HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
hdrawevent.cxx
Go to the documentation of this file.
1 #include "HarpoReader.h"
2 #include "HarpoConfig.h"
3 #include "HarpoDccMap.h"
4 #include "HarpoEvent.h"
5 //#include "HarpoRecoMonitorGui.h"
6 #include "HarpoTools.h"
7 
8 #include "MakeNiceHisto.h"
9 
10 #include "TH2F.h"
11 #include "TLatex.h"
12 #include "TLine.h"
13 #include "TH2F.h"
14 #include "TStyle.h"
15 #include "TApplication.h"
16 #include "TSystem.h"
17 
18 #include <fstream>
19 #include <iostream>
20 
21 
22 void DrawEvent(HarpoReader* reader, Int_t nevent);
23 
24 int main(int argc, char** argv)
25 {
26 
27  TApplication* theApp = 0;
28  gStyle->SetOptStat(0);
29 
30  HarpoConfig *cfg = new HarpoConfig(argc,argv,0x17);
31  Bool_t bw = kFALSE;
32 
33  // Philippe use verbose flag to distinguish interactive and batch modes
34  if(cfg->GetVerbose()>1)
35  theApp = new TApplication("App", 0, 0);
36  if(cfg->GetVerbose()>0){
37  cout << "Black and White" << endl;
38  bw = kTRUE;
39  }
40  // Int_t run = cfg->GetRunNo();
41  Int_t nevent = cfg->GetNEvent();
42 
43  cfg->Init();
44  cfg->print();
45 
46  HarpoReader* reader = new HarpoReader( cfg );
47  HarpoRunHeader *hdr;
48  if ( reader->Init(hSyncTime) ) {
49  hdr = reader->GetRunHeader();
50  }else{
51  printf ("Int ERROR exiting ...\n");
52  return 0;
53  }
54 
55  Bool_t test = reader->Find(nevent);
56  HarpoEvent* event;
57  if(test)
58  event = reader->GetEvent();
59  else{
60  printf("Could not find event %d",nevent);
61  return 0;
62  }
63 
64  // TApplication *theApp = new TApplication("App", 0, 0);
65  gROOT->SetStyle("Plain");
66  gStyle->SetPalette(1);
67 
68  TString* outdirname = cfg->GetOutFile();
69  if(outdirname == NULL)
70  outdirname = new TString("./");
71  HarpoTools::SaveEvent(event,outdirname->Data(),hdr,bw);
72 
73 
74  if(cfg->GetVerbose()>1)
75  theApp->Run();
76  return 0;
77 }
Long_t Find(Long_t eventNo)
Find raw event by event number.
Definition: HarpoReader.h:82
TString * GetOutFile()
Get Output root file name.
Definition: HarpoConfig.h:98
Bool_t Init(hReadMode mode=hSyncTime)
Definition: HarpoReader.h:73
A class hold HARPO run iformation.
TCanvas * SaveEvent(HarpoEvent *evt, const char *dirname, HarpoRunHeader *rh, Bool_t bw=0)
A class which instantiate the real top level reader.
Definition: HarpoReader.h:33
void Init()
Definition: HarpoConfig.h:63
HarpoEvent * GetEvent()
Definition: HarpoReader.h:68
Long64_t GetNEvent()
Get Event number with we looking for.
Definition: HarpoConfig.h:124
int main(int argc, char **argv)
Definition: hdrawevent.cxx:24
void print() const
Read config file in libconfig format.
A class store HARPO row event data and header. Provide access metods to the row event data...
Definition: HarpoEvent.h:29
void DrawEvent(HarpoReader *reader, Int_t nevent)
HarpoRunHeader * GetRunHeader()
Definition: HarpoReader.h:70
A class which keeps track of the entire configuration of the analysis.
Definition: HarpoConfig.h:50
Long64_t GetVerbose()
Get program verbosity level.
Definition: HarpoConfig.h:115