HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pmm2monitor.cxx
Go to the documentation of this file.
1 //
2 // Demo code for harpo analyse framework in C++ and Root
3 //
4 
5 #include <stdlib.h>
6 #include <stdio.h>
7 
8 #include "HarpoConfig.h"
9 #include "HarpoReader.h"
10 #include "HarpoRunHeader.h"
12 
13 #include "TROOT.h"
14 #include "TStyle.h"
15 #include "TApplication.h"
16 
17 int main(int argc, char **argv)
18 {
19  Long_t processed = -1; // Processed events counter , negative on error
20 
21  HarpoRunHeader *hdr;
22  //HarpoEvent *hevent;
23  // gDebug = 1;
24  HarpoConfig *cfg = new HarpoConfig(argc,argv);
25  cfg->Init();
26 
27  cfg->print();
28 
29  HarpoReader *rdr = new HarpoReader( cfg );
30 
31  if ( rdr->Init(hNoCMPTime) ) {
32  hdr = rdr->GetRunHeader();
33  hdr->print();
34  }
35  else
36  {
37  printf ("Int ERROR exiting ...\n");
38  return 1;
39  }
40 
41  Long64_t display = 0;
42  gHConfig->Lookup("monitor.displayPmm2",display);
43  TApplication *theApp = 0;
44  if(display>0){
45  theApp = new TApplication("App", &argc, argv);
46  gROOT->SetStyle("Plain"); gStyle->SetPalette(1);
47  }
48  //theApp->Run();
49 
51 
52  hana-> Init(); // if errors ???
53 
54  rdr->SetAnalyseFunction(hana);
55 
56  //if ( rdr->NextEvent() ) printf("\n Next Event OK\n");
57  processed = rdr->LoopAll();
58 
59  hana->Save();
60  printf("\n Done processed Events %li\n",processed);
61 
62  if(display>0)
63  theApp->Run();
64 
65  delete hana;
66  delete rdr;
67  delete cfg;
68 
69  return 0;
70 }
71 
72 
73 
Monitor Pmm2 data for online GUI.
Bool_t Init(hReadMode mode=hSyncTime)
Definition: HarpoReader.h:73
A class hold HARPO run iformation.
A class which instantiate the real top level reader.
Definition: HarpoReader.h:33
Long_t LoopAll()
Read errors.
Definition: HarpoReader.h:79
void Init()
Definition: HarpoConfig.h:63
int main(int argc, char **argv)
Definition: pmm2monitor.cxx:17
void SetAnalyseFunction(HarpoAnalyse *func, Int_t i=0)
Definition: HarpoReader.h:51
Bool_t Lookup(const char *path, Bool_t &val)
Lookup function for scalar values.
void print() const
Read config file in libconfig format.
HarpoConfig * gHConfig
HarpoRunHeader * GetRunHeader()
Definition: HarpoReader.h:70
A class which keeps track of the entire configuration of the analysis.
Definition: HarpoConfig.h:50