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