HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
hmonitoroffline.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"
11 #include "HarpoAnalyseBasic.h"
12 #include "TROOT.h"
13 #include "TStyle.h"
14 #include "TApplication.h"
15 
16 int main(int argc, char **argv)
17 {
18  Long_t processed = -1; // Processed events counter , negative on error
19 
20  //HarpoRunHeader *hdr;
21  //HarpoEvent *hevent;
23 
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() ) {
32  //hdr = rdr->GetRunHeader();
33  // hdr->print();
34  }
35  else
36  {
37  printf ("Int ERROR exiting ...\n");
38  return 1;
39  }
40 
41  TApplication *theApp = new TApplication("App", &argc, argv);
42  gROOT->SetStyle("Plain"); gStyle->SetPalette(1);
43  // gROOT->Macro("Harpo2D.C");
44  // gROOT->Macro("HarpoStyle.C");
45  // theApp->Run();
46 
48  hana-> Init();
49 
50  rdr->SetAnalyseFunction(hana);
51 
52  //if ( rdr->NextEvent() ) printf("\n Next Event OK\n");
53  processed = rdr->LoopAll();
54 
55  hana->Save();
56  delete hana;
57  delete rdr;
58  delete cfg;
59  printf("\n Done processed Events %li\n",processed);
60 
61  // theApp->Run();
62 
63  delete theApp;
64  return 0;
65 }
66 
67 
Bool_t Init(hReadMode mode=hSyncTime)
Definition: HarpoReader.h:73
A class which instantiate the real top level reader.
Definition: HarpoReader.h:33
Long_t LoopAll()
Read errors.
Definition: HarpoReader.h:79
void Save(char *mode=NULL)
void Init()
Definition: HarpoConfig.h:63
void SetAnalyseFunction(HarpoAnalyse *func, Int_t i=0)
Definition: HarpoReader.h:51
int main(int argc, char **argv)
Harpo Event Simulation.
Definition: HarpoConfig.h:32
void print() const
Read config file in libconfig format.
Basic HARPO Event Analysis code. "Offline monitoring".
static hReaderType gHReaderType
Reader Type.
Definition: HarpoConfig.h:179
A class which keeps track of the entire configuration of the analysis.
Definition: HarpoConfig.h:50