HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
hana.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 "HarpoAnalysePmm2Monitor.h"
12 #include "HarpoAnalysePrf.h"
13 #include "HarpoAnalyseTemplate.h"
14 #include "HarpoAnalyseMonitorGui.h"
15 
16 #include "TROOT.h"
17 #include "TStyle.h"
18 #include "TApplication.h"
19 
20 int main(int argc, char **argv)
21 {
22  Long_t processed = -1; // Processed events counter , negative on error
23 
25 
26 
27  HarpoRunHeader *hdr;
28  //HarpoEvent *hevent;
29  // gDebug = 1;
30  HarpoConfig *cfg = new HarpoConfig(argc,argv);
31  cfg->Init();
32 
33  cfg->print();
34 
35  HarpoReader *rdr = new HarpoReader( cfg );
36 
37  if ( rdr->Init(hNoCMPTime) ) {
38  hdr = rdr->GetRunHeader();
39  hdr->print();
40  }
41  else
42  {
43  printf ("Int ERROR exiting ...\n");
44  return 1;
45  }
46 
47  // TApplication *theApp = new TApplication("App", &argc, argv);
48  gROOT->SetStyle("Plain");
49  gStyle->SetPalette(1);
50 
51  // theApp->Run();
52 
54 //HarpoAnalysePrf *hana = new HarpoAnalysePrf();
55  // HarpoAnalyseMonitorGui *hana = new HarpoAnalyseMonitorGui();
56 
57  hana-> Init(); // if errors ???
58 
59  rdr->SetAnalyseFunction(hana);
60 
61  //if ( rdr->NextEvent() ) printf("\n Next Event OK\n");
62  processed = rdr->LoopAll();
63 
64  hana->Save();
65  printf("\n Done processed Events %li\n",processed);
66 
67  //theApp->Run();
68 
69  delete hana;
70  delete rdr;
71  delete cfg;
72 
73  return 0;
74 }
75 
76 
77 
int main(int argc, char **argv)
Definition: hana.cxx:20
Dummy analysis to run as test and example. Give basic histograms of the data.
Bool_t Init(hReadMode mode=hSyncTime)
Definition: HarpoReader.h:73
void Save(char *mode=NULL)
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
void SetAnalyseFunction(HarpoAnalyse *func, Int_t i=0)
Definition: HarpoReader.h:51
Harpo Event Simulation.
Definition: HarpoConfig.h:32
void print() const
Read config file in libconfig format.
static hReaderType gHReaderType
Reader Type.
Definition: HarpoConfig.h:179
HarpoRunHeader * GetRunHeader()
Definition: HarpoReader.h:70
A class which keeps track of the entire configuration of the analysis.
Definition: HarpoConfig.h:50