30 |
void GPamela::Delete() { |
void GPamela::Delete() { |
31 |
|
|
32 |
Clear(); |
Clear(); |
33 |
|
/* EM all these are in the stack not in the heap, so no need to delete by hand... |
34 |
delete[] Ipltof; |
delete[] Ipltof; |
35 |
delete[] Ipaddle; |
delete[] Ipaddle; |
36 |
delete[] Ipartof; |
delete[] Ipartof; |
131 |
delete[] Timecard; |
delete[] Timecard; |
132 |
delete[] Pathcard; |
delete[] Pathcard; |
133 |
delete[] P0card; |
delete[] P0card; |
134 |
|
*/ |
135 |
} |
} |
136 |
; |
|
137 |
|
|
138 |
void GPamela::SetBranchAddress(TChain* fhBookTree) { |
void GPamela::SetBranchAddress(TChain* fhBookTree) { |
139 |
|
|
278 |
*/ |
*/ |
279 |
PamTrack::PamTrack() { |
PamTrack::PamTrack() { |
280 |
trk_track = 0; |
trk_track = 0; |
281 |
|
trk_ext_track = 0; |
282 |
calo_track = 0; |
calo_track = 0; |
283 |
tof_track = 0; |
tof_track = 0; |
284 |
orb_track = 0; |
orb_track = 0; |
296 |
*/ |
*/ |
297 |
PamTrack::PamTrack(TrkTrack* t, CaloTrkVar* c, ToFTrkVar* o, OrbitalInfoTrkVar *r) { |
PamTrack::PamTrack(TrkTrack* t, CaloTrkVar* c, ToFTrkVar* o, OrbitalInfoTrkVar *r) { |
298 |
|
|
299 |
|
trk_ext_track = 0; |
300 |
trk_track = 0; |
trk_track = 0; |
301 |
calo_track = 0; |
calo_track = 0; |
302 |
tof_track = 0; |
tof_track = 0; |
304 |
// if(t)trk_track = new TrkTrack(*t); |
// if(t)trk_track = new TrkTrack(*t); |
305 |
// if(c)calo_track = new CaloTrkVar(*c); |
// if(c)calo_track = new CaloTrkVar(*c); |
306 |
// if(o)tof_track = new ToFTrkVar(*o); |
// if(o)tof_track = new ToFTrkVar(*o); |
307 |
if (t) |
// if (t) |
308 |
trk_track = t; |
// trk_track = t; |
309 |
|
// if (c) |
310 |
|
// calo_track = c; |
311 |
|
// if (o) |
312 |
|
// tof_track = o; |
313 |
|
// if (r) |
314 |
|
// orb_track = r; |
315 |
|
|
316 |
|
// candeleteobj = 0; |
317 |
|
|
318 |
|
|
319 |
|
if (t){ |
320 |
|
trk_track = new TrkTrack(*t); |
321 |
|
trk_ext_track = new ExtTrack(*t);//NB!! ha dimensione 6 invece che 8 |
322 |
|
} |
323 |
if (c) |
if (c) |
324 |
calo_track = c; |
calo_track = new CaloTrkVar(*c); |
325 |
if (o) |
if (o) |
326 |
tof_track = o; |
tof_track = new ToFTrkVar(*o); |
327 |
if (r) |
if (r) |
328 |
orb_track = r; |
orb_track = new OrbitalInfoTrkVar(*r); |
329 |
|
candeleteobj = 1; |
330 |
|
|
331 |
candeleteobj = 0; |
} |
332 |
|
; |
333 |
|
/** |
334 |
|
* Constructor |
335 |
|
*/ |
336 |
|
PamTrack::PamTrack(ExtTrack* t, CaloTrkVar* c, ToFTrkVar* o, OrbitalInfoTrkVar *r) { |
337 |
|
|
338 |
|
trk_ext_track = 0; |
339 |
|
trk_track = 0; |
340 |
|
calo_track = 0; |
341 |
|
tof_track = 0; |
342 |
|
orb_track = 0; |
343 |
|
// if(t)trk_track = new TrkTrack(*t); |
344 |
|
// if(c)calo_track = new CaloTrkVar(*c); |
345 |
|
// if(o)tof_track = new ToFTrkVar(*o); |
346 |
|
// if (t) |
347 |
|
// trk_track = t; |
348 |
|
// if (c) |
349 |
|
// calo_track = c; |
350 |
|
// if (o) |
351 |
|
// tof_track = o; |
352 |
|
// if (r) |
353 |
|
// orb_track = r; |
354 |
|
|
355 |
|
// candeleteobj = 0; |
356 |
|
|
357 |
|
|
358 |
|
if (t){ |
359 |
|
//// trk_track = new TrkTrack(*t);//in this case TrkTrack object remains null |
360 |
|
trk_ext_track = new ExtTrack(*t); |
361 |
|
} |
362 |
|
if (c) |
363 |
|
calo_track = new CaloTrkVar(*c); |
364 |
|
if (o) |
365 |
|
tof_track = new ToFTrkVar(*o); |
366 |
|
if (r) |
367 |
|
orb_track = new OrbitalInfoTrkVar(*r); |
368 |
|
candeleteobj = 1; |
369 |
|
pscore = 0; |
370 |
|
iscore = 0; |
371 |
|
|
372 |
} |
} |
373 |
; |
; |
374 |
PamTrack::PamTrack(const PamTrack& track) { |
PamTrack::PamTrack(const PamTrack& track) { |
375 |
|
|
376 |
TrkTrack *t = track.trk_track; |
TrkTrack *t = track.trk_track; |
377 |
|
ExtTrack *e = track.trk_ext_track; |
378 |
CaloTrkVar *c = track.calo_track; |
CaloTrkVar *c = track.calo_track; |
379 |
ToFTrkVar *o = track.tof_track; |
ToFTrkVar *o = track.tof_track; |
380 |
OrbitalInfoTrkVar *r = track.orb_track; |
OrbitalInfoTrkVar *r = track.orb_track; |
381 |
|
|
382 |
trk_track = 0; |
trk_ext_track = 0; |
383 |
calo_track = 0; |
trk_track = 0; |
384 |
tof_track = 0; |
calo_track = 0; |
385 |
orb_track = 0; |
tof_track = 0; |
386 |
|
orb_track = 0; |
387 |
|
if(e) |
388 |
|
trk_ext_track = new ExtTrack(*e); |
389 |
if (t) |
if (t) |
390 |
trk_track = new TrkTrack(*t); |
trk_track = new TrkTrack(*t); |
391 |
if (c) |
if (c) |
394 |
tof_track = new ToFTrkVar(*o); |
tof_track = new ToFTrkVar(*o); |
395 |
if (r) |
if (r) |
396 |
orb_track = new OrbitalInfoTrkVar(*r); |
orb_track = new OrbitalInfoTrkVar(*r); |
397 |
|
|
398 |
candeleteobj = 1; |
candeleteobj = 1; |
399 |
|
pscore = 0; |
400 |
|
iscore = 0; |
401 |
|
|
402 |
} |
} |
403 |
void PamTrack::Clear() { |
void PamTrack::Clear(Option_t *option) { |
404 |
|
|
405 |
// cout << "PamTrack::Clear() "<<candeleteobj<<endl; |
// cout << "PamTrack::Clear( "<<option<<" ) "<<candeleteobj<<endl; |
406 |
if (candeleteobj) { |
if (candeleteobj) { |
407 |
|
|
408 |
|
if (trk_ext_track) |
409 |
|
trk_ext_track->ExtTrack::Clear(option); |
410 |
if (trk_track) |
if (trk_track) |
411 |
trk_track->TrkTrack::Clear(); |
trk_track->TrkTrack::Clear(); |
412 |
if (calo_track) |
if (calo_track) |
417 |
orb_track->OrbitalInfoTrkVar::Clear();//??? |
orb_track->OrbitalInfoTrkVar::Clear();//??? |
418 |
} |
} |
419 |
else { |
else { |
420 |
|
trk_ext_track = 0; |
421 |
trk_track = 0; |
trk_track = 0; |
422 |
calo_track = 0; |
calo_track = 0; |
423 |
tof_track = 0; |
tof_track = 0; |
430 |
void PamTrack::Delete() { |
void PamTrack::Delete() { |
431 |
// cout << "PamTrack::Delete() "<<candeleteobj<<endl; |
// cout << "PamTrack::Delete() "<<candeleteobj<<endl; |
432 |
if (candeleteobj) { |
if (candeleteobj) { |
433 |
|
if (trk_ext_track) { |
434 |
|
trk_ext_track->ExtTrack::Clear("C"); |
435 |
|
delete trk_ext_track; |
436 |
|
} |
437 |
if (trk_track) { |
if (trk_track) { |
438 |
trk_track->TrkTrack::Clear(); |
trk_track->TrkTrack::Clear(); |
439 |
delete trk_track; |
delete trk_track; |
455 |
Clear(); |
Clear(); |
456 |
} |
} |
457 |
} |
} |
458 |
|
|
459 |
|
|
460 |
|
|
461 |
|
|
462 |
//-------------------------------------- |
//-------------------------------------- |
463 |
// |
// |
464 |
// |
// |
469 |
PamLevel2::PamLevel2() { |
PamLevel2::PamLevel2() { |
470 |
Initialize(); |
Initialize(); |
471 |
} |
} |
472 |
; |
|
473 |
|
|
474 |
/** |
/** |
475 |
* Constructor |
* Constructor |
492 |
GetPamTree(listf, detlist); |
GetPamTree(listf, detlist); |
493 |
if (listf) |
if (listf) |
494 |
GetRunTree(listf); |
GetRunTree(listf); |
495 |
|
SetMaxShift(-1); |
496 |
} |
} |
497 |
; |
|
498 |
|
|
499 |
PamLevel2::PamLevel2(TString ddir, TList *llist, TString detlist) { |
PamLevel2::PamLevel2(TString ddir, TList *llist, TString detlist) { |
500 |
Initialize(); |
Initialize(); |
501 |
GetPamTree(llist, detlist); |
GetPamTree(llist, detlist); |
502 |
GetRunTree(llist); |
GetRunTree(llist); |
503 |
|
SetMaxShift(-1); |
504 |
} |
} |
505 |
; |
|
506 |
/** |
/** |
507 |
* Constructor |
* Constructor |
508 |
* @param ddir Name of directory where level2 files are stored. |
* @param ddir Name of directory where level2 files are stored. |
512 |
*/ |
*/ |
513 |
PamLevel2::PamLevel2(TString ddir, TString llist) { |
PamLevel2::PamLevel2(TString ddir, TString llist) { |
514 |
Initialize(); |
Initialize(); |
515 |
TList* listf = GetListOfLevel2Files(ddir, llist); |
TList* listf = GetListOfLevel2Files(ddir, llist); |
516 |
|
cout << "GetPamTree: "<<endl; |
517 |
GetPamTree(listf, ""); |
GetPamTree(listf, ""); |
518 |
|
cout << "GetRunTree: "<<endl; |
519 |
GetRunTree(listf); |
GetRunTree(listf); |
520 |
|
SetMaxShift(-1); |
521 |
} |
} |
522 |
; |
|
523 |
|
|
524 |
void PamLevel2::Initialize() { |
void PamLevel2::Initialize() { |
525 |
|
|
532 |
trkh_obj = 0; |
trkh_obj = 0; |
533 |
calo1_obj = 0; |
calo1_obj = 0; |
534 |
calo2_obj = 0; |
calo2_obj = 0; |
535 |
tof_obj = 0; |
tof2_obj = 0; |
536 |
trig_obj = 0; |
trig_obj = 0; |
537 |
s4_obj = 0; |
s4_obj = 0; |
538 |
nd_obj = 0; |
nd_obj = 0; |
539 |
ac_obj = 0; |
ac_obj = 0; |
540 |
orb_obj = 0; |
orb2_obj = 0; |
541 |
gp_obj = 0; |
gp_obj = 0; |
542 |
|
|
543 |
|
extAlgFlag=0; |
544 |
|
|
545 |
|
trk_ext_obj = 0; |
546 |
|
trk_ext_nuc_obj = 0; |
547 |
|
trk_nuc_obj = 0; |
548 |
|
|
549 |
|
calo_ext_obj = 0; |
550 |
|
calo_ext_nuc_obj = 0; |
551 |
|
calo_nuc_obj = 0; |
552 |
|
|
553 |
|
tof_ext_obj = 0; |
554 |
|
tof_ext_nuc_obj = 0; |
555 |
|
tof_nuc_obj = 0; |
556 |
|
|
557 |
|
orb_ext_obj = 0; |
558 |
|
orb_ext_nuc_obj = 0; |
559 |
|
orb_nuc_obj = 0; |
560 |
|
|
561 |
|
trk2_nuc_obj = 0; |
562 |
|
calo2_nuc_obj = 0; |
563 |
|
tof2_nuc_obj = 0; |
564 |
|
orb2_nuc_obj = 0; |
565 |
|
|
566 |
|
|
567 |
run_obj = 0;//new GL_RUN(); |
run_obj = 0;//new GL_RUN(); |
568 |
soft_obj = 0;// Emiliano |
soft_obj = 0;// Emiliano |
569 |
irun = -1LL; |
irun = -1LL; |
570 |
irunt = -1LL; |
irunt = -1LL; |
571 |
|
totrunentry = 0LL; |
572 |
|
totrunentrymax = 0LL; |
573 |
|
totrunentrymin = 0LL; |
574 |
runfirstentry = 0LL; |
runfirstentry = 0LL; |
575 |
runlastentry = 0LL; |
runlastentry = 0LL; |
576 |
gltsync = 0; // Emiliano |
gltsync = 0; // Emiliano |
577 |
fUpdateRunInfo = true; // Emiliano |
fUpdateRunInfo = true; // Emiliano |
578 |
|
fUseDBinRunInfo = true; // Emiliano |
579 |
|
fDiscarded = false; //EM |
580 |
|
isSync = false; // by default assume that the level2 file(s) is(are) not sinchronized between L0/DB and L2, that is we miss some packets in L2 due to nested/DV-skipped events |
581 |
|
il0entry = 0LL; |
582 |
|
// hasL0EE = true; |
583 |
|
|
584 |
l0_file = NULL; |
l0_file = NULL; |
585 |
l0_tree = NULL; |
l0_tree = NULL; |
587 |
dbc = 0; |
dbc = 0; |
588 |
|
|
589 |
prevshift = 0; |
prevshift = 0; |
590 |
maxshift = 10; //EMILIANO |
yprevshift = 0; |
591 |
|
maxshift = 10; //EMILIANO now overridden by SetMaxShift(-1) called by constructors |
592 |
|
|
593 |
run_tree = NULL; |
run_tree = NULL; |
594 |
run_tree_clone = NULL; |
run_tree_clone = NULL; |
641 |
ORB = true; |
ORB = true; |
642 |
GP = false; |
GP = false; |
643 |
|
|
644 |
|
EXT = false; |
645 |
|
NUC = false; |
646 |
|
trkAlg = "STD";//default tracking algorythm |
647 |
|
|
648 |
RUN = true; |
RUN = true; |
649 |
|
|
650 |
SELLI = -1; |
SELLI = -1; |
655 |
|
|
656 |
tsorted = 0; |
tsorted = 0; |
657 |
timage = 0; |
timage = 0; |
658 |
|
text = 0 ; |
659 |
|
|
660 |
|
tsorted_nuc = 0; |
661 |
|
timage_nuc = 0; |
662 |
|
text_nuc = 0 ; |
663 |
|
|
664 |
howtosort = "+CAL+TOF"; |
howtosort = "+CAL+TOF"; |
665 |
//howtosort = "+TOF"; |
//howtosort = "+TOF"; |
667 |
|
|
668 |
issorted = false; |
issorted = false; |
669 |
lastsorted = -1; |
lastsorted = -1; |
670 |
|
issorted_new = false; |
671 |
|
lastsorted_new = -1; |
672 |
|
|
673 |
} |
} |
674 |
; |
; |
699 |
delete calo1_obj; |
delete calo1_obj; |
700 |
if (calo2_obj) |
if (calo2_obj) |
701 |
delete calo2_obj; |
delete calo2_obj; |
702 |
if (tof_obj) |
if (tof2_obj) |
703 |
delete tof_obj; |
delete tof2_obj; |
704 |
if (trig_obj) |
if (trig_obj) |
705 |
delete trig_obj; |
delete trig_obj; |
706 |
if (s4_obj) |
if (s4_obj) |
709 |
delete nd_obj; |
delete nd_obj; |
710 |
if (ac_obj) |
if (ac_obj) |
711 |
delete ac_obj; |
delete ac_obj; |
712 |
if (orb_obj) |
if (orb2_obj) |
713 |
delete orb_obj; |
delete orb2_obj; |
714 |
if (gp_obj) |
if (gp_obj) |
715 |
delete gp_obj; |
delete gp_obj; |
716 |
|
|
717 |
|
if(trk_nuc_obj)trk_nuc_obj->Delete(); |
718 |
|
if(trk_ext_obj)trk_ext_obj->Delete(); |
719 |
|
if(trk_ext_nuc_obj)trk_ext_nuc_obj->Delete(); |
720 |
|
|
721 |
|
if(calo_nuc_obj)calo_nuc_obj->Delete(); |
722 |
|
if(calo_ext_obj)calo_ext_obj->Delete(); |
723 |
|
if(calo_ext_nuc_obj)calo_ext_nuc_obj->Delete(); |
724 |
|
|
725 |
|
if(tof_nuc_obj)tof_nuc_obj->Delete(); |
726 |
|
if(tof_ext_obj)tof_ext_obj->Delete(); |
727 |
|
if(tof_ext_nuc_obj)tof_ext_nuc_obj->Delete(); |
728 |
|
|
729 |
|
if(orb_nuc_obj)orb_nuc_obj->Delete(); |
730 |
|
if(orb_ext_obj)orb_ext_obj->Delete(); |
731 |
|
if(orb_ext_nuc_obj)orb_ext_nuc_obj->Delete(); |
732 |
|
|
733 |
|
|
734 |
|
if(trk2_nuc_obj)trk2_nuc_obj->Delete();; |
735 |
|
if( calo2_nuc_obj)calo2_nuc_obj->Delete();; |
736 |
|
if(tof2_nuc_obj)tof2_nuc_obj->Delete();; |
737 |
|
if(orb2_nuc_obj)orb2_nuc_obj->Delete();; |
738 |
|
|
739 |
|
|
740 |
|
|
741 |
if (tsorted) { |
if (tsorted) { |
742 |
tsorted->Delete(); |
tsorted->Delete(); |
743 |
delete tsorted; |
delete tsorted; |
746 |
timage->Delete(); |
timage->Delete(); |
747 |
delete timage; |
delete timage; |
748 |
} |
} |
749 |
|
if (text) { |
750 |
|
text->Delete(); |
751 |
|
delete text; |
752 |
|
} |
753 |
|
if (tsorted_nuc) { |
754 |
|
tsorted_nuc->Delete(); |
755 |
|
delete tsorted_nuc; |
756 |
|
} |
757 |
|
if (timage_nuc) { |
758 |
|
timage_nuc->Delete(); |
759 |
|
delete timage_nuc; |
760 |
|
} |
761 |
|
if (text_nuc) { |
762 |
|
text_nuc->Delete(); |
763 |
|
delete text_nuc; |
764 |
|
} |
765 |
|
|
766 |
|
|
767 |
|
|
768 |
if (dbc) { |
if (dbc) { |
769 |
dbc->Close(); |
dbc->Close(); |
813 |
run_tree->Delete();; |
run_tree->Delete();; |
814 |
if (sel_tree) |
if (sel_tree) |
815 |
sel_tree->Delete();; |
sel_tree->Delete();; |
816 |
for (Int_t i = 0; i < NCLONES; i++) |
|
817 |
|
// The following lines are commented out since they may generate a double delete error |
818 |
|
// if the file containing the clone trees is closed. This is because the file owns the |
819 |
|
// clone trees which are written into it, so it will delete them when it is closed; if |
820 |
|
// also PamLevel2 will try to delete these trees, a double delete error will be generated |
821 |
|
// when exiting from analysis program. (Nicola 28/11/2011) |
822 |
|
|
823 |
|
/*for (Int_t i = 0; i < NCLONES; i++) |
824 |
if (pam_tree_clone[i]) |
if (pam_tree_clone[i]) |
825 |
pam_tree_clone[i]->Delete();; |
pam_tree_clone[i]->Delete();; |
826 |
if (run_tree_clone) |
if (run_tree_clone) |
827 |
run_tree_clone->Delete();; |
run_tree_clone->Delete();; |
828 |
if (sel_tree_clone) |
if (sel_tree_clone) |
829 |
sel_tree_clone->Delete();; |
sel_tree_clone->Delete();;*/ |
830 |
|
|
831 |
if (irunoffset) |
if (irunoffset) |
832 |
delete[] irunoffset; |
delete[] irunoffset; |
833 |
|
|
834 |
|
|
835 |
|
Initialize(); |
836 |
|
|
837 |
} |
} |
838 |
; |
; |
839 |
|
|
867 |
calo1_obj->Clear(); |
calo1_obj->Clear(); |
868 |
if (calo2_obj) |
if (calo2_obj) |
869 |
calo2_obj->Clear(); |
calo2_obj->Clear(); |
870 |
if (tof_obj) |
if (tof2_obj) |
871 |
tof_obj->Clear(); |
tof2_obj->Clear(); |
872 |
if (trig_obj) |
if (trig_obj) |
873 |
trig_obj->Clear(); |
trig_obj->Clear(); |
874 |
if (s4_obj) |
if (s4_obj) |
877 |
nd_obj->Clear(); |
nd_obj->Clear(); |
878 |
if (ac_obj) |
if (ac_obj) |
879 |
ac_obj->Clear(); |
ac_obj->Clear(); |
880 |
if (orb_obj) |
if (orb2_obj) |
881 |
orb_obj->Clear(); |
orb2_obj->Clear(); |
882 |
if (gp_obj) |
if (gp_obj) |
883 |
gp_obj->Clear(); |
gp_obj->Clear(); |
884 |
|
|
885 |
// if(sorted_tracks)sorted_tracks->Clear(); |
// if(sorted_tracks)sorted_tracks->Clear(); |
886 |
// sorted_tracks.Clear(); |
// sorted_tracks.Clear(); |
887 |
|
|
888 |
if (tsorted) { |
if(trk_nuc_obj)trk_nuc_obj->Clear(); |
889 |
tsorted->Delete(); |
if(trk_ext_obj)trk_ext_obj->Clear(); |
890 |
} |
if(trk_ext_nuc_obj)trk_ext_nuc_obj->Clear(); |
891 |
if (timage) { |
|
892 |
timage->Delete(); |
if(calo_nuc_obj)calo_nuc_obj->Clear(); |
893 |
} |
if(calo_ext_obj)calo_ext_obj->Clear(); |
894 |
|
if(calo_ext_nuc_obj)calo_ext_nuc_obj->Clear(); |
895 |
|
|
896 |
|
if(tof_nuc_obj)tof_nuc_obj->Clear(); |
897 |
|
if(tof_ext_obj)tof_ext_obj->Clear(); |
898 |
|
if(tof_ext_nuc_obj)tof_ext_nuc_obj->Clear(); |
899 |
|
|
900 |
|
if(orb_nuc_obj)orb_nuc_obj->Clear(); |
901 |
|
if(orb_ext_obj)orb_ext_obj->Clear(); |
902 |
|
if(orb_ext_nuc_obj)orb_ext_nuc_obj->Clear(); |
903 |
|
|
904 |
|
if(trk2_nuc_obj)trk2_nuc_obj->Clear();; |
905 |
|
if( calo2_nuc_obj)calo2_nuc_obj->Clear();; |
906 |
|
if(tof2_nuc_obj)tof2_nuc_obj->Clear();; |
907 |
|
if(orb2_nuc_obj)orb2_nuc_obj->Clear();; |
908 |
|
|
909 |
|
if (tsorted)tsorted->Delete(); |
910 |
|
if (timage)timage->Delete(); |
911 |
|
if (text) text->Delete(); |
912 |
|
|
913 |
|
if (tsorted_nuc)tsorted_nuc->Delete(); |
914 |
|
if (timage_nuc)timage_nuc->Delete(); |
915 |
|
if (text_nuc) text_nuc->Delete(); |
916 |
} |
} |
917 |
; |
; |
918 |
|
|
977 |
trkh_obj = 0; |
trkh_obj = 0; |
978 |
calo1_obj = 0; |
calo1_obj = 0; |
979 |
calo2_obj = 0; |
calo2_obj = 0; |
980 |
tof_obj = 0; |
tof2_obj = 0; |
981 |
trig_obj = 0; |
trig_obj = 0; |
982 |
s4_obj = 0; |
s4_obj = 0; |
983 |
nd_obj = 0; |
nd_obj = 0; |
984 |
ac_obj = 0; |
ac_obj = 0; |
985 |
orb_obj = 0; |
orb2_obj = 0; |
986 |
gp_obj = 0; |
gp_obj = 0; |
987 |
|
|
988 |
|
trk_ext_obj = 0; |
989 |
|
trk_ext_nuc_obj = 0; |
990 |
|
trk_nuc_obj = 0; |
991 |
|
|
992 |
|
calo_ext_obj = 0; |
993 |
|
calo_ext_nuc_obj = 0; |
994 |
|
calo_nuc_obj = 0; |
995 |
|
|
996 |
|
tof_ext_obj = 0; |
997 |
|
tof_ext_nuc_obj = 0; |
998 |
|
tof_nuc_obj = 0; |
999 |
|
|
1000 |
|
orb_ext_obj = 0; |
1001 |
|
orb_ext_nuc_obj = 0; |
1002 |
|
orb_nuc_obj = 0; |
1003 |
|
|
1004 |
|
trk2_nuc_obj = 0; |
1005 |
|
calo2_nuc_obj = 0; |
1006 |
|
tof2_nuc_obj = 0; |
1007 |
|
orb2_nuc_obj = 0; |
1008 |
|
|
1009 |
|
trk2_nuc_obj = 0; |
1010 |
|
calo2_nuc_obj = 0; |
1011 |
|
tof2_nuc_obj = 0; |
1012 |
|
orb2_nuc_obj = 0; |
1013 |
// |
// |
1014 |
// Reset run pointers |
// Reset run pointers |
1015 |
// |
// |
1017 |
soft_obj = 0;// Emiliano |
soft_obj = 0;// Emiliano |
1018 |
irun = -1; |
irun = -1; |
1019 |
irunt = -1; |
irunt = -1; |
1020 |
|
totrunentry = 0LL; |
1021 |
|
totrunentrymax = 0LL; |
1022 |
|
totrunentrymin = 0LL; |
1023 |
runfirstentry = 0ULL; |
runfirstentry = 0ULL; |
1024 |
runlastentry = 0ULL; |
runlastentry = 0ULL; |
1025 |
|
prevabstime = 0ULL; |
1026 |
|
prevpktnum = 0; |
1027 |
|
abstime = 0ULL; |
1028 |
|
pktnum = 0; |
1029 |
|
isFragment = false; |
1030 |
// |
// |
1031 |
totdltime[0] = 0LL; |
totdltime[0] = 0LL; |
1032 |
totdltime[1] = 0LL; |
totdltime[1] = 0LL; |
1044 |
if (strict) { |
if (strict) { |
1045 |
if (trk2_obj && trk2_obj->UnpackError() != 0) |
if (trk2_obj && trk2_obj->UnpackError() != 0) |
1046 |
goodev = false; |
goodev = false; |
1047 |
if (tof_obj && tof_obj->unpackError != 0) |
if (tof2_obj && tof2_obj->unpackError != 0) |
1048 |
goodev = false; |
goodev = false; |
1049 |
if (trig_obj && trig_obj->unpackError != 0) |
if (trig_obj && trig_obj->unpackError != 0) |
1050 |
goodev = false; |
goodev = false; |
1054 |
goodev = false; |
goodev = false; |
1055 |
if (ac_obj && (ac_obj->unpackError != 0 || ((ac_obj->status[0] >> 2) & 1) || ((ac_obj->status[1] >> 2) & 1))) |
if (ac_obj && (ac_obj->unpackError != 0 || ((ac_obj->status[0] >> 2) & 1) || ((ac_obj->status[1] >> 2) & 1))) |
1056 |
goodev = false; |
goodev = false; |
1057 |
// if(orb_obj) |
// if(orb2_obj) |
1058 |
} |
} |
1059 |
else { |
else { |
1060 |
if (nd_obj && nd_obj->unpackError != 0) |
if (nd_obj && nd_obj->unpackError != 0) |
1080 |
}; |
}; |
1081 |
} |
} |
1082 |
|
|
1083 |
|
void PamLevel2::SetMaxShift(Int_t sh){ |
1084 |
|
if ( sh >= 0 ){ |
1085 |
|
printf("PamLevel2::SetMaxShift(Int_t) --WARNING-- the default is optimized by checking the level2 file\n it is strongly suggested to let PamLevel2 choose the max shift!\n"); |
1086 |
|
maxshift = sh; |
1087 |
|
} else { |
1088 |
|
ULong64_t nev = GetEntries(); |
1089 |
|
ULong64_t runnev = 0ULL; |
1090 |
|
for (Int_t r=0; r< run_tree->GetEntries();r++){ |
1091 |
|
run_tree->GetEntry(r);//update runinfo |
1092 |
|
runnev += GetRunInfo()->NEVENTS; |
1093 |
|
} |
1094 |
|
maxshift = (Int_t)(runnev-nev) + 10; // +10 just to be conservative |
1095 |
|
if ( (runnev-nev) == 0 ) isSync = true; |
1096 |
|
if (DBG) printf("PamLevel2::SetMaxShift(Int_t_) - sh negative %i - nev is %lld runnnev is %lld so maxshift set to %i \n",sh,nev,runnev,maxshift); |
1097 |
|
// printf("PamLevel2::SetMaxShift(Int_t_) - sh negative %i - nev is %lld runnnev is %lld so maxshift set to %i \n",sh,nev,runnev,maxshift); // TOGLITOGLI |
1098 |
|
} |
1099 |
|
} |
1100 |
|
|
1101 |
//-------------------------------------- |
//-------------------------------------- |
1102 |
// |
// |
1103 |
// |
// |
1140 |
return &calo2_obj; |
return &calo2_obj; |
1141 |
}; |
}; |
1142 |
if (!objname.CompareTo("ToFLevel2")) { |
if (!objname.CompareTo("ToFLevel2")) { |
1143 |
if (!tof_obj) { |
if (!tof2_obj) { |
1144 |
tof_obj = new ToFLevel2(); |
tof2_obj = new ToFLevel2(); |
1145 |
tof_obj->Set(); |
tof2_obj->Set(); |
1146 |
} |
} |
1147 |
return &tof_obj; |
return &tof2_obj; |
1148 |
}; |
}; |
1149 |
if (!objname.CompareTo("TrigLevel2")) { |
if (!objname.CompareTo("TrigLevel2")) { |
1150 |
if (!trig_obj) |
if (!trig_obj) |
1167 |
return &ac_obj; |
return &ac_obj; |
1168 |
}; |
}; |
1169 |
if (!objname.CompareTo("OrbitalInfo")) { |
if (!objname.CompareTo("OrbitalInfo")) { |
1170 |
if (!orb_obj) { |
if (!orb2_obj) { |
1171 |
orb_obj = new OrbitalInfo(); |
orb2_obj = new OrbitalInfo(); |
1172 |
orb_obj->Set(); |
orb2_obj->Set(); |
1173 |
} |
} |
1174 |
return &orb_obj; |
return &orb2_obj; |
1175 |
}; |
}; |
1176 |
// if(!objname.CompareTo("OrbitalInfo")){ |
// if(!objname.CompareTo("OrbitalInfo")){ |
1177 |
// if(!orb_obj) orb_obj = new OrbitalInfo(); |
// if(!orb2_obj) orb2_obj = new OrbitalInfo(); |
1178 |
// return &orb_obj; |
// return &orb2_obj; |
1179 |
// }; |
// }; |
1180 |
if (!objname.CompareTo("GPamela")) { |
if (!objname.CompareTo("GPamela")) { |
1181 |
if (!gp_obj) |
if (!gp_obj) |
1239 |
*/ |
*/ |
1240 |
ToFTrkVar *PamLevel2::GetToFStoredTrack(int seqno) { |
ToFTrkVar *PamLevel2::GetToFStoredTrack(int seqno) { |
1241 |
|
|
1242 |
if (!tof_obj) |
if (!tof2_obj) |
1243 |
return 0; |
return 0; |
1244 |
|
|
1245 |
if (tof_obj->ToFLevel2::ntrk() == 0) { |
if (tof2_obj->ToFLevel2::ntrk() == 0) { |
1246 |
cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo " << seqno << " but no ToF tracks are stored" |
cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo " << seqno << " but no ToF tracks are stored" |
1247 |
<< endl; |
<< endl; |
1248 |
return NULL; |
return NULL; |
1252 |
Int_t it_tof = 0; |
Int_t it_tof = 0; |
1253 |
|
|
1254 |
do { |
do { |
1255 |
c = tof_obj->ToFLevel2::GetToFTrkVar(it_tof); |
c = tof2_obj->ToFLevel2::GetToFTrkVar(it_tof); |
1256 |
it_tof++; |
it_tof++; |
1257 |
} while (c && seqno != c->trkseqno && it_tof < tof_obj->ToFLevel2::ntrk()); |
} while (c && seqno != c->trkseqno && it_tof < tof2_obj->ToFLevel2::ntrk()); |
1258 |
|
|
1259 |
if (!c || seqno != c->trkseqno) { |
if (!c || seqno != c->trkseqno) { |
1260 |
c = 0; |
c = 0; |
1277 |
*/ |
*/ |
1278 |
OrbitalInfoTrkVar *PamLevel2::GetOrbitalInfoStoredTrack(int seqno) { |
OrbitalInfoTrkVar *PamLevel2::GetOrbitalInfoStoredTrack(int seqno) { |
1279 |
|
|
1280 |
if (!orb_obj) |
if (!orb2_obj) |
1281 |
return 0; |
return 0; |
1282 |
|
|
1283 |
if (orb_obj->OrbitalInfo::ntrk() == 0) { |
if (orb2_obj->OrbitalInfo::ntrk() == 0) { |
1284 |
// // TRICK BEGIN |
// // TRICK BEGIN |
1285 |
// OrbitalInfoTrkVar *r = new OrbitalInfoTrkVar(); // TEMPORARY TRICK |
// OrbitalInfoTrkVar *r = new OrbitalInfoTrkVar(); // TEMPORARY TRICK |
1286 |
// Int_t nn = 0; |
// Int_t nn = 0; |
1287 |
// TClonesArray &tor = *orb_obj->OrbitalInfoTrk; |
// TClonesArray &tor = *orb2_obj->OrbitalInfoTrk; |
1288 |
// for(Int_t nt=0; nt < tof_obj->ToFLevel2::ntrk(); nt++){ |
// for(Int_t nt=0; nt < tof2_obj->ToFLevel2::ntrk(); nt++){ |
1289 |
// // |
// // |
1290 |
// ToFTrkVar *ptt = tof_obj->ToFLevel2::GetToFTrkVar(nt); |
// ToFTrkVar *ptt = tof2_obj->ToFLevel2::GetToFTrkVar(nt); |
1291 |
// if ( ptt->trkseqno != -1 ){ |
// if ( ptt->trkseqno != -1 ){ |
1292 |
// // |
// // |
1293 |
// r->trkseqno = ptt->trkseqno; |
// r->trkseqno = ptt->trkseqno; |
1309 |
// }; |
// }; |
1310 |
// delete r; |
// delete r; |
1311 |
// OrbitalInfoTrkVar *c = 0; |
// OrbitalInfoTrkVar *c = 0; |
1312 |
// c = orb_obj->OrbitalInfo::GetOrbitalInfoTrkVar(0); |
// c = orb2_obj->OrbitalInfo::GetOrbitalInfoTrkVar(0); |
1313 |
// return c; |
// return c; |
1314 |
// //TRICK END |
// //TRICK END |
1315 |
cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo " << seqno |
cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo " << seqno |
1321 |
Int_t it_tof = 0; |
Int_t it_tof = 0; |
1322 |
|
|
1323 |
do { |
do { |
1324 |
c = orb_obj->OrbitalInfo::GetOrbitalInfoTrkVar(it_tof); |
c = orb2_obj->OrbitalInfo::GetOrbitalInfoTrkVar(it_tof); |
1325 |
it_tof++; |
it_tof++; |
1326 |
} while (c && seqno != c->trkseqno && it_tof < orb_obj->OrbitalInfo::ntrk()); |
} while (c && seqno != c->trkseqno && it_tof < orb2_obj->OrbitalInfo::ntrk()); |
1327 |
|
|
1328 |
if (!c || seqno != c->trkseqno) { |
if (!c || seqno != c->trkseqno) { |
1329 |
c = 0; |
c = 0; |
1454 |
// create TCloneArrays to store tracks and its images |
// create TCloneArrays to store tracks and its images |
1455 |
if (!tsorted) |
if (!tsorted) |
1456 |
tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
1457 |
tsorted->Delete(); |
tsorted->Clear("C+C");//Delete(); |
1458 |
TClonesArray &ttsorted = *tsorted; |
TClonesArray &ttsorted = *tsorted; |
1459 |
|
|
1460 |
if (!timage) |
if (!timage) |
1461 |
timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
1462 |
timage->Delete(); |
timage->Clear("C+C");//Delete(); |
1463 |
TClonesArray &ttimage = *timage; |
TClonesArray &ttimage = *timage; |
1464 |
|
|
1465 |
|
|
1466 |
|
|
1467 |
//-------------------------------------------------- |
//-------------------------------------------------- |
1468 |
// retrieve sorting method |
// retrieve sorting method |
1469 |
//-------------------------------------------------- |
//-------------------------------------------------- |
1579 |
// ----------------------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------------------- |
1580 |
// check the number of hit pmts along the track |
// check the number of hit pmts along the track |
1581 |
// on S12 S21 and S32, where paddles are parallel to Y axis |
// on S12 S21 and S32, where paddles are parallel to Y axis |
1582 |
if ((use_TOF || use_S1 || use_S2 || use_S3) && !tof_obj) { |
if ((use_TOF || use_S1 || use_S2 || use_S3) && !tof2_obj) { |
1583 |
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but ToFLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but ToFLevel2 not loaded !!!"; |
1584 |
return; |
return; |
1585 |
}; |
}; |
1596 |
// |
// |
1597 |
Float_t sen = 0.; |
Float_t sen = 0.; |
1598 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1599 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1600 |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
1601 |
sen += (op->dedx).At(ih); |
sen += (op->dedx).At(ih); |
1602 |
}; |
}; |
1603 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1604 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1605 |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
1606 |
sen += (oi->dedx).At(ih); |
sen += (oi->dedx).At(ih); |
1607 |
}; |
}; |
1614 |
Int_t nz = 6; |
Int_t nz = 6; |
1615 |
Float_t zin[6]; // << define TOF z-coordinates |
Float_t zin[6]; // << define TOF z-coordinates |
1616 |
for (Int_t ip = 0; ip < nz; ip++) |
for (Int_t ip = 0; ip < nz; ip++) |
1617 |
zin[ip] = tof_obj->ToFLevel2::GetZTOF(tof_obj->ToFLevel2::GetToFPlaneID(ip)); // << read ToF plane z-coordinates |
zin[ip] = tof2_obj->ToFLevel2::GetZTOF(tof2_obj->ToFLevel2::GetToFPlaneID(ip)); // << read ToF plane z-coordinates |
1618 |
Trajectory *tr = new Trajectory(nz, zin); |
Trajectory *tr = new Trajectory(nz, zin); |
1619 |
// |
// |
1620 |
Int_t nphit_p = 0; |
Int_t nphit_p = 0; |
1623 |
Float_t enhit_i = 0.; |
Float_t enhit_i = 0.; |
1624 |
// |
// |
1625 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1626 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1627 |
if (pl == 1 || pl == 2 || pl == 5) { |
if (pl == 1 || pl == 2 || pl == 5) { |
1628 |
nphit_p++; |
nphit_p++; |
1629 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1634 |
// |
// |
1635 |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
1636 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1637 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1638 |
if (pl == 0) { |
if (pl == 0) { |
1639 |
nphit_p++; |
nphit_p++; |
1640 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1643 |
}; |
}; |
1644 |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
1645 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1646 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1647 |
if (pl == 3) { |
if (pl == 3) { |
1648 |
nphit_p++; |
nphit_p++; |
1649 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1652 |
}; |
}; |
1653 |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
1654 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1655 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1656 |
if (pl == 4) { |
if (pl == 4) { |
1657 |
nphit_p++; |
nphit_p++; |
1658 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1661 |
}; |
}; |
1662 |
|
|
1663 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1664 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1665 |
if (pl == 1 || pl == 2 || pl == 5) { |
if (pl == 1 || pl == 2 || pl == 5) { |
1666 |
nphit_i++; |
nphit_i++; |
1667 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1672 |
// |
// |
1673 |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
1674 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1675 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1676 |
if (pl == 0) { |
if (pl == 0) { |
1677 |
nphit_i++; |
nphit_i++; |
1678 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1681 |
}; |
}; |
1682 |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
1683 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1684 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1685 |
if (pl == 3) { |
if (pl == 3) { |
1686 |
nphit_i++; |
nphit_i++; |
1687 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1690 |
}; |
}; |
1691 |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
1692 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1693 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1694 |
if (pl == 4) { |
if (pl == 4) { |
1695 |
nphit_i++; |
nphit_i++; |
1696 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1734 |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
1735 |
|
|
1736 |
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
1737 |
// Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
// Int_t pl = tof2_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
1738 |
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
1739 |
// }; |
// }; |
1740 |
|
|
1741 |
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
1742 |
// Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
// Int_t pl = tof2_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
1743 |
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
1744 |
// }; |
// }; |
1745 |
// --- modified to count tdc signals (more efficient?) |
// --- modified to count tdc signals (more efficient?) |
1746 |
// --- and to implement check on tdcflag |
// --- and to implement check on tdcflag |
1747 |
for (Int_t ih = 0; ih < op->npmttdc; ih++) { |
for (Int_t ih = 0; ih < op->npmttdc; ih++) { |
1748 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmttdc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmttdc).At(ih)); |
1749 |
// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; |
// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; |
1750 |
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
1751 |
|| (use_S3 && (pl == 4 || pl == 5))) { |
|| (use_S3 && (pl == 4 || pl == 5))) { |
1755 |
}; |
}; |
1756 |
|
|
1757 |
for (Int_t ih = 0; ih < oi->npmttdc; ih++) { |
for (Int_t ih = 0; ih < oi->npmttdc; ih++) { |
1758 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmttdc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmttdc).At(ih)); |
1759 |
// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; |
// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; |
1760 |
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
1761 |
|| (use_S3 && (pl == 4 || pl == 5))) { |
|| (use_S3 && (pl == 4 || pl == 5))) { |
1930 |
|
|
1931 |
} |
} |
1932 |
; |
; |
1933 |
|
// |
1934 |
|
//-------------------------------------- |
1935 |
|
/** |
1936 |
|
* Sort physical (tracker) tracks. |
1937 |
|
* @param how String to set the sorting cryterium (es: "CAL" or "TRK+CAL+TOF" ecc...). |
1938 |
|
* Sorting cryteria: |
1939 |
|
* TRK: lower chi**2 |
1940 |
|
* CAL: lower Y spatial residual on the first calorimeter plane |
1941 |
|
* TOF: bigger numebr of hit PMTs along the track, on S12 S21 S32 (where paddles are along the Y axis). |
1942 |
|
* S1: (ask Emiliano) |
1943 |
|
* S2: (ask Emiliano) |
1944 |
|
* S3: (ask Emiliano) |
1945 |
|
* GP: more GP hits |
1946 |
|
* The default sorting cryterium is "TOF+CAL". |
1947 |
|
* |
1948 |
|
* The total number of physical tracks is always given by GetNTracks() and the it-th physical track can be retrieved by means of the methods GetTrack(int it) and GetTrack(int it, TString how). |
1949 |
|
* |
1950 |
|
* New version, with handling of extended tracks and nuclei tracks. |
1951 |
|
*/ |
1952 |
|
void PamLevel2::SortTracksNew() { |
1953 |
|
|
1954 |
|
//-------------------------------------------------- |
1955 |
|
//Check if the current event has already been sorted |
1956 |
|
//-------------------------------------------------- |
1957 |
|
if (issorted_new && lastsorted_new == GetReadEntry()) { |
1958 |
|
return; //already done for this event |
1959 |
|
} |
1960 |
|
|
1961 |
|
|
1962 |
|
// cout << "SORT" << endl; |
1963 |
|
|
1964 |
|
//Reset the sort flags, just in case something will go wrong... |
1965 |
|
issorted_new = false; |
1966 |
|
lastsorted_new = -1; |
1967 |
|
|
1968 |
|
//-------------------------------------------------- |
1969 |
|
// set input variables |
1970 |
|
//-------------------------------------------------- |
1971 |
|
|
1972 |
|
TString how = howtosort; |
1973 |
|
//Save current Object count |
1974 |
|
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
1975 |
|
|
1976 |
|
|
1977 |
|
|
1978 |
|
|
1979 |
|
TrkLevel2 * trk2 ; |
1980 |
|
CaloLevel2 * calo2; |
1981 |
|
ToFLevel2 * tof2 ; |
1982 |
|
OrbitalInfo * orb2 ; |
1983 |
|
|
1984 |
|
TClonesArray * trkext ; |
1985 |
|
TClonesArray * caloext; |
1986 |
|
TClonesArray * tofext ; |
1987 |
|
TClonesArray * orbext ; |
1988 |
|
|
1989 |
|
|
1990 |
|
// cout << "trk2_obj" << trk2_obj<< endl; |
1991 |
|
// cout << "trk2_nuc_obj" << trk2_nuc_obj<< endl; |
1992 |
|
// cout << " trk_ext_obj "<<trk_ext_obj<< endl; |
1993 |
|
// cout << " trk_ext_nuc_obj "<<trk_ext_nuc_obj<< endl; |
1994 |
|
|
1995 |
|
//----------------------------------------------------------- |
1996 |
|
// create/reset TCloneArrays to store tracks and their images |
1997 |
|
//----------------------------------------------------------- |
1998 |
|
|
1999 |
|
// cout << " PamLevel2::SortTracksNew() --- Clear TClonesArray objects"<<endl; |
2000 |
|
|
2001 |
|
// main tracks from standard alg |
2002 |
|
// if (!tsorted) |
2003 |
|
// tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2004 |
|
// tsorted->Clear("C+C");//Delete(); |
2005 |
|
// // track images from standard alg |
2006 |
|
// if (!timage) |
2007 |
|
// timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2008 |
|
// timage->Clear("C+C");//Delete(); |
2009 |
|
// // tracks from extended algorythm |
2010 |
|
// if(EXT && !text) |
2011 |
|
// text = new TClonesArray("PamTrack",trk_ext_obj->GetEntries()); |
2012 |
|
// if(text)text->Clear("C+C");//Delete(); |
2013 |
|
|
2014 |
|
if(tsorted)delete tsorted; |
2015 |
|
if(timage) delete timage; |
2016 |
|
if(text) delete text; |
2017 |
|
tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2018 |
|
timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2019 |
|
text = new TClonesArray("PamTrack",trk_ext_obj->GetEntries()); |
2020 |
|
|
2021 |
|
//----------------------------------------------------------- |
2022 |
|
// create/reset TCloneArrays to store tracks and their images |
2023 |
|
//----------------------------------------------------------- |
2024 |
|
if(NUC){ |
2025 |
|
|
2026 |
|
|
2027 |
|
if(tsorted_nuc)delete tsorted_nuc; |
2028 |
|
if(timage_nuc) delete timage_nuc; |
2029 |
|
if(text_nuc) delete text_nuc; |
2030 |
|
tsorted_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2031 |
|
timage_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2032 |
|
text_nuc = new TClonesArray("PamTrack",trk_ext_nuc_obj->GetEntries()); |
2033 |
|
|
2034 |
|
// main tracks from standard alg |
2035 |
|
// if (!tsorted_nuc) |
2036 |
|
// tsorted_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2037 |
|
// tsorted_nuc->Clear("C+C");//Delete(); |
2038 |
|
// // track images from standard alg |
2039 |
|
// if (!timage_nuc) |
2040 |
|
// timage_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2041 |
|
// timage_nuc->Clear("C+C");//Delete(); |
2042 |
|
// // tracks from extended algorythm |
2043 |
|
// if(EXT && !text_nuc) |
2044 |
|
// text_nuc = new TClonesArray("PamTrack",trk_ext_nuc_obj->GetEntries()); |
2045 |
|
// if(text_nuc)text_nuc->Clear("C+C");//Delete(); |
2046 |
|
|
2047 |
|
} |
2048 |
|
//-------------------------------------------------- |
2049 |
|
// retrieve sorting method |
2050 |
|
//-------------------------------------------------- |
2051 |
|
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
2052 |
|
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
2053 |
|
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
2054 |
|
Bool_t use_S1 = how.Contains("S1", TString::kIgnoreCase); |
2055 |
|
Bool_t use_S2 = how.Contains("S2", TString::kIgnoreCase); |
2056 |
|
Bool_t use_S3 = how.Contains("S3", TString::kIgnoreCase); |
2057 |
|
Bool_t use_GP = how.Contains("GP", TString::kIgnoreCase); |
2058 |
|
|
2059 |
|
if (use_TOF) { |
2060 |
|
use_S1 = true; |
2061 |
|
use_S2 = true; |
2062 |
|
use_S3 = true; |
2063 |
|
}; |
2064 |
|
if (!CAL2 && use_CAL) |
2065 |
|
use_CAL = false; |
2066 |
|
if (!TOF) { |
2067 |
|
use_TOF = false; |
2068 |
|
use_S1 = false; |
2069 |
|
use_S2 = false; |
2070 |
|
use_S3 = false; |
2071 |
|
} |
2072 |
|
if (!GP) { |
2073 |
|
use_GP = false; |
2074 |
|
} |
2075 |
|
|
2076 |
|
if (!TRK2) { |
2077 |
|
cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
2078 |
|
return; |
2079 |
|
}; |
2080 |
|
|
2081 |
|
|
2082 |
|
/////////////////////////////////////////////////////////////////////////////////// |
2083 |
|
// |
2084 |
|
// sort tracks and fill PamTrack arrays |
2085 |
|
// |
2086 |
|
/////////////////////////////////////////////////////////////////////////////////// |
2087 |
|
for(int doit=0; doit<2; doit++){ |
2088 |
|
|
2089 |
|
// cout << "doit "<<doit<<endl; |
2090 |
|
|
2091 |
|
|
2092 |
|
if(doit == 0){ |
2093 |
|
|
2094 |
|
trk2 = trk2_obj; |
2095 |
|
calo2 = calo2_obj; |
2096 |
|
tof2 = tof2_obj; |
2097 |
|
orb2 = orb2_obj; |
2098 |
|
|
2099 |
|
trkext = trk_ext_obj; |
2100 |
|
caloext = calo_ext_obj; |
2101 |
|
tofext = tof_ext_obj; |
2102 |
|
orbext = orb_ext_obj; |
2103 |
|
|
2104 |
|
|
2105 |
|
|
2106 |
|
|
2107 |
|
|
2108 |
|
}else if (doit == 1){ |
2109 |
|
|
2110 |
|
if(!NUC)break; |
2111 |
|
|
2112 |
|
|
2113 |
|
trk2 = trk2_nuc_obj; |
2114 |
|
calo2 = calo2_nuc_obj; |
2115 |
|
tof2 = tof2_nuc_obj; |
2116 |
|
orb2 = orb2_nuc_obj; |
2117 |
|
|
2118 |
|
trkext = trk_ext_nuc_obj; |
2119 |
|
caloext = calo_ext_nuc_obj; |
2120 |
|
tofext = tof_ext_nuc_obj; |
2121 |
|
orbext = orb_ext_nuc_obj; |
2122 |
|
|
2123 |
|
|
2124 |
|
|
2125 |
|
|
2126 |
|
} |
2127 |
|
|
2128 |
|
// cout << "trk2" << trk2<<endl; |
2129 |
|
// cout << "calo2" << calo2<<endl; |
2130 |
|
// cout << "tof2" << tof2<<endl; |
2131 |
|
// cout << "orb2" << orb2<<endl; |
2132 |
|
// cout << "trkext" <<trkext <<endl; |
2133 |
|
// cout << "tofext" << tofext<<endl; |
2134 |
|
// cout << "caloext" << caloext<<endl; |
2135 |
|
// cout << "orbext" << orbext<<endl; |
2136 |
|
|
2137 |
|
TClonesArray &ttext = (doit==0 ? *text : *text_nuc); |
2138 |
|
TClonesArray &ttimage = (doit==0 ? *timage : *timage_nuc); |
2139 |
|
TClonesArray &ttsorted = (doit==0 ? *tsorted : *tsorted_nuc); |
2140 |
|
|
2141 |
|
// cout << "tsorted + timage "<<doit<<endl; |
2142 |
|
|
2143 |
|
//-------------------------------------------------- |
2144 |
|
// loop over "physical" tracks sorted by the tracker |
2145 |
|
//-------------------------------------------------- |
2146 |
|
for (Int_t i = 0; i < trk2->TrkLevel2::GetNTracks(); i++) { |
2147 |
|
|
2148 |
|
TrkTrack *ts = 0; |
2149 |
|
CaloTrkVar *cs = 0; |
2150 |
|
ToFTrkVar *os = 0; |
2151 |
|
OrbitalInfoTrkVar *rs = 0; |
2152 |
|
|
2153 |
|
// get tracker tracks |
2154 |
|
TrkTrack *tp = trk2->GetTrack(i); //tracker |
2155 |
|
CaloTrkVar *cp = calo2->GetCaloStoredTrack(tp->GetSeqNo()); |
2156 |
|
ToFTrkVar *op = tof2->GetToFStoredTrack(tp->GetSeqNo()); |
2157 |
|
OrbitalInfoTrkVar *rp = orb2->GetOrbitalInfoStoredTrack(tp->GetSeqNo()); |
2158 |
|
|
2159 |
|
TrkTrack *ti = 0; //tracker (image) |
2160 |
|
CaloTrkVar *ci = 0; |
2161 |
|
ToFTrkVar *oi = 0; |
2162 |
|
OrbitalInfoTrkVar *ri = 0; |
2163 |
|
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
2164 |
|
// if track has an image, check image selection |
2165 |
|
|
2166 |
|
Int_t tp_score = 0; //main track sorted by the tracker |
2167 |
|
Int_t ti_score = 0; //image track |
2168 |
|
Int_t totp_score = 0; //main track sorted by the tracker |
2169 |
|
Int_t toti_score = 0; //image track |
2170 |
|
|
2171 |
|
if (tp->HasImage()) { |
2172 |
|
|
2173 |
|
ti = trk2->GetTrackImage(i); //tracker (image) |
2174 |
|
ci = calo2->GetCaloStoredTrack(ti->GetSeqNo()); |
2175 |
|
oi = tof2->GetToFStoredTrack(ti->GetSeqNo()); |
2176 |
|
ri = orb2->GetOrbitalInfoStoredTrack(ti->GetSeqNo()); |
2177 |
|
|
2178 |
|
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
2179 |
|
|
2180 |
|
//assign starting scores |
2181 |
|
tp_score = 0; //main track sorted by the tracker |
2182 |
|
ti_score = 0; //image track |
2183 |
|
|
2184 |
|
// ----------------------------------------------------------------------------------------- |
2185 |
|
// ***************************************************************************************** |
2186 |
|
// ----------------------------------------------------------------------------------------- |
2187 |
|
// calorimeter check |
2188 |
|
// ----------------------------------------------------------------------------------------- |
2189 |
|
if (use_CAL && !calo2) { |
2190 |
|
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but CaloLevel2 not loaded !!!"; |
2191 |
|
return; |
2192 |
|
}; |
2193 |
|
if (use_CAL && !cp && ci) { |
2194 |
|
ti_score++; |
2195 |
|
toti_score++; |
2196 |
|
}; |
2197 |
|
if (use_CAL && cp && !ci) { |
2198 |
|
tp_score++; |
2199 |
|
totp_score++; |
2200 |
|
}; |
2201 |
|
if (use_CAL && cp && ci && true) { |
2202 |
|
|
2203 |
|
if (cp->npresh > ci->npresh && true) { |
2204 |
|
tp_score++; |
2205 |
|
totp_score++; |
2206 |
|
}; |
2207 |
|
if (cp->npresh < ci->npresh && true) { |
2208 |
|
ti_score++; |
2209 |
|
toti_score++; |
2210 |
|
}; |
2211 |
|
|
2212 |
|
// cout << "CALO "<<tp_score<<ti_score<<endl; |
2213 |
|
|
2214 |
|
}; |
2215 |
|
// ----------------------------------------------------------------------------------------- |
2216 |
|
// ***************************************************************************************** |
2217 |
|
// ----------------------------------------------------------------------------------------- |
2218 |
|
// TOF check |
2219 |
|
// ----------------------------------------------------------------------------------------- |
2220 |
|
// check the number of hit pmts along the track |
2221 |
|
// on S12 S21 and S32, where paddles are parallel to Y axis |
2222 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && !tof2) { |
2223 |
|
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but ToFLevel2 not loaded !!!"; |
2224 |
|
return; |
2225 |
|
}; |
2226 |
|
// |
2227 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && !op && oi) { |
2228 |
|
ti_score++; |
2229 |
|
toti_score++; |
2230 |
|
}; |
2231 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && op && !oi) { |
2232 |
|
tp_score++; |
2233 |
|
totp_score++; |
2234 |
|
}; |
2235 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && op && oi) { |
2236 |
|
// |
2237 |
|
Float_t sen = 0.; |
2238 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2239 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2240 |
|
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
2241 |
|
sen += (op->dedx).At(ih); |
2242 |
|
}; |
2243 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2244 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2245 |
|
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
2246 |
|
sen += (oi->dedx).At(ih); |
2247 |
|
}; |
2248 |
|
// |
2249 |
|
if (sen >= sortthr && false) { // temporary disabled NUCLEI special algorithm since the new one should work for every particle (to be checked!) |
2250 |
|
//printf(" IS A NUCLEUS! en = %f \n",sen); |
2251 |
|
// |
2252 |
|
// is a nucleus use a different algorithm |
2253 |
|
// |
2254 |
|
Int_t nz = 6; |
2255 |
|
Float_t zin[6]; // << define TOF z-coordinates |
2256 |
|
for (Int_t ip = 0; ip < nz; ip++) |
2257 |
|
zin[ip] = tof2->GetZTOF(tof2->GetToFPlaneID(ip)); // << read ToF plane z-coordinates |
2258 |
|
Trajectory *tr = new Trajectory(nz, zin); |
2259 |
|
// |
2260 |
|
Int_t nphit_p = 0; |
2261 |
|
Int_t nphit_i = 0; |
2262 |
|
Float_t enhit_p = 0.; |
2263 |
|
Float_t enhit_i = 0.; |
2264 |
|
// |
2265 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2266 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2267 |
|
if (pl == 1 || pl == 2 || pl == 5) { |
2268 |
|
nphit_p++; |
2269 |
|
enhit_p += (op->dedx).At(ih); |
2270 |
|
}; |
2271 |
|
}; |
2272 |
|
// |
2273 |
|
tp->DoTrack2(tr); |
2274 |
|
// |
2275 |
|
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
2276 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2277 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2278 |
|
if (pl == 0) { |
2279 |
|
nphit_p++; |
2280 |
|
enhit_p += (op->dedx).At(ih); |
2281 |
|
}; |
2282 |
|
}; |
2283 |
|
}; |
2284 |
|
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
2285 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2286 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2287 |
|
if (pl == 3) { |
2288 |
|
nphit_p++; |
2289 |
|
enhit_p += (op->dedx).At(ih); |
2290 |
|
}; |
2291 |
|
}; |
2292 |
|
}; |
2293 |
|
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
2294 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2295 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2296 |
|
if (pl == 4) { |
2297 |
|
nphit_p++; |
2298 |
|
enhit_p += (op->dedx).At(ih); |
2299 |
|
}; |
2300 |
|
}; |
2301 |
|
}; |
2302 |
|
|
2303 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2304 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2305 |
|
if (pl == 1 || pl == 2 || pl == 5) { |
2306 |
|
nphit_i++; |
2307 |
|
enhit_i += (op->dedx).At(ih); |
2308 |
|
}; |
2309 |
|
}; |
2310 |
|
// |
2311 |
|
ti->DoTrack2(tr); |
2312 |
|
// |
2313 |
|
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
2314 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2315 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2316 |
|
if (pl == 0) { |
2317 |
|
nphit_i++; |
2318 |
|
enhit_i += (op->dedx).At(ih); |
2319 |
|
}; |
2320 |
|
}; |
2321 |
|
}; |
2322 |
|
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
2323 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2324 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2325 |
|
if (pl == 3) { |
2326 |
|
nphit_i++; |
2327 |
|
enhit_i += (op->dedx).At(ih); |
2328 |
|
}; |
2329 |
|
}; |
2330 |
|
}; |
2331 |
|
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
2332 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2333 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2334 |
|
if (pl == 4) { |
2335 |
|
nphit_i++; |
2336 |
|
enhit_i += (op->dedx).At(ih); |
2337 |
|
}; |
2338 |
|
}; |
2339 |
|
}; |
2340 |
|
|
2341 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && (nphit_p + nphit_i) != 0 && true) { |
2342 |
|
|
2343 |
|
// printf(" seqno %i nphit_p %i nphit_i %i enhit_p %f enhit_i %f \n",trk2_obj->TrkLevel2::GetSeqNo(i),nphit_p,nphit_i,enhit_p,enhit_i); |
2344 |
|
// printf(" score p %i score i %i \n",tp_score,ti_score); |
2345 |
|
// if( enhit_p > enhit_i ) tp_score++; |
2346 |
|
// if( nphit_p >= nphit_i && enhit_p > enhit_i ) tp_score++; |
2347 |
|
if (nphit_p > nphit_i) |
2348 |
|
tp_score++; |
2349 |
|
if (nphit_p < nphit_i) |
2350 |
|
ti_score++; |
2351 |
|
if (nphit_p == nphit_i) { |
2352 |
|
if (enhit_p > enhit_i) |
2353 |
|
tp_score++; |
2354 |
|
else |
2355 |
|
ti_score++; |
2356 |
|
}; |
2357 |
|
// printf(" dopo score p %i score i %i \n",tp_score,ti_score); |
2358 |
|
}; |
2359 |
|
delete tr; |
2360 |
|
// |
2361 |
|
} |
2362 |
|
else { |
2363 |
|
// ------------- |
2364 |
|
// NOT a NUCLEUS |
2365 |
|
// ------------- |
2366 |
|
//printf(" NOT a NUCLEUS! en = %f \n",sen); |
2367 |
|
|
2368 |
|
Int_t nphit_p = 0; |
2369 |
|
Int_t nphit_i = 0; |
2370 |
|
|
2371 |
|
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
2372 |
|
cout << "track: npmttdc "<< op->npmttdc << endl; |
2373 |
|
cout << "image: npmtadc "<< oi->npmtadc << endl; |
2374 |
|
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
2375 |
|
|
2376 |
|
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
2377 |
|
// Int_t pl = tof2_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
2378 |
|
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
2379 |
|
// }; |
2380 |
|
|
2381 |
|
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
2382 |
|
// Int_t pl = tof2_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
2383 |
|
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
2384 |
|
// }; |
2385 |
|
// --- modified to count tdc signals (more efficient?) |
2386 |
|
// --- and to implement check on tdcflag |
2387 |
|
for (Int_t ih = 0; ih < op->npmttdc; ih++) { |
2388 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmttdc).At(ih)); |
2389 |
|
// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; |
2390 |
|
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
2391 |
|
|| (use_S3 && (pl == 4 || pl == 5))) { |
2392 |
|
if ((op->tdcflag).At(ih) == 0) |
2393 |
|
nphit_p++; |
2394 |
|
}; |
2395 |
|
}; |
2396 |
|
|
2397 |
|
for (Int_t ih = 0; ih < oi->npmttdc; ih++) { |
2398 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmttdc).At(ih)); |
2399 |
|
// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; |
2400 |
|
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
2401 |
|
|| (use_S3 && (pl == 4 || pl == 5))) { |
2402 |
|
if ((oi->tdcflag).At(ih) == 0) |
2403 |
|
nphit_i++; |
2404 |
|
}; |
2405 |
|
}; |
2406 |
|
|
2407 |
|
if ((nphit_p + nphit_i) != 0 && true) { |
2408 |
|
|
2409 |
|
if (nphit_p != nphit_i) { |
2410 |
|
totp_score += nphit_p; |
2411 |
|
toti_score += nphit_i; |
2412 |
|
tp_score += nphit_p; |
2413 |
|
ti_score += nphit_i; |
2414 |
|
}; |
2415 |
|
// if ( nphit_p > nphit_i) tp_score+=nphit_p; |
2416 |
|
// else if( nphit_p < nphit_i) ti_score+=nphit_i; |
2417 |
|
// else ;//niente |
2418 |
|
}; |
2419 |
|
}; |
2420 |
|
// cout << "TOF "<<tp_score<<ti_score<<endl; |
2421 |
|
}; |
2422 |
|
|
2423 |
|
// if(tp_score == ti_score) use_TRK = true; |
2424 |
|
|
2425 |
|
|
2426 |
|
// ----------------------------------------------------------------------------------------- |
2427 |
|
// ***************************************************************************************** |
2428 |
|
// ----------------------------------------------------------------------------------------- |
2429 |
|
// tracker check |
2430 |
|
// ----------------------------------------------------------------------------------------- |
2431 |
|
// chi**2 difference is not always large enough to distinguish among |
2432 |
|
// the real track and its image. |
2433 |
|
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
2434 |
|
// *** MODIFIED ON AUGUST 2007 *** |
2435 |
|
if (use_TRK) { |
2436 |
|
// if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
2437 |
|
// else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
2438 |
|
|
2439 |
|
// CHECK 1 : number of points along X |
2440 |
|
if (tp->GetNX() >= ti->GetNX()) { |
2441 |
|
tp_score++; |
2442 |
|
totp_score++; |
2443 |
|
}; |
2444 |
|
if (tp->GetNX() <= ti->GetNX()) { |
2445 |
|
ti_score++; |
2446 |
|
toti_score++; |
2447 |
|
}; |
2448 |
|
// CHECK 2 : number of points along Y |
2449 |
|
if (tp->GetNY() >= ti->GetNY()) { |
2450 |
|
tp_score++; |
2451 |
|
totp_score++; |
2452 |
|
}; |
2453 |
|
if (tp->GetNY() <= ti->GetNY()) { |
2454 |
|
ti_score++; |
2455 |
|
toti_score++; |
2456 |
|
}; |
2457 |
|
|
2458 |
|
// cout << "TRK "<<tp_score<<ti_score<<endl; |
2459 |
|
}; |
2460 |
|
|
2461 |
|
// ----------------------------------------------------------------------------------------- |
2462 |
|
// ***************************************************************************************** |
2463 |
|
// ----------------------------------------------------------------------------------------- |
2464 |
|
// GPamela check |
2465 |
|
// ----------------------------------------------------------------------------------------- |
2466 |
|
|
2467 |
|
//--------------------------------------------------- |
2468 |
|
// count the number of GP hits |
2469 |
|
//--------------------------------------------------- |
2470 |
|
if (use_GP) { |
2471 |
|
int ngphits_p = 0; |
2472 |
|
int ngphits_i = 0; |
2473 |
|
float toll = 0.02; //200 micron |
2474 |
|
for (int ih = 0; ih < GetGPamela()->Nthspe; ih++) { |
2475 |
|
int ip = (Int_t) GetGPamela()->Itrpb[ih] - 1; |
2476 |
|
if (tp && tp->YGood(ip) && fabs(tp->ym[ip] - GetGPamela()->Yavspe[ih]) < toll && true) |
2477 |
|
ngphits_p++; |
2478 |
|
if (ti && ti->YGood(ip) && fabs(ti->ym[ip] - GetGPamela()->Yavspe[ih]) < toll && true) |
2479 |
|
ngphits_i++; |
2480 |
|
} |
2481 |
|
if (ngphits_p > ngphits_i && true) { |
2482 |
|
tp_score++; |
2483 |
|
totp_score++; |
2484 |
|
} |
2485 |
|
if (ngphits_p < ngphits_i && true) { |
2486 |
|
ti_score++; |
2487 |
|
toti_score++; |
2488 |
|
} |
2489 |
|
} |
2490 |
|
|
2491 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2492 |
|
// the winner is.... |
2493 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2494 |
|
if (tp_score > ti_score) { |
2495 |
|
|
2496 |
|
} |
2497 |
|
else if (tp_score < ti_score) { |
2498 |
|
|
2499 |
|
ts = ti;//its image!! |
2500 |
|
cs = ci; |
2501 |
|
os = oi; |
2502 |
|
rs = ri; |
2503 |
|
Int_t totis = toti_score; |
2504 |
|
|
2505 |
|
ti = tp;//its image!! |
2506 |
|
ci = cp; |
2507 |
|
oi = op; |
2508 |
|
ri = rp; |
2509 |
|
|
2510 |
|
tp = ts;//its image!! |
2511 |
|
cp = cs; |
2512 |
|
op = os; |
2513 |
|
rp = rs; |
2514 |
|
|
2515 |
|
toti_score = totp_score; |
2516 |
|
totp_score = totis; |
2517 |
|
|
2518 |
|
} |
2519 |
|
else { |
2520 |
|
|
2521 |
|
// cout << "Warning - track image ambiguity not solved" << endl; |
2522 |
|
|
2523 |
|
}; |
2524 |
|
|
2525 |
|
} |
2526 |
|
else { |
2527 |
|
totp_score = 1; |
2528 |
|
toti_score = 0; |
2529 |
|
|
2530 |
|
// ts = tp; |
2531 |
|
// cs = cp; |
2532 |
|
// os = op; |
2533 |
|
}; |
2534 |
|
|
2535 |
|
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
2536 |
|
// sorted_tracks->Add(ts);//save the track in the sorted array |
2537 |
|
// sorted_tracks.Add(ts);//save the track in the sorted array |
2538 |
|
// sorted_tracks.Add(tp);//save the track in the sorted array |
2539 |
|
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
2540 |
|
// cout<<"o "<<tp<<endl; |
2541 |
|
// cout<<"o "<<cp<<endl; |
2542 |
|
// cout<<"o "<<op<<endl; |
2543 |
|
|
2544 |
|
new (ttsorted[i]) PamTrack(tp, cp, op, rp); |
2545 |
|
new (ttimage[i]) PamTrack(ti, ci, oi, ri); |
2546 |
|
|
2547 |
|
((PamTrack*) (ttsorted[i]))->SetPScore(totp_score); |
2548 |
|
((PamTrack*) (ttsorted[i]))->SetIScore(toti_score); |
2549 |
|
((PamTrack*) (ttimage[i]))->SetPScore(totp_score); |
2550 |
|
((PamTrack*) (ttimage[i]))->SetIScore(toti_score); |
2551 |
|
}; |
2552 |
|
|
2553 |
|
|
2554 |
|
|
2555 |
|
|
2556 |
|
|
2557 |
|
// if (tsorted->GetEntries() != trk2->GetNTracks()) { |
2558 |
|
// cout << "void PamLevel2::SortTracks(): tsorted->GetEntries() " << tsorted->GetEntries() |
2559 |
|
// << " != trk2->GetNTracks() = " << trk2->GetNTracks() << endl; |
2560 |
|
// tsorted->Delete(); |
2561 |
|
// tsorted = 0; |
2562 |
|
// timage->Delete(); |
2563 |
|
// timage = 0; |
2564 |
|
// } |
2565 |
|
|
2566 |
|
|
2567 |
|
// cout << "text "<<doit<<endl; |
2568 |
|
|
2569 |
|
|
2570 |
|
//-------------------------------------------------- |
2571 |
|
// fill array with extended tracks (this is easy...) |
2572 |
|
//-------------------------------------------------- |
2573 |
|
if(EXT){ |
2574 |
|
for(int it=0; it<trkext->GetEntries(); it++){ |
2575 |
|
|
2576 |
|
new (ttext[it]) PamTrack((ExtTrack*)(*trkext)[it], (CaloTrkVar*)(*caloext)[it], (ToFTrkVar*)(*tofext)[it], (OrbitalInfoTrkVar*)(*orbext)[it]); |
2577 |
|
|
2578 |
|
} |
2579 |
|
} |
2580 |
|
|
2581 |
|
|
2582 |
|
|
2583 |
|
}; |
2584 |
|
|
2585 |
|
|
2586 |
|
//Restore Object count |
2587 |
|
//To save space in the table keeping track of all referenced objects |
2588 |
|
//We reset the object count to what it was at the beginning of the event. |
2589 |
|
TProcessID::SetObjectCount(ObjectNumber); |
2590 |
|
|
2591 |
|
//Everything went fine so the current event can be tagged as sorted |
2592 |
|
issorted_new = true; |
2593 |
|
lastsorted_new = GetReadEntry(); |
2594 |
|
|
2595 |
|
// cout << " tsorted "<< tsorted << " "<<(tsorted ? tsorted->GetEntries() : 0)<<endl; |
2596 |
|
// cout << " timage "<< timage << " "<<(timage ? timage->GetEntries() : 0)<<endl; |
2597 |
|
// cout << " text "<< text << " "<<(text ? text->GetEntries() : 0)<<endl; |
2598 |
|
|
2599 |
|
|
2600 |
|
}; |
2601 |
//-------------------------------------- |
//-------------------------------------- |
2602 |
// |
// |
2603 |
// |
// |
2606 |
* This method overrides TrkLevel2::GetTracks(), where sorting is done by decreasing number of fit points and increasing chi^2. |
* This method overrides TrkLevel2::GetTracks(), where sorting is done by decreasing number of fit points and increasing chi^2. |
2607 |
* PamLevel2::GetTracks() keeps the same track order given by TrkLevel2::GetTracks(), but checks image selection by using calorimeter and ToF tracking information. |
* PamLevel2::GetTracks() keeps the same track order given by TrkLevel2::GetTracks(), but checks image selection by using calorimeter and ToF tracking information. |
2608 |
*/ |
*/ |
2609 |
|
|
2610 |
// TRefArray *PamLevel2::GetTracks(){ |
// TRefArray *PamLevel2::GetTracks(){ |
2611 |
|
|
2612 |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
2617 |
// return &sorted_tracks; |
// return &sorted_tracks; |
2618 |
|
|
2619 |
// }; |
// }; |
|
TClonesArray *PamLevel2::GetTracks() { |
|
2620 |
|
|
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
|
|
SortTracks(); |
|
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
|
|
|
|
|
return tsorted; |
|
2621 |
|
|
|
} |
|
|
; |
|
2622 |
//-------------------------------------- |
//-------------------------------------- |
2623 |
// |
// |
2624 |
// |
// |
2625 |
//-------------------------------------- |
//-------------------------------------- |
2626 |
|
|
2627 |
/** |
/** |
2628 |
* Retrieves the it-th Pamela "physical" track. |
* Retrieves the it-th Pamela "physical" track. |
2629 |
* It override TrkLevel2::GetTrack(int it). |
* It override TrkLevel2::GetTrack(int it). |
2630 |
* @param it Track number, ranging from 0 to GetNTracks(). |
* @param it Track number, ranging from 0 to GetNTracks(). |
2631 |
*/ |
*/ |
2632 |
PamTrack *PamLevel2::GetTrack(int it) { |
PamTrack *PamLevel2::GetTrackOld(int it) { |
2633 |
|
|
2634 |
// if(!trk2_obj) return 0; |
PamTrack *track = NULL; |
2635 |
|
|
|
// // *-*-*-*+-*-*-*-*-*-*-*-*-* |
|
|
// SortTracks("+CAL+TOF"); |
|
|
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
|
|
// // if(!sorted_tracks)return 0; |
|
|
// if(sorted_tracks.IsEmpty())return 0; |
|
|
|
|
|
// PamTrack *track = 0; |
|
|
|
|
|
// if( it >=0 && it < trk2_obj->TrkLevel2::GetNTracks() && it<sorted_tracks.GetEntriesFast() ){ |
|
|
// TrkTrack *t = (TrkTrack*)sorted_tracks.At(it); |
|
|
// track = GetPamTrackAlong(t); |
|
|
// }else{ |
|
|
// cout << "PamLevel2::GetTrack(int) : tracker track SeqNo "<< it <<" does not exist (GetNTracks() = "<<trk2_obj->TrkLevel2::GetNTracks()<<")"<<endl; |
|
|
// }; |
|
|
|
|
|
// return track; |
|
|
|
|
|
// cout << "PamLevel2::GetTrack(int it) "<<endl; |
|
2636 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2637 |
SortTracks(); |
SortTracks(); |
2638 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2639 |
if (!tsorted) |
if (!tsorted) |
2640 |
return 0; |
return track; |
2641 |
if (!tsorted->GetEntries()) |
if (!tsorted->GetEntries()) |
2642 |
return 0; |
return track; |
2643 |
|
|
|
PamTrack *track = 0; |
|
2644 |
|
|
2645 |
if (it >= 0 && it < trk2_obj->TrkLevel2::GetNTracks()) { |
if (it >= 0 && it < trk2_obj->TrkLevel2::GetNTracks()) { |
|
// TrkTrack *t = (TrkTrack*)sorted_tracks.At(it); |
|
|
// track = GetPamTrackAlong(t); |
|
|
//TClonesArray &t = *(tsorted); |
|
|
//track = (PamTrack*)t[it]; |
|
2646 |
track = (PamTrack*)((*tsorted)[it]); |
track = (PamTrack*)((*tsorted)[it]); |
2647 |
} |
} |
2648 |
else { |
else { |
2649 |
cout << "PamLevel2::GetTrack(int) : tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
cout << "PamLevel2::GetTrackOld(int) : tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
2650 |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
2651 |
}; |
}; |
2652 |
|
|
2653 |
return track; |
return track; |
2654 |
|
|
2655 |
|
}; |
2656 |
|
|
2657 |
|
//PamTrack *PamLevel2::GetTrack(int it) { return GetTrack(it,trkAlg); }; |
2658 |
|
|
2659 |
|
/** |
2660 |
|
* Retrieves the it-th Pamela "physical" track. |
2661 |
|
* It override TrkLevel2::GetTrack(int it). |
2662 |
|
* @param it Track number, ranging from 0 to GetNTracks(). |
2663 |
|
* @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation. |
2664 |
|
*/ |
2665 |
|
PamTrack *PamLevel2::GetTrack(int it, const char* alg) { |
2666 |
|
|
2667 |
|
TString s(alg); |
2668 |
|
if(!s.CompareTo("") ||!s.CompareTo("STD") )return GetTrackOld(it); //old algorythm |
2669 |
|
|
2670 |
|
|
2671 |
|
SortTracksNew(); |
2672 |
|
// >> fill tsorted, timage and text |
2673 |
|
|
2674 |
|
if ( ( !s.Contains("EXTF", TString::kIgnoreCase) || !EXT )){ //not forced exteded-alg requested (or exteded-data missing) |
2675 |
|
|
2676 |
|
if( s.Contains("NUC")){ |
2677 |
|
if( |
2678 |
|
tsorted_nuc && |
2679 |
|
it < tsorted_nuc->GetEntries() && //enough tracks found |
2680 |
|
it >= 0 && //valid index |
2681 |
|
true) return (PamTrack*)((*tsorted_nuc)[it]); //ok return the track |
2682 |
|
}else{ |
2683 |
|
if( |
2684 |
|
tsorted && |
2685 |
|
it < tsorted->GetEntries() && //enough tracks found |
2686 |
|
it >= 0 && //valid index |
2687 |
|
true )return (PamTrack*)((*tsorted)[it]); //ok return the track |
2688 |
|
} |
2689 |
|
|
2690 |
|
} |
2691 |
|
|
2692 |
|
|
2693 |
|
///////////////////////////////////////////////////////////////////////// |
2694 |
|
/// if requested get track from extended algorythm output |
2695 |
|
///////////////////////////////////////////////////////////////////////// |
2696 |
|
|
2697 |
|
if(s.Contains("EXT", TString::kIgnoreCase) && EXT){//if exteded-alg requested |
2698 |
|
|
2699 |
|
if(s.Contains("NUC")){ |
2700 |
|
if( |
2701 |
|
text_nuc && |
2702 |
|
it < text_nuc->GetEntries() && //enough tracks found |
2703 |
|
it >= 0 && //valid index |
2704 |
|
true) return (PamTrack*)((*text_nuc)[it]); |
2705 |
|
}else{ |
2706 |
|
if( |
2707 |
|
text && |
2708 |
|
it < text->GetEntries() && //enough tracks found |
2709 |
|
it >= 0 && //valid index |
2710 |
|
true) return (PamTrack*)((*text)[it]); |
2711 |
|
} |
2712 |
|
|
2713 |
|
}; |
2714 |
|
|
2715 |
|
|
2716 |
|
cout << "PamTrack *PamLevel2::GetTrack("<<it<<","<<alg<<") -- wrong track number or unrecognised algorithm"<<endl; |
2717 |
|
|
2718 |
|
return NULL; |
2719 |
|
|
2720 |
|
} |
2721 |
|
; |
2722 |
|
TClonesArray *PamLevel2::GetTracks() { |
2723 |
|
|
2724 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2725 |
|
SortTracks(); |
2726 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2727 |
|
|
2728 |
|
return tsorted; |
2729 |
|
|
2730 |
} |
} |
2731 |
; |
; |
2732 |
|
Int_t PamLevel2::GetNTracks(const char* alg) { |
2733 |
|
|
2734 |
|
|
2735 |
|
// cout << " trk_nuc_obj->GetEntries() "<<trk_nuc_obj->GetEntries()<<" trk2_nuc_obj->GetNTracks() "<<trk2_nuc_obj->GetNTracks()<<endl; |
2736 |
|
|
2737 |
|
TString s(alg); |
2738 |
|
|
2739 |
|
if(!s.CompareTo("") || !s.CompareTo("STD"))return trk2_obj->TrkLevel2::GetNTracks(); //standard algorythm |
2740 |
|
|
2741 |
|
if(s.Contains("EXTF", TString::kIgnoreCase) && EXT){ |
2742 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && NUC)return trk_ext_nuc_obj->GetEntries();//ok |
2743 |
|
return trk_ext_obj->GetEntries();//ok |
2744 |
|
} |
2745 |
|
if( s.Contains("EXT", TString::kIgnoreCase) && EXT) { |
2746 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && NUC) |
2747 |
|
return (trk2_nuc_obj->TrkLevel2::GetNTracks() ? trk2_nuc_obj->TrkLevel2::GetNTracks() : trk_ext_nuc_obj->GetEntries() ); |
2748 |
|
return (trk2_obj->TrkLevel2::GetNTracks() ? trk2_obj->TrkLevel2::GetNTracks() : trk_ext_obj->GetEntries() ); |
2749 |
|
} |
2750 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && NUC ) |
2751 |
|
return trk2_nuc_obj->TrkLevel2::GetNTracks(); |
2752 |
|
|
2753 |
|
cout << "Int_t PamLevel2::GetNTracks("<<alg<<") -- unrecognised algorithm"<<endl; |
2754 |
|
|
2755 |
|
return 0; |
2756 |
|
|
2757 |
|
} |
2758 |
|
|
2759 |
|
|
2760 |
//-------------------------------------- |
//-------------------------------------- |
2761 |
// |
// |
2765 |
* Retrieves (if present) the image of the it-th Pamela "physical" track, sorted by the method PamLevel2::SortTracks(). |
* Retrieves (if present) the image of the it-th Pamela "physical" track, sorted by the method PamLevel2::SortTracks(). |
2766 |
* @param it Track number, ranging from 0 to GetNTracks(). |
* @param it Track number, ranging from 0 to GetNTracks(). |
2767 |
*/ |
*/ |
2768 |
PamTrack *PamLevel2::GetTrackImage(int it) { |
PamTrack *PamLevel2::GetTrackImageOld(int it) { |
2769 |
|
|
2770 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2771 |
SortTracks(); |
SortTracks(); |
2789 |
}; |
}; |
2790 |
} |
} |
2791 |
else { |
else { |
2792 |
cout << "PamLevel2::GetTrackImage(int) : Tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
cout << "PamLevel2::GetTrackImageOld(int) : Tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
2793 |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
2794 |
}; |
}; |
2795 |
|
|
2796 |
return image; |
return image; |
2797 |
} |
} |
2798 |
|
/** |
2799 |
|
* Retrieves (if present) the image of the it-th Pamela "physical" track, sorted by the method PamLevel2::SortTracks(). |
2800 |
|
* @param it Track number, ranging from 0 to GetNTracks(). |
2801 |
|
* @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation. |
2802 |
|
*/ |
2803 |
|
PamTrack *PamLevel2::GetTrackImage(int it, const char* alg) { |
2804 |
|
|
2805 |
|
TString s(alg); |
2806 |
|
if(!s.CompareTo("") || !s.CompareTo("STD"))return GetTrackImageOld(it); //old algorythm |
2807 |
|
|
2808 |
|
|
2809 |
|
SortTracksNew(); |
2810 |
|
// >> fill tsorted, timage and text |
2811 |
|
|
2812 |
|
if ( ( !s.Contains("EXTF", TString::kIgnoreCase) || !EXT )){ //not forced exteded-alg requested (or exteded-data missing) |
2813 |
|
|
2814 |
|
if( s.Contains("NUC")){ |
2815 |
|
if( |
2816 |
|
tsorted_nuc && |
2817 |
|
it < tsorted_nuc->GetEntries() && //enough tracks found |
2818 |
|
it >= 0 && //valid index |
2819 |
|
true){ |
2820 |
|
TClonesArray &t = *(tsorted_nuc); |
2821 |
|
PamTrack *temp = (PamTrack*) t[it]; |
2822 |
|
if (temp->GetTrkTrack()->HasImage()) { |
2823 |
|
return (PamTrack*)((*timage_nuc)[it]); //ok return the track |
2824 |
|
}else{ |
2825 |
|
return NULL; |
2826 |
|
} |
2827 |
|
|
2828 |
|
} |
2829 |
|
}else{ |
2830 |
|
if( |
2831 |
|
tsorted && |
2832 |
|
it < tsorted->GetEntries() && //enough tracks found |
2833 |
|
it >= 0 && //valid index |
2834 |
|
true ){ |
2835 |
|
TClonesArray &t = *(tsorted); |
2836 |
|
PamTrack *temp = (PamTrack*) t[it]; |
2837 |
|
if (temp->GetTrkTrack()->HasImage()) { |
2838 |
|
return (PamTrack*)((*timage)[it]); //ok return the track |
2839 |
|
}else{ |
2840 |
|
return NULL; |
2841 |
|
} |
2842 |
|
} |
2843 |
|
} |
2844 |
|
|
2845 |
|
} |
2846 |
|
|
2847 |
|
cout << "PamTrack *PamLevel2::GetTrackImage("<<it<<","<<alg<<") -- wrong track number or unrecognised algorithm"<<endl; |
2848 |
|
|
2849 |
|
return NULL; |
2850 |
|
|
2851 |
|
} |
2852 |
|
; |
2853 |
|
|
2854 |
//-------------------------------------- |
//-------------------------------------- |
2855 |
// |
// |
2939 |
if (!Trout) |
if (!Trout) |
2940 |
Trout = T; |
Trout = T; |
2941 |
else |
else |
2942 |
Trout->AddFriend(T); |
Trout->AddFriend(T); |
2943 |
} |
} |
2944 |
else { |
else { |
2945 |
cout << "Tracker : missing tree" << endl; |
cout << "Tracker : missing tree" << endl; |
3352 |
G->Add(name); |
G->Add(name); |
3353 |
if (SELLI == 1) |
if (SELLI == 1) |
3354 |
L->Add(name); |
L->Add(name); |
3355 |
}; |
}; |
3356 |
}; |
}; |
3357 |
|
|
3358 |
cout << "done chains\n"; |
cout << "done data-tree chains "<< T->GetNtrees() <<" \n"; |
3359 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "----------------------------------------------------" << endl; |
3360 |
|
|
3361 |
// ------------------------------------------- |
// ------------------------------------------- |
3362 |
// make friends |
// make friends |
3439 |
// ===================================== |
// ===================================== |
3440 |
// SET BRANCH-ADDRESS AFTER CHAIN+FRIEND |
// SET BRANCH-ADDRESS AFTER CHAIN+FRIEND |
3441 |
// ===================================== |
// ===================================== |
3442 |
SetBranchAddress(Trout); |
if( Trout->GetNtrees() )SetBranchAddress(Trout); |
3443 |
|
|
3444 |
// ------------------------------------ |
// ------------------------------------ |
3445 |
// finally handle selection trees... |
// finally handle selection trees... |
3446 |
// (it is not friend of pamela tree) |
// (it is not friend of pamela tree) |
3447 |
// ------------------------------------ |
// ------------------------------------ |
3448 |
|
|
3449 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "----------------------------------------------------" << endl; |
3450 |
|
|
3451 |
// Selection List |
// Selection List |
3452 |
if (L && SELLI == 1) { |
if (L && SELLI == 1) { |
3456 |
cout << "SelectionList: set branch address RunEntry" << endl; |
cout << "SelectionList: set branch address RunEntry" << endl; |
3457 |
L->SetBranchAddress("EventEntry", &irunentry); |
L->SetBranchAddress("EventEntry", &irunentry); |
3458 |
cout << "SelectionList: set branch address EventEntry" << endl; |
cout << "SelectionList: set branch address EventEntry" << endl; |
3459 |
|
/* if ( L->GetBranch("L0EventEntry") ){ |
3460 |
|
hasL0EE = true; |
3461 |
|
L->SetBranchAddress("L0EventEntry", &il0entry); |
3462 |
|
cout << "SelectionList: set branch address L0EventEntry" << endl; |
3463 |
|
} else { |
3464 |
|
hasL0EE = false; // backward compatibility with old preselected files... |
3465 |
|
}*/ |
3466 |
sel_tree = L; |
sel_tree = L; |
3467 |
// if(!Trout)Trout=O; |
// if(!Trout)Trout=O; |
3468 |
// else Trout->AddFriend("SelectionList"); |
// else Trout->AddFriend("SelectionList"); |
3469 |
cout << "+SelectionList" << endl; |
cout << "+SelectionList" << endl; |
3470 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "----------------------------------------------------" << endl; |
3471 |
} |
} |
3472 |
else { |
else { |
3473 |
// cout << "SelectionList : missing tree"<<endl; |
// cout << "SelectionList : missing tree"<<endl; |
3493 |
*/ |
*/ |
3494 |
void PamLevel2::SetBranchAddress(TTree *t) { |
void PamLevel2::SetBranchAddress(TTree *t) { |
3495 |
|
|
3496 |
TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
// TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
3497 |
TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
// TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
3498 |
TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
// TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
3499 |
CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
// CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
3500 |
CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
// CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
3501 |
TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
// TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
3502 |
TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
// TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
3503 |
S4 = S4 & t->GetBranchStatus("S4Level2"); |
// S4 = S4 & t->GetBranchStatus("S4Level2"); |
3504 |
ND = ND & t->GetBranchStatus("NDLevel2"); |
// ND = ND & t->GetBranchStatus("NDLevel2"); |
3505 |
AC = AC & t->GetBranchStatus("AcLevel2"); |
// AC = AC & t->GetBranchStatus("AcLevel2"); |
3506 |
ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
// ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
3507 |
GP = GP & t->GetBranchStatus("h20"); |
// GP = GP & t->GetBranchStatus("h20"); |
3508 |
|
|
3509 |
|
|
3510 |
// Tracker |
// Tracker |
3511 |
if (TRK1) { |
if (TRK1) { |
3515 |
if (TRK2) { |
if (TRK2) { |
3516 |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel1")); |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel1")); |
3517 |
cout << "Tracker : set branch address TrkLevel2" << endl; |
cout << "Tracker : set branch address TrkLevel2" << endl; |
3518 |
|
NUC = t->GetBranchStatus("TrackNuclei"); |
3519 |
|
EXT = t->GetBranchStatus("RecoveredTrack") && (NUC ? t->GetBranchStatus("RecoveredTrackNuclei"): true ); |
3520 |
}; |
}; |
3521 |
if (TRKh) { |
if (TRKh) { |
3522 |
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
3577 |
|
|
3578 |
cout << "h20 : set branch address GPamela " << endl; |
cout << "h20 : set branch address GPamela " << endl; |
3579 |
}; |
}; |
3580 |
|
if(NUC){ |
3581 |
|
|
3582 |
|
cout << "Found nuclei-track branches" << endl; |
3583 |
|
|
3584 |
|
if( !trk_nuc_obj )trk_nuc_obj = new TClonesArray("TrkTrack"); |
3585 |
|
if( !calo_nuc_obj)calo_nuc_obj= new TClonesArray("CaloTrkVar"); |
3586 |
|
if( !tof_nuc_obj)tof_nuc_obj= new TClonesArray("ToFTrkVar"); |
3587 |
|
if( !orb_nuc_obj)orb_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3588 |
|
if (TRK2)t-> SetBranchAddress("TrackNuclei",&trk_nuc_obj); |
3589 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("TrackNuclei",&calo_nuc_obj); |
3590 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("TrackNuclei",&tof_nuc_obj); |
3591 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("TrackNuclei",&orb_nuc_obj); |
3592 |
|
|
3593 |
|
///copy the vector content inside a "fake" object (all aother info are missing) |
3594 |
|
|
3595 |
|
if( !trk2_nuc_obj )trk2_nuc_obj = new TrkLevel2(); |
3596 |
|
if( !calo2_nuc_obj )calo2_nuc_obj = new CaloLevel2(); |
3597 |
|
if( !tof2_nuc_obj )tof2_nuc_obj = new ToFLevel2(); |
3598 |
|
if( !orb2_nuc_obj )orb2_nuc_obj = new OrbitalInfo(); |
3599 |
|
// *(trk2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*trk_nuc_obj); |
3600 |
|
// *(calo2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*calo_nuc_obj); |
3601 |
|
// *(tof2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*tof_nuc_obj); |
3602 |
|
// *(orb2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*orb_nuc_obj); |
3603 |
|
|
3604 |
|
trk2_nuc_obj->SetTrackArray( trk_nuc_obj ); |
3605 |
|
calo2_nuc_obj->SetTrackArray( calo_nuc_obj ); |
3606 |
|
tof2_nuc_obj->SetTrackArray( tof_nuc_obj ); |
3607 |
|
orb2_nuc_obj->SetTrackArray( orb_nuc_obj ); |
3608 |
|
|
3609 |
|
|
3610 |
|
} |
3611 |
|
|
3612 |
|
if(EXT){ |
3613 |
|
|
3614 |
|
cout << "Found extended tracking algorythm branches" << endl; |
3615 |
|
|
3616 |
|
if( !trk_ext_obj )trk_ext_obj = new TClonesArray("ExtTrack"); |
3617 |
|
if( !calo_ext_obj)calo_ext_obj= new TClonesArray("CaloTrkVar"); |
3618 |
|
if( !tof_ext_obj)tof_ext_obj= new TClonesArray("ToFTrkVar"); |
3619 |
|
if( !orb_ext_obj)orb_ext_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3620 |
|
|
3621 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrack",&trk_ext_obj); |
3622 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrack",&calo_ext_obj); |
3623 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrack",&tof_ext_obj); |
3624 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrack",&orb_ext_obj); |
3625 |
|
|
3626 |
|
|
3627 |
|
if(NUC){ |
3628 |
|
if( !trk_ext_nuc_obj )trk_ext_nuc_obj = new TClonesArray("ExtTrack"); |
3629 |
|
if( !calo_ext_nuc_obj)calo_ext_nuc_obj= new TClonesArray("CaloTrkVar"); |
3630 |
|
if( !tof_ext_nuc_obj)tof_ext_nuc_obj= new TClonesArray("ToFTrkVar"); |
3631 |
|
if( !orb_ext_nuc_obj)orb_ext_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3632 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrackNuclei",&trk_ext_nuc_obj); |
3633 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrackNuclei",&calo_ext_nuc_obj); |
3634 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrackNuclei",&tof_ext_nuc_obj); |
3635 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrackNuclei",&orb_ext_nuc_obj); |
3636 |
|
} |
3637 |
|
} |
3638 |
} |
} |
3639 |
/** |
/** |
3640 |
* Set branch addresses for Pamela friend trees |
* Set branch addresses for Pamela friend trees |
3658 |
if (TRK2) { |
if (TRK2) { |
3659 |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
3660 |
cout << "Tracker : set branch address TrkLevel2" << endl; |
cout << "Tracker : set branch address TrkLevel2" << endl; |
3661 |
|
NUC = t->GetBranchStatus("TrackNuclei"); |
3662 |
|
EXT = t->GetBranchStatus("RecoveredTrack") && (NUC ? t->GetBranchStatus("RecoveredTrackNuclei"): true ); |
3663 |
}; |
}; |
3664 |
if (TRK1) { |
if (TRK1) { |
3665 |
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
3673 |
// Calorimeter |
// Calorimeter |
3674 |
if (CAL2) { |
if (CAL2) { |
3675 |
t->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
t->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
3676 |
cout << "Calorimeter : set branch address CaloLevel2" << endl; |
cout << "Calorimeter : set branch address CaloLevel2" << endl; |
3677 |
}; |
}; |
3678 |
if (CAL1) { |
if (CAL1) { |
3679 |
t->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
t->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
3731 |
// cout << "SelectionList: set branch address EventEntry"<<endl; |
// cout << "SelectionList: set branch address EventEntry"<<endl; |
3732 |
|
|
3733 |
// } |
// } |
3734 |
|
if(NUC){ |
3735 |
|
|
3736 |
|
cout << "Found nuclei-track branches" << endl; |
3737 |
|
|
3738 |
|
if( !trk_nuc_obj )trk_nuc_obj = new TClonesArray("TrkTrack"); |
3739 |
|
if( !calo_nuc_obj)calo_nuc_obj= new TClonesArray("CaloTrkVar"); |
3740 |
|
if( !tof_nuc_obj)tof_nuc_obj= new TClonesArray("ToFTrkVar"); |
3741 |
|
if( !orb_nuc_obj)orb_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3742 |
|
if (TRK2)t-> SetBranchAddress("TrackNuclei",&trk_nuc_obj); |
3743 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("TrackNuclei",&calo_nuc_obj); |
3744 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("TrackNuclei",&tof_nuc_obj); |
3745 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("TrackNuclei",&orb_nuc_obj); |
3746 |
|
|
3747 |
|
///copy the vector content inside a "fake" object (all aother info are missing) |
3748 |
|
|
3749 |
|
if( !trk2_nuc_obj )trk2_nuc_obj = new TrkLevel2(); |
3750 |
|
if( !calo2_nuc_obj )calo2_nuc_obj = new CaloLevel2(); |
3751 |
|
if( !tof2_nuc_obj )tof2_nuc_obj = new ToFLevel2(); |
3752 |
|
if( !orb2_nuc_obj )orb2_nuc_obj = new OrbitalInfo(); |
3753 |
|
|
3754 |
|
// *(trk2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*trk_nuc_obj); |
3755 |
|
// *(calo2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*calo_nuc_obj); |
3756 |
|
// *(tof2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*tof_nuc_obj); |
3757 |
|
// *(orb2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*orb_nuc_obj); |
3758 |
|
trk2_nuc_obj->SetTrackArray( trk_nuc_obj ); |
3759 |
|
calo2_nuc_obj->SetTrackArray( calo_nuc_obj ); |
3760 |
|
tof2_nuc_obj->SetTrackArray( tof_nuc_obj ); |
3761 |
|
orb2_nuc_obj->SetTrackArray( orb_nuc_obj ); |
3762 |
|
|
3763 |
|
} |
3764 |
|
if(EXT){ |
3765 |
|
|
3766 |
|
cout << "Found extended tracking algorythm branches" << endl; |
3767 |
|
|
3768 |
|
t->SetBranchAddress("extAlgFlag",&extAlgFlag); |
3769 |
|
|
3770 |
|
if( !trk_ext_obj )trk_ext_obj = new TClonesArray("ExtTrack"); |
3771 |
|
if( !calo_ext_obj)calo_ext_obj= new TClonesArray("CaloTrkVar"); |
3772 |
|
if( !tof_ext_obj)tof_ext_obj= new TClonesArray("ToFTrkVar"); |
3773 |
|
if( !orb_ext_obj)orb_ext_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3774 |
|
|
3775 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrack",&trk_ext_obj); |
3776 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrack",&calo_ext_obj); |
3777 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrack",&tof_ext_obj); |
3778 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrack",&orb_ext_obj); |
3779 |
|
|
3780 |
|
if(NUC){ |
3781 |
|
if( !trk_ext_nuc_obj )trk_ext_nuc_obj = new TClonesArray("ExtTrack"); |
3782 |
|
if( !calo_ext_nuc_obj)calo_ext_nuc_obj= new TClonesArray("CaloTrkVar"); |
3783 |
|
if( !tof_ext_nuc_obj)tof_ext_nuc_obj= new TClonesArray("ToFTrkVar"); |
3784 |
|
if( !orb_ext_nuc_obj)orb_ext_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3785 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrackNuclei",&trk_ext_nuc_obj); |
3786 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrackNuclei",&calo_ext_nuc_obj); |
3787 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrackNuclei",&tof_ext_nuc_obj); |
3788 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrackNuclei",&orb_ext_nuc_obj); |
3789 |
|
} |
3790 |
|
} |
3791 |
|
|
3792 |
} |
} |
3793 |
|
|
3794 |
|
/** |
3795 |
|
* Set the tracking algorythm |
3796 |
|
* @param alg String to choose the track. |
3797 |
|
* "" --> take the output of the standard tracking algorythm |
3798 |
|
* "STD" --> take the output of the standard tracking algorythm |
3799 |
|
* "NUC" --> take the output of the standard tracking algorythm for nuclei cluster selection |
3800 |
|
* "EXT" --> in case the standard tracking algorythm has not found any track, take the output of the extended one |
3801 |
|
* "EXTF" --> force the extended tracking algorythm |
3802 |
|
* "NUCEXT" --> as "EXT", but for nuclei |
3803 |
|
* "NUCEXTF" --> as "EXTF", but for nuclei |
3804 |
|
*/ |
3805 |
|
// void PamLevel2::SetTrackingAlgorythm(const char *alg){ |
3806 |
|
|
3807 |
|
|
3808 |
|
// TString s(alg); |
3809 |
|
// if(s.Contains("NUC", TString::kIgnoreCase) && !NUC) |
3810 |
|
// cout << "Warning! NUC algorythm requested, but branches are missing"<<endl; |
3811 |
|
// if(s.Contains("EXT", TString::kIgnoreCase) && !EXT) |
3812 |
|
// cout << "Warning! EXT algorythm requested, but branches are missing"<<endl;; |
3813 |
|
|
3814 |
|
// trkAlg = alg; |
3815 |
|
|
3816 |
|
// }; |
3817 |
|
// const char* PamLevel2::GetTrackingAlgorythm(){ |
3818 |
|
|
3819 |
|
|
3820 |
|
// cout<<endl<<" Implemented tracking algorythm: "; |
3821 |
|
// cout<<endl<<" \"\" or \"STD\" --> take the output of the standard tracking algorythm"; |
3822 |
|
// cout<<endl<<" \"NUC\" --> take the output of the standard tracking algorythm for nuclei cluster selection"; |
3823 |
|
// cout<<endl<<" \"EXT\" --> in case the standard tracking algorythm has not found any track,"; |
3824 |
|
// cout<<endl<<" take the output of the extended one"; |
3825 |
|
// cout<<endl<<" \"EXTF\" --> force the extended tracking algorythm"; |
3826 |
|
// cout<<endl<<" \"NUCEXT\" --> as \"EXT\", but for nuclei "; |
3827 |
|
// cout<<endl<<" \"NUCEXTF\" --> as \"EXTF\", but for nuclei"; |
3828 |
|
|
3829 |
|
// cout<<endl; |
3830 |
|
// cout<<" <<Currently set algorythm>> "<<trkAlg<<endl; |
3831 |
|
// cout<<endl; |
3832 |
|
|
3833 |
|
// return trkAlg; |
3834 |
|
// }; |
3835 |
|
|
3836 |
|
|
3837 |
|
|
3838 |
//-------------------------------------- |
//-------------------------------------- |
3839 |
// |
// |
3840 |
// |
// |
3868 |
}; |
}; |
3869 |
} |
} |
3870 |
|
|
3871 |
|
cout << "done run chain "<< R->GetNtrees() <<" \n"; |
3872 |
|
|
3873 |
|
|
3874 |
if (RUN && R->GetNtrees()) { |
if (RUN && R->GetNtrees()) { |
3875 |
|
|
3876 |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
3910 |
cout << "----------------------------------------------------" << endl; |
cout << "----------------------------------------------------" << endl; |
3911 |
|
|
3912 |
} |
} |
3913 |
else { |
// else { |
3914 |
delete R; |
// delete R; |
3915 |
R = 0; |
// R = 0; |
3916 |
} |
// } |
3917 |
|
|
3918 |
run_tree = R; |
run_tree = R; |
3919 |
|
|
3952 |
return T; |
return T; |
3953 |
|
|
3954 |
} |
} |
|
/** |
|
|
* Update the runinfo informations (to be used to have Run infos event by event basis) |
|
|
* @param run Pointer to the chain/tree which contains run infos |
|
|
* @return true if a new run has been read, false if it is still the same run |
|
|
*/ |
|
|
Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev) { |
|
|
// |
|
|
// check if we have already called once GetEntry, if not call it |
|
|
// |
|
|
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev) --- ATTENZIONE --- NON E` MANTENUTA!!!!!!!.... " |
|
|
<< endl; |
|
|
if (!run) { |
|
|
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing RunInfo tree " << endl; |
|
|
return (false); |
|
|
} |
|
|
if (run->GetEntries() <= 0) |
|
|
return (false); |
|
|
// |
|
|
|
|
|
// Int_t oldrun = irun; |
|
|
Long64_t oldrun = irun; |
|
|
|
|
|
// -------------------------------------- |
|
|
// if it is a full file (not preselected) |
|
|
// -------------------------------------- |
|
|
if (SELLI == 0) { |
|
|
|
|
|
// |
|
|
// the absolute time is necessary to relate the event with the run |
|
|
// |
|
|
if (!GetOrbitalInfo() && !ISGP) { |
|
|
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo " << endl; |
|
|
return (false); |
|
|
} |
|
|
|
|
|
ULong64_t abstime = 0; |
|
|
if (GetOrbitalInfo()) |
|
|
abstime = GetOrbitalInfo()->absTime; |
|
|
|
|
|
// |
|
|
// the first time the routine is called, set run search from the beginning |
|
|
// |
|
|
if (irun < 0LL) { |
|
|
irun = 0LL; |
|
|
run->GetEntry(irun); |
|
|
runfirstentry = 0LL; |
|
|
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
|
|
if ((Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL) |
|
|
runlastentry -= 1LL; |
|
|
|
|
|
if (ISGP && run->GetEntries() != 1) { |
|
|
cout << "** WARNING ** simulated files are assumed to have 1 single run, not " << run->GetEntries() << endl; |
|
|
cout << "** WARNING ** run will not be updated" << endl; |
|
|
} |
|
|
|
|
|
}; |
|
|
// |
|
|
if (ISGP) |
|
|
abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO |
|
|
// |
|
|
if (irun == run->GetEntries() - 1LL && !(abstime >= GetRunInfo()->RUNHEADER_TIME && abstime |
|
|
<= GetRunInfo()->RUNTRAILER_TIME)) { |
|
|
irun = -1LL; |
|
|
irunt = -1LL; |
|
|
runfirstentry = 0LL; |
|
|
runlastentry = -1LL; |
|
|
}; |
|
|
// modificato il controllo sull'aggiornamento del run, per evitare problemi |
|
|
// dovuti agli eventi annidati (NB! NEVENTS conta anche questi!!) |
|
|
// |
|
|
bool fromfirst = true; |
|
|
// |
|
|
while (!(abstime >= GetRunInfo()->RUNHEADER_TIME && abstime <= GetRunInfo()->RUNTRAILER_TIME) && irun |
|
|
< run->GetEntries() - 1LL) { |
|
|
// while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
|
|
irun++; |
|
|
run->GetEntry(irun); |
|
|
runfirstentry = runlastentry; |
|
|
if ((Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL) |
|
|
runfirstentry += 1LL; |
|
|
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
|
|
// cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
|
|
// cout << "runfirstentry "<<runfirstentry<<endl; |
|
|
// printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); |
|
|
// printf(" abstime %u trailertime %u \n",abstime,GetRunInfo()->RUNTRAILER_TIME); |
|
|
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
|
|
// |
|
|
// prevshift = 0; |
|
|
// |
|
|
if (irun == (Long64_t)(run->GetEntries() - 1LL) && fromfirst && !(abstime >= GetRunInfo()->RUNHEADER_TIME |
|
|
&& abstime <= GetRunInfo()->RUNTRAILER_TIME)) { |
|
|
printf(" resetting irun (it should NOT happen!!!)\n"); |
|
|
fromfirst = false; |
|
|
irun = 0; |
|
|
run->GetEntry(irun); |
|
|
runfirstentry = 0ULL; |
|
|
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
|
|
if ((Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL) |
|
|
runlastentry -= 1LL; |
|
|
}; |
|
|
// |
|
|
}; |
|
|
// |
|
|
if (!(abstime >= GetRunInfo()->RUNHEADER_TIME && abstime <= GetRunInfo()->RUNTRAILER_TIME)) { |
|
|
printf(" Something very wrong here: cannot find RUN containing absolute time %llu \n", abstime); |
|
|
return false; |
|
|
} |
|
|
// |
|
|
if (irun == oldrun || irun >= run->GetEntries()) |
|
|
return (false); |
|
|
// |
|
|
// printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry); |
|
|
// |
|
|
prevshift = 0; |
|
|
cout << " ))))) UPDATE RUN INFO ((((( @iev " << iev << " run " << GetRunInfo()->ID << " irun " << irun << endl; |
|
|
// cout << "runfirstentry "<<runfirstentry<<endl; |
|
|
return (true); |
|
|
}; |
|
|
// ---------------------------------------------------- |
|
|
// if it is a preselected file (there is SelectionList) |
|
|
// NBNB - the event tree MUST be read first |
|
|
// ---------------------------------------------------- |
|
|
if (SELLI == 1) { |
|
|
sel_tree->GetEntry(iev); |
|
|
// cout << irun << " "<< irunentry << endl; |
|
|
if (irun != oldrun) { |
|
|
run->GetEntry(irun); |
|
|
cout << " ))))) UPDATE RUN INFO ((((( @iev " << iev << " run " << GetRunInfo()->ID << " irun " << irun << endl; |
|
|
prevshift = 0; |
|
|
return true; |
|
|
} |
|
|
return false; |
|
|
} |
|
|
|
|
|
return false; |
|
|
// |
|
|
} |
|
|
; |
|
3955 |
|
|
3956 |
Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) { |
Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) { |
3957 |
|
|
3958 |
|
if (DBG) printf("PamLevel2::UpdateRunInfo(Long64_t) - inside\n"); |
3959 |
|
|
3960 |
if (!run_tree) { |
if (!run_tree) { |
3961 |
cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree not loaded" << endl; |
cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree not loaded" << endl; |
3962 |
return false; |
return false; |
3966 |
return (false); |
return (false); |
3967 |
} |
} |
3968 |
|
|
3969 |
|
|
3970 |
Int_t oldrun = irun; // store current run index |
Int_t oldrun = irun; // store current run index |
3971 |
|
|
3972 |
// ----------------------------------------------------------------------- |
// ----------------------------------------------------------------------- |
3976 |
if (irun < 0) { |
if (irun < 0) { |
3977 |
irun = 0LL; |
irun = 0LL; |
3978 |
irunt = 0LL; |
irunt = 0LL; |
3979 |
irunentry = 0; |
totrunentry = 0LL; |
3980 |
|
totrunentrymin = 0LL; |
3981 |
|
totrunentrymax = 0LL; |
3982 |
|
irunentry = 0LL; |
3983 |
|
il0entry = 0LL; |
3984 |
prevshift = 0; |
prevshift = 0; |
3985 |
|
yprevshift = 0; |
3986 |
|
prevabstime = 0; |
3987 |
|
prevpktnum = 0; |
3988 |
|
abstime = 0ULL; |
3989 |
|
pktnum = 0; |
3990 |
|
isFragment = false; |
3991 |
run_tree->GetEntry(irun); |
run_tree->GetEntry(irun); |
3992 |
if (!GetOrbitalInfo()) |
if (!GetOrbitalInfo()) |
3993 |
cout << "** WARNING ** missing OrbitalInfo ---> run info might be not correctly updated " << endl; |
cout << "** WARNING ** missing OrbitalInfo ---> run info might be not correctly updated " << endl; |
3994 |
if (gltsync) |
if ( fUseDBinRunInfo ){ |
3995 |
delete gltsync; //Emiliano |
if (gltsync) |
3996 |
if (!dbc || (dbc && !dbc->IsConnected())) |
delete gltsync; //Emiliano |
3997 |
SetDBConnection(); //Emiliano |
if (!dbc || (dbc && !dbc->IsConnected())) |
3998 |
gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); //Emiliano // the "false" means not to use level0 file (not necessary here) |
SetDBConnection(); //Emiliano |
3999 |
if (dbc){ |
gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); //Emiliano // the "false" means not to use level0 file (not necessary here) |
4000 |
dbc->Close();// Emiliano |
if (dbc){ |
4001 |
delete dbc; |
dbc->Close();// Emiliano |
4002 |
dbc=0; |
delete dbc; |
4003 |
}; |
dbc=0; |
4004 |
}; |
} |
4005 |
|
} |
4006 |
|
} |
4007 |
// --------------------------------------------------------------- |
// --------------------------------------------------------------- |
4008 |
// retrieve OBT and absolute time of the event |
// retrieve OBT and absolute time of the event |
4009 |
// --------------------------------------------------------------- |
// --------------------------------------------------------------- |
|
ULong64_t abstime = 0LL; |
|
|
// ULong64_t obt = 0LL; // Emiliano |
|
4010 |
Long64_t obt = 0LL; // Emiliano, Long64_t GL_TIMESYNC::DBobt(UInt_t obt) since depending on the situation OBT is lowered or boosted |
Long64_t obt = 0LL; // Emiliano, Long64_t GL_TIMESYNC::DBobt(UInt_t obt) since depending on the situation OBT is lowered or boosted |
4011 |
|
prevabstime = abstime; |
4012 |
|
prevpktnum = pktnum; |
4013 |
if (GetOrbitalInfo()) { |
if (GetOrbitalInfo()) { |
4014 |
abstime = GetOrbitalInfo()->absTime; |
abstime = GetOrbitalInfo()->absTime; |
4015 |
obt = gltsync->DBobt(GetOrbitalInfo()->OBT); // Emiliano |
if ( fUseDBinRunInfo ) obt = gltsync->DBobt(GetOrbitalInfo()->OBT); // Emiliano |
4016 |
|
pktnum = GetOrbitalInfo()->pkt_num; // Emiliano |
4017 |
} |
} |
4018 |
else { |
else { |
4019 |
abstime = GetRunInfo()->RUNHEADER_TIME; |
abstime = GetRunInfo()->RUNHEADER_TIME; |
4020 |
obt = gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT); // Emiliano |
if ( fUseDBinRunInfo ) obt = gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT); // Emiliano |
4021 |
|
pktnum = GetRunInfo()->RUNHEADER_PKT; // Emiliano |
4022 |
|
} |
4023 |
|
|
4024 |
|
if (DBG){ |
4025 |
|
printf("0abstime %lld %lld pktnum %d %d obt %lld \n",abstime,prevabstime,pktnum,prevpktnum,obt); |
4026 |
|
printf("0 rth %d %d nevents %d \n",GetRunInfo()->RUNHEADER_TIME,GetRunInfo()->RUNTRAILER_TIME,GetRunInfo()->NEVENTS); |
4027 |
|
printf("0 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
4028 |
|
if ( fUseDBinRunInfo ) printf("0 rto2 %lld %lld \n",gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT),gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)); |
4029 |
|
printf("0 bo irunentry %lld prevshift %lld irun %lld \n",irunentry,prevshift,irun); |
4030 |
|
printf("0 min %lld iev %lld max %lld tot %lld \n",totrunentrymin,iev,totrunentrymax,totrunentry); |
4031 |
} |
} |
4032 |
|
|
4033 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
4048 |
} |
} |
4049 |
|
|
4050 |
// |
// |
4051 |
bool fromfirst = true; // first loop over runs |
bool a = true; |
4052 |
|
bool b = true; |
4053 |
|
if ( fUseDBinRunInfo ){ |
4054 |
|
a = false; |
4055 |
|
b = false; |
4056 |
|
if ( obt < gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) ) a = true; |
4057 |
|
if ( obt > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT) ) b = true; |
4058 |
|
} |
4059 |
|
if ( iev < totrunentrymin || iev > totrunentrymax // entry is outside run limits |
4060 |
|
|| iev == 0 // or it is the first entry |
4061 |
|
|| (!isSync && ( |
4062 |
|
(abstime <= GetRunInfo()->RUNHEADER_TIME && a ) // or it is outside obt limits (and abstime limits for security reasons) |
4063 |
|
|| (abstime >= GetRunInfo()->RUNTRAILER_TIME && b ) ))// or it is outside obt limits (and abstime limits for security reasons) |
4064 |
|
){ // check on abstime and obt needed to handle nested+DV_skipped packets |
4065 |
|
|
4066 |
|
// check for a new run (ma prima il primo!) |
4067 |
|
if (DBG){ |
4068 |
|
printf("1abstime %lld %lld pktnum %d %d obt %lld \n",abstime,prevabstime,pktnum,prevpktnum,obt); |
4069 |
|
printf("1 rth %d %d nevents %d \n",GetRunInfo()->RUNHEADER_TIME,GetRunInfo()->RUNTRAILER_TIME,GetRunInfo()->NEVENTS); |
4070 |
|
printf("1 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
4071 |
|
if ( fUseDBinRunInfo ) printf("1 rto2 %lld %lld \n",gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT),gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)); |
4072 |
|
printf("1 bo irunentry %lld prevshift %lld irun %lld \n",irunentry,prevshift,irun); |
4073 |
|
printf("1 min %lld iev %lld max %lld tot %lld \n",totrunentrymin,iev,totrunentrymax,totrunentry); |
4074 |
|
} |
4075 |
|
// printf("1abstime %lld %lld pktnum %d %d obt %lld \n",abstime,prevabstime,pktnum,prevpktnum,obt); |
4076 |
|
// printf("1 rth %d %d nevents %d \n",GetRunInfo()->RUNHEADER_TIME,GetRunInfo()->RUNTRAILER_TIME,GetRunInfo()->NEVENTS); |
4077 |
|
// printf("1 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
4078 |
|
// printf("1 rto2 %lld %lld \n",gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT),gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)); |
4079 |
|
// printf("1 bo irunentry %lld prevshift %lld irun %lld \n",irunentry,prevshift,irun); |
4080 |
|
// printf("1 min %lld iev %lld max %lld tot %lld \n",totrunentrymin,iev,totrunentrymax,totrunentry);//TOGLITOGLI |
4081 |
|
|
4082 |
// ------------------------------------------------------ |
totrunentry = 0LL; |
4083 |
// loop over runs to find the one that contains the event |
runfirstentry = 0LL; |
4084 |
// ------------------------------------------------------ |
for (Int_t r=0; r< run_tree->GetEntries();r++){ |
4085 |
while (( |
// ------------------------------------------------------------------- |
4086 |
// ( |
// save the index of the first entry of the run, relative to pam_tree, |
4087 |
// !(abstime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
// and read a new run |
4088 |
// abstime <= GetRunInfo()->RUNTRAILER_TIME) && |
// ------------------------------------------------------------------- |
4089 |
// !(obt >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
run_tree->GetEntry(r);//update runinfo |
4090 |
// obt <= GetRunInfo()->RUNTRAILER_OBT) |
if ( r > 0 ){ |
4091 |
// ) |
totrunentrymin = totrunentrymax+1; |
4092 |
|
} else { |
4093 |
!(abstime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
totrunentrymin = 0LL; |
4094 |
abstime <= GetRunInfo()->RUNTRAILER_TIME) || !(obt >= gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) && // additional check on OBT (ms) // Emiliano |
} |
4095 |
obt <= gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)) // Emiliano |
totrunentry += GetRunInfo()->NEVENTS; |
4096 |
|| GetRunInfo()->NEVENTS == 0 |
totrunentrymax = totrunentry - 1 - prevshift; // prevshift is needed to handle nested+DV_skipped packets |
4097 |
// || !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) // ERRORE!!! fa saltare i run con 1 evento |
irun = r; |
4098 |
|| !(irunentry <= GetRunInfo()->NEVENTS - 1 - prevshift)) && irun < run_tree->GetEntries()) { |
if ( fUseDBinRunInfo ){ |
4099 |
|
a = false; |
4100 |
// if( !(abstime >= GetRunInfo()->RUNHEADER_TIME &&abstime <= GetRunInfo()->RUNTRAILER_TIME) )cout << "ABS TIME "<<abstime << " " <<GetRunInfo()->RUNTRAILER_TIME <<endl; |
b = false; |
4101 |
// if( !(obt >= GetRunInfo()->RUNHEADER_OBT && obt <= GetRunInfo()->RUNTRAILER_OBT) )cout << "OBT TIME "<< obt <<" "<< GetRunInfo()->RUNTRAILER_OBT << endl; |
if ( obt < gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) ) a = true; |
4102 |
// if( GetRunInfo()->NEVENTS==0 )cout <<"GetRunInfo()->NEVENTS==0 "<<endl; |
if ( obt > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT) ) b = true; |
4103 |
// if( !(irunentry <= GetRunInfo()->NEVENTS-1-prevshift) ) cout << "irunentry > "<<GetRunInfo()->NEVENTS-1-prevshift << endl; |
} |
4104 |
// - - - - - - - - - - - - - |
if ( (iev >= totrunentrymin && iev <= totrunentrymax) || // entry is inside run limits |
4105 |
// irunentry = position of current entry, relative to the run |
( !isSync && |
4106 |
// prevshift = shift needed to synchronize l0 and l2 data (nested events) |
( abstime >= GetRunInfo()->RUNHEADER_TIME && a // or it is inside obt limits (and abstime limits for security reasons) |
4107 |
// - - - - - - - - - - - - - |
&& abstime <= GetRunInfo()->RUNTRAILER_TIME && b)) // or it is inside obt limits (and abstime limits for security reasons) |
4108 |
|
){ // check on abstime and obt needed to handle nested+DV_skipped packets |
4109 |
// ----------------------------------------- |
if ( totrunentrymin > iev ){ // there is a shift (nested+DV_skipped packets) |
4110 |
// store dead and live-time of previous run |
if ( !isSync ){ |
4111 |
// ----------------------------------------- |
if (DBG) printf("PamLevel2::UpdateRunInfo(Long64_t) - unconsistent iev - nevents, probable DBL0-L2 async\n"); |
4112 |
// if(SELLI==0){ |
if (DBG) printf("PamLevel2::UpdateRunInfo(Long64_t) - totrunentrymin %lld iev %lld prevshift %lld totrunentrymax %lld \n",totrunentrymin,iev,prevshift,totrunentrymax); |
4113 |
if (SELLI != 2) { |
// printf("PamLevel2::UpdateRunInfo(Long64_t) - unconsistent iev - nevents, probable DBL0-L2 async\n"); |
4114 |
if (fromfirst) { |
// printf("PamLevel2::UpdateRunInfo(Long64_t) - totrunentrymin %lld iev %lld prevshift %lld totrunentrymax %lld \n",totrunentrymin,iev,prevshift,totrunentrymax);//TOGLITOGLI |
4115 |
if (oldrun == irun) { |
prevshift += (totrunentrymin-iev); // add the new shift to total shift |
4116 |
/// decrement counters |
totrunentrymin -= (totrunentrymin-iev); // shift run position min |
4117 |
if (GetTrigLevel2()) { |
totrunentrymax -= (totrunentrymin-iev); // shift run position max |
4118 |
totdltime[0] -= GetTrigLevel2()->dltime[0];//live-time |
if (DBG) printf("PamLevel2::UpdateRunInfo(Long64_t) - totrunentrymin %lld iev %lld prevshift %lld totrunentrymax %lld \n",totrunentrymin,iev,prevshift,totrunentrymax); |
4119 |
totdltime[1] -= GetTrigLevel2()->dltime[1];//dead-time |
// printf("PamLevel2::UpdateRunInfo(Long64_t) - totrunentrymin %lld iev %lld prevshift %lld totrunentrymax %lld \n",totrunentrymin,iev,prevshift,totrunentrymax);//TOGLITOGLI |
4120 |
} |
} else { |
4121 |
totdltime[2]--; //event counter |
printf(" PamLevel2::UpdateRunInfo(Long64_t) ERROR! sync file but unconsistent totrunetrymin %lld and iev %lld!!! \n",totrunentrymin,iev); |
4122 |
if (DBG) { |
cout << " OK this is a bug, write to Emiliano, Emiliano.Mocchiutti@ts.infn.it " << endl; |
4123 |
cout << endl; |
cout << "\nFor bug reporting instructions, please see for example:\n"; |
4124 |
cout << "n.events : " << totdltime[2] << endl; |
cout << " <http://www.ts.infn.it/~mocchiut/bugs/bugs.html>.\n"; |
4125 |
cout << "RUN LIVE-TIME: " << totdltime[0] * 0.16 << " ms" << endl; |
cout << " " << endl; |
|
cout << "RUN DEAD-TIME: " << totdltime[1] * 0.01 << " ms" << endl; |
|
4126 |
} |
} |
4127 |
} |
} |
4128 |
else { |
runfirstentry = totrunentrymin; // first entry of the run in the level2 |
4129 |
totdltime[0] = 0;//live-time |
|
4130 |
totdltime[1] = 0;//dead-time |
|
4131 |
totdltime[2] = 0; //event counter |
// |
4132 |
if (DBG) |
if ( fUseDBinRunInfo ){ |
4133 |
cout << " *** JUMP RUN *** irun " << irun << endl; |
if (gltsync) |
4134 |
|
delete gltsync; // Emiliano |
4135 |
|
if (!dbc || (dbc && !dbc->IsConnected())) |
4136 |
|
SetDBConnection(); //Emiliano |
4137 |
|
gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); // Emiliano |
4138 |
|
TrkParams::Set(GetRunInfo(), dbc); |
4139 |
|
if (dbc){ |
4140 |
|
dbc->Close(); // Emiliano |
4141 |
|
delete dbc; |
4142 |
|
dbc=0; |
4143 |
|
} |
4144 |
|
if (gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)) { // Emiliano |
4145 |
|
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun " << irun |
4146 |
|
<< " has RUNHEADER_OBT>=RUNTRAILER_OBT " << endl; |
4147 |
|
cout |
4148 |
|
<< " (NB!! in this case some events could be assigned to a wrong run)" |
4149 |
|
<< endl; |
4150 |
|
} |
4151 |
} |
} |
4152 |
/// add an entry |
// |
4153 |
if (run_tree_clone) |
if (DBG) printf(" found \n"); |
4154 |
if (run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) |
// printf(" found \n");//TOGLITOGLI |
4155 |
run_tree_clone->GetBranch("DeadLiveTime")->Fill(); |
// |
4156 |
/// reset counters |
break; |
4157 |
|
} |
4158 |
|
} // loop over run |
4159 |
|
|
4160 |
|
// -------------------------------------- |
4161 |
|
// if there was no need to update the run |
4162 |
|
// ---> exit with FALSE |
4163 |
|
// -------------------------------------- |
4164 |
|
if (irun == oldrun){ |
4165 |
|
if (DBG) printf(" no new run \n"); |
4166 |
|
// printf(" no new run \n");//TOGLITOGLI |
4167 |
|
return (false); |
4168 |
|
} |
4169 |
|
// -------------------------------------- |
4170 |
|
// ... otherwise |
4171 |
|
// ---> exit with TRUE |
4172 |
|
// -------------------------------------- |
4173 |
|
|
4174 |
|
if (SELLI != 2) { |
4175 |
|
/// decrement counters since this event belongs to a new run |
4176 |
|
if (GetTrigLevel2()) { |
4177 |
|
totdltime[0] -= GetTrigLevel2()->dltime[0];//live-time |
4178 |
|
totdltime[1] -= GetTrigLevel2()->dltime[1];//dead-time |
4179 |
|
} |
4180 |
|
totdltime[2]--; //event counter |
4181 |
|
if (DBG) { |
4182 |
|
cout << endl; |
4183 |
|
cout << "n.events : " << totdltime[2] << endl; |
4184 |
|
cout << "RUN LIVE-TIME: " << totdltime[0] * 0.16 << " ms" << endl; |
4185 |
|
cout << "RUN DEAD-TIME: " << totdltime[1] * 0.01 << " ms" << endl; |
4186 |
|
} |
4187 |
|
// add an entry |
4188 |
|
if (run_tree_clone && totdltime[2] > 0) |
4189 |
|
if (run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) |
4190 |
|
run_tree_clone->GetBranch("DeadLiveTime")->Fill(); |
4191 |
|
// reset counters |
4192 |
|
if ( totdltime[2] > 0 ){ |
4193 |
if (GetTrigLevel2()) { |
if (GetTrigLevel2()) { |
4194 |
totdltime[0] = GetTrigLevel2()->dltime[0];//live-time |
totdltime[0] = GetTrigLevel2()->dltime[0];//live-time |
4195 |
totdltime[1] = 0; //dead-time |
totdltime[1] = 0; //dead-time |
4197 |
totdltime[2] = 1; //event counter |
totdltime[2] = 1; //event counter |
4198 |
} |
} |
4199 |
} |
} |
|
// } |
|
4200 |
|
|
4201 |
irun++; |
if (DBG){ |
4202 |
// ------------------------------------ |
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev " << iev << " run " << GetRunInfo()->ID << " irun " << irun |
4203 |
// if the end of run tree is reached... |
<< endl; |
4204 |
// ------------------------------------ |
printf("2abstime %lld %lld pktnum %d %d obt %lld \n",abstime,prevabstime,pktnum,prevpktnum,obt); |
4205 |
if (irun == run_tree->GetEntries()) { |
printf("2 rth %d %d nevents %d \n",GetRunInfo()->RUNHEADER_TIME,GetRunInfo()->RUNTRAILER_TIME,GetRunInfo()->NEVENTS); |
4206 |
if (!fromfirst) { |
printf("2 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
4207 |
// ----------------------------------------------------- |
if ( fUseDBinRunInfo ) printf("2 rto2 %lld %lld \n",gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT),gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)); |
4208 |
// if it happened already once and the run was not found |
printf("2 bo irunentry %lld prevshift %lld irun %lld \n",irunentry,prevshift,irun); |
4209 |
// ---> exit with error |
printf("2 min %lld iev %lld max %lld tot %lld \n",totrunentrymin,iev,totrunentrymax,totrunentry); |
|
// ----------------------------------------------------- |
|
|
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- ERROR -- event entry #" << iev |
|
|
<< " does not belong to any run (should not happen)" << endl; |
|
|
return false; |
|
|
} |
|
|
// ----------------------------------------- |
|
|
// ...otherwise repeat search from beginning |
|
|
// ----------------------------------------- |
|
|
cout |
|
|
<< "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- reached end of run tree. searchin again from beginning " |
|
|
<< endl; |
|
|
fromfirst = false; |
|
|
irun = 0LL; |
|
|
runfirstentry = 0LL; |
|
4210 |
} |
} |
4211 |
// ------------------------------------------------------------------- |
// printf("2abstime %lld %lld pktnum %d %d obt %lld \n",abstime,prevabstime,pktnum,prevpktnum,obt); |
4212 |
// save the index of the first entry of the run, relative to pam_tree, |
// printf("2 rth %d %d nevents %d \n",GetRunInfo()->RUNHEADER_TIME,GetRunInfo()->RUNTRAILER_TIME,GetRunInfo()->NEVENTS); |
4213 |
// and read a new run |
// printf("2 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
4214 |
// ------------------------------------------------------------------- |
// printf("2 rto2 %lld %lld \n",gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT),gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)); |
4215 |
if (irun > 0) |
// printf("2 bo irunentry %lld prevshift %lld irun %lld \n",irunentry,prevshift,irun); |
4216 |
runfirstentry += (GetRunInfo()->NEVENTS) - prevshift; |
// printf("2 min %lld iev %lld max %lld tot %lld \n",totrunentrymin,iev,totrunentrymax,totrunentry);//TOGLITOGLI |
4217 |
irunentry = 0; |
|
4218 |
prevshift = 0; |
return (true); |
4219 |
run_tree->GetEntry(irun);//update runinfo |
} // need for run upgrade |
4220 |
irunt = irun - irunoffset[run_tree->GetTreeNumber()]; |
if (DBG) printf("return false\n"); |
4221 |
if (gltsync) |
return (false); |
4222 |
delete gltsync; // Emiliano |
}// SELLI = 0 SELLI = 2 |
4223 |
if (!dbc || (dbc && !dbc->IsConnected())) |
|
|
SetDBConnection(); //Emiliano |
|
|
gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); // Emiliano |
|
|
if (dbc){ |
|
|
dbc->Close(); // Emiliano |
|
|
delete dbc; |
|
|
dbc=0; |
|
|
}; |
|
|
if (gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)) { // Emiliano |
|
|
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun " << irun |
|
|
<< " has RUNHEADER_OBT>=RUNTRAILER_OBT " << endl; |
|
|
cout |
|
|
<< " (NB!! in this case some events are assigned to a wrong run)" |
|
|
<< endl; |
|
|
} |
|
|
// if(hasfrag && fragid != GetRunInfo()->ID){ |
|
|
// cout << "... where is the next fragment ??"<<endl; |
|
|
// } |
|
|
}; |
|
|
|
|
|
// -------------------------------------- |
|
|
// if there was no need to update the run |
|
|
// ---> exit with FALSE |
|
|
// -------------------------------------- |
|
|
if (irun == oldrun) |
|
|
return (false); |
|
|
|
|
|
// -------------------------------------- |
|
|
// ... otherwise |
|
|
// -------------------------------------- |
|
|
|
|
|
|
|
|
// -------------------------------------- |
|
|
// ---> exit with TRUE |
|
|
// -------------------------------------- |
|
|
if (DBG) |
|
|
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev " << iev << " run " << GetRunInfo()->ID << " irun " << irun |
|
|
<< endl; |
|
|
// ---------------------------------------------------- |
|
|
// update the tracker parameters |
|
|
// (non ho trovato nessun altro modo sicuro di farlo...) |
|
|
// ---------------------------------------------------- |
|
|
if (!dbc || (dbc && !dbc->IsConnected())) |
|
|
SetDBConnection(); |
|
|
TrkParams::Set(GetRunInfo(), dbc); |
|
|
if (dbc){ |
|
|
dbc->Close(); |
|
|
delete dbc; |
|
|
dbc=0; |
|
|
}; |
|
|
|
|
|
// ---------------------------------------------------- |
|
|
// then check if the run has a fragment |
|
|
// in this case we have to switch to the next fragment |
|
|
// when the end of the first fragment is reached |
|
|
// ---------------------------------------------------- |
|
|
if (GetRunInfo()->ID_RUN_FRAG != 0 && |
|
|
// GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID && |
|
|
DBG && true) { |
|
|
cout << "* fragment *" << endl; |
|
|
} |
|
|
|
|
|
return (true); |
|
|
}; |
|
4224 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
4225 |
// if it is a preselected file (there is SelectionList) |
// if it is a preselected file (there is SelectionList) |
4226 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
4295 |
// update the tracker parameters |
// update the tracker parameters |
4296 |
// (non ho trovato nessun altro modo sicuro di farlo...) |
// (non ho trovato nessun altro modo sicuro di farlo...) |
4297 |
// ---------------------------------------------------- |
// ---------------------------------------------------- |
4298 |
if (!dbc || (dbc && !dbc->IsConnected())) |
if ( fUseDBinRunInfo ){ |
4299 |
SetDBConnection(); |
if (!dbc || (dbc && !dbc->IsConnected())) |
4300 |
TrkParams::Set(GetRunInfo(), dbc); |
SetDBConnection(); |
4301 |
if (dbc){ |
TrkParams::Set(GetRunInfo(), dbc); |
4302 |
dbc->Close(); |
if (dbc){ |
4303 |
delete dbc; |
dbc->Close(); |
4304 |
dbc=0; |
delete dbc; |
4305 |
}; |
dbc=0; |
4306 |
|
} |
4307 |
|
} |
4308 |
// cout << endl; |
// cout << endl; |
4309 |
prevshift = 0; |
prevshift = 0; |
4310 |
|
yprevshift = 0; |
4311 |
return true; |
return true; |
4312 |
} |
} |
4313 |
return false; |
return false; |
4316 |
return false; |
return false; |
4317 |
// |
// |
4318 |
} |
} |
4319 |
; |
|
4320 |
|
/** |
4321 |
|
* Update the runinfo informations (to be used to have Run infos event by event basis) |
4322 |
|
* @param run Pointer to the chain/tree which contains run infos |
4323 |
|
* @return true if a new run has been read, false if it is still the same run |
4324 |
|
*/ |
4325 |
|
Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev) { |
4326 |
|
return (UpdateRunInfo(iev)); |
4327 |
|
} |
4328 |
|
|
4329 |
/** |
/** |
4330 |
* Update the runinfo informations (to be used to have Run infos event by event basis) |
* Update the runinfo informations (to be used to have Run infos event by event basis) |
4331 |
* @param run Pointer to the chain/tree which contains run infos |
* @param run Pointer to the chain/tree which contains run infos |
4334 |
Bool_t PamLevel2::UpdateRunInfo(TTree *run, Long64_t iev) { |
Bool_t PamLevel2::UpdateRunInfo(TTree *run, Long64_t iev) { |
4335 |
return (UpdateRunInfo((TChain*) run, iev)); |
return (UpdateRunInfo((TChain*) run, iev)); |
4336 |
} |
} |
4337 |
; |
|
4338 |
|
|
4339 |
//-------------------------------------- |
//-------------------------------------- |
4340 |
// |
// |
4572 |
// cout << "Checking file: "<<f->GetName()<<endl; |
// cout << "Checking file: "<<f->GetName()<<endl; |
4573 |
if (!f || f->IsZombie()) { |
if (!f || f->IsZombie()) { |
4574 |
cout << "File: " << f->GetName() << " Non valid root file" << endl; |
cout << "File: " << f->GetName() << " Non valid root file" << endl; |
4575 |
|
fDiscarded = true; |
4576 |
return; |
return; |
4577 |
} |
} |
4578 |
|
|
4779 |
TFile *f = new TFile(name.Data()); |
TFile *f = new TFile(name.Data()); |
4780 |
if (!f || f->IsZombie()) { |
if (!f || f->IsZombie()) { |
4781 |
cout << "File: " << f->GetName() << " discarded ---- Non valid root file" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Non valid root file" << endl; |
4782 |
|
fDiscarded = true; |
4783 |
return false; |
return false; |
4784 |
} |
} |
4785 |
// cout << "Get list of keys: "<<f<<endl; |
// cout << "Get list of keys: "<<f<<endl; |
4818 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4819 |
cout << "File: " << f->GetName() << " discarded ---- SelectionList tree has " << nevt |
cout << "File: " << f->GetName() << " discarded ---- SelectionList tree has " << nevt |
4820 |
<< " events instead of " << nev << endl; |
<< " events instead of " << nev << endl; |
4821 |
|
fDiscarded = true; |
4822 |
return false; |
return false; |
4823 |
} |
} |
4824 |
nev = nevt; |
nev = nevt; |
4833 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4834 |
cout << "File: " << f->GetName() << " discarded ---- Trigger tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Trigger tree has " << nevt << " events instead of " |
4835 |
<< nev << endl; |
<< nev << endl; |
4836 |
|
fDiscarded = true; |
4837 |
return false; |
return false; |
4838 |
} |
} |
4839 |
nev = nevt; |
nev = nevt; |
4847 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4848 |
cout << "File: " << f->GetName() << " discarded ---- ToF tree has " << nevt << " events instead of " << nev |
cout << "File: " << f->GetName() << " discarded ---- ToF tree has " << nevt << " events instead of " << nev |
4849 |
<< endl; |
<< endl; |
4850 |
|
fDiscarded = true; |
4851 |
return false; |
return false; |
4852 |
} |
} |
4853 |
nev = nevt; |
nev = nevt; |
4861 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4862 |
cout << "File: " << f->GetName() << " discarded ---- S4 tree has " << nevt << " events instead of " << nev |
cout << "File: " << f->GetName() << " discarded ---- S4 tree has " << nevt << " events instead of " << nev |
4863 |
<< endl; |
<< endl; |
4864 |
|
fDiscarded = true; |
4865 |
return false; |
return false; |
4866 |
} |
} |
4867 |
nev = nevt; |
nev = nevt; |
4876 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4877 |
cout << "File: " << f->GetName() << " discarded ---- NeutronD tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- NeutronD tree has " << nevt << " events instead of " |
4878 |
<< nev << endl; |
<< nev << endl; |
4879 |
|
fDiscarded = true; |
4880 |
return false; |
return false; |
4881 |
} |
} |
4882 |
nev = nevt; |
nev = nevt; |
4890 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4891 |
cout << "File: " << f->GetName() << " discarded ---- Anticounter tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Anticounter tree has " << nevt << " events instead of " |
4892 |
<< nev << endl; |
<< nev << endl; |
4893 |
|
fDiscarded = true; |
4894 |
return false; |
return false; |
4895 |
} |
} |
4896 |
nev = nevt; |
nev = nevt; |
4904 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4905 |
cout << "File: " << f->GetName() << " discarded ---- OrbitalInfo tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- OrbitalInfo tree has " << nevt << " events instead of " |
4906 |
<< nev << endl; |
<< nev << endl; |
4907 |
|
fDiscarded = true; |
4908 |
return false; |
return false; |
4909 |
} |
} |
4910 |
nev = nevt; |
nev = nevt; |
4918 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4919 |
cout << "File: " << f->GetName() << " discarded ---- Tracker tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Tracker tree has " << nevt << " events instead of " |
4920 |
<< nev << endl; |
<< nev << endl; |
4921 |
|
fDiscarded = true; |
4922 |
return false; |
return false; |
4923 |
} |
} |
4924 |
nev = nevt; |
nev = nevt; |
4942 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4943 |
cout << "File: " << f->GetName() << " discarded ---- Calorimeter tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Calorimeter tree has " << nevt << " events instead of " |
4944 |
<< nev << endl; |
<< nev << endl; |
4945 |
|
fDiscarded = true; |
4946 |
return false; |
return false; |
4947 |
} |
} |
4948 |
nev = nevt; |
nev = nevt; |
4965 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4966 |
cout << "File: " << f->GetName() << " discarded ---- h20 tree has " << nevt << " events instead of " << nev |
cout << "File: " << f->GetName() << " discarded ---- h20 tree has " << nevt << " events instead of " << nev |
4967 |
<< endl; |
<< endl; |
4968 |
|
fDiscarded = true; |
4969 |
return false; |
return false; |
4970 |
} |
} |
4971 |
nev = nevt; |
nev = nevt; |
4978 |
SELLI = (Int_t) SELLI__ok; |
SELLI = (Int_t) SELLI__ok; |
4979 |
if (SELLI == 0 && SELLI__ok) { |
if (SELLI == 0 && SELLI__ok) { |
4980 |
cout << "File: " << f->GetName() << " discarded ---- found SelectionList (it is not a full-event file)" << endl; |
cout << "File: " << f->GetName() << " discarded ---- found SelectionList (it is not a full-event file)" << endl; |
4981 |
|
fDiscarded = true; |
4982 |
return false; |
return false; |
4983 |
} |
} |
4984 |
if (SELLI == 1 && !SELLI__ok) { |
if (SELLI == 1 && !SELLI__ok) { |
4985 |
cout << "File: " << f->GetName() << " discarded ---- SelectionList missing" << endl; |
cout << "File: " << f->GetName() << " discarded ---- SelectionList missing" << endl; |
4986 |
|
fDiscarded = true; |
4987 |
return false; |
return false; |
4988 |
} |
} |
4989 |
|
|
5022 |
|
|
5023 |
if (CAL1 && !CAL1__ok) { |
if (CAL1 && !CAL1__ok) { |
5024 |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel1 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel1 branch" << endl; |
5025 |
|
fDiscarded = true; |
5026 |
return false; |
return false; |
5027 |
}; |
}; |
5028 |
if (CAL2 && !CAL2__ok) { |
if (CAL2 && !CAL2__ok) { |
5029 |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel2 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel2 branch" << endl; |
5030 |
|
fDiscarded = true; |
5031 |
return false; |
return false; |
5032 |
}; |
}; |
5033 |
if (TRK2 && !TRK2__ok) { |
if (TRK2 && !TRK2__ok) { |
5034 |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel2 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel2 branch" << endl; |
5035 |
|
fDiscarded = true; |
5036 |
return false; |
return false; |
5037 |
}; |
}; |
5038 |
if (TRK1 && !TRK1__ok) { |
if (TRK1 && !TRK1__ok) { |
5039 |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel1 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel1 branch" << endl; |
5040 |
|
fDiscarded = true; |
5041 |
return false; |
return false; |
5042 |
}; |
}; |
5043 |
if (TRKh && !TRKh__ok) { |
if (TRKh && !TRKh__ok) { |
5044 |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkHough branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkHough branch" << endl; |
5045 |
|
fDiscarded = true; |
5046 |
return false; |
return false; |
5047 |
}; |
}; |
5048 |
if (ORB && !ORB__ok) { |
if (ORB && !ORB__ok) { |
5049 |
cout << "File: " << f->GetName() << " discarded ---- Missing ORB tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing ORB tree" << endl; |
5050 |
|
fDiscarded = true; |
5051 |
return false; |
return false; |
5052 |
}; |
}; |
5053 |
if (AC && !AC__ok) { |
if (AC && !AC__ok) { |
5054 |
cout << "File: " << f->GetName() << " discarded ---- Missing AC tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing AC tree" << endl; |
5055 |
|
fDiscarded = true; |
5056 |
return false; |
return false; |
5057 |
}; |
}; |
5058 |
if (S4 && !S4__ok) { |
if (S4 && !S4__ok) { |
5059 |
cout << "File: " << f->GetName() << " discarded ---- Missing S4 tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing S4 tree" << endl; |
5060 |
|
fDiscarded = true; |
5061 |
return false; |
return false; |
5062 |
}; |
}; |
5063 |
if (TOF && !TOF__ok) { |
if (TOF && !TOF__ok) { |
5064 |
cout << "File: " << f->GetName() << " discarded ---- Missing ToF tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing ToF tree" << endl; |
5065 |
|
fDiscarded = true; |
5066 |
return false; |
return false; |
5067 |
}; |
}; |
5068 |
|
|
5069 |
if (ND && !ND__ok) { |
if (ND && !ND__ok) { |
5070 |
cout << "File: " << f->GetName() << " discarded ---- Missing ND tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing ND tree" << endl; |
5071 |
|
fDiscarded = true; |
5072 |
return false; |
return false; |
5073 |
}; |
}; |
5074 |
if (TRG && !TRG__ok) { |
if (TRG && !TRG__ok) { |
5075 |
cout << "File: " << f->GetName() << " discarded ---- Missing Trigger tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing Trigger tree" << endl; |
5076 |
|
fDiscarded = true; |
5077 |
return false; |
return false; |
5078 |
}; |
}; |
5079 |
if (GP && !GP__ok) { |
if (GP && !GP__ok) { |
5080 |
cout << "File: " << f->GetName() << " discarded ---- Missing h20 tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing h20 tree" << endl; |
5081 |
|
fDiscarded = true; |
5082 |
return false; |
return false; |
5083 |
}; |
}; |
5084 |
|
|
5191 |
// sel_tree_clone->Branch("RunEntry",&irun,"runentry/L"); |
// sel_tree_clone->Branch("RunEntry",&irun,"runentry/L"); |
5192 |
sel_tree_clone->Branch("RunEntry", &irunt, "runentry/L");//NEWNEW |
sel_tree_clone->Branch("RunEntry", &irunt, "runentry/L");//NEWNEW |
5193 |
sel_tree_clone->Branch("EventEntry", &irunentry, "eventry/L"); |
sel_tree_clone->Branch("EventEntry", &irunentry, "eventry/L"); |
5194 |
|
// if ( hasL0EE ) sel_tree_clone->Branch("L0EventEntry", &il0entry, "l0eventry/L"); |
5195 |
}; |
}; |
5196 |
|
|
5197 |
Int_t i = 0; |
Int_t i = 0; |
5211 |
pam_tree_clone[i]->Branch("TrkHough", "TrkHough", GetPointerTo("TrkHough")); |
pam_tree_clone[i]->Branch("TrkHough", "TrkHough", GetPointerTo("TrkHough")); |
5212 |
cout << "Tracker : branch TrkHough" << endl; |
cout << "Tracker : branch TrkHough" << endl; |
5213 |
}; |
}; |
5214 |
|
if(NUC){ |
5215 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&trk_nuc_obj); |
5216 |
|
cout << "Tracker : branch TrackNuclei" << endl; |
5217 |
|
} |
5218 |
|
if(EXT){ |
5219 |
|
pam_tree_clone[i]->Branch("extAlgFlag",&extAlgFlag,"extAlgFlag/I"); |
5220 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&trk_ext_obj); |
5221 |
|
cout << "Tracker : branch RecoveredTrack" << endl; |
5222 |
|
if(NUC){ |
5223 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&trk_ext_nuc_obj); |
5224 |
|
cout << "Tracker : branch RecoveredTrackNuclei" << endl; |
5225 |
|
} |
5226 |
|
} |
5227 |
|
|
5228 |
i++; |
i++; |
5229 |
} |
} |
5230 |
|
|
5239 |
pam_tree_clone[i]->Branch("CaloLevel2", "CaloLevel2", GetPointerTo("CaloLevel2")); |
pam_tree_clone[i]->Branch("CaloLevel2", "CaloLevel2", GetPointerTo("CaloLevel2")); |
5240 |
cout << "Calorimeter : branch CaloLevel2" << endl; |
cout << "Calorimeter : branch CaloLevel2" << endl; |
5241 |
}; |
}; |
5242 |
|
if(NUC){ |
5243 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&calo_nuc_obj); |
5244 |
|
cout << "Calorimeter : branch TrackNuclei" << endl; |
5245 |
|
} |
5246 |
|
if(EXT){ |
5247 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&calo_ext_obj); |
5248 |
|
cout << "Calorimeter : branch RecoveredTrack" << endl; |
5249 |
|
if(NUC){ |
5250 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&calo_ext_nuc_obj); |
5251 |
|
cout << "Calorimeter : branch RecoveredTrackNuclei" << endl; |
5252 |
|
} |
5253 |
|
} |
5254 |
i++; |
i++; |
5255 |
} |
} |
5256 |
|
|
5259 |
pam_tree_clone[i] = new TTree("ToF", "PAMELA ToF level2 data "); |
pam_tree_clone[i] = new TTree("ToF", "PAMELA ToF level2 data "); |
5260 |
pam_tree_clone[i]->Branch("ToFLevel2", "ToFLevel2", GetPointerTo("ToFLevel2")); |
pam_tree_clone[i]->Branch("ToFLevel2", "ToFLevel2", GetPointerTo("ToFLevel2")); |
5261 |
cout << "ToF : branch ToFLevel2" << endl; |
cout << "ToF : branch ToFLevel2" << endl; |
5262 |
|
if(NUC){ |
5263 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&tof_nuc_obj); |
5264 |
|
cout << "ToF : branch TrackNuclei" << endl; |
5265 |
|
} |
5266 |
|
if(EXT){ |
5267 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&tof_ext_obj); |
5268 |
|
cout << "ToF : branch RecoveredTrack" << endl; |
5269 |
|
if(NUC){ |
5270 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&tof_ext_nuc_obj); |
5271 |
|
cout << "ToF : branch RecoveredTrackNuclei" << endl; |
5272 |
|
} |
5273 |
|
} |
5274 |
i++; |
i++; |
5275 |
}; |
}; |
5276 |
// Trigger |
// Trigger |
5306 |
pam_tree_clone[i] = new TTree("OrbitalInfo", "PAMELA orbital info "); |
pam_tree_clone[i] = new TTree("OrbitalInfo", "PAMELA orbital info "); |
5307 |
pam_tree_clone[i]->Branch("OrbitalInfo", "OrbitalInfo", GetPointerTo("OrbitalInfo")); |
pam_tree_clone[i]->Branch("OrbitalInfo", "OrbitalInfo", GetPointerTo("OrbitalInfo")); |
5308 |
cout << "OrbitalInfo : branch OrbitalInfo" << endl; |
cout << "OrbitalInfo : branch OrbitalInfo" << endl; |
5309 |
|
if(NUC){ |
5310 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&orb_nuc_obj); |
5311 |
|
cout << "OrbitalInfo : branch TrackNuclei" << endl; |
5312 |
|
} |
5313 |
|
if(EXT){ |
5314 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&orb_ext_obj); |
5315 |
|
cout << "OrbitalInfo : branch RecoveredTrack" << endl; |
5316 |
|
if(NUC){ |
5317 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&orb_ext_nuc_obj); |
5318 |
|
cout << "OrbitalInfo : branch RecoveredTrackNuclei" << endl; |
5319 |
|
} |
5320 |
|
} |
5321 |
i++; |
i++; |
5322 |
}; |
}; |
5323 |
// GPamela |
// GPamela |
5324 |
if (GP) { |
if (GP) { |
5325 |
pam_tree_clone[i] = new TTree("h20", "GPAMELA info "); |
pam_tree_clone[i] = new TTree("h20", "GPAMELA info "); |
5326 |
pam_tree_clone[i]->Branch("GPamela", "GPamela", GetPointerTo("GPamela"), 32000, 1);//split |
pam_tree_clone[i]->Branch("GPamela", "GPamela", GetPointerTo("GPamela"), 32000, 1);//split |
5327 |
cout << "OrbitalInfo : branch OrbitalInfo" << endl; |
cout << "GPamela : branch GPamela" << endl; |
5328 |
i++; |
i++; |
5329 |
}; |
}; |
5330 |
|
|
5331 |
|
|
5332 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
5333 |
|
|
5334 |
} |
} |
5389 |
for (Int_t i = 0; i < NCLONES; i++) { |
for (Int_t i = 0; i < NCLONES; i++) { |
5390 |
if (pam_tree_clone[i]) { |
if (pam_tree_clone[i]) { |
5391 |
cout << pam_tree_clone[i]->GetName() << endl; |
cout << pam_tree_clone[i]->GetName() << endl; |
5392 |
pam_tree_clone[i]->Write(); |
pam_tree_clone[i]->Write(pam_tree_clone[i]->GetName(),TObject::kOverwrite); |
5393 |
}; |
}; |
5394 |
} |
} |
5395 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
5399 |
/** |
/** |
5400 |
* Method to get level2-trees entry, the corresponding run entry and (if required) the level0 entry. |
* Method to get level2-trees entry, the corresponding run entry and (if required) the level0 entry. |
5401 |
*/ |
*/ |
|
//Int_t PamLevel2::GetEntry(Int_t iee){ |
|
5402 |
Int_t PamLevel2::GetEntry(Long64_t iee) { |
Int_t PamLevel2::GetEntry(Long64_t iee) { |
5403 |
|
|
|
// cout << "-------------------------------------"<<endl; |
|
|
// cout << "Int_t PamLevel2::GetEntry("<<iee<<")"<<endl; |
|
|
|
|
5404 |
if (!pam_tree) { |
if (!pam_tree) { |
5405 |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded" << endl; |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded" << endl; |
5406 |
return 0; |
return 0; |
5414 |
// return 0; |
// return 0; |
5415 |
// } |
// } |
5416 |
|
|
|
Long64_t ii = 0; |
|
5417 |
//------------------------------- |
//------------------------------- |
5418 |
ii = iee; |
if (!pam_tree->GetEntry(iee)) { |
|
if (!pam_tree->GetEntry(ii)) { |
|
5419 |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading pam tree" << endl; |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading pam tree" << endl; |
5420 |
return 0; |
return 0; |
5421 |
} |
} |
5435 |
} |
} |
5436 |
|
|
5437 |
//------------------------------- |
//------------------------------- |
5438 |
ii = iee; |
// |
5439 |
// Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
if ( fUpdateRunInfo ) UpdateRunInfo(iee); // Emiliano |
5440 |
// Bool_t UPDATED = UpdateRunInfo(ii); |
if (SELLI == 0 || SELLI == 2) irunentry = iee - runfirstentry; |
|
if ( fUpdateRunInfo ) UpdateRunInfo(ii); // Emiliano |
|
|
if (SELLI == 0 || SELLI == 2) |
|
|
irunentry = iee - runfirstentry; |
|
|
// if(UPDATED && run_tree_clone)run_tree_clone->Fill(); |
|
|
|
|
|
// cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl; |
|
|
|
|
|
// cout << "irunentry "<<irunentry << endl; |
|
|
// cout << "runfirstentry "<<runfirstentry << endl; |
|
|
// cout << "nevents "<<GetRunInfo()->NEVENTS<< endl; |
|
|
|
|
|
// if( TRK0 || CAL0 || TOF0 ){ |
|
|
// if( !GetYodaEntry( ) ){ |
|
|
// cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading level0 tree"<<endl; |
|
|
// return 0; |
|
|
// } |
|
|
// } |
|
|
|
|
5441 |
|
|
5442 |
return 1; |
return 1; |
5443 |
|
|
5478 |
//=================================== |
//=================================== |
5479 |
if (irun < 0) { |
if (irun < 0) { |
5480 |
cout << "PamLevel2::GetYodaTree() -- ERROR -- irun = " << irun << endl; |
cout << "PamLevel2::GetYodaTree() -- ERROR -- irun = " << irun << endl; |
5481 |
// cout << "In order to use this method you have to first load the RunInfo tree "<<endl; |
if (DBG) cout << "In order to use this method you have to first load the RunInfo tree "<<endl; |
5482 |
return NULL; |
return NULL; |
5483 |
} |
} |
5484 |
Int_t irootnew = run_obj->ID_ROOT_L0; |
Int_t irootnew = GetRunInfo()->ID_ROOT_L0; |
5485 |
// cout << "iroot "<<iroot<<endl; |
if (DBG){ |
5486 |
// cout << "irootnew "<<irootnew<<endl; |
cout << "iroot "<<iroot<<endl; |
5487 |
|
cout << "irootnew "<<irootnew<<endl; |
5488 |
|
} |
5489 |
|
|
5490 |
//=================================== |
//=================================== |
5491 |
// load the level0 file |
// load the level0 file |
5523 |
if (!h0_obj) |
if (!h0_obj) |
5524 |
h0_obj = new EventHeader(); |
h0_obj = new EventHeader(); |
5525 |
l0_tree->SetBranchAddress("Header", &h0_obj); |
l0_tree->SetBranchAddress("Header", &h0_obj); |
5526 |
prevshift = 0; |
yprevshift = 0; // yes, yprevshift is the shift in the level0, prevshift is the shift in the level2 |
5527 |
//--------------------------------------------------- |
//--------------------------------------------------- |
5528 |
// TRACKER: |
// TRACKER: |
5529 |
if (TRK0) { |
if (TRK0) { |
5541 |
calo0_obj->Set(); |
calo0_obj->Set(); |
5542 |
}; |
}; |
5543 |
l0_tree->SetBranchAddress("Calorimeter", calo0_obj->GetPointerToCalorimeterEvent()); |
l0_tree->SetBranchAddress("Calorimeter", calo0_obj->GetPointerToCalorimeterEvent()); |
|
// cout << "PamLevel2::GetYodaTree() --- level0 calorimeter not implemented "<<endl; |
|
5544 |
} |
} |
5545 |
//--------------------------------------------------- |
//--------------------------------------------------- |
5546 |
// TOF: |
// TOF: |
5554 |
|
|
5555 |
}; |
}; |
5556 |
|
|
|
// if(!dbc || (dbc && !dbc->IsConnected())){ |
|
|
// cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl; |
|
|
// } |
|
|
|
|
5557 |
if (TRK0) { |
if (TRK0) { |
5558 |
// TrkParams::Load(6); |
if(!dbc || (dbc && !dbc->IsConnected()))SetDBConnection(); |
|
// if( !TrkParams::IsLoaded(6) ){ |
|
|
// cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- VK-mask not loaded"<<endl; |
|
|
// }; |
|
|
if(!dbc || (dbc && !dbc->IsConnected()))SetDBConnection(); // PERCHE` ERA COMMENTATA QUESTA RIGA? |
|
5559 |
TrkParams::SetCalib(run_obj, dbc); |
TrkParams::SetCalib(run_obj, dbc); |
5560 |
TrkParams::LoadCalib(); |
TrkParams::LoadCalib(); |
5561 |
if (!TrkParams::CalibIsLoaded()) { |
if (!TrkParams::CalibIsLoaded()) { |
5567 |
dbc=0; |
dbc=0; |
5568 |
}; |
}; |
5569 |
} |
} |
|
|
|
|
// cout << l0_tree << endl; |
|
5570 |
return l0_tree; |
return l0_tree; |
|
|
|
5571 |
} |
} |
5572 |
|
|
5573 |
/** |
/** |
5575 |
*/ |
*/ |
5576 |
Int_t PamLevel2::GetYodaEntry() { |
Int_t PamLevel2::GetYodaEntry() { |
5577 |
|
|
5578 |
// cout << "Int_t PamLevel2::GetYodaEntry()"<<endl; |
Long64_t iev = this->GetReadEntry(); |
|
if (!GetYodaTree()) |
|
|
return 0; |
|
5579 |
|
|
5580 |
// patch |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
5581 |
if (irunentry < 0) { |
// if it is a full file (not preselected) |
5582 |
// cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl; |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
5583 |
irunentry = 0LL; |
// if (SELLI == 0 || SELLI == 2 || !hasL0EE) { |
|
} |
|
|
// --------------------------------- |
|
|
// if file is NOT a preselected file |
|
|
// --------------------------------- |
|
|
Long64_t quellagiusta = irunentry + (Long64_t)(run_obj->EV_FROM); |
|
|
// cout << " irunentry "<<irunentry<<endl; |
|
|
// cout << " EV_FROM "<<run_obj->EV_FROM<<endl; |
|
|
// cout << " quellagiusta = irunentry + EV_FROM "<< quellagiusta << endl; |
|
|
|
|
|
// cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl; |
|
|
// cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl; |
|
|
// cout << " time "<< abstime << endl; |
|
|
// cout << " trk_calib_used "<<run_obj->TRK_CALIB_USED<< endl; |
|
5584 |
|
|
5585 |
ULong64_t obt = 0; |
if (!GetYodaTree()){ |
5586 |
ULong64_t pktn = 0; |
printf(" PamLevel2::GetYodaEntry() : ERROR no level0 file loaded!\n"); |
5587 |
if (GetOrbitalInfo()) { |
return 0; |
5588 |
obt = GetOrbitalInfo()->OBT; |
} |
|
pktn = GetOrbitalInfo()->pkt_num; |
|
|
} |
|
5589 |
|
|
5590 |
if (!GetOrbitalInfo() && !ISGP) { |
if (irunentry < 0) { |
5591 |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo " << endl; |
if (DBG) cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl; |
5592 |
return 0; |
// cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl; // TOGLITOGLI |
5593 |
} |
irunentry = 0LL; |
5594 |
if (obt == 0 && pktn == 0 && !ISGP) { |
} |
5595 |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- level2 event corrupted ?? " << endl; |
// --------------------------------- |
5596 |
return 0; |
// if file is NOT a preselected file |
5597 |
} |
// --------------------------------- |
5598 |
|
Long64_t quellagiusta = irunentry + (Long64_t)(run_obj->EV_FROM); // prevshift already included in irunentry |
5599 |
|
|
5600 |
|
if (DBG){ |
5601 |
|
cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl; |
5602 |
|
cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl; |
5603 |
|
cout << " time "<< abstime << endl; |
5604 |
|
} |
5605 |
|
|
5606 |
|
ULong64_t obt = 0; |
5607 |
|
ULong64_t pktn = 0; |
5608 |
|
if (GetOrbitalInfo()) { |
5609 |
|
obt = GetOrbitalInfo()->OBT; |
5610 |
|
pktn = GetOrbitalInfo()->pkt_num; |
5611 |
|
} |
5612 |
|
|
5613 |
// --------------------------------------------------------------------- |
if (!GetOrbitalInfo() && !ISGP) { |
5614 |
// ATTENTION!!! |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo " << endl; |
5615 |
// If data are not pre-processed with cleaner, the level0 tree may contain |
return 0; |
|
// spurious nested physics packets. |
|
|
// The GL_RUN variables EV_FROM, EV_TO and NEVENTS counts also these entries |
|
|
// while level2 tree DOES NOT!! |
|
|
// This means that "quellagiusta" in these cases is not correct. |
|
|
// In order to retrieve the correct level0 event, I implemented a check |
|
|
// of the OBT and pkt-number. In case of mismatch, the level0 entry number |
|
|
// is shift forward until when the packets match. |
|
|
// --------------------------------------------------------------------- |
|
|
Int_t answer = 0; |
|
|
Int_t shift = 0; |
|
|
// printf(" siamo qui %i %i \n",shift,prevshift); |
|
|
// Int_t maxshift = 50; // EMILIANO |
|
|
do { |
|
|
if (shift > 0) { |
|
|
cout << " PKTNUM L2 --- " << pktn << " --- L0 --- " << GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
|
|
if (DBG) |
|
|
cout << " RUN: ID " << GetRunInfo()->ID << " ID_ROOT_L0 " << run_obj->ID_ROOT_L0 << " ID_RUN_FRAG " |
|
|
<< GetRunInfo()->ID_RUN_FRAG << " EV_FROM " << GetRunInfo()->EV_FROM << endl; |
|
|
if (DBG) |
|
|
cout << " L2 <--> L0 mismatch ( irun " << irun << " irunentry " << irunentry << " shift " << shift |
|
|
<< " prevshift " << prevshift << " )" << endl; |
|
5616 |
} |
} |
5617 |
answer = l0_tree->GetEntry(quellagiusta + (Long64_t) shift + (Long64_t) prevshift); |
if (obt == 0 && pktn == 0 && !ISGP) { |
5618 |
shift++; |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- level2 event corrupted ?? " << endl; |
|
if (!GetEventHeader()) { |
|
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader " << endl; |
|
5619 |
return 0; |
return 0; |
5620 |
} |
} |
5621 |
|
|
5622 |
|
// --------------------------------------------------------------------- |
5623 |
|
// ATTENTION!!! |
5624 |
|
// If data are not pre-processed with cleaner, the level0 tree may contain |
5625 |
|
// spurious nested physics packets. |
5626 |
|
// The GL_RUN variables EV_FROM, EV_TO and NEVENTS counts also these entries |
5627 |
|
// while level2 tree DOES NOT!! |
5628 |
|
// This means that "quellagiusta" in these cases is not correct. |
5629 |
|
// In order to retrieve the correct level0 event, I implemented a check |
5630 |
|
// of the OBT and pkt-number. In case of mismatch, the level0 entry number |
5631 |
|
// is shift forward until when the packets match. |
5632 |
|
// --------------------------------------------------------------------- |
5633 |
|
Long64_t shift = 0LL; |
5634 |
|
Long64_t answer = quellagiusta + shift + yprevshift; |
5635 |
|
Int_t readl0 = 0; |
5636 |
|
readl0 = l0_tree->GetEntry(answer); // prevshift already included in irunentry |
5637 |
|
|
5638 |
|
if (DBG){ |
5639 |
|
printf(" siamo qui shift %lld yprevshift %lld answer %lld \n",shift,yprevshift,answer); |
5640 |
|
} |
5641 |
|
|
5642 |
|
|
5643 |
if (ISGP) { |
if (ISGP) { |
5644 |
obt = (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()); //BARBATRUCCO |
obt = (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()); //BARBATRUCCO |
5645 |
pktn = (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter()); //BARBATRUCCO |
pktn = (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter()); //BARBATRUCCO |
5646 |
} |
} |
5647 |
|
|
5648 |
// cout << "PKTNUM "<<shift<<" == L2 --- "<< pktn << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
while ( (obt != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || pktn != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta + (Long64_t) shift) < GetYodaTree()->GetEntries() && shift < maxshift ){ |
5649 |
// cout << " L2 --- "<< obt << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime()<<endl; |
if ( isSync && shift == 0LL ){ |
5650 |
// if( (quellagiusta+shift) == l0_tree->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl; |
printf(" PamLevel2::GetYodaEntry() ERROR! sync file but the level0 entry not found in place!!! \n"); |
5651 |
// cout << " obt "<< obt << endl; |
cout << " OK this is a bug, write to Emiliano, Emiliano.Mocchiutti@ts.infn.it " << endl; |
5652 |
// cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl; |
cout << "\nFor bug reporting instructions, please see for example:\n"; |
5653 |
// cout << " pktn "<< pktn << endl; |
cout << " <http://www.ts.infn.it/~mocchiut/bugs/bugs.html>.\n"; |
5654 |
// cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
cout << " " << endl; |
5655 |
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
} |
5656 |
// |
if (shift > 0) { |
5657 |
if (prevshift != 0 && (quellagiusta + (Long64_t) shift) == GetYodaTree()->GetEntries()) { |
if (DBG) cout << " PKTNUM L2 --- " << pktn << " --- L0 --- " << GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
5658 |
prevshift = 0; |
if (DBG) |
5659 |
shift = -1; |
cout << " RUN: ID " << GetRunInfo()->ID << " ID_ROOT_L0 " << run_obj->ID_ROOT_L0 << " ID_RUN_FRAG " |
5660 |
}; |
<< GetRunInfo()->ID_RUN_FRAG << " EV_FROM " << GetRunInfo()->EV_FROM << endl; |
5661 |
|
if (DBG) |
5662 |
|
cout << " L2 <--> L0 mismatch ( irun " << irun << " irunentry " << irunentry << " shift " << shift |
5663 |
|
<< " prevshift " << prevshift << " )" << endl; |
5664 |
|
} |
5665 |
|
answer = quellagiusta + shift+ yprevshift; |
5666 |
|
readl0 = l0_tree->GetEntry(answer); |
5667 |
|
// printf(" inside while shift %lld yprevshift %lld answer %lld \n",shift,yprevshift,answer);//TOGLITOGLI |
5668 |
|
|
5669 |
} while ((obt != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || pktn != (UInt_t)( |
if (!GetEventHeader()) { |
5670 |
GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta + (Long64_t) shift) |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader " << endl; |
5671 |
< GetYodaTree()->GetEntries() && shift < maxshift); |
return 0; |
5672 |
|
} |
5673 |
|
|
5674 |
if ((quellagiusta + (Long64_t) shift + (Long64_t) prevshift) > GetYodaTree()->GetEntries() || shift == maxshift) { |
// |
5675 |
cout << " Big trouble here, no such event in Level0 data! (NB maxshift set to " << maxshift << " )" << endl; |
if (yprevshift != 0 && (quellagiusta + (Long64_t) shift) == GetYodaTree()->GetEntries()) { |
5676 |
return 0; |
if (DBG) printf(" reset inside while shift %lld yprevshift %lld answer %lld \n",shift,yprevshift,answer); |
5677 |
} |
// printf(" reset inside while shift %lld yprevshift %lld answer %lld \n",shift,yprevshift,answer);//TOGLITOGLI |
5678 |
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
yprevshift = 0LL; |
5679 |
// return GetYodaTree()->GetEntry(quellagiusta); |
shift = -1LL; |
5680 |
if (shift > 1) |
}; |
5681 |
prevshift += (shift - 1); |
|
5682 |
|
shift++; |
5683 |
|
} |
5684 |
|
|
5685 |
|
|
5686 |
return answer; |
if ( obt != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || pktn != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter()) ){ |
5687 |
|
if ( isSync ){ |
5688 |
|
printf(" PamLevel2::GetYodaEntry() ERROR! sync file but the level0 entry not found AT ALL!!! \n"); |
5689 |
|
cout << " OK this is a bug, write to Emiliano, Emiliano.Mocchiutti@ts.infn.it " << endl; |
5690 |
|
cout << "\nFor bug reporting instructions, please see for example:\n"; |
5691 |
|
cout << " <http://www.ts.infn.it/~mocchiut/bugs/bugs.html>.\n"; |
5692 |
|
cout << " " << endl; |
5693 |
|
} |
5694 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- WARNING -- " << endl; |
5695 |
|
cout << " Big trouble here, no such event in Level0 data! (NB maxshift set to " << maxshift << " )" << endl; |
5696 |
|
cout << " Nested and/or DarthVader skipped packets in fragmented run? checking and trying to fix " <<endl; |
5697 |
|
// query the DB for runs containing the event, loop over LEVEL0 files which could contain the level0 event and try to find it |
5698 |
|
// ma nel mezzo del cammin per ogni run che pesco devo vedere la posizione relativa di iev rispetto al runheader nel livello2 per andare a cercare nel posto giusto |
5699 |
|
// connect to db |
5700 |
|
if (!dbc || (dbc && !dbc->IsConnected())) SetDBConnection(); //Emiliano |
5701 |
|
// |
5702 |
|
if (GetOrbitalInfo()){ |
5703 |
|
abstime = GetOrbitalInfo()->absTime; |
5704 |
|
} else { |
5705 |
|
printf(" PamLevel2::GetYodaEntry() ERROR! no OrbitalInfo, cannot get the absolute time for event \n"); |
5706 |
|
return 0; |
5707 |
|
} |
5708 |
|
// query DB looking for runs containing the processed event |
5709 |
|
TSQLResult *pResult; |
5710 |
|
TSQLRow *Row = NULL; |
5711 |
|
TString myquery = Form("select ID,NEVENTS from GL_RUN where RUNHEADER_TIME<=%lld and RUNTRAILER_TIME>=%lld;",abstime,abstime); |
5712 |
|
if ( DBG ) printf(" query is %s \n",myquery.Data()); |
5713 |
|
// printf(" query is %s \n",myquery.Data());// TOGLITOGLI |
5714 |
|
pResult = dbc->Query(myquery.Data()); |
5715 |
|
if (!pResult->GetRowCount()){ |
5716 |
|
printf(" PamLevel2::GetYodaEntry() ERROR! event is not included in any run!!! \n"); |
5717 |
|
cout << " OK this is a bug, write to Emiliano, Emiliano.Mocchiutti@ts.infn.it " << endl; |
5718 |
|
cout << "\nFor bug reporting instructions, please see for example:\n"; |
5719 |
|
cout << " <http://www.ts.infn.it/~mocchiut/bugs/bugs.html>.\n"; |
5720 |
|
cout << " " << endl; |
5721 |
|
return 0; |
5722 |
|
} |
5723 |
|
if ( pResult->GetRowCount() == 1 ){ |
5724 |
|
if (DBG) printf(" PamLevel2::GetYodaEntry() - WARNING - YodaEntry not found but only one run containing the event, it should not happen \n"); |
5725 |
|
// printf(" PamLevel2::GetYodaEntry() - WARNING - YodaEntry not found but only one run containing the event, it should not happen \n");//TOGLITOGLI |
5726 |
|
} |
5727 |
|
for( Int_t ru=0; ru < pResult->GetRowCount(); ru++){ // loop over runs containing the event |
5728 |
|
if (Row) delete Row; |
5729 |
|
Row = pResult->Next(); |
5730 |
|
if( Row == NULL ) break; |
5731 |
|
UInt_t idrun = (UInt_t)atoll(Row->GetField(0)); |
5732 |
|
UInt_t nev = (UInt_t)atoll(Row->GetField(1)); |
5733 |
|
if (DBG) printf(" inside loop over runs: ru %i idrun %i nev %i \n",ru,idrun,nev); |
5734 |
|
// printf(" inside loop over runs: ru %i idrun %i nev %i \n",ru,idrun,nev);//TOGLITOGLI |
5735 |
|
|
5736 |
|
// now look for this run in the level2 file, it must be present! code is taken from updateruninfo of course |
5737 |
|
Bool_t rfound = false; |
5738 |
|
totrunentry = 0LL; |
5739 |
|
runfirstentry = 0LL; |
5740 |
|
for (Int_t r=0; r< run_tree->GetEntries();r++){ |
5741 |
|
run_tree->GetEntry(r);//update runinfo |
5742 |
|
if ( r > 0 ){ |
5743 |
|
totrunentrymin = totrunentrymax+1; |
5744 |
|
} else { |
5745 |
|
totrunentrymin = 0LL; |
5746 |
|
} |
5747 |
|
totrunentry += GetRunInfo()->NEVENTS; |
5748 |
|
totrunentrymax = totrunentry - 1 - prevshift; // prevshift is needed to handle nested+DV_skipped packets |
5749 |
|
irun = r; |
5750 |
|
|
5751 |
|
if (idrun == GetRunInfo()->ID){ |
5752 |
|
if ( totrunentrymin > iev ){ // there is a shift (nested+DV_skipped packets) |
5753 |
|
if (DBG) printf("PamLevel2::GetYodaEntry - unconsistent iev - nevents, probable DBL0-L2 async\n"); |
5754 |
|
if (DBG) printf("PamLevel2::GetYodaEntry - totrunentrymin %lld iev %lld prevshift %lld totrunentrymax %lld \n",totrunentrymin,iev,prevshift,totrunentrymax); |
5755 |
|
// printf("PamLevel2::GetYodaEntry - unconsistent iev - nevents, probable DBL0-L2 async\n"); |
5756 |
|
// printf("PamLevel2::GetYodaEntry - totrunentrymin %lld iev %lld prevshift %lld totrunentrymax %lld \n",totrunentrymin,iev,prevshift,totrunentrymax);//TOGLITOGLI |
5757 |
|
prevshift += (totrunentrymin-iev); // add the new shift to total shift |
5758 |
|
totrunentrymin -= (totrunentrymin-iev); // shift run position min |
5759 |
|
totrunentrymax -= (totrunentrymin-iev); // shift run position max |
5760 |
|
if (DBG) printf("PamLevel2::GetYodaEntry - totrunentrymin %lld iev %lld prevshift %lld totrunentrymax %lld \n",totrunentrymin,iev,prevshift,totrunentrymax); |
5761 |
|
// printf("PamLevel2::GetYodaEntry - totrunentrymin %lld iev %lld prevshift %lld totrunentrymax %lld \n",totrunentrymin,iev,prevshift,totrunentrymax);//TOGLITOGLI |
5762 |
|
} |
5763 |
|
runfirstentry = totrunentrymin; // first entry of the run in the level2 |
5764 |
|
|
5765 |
|
|
5766 |
|
// |
5767 |
|
if (gltsync) |
5768 |
|
delete gltsync; // Emiliano |
5769 |
|
if (!dbc || (dbc && !dbc->IsConnected())) |
5770 |
|
SetDBConnection(); //Emiliano |
5771 |
|
gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); // Emiliano |
5772 |
|
if (dbc){ |
5773 |
|
dbc->Close(); // Emiliano |
5774 |
|
delete dbc; |
5775 |
|
dbc=0; |
5776 |
|
} |
5777 |
|
if (gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)) { // Emiliano |
5778 |
|
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun " << irun |
5779 |
|
<< " has RUNHEADER_OBT>=RUNTRAILER_OBT " << endl; |
5780 |
|
cout |
5781 |
|
<< " (NB!! in this case some events could be assigned to a wrong run)" |
5782 |
|
<< endl; |
5783 |
|
} |
5784 |
|
// |
5785 |
|
if (DBG) printf(" found \n"); |
5786 |
|
// printf(" found \n");//TOGLITOGLI |
5787 |
|
rfound = true; |
5788 |
|
// |
5789 |
|
break; |
5790 |
|
} |
5791 |
|
} // loop over run |
5792 |
|
if ( !rfound ){ |
5793 |
|
printf(" PamLevel2::GetYodaEntry() ERROR! run is not present in the level2 file!!! \n"); |
5794 |
|
cout << " OK this is a bug, write to Emiliano, Emiliano.Mocchiutti@ts.infn.it " << endl; |
5795 |
|
cout << "\nFor bug reporting instructions, please see for example:\n"; |
5796 |
|
cout << " <http://www.ts.infn.it/~mocchiut/bugs/bugs.html>.\n"; |
5797 |
|
cout << " " << endl; |
5798 |
|
return 0; |
5799 |
|
} |
5800 |
|
|
5801 |
|
// here we got the first run and we can check if it contains the level0 event |
5802 |
|
if (!GetYodaTree()){ |
5803 |
|
printf(" PamLevel2::GetYodaEntry() : ERROR no level0 file loaded!\n"); |
5804 |
|
return 0; |
5805 |
|
} |
5806 |
|
|
5807 |
|
// get the current run entry |
5808 |
|
irunentry = iev - runfirstentry; |
5809 |
|
if (irunentry < 0) { |
5810 |
|
if (DBG) cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl; |
5811 |
|
// cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl; // TOGLITOGLI |
5812 |
|
irunentry = 0LL; |
5813 |
|
} |
5814 |
|
// --------------------------------- |
5815 |
|
// if file is NOT a preselected file |
5816 |
|
// --------------------------------- |
5817 |
|
quellagiusta = irunentry + (Long64_t)(run_obj->EV_FROM); // prevshift already included in irunentry |
5818 |
|
|
5819 |
|
if (DBG){ |
5820 |
|
cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl; |
5821 |
|
cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl; |
5822 |
|
cout << " time "<< abstime << endl; |
5823 |
|
} |
5824 |
|
// cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl; |
5825 |
|
// cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl; |
5826 |
|
// cout << " time "<< abstime << endl; // TOGLITOGLI |
5827 |
|
|
5828 |
|
shift = 0; |
5829 |
|
answer = quellagiusta + shift + yprevshift; // prevshift already included in irunentry |
5830 |
|
readl0 = l0_tree->GetEntry(answer); // prevshift already included in irunentry |
5831 |
|
|
5832 |
|
if (DBG){ |
5833 |
|
printf(" siamo qua shift %lld yprevshift %lld answer %lld \n",shift,yprevshift,answer); |
5834 |
|
} |
5835 |
|
// printf(" siamo qua shift %lld yprevshift %lld answer %lld \n",shift,yprevshift,answer);//TOGLITOGLI |
5836 |
|
|
5837 |
|
while ( (obt != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || pktn != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta + (Long64_t) shift) < GetYodaTree()->GetEntries() && shift < maxshift ){ |
5838 |
|
if (shift > 0) { |
5839 |
|
if (DBG) cout << " PKTNUM L2 --- " << pktn << " --- L0 --- " << GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
5840 |
|
if (DBG) |
5841 |
|
cout << " RUN: ID " << GetRunInfo()->ID << " ID_ROOT_L0 " << run_obj->ID_ROOT_L0 << " ID_RUN_FRAG " |
5842 |
|
<< GetRunInfo()->ID_RUN_FRAG << " EV_FROM " << GetRunInfo()->EV_FROM << endl; |
5843 |
|
if (DBG) |
5844 |
|
cout << " L2 <--> L0 mismatch ( irun " << irun << " irunentry " << irunentry << " shift " << shift |
5845 |
|
<< " prevshift " << prevshift << " )" << endl; |
5846 |
|
} |
5847 |
|
answer = quellagiusta + shift+ yprevshift; |
5848 |
|
readl0 = l0_tree->GetEntry(answer); |
5849 |
|
// printf(" inside inside while shift %lld yprevshift %lld answer %lld \n",shift,yprevshift,answer);//TOGLITOGLI |
5850 |
|
|
5851 |
|
if (!GetEventHeader()) { |
5852 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader " << endl; |
5853 |
|
return 0; |
5854 |
|
} |
5855 |
|
// |
5856 |
|
if (yprevshift != 0 && (quellagiusta + (Long64_t) shift) == GetYodaTree()->GetEntries()) { |
5857 |
|
if (DBG) printf(" reset inside while shift %lld yprevshift %lld answer %lld \n",shift,yprevshift,answer); |
5858 |
|
// printf(" reset inside while shift %lld yprevshift %lld answer %lld \n",shift,yprevshift,answer);//TOGLITOGLI |
5859 |
|
yprevshift = 0; |
5860 |
|
shift = -1; |
5861 |
|
}; |
5862 |
|
|
5863 |
|
shift++; |
5864 |
|
} |
5865 |
|
|
5866 |
|
if ( obt != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || pktn != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter()) ){ |
5867 |
|
//still not the good run... continue with the nex one! |
5868 |
|
printf("still not the good run... continue with the nex one!\n"); |
5869 |
|
} else { |
5870 |
|
if (DBG) cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
5871 |
|
// cout << "LA ENTRY GIUSTA E`: "<<answer<<" (spero...)"<<endl;//TOGLITOGLI |
5872 |
|
if (shift > 1) yprevshift = (shift - 1); |
5873 |
|
if (Row) delete Row; |
5874 |
|
delete pResult; |
5875 |
|
if (dbc){ |
5876 |
|
dbc->Close(); // Emiliano |
5877 |
|
delete dbc; |
5878 |
|
dbc=0; |
5879 |
|
} |
5880 |
|
il0entry = answer; |
5881 |
|
return readl0; |
5882 |
|
} |
5883 |
|
// perhaps it is all |
5884 |
|
}// loop over runs containing the event |
5885 |
|
if (Row) delete Row; |
5886 |
|
delete pResult; |
5887 |
|
if (dbc){ |
5888 |
|
dbc->Close(); // Emiliano |
5889 |
|
delete dbc; |
5890 |
|
dbc=0; |
5891 |
|
} |
5892 |
|
// arriving here it means no run found, cannot be! error! |
5893 |
|
printf(" PamLevel2::GetYodaEntry() ERROR! run is not present in the level0 files!!! \n"); |
5894 |
|
cout << " OK this is a bug, write to Emiliano, Emiliano.Mocchiutti@ts.infn.it " << endl; |
5895 |
|
cout << "\nFor bug reporting instructions, please see for example:\n"; |
5896 |
|
cout << " <http://www.ts.infn.it/~mocchiut/bugs/bugs.html>.\n"; |
5897 |
|
cout << " " << endl; |
5898 |
|
return 0; |
5899 |
|
} else { |
5900 |
|
if (DBG) cout << "=> LA ENTRY GIUSTA E`: "<<answer<<" (spero...)"<<endl; |
5901 |
|
// cout << "=> LA ENTRY GIUSTA E`: "<<answer<<" (spero...)"<<endl; |
5902 |
|
// printf("obt %lld (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) %i pktn %lld (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter() %i \n",obt,(UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()), pktn, (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter()) ); |
5903 |
|
if (shift > 1) yprevshift = (shift - 1); |
5904 |
|
il0entry = answer; |
5905 |
|
return readl0; |
5906 |
|
} |
5907 |
|
|
5908 |
|
/* } // if selli 0 || 2 |
5909 |
|
if ( SELLI == 1 && hasL0EE ){ |
5910 |
|
sel_tree->GetEntry(iev); |
5911 |
|
Long64_t answer = il0entry; |
5912 |
|
Int_t readl0 = 0; |
5913 |
|
readl0 = l0_tree->GetEntry(answer); |
5914 |
|
return readl0; |
5915 |
|
}*/ |
5916 |
|
printf(" PamLevel2::GetYodaEntry() ERROR! \n"); |
5917 |
|
cout << " Entry not found! OK this is a bug, write to Emiliano, Emiliano.Mocchiutti@ts.infn.it " << endl; |
5918 |
|
cout << "\nFor bug reporting instructions, please see for example:\n"; |
5919 |
|
cout << " <http://www.ts.infn.it/~mocchiut/bugs/bugs.html>.\n"; |
5920 |
|
cout << " " << endl; |
5921 |
|
return 0; |
5922 |
} |
} |
5923 |
|
|
5924 |
/** |
/** |
5925 |
* \Brief Set DB connection |
* \Brief Set DB connection |
5926 |
*/ |
*/ |
6013 |
void PamLevel2::SetSortingMethod(TString how) { |
void PamLevel2::SetSortingMethod(TString how) { |
6014 |
if (howtosort != how) { |
if (howtosort != how) { |
6015 |
issorted = false; |
issorted = false; |
6016 |
|
issorted_new = false; |
6017 |
} |
} |
6018 |
howtosort = how; |
howtosort = how; |
6019 |
} |
} |