1 | // AIDA analysis program over ELYSE.root file. |
---|
2 | |
---|
3 | // AIDA : |
---|
4 | #include <AIDA/AIDA.h> |
---|
5 | #include <AIDA/ITupleEntry.h> |
---|
6 | |
---|
7 | // std : |
---|
8 | #include <iostream> |
---|
9 | |
---|
10 | // Lib : |
---|
11 | #include <Lib/smanip.h> |
---|
12 | |
---|
13 | ////////////////////////////////////////////////////////////////////////////// |
---|
14 | AIDA::ITuple* cast_Tuple( |
---|
15 | AIDA::ITupleEntry* aEntry |
---|
16 | ) |
---|
17 | ////////////////////////////////////////////////////////////////////////////// |
---|
18 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
19 | { |
---|
20 | //FIXME : CINT can't handle dynamic_cast : |
---|
21 | //return (AIDA::ITuple*)aEntry->cast("AIDA::ITuple"); |
---|
22 | |
---|
23 | return dynamic_cast<AIDA::ITuple*>(aEntry); |
---|
24 | } |
---|
25 | ////////////////////////////////////////////////////////////////////////////// |
---|
26 | bool get_XYZ( |
---|
27 | AIDA::ITuple& aParent |
---|
28 | ,int aColumn |
---|
29 | ,double& aX |
---|
30 | ,double& aY |
---|
31 | ,double& aZ |
---|
32 | ) |
---|
33 | ////////////////////////////////////////////////////////////////////////////// |
---|
34 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
35 | { |
---|
36 | AIDA::ITupleEntry* entry = (AIDA::ITupleEntry*)aParent.getObject(aColumn); |
---|
37 | if(!entry) return false; |
---|
38 | |
---|
39 | AIDA::ITuple* tuple = cast_Tuple(entry); |
---|
40 | if(!tuple) return false; |
---|
41 | |
---|
42 | tuple->start(); |
---|
43 | if(!tuple->next()) return false; |
---|
44 | |
---|
45 | aX = tuple->getDouble(0); |
---|
46 | aY = tuple->getDouble(1); |
---|
47 | aZ = tuple->getDouble(2); |
---|
48 | |
---|
49 | return true; |
---|
50 | } |
---|
51 | ////////////////////////////////////////////////////////////////////////////// |
---|
52 | ////////////////////////////////////////////////////////////////////////////// |
---|
53 | ////////////////////////////////////////////////////////////////////////////// |
---|
54 | bool dump_tracks( |
---|
55 | AIDA::ITuple& aParent |
---|
56 | ) |
---|
57 | ////////////////////////////////////////////////////////////////////////////// |
---|
58 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
59 | { |
---|
60 | AIDA::ITupleEntry* entry = (AIDA::ITupleEntry*)aParent.getObject(8); |
---|
61 | if(!entry) return false; |
---|
62 | |
---|
63 | AIDA::ITuple* tuple = cast_Tuple(entry); |
---|
64 | if(!tuple) return false; |
---|
65 | |
---|
66 | //if(nPart!=tracks->rows()) { |
---|
67 | // std::cout << "read: nPart / tracks mismatch " |
---|
68 | // << nPart << " " << tracks->rows() << std::endl; |
---|
69 | // return false; |
---|
70 | //} |
---|
71 | |
---|
72 | tuple->start(); |
---|
73 | int irow = 0; |
---|
74 | while(tuple->next()) { |
---|
75 | |
---|
76 | int pId = tuple->getInt(0); |
---|
77 | int parent = tuple->getInt(1); |
---|
78 | float timeStart = tuple->getFloat(2); |
---|
79 | |
---|
80 | double dx,dy,dz; |
---|
81 | if(!get_XYZ(*tuple,3,dx,dy,dz)) return false; |
---|
82 | |
---|
83 | double mass = tuple->getDouble(4); |
---|
84 | double pTot = tuple->getDouble(5); |
---|
85 | double ETot = tuple->getDouble(6); |
---|
86 | |
---|
87 | double px,py,pz; |
---|
88 | if(!get_XYZ(*tuple,7,px,py,pz)) return false; |
---|
89 | |
---|
90 | double start_x,start_y,start_z; |
---|
91 | if(!get_XYZ(*tuple,8,start_x,start_y,start_z)) return false; |
---|
92 | |
---|
93 | double stop_x,stop_y,stop_z; |
---|
94 | if(!get_XYZ(*tuple,9,stop_x,stop_y,stop_z)) return false; |
---|
95 | |
---|
96 | int startVol = tuple->getInt(10); |
---|
97 | int stopVol = tuple->getInt(11); |
---|
98 | |
---|
99 | std::cout << "----> Tk{"<<irow<<"}: " |
---|
100 | << " pId " << pId |
---|
101 | << " parent " << parent |
---|
102 | << " creation time " << timeStart |
---|
103 | << " Volumes " << startVol << " " << stopVol << "\n" |
---|
104 | << " Start Pos (" << start_x |
---|
105 | << "," << start_y << "," << start_z << ")\n" |
---|
106 | << " Stop Pos (" << stop_x |
---|
107 | << "," << stop_y << "," << stop_z << ")\n" |
---|
108 | << " dx,dy,dz " << dx << " " << dy << " " << dz << "\n" |
---|
109 | << " m " << mass |
---|
110 | << " ETot " << ETot |
---|
111 | << " pTot " << pTot |
---|
112 | << " px,py,pz " << px << " " << py << " " << pz << "\n" |
---|
113 | << std::endl; |
---|
114 | |
---|
115 | irow++; |
---|
116 | } |
---|
117 | return true; |
---|
118 | } |
---|
119 | ////////////////////////////////////////////////////////////////////////////// |
---|
120 | bool process_hits_times( |
---|
121 | AIDA::ITuple& aParent |
---|
122 | ,AIDA::IHistogram1D& aHisto |
---|
123 | ) |
---|
124 | ////////////////////////////////////////////////////////////////////////////// |
---|
125 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
126 | { |
---|
127 | AIDA::ITupleEntry* entry = (AIDA::ITupleEntry*)aParent.getObject(2); |
---|
128 | if(!entry) return false; |
---|
129 | |
---|
130 | AIDA::ITuple* tuple = cast_Tuple(entry); |
---|
131 | if(!tuple) return false; |
---|
132 | |
---|
133 | tuple->start(); |
---|
134 | while(tuple->next()) { |
---|
135 | |
---|
136 | float time = tuple->getFloat(0); |
---|
137 | |
---|
138 | aHisto.fill(time); |
---|
139 | } |
---|
140 | return true; |
---|
141 | } |
---|
142 | ////////////////////////////////////////////////////////////////////////////// |
---|
143 | bool process_hits( |
---|
144 | AIDA::ITuple& aParent |
---|
145 | ,AIDA::IHistogram1D& aHisto |
---|
146 | ) |
---|
147 | ////////////////////////////////////////////////////////////////////////////// |
---|
148 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
149 | { |
---|
150 | AIDA::ITupleEntry* entry = (AIDA::ITupleEntry*)aParent.getObject(10); |
---|
151 | if(!entry) return false; |
---|
152 | |
---|
153 | AIDA::ITuple* tuple = cast_Tuple(entry); |
---|
154 | if(!tuple) return false; |
---|
155 | |
---|
156 | tuple->start(); |
---|
157 | while(tuple->next()) { |
---|
158 | |
---|
159 | //int tubeId = tuple->getInt(0); |
---|
160 | //int totalPE = tuple->getInt(1); |
---|
161 | |
---|
162 | if(!process_hits_times(*tuple,aHisto)) return false; |
---|
163 | } |
---|
164 | return true; |
---|
165 | } |
---|
166 | ////////////////////////////////////////////////////////////////////////////// |
---|
167 | bool process_digits( |
---|
168 | AIDA::ITuple& aParent |
---|
169 | ,AIDA::IHistogram2D& aHisto |
---|
170 | ) |
---|
171 | ////////////////////////////////////////////////////////////////////////////// |
---|
172 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
173 | { |
---|
174 | AIDA::ITupleEntry* entry = (AIDA::ITupleEntry*)aParent.getObject(13); |
---|
175 | if(!entry) return false; |
---|
176 | |
---|
177 | AIDA::ITuple* tuple = cast_Tuple(entry); |
---|
178 | if(!tuple) return false; |
---|
179 | |
---|
180 | tuple->start(); |
---|
181 | while(tuple->next()) { |
---|
182 | |
---|
183 | //int tubeId = tuple->getInt(0); |
---|
184 | double pe = tuple->getDouble(1); |
---|
185 | double time = tuple->getDouble(2); |
---|
186 | //printf("debug : ++++ : %g %g\n",time,pe); |
---|
187 | |
---|
188 | aHisto.fill(time,pe); |
---|
189 | } |
---|
190 | return true; |
---|
191 | } |
---|
192 | ////////////////////////////////////////////////////////////////////////////// |
---|
193 | void set_region_style( |
---|
194 | AIDA::IPlotterRegion& aRegion |
---|
195 | ) |
---|
196 | ////////////////////////////////////////////////////////////////////////////// |
---|
197 | // Taken from G4SPL_analysis.cxx. |
---|
198 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
199 | { |
---|
200 | //FIXME : have to do the below with AIDA styles. |
---|
201 | |
---|
202 | // ROOT is in NDC, then we take a plotter with width = height = 1 |
---|
203 | |
---|
204 | // PAW : |
---|
205 | //float XSIZ = 20.0F; |
---|
206 | //float XLAB = 1.4F; |
---|
207 | //float YSIZ = 20.0F; |
---|
208 | //float YLAB = 1.4F; |
---|
209 | |
---|
210 | float XLAB = 1.4F/20.0F; //0.07 //x distance of y title to data frame. |
---|
211 | float YLAB = 0.8F/20.0F; //0.04 //y distance of x title to data frame. |
---|
212 | YLAB = 0.05F; //FIXME : cooking. |
---|
213 | |
---|
214 | // To have a good matching with ROOT for text size : |
---|
215 | //double majic = 0.014/0.027; |
---|
216 | double majic = 0.6; |
---|
217 | std::string s = Lib::smanip::tostring(majic); |
---|
218 | //FIXME : have methods for the below : |
---|
219 | aRegion.style().setParameter("textScale",s); |
---|
220 | aRegion.style().xAxisStyle().setParameter("magStyle.scale",s); |
---|
221 | aRegion.style().yAxisStyle().setParameter("magStyle.scale",s); |
---|
222 | aRegion.style().xAxisStyle().tickLabelStyle().setParameter("scale",s); |
---|
223 | aRegion.style().xAxisStyle().labelStyle().setParameter("scale",s); |
---|
224 | aRegion.style().yAxisStyle().tickLabelStyle().setParameter("scale",s); |
---|
225 | aRegion.style().yAxisStyle().labelStyle().setParameter("scale",s); |
---|
226 | |
---|
227 | // ROOT def margins 0.1. SoPlotter def 0.1. |
---|
228 | aRegion.layout().setParameter("rightMargin",0.1); |
---|
229 | aRegion.layout().setParameter("topMargin",0.1); |
---|
230 | //gStyle->SetPadBottomMargin(0.15); |
---|
231 | aRegion.layout().setParameter("leftMargin",0.15); |
---|
232 | //gStyle->SetPadLeftMargin(0.15); |
---|
233 | aRegion.layout().setParameter("bottomMargin",0.15); |
---|
234 | |
---|
235 | aRegion.style().setParameter("superposeBins","TRUE"); |
---|
236 | aRegion.setParameter("plotter.wallStyle.visible","FALSE"); |
---|
237 | aRegion.setParameter("plotter.gridStyle.visible","FALSE"); |
---|
238 | |
---|
239 | //std::string font = "Hershey"; //PAW font. |
---|
240 | //std::string font = "TTF/arialbd"; //Default ROOT font 62. |
---|
241 | //std::string font = "TTF/couri"; |
---|
242 | std::string font = "TTF/times"; //= ROOT 132 ? |
---|
243 | //std::string smoothing = "FALSE"; |
---|
244 | std::string smoothing = "TRUE"; |
---|
245 | |
---|
246 | // X axis : |
---|
247 | aRegion.style().xAxisStyle().tickLabelStyle().setFont(font); |
---|
248 | aRegion.style().xAxisStyle().tickLabelStyle().setParameter("smoothing",smoothing); |
---|
249 | aRegion.style().xAxisStyle().labelStyle().setFont(font); |
---|
250 | aRegion.style().xAxisStyle().labelStyle().setParameter("smoothing",smoothing); |
---|
251 | aRegion.setParameter("plotter.xAxis.magStyle.fontName",font); |
---|
252 | aRegion.setParameter("plotter.xAxis.magStyle.smoothing",smoothing); |
---|
253 | aRegion.style().xAxisStyle().lineStyle().setThickness(2); |
---|
254 | aRegion.setParameter("plotter.xAxis.ticksStyle.width","2"); |
---|
255 | aRegion.style().setParameter("topAxisVisible","TRUE"); |
---|
256 | // Set hplot tick modeling : |
---|
257 | aRegion.style().xAxisStyle().setParameter("modeling","hplot"); |
---|
258 | aRegion.style().xAxisStyle().setParameter("divisions","505"); |
---|
259 | |
---|
260 | // Y axis : |
---|
261 | //aRegion.style().setParameter("yAxisLogScale","TRUE"); |
---|
262 | aRegion.style().yAxisStyle().tickLabelStyle().setFont(font); |
---|
263 | aRegion.style().yAxisStyle().tickLabelStyle().setParameter("smoothing",smoothing); |
---|
264 | aRegion.style().yAxisStyle().labelStyle().setFont(font); |
---|
265 | aRegion.style().yAxisStyle().labelStyle().setParameter("smoothing",smoothing); |
---|
266 | aRegion.setParameter("plotter.yAxis.magStyle.fontName",font); |
---|
267 | aRegion.setParameter("plotter.yAxis.magStyle.smoothing",smoothing); |
---|
268 | aRegion.style().yAxisStyle().lineStyle().setThickness(2); |
---|
269 | aRegion.setParameter("plotter.yAxis.ticksStyle.width","2"); |
---|
270 | |
---|
271 | //gStyle->SetTitleSize(0.06,"XYZ"); //ROOT def 0.04. SoPlotter : 0.014 |
---|
272 | aRegion.setParameter("plotter.xAxis.titleHeight","0.06"); |
---|
273 | aRegion.setParameter("plotter.yAxis.titleHeight","0.06"); |
---|
274 | //gStyle->SetLabelOffset(0.01,"Y"); //ROOT def 0.005. SoPlotter def 0.02 |
---|
275 | aRegion.setParameter("plotter.yAxis.labelToAxis","0.01"); |
---|
276 | //gStyle->SetTitleOffset(1.1,"Y"); |
---|
277 | aRegion.setParameter("plotter.yAxis.titleToAxis", |
---|
278 | Lib::smanip::tostring(1.1*XLAB)); |
---|
279 | aRegion.setParameter("plotter.xAxis.titleToAxis", |
---|
280 | Lib::smanip::tostring(1.1*YLAB)); |
---|
281 | //gStyle->SetLabelSize(0.05,"XYZ"); //ROOT def 0.04. SoPlotter def 0.014. |
---|
282 | aRegion.setParameter("plotter.yAxis.labelHeight","0.05"); |
---|
283 | aRegion.setParameter("plotter.xAxis.labelHeight","0.05"); |
---|
284 | |
---|
285 | aRegion.style().setParameter("rightAxisVisible","TRUE"); |
---|
286 | // Set hplot tick modeling : |
---|
287 | aRegion.style().yAxisStyle().setParameter("modeling","hplot"); |
---|
288 | aRegion.style().yAxisStyle().setParameter("divisions","505"); |
---|
289 | |
---|
290 | // title : |
---|
291 | aRegion.style().setParameter("titleHeight","0.04"); |
---|
292 | aRegion.style().setParameter("titleToAxis","0.02"); |
---|
293 | aRegion.style().titleStyle().textStyle().setFont(font); |
---|
294 | aRegion.style().titleStyle().textStyle().setParameter("smoothing",smoothing); |
---|
295 | aRegion.style().titleStyle().textStyle().setColor("0 0 1"); |
---|
296 | |
---|
297 | // legend box : |
---|
298 | aRegion.setParameter("legendRegionVisible","TRUE"); |
---|
299 | aRegion.setParameter("legendRegion.viewportRegion.backgroundColor","1 1 0"); |
---|
300 | aRegion.setParameter("legendRegionSize","0.15 0.16"); |
---|
301 | aRegion.setParameter("legendRegionOrigin","0.1 0.1"); |
---|
302 | aRegion.setParameter("legendRegion.horizontalMargin","2"); |
---|
303 | aRegion.setParameter("legendRegion.verticalMargin","2"); |
---|
304 | |
---|
305 | // Frame : |
---|
306 | aRegion.setParameter("plotter.innerFrameStyle.lineWidth","2"); |
---|
307 | } |
---|
308 | ////////////////////////////////////////////////////////////////////////////// |
---|
309 | bool plot( |
---|
310 | AIDA::IAnalysisFactory& aAIDA |
---|
311 | ,AIDA::IHistogram1D& aHisto1D |
---|
312 | ,AIDA::IHistogram2D& aHisto2D |
---|
313 | ) |
---|
314 | ////////////////////////////////////////////////////////////////////////////// |
---|
315 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
316 | { |
---|
317 | std::string header = "ELYSE_analysis : "; |
---|
318 | |
---|
319 | AIDA::IPlotterFactory* plotterFactory = |
---|
320 | aAIDA.createPlotterFactory(0,0); |
---|
321 | if(!plotterFactory) { |
---|
322 | std::cout << header << "can't get a PlotterFactory." << std::endl; |
---|
323 | return false; |
---|
324 | } |
---|
325 | |
---|
326 | AIDA::IPlotter* plotter = plotterFactory->create(); |
---|
327 | if(!plotter) { |
---|
328 | std::cout << header << "can't get a plotter." << std::endl; |
---|
329 | return false; |
---|
330 | } |
---|
331 | |
---|
332 | plotter->clearRegions(); |
---|
333 | plotter->createRegions(1,2,0); |
---|
334 | |
---|
335 | {plotter->setCurrentRegionNumber(0); |
---|
336 | AIDA::IPlotterRegion& region = plotter->currentRegion(); |
---|
337 | set_region_style(region); |
---|
338 | region.style().xAxisStyle().setLabel("time"); |
---|
339 | region.style().yAxisStyle().setLabel("Entries"); |
---|
340 | region.plot(aHisto1D);} |
---|
341 | |
---|
342 | {plotter->setCurrentRegionNumber(1); |
---|
343 | AIDA::IPlotterRegion& region = plotter->currentRegion(); |
---|
344 | set_region_style(region); |
---|
345 | region.style().xAxisStyle().setLabel("time"); |
---|
346 | region.style().yAxisStyle().setLabel("PE"); |
---|
347 | region.plot(aHisto2D);} |
---|
348 | |
---|
349 | plotter->show(); |
---|
350 | |
---|
351 | /* FIXME : try to have multiple plotters in the tab stack : |
---|
352 | {AIDA::IPlotter* plotter = plotterFactory->create("Viewer_2"); |
---|
353 | if(!plotter) { |
---|
354 | std::cout << header << "can't get a plotter." << std::endl; |
---|
355 | return false; |
---|
356 | } |
---|
357 | plotter->clearRegions(); |
---|
358 | plotter->createRegions(1,1,0);} |
---|
359 | */ |
---|
360 | |
---|
361 | plotter->interact(); |
---|
362 | |
---|
363 | delete plotter; |
---|
364 | delete plotterFactory; |
---|
365 | |
---|
366 | return true; |
---|
367 | } |
---|
368 | ////////////////////////////////////////////////////////////////////////////// |
---|
369 | ////////////////////////////////////////////////////////////////////////////// |
---|
370 | ////////////////////////////////////////////////////////////////////////////// |
---|
371 | int main(int aArgc,char** aArgv) |
---|
372 | ////////////////////////////////////////////////////////////////////////////// |
---|
373 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
374 | { |
---|
375 | std::string program = "ELYSE_analysis"; |
---|
376 | std::string header = program + " : "; |
---|
377 | |
---|
378 | AIDA::IAnalysisFactory* aida = AIDA_createAnalysisFactory(); |
---|
379 | if(!aida) { |
---|
380 | std::cout << header << "AIDA not found." << std::endl; |
---|
381 | return 1; |
---|
382 | } |
---|
383 | |
---|
384 | AIDA::ITreeFactory* treeFactory = aida->createTreeFactory(); |
---|
385 | if(!treeFactory) { |
---|
386 | std::cout << header << "can't get a TreeFactory." << std::endl; |
---|
387 | return 1; |
---|
388 | } |
---|
389 | |
---|
390 | //////////////////////////////////////////////////////// |
---|
391 | // Create histograms in memory tree //////////////////// |
---|
392 | //////////////////////////////////////////////////////// |
---|
393 | AIDA::ITree* memory = treeFactory->create(); |
---|
394 | if(!memory) { |
---|
395 | std::cout << header << "can't get memory tree." << std::endl; |
---|
396 | return 1; |
---|
397 | } |
---|
398 | AIDA::IHistogramFactory* histogramFactory = |
---|
399 | aida->createHistogramFactory(*memory); |
---|
400 | if(!histogramFactory) { |
---|
401 | std::cout << header << "can't get an histogram factory." << std::endl; |
---|
402 | return 1; |
---|
403 | } |
---|
404 | |
---|
405 | AIDA::IHistogram1D* hits_times = |
---|
406 | histogramFactory->createHistogram1D("hits_times","Hits times",100,0,3000); |
---|
407 | if(!hits_times) { |
---|
408 | std::cout << header |
---|
409 | << "can't create histogram : time." |
---|
410 | << std::endl; |
---|
411 | return 1; |
---|
412 | } |
---|
413 | |
---|
414 | AIDA::IHistogram2D* digits_time_pe = |
---|
415 | histogramFactory->createHistogram2D("digits_pe_time","Digits PE time", |
---|
416 | 100,0,3000,100,0,10); |
---|
417 | if(!digits_time_pe) { |
---|
418 | std::cout << header |
---|
419 | << "can't create histogram : digits_time_pe." |
---|
420 | << std::endl; |
---|
421 | return 1; |
---|
422 | } |
---|
423 | |
---|
424 | delete histogramFactory; |
---|
425 | |
---|
426 | //////////////////////////////////////////////////////// |
---|
427 | /// Read data ////////////////////////////////////////// |
---|
428 | //////////////////////////////////////////////////////// |
---|
429 | |
---|
430 | std::string fmt = (aArgc>=2?aArgv[1]:"root"); //file extension |
---|
431 | |
---|
432 | AIDA::ITree* tree = treeFactory->create("ELYSE."+fmt,fmt,true,false); |
---|
433 | if(!tree) { |
---|
434 | std::cout << header << "can't open data file." << std::endl; |
---|
435 | return 1; |
---|
436 | } |
---|
437 | |
---|
438 | AIDA::IManagedObject* object = tree->find("Event"); |
---|
439 | if(!object) { |
---|
440 | std::cout << header |
---|
441 | << "object Event not found in tree." |
---|
442 | << std::endl; |
---|
443 | return 1; |
---|
444 | } |
---|
445 | //FIXME : CINT can't handle dynamic_cast : |
---|
446 | //AIDA::ITuple* tuple = (AIDA::ITuple*)object->cast("AIDA::ITuple"); |
---|
447 | AIDA::ITuple* tuple = dynamic_cast<AIDA::ITuple*>(object); |
---|
448 | if(!tuple) { |
---|
449 | std::cout << header << "object not an AIDA::ITuple." << std::endl; |
---|
450 | return 1; |
---|
451 | } |
---|
452 | |
---|
453 | int coln = tuple->columns(); |
---|
454 | for(int index=0;index<coln;index++) { |
---|
455 | std::cout << header |
---|
456 | << " icol = " << index |
---|
457 | << ", label = " << tuple->columnName(index) |
---|
458 | << ", type = " << tuple->columnType(index) |
---|
459 | << std::endl; |
---|
460 | } |
---|
461 | |
---|
462 | std::cout << header << "rows = " << tuple->rows() << std::endl; |
---|
463 | |
---|
464 | int nentries = tuple->rows(); |
---|
465 | //nentries = 100000; |
---|
466 | //nentries = 40; |
---|
467 | std::cout << header |
---|
468 | << "traitements de " << nentries << " entrees" |
---|
469 | << std::endl; |
---|
470 | |
---|
471 | int irow = 0; |
---|
472 | tuple->start(); |
---|
473 | while(tuple->next() && (irow<nentries)) { |
---|
474 | |
---|
475 | /* |
---|
476 | int eventId = tuple->getInt(0); |
---|
477 | //int inputEvtId = tuple->getInt(1); |
---|
478 | //int interMode = tuple->getInt(2); |
---|
479 | //int vtxVol = tuple->getInt(3); |
---|
480 | |
---|
481 | int nPart = tuple->getInt(5); |
---|
482 | //int leptonIndex = tuple->getInt(6); |
---|
483 | //int protonIndex = tuple->getInt(7); |
---|
484 | |
---|
485 | int nHits = tuple->getInt(9); |
---|
486 | int nDigits = tuple->getInt(11); |
---|
487 | double sumPE = tuple->getDouble(12); |
---|
488 | |
---|
489 | std::cout << ">>>>>>>>>>>>> Event{" << irow << "}: " |
---|
490 | << " evt Id " << eventId |
---|
491 | // << " evt Input Id " << inputEvtId |
---|
492 | // << "\n interaction mode " << interMode |
---|
493 | // << " start in volume " << vtxVol << "\n" |
---|
494 | <<" #tracks: " << nPart |
---|
495 | <<" #hits: " << nHits |
---|
496 | <<" #digits: " << nDigits |
---|
497 | <<" sumPE " << sumPE |
---|
498 | << std::endl; |
---|
499 | */ |
---|
500 | |
---|
501 | //if(!dump_tracks(*tuple)) return 1; |
---|
502 | |
---|
503 | if(!process_hits(*tuple,*hits_times)) return 1; |
---|
504 | if(!process_digits(*tuple,*digits_time_pe)) return 1; |
---|
505 | |
---|
506 | irow++; |
---|
507 | } |
---|
508 | |
---|
509 | delete tree; |
---|
510 | delete treeFactory; |
---|
511 | |
---|
512 | plot(*aida,*hits_times,*digits_time_pe); |
---|
513 | |
---|
514 | delete aida; |
---|
515 | |
---|
516 | return 0; |
---|
517 | } |
---|