testFDasEventFile.cc
Go to the documentation of this file.
1 
11 #include <io/FDasEventFile.h>
12 #include <evt/Event.h>
13 
14 #include <fwk/CentralConfig.h>
15 #include <det/Detector.h>
16 
17 #include <iostream>
18 #include <utl/Trace.h>
19 #include <utl/Photon.h>
20 #include <utl/TimeStamp.h>
21 #include <utl/UTCDateTime.h>
22 #include <utl/ErrorLogger.h>
23 #include <fevt/FEvent.h>
24 #include <fevt/Eye.h>
25 #include <fevt/Telescope.h>
26 #include <fevt/Channel.h>
27 #include <fevt/Pixel.h>
28 #include <fevt/ChannelSimData.h>
29 #include <fevt/PixelSimData.h>
30 #include <fevt/PixelRecData.h>
31 
32 #include <AugerEvent.h>
33 #include <EyeEvent.hh>
34 
35 #include <boost/filesystem/operations.hpp>
36 #include <boost/filesystem/path.hpp>
37 
38 namespace fs = boost::filesystem;
39 using namespace std;
40 using namespace io;
41 using namespace utl;
42 using namespace evt;
43 using namespace fevt;
44 using namespace det;
45 
46 
47 #define PRINTFADCTRACES 0
48 
49 
50 void Dump(const FEvent& fevent);
51 
52 
53 int
54 main(int /*argc*/, char* argv[])
55 {
56  ErrorLogger::GetInstance().SetVerbosity(Verbosity::eVerbose);
57 
58  // Set up the detector description
59  fwk::CentralConfig::GetInstance(BOOTSTRAPFILE);
60 
61  TimeStamp theTime = UTCDateTime(2002,4,10).GetTimeStamp();
62  det::Detector::GetInstance().Update(theTime);
63  cout << endl << "Starting " << argv[0] << endl << endl;
64 
65  string theInputFilename = TESTFILE;
66 
67  FDasEventFile file(theInputFilename, io::eRead);
68 
69  evt::Event event;
70 
71  file.Read(event);
72 
73  AugerEvent& rawevent = event.GetRawEvent();
74 
75  for (AugerEvent::EyeIterator it = rawevent.EyesBegin();
76  it != rawevent.EyesEnd(); ++it)
77  it->Dump();
78 
79  cout << " done" << endl;
80 }
81 
82 
83 /* This test has to be rewritten , sa
84 void Dump(const FEvent& fevent){
85  cout << endl;
86  cout << " ******* Now starting readback *********" << endl;
87  cout << endl;
88 
89 // iterate over eyes
90 
91  FEvent::ConstEyeIterator iter;
92  for (iter = fevent.EyesBegin(); iter != fevent.EyesEnd();iter++){
93 
94  Eye& eye = *iter;
95 
96 // iterate over telescopes
97 
98  Eye::ConstTelescopeIterator teliter;
99 
100  for (teliter = eye.TelescopesBegin();
101  teliter!=eye.TelescopesEnd(); teliter++){
102 
103  Telescope& tel = *teliter;
104 
105  if (tel.HasTriggerData()) {
106 
107  TelescopeTriggerData& trig = tel.GetTriggerData();
108 
109 //#define PRINTSLT 1
110 
111 
112  for (int a=1; a<= 440 ; a++){
113 
114  for (unsigned int i=0; i< TelescopeTriggerData::GetNTriggerBins(); i++){
115  int dummy = trig.HasFLT(i,a);
116 #if PRINSLT
117  cout << dummy;
118 #endif
119  }
120 #if PRINSLT
121  cout << endl;
122 #endif
123  }
124 
125  }
126 
127  Telescope::ConstChannelIterator chiter;
128 
129 // iterate over channels
130 
131  for (chiter = tel.ChannelsBegin();
132  chiter != tel.ChannelsEnd(); chiter++){
133  Channel& ch = *chiter;
134 
135 #if PRINTFADCTRACES
136  cout << endl;
137  cout << "Examining channel "<< ch.GetId()
138  << " Tel " << ch.GetTelescopeId()
139  << " Eye " << ch.GetEyeId()<< endl;
140 
141 #else
142  ;
143 #endif
144 
145 // retrieve raw fadc trace
146 
147  if (!ch.HasRawData()){ERROR("Raw Data not found");exit(1);}
148  ChannelRawData& rawdata= ch.GetRawData();
149 
150  if (!rawdata.HasFADCTrace()){ERROR("Raw FADC not found");exit(1);}
151 
152 
153  TraceI& rawtrace = rawdata.GetFADCTrace();
154 
155 #if PRINTFADCTRACES
156  cout << " raw fadc values: " ;
157 #endif
158 
159  for (unsigned int i = rawtrace.GetStart(); i<= rawtrace.GetStop(); i++ )
160 #if PRINTFADCTRACES
161  cout << "[" << i<< "]" << rawtrace[i]<< " " ;
162 
163  cout << endl;
164 
165 #else
166  int a=rawtrace[i] ;
167 #endif
168 
169 
170  }// loop on channels
171 
172  cout << endl;
173 
174 // iterate over pixel
175 
176  Telescope::ConstPixelIterator pixiter;
177 
178  for (pixiter = tel->PixelsBegin(); pixiter != tel->PixelsEnd(); pixiter++){
179 
180  Pixel * pix = *pixiter;
181  cout << endl;
182  cout << "Examining pixel "<< pix->GetId() << " Tel " << pix->GetTelescopeId() << " Eye " \
183  << pix->GetEyeId()<< endl;
184 
185 // retrieve reconstructed photon trace
186 
187  TraceD * recph = pix->GetRecData()->GetPhotonTrace();
188 
189  cout << " reconstructed photons: " ;
190 
191  for (int i = recph->GetStart(); i<= recph->GetStop(); i++ )
192  cout << "[" << i<< "]" << (*recph)[i]<< " " ;
193 
194  cout <<endl;
195 
196 // retrieve reconstructed Fluorescence pulse information
197 
198  cout << " Pulse Start "<< pix->GetRecData()->GetPulseStart();
199  cout << " Pulse Stop "<< pix->GetRecData()->GetPulseStop();
200  cout << " Charge " << pix->GetRecData()->GetTotalCharge();
201  cout << endl;
202 
203 // retrieve Mie scattered component of reconstructed photon trace
204 
205  TraceD * recphScat = pix->GetRecData()->GetPhotonTrace(Telescope::eMieScattered);
206 
207  cout << " reconstructed photons Mie Scattered: " ;
208 
209  for (int i = recphScat->GetStart(); i<= recphScat->GetStop(); i++ )
210  cout << "[" << i<< "]" << (*recphScat)[i]<< " " ;
211 
212  cout << endl;
213 
214 // retrieve simuated photon trace
215 
216  TraceD * simph = pix->GetSimData()->GetPhotonTrace();
217 
218  cout << " Simulated photons: " ;
219 
220  for (int i = simph->GetStart(); i<= simph->GetStop(); i++ )
221  cout << "[" << i<< "]" << (*simph)[i]<< " " ;
222  cout << endl;
223 
224 // retrieve direct component of simulated photon trace
225 
226  TraceD * simphDir = pix->GetSimData()->GetPhotonTrace(Telescope::eDirect);
227  cout << " Simulated photons Direct component: " ;
228 
229 
230  for (int i = simphDir->GetStart(); i<= simphDir->GetStop(); i++ )
231  cout << "[" << i<< "]" << (*simphDir)[i]<< " " ;
232  cout << "" <<endl;
233 
234  }// loop on pixels
235 
236  }// loop on telescopes
237 
238  }// loop on eyes
239 
240 
241 }
242 
243 */
244 
245 // Local Variables:
246 // mode:c++
247 // compile-command: "make -C .. testFDasEventFile -k"
248 // End:
Status Read(evt::Event &event) override
clear /par event read current event advance cursor by 1
Traditional name.
Definition: Verbosity.h:17
A TimeStamp holds GPS second and nanosecond for some event.
Definition: TimeStamp.h:110
int main(int argc, char *argv[])
Definition: DBSync.cc:58
Top of Fluorescence Detector event hierarchy.
Definition: FEvent.h:33
const string file
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
void Dump(const FEvent &fevent)
Interface for FDAS file reading.
Definition: FDasEventFile.h:24
TimeStamp GetTimeStamp() const
Definition: UTCDateTime.cc:115

, generated on Tue Sep 26 2023.