HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HarpoReaderBase.cxx
Go to the documentation of this file.
1 //
2 // File HarpoReaderBase.cxx
3 //
10 #include "HarpoReaderBase.h"
11 #include "HarpoDetReader.h"
12 #include "HarpoConfig.h"
13 #include "HarpoRunHeader.h"
14 #include "HarpoEvent.h"
15 #include "HarpoTimeStamp.h"
16 
17 #include "HarpoDccReader.h"
18 #include "HarpoSimReader.h"
19 
20 #include <climits>
21 #include <cstdio>
22 #include <arpa/inet.h>
23 //#include <cstdlib>
24 //#include <cstring>
25 #include <iostream>
26 
27 
28 ClassImp(HarpoReaderBase)
29 
30 
36 {
37  if(gHarpoDebug>0) Info("HarpoReaderBase()"," ");
38 
39  fRunNo = 0;
40  fNevts = 0;
41  fDone = false;
42  fError = false;
43  fMaxEvents = LONG_MAX;
44 
45  fNanalyses = 0;
46 
47  fDetReader = new HarpoDetReader *[gkNDetectors]; //Pointers to readers
48 
49  fEvent = (HarpoEvent *) NULL;
50  fEventHeader = (HarpoEventHeader *) NULL;
51  fRunHeader = (HarpoRunHeader *) NULL;
52 
53  //fAnalyse = (HarpoAnalyse *) NULL;
54  //fAnalyse = (HarpoAnalyse *) NULL;
55  // fAnalyse.reserve(10);
56  fDetSet = HarpoDetSet::Instance();
57 }
58 
60 
65  if(gHarpoDebug>0) Info("HarpoReaderBase(cfg)"," ");
66  // Config Function
67  fRunNo = 0;
68  fNevts = 0;
69 
70  fNanalyses = 0;
71 
72  fDone = false;
73  fError = false;
74 
75  fDetReader = new HarpoDetReader *[gkNDetectors]; //Pointers to readers
76 
77  fMaxEvents = cfg->GetMaxEvents();
78  fRunNo = cfg->GetRunNo();
79  fFirstEvent = cfg->GetFromEvent();
80 
81  fEvent = (HarpoEvent *) NULL;
82  fEventHeader = (HarpoEventHeader *) NULL;
83  fRunHeader = (HarpoRunHeader *) NULL;
84 
85  // fAnalyse = (HarpoAnalyse *) NULL;
86  //fAnalyse.reserve(10);
87 
89 
90 }
91 
93 {
94  if(gHarpoDebug>0) Info("~HarpoReaderBase()"," ");
95  delete [] fDetReader;
96 }
97 
99 {
100  if(gHarpoDebug>0) Info("SetAnalyseFunction"," ");
101  if(i<=fNanalyses) {
102  fAnalyse[i] = func;
103  } else {
104  Warning(__FUNCTION__,
105  "Attempt to Set Analyse %d with %d defined, skeeping\n",
106  i,fNanalyses);
107  }
108 
109  if(( i==fNanalyses) && (fNanalyses < 29))
110  fNanalyses++;
111  else
112  {
113  Warning(__FUNCTION__,
114  "NO Spasce inAnalyses Array %d\n",fNanalyses);
115  }
116  // if ( fNanalyses == fAnalyse.size() ) {
117  // if(gHarpoDebug>0) Info(__FUNCTION__,"fAnalyse new size %d\n",(fNanalyses * 2));
118  // fAnalyse.resize(fNanalyses * 2);
119  //}
120 }
121 
123 {
124  if(gHarpoDebug>0) Info("SetAnalyseFunction"," ");
125 
126  if ( fNanalyses < 29 ) {
127  fAnalyse[fNanalyses] = func;
128  fNanalyses++;
129  } else {
130  Warning(__FUNCTION__,
131  "NO Spasce in Analyses Array %d\n",fNanalyses);
132  }
133 
134  // if ( fNanalyses == fAnalyse.size() ) {
135  // if(gHarpoDebug>0) Info(__FUNCTION__,"fAnalyse new size %d\n",(fNanalyses * 2));
136  // fAnalyse.resize(fNanalyses * 2);
137  //}
138 }
139 
140 
142 {
143  Long_t maxevents = fMaxEvents;
144  if(gHarpoDebug>0) Info("Loop", "maxevents = %ld",maxevents);
145  return Loop(maxevents);
146 }
147 
HarpoRunHeader * fRunHeader
virtual void AddAnalyseFunction(HarpoAnalyse *func)
virtual ~HarpoReaderBase()
static HarpoDetSet * Instance()
Definition: HarpoDetSet.cxx:20
Long64_t GetRunNo()
Set Run Number.
Definition: HarpoConfig.h:127
Long_t fRunNo
Number of readed events.
A virtual class which define intrafece between HARPO Reader and Event Analysis code.
Definition: HarpoAnalyse.h:47
virtual Long_t LoopAll()
Read errors.
A class hold HARPO run iformation.
HarpoAnalyse * fAnalyse[30]
FullEvent Header not scecific to the detectors The class is ....
A virtual base class for all HARPO detectors readers.
A base class for all top level HARPO readers.
virtual Long_t Loop(Long_t maxevents)=0
virtual void SetAnalyseFunction(HarpoAnalyse *func, Int_t i=0)
Long64_t gHarpoDebug
Definition: HarpoDebug.cxx:9
Long64_t GetFromEvent()
Get First Event to process.
Definition: HarpoConfig.h:120
A class store HARPO row event data and header. Provide access metods to the row event data...
Definition: HarpoEvent.h:29
HarpoEvent * fEvent
const ULong_t gkNDetectors
Definition: HarpoDet.h:14
A class which keeps track of the entire configuration of the analysis.
Definition: HarpoConfig.h:50
HarpoDetReader ** fDetReader
HarpoDetSet * fDetSet
HarpoEventHeader * fEventHeader
Long64_t GetMaxEvents()
Get Max Event for prosess.
Definition: HarpoConfig.h:118