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 |
|
} |
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 |
candeleteobj = 0; |
|
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 |
|
|
375 |
PamTrack::PamTrack(const PamTrack& track) { |
PamTrack::PamTrack(const PamTrack& track) { |
376 |
|
|
377 |
TrkTrack *t = track.trk_track; |
TrkTrack *t = track.trk_track; |
378 |
|
ExtTrack *e = track.trk_ext_track; |
379 |
CaloTrkVar *c = track.calo_track; |
CaloTrkVar *c = track.calo_track; |
380 |
ToFTrkVar *o = track.tof_track; |
ToFTrkVar *o = track.tof_track; |
381 |
OrbitalInfoTrkVar *r = track.orb_track; |
OrbitalInfoTrkVar *r = track.orb_track; |
382 |
|
|
383 |
trk_track = 0; |
trk_ext_track = 0; |
384 |
calo_track = 0; |
trk_track = 0; |
385 |
tof_track = 0; |
calo_track = 0; |
386 |
orb_track = 0; |
tof_track = 0; |
387 |
|
orb_track = 0; |
388 |
|
if(e) |
389 |
|
trk_ext_track = new ExtTrack(*e); |
390 |
if (t) |
if (t) |
391 |
trk_track = new TrkTrack(*t); |
trk_track = new TrkTrack(*t); |
392 |
if (c) |
if (c) |
395 |
tof_track = new ToFTrkVar(*o); |
tof_track = new ToFTrkVar(*o); |
396 |
if (r) |
if (r) |
397 |
orb_track = new OrbitalInfoTrkVar(*r); |
orb_track = new OrbitalInfoTrkVar(*r); |
398 |
|
|
399 |
candeleteobj = 1; |
candeleteobj = 1; |
400 |
|
pscore = 0; |
401 |
|
iscore = 0; |
402 |
|
|
403 |
} |
} |
|
void PamTrack::Clear() { |
|
404 |
|
|
405 |
// cout << "PamTrack::Clear() "<<candeleteobj<<endl; |
void PamTrack::Copy( PamTrack& track) const { |
406 |
|
|
407 |
|
track.trk_track = trk_track; |
408 |
|
track.trk_ext_track = trk_ext_track; |
409 |
|
track.calo_track = calo_track; |
410 |
|
track.tof_track = tof_track; |
411 |
|
track.orb_track = orb_track; |
412 |
|
|
413 |
|
track.candeleteobj = candeleteobj; |
414 |
|
track.pscore = pscore; |
415 |
|
track.iscore = iscore; |
416 |
|
|
417 |
|
} |
418 |
|
|
419 |
|
|
420 |
|
|
421 |
|
void PamTrack::Clear(Option_t *option) { |
422 |
|
|
423 |
|
// cout << "PamTrack::Clear( "<<option<<" ) "<<candeleteobj<<endl; |
424 |
if (candeleteobj) { |
if (candeleteobj) { |
425 |
|
|
426 |
|
if (trk_ext_track) |
427 |
|
trk_ext_track->ExtTrack::Clear(option); |
428 |
if (trk_track) |
if (trk_track) |
429 |
trk_track->TrkTrack::Clear(); |
trk_track->TrkTrack::Clear(); |
430 |
if (calo_track) |
if (calo_track) |
435 |
orb_track->OrbitalInfoTrkVar::Clear();//??? |
orb_track->OrbitalInfoTrkVar::Clear();//??? |
436 |
} |
} |
437 |
else { |
else { |
438 |
|
trk_ext_track = 0; |
439 |
trk_track = 0; |
trk_track = 0; |
440 |
calo_track = 0; |
calo_track = 0; |
441 |
tof_track = 0; |
tof_track = 0; |
448 |
void PamTrack::Delete() { |
void PamTrack::Delete() { |
449 |
// cout << "PamTrack::Delete() "<<candeleteobj<<endl; |
// cout << "PamTrack::Delete() "<<candeleteobj<<endl; |
450 |
if (candeleteobj) { |
if (candeleteobj) { |
451 |
|
if (trk_ext_track) { |
452 |
|
// trk_ext_track->ExtTrack::Clear("C");//Clear is called for all the array elements |
453 |
|
trk_ext_track->ExtTrack::Clear("C+C");//Clear is called for all the array elements passing option 'C' |
454 |
|
delete trk_ext_track; |
455 |
|
} |
456 |
if (trk_track) { |
if (trk_track) { |
457 |
trk_track->TrkTrack::Clear(); |
trk_track->TrkTrack::Clear(); |
458 |
delete trk_track; |
delete trk_track; |
474 |
Clear(); |
Clear(); |
475 |
} |
} |
476 |
} |
} |
477 |
|
|
478 |
|
|
479 |
|
|
480 |
|
|
481 |
//-------------------------------------- |
//-------------------------------------- |
482 |
// |
// |
483 |
// |
// |
511 |
GetPamTree(listf, detlist); |
GetPamTree(listf, detlist); |
512 |
if (listf) |
if (listf) |
513 |
GetRunTree(listf); |
GetRunTree(listf); |
514 |
this->SetMaxShift(-1); |
SetMaxShift(-1); |
515 |
} |
} |
516 |
|
|
517 |
|
|
519 |
Initialize(); |
Initialize(); |
520 |
GetPamTree(llist, detlist); |
GetPamTree(llist, detlist); |
521 |
GetRunTree(llist); |
GetRunTree(llist); |
522 |
this->SetMaxShift(-1); |
SetMaxShift(-1); |
523 |
} |
} |
524 |
|
|
525 |
/** |
/** |
531 |
*/ |
*/ |
532 |
PamLevel2::PamLevel2(TString ddir, TString llist) { |
PamLevel2::PamLevel2(TString ddir, TString llist) { |
533 |
Initialize(); |
Initialize(); |
534 |
TList* listf = GetListOfLevel2Files(ddir, llist); |
TList* listf = GetListOfLevel2Files(ddir, llist); |
535 |
|
cout << "GetPamTree: "<<endl; |
536 |
GetPamTree(listf, ""); |
GetPamTree(listf, ""); |
537 |
|
cout << "GetRunTree: "<<endl; |
538 |
GetRunTree(listf); |
GetRunTree(listf); |
539 |
this->SetMaxShift(-1); |
SetMaxShift(-1); |
540 |
} |
} |
541 |
|
|
542 |
|
|
551 |
trkh_obj = 0; |
trkh_obj = 0; |
552 |
calo1_obj = 0; |
calo1_obj = 0; |
553 |
calo2_obj = 0; |
calo2_obj = 0; |
554 |
tof_obj = 0; |
tof2_obj = 0; |
555 |
trig_obj = 0; |
trig_obj = 0; |
556 |
s4_obj = 0; |
s4_obj = 0; |
557 |
nd_obj = 0; |
nd_obj = 0; |
558 |
ac_obj = 0; |
ac_obj = 0; |
559 |
orb_obj = 0; |
orb2_obj = 0; |
560 |
gp_obj = 0; |
gp_obj = 0; |
561 |
|
|
562 |
|
extAlgFlag=0; |
563 |
|
|
564 |
|
trk_ext_obj = 0; |
565 |
|
trk_ext_nuc_obj = 0; |
566 |
|
trk_nuc_obj = 0; |
567 |
|
|
568 |
|
calo_ext_obj = 0; |
569 |
|
calo_ext_nuc_obj = 0; |
570 |
|
calo_nuc_obj = 0; |
571 |
|
|
572 |
|
tof_ext_obj = 0; |
573 |
|
tof_ext_nuc_obj = 0; |
574 |
|
tof_nuc_obj = 0; |
575 |
|
|
576 |
|
orb_ext_obj = 0; |
577 |
|
orb_ext_nuc_obj = 0; |
578 |
|
orb_nuc_obj = 0; |
579 |
|
|
580 |
|
trk2_nuc_obj = 0; |
581 |
|
calo2_nuc_obj = 0; |
582 |
|
tof2_nuc_obj = 0; |
583 |
|
orb2_nuc_obj = 0; |
584 |
|
|
585 |
|
|
586 |
run_obj = 0;//new GL_RUN(); |
run_obj = 0;//new GL_RUN(); |
587 |
soft_obj = 0;// Emiliano |
soft_obj = 0;// Emiliano |
588 |
|
proc_obj = 0;// Emiliano |
589 |
irun = -1LL; |
irun = -1LL; |
590 |
irunt = -1LL; |
irunt = -1LL; |
591 |
totrunentry = 0LL; |
totrunentry = 0LL; |
595 |
runlastentry = 0LL; |
runlastentry = 0LL; |
596 |
gltsync = 0; // Emiliano |
gltsync = 0; // Emiliano |
597 |
fUpdateRunInfo = true; // Emiliano |
fUpdateRunInfo = true; // Emiliano |
598 |
|
fUseDBinRunInfo = true; // Emiliano |
599 |
|
fDiscarded = false; //EM |
600 |
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 |
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 |
601 |
il0entry = 0LL; |
il0entry = 0LL; |
602 |
// hasL0EE = true; |
// hasL0EE = true; |
612 |
|
|
613 |
run_tree = NULL; |
run_tree = NULL; |
614 |
run_tree_clone = NULL; |
run_tree_clone = NULL; |
615 |
|
|
616 |
|
proc_tree = NULL; |
617 |
|
proc_tree_clone = NULL; |
618 |
|
|
619 |
sel_tree = NULL; |
sel_tree = NULL; |
620 |
sel_tree_clone = NULL; |
sel_tree_clone = NULL; |
621 |
|
|
647 |
if (strcmp(pamdbpsw, "")) |
if (strcmp(pamdbpsw, "")) |
648 |
psw = pamdbpsw; |
psw = pamdbpsw; |
649 |
|
|
650 |
|
customString = ""; |
651 |
|
|
652 |
// sorted_tracks = 0;//new TRefArray(); |
// sorted_tracks = 0;//new TRefArray(); |
653 |
|
|
654 |
CAL0 = false; |
CAL0 = false; |
665 |
ND = true; |
ND = true; |
666 |
AC = true; |
AC = true; |
667 |
ORB = true; |
ORB = true; |
668 |
|
PROC = true; |
669 |
GP = false; |
GP = false; |
670 |
|
|
671 |
|
EXT = false; |
672 |
|
NUC = false; |
673 |
|
trkAlg = "STD";//default tracking algorythm |
674 |
|
|
675 |
RUN = true; |
RUN = true; |
676 |
|
|
677 |
SELLI = -1; |
SELLI = -1; |
682 |
|
|
683 |
tsorted = 0; |
tsorted = 0; |
684 |
timage = 0; |
timage = 0; |
685 |
|
text = 0 ; |
686 |
|
|
687 |
|
tsorted_nuc = 0; |
688 |
|
timage_nuc = 0; |
689 |
|
text_nuc = 0 ; |
690 |
|
|
691 |
howtosort = "+CAL+TOF"; |
howtosort = "+CAL+TOF"; |
692 |
//howtosort = "+TOF"; |
//howtosort = "+TOF"; |
694 |
|
|
695 |
issorted = false; |
issorted = false; |
696 |
lastsorted = -1; |
lastsorted = -1; |
697 |
|
issorted_new = false; |
698 |
|
lastsorted_new = -1; |
699 |
|
|
700 |
} |
} |
701 |
; |
; |
708 |
delete run_obj; |
delete run_obj; |
709 |
if (soft_obj) |
if (soft_obj) |
710 |
delete soft_obj; //Emiliano |
delete soft_obj; //Emiliano |
711 |
|
if (proc_obj) |
712 |
|
delete proc_obj; //Emiliano |
713 |
|
|
714 |
// cout << "void PamLevel2::Clear()"<<endl; |
// cout << "void PamLevel2::Clear()"<<endl; |
715 |
if (h0_obj) |
if (h0_obj) |
728 |
delete calo1_obj; |
delete calo1_obj; |
729 |
if (calo2_obj) |
if (calo2_obj) |
730 |
delete calo2_obj; |
delete calo2_obj; |
731 |
if (tof_obj) |
if (tof2_obj) |
732 |
delete tof_obj; |
delete tof2_obj; |
733 |
if (trig_obj) |
if (trig_obj) |
734 |
delete trig_obj; |
delete trig_obj; |
735 |
if (s4_obj) |
if (s4_obj) |
738 |
delete nd_obj; |
delete nd_obj; |
739 |
if (ac_obj) |
if (ac_obj) |
740 |
delete ac_obj; |
delete ac_obj; |
741 |
if (orb_obj) |
if (orb2_obj) |
742 |
delete orb_obj; |
delete orb2_obj; |
743 |
if (gp_obj) |
if (gp_obj) |
744 |
delete gp_obj; |
delete gp_obj; |
745 |
|
|
746 |
|
if(trk_nuc_obj)trk_nuc_obj->Delete(); |
747 |
|
if(trk_ext_obj)trk_ext_obj->Delete(); |
748 |
|
if(trk_ext_nuc_obj)trk_ext_nuc_obj->Delete(); |
749 |
|
|
750 |
|
if(calo_nuc_obj)calo_nuc_obj->Delete(); |
751 |
|
if(calo_ext_obj)calo_ext_obj->Delete(); |
752 |
|
if(calo_ext_nuc_obj)calo_ext_nuc_obj->Delete(); |
753 |
|
|
754 |
|
if(tof_nuc_obj)tof_nuc_obj->Delete(); |
755 |
|
if(tof_ext_obj)tof_ext_obj->Delete(); |
756 |
|
if(tof_ext_nuc_obj)tof_ext_nuc_obj->Delete(); |
757 |
|
|
758 |
|
if(orb_nuc_obj)orb_nuc_obj->Delete(); |
759 |
|
if(orb_ext_obj)orb_ext_obj->Delete(); |
760 |
|
if(orb_ext_nuc_obj)orb_ext_nuc_obj->Delete(); |
761 |
|
|
762 |
|
|
763 |
|
if(trk2_nuc_obj)trk2_nuc_obj->Delete();; |
764 |
|
if( calo2_nuc_obj)calo2_nuc_obj->Delete();; |
765 |
|
if(tof2_nuc_obj)tof2_nuc_obj->Delete();; |
766 |
|
if(orb2_nuc_obj)orb2_nuc_obj->Delete();; |
767 |
|
|
768 |
|
|
769 |
|
|
770 |
if (tsorted) { |
if (tsorted) { |
771 |
tsorted->Delete(); |
tsorted->Delete(); |
772 |
delete tsorted; |
delete tsorted; |
775 |
timage->Delete(); |
timage->Delete(); |
776 |
delete timage; |
delete timage; |
777 |
} |
} |
778 |
|
if (text) { |
779 |
|
text->Delete(); |
780 |
|
delete text; |
781 |
|
} |
782 |
|
if (tsorted_nuc) { |
783 |
|
tsorted_nuc->Delete(); |
784 |
|
delete tsorted_nuc; |
785 |
|
} |
786 |
|
if (timage_nuc) { |
787 |
|
timage_nuc->Delete(); |
788 |
|
delete timage_nuc; |
789 |
|
} |
790 |
|
if (text_nuc) { |
791 |
|
text_nuc->Delete(); |
792 |
|
delete text_nuc; |
793 |
|
} |
794 |
|
|
795 |
|
|
796 |
|
|
797 |
if (dbc) { |
if (dbc) { |
798 |
dbc->Close(); |
dbc->Close(); |
860 |
if (irunoffset) |
if (irunoffset) |
861 |
delete[] irunoffset; |
delete[] irunoffset; |
862 |
|
|
863 |
|
|
864 |
|
Initialize(); |
865 |
|
|
866 |
} |
} |
867 |
; |
; |
868 |
|
|
896 |
calo1_obj->Clear(); |
calo1_obj->Clear(); |
897 |
if (calo2_obj) |
if (calo2_obj) |
898 |
calo2_obj->Clear(); |
calo2_obj->Clear(); |
899 |
if (tof_obj) |
if (tof2_obj) |
900 |
tof_obj->Clear(); |
tof2_obj->Clear(); |
901 |
if (trig_obj) |
if (trig_obj) |
902 |
trig_obj->Clear(); |
trig_obj->Clear(); |
903 |
if (s4_obj) |
if (s4_obj) |
906 |
nd_obj->Clear(); |
nd_obj->Clear(); |
907 |
if (ac_obj) |
if (ac_obj) |
908 |
ac_obj->Clear(); |
ac_obj->Clear(); |
909 |
if (orb_obj) |
if (orb2_obj) |
910 |
orb_obj->Clear(); |
orb2_obj->Clear(); |
911 |
if (gp_obj) |
if (gp_obj) |
912 |
gp_obj->Clear(); |
gp_obj->Clear(); |
913 |
|
if (proc_obj) |
914 |
|
proc_obj->Clear(); |
915 |
|
|
916 |
// if(sorted_tracks)sorted_tracks->Clear(); |
// if(sorted_tracks)sorted_tracks->Clear(); |
917 |
// sorted_tracks.Clear(); |
// sorted_tracks.Clear(); |
918 |
|
|
919 |
if (tsorted) { |
if(trk_nuc_obj)trk_nuc_obj->Clear(); |
920 |
tsorted->Delete(); |
if(trk_ext_obj)trk_ext_obj->Clear(); |
921 |
} |
if(trk_ext_nuc_obj)trk_ext_nuc_obj->Clear(); |
922 |
if (timage) { |
|
923 |
timage->Delete(); |
if(calo_nuc_obj)calo_nuc_obj->Clear(); |
924 |
} |
if(calo_ext_obj)calo_ext_obj->Clear(); |
925 |
|
if(calo_ext_nuc_obj)calo_ext_nuc_obj->Clear(); |
926 |
|
|
927 |
|
if(tof_nuc_obj)tof_nuc_obj->Clear(); |
928 |
|
if(tof_ext_obj)tof_ext_obj->Clear(); |
929 |
|
if(tof_ext_nuc_obj)tof_ext_nuc_obj->Clear(); |
930 |
|
|
931 |
|
if(orb_nuc_obj)orb_nuc_obj->Clear(); |
932 |
|
if(orb_ext_obj)orb_ext_obj->Clear(); |
933 |
|
if(orb_ext_nuc_obj)orb_ext_nuc_obj->Clear(); |
934 |
|
|
935 |
|
if(trk2_nuc_obj)trk2_nuc_obj->Clear();; |
936 |
|
if( calo2_nuc_obj)calo2_nuc_obj->Clear();; |
937 |
|
if(tof2_nuc_obj)tof2_nuc_obj->Clear();; |
938 |
|
if(orb2_nuc_obj)orb2_nuc_obj->Clear();; |
939 |
|
|
940 |
|
if (tsorted)tsorted->Delete(); |
941 |
|
if (timage)timage->Delete(); |
942 |
|
if (text) text->Delete(); |
943 |
|
|
944 |
|
if (tsorted_nuc)tsorted_nuc->Delete(); |
945 |
|
if (timage_nuc)timage_nuc->Delete(); |
946 |
|
if (text_nuc) text_nuc->Delete(); |
947 |
} |
} |
948 |
; |
; |
949 |
|
|
992 |
if (sel_tree) |
if (sel_tree) |
993 |
sel_tree->Delete();; |
sel_tree->Delete();; |
994 |
sel_tree = NULL; |
sel_tree = NULL; |
995 |
|
|
996 |
|
if (proc_tree) |
997 |
|
proc_tree->Delete(); |
998 |
|
proc_tree = NULL; |
999 |
// |
// |
1000 |
// Close file |
// Close file |
1001 |
// |
// |
1012 |
trkh_obj = 0; |
trkh_obj = 0; |
1013 |
calo1_obj = 0; |
calo1_obj = 0; |
1014 |
calo2_obj = 0; |
calo2_obj = 0; |
1015 |
tof_obj = 0; |
tof2_obj = 0; |
1016 |
trig_obj = 0; |
trig_obj = 0; |
1017 |
s4_obj = 0; |
s4_obj = 0; |
1018 |
nd_obj = 0; |
nd_obj = 0; |
1019 |
ac_obj = 0; |
ac_obj = 0; |
1020 |
orb_obj = 0; |
orb2_obj = 0; |
1021 |
gp_obj = 0; |
gp_obj = 0; |
1022 |
|
proc_obj = 0; |
1023 |
|
|
1024 |
|
trk_ext_obj = 0; |
1025 |
|
trk_ext_nuc_obj = 0; |
1026 |
|
trk_nuc_obj = 0; |
1027 |
|
|
1028 |
|
calo_ext_obj = 0; |
1029 |
|
calo_ext_nuc_obj = 0; |
1030 |
|
calo_nuc_obj = 0; |
1031 |
|
|
1032 |
|
tof_ext_obj = 0; |
1033 |
|
tof_ext_nuc_obj = 0; |
1034 |
|
tof_nuc_obj = 0; |
1035 |
|
|
1036 |
|
orb_ext_obj = 0; |
1037 |
|
orb_ext_nuc_obj = 0; |
1038 |
|
orb_nuc_obj = 0; |
1039 |
|
|
1040 |
|
trk2_nuc_obj = 0; |
1041 |
|
calo2_nuc_obj = 0; |
1042 |
|
tof2_nuc_obj = 0; |
1043 |
|
orb2_nuc_obj = 0; |
1044 |
|
|
1045 |
|
trk2_nuc_obj = 0; |
1046 |
|
calo2_nuc_obj = 0; |
1047 |
|
tof2_nuc_obj = 0; |
1048 |
|
orb2_nuc_obj = 0; |
1049 |
// |
// |
1050 |
// Reset run pointers |
// Reset run pointers |
1051 |
// |
// |
1052 |
run_obj = 0;//new GL_RUN(); |
run_obj = 0;//new GL_RUN(); |
1053 |
soft_obj = 0;// Emiliano |
soft_obj = 0;// Emiliano |
1054 |
|
proc_obj = 0;// Emiliano |
1055 |
irun = -1; |
irun = -1; |
1056 |
irunt = -1; |
irunt = -1; |
1057 |
totrunentry = 0LL; |
totrunentry = 0LL; |
1081 |
if (strict) { |
if (strict) { |
1082 |
if (trk2_obj && trk2_obj->UnpackError() != 0) |
if (trk2_obj && trk2_obj->UnpackError() != 0) |
1083 |
goodev = false; |
goodev = false; |
1084 |
if (tof_obj && tof_obj->unpackError != 0) |
if (tof2_obj && tof2_obj->unpackError != 0) |
1085 |
goodev = false; |
goodev = false; |
1086 |
if (trig_obj && trig_obj->unpackError != 0) |
if (trig_obj && trig_obj->unpackError != 0) |
1087 |
goodev = false; |
goodev = false; |
1091 |
goodev = false; |
goodev = false; |
1092 |
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))) |
1093 |
goodev = false; |
goodev = false; |
1094 |
// if(orb_obj) |
// if(orb2_obj) |
1095 |
} |
} |
1096 |
else { |
else { |
1097 |
if (nd_obj && nd_obj->unpackError != 0) |
if (nd_obj && nd_obj->unpackError != 0) |
1122 |
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"); |
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"); |
1123 |
maxshift = sh; |
maxshift = sh; |
1124 |
} else { |
} else { |
1125 |
ULong64_t nev = this->GetEntries(); |
ULong64_t nev = GetEntries(); |
1126 |
ULong64_t runnev = 0ULL; |
ULong64_t runnev = 0ULL; |
1127 |
for (Int_t r=0; r< run_tree->GetEntries();r++){ |
for (Int_t r=0; r< run_tree->GetEntries();r++){ |
1128 |
run_tree->GetEntry(r);//update runinfo |
run_tree->GetEntry(r);//update runinfo |
1177 |
return &calo2_obj; |
return &calo2_obj; |
1178 |
}; |
}; |
1179 |
if (!objname.CompareTo("ToFLevel2")) { |
if (!objname.CompareTo("ToFLevel2")) { |
1180 |
if (!tof_obj) { |
if (!tof2_obj) { |
1181 |
tof_obj = new ToFLevel2(); |
tof2_obj = new ToFLevel2(); |
1182 |
tof_obj->Set(); |
tof2_obj->Set(); |
1183 |
} |
} |
1184 |
return &tof_obj; |
return &tof2_obj; |
1185 |
}; |
}; |
1186 |
if (!objname.CompareTo("TrigLevel2")) { |
if (!objname.CompareTo("TrigLevel2")) { |
1187 |
if (!trig_obj) |
if (!trig_obj) |
1204 |
return &ac_obj; |
return &ac_obj; |
1205 |
}; |
}; |
1206 |
if (!objname.CompareTo("OrbitalInfo")) { |
if (!objname.CompareTo("OrbitalInfo")) { |
1207 |
if (!orb_obj) { |
if (!orb2_obj) { |
1208 |
orb_obj = new OrbitalInfo(); |
orb2_obj = new OrbitalInfo(); |
1209 |
orb_obj->Set(); |
orb2_obj->Set(); |
1210 |
} |
} |
1211 |
return &orb_obj; |
return &orb2_obj; |
1212 |
}; |
}; |
1213 |
// if(!objname.CompareTo("OrbitalInfo")){ |
// if(!objname.CompareTo("OrbitalInfo")){ |
1214 |
// if(!orb_obj) orb_obj = new OrbitalInfo(); |
// if(!orb2_obj) orb2_obj = new OrbitalInfo(); |
1215 |
// return &orb_obj; |
// return &orb2_obj; |
1216 |
// }; |
// }; |
1217 |
if (!objname.CompareTo("GPamela")) { |
if (!objname.CompareTo("GPamela")) { |
1218 |
if (!gp_obj) |
if (!gp_obj) |
1226 |
if (!objname.CompareTo("SoftInfo")) |
if (!objname.CompareTo("SoftInfo")) |
1227 |
return &soft_obj; // Emiliano |
return &soft_obj; // Emiliano |
1228 |
|
|
1229 |
|
if (!objname.CompareTo("ProcInfo")){ |
1230 |
|
if (!proc_obj) |
1231 |
|
proc_obj = new ProcInfo(); |
1232 |
|
return &proc_obj; // Emiliano |
1233 |
|
} |
1234 |
|
|
1235 |
return NULL; |
return NULL; |
1236 |
} |
} |
1237 |
; |
; |
1249 |
return 0; |
return 0; |
1250 |
|
|
1251 |
if (calo2_obj->CaloLevel2::ntrk() == 0) { |
if (calo2_obj->CaloLevel2::ntrk() == 0) { |
1252 |
cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo " << seqno |
if( seqno >=0 ){ |
1253 |
<< " but no Calorimeter tracks are stored" << endl; |
cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo " << seqno; |
1254 |
return NULL; |
cout << " but no Calorimeter tracks are stored" << endl; |
1255 |
|
} |
1256 |
|
return NULL; |
1257 |
}; |
}; |
1258 |
|
|
1259 |
CaloTrkVar *c = 0; |
CaloTrkVar *c = 0; |
1266 |
|
|
1267 |
if (!c || seqno != c->trkseqno) { |
if (!c || seqno != c->trkseqno) { |
1268 |
c = 0; |
c = 0; |
1269 |
if (seqno != -1) |
if (seqno != -1 && seqno>=0) |
1270 |
cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo " << seqno |
cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo " << seqno |
1271 |
<< " does not match Calorimeter stored tracks" << endl; |
<< " does not match Calorimeter stored tracks" << endl; |
1272 |
}; |
}; |
1284 |
*/ |
*/ |
1285 |
ToFTrkVar *PamLevel2::GetToFStoredTrack(int seqno) { |
ToFTrkVar *PamLevel2::GetToFStoredTrack(int seqno) { |
1286 |
|
|
1287 |
if (!tof_obj) |
if (!tof2_obj) |
1288 |
return 0; |
return 0; |
1289 |
|
|
1290 |
if (tof_obj->ToFLevel2::ntrk() == 0) { |
if (tof2_obj->ToFLevel2::ntrk() == 0) { |
1291 |
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" |
1292 |
<< endl; |
<< endl; |
1293 |
return NULL; |
return NULL; |
1297 |
Int_t it_tof = 0; |
Int_t it_tof = 0; |
1298 |
|
|
1299 |
do { |
do { |
1300 |
c = tof_obj->ToFLevel2::GetToFTrkVar(it_tof); |
c = tof2_obj->ToFLevel2::GetToFTrkVar(it_tof); |
1301 |
it_tof++; |
it_tof++; |
1302 |
} while (c && seqno != c->trkseqno && it_tof < tof_obj->ToFLevel2::ntrk()); |
} while (c && seqno != c->trkseqno && it_tof < tof2_obj->ToFLevel2::ntrk()); |
1303 |
|
|
1304 |
if (!c || seqno != c->trkseqno) { |
if (!c || seqno != c->trkseqno) { |
1305 |
c = 0; |
c = 0; |
1322 |
*/ |
*/ |
1323 |
OrbitalInfoTrkVar *PamLevel2::GetOrbitalInfoStoredTrack(int seqno) { |
OrbitalInfoTrkVar *PamLevel2::GetOrbitalInfoStoredTrack(int seqno) { |
1324 |
|
|
1325 |
if (!orb_obj) |
if (!orb2_obj) |
1326 |
return 0; |
return 0; |
1327 |
|
|
1328 |
if (orb_obj->OrbitalInfo::ntrk() == 0) { |
if (orb2_obj->OrbitalInfo::ntrk() == 0) { |
1329 |
// // TRICK BEGIN |
// // TRICK BEGIN |
1330 |
// OrbitalInfoTrkVar *r = new OrbitalInfoTrkVar(); // TEMPORARY TRICK |
// OrbitalInfoTrkVar *r = new OrbitalInfoTrkVar(); // TEMPORARY TRICK |
1331 |
// Int_t nn = 0; |
// Int_t nn = 0; |
1332 |
// TClonesArray &tor = *orb_obj->OrbitalInfoTrk; |
// TClonesArray &tor = *orb2_obj->OrbitalInfoTrk; |
1333 |
// for(Int_t nt=0; nt < tof_obj->ToFLevel2::ntrk(); nt++){ |
// for(Int_t nt=0; nt < tof2_obj->ToFLevel2::ntrk(); nt++){ |
1334 |
// // |
// // |
1335 |
// ToFTrkVar *ptt = tof_obj->ToFLevel2::GetToFTrkVar(nt); |
// ToFTrkVar *ptt = tof2_obj->ToFLevel2::GetToFTrkVar(nt); |
1336 |
// if ( ptt->trkseqno != -1 ){ |
// if ( ptt->trkseqno != -1 ){ |
1337 |
// // |
// // |
1338 |
// r->trkseqno = ptt->trkseqno; |
// r->trkseqno = ptt->trkseqno; |
1354 |
// }; |
// }; |
1355 |
// delete r; |
// delete r; |
1356 |
// OrbitalInfoTrkVar *c = 0; |
// OrbitalInfoTrkVar *c = 0; |
1357 |
// c = orb_obj->OrbitalInfo::GetOrbitalInfoTrkVar(0); |
// c = orb2_obj->OrbitalInfo::GetOrbitalInfoTrkVar(0); |
1358 |
// return c; |
// return c; |
1359 |
// //TRICK END |
// //TRICK END |
1360 |
cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo " << seqno |
cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo " << seqno |
1366 |
Int_t it_tof = 0; |
Int_t it_tof = 0; |
1367 |
|
|
1368 |
do { |
do { |
1369 |
c = orb_obj->OrbitalInfo::GetOrbitalInfoTrkVar(it_tof); |
c = orb2_obj->OrbitalInfo::GetOrbitalInfoTrkVar(it_tof); |
1370 |
it_tof++; |
it_tof++; |
1371 |
} while (c && seqno != c->trkseqno && it_tof < orb_obj->OrbitalInfo::ntrk()); |
} while (c && seqno != c->trkseqno && it_tof < orb2_obj->OrbitalInfo::ntrk()); |
1372 |
|
|
1373 |
if (!c || seqno != c->trkseqno) { |
if (!c || seqno != c->trkseqno) { |
1374 |
c = 0; |
c = 0; |
1385 |
// |
// |
1386 |
// |
// |
1387 |
//-------------------------------------- |
//-------------------------------------- |
1388 |
/** |
// /** |
1389 |
* Give the pamela track associated to a tracker track, retrieving related calorimeter, orbitalinfo and tof track information. |
// * Give the pamela track associated to a tracker track, retrieving related calorimeter, orbitalinfo and tof track information. |
1390 |
*/ |
// */ |
1391 |
PamTrack* PamLevel2::GetPamTrackAlong(TrkTrack* t) { |
// PamTrack* PamLevel2::GetPamTrackAlong(TrkTrack* t) { |
1392 |
|
|
1393 |
cout << "PamLevel2::GetPamTrackAlong(TrkTrack* t) **obsolete** " << endl; |
// cout << "PamLevel2::GetPamTrackAlong(TrkTrack* t) **obsolete** " << endl; |
1394 |
cout << "(if you use it, remember to delete the PamTrack object)" << endl; |
// cout << "(if you use it, remember to delete the PamTrack object)" << endl; |
1395 |
|
|
1396 |
CaloTrkVar *c = 0; |
// CaloTrkVar *c = 0; |
1397 |
ToFTrkVar *o = 0; |
// ToFTrkVar *o = 0; |
1398 |
OrbitalInfoTrkVar *r = 0; |
// OrbitalInfoTrkVar *r = 0; |
1399 |
|
|
1400 |
if (CAL2) |
// if (CAL2) |
1401 |
c = GetCaloStoredTrack(t->GetSeqNo()); |
// c = GetCaloStoredTrack(t->GetSeqNo()); |
1402 |
if (TOF) |
// if (TOF) |
1403 |
o = GetToFStoredTrack(t->GetSeqNo()); |
// o = GetToFStoredTrack(t->GetSeqNo()); |
1404 |
if (ORB) |
// if (ORB) |
1405 |
r = GetOrbitalInfoStoredTrack(t->GetSeqNo()); |
// r = GetOrbitalInfoStoredTrack(t->GetSeqNo()); |
1406 |
|
|
1407 |
// if(t && c && o)track = new PamTrack(t,c,o); |
// // if(t && c && o)track = new PamTrack(t,c,o); |
1408 |
PamTrack *track = new PamTrack(t, c, o, r); |
// PamTrack *track = new PamTrack(t, c, o, r); |
1409 |
|
|
1410 |
return track; |
// return track; |
1411 |
|
|
1412 |
} |
// } |
1413 |
; |
// ; |
1414 |
//-------------------------------------- |
//-------------------------------------- |
1415 |
// |
// |
1416 |
// |
// |
1417 |
//-------------------------------------- |
//-------------------------------------- |
1418 |
/** |
// /** |
1419 |
* Retrieves the it-th stored track. |
// * Retrieves the it-th stored track. |
1420 |
* It override TrkLevel2::GetTrack(int it). |
// * It override TrkLevel2::GetTrack(int it). |
1421 |
* @param itrk Track number, ranging from 0 to GetNTracks(). |
// * @param itrk Track number, ranging from 0 to GetNTracks(). |
1422 |
*/ |
// */ |
1423 |
|
|
1424 |
PamTrack* PamLevel2::GetStoredTrack(Int_t itrk) { |
// PamTrack* PamLevel2::GetStoredTrack(Int_t itrk) { |
1425 |
|
|
1426 |
cout << "PamLevel2::GetStoredTrack(Int_t itrk) **to-be-updated** " << endl; |
// cout << "PamLevel2::GetStoredTrack(Int_t itrk) **to-be-updated** " << endl; |
1427 |
cout |
// cout |
1428 |
<< "for the moment, better use separately the methods: TrkLevel2::GetStoredTrack(seqno) CaloLevel2::GetCaloTrkVar(Int_t notrack) ToFLevel2::GetToFTrkVar(Int_t notrack) OrbitalInfo::GetOrbitalInfoTrkVar(Int_t notrack)" |
// << "for the moment, better use separately the methods: TrkLevel2::GetStoredTrack(seqno) CaloLevel2::GetCaloTrkVar(Int_t notrack) ToFLevel2::GetToFTrkVar(Int_t notrack) OrbitalInfo::GetOrbitalInfoTrkVar(Int_t notrack)" |
1429 |
<< endl; |
// << endl; |
1430 |
cout << "(if you use it, remember to delete the PamTrack object)" << endl; |
// cout << "(if you use it, remember to delete the PamTrack object)" << endl; |
1431 |
PamTrack *track = 0; |
// PamTrack *track = 0; |
1432 |
|
|
1433 |
if (itrk >= 0 && itrk < trk2_obj->TrkLevel2::ntrk()) { |
// if (itrk >= 0 && itrk < trk2_obj->TrkLevel2::ntrk()) { |
1434 |
|
|
1435 |
TrkTrack *t = trk2_obj->TrkLevel2::GetStoredTrack(itrk); |
// TrkTrack *t = trk2_obj->TrkLevel2::GetStoredTrack(itrk); |
1436 |
track = GetPamTrackAlong(t); |
// track = GetPamTrackAlong(t); |
1437 |
|
|
1438 |
} |
// } |
1439 |
else { |
// else { |
1440 |
cout << "PamLevel2::GetStoredTrack(int) : tracker track SeqNo " << itrk << " does not exist (GetNTracks() = " |
// cout << "PamLevel2::GetStoredTrack(int) : tracker track SeqNo " << itrk << " does not exist (GetNTracks() = " |
1441 |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
// << trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
1442 |
}; |
// }; |
1443 |
|
|
1444 |
return track; |
// return track; |
1445 |
|
|
1446 |
} |
// } |
1447 |
//-------------------------------------- |
//-------------------------------------- |
1448 |
// |
// |
1449 |
|
|
1497 |
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
1498 |
|
|
1499 |
// create TCloneArrays to store tracks and its images |
// create TCloneArrays to store tracks and its images |
1500 |
if (!tsorted) |
// if (!tsorted) |
1501 |
tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
// tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
1502 |
tsorted->Delete(); |
// tsorted->Clear("C+C");//Delete(); |
1503 |
TClonesArray &ttsorted = *tsorted; |
// if (!timage) |
1504 |
|
// timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
1505 |
|
// timage->Clear("C+C");//Delete(); |
1506 |
|
|
1507 |
|
if(tsorted)delete tsorted; |
1508 |
|
if(timage) delete timage; |
1509 |
|
tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
1510 |
|
timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
1511 |
|
|
1512 |
if (!timage) |
|
1513 |
timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
TClonesArray &ttsorted = *tsorted; |
|
timage->Delete(); |
|
1514 |
TClonesArray &ttimage = *timage; |
TClonesArray &ttimage = *timage; |
1515 |
|
|
1516 |
|
|
1517 |
|
|
1518 |
//-------------------------------------------------- |
//-------------------------------------------------- |
1519 |
// retrieve sorting method |
// retrieve sorting method |
1520 |
//-------------------------------------------------- |
//-------------------------------------------------- |
1630 |
// ----------------------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------------------- |
1631 |
// check the number of hit pmts along the track |
// check the number of hit pmts along the track |
1632 |
// on S12 S21 and S32, where paddles are parallel to Y axis |
// on S12 S21 and S32, where paddles are parallel to Y axis |
1633 |
if ((use_TOF || use_S1 || use_S2 || use_S3) && !tof_obj) { |
if ((use_TOF || use_S1 || use_S2 || use_S3) && !tof2_obj) { |
1634 |
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but ToFLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but ToFLevel2 not loaded !!!"; |
1635 |
return; |
return; |
1636 |
}; |
}; |
1647 |
// |
// |
1648 |
Float_t sen = 0.; |
Float_t sen = 0.; |
1649 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1650 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1651 |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
1652 |
sen += (op->dedx).At(ih); |
sen += (op->dedx).At(ih); |
1653 |
}; |
}; |
1654 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1655 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1656 |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
1657 |
sen += (oi->dedx).At(ih); |
sen += (oi->dedx).At(ih); |
1658 |
}; |
}; |
1665 |
Int_t nz = 6; |
Int_t nz = 6; |
1666 |
Float_t zin[6]; // << define TOF z-coordinates |
Float_t zin[6]; // << define TOF z-coordinates |
1667 |
for (Int_t ip = 0; ip < nz; ip++) |
for (Int_t ip = 0; ip < nz; ip++) |
1668 |
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 |
1669 |
Trajectory *tr = new Trajectory(nz, zin); |
Trajectory *tr = new Trajectory(nz, zin); |
1670 |
// |
// |
1671 |
Int_t nphit_p = 0; |
Int_t nphit_p = 0; |
1674 |
Float_t enhit_i = 0.; |
Float_t enhit_i = 0.; |
1675 |
// |
// |
1676 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1677 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1678 |
if (pl == 1 || pl == 2 || pl == 5) { |
if (pl == 1 || pl == 2 || pl == 5) { |
1679 |
nphit_p++; |
nphit_p++; |
1680 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1685 |
// |
// |
1686 |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
1687 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1688 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1689 |
if (pl == 0) { |
if (pl == 0) { |
1690 |
nphit_p++; |
nphit_p++; |
1691 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1694 |
}; |
}; |
1695 |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
1696 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1697 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1698 |
if (pl == 3) { |
if (pl == 3) { |
1699 |
nphit_p++; |
nphit_p++; |
1700 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1703 |
}; |
}; |
1704 |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
1705 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1706 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1707 |
if (pl == 4) { |
if (pl == 4) { |
1708 |
nphit_p++; |
nphit_p++; |
1709 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1712 |
}; |
}; |
1713 |
|
|
1714 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1715 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1716 |
if (pl == 1 || pl == 2 || pl == 5) { |
if (pl == 1 || pl == 2 || pl == 5) { |
1717 |
nphit_i++; |
nphit_i++; |
1718 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1723 |
// |
// |
1724 |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
1725 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1726 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1727 |
if (pl == 0) { |
if (pl == 0) { |
1728 |
nphit_i++; |
nphit_i++; |
1729 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1732 |
}; |
}; |
1733 |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
1734 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1735 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1736 |
if (pl == 3) { |
if (pl == 3) { |
1737 |
nphit_i++; |
nphit_i++; |
1738 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1741 |
}; |
}; |
1742 |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
1743 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1744 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1745 |
if (pl == 4) { |
if (pl == 4) { |
1746 |
nphit_i++; |
nphit_i++; |
1747 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1785 |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
1786 |
|
|
1787 |
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
1788 |
// Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
// Int_t pl = tof2_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
1789 |
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
1790 |
// }; |
// }; |
1791 |
|
|
1792 |
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
1793 |
// Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
// Int_t pl = tof2_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
1794 |
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
1795 |
// }; |
// }; |
1796 |
// --- modified to count tdc signals (more efficient?) |
// --- modified to count tdc signals (more efficient?) |
1797 |
// --- and to implement check on tdcflag |
// --- and to implement check on tdcflag |
1798 |
for (Int_t ih = 0; ih < op->npmttdc; ih++) { |
for (Int_t ih = 0; ih < op->npmttdc; ih++) { |
1799 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmttdc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmttdc).At(ih)); |
1800 |
// 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++; |
1801 |
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)) |
1802 |
|| (use_S3 && (pl == 4 || pl == 5))) { |
|| (use_S3 && (pl == 4 || pl == 5))) { |
1806 |
}; |
}; |
1807 |
|
|
1808 |
for (Int_t ih = 0; ih < oi->npmttdc; ih++) { |
for (Int_t ih = 0; ih < oi->npmttdc; ih++) { |
1809 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmttdc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmttdc).At(ih)); |
1810 |
// 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++; |
1811 |
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)) |
1812 |
|| (use_S3 && (pl == 4 || pl == 5))) { |
|| (use_S3 && (pl == 4 || pl == 5))) { |
1981 |
|
|
1982 |
} |
} |
1983 |
; |
; |
1984 |
|
// |
1985 |
|
//-------------------------------------- |
1986 |
|
/** |
1987 |
|
* Sort physical (tracker) tracks. |
1988 |
|
* @param how String to set the sorting cryterium (es: "CAL" or "TRK+CAL+TOF" ecc...). |
1989 |
|
* Sorting cryteria: |
1990 |
|
* TRK: lower chi**2 |
1991 |
|
* CAL: lower Y spatial residual on the first calorimeter plane |
1992 |
|
* TOF: bigger numebr of hit PMTs along the track, on S12 S21 S32 (where paddles are along the Y axis). |
1993 |
|
* S1: (ask Emiliano) |
1994 |
|
* S2: (ask Emiliano) |
1995 |
|
* S3: (ask Emiliano) |
1996 |
|
* GP: more GP hits |
1997 |
|
* The default sorting cryterium is "TOF+CAL". |
1998 |
|
* |
1999 |
|
* 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). |
2000 |
|
* |
2001 |
|
* New version, with handling of extended tracks and nuclei tracks. |
2002 |
|
*/ |
2003 |
|
void PamLevel2::SortTracksNew() { |
2004 |
|
|
2005 |
|
//-------------------------------------------------- |
2006 |
|
//Check if the current event has already been sorted |
2007 |
|
//-------------------------------------------------- |
2008 |
|
if (issorted_new && lastsorted_new == GetReadEntry()) { |
2009 |
|
return; //already done for this event |
2010 |
|
} |
2011 |
|
|
2012 |
|
|
2013 |
|
// cout << "SORT" << endl; |
2014 |
|
|
2015 |
|
//Reset the sort flags, just in case something will go wrong... |
2016 |
|
issorted_new = false; |
2017 |
|
lastsorted_new = -1; |
2018 |
|
|
2019 |
|
//-------------------------------------------------- |
2020 |
|
// set input variables |
2021 |
|
//-------------------------------------------------- |
2022 |
|
|
2023 |
|
TString how = howtosort; |
2024 |
|
//Save current Object count |
2025 |
|
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
2026 |
|
|
2027 |
|
|
2028 |
|
|
2029 |
|
|
2030 |
|
TrkLevel2 * trk2 ; |
2031 |
|
CaloLevel2 * calo2; |
2032 |
|
ToFLevel2 * tof2 ; |
2033 |
|
OrbitalInfo * orb2 ; |
2034 |
|
|
2035 |
|
TClonesArray * trkext ; |
2036 |
|
TClonesArray * caloext; |
2037 |
|
TClonesArray * tofext ; |
2038 |
|
TClonesArray * orbext ; |
2039 |
|
|
2040 |
|
|
2041 |
|
// cout << "trk2_obj" << trk2_obj<< endl; |
2042 |
|
// cout << "trk2_nuc_obj" << trk2_nuc_obj<< endl; |
2043 |
|
// cout << " trk_ext_obj "<<trk_ext_obj<< endl; |
2044 |
|
// cout << " trk_ext_nuc_obj "<<trk_ext_nuc_obj<< endl; |
2045 |
|
|
2046 |
|
//----------------------------------------------------------- |
2047 |
|
// create/reset TCloneArrays to store tracks and their images |
2048 |
|
//----------------------------------------------------------- |
2049 |
|
|
2050 |
|
// cout << " PamLevel2::SortTracksNew() --- Clear TClonesArray objects"<<endl; |
2051 |
|
|
2052 |
|
// main tracks from standard alg |
2053 |
|
// if (!tsorted) |
2054 |
|
// tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2055 |
|
// tsorted->Clear("C+C");//Delete(); |
2056 |
|
// // track images from standard alg |
2057 |
|
// if (!timage) |
2058 |
|
// timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2059 |
|
// timage->Clear("C+C");//Delete(); |
2060 |
|
// // tracks from extended algorythm |
2061 |
|
// if(EXT && !text) |
2062 |
|
// text = new TClonesArray("PamTrack",trk_ext_obj->GetEntries()); |
2063 |
|
// if(text)text->Clear("C+C");//Delete(); |
2064 |
|
|
2065 |
|
if(tsorted)delete tsorted; |
2066 |
|
if(timage) delete timage; |
2067 |
|
if(text) delete text; |
2068 |
|
tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2069 |
|
timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2070 |
|
text = new TClonesArray("PamTrack",trk_ext_obj->GetEntries()); |
2071 |
|
|
2072 |
|
//----------------------------------------------------------- |
2073 |
|
// create/reset TCloneArrays to store tracks and their images |
2074 |
|
//----------------------------------------------------------- |
2075 |
|
if(NUC){ |
2076 |
|
|
2077 |
|
|
2078 |
|
if(tsorted_nuc)delete tsorted_nuc; |
2079 |
|
if(timage_nuc) delete timage_nuc; |
2080 |
|
if(text_nuc) delete text_nuc; |
2081 |
|
tsorted_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2082 |
|
timage_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2083 |
|
text_nuc = new TClonesArray("PamTrack",trk_ext_nuc_obj->GetEntries()); |
2084 |
|
|
2085 |
|
// main tracks from standard alg |
2086 |
|
// if (!tsorted_nuc) |
2087 |
|
// tsorted_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2088 |
|
// tsorted_nuc->Clear("C+C");//Delete(); |
2089 |
|
// // track images from standard alg |
2090 |
|
// if (!timage_nuc) |
2091 |
|
// timage_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2092 |
|
// timage_nuc->Clear("C+C");//Delete(); |
2093 |
|
// // tracks from extended algorythm |
2094 |
|
// if(EXT && !text_nuc) |
2095 |
|
// text_nuc = new TClonesArray("PamTrack",trk_ext_nuc_obj->GetEntries()); |
2096 |
|
// if(text_nuc)text_nuc->Clear("C+C");//Delete(); |
2097 |
|
|
2098 |
|
} |
2099 |
|
//-------------------------------------------------- |
2100 |
|
// retrieve sorting method |
2101 |
|
//-------------------------------------------------- |
2102 |
|
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
2103 |
|
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
2104 |
|
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
2105 |
|
Bool_t use_S1 = how.Contains("S1", TString::kIgnoreCase); |
2106 |
|
Bool_t use_S2 = how.Contains("S2", TString::kIgnoreCase); |
2107 |
|
Bool_t use_S3 = how.Contains("S3", TString::kIgnoreCase); |
2108 |
|
Bool_t use_GP = how.Contains("GP", TString::kIgnoreCase); |
2109 |
|
|
2110 |
|
if (use_TOF) { |
2111 |
|
use_S1 = true; |
2112 |
|
use_S2 = true; |
2113 |
|
use_S3 = true; |
2114 |
|
}; |
2115 |
|
if (!CAL2 && use_CAL) |
2116 |
|
use_CAL = false; |
2117 |
|
if (!TOF) { |
2118 |
|
use_TOF = false; |
2119 |
|
use_S1 = false; |
2120 |
|
use_S2 = false; |
2121 |
|
use_S3 = false; |
2122 |
|
} |
2123 |
|
if (!GP) { |
2124 |
|
use_GP = false; |
2125 |
|
} |
2126 |
|
|
2127 |
|
if (!TRK2) { |
2128 |
|
cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
2129 |
|
return; |
2130 |
|
}; |
2131 |
|
|
2132 |
|
|
2133 |
|
/////////////////////////////////////////////////////////////////////////////////// |
2134 |
|
// |
2135 |
|
// sort tracks and fill PamTrack arrays |
2136 |
|
// |
2137 |
|
/////////////////////////////////////////////////////////////////////////////////// |
2138 |
|
for(int doit=0; doit<2; doit++){ |
2139 |
|
|
2140 |
|
// cout << "doit "<<doit<<endl; |
2141 |
|
|
2142 |
|
|
2143 |
|
if(doit == 0){ |
2144 |
|
|
2145 |
|
trk2 = trk2_obj; |
2146 |
|
calo2 = calo2_obj; |
2147 |
|
tof2 = tof2_obj; |
2148 |
|
orb2 = orb2_obj; |
2149 |
|
|
2150 |
|
trkext = trk_ext_obj; |
2151 |
|
caloext = calo_ext_obj; |
2152 |
|
tofext = tof_ext_obj; |
2153 |
|
orbext = orb_ext_obj; |
2154 |
|
|
2155 |
|
|
2156 |
|
|
2157 |
|
|
2158 |
|
|
2159 |
|
}else if (doit == 1){ |
2160 |
|
|
2161 |
|
if(!NUC)break; |
2162 |
|
|
2163 |
|
|
2164 |
|
trk2 = trk2_nuc_obj; |
2165 |
|
calo2 = calo2_nuc_obj; |
2166 |
|
tof2 = tof2_nuc_obj; |
2167 |
|
orb2 = orb2_nuc_obj; |
2168 |
|
|
2169 |
|
trkext = trk_ext_nuc_obj; |
2170 |
|
caloext = calo_ext_nuc_obj; |
2171 |
|
tofext = tof_ext_nuc_obj; |
2172 |
|
orbext = orb_ext_nuc_obj; |
2173 |
|
|
2174 |
|
|
2175 |
|
|
2176 |
|
|
2177 |
|
} |
2178 |
|
|
2179 |
|
// cout << "trk2" << trk2<<endl; |
2180 |
|
// cout << "calo2" << calo2<<endl; |
2181 |
|
// cout << "tof2" << tof2<<endl; |
2182 |
|
// cout << "orb2" << orb2<<endl; |
2183 |
|
// cout << "trkext" <<trkext <<endl; |
2184 |
|
// cout << "tofext" << tofext<<endl; |
2185 |
|
// cout << "caloext" << caloext<<endl; |
2186 |
|
// cout << "orbext" << orbext<<endl; |
2187 |
|
|
2188 |
|
TClonesArray &ttext = (doit==0 ? *text : *text_nuc); |
2189 |
|
TClonesArray &ttimage = (doit==0 ? *timage : *timage_nuc); |
2190 |
|
TClonesArray &ttsorted = (doit==0 ? *tsorted : *tsorted_nuc); |
2191 |
|
|
2192 |
|
// cout << "tsorted + timage "<<doit<<endl; |
2193 |
|
|
2194 |
|
//-------------------------------------------------- |
2195 |
|
// loop over "physical" tracks sorted by the tracker |
2196 |
|
//-------------------------------------------------- |
2197 |
|
for (Int_t i = 0; i < trk2->TrkLevel2::GetNTracks(); i++) { |
2198 |
|
|
2199 |
|
TrkTrack *ts = 0; |
2200 |
|
CaloTrkVar *cs = 0; |
2201 |
|
ToFTrkVar *os = 0; |
2202 |
|
OrbitalInfoTrkVar *rs = 0; |
2203 |
|
|
2204 |
|
// get tracker tracks |
2205 |
|
TrkTrack *tp = trk2->GetTrack(i); //tracker |
2206 |
|
CaloTrkVar *cp = calo2->GetCaloStoredTrack(tp->GetSeqNo()); |
2207 |
|
ToFTrkVar *op = tof2->GetToFStoredTrack(tp->GetSeqNo()); |
2208 |
|
OrbitalInfoTrkVar *rp = orb2->GetOrbitalInfoStoredTrack(tp->GetSeqNo()); |
2209 |
|
|
2210 |
|
TrkTrack *ti = 0; //tracker (image) |
2211 |
|
CaloTrkVar *ci = 0; |
2212 |
|
ToFTrkVar *oi = 0; |
2213 |
|
OrbitalInfoTrkVar *ri = 0; |
2214 |
|
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
2215 |
|
// if track has an image, check image selection |
2216 |
|
|
2217 |
|
Int_t tp_score = 0; //main track sorted by the tracker |
2218 |
|
Int_t ti_score = 0; //image track |
2219 |
|
Int_t totp_score = 0; //main track sorted by the tracker |
2220 |
|
Int_t toti_score = 0; //image track |
2221 |
|
|
2222 |
|
if (tp->HasImage()) { |
2223 |
|
|
2224 |
|
ti = trk2->GetTrackImage(i); //tracker (image) |
2225 |
|
ci = calo2->GetCaloStoredTrack(ti->GetSeqNo()); |
2226 |
|
oi = tof2->GetToFStoredTrack(ti->GetSeqNo()); |
2227 |
|
ri = orb2->GetOrbitalInfoStoredTrack(ti->GetSeqNo()); |
2228 |
|
|
2229 |
|
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
2230 |
|
|
2231 |
|
//assign starting scores |
2232 |
|
tp_score = 0; //main track sorted by the tracker |
2233 |
|
ti_score = 0; //image track |
2234 |
|
|
2235 |
|
// ----------------------------------------------------------------------------------------- |
2236 |
|
// ***************************************************************************************** |
2237 |
|
// ----------------------------------------------------------------------------------------- |
2238 |
|
// calorimeter check |
2239 |
|
// ----------------------------------------------------------------------------------------- |
2240 |
|
if (use_CAL && !calo2) { |
2241 |
|
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but CaloLevel2 not loaded !!!"; |
2242 |
|
return; |
2243 |
|
}; |
2244 |
|
if (use_CAL && !cp && ci) { |
2245 |
|
ti_score++; |
2246 |
|
toti_score++; |
2247 |
|
}; |
2248 |
|
if (use_CAL && cp && !ci) { |
2249 |
|
tp_score++; |
2250 |
|
totp_score++; |
2251 |
|
}; |
2252 |
|
if (use_CAL && cp && ci && true) { |
2253 |
|
|
2254 |
|
if (cp->npresh > ci->npresh && true) { |
2255 |
|
tp_score++; |
2256 |
|
totp_score++; |
2257 |
|
}; |
2258 |
|
if (cp->npresh < ci->npresh && true) { |
2259 |
|
ti_score++; |
2260 |
|
toti_score++; |
2261 |
|
}; |
2262 |
|
|
2263 |
|
// cout << "CALO "<<tp_score<<ti_score<<endl; |
2264 |
|
|
2265 |
|
}; |
2266 |
|
// ----------------------------------------------------------------------------------------- |
2267 |
|
// ***************************************************************************************** |
2268 |
|
// ----------------------------------------------------------------------------------------- |
2269 |
|
// TOF check |
2270 |
|
// ----------------------------------------------------------------------------------------- |
2271 |
|
// check the number of hit pmts along the track |
2272 |
|
// on S12 S21 and S32, where paddles are parallel to Y axis |
2273 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && !tof2) { |
2274 |
|
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but ToFLevel2 not loaded !!!"; |
2275 |
|
return; |
2276 |
|
}; |
2277 |
|
// |
2278 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && !op && oi) { |
2279 |
|
ti_score++; |
2280 |
|
toti_score++; |
2281 |
|
}; |
2282 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && op && !oi) { |
2283 |
|
tp_score++; |
2284 |
|
totp_score++; |
2285 |
|
}; |
2286 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && op && oi) { |
2287 |
|
// |
2288 |
|
Float_t sen = 0.; |
2289 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2290 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2291 |
|
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
2292 |
|
sen += (op->dedx).At(ih); |
2293 |
|
}; |
2294 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2295 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2296 |
|
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
2297 |
|
sen += (oi->dedx).At(ih); |
2298 |
|
}; |
2299 |
|
// |
2300 |
|
if (sen >= sortthr && false) { // temporary disabled NUCLEI special algorithm since the new one should work for every particle (to be checked!) |
2301 |
|
//printf(" IS A NUCLEUS! en = %f \n",sen); |
2302 |
|
// |
2303 |
|
// is a nucleus use a different algorithm |
2304 |
|
// |
2305 |
|
Int_t nz = 6; |
2306 |
|
Float_t zin[6]; // << define TOF z-coordinates |
2307 |
|
for (Int_t ip = 0; ip < nz; ip++) |
2308 |
|
zin[ip] = tof2->GetZTOF(tof2->GetToFPlaneID(ip)); // << read ToF plane z-coordinates |
2309 |
|
Trajectory *tr = new Trajectory(nz, zin); |
2310 |
|
// |
2311 |
|
Int_t nphit_p = 0; |
2312 |
|
Int_t nphit_i = 0; |
2313 |
|
Float_t enhit_p = 0.; |
2314 |
|
Float_t enhit_i = 0.; |
2315 |
|
// |
2316 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2317 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2318 |
|
if (pl == 1 || pl == 2 || pl == 5) { |
2319 |
|
nphit_p++; |
2320 |
|
enhit_p += (op->dedx).At(ih); |
2321 |
|
}; |
2322 |
|
}; |
2323 |
|
// |
2324 |
|
tp->DoTrack2(tr); |
2325 |
|
// |
2326 |
|
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
2327 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2328 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2329 |
|
if (pl == 0) { |
2330 |
|
nphit_p++; |
2331 |
|
enhit_p += (op->dedx).At(ih); |
2332 |
|
}; |
2333 |
|
}; |
2334 |
|
}; |
2335 |
|
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
2336 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2337 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2338 |
|
if (pl == 3) { |
2339 |
|
nphit_p++; |
2340 |
|
enhit_p += (op->dedx).At(ih); |
2341 |
|
}; |
2342 |
|
}; |
2343 |
|
}; |
2344 |
|
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
2345 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2346 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2347 |
|
if (pl == 4) { |
2348 |
|
nphit_p++; |
2349 |
|
enhit_p += (op->dedx).At(ih); |
2350 |
|
}; |
2351 |
|
}; |
2352 |
|
}; |
2353 |
|
|
2354 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2355 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2356 |
|
if (pl == 1 || pl == 2 || pl == 5) { |
2357 |
|
nphit_i++; |
2358 |
|
enhit_i += (op->dedx).At(ih); |
2359 |
|
}; |
2360 |
|
}; |
2361 |
|
// |
2362 |
|
ti->DoTrack2(tr); |
2363 |
|
// |
2364 |
|
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
2365 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2366 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2367 |
|
if (pl == 0) { |
2368 |
|
nphit_i++; |
2369 |
|
enhit_i += (op->dedx).At(ih); |
2370 |
|
}; |
2371 |
|
}; |
2372 |
|
}; |
2373 |
|
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
2374 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2375 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2376 |
|
if (pl == 3) { |
2377 |
|
nphit_i++; |
2378 |
|
enhit_i += (op->dedx).At(ih); |
2379 |
|
}; |
2380 |
|
}; |
2381 |
|
}; |
2382 |
|
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
2383 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2384 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2385 |
|
if (pl == 4) { |
2386 |
|
nphit_i++; |
2387 |
|
enhit_i += (op->dedx).At(ih); |
2388 |
|
}; |
2389 |
|
}; |
2390 |
|
}; |
2391 |
|
|
2392 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && (nphit_p + nphit_i) != 0 && true) { |
2393 |
|
|
2394 |
|
// 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); |
2395 |
|
// printf(" score p %i score i %i \n",tp_score,ti_score); |
2396 |
|
// if( enhit_p > enhit_i ) tp_score++; |
2397 |
|
// if( nphit_p >= nphit_i && enhit_p > enhit_i ) tp_score++; |
2398 |
|
if (nphit_p > nphit_i) |
2399 |
|
tp_score++; |
2400 |
|
if (nphit_p < nphit_i) |
2401 |
|
ti_score++; |
2402 |
|
if (nphit_p == nphit_i) { |
2403 |
|
if (enhit_p > enhit_i) |
2404 |
|
tp_score++; |
2405 |
|
else |
2406 |
|
ti_score++; |
2407 |
|
}; |
2408 |
|
// printf(" dopo score p %i score i %i \n",tp_score,ti_score); |
2409 |
|
}; |
2410 |
|
delete tr; |
2411 |
|
// |
2412 |
|
} |
2413 |
|
else { |
2414 |
|
// ------------- |
2415 |
|
// NOT a NUCLEUS |
2416 |
|
// ------------- |
2417 |
|
//printf(" NOT a NUCLEUS! en = %f \n",sen); |
2418 |
|
|
2419 |
|
Int_t nphit_p = 0; |
2420 |
|
Int_t nphit_i = 0; |
2421 |
|
|
2422 |
|
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
2423 |
|
cout << "track: npmttdc "<< op->npmttdc << endl; |
2424 |
|
cout << "image: npmtadc "<< oi->npmtadc << endl; |
2425 |
|
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
2426 |
|
|
2427 |
|
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
2428 |
|
// Int_t pl = tof2_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
2429 |
|
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
2430 |
|
// }; |
2431 |
|
|
2432 |
|
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
2433 |
|
// Int_t pl = tof2_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
2434 |
|
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
2435 |
|
// }; |
2436 |
|
// --- modified to count tdc signals (more efficient?) |
2437 |
|
// --- and to implement check on tdcflag |
2438 |
|
for (Int_t ih = 0; ih < op->npmttdc; ih++) { |
2439 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmttdc).At(ih)); |
2440 |
|
// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; |
2441 |
|
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
2442 |
|
|| (use_S3 && (pl == 4 || pl == 5))) { |
2443 |
|
if ((op->tdcflag).At(ih) == 0) |
2444 |
|
nphit_p++; |
2445 |
|
}; |
2446 |
|
}; |
2447 |
|
|
2448 |
|
for (Int_t ih = 0; ih < oi->npmttdc; ih++) { |
2449 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmttdc).At(ih)); |
2450 |
|
// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; |
2451 |
|
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
2452 |
|
|| (use_S3 && (pl == 4 || pl == 5))) { |
2453 |
|
if ((oi->tdcflag).At(ih) == 0) |
2454 |
|
nphit_i++; |
2455 |
|
}; |
2456 |
|
}; |
2457 |
|
|
2458 |
|
if ((nphit_p + nphit_i) != 0 && true) { |
2459 |
|
|
2460 |
|
if (nphit_p != nphit_i) { |
2461 |
|
totp_score += nphit_p; |
2462 |
|
toti_score += nphit_i; |
2463 |
|
tp_score += nphit_p; |
2464 |
|
ti_score += nphit_i; |
2465 |
|
}; |
2466 |
|
// if ( nphit_p > nphit_i) tp_score+=nphit_p; |
2467 |
|
// else if( nphit_p < nphit_i) ti_score+=nphit_i; |
2468 |
|
// else ;//niente |
2469 |
|
}; |
2470 |
|
}; |
2471 |
|
// cout << "TOF "<<tp_score<<ti_score<<endl; |
2472 |
|
}; |
2473 |
|
|
2474 |
|
// if(tp_score == ti_score) use_TRK = true; |
2475 |
|
|
2476 |
|
|
2477 |
|
// ----------------------------------------------------------------------------------------- |
2478 |
|
// ***************************************************************************************** |
2479 |
|
// ----------------------------------------------------------------------------------------- |
2480 |
|
// tracker check |
2481 |
|
// ----------------------------------------------------------------------------------------- |
2482 |
|
// chi**2 difference is not always large enough to distinguish among |
2483 |
|
// the real track and its image. |
2484 |
|
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
2485 |
|
// *** MODIFIED ON AUGUST 2007 *** |
2486 |
|
if (use_TRK) { |
2487 |
|
// if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
2488 |
|
// else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
2489 |
|
|
2490 |
|
// CHECK 1 : number of points along X |
2491 |
|
if (tp->GetNX() >= ti->GetNX()) { |
2492 |
|
tp_score++; |
2493 |
|
totp_score++; |
2494 |
|
}; |
2495 |
|
if (tp->GetNX() <= ti->GetNX()) { |
2496 |
|
ti_score++; |
2497 |
|
toti_score++; |
2498 |
|
}; |
2499 |
|
// CHECK 2 : number of points along Y |
2500 |
|
if (tp->GetNY() >= ti->GetNY()) { |
2501 |
|
tp_score++; |
2502 |
|
totp_score++; |
2503 |
|
}; |
2504 |
|
if (tp->GetNY() <= ti->GetNY()) { |
2505 |
|
ti_score++; |
2506 |
|
toti_score++; |
2507 |
|
}; |
2508 |
|
|
2509 |
|
// cout << "TRK "<<tp_score<<ti_score<<endl; |
2510 |
|
}; |
2511 |
|
|
2512 |
|
// ----------------------------------------------------------------------------------------- |
2513 |
|
// ***************************************************************************************** |
2514 |
|
// ----------------------------------------------------------------------------------------- |
2515 |
|
// GPamela check |
2516 |
|
// ----------------------------------------------------------------------------------------- |
2517 |
|
|
2518 |
|
//--------------------------------------------------- |
2519 |
|
// count the number of GP hits |
2520 |
|
//--------------------------------------------------- |
2521 |
|
if (use_GP) { |
2522 |
|
int ngphits_p = 0; |
2523 |
|
int ngphits_i = 0; |
2524 |
|
float toll = 0.02; //200 micron |
2525 |
|
for (int ih = 0; ih < GetGPamela()->Nthspe; ih++) { |
2526 |
|
int ip = (Int_t) GetGPamela()->Itrpb[ih] - 1; |
2527 |
|
if (tp && tp->YGood(ip) && fabs(tp->ym[ip] - GetGPamela()->Yavspe[ih]) < toll && true) |
2528 |
|
ngphits_p++; |
2529 |
|
if (ti && ti->YGood(ip) && fabs(ti->ym[ip] - GetGPamela()->Yavspe[ih]) < toll && true) |
2530 |
|
ngphits_i++; |
2531 |
|
} |
2532 |
|
if (ngphits_p > ngphits_i && true) { |
2533 |
|
tp_score++; |
2534 |
|
totp_score++; |
2535 |
|
} |
2536 |
|
if (ngphits_p < ngphits_i && true) { |
2537 |
|
ti_score++; |
2538 |
|
toti_score++; |
2539 |
|
} |
2540 |
|
} |
2541 |
|
|
2542 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2543 |
|
// the winner is.... |
2544 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2545 |
|
if (tp_score > ti_score) { |
2546 |
|
|
2547 |
|
} |
2548 |
|
else if (tp_score < ti_score) { |
2549 |
|
|
2550 |
|
ts = ti;//its image!! |
2551 |
|
cs = ci; |
2552 |
|
os = oi; |
2553 |
|
rs = ri; |
2554 |
|
Int_t totis = toti_score; |
2555 |
|
|
2556 |
|
ti = tp;//its image!! |
2557 |
|
ci = cp; |
2558 |
|
oi = op; |
2559 |
|
ri = rp; |
2560 |
|
|
2561 |
|
tp = ts;//its image!! |
2562 |
|
cp = cs; |
2563 |
|
op = os; |
2564 |
|
rp = rs; |
2565 |
|
|
2566 |
|
toti_score = totp_score; |
2567 |
|
totp_score = totis; |
2568 |
|
|
2569 |
|
} |
2570 |
|
else { |
2571 |
|
|
2572 |
|
// cout << "Warning - track image ambiguity not solved" << endl; |
2573 |
|
|
2574 |
|
}; |
2575 |
|
|
2576 |
|
} |
2577 |
|
else { |
2578 |
|
totp_score = 1; |
2579 |
|
toti_score = 0; |
2580 |
|
|
2581 |
|
// ts = tp; |
2582 |
|
// cs = cp; |
2583 |
|
// os = op; |
2584 |
|
}; |
2585 |
|
|
2586 |
|
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
2587 |
|
// sorted_tracks->Add(ts);//save the track in the sorted array |
2588 |
|
// sorted_tracks.Add(ts);//save the track in the sorted array |
2589 |
|
// sorted_tracks.Add(tp);//save the track in the sorted array |
2590 |
|
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
2591 |
|
// cout<<"o "<<tp<<endl; |
2592 |
|
// cout<<"o "<<cp<<endl; |
2593 |
|
// cout<<"o "<<op<<endl; |
2594 |
|
|
2595 |
|
new (ttsorted[i]) PamTrack(tp, cp, op, rp); |
2596 |
|
new (ttimage[i]) PamTrack(ti, ci, oi, ri); |
2597 |
|
|
2598 |
|
((PamTrack*) (ttsorted[i]))->SetPScore(totp_score); |
2599 |
|
((PamTrack*) (ttsorted[i]))->SetIScore(toti_score); |
2600 |
|
((PamTrack*) (ttimage[i]))->SetPScore(totp_score); |
2601 |
|
((PamTrack*) (ttimage[i]))->SetIScore(toti_score); |
2602 |
|
}; |
2603 |
|
|
2604 |
|
|
2605 |
|
|
2606 |
|
|
2607 |
|
|
2608 |
|
// if (tsorted->GetEntries() != trk2->GetNTracks()) { |
2609 |
|
// cout << "void PamLevel2::SortTracks(): tsorted->GetEntries() " << tsorted->GetEntries() |
2610 |
|
// << " != trk2->GetNTracks() = " << trk2->GetNTracks() << endl; |
2611 |
|
// tsorted->Delete(); |
2612 |
|
// tsorted = 0; |
2613 |
|
// timage->Delete(); |
2614 |
|
// timage = 0; |
2615 |
|
// } |
2616 |
|
|
2617 |
|
|
2618 |
|
// cout << "text "<<doit<<endl; |
2619 |
|
|
2620 |
|
|
2621 |
|
//-------------------------------------------------- |
2622 |
|
// fill array with extended tracks (this is easy...) |
2623 |
|
//-------------------------------------------------- |
2624 |
|
if(EXT){ |
2625 |
|
for(int it=0; it<trkext->GetEntries(); it++){ |
2626 |
|
|
2627 |
|
new (ttext[it]) PamTrack((ExtTrack*)(*trkext)[it], (CaloTrkVar*)(*caloext)[it], (ToFTrkVar*)(*tofext)[it], (OrbitalInfoTrkVar*)(*orbext)[it]); |
2628 |
|
|
2629 |
|
} |
2630 |
|
} |
2631 |
|
|
2632 |
|
|
2633 |
|
|
2634 |
|
}; |
2635 |
|
|
2636 |
|
|
2637 |
|
//Restore Object count |
2638 |
|
//To save space in the table keeping track of all referenced objects |
2639 |
|
//We reset the object count to what it was at the beginning of the event. |
2640 |
|
TProcessID::SetObjectCount(ObjectNumber); |
2641 |
|
|
2642 |
|
//Everything went fine so the current event can be tagged as sorted |
2643 |
|
issorted_new = true; |
2644 |
|
lastsorted_new = GetReadEntry(); |
2645 |
|
|
2646 |
|
// cout << " tsorted "<< tsorted << " "<<(tsorted ? tsorted->GetEntries() : 0)<<endl; |
2647 |
|
// cout << " timage "<< timage << " "<<(timage ? timage->GetEntries() : 0)<<endl; |
2648 |
|
// cout << " text "<< text << " "<<(text ? text->GetEntries() : 0)<<endl; |
2649 |
|
|
2650 |
|
|
2651 |
|
}; |
2652 |
//-------------------------------------- |
//-------------------------------------- |
2653 |
// |
// |
2654 |
// |
// |
2657 |
* 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. |
2658 |
* 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. |
2659 |
*/ |
*/ |
2660 |
|
|
2661 |
// TRefArray *PamLevel2::GetTracks(){ |
// TRefArray *PamLevel2::GetTracks(){ |
2662 |
|
|
2663 |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
2668 |
// return &sorted_tracks; |
// return &sorted_tracks; |
2669 |
|
|
2670 |
// }; |
// }; |
|
TClonesArray *PamLevel2::GetTracks() { |
|
2671 |
|
|
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
|
|
SortTracks(); |
|
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
|
2672 |
|
|
|
return tsorted; |
|
|
|
|
|
} |
|
|
; |
|
2673 |
//-------------------------------------- |
//-------------------------------------- |
2674 |
// |
// |
2675 |
// |
// |
2676 |
//-------------------------------------- |
//-------------------------------------- |
2677 |
|
|
2678 |
/** |
/** |
2679 |
* Retrieves the it-th Pamela "physical" track. |
* Retrieves the it-th Pamela "physical" track. |
2680 |
* It override TrkLevel2::GetTrack(int it). |
* It override TrkLevel2::GetTrack(int it). |
2681 |
* @param it Track number, ranging from 0 to GetNTracks(). |
* @param it Track number, ranging from 0 to GetNTracks(). |
2682 |
*/ |
*/ |
2683 |
PamTrack *PamLevel2::GetTrack(int it) { |
PamTrack *PamLevel2::GetTrackOld(int it) { |
2684 |
|
|
2685 |
// if(!trk2_obj) return 0; |
PamTrack *track = NULL; |
|
|
|
|
// // *-*-*-*+-*-*-*-*-*-*-*-*-* |
|
|
// 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; |
|
|
// }; |
|
2686 |
|
|
|
// return track; |
|
|
|
|
|
// cout << "PamLevel2::GetTrack(int it) "<<endl; |
|
2687 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2688 |
SortTracks(); |
SortTracks(); |
2689 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2690 |
if (!tsorted) |
if (!tsorted) |
2691 |
return 0; |
return track; |
2692 |
if (!tsorted->GetEntries()) |
// if (!tsorted->GetEntries()) |
2693 |
return 0; |
// return track; |
2694 |
|
if (tsorted->GetEntries()==0) |
2695 |
|
return track; |
2696 |
|
|
|
PamTrack *track = 0; |
|
2697 |
|
|
2698 |
if (it >= 0 && it < trk2_obj->TrkLevel2::GetNTracks()) { |
if ( |
2699 |
// TrkTrack *t = (TrkTrack*)sorted_tracks.At(it); |
tsorted && |
2700 |
// track = GetPamTrackAlong(t); |
it >= 0 && |
2701 |
//TClonesArray &t = *(tsorted); |
it < trk2_obj->TrkLevel2::GetNTracks() && |
2702 |
//track = (PamTrack*)t[it]; |
it < tsorted->GetEntries() && |
2703 |
track = (PamTrack*)((*tsorted)[it]); |
true) { |
2704 |
|
track = (PamTrack*)((*tsorted)[it]); |
2705 |
} |
} |
2706 |
else { |
else { |
2707 |
cout << "PamLevel2::GetTrack(int) : tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
cout << "PamLevel2::GetTrackOld(int) : tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
2708 |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
2709 |
}; |
}; |
2710 |
|
|
2711 |
return track; |
return track; |
2712 |
|
|
2713 |
|
}; |
2714 |
|
|
2715 |
|
//PamTrack *PamLevel2::GetTrack(int it) { return GetTrack(it,trkAlg); }; |
2716 |
|
|
2717 |
|
/** |
2718 |
|
* Retrieves the it-th Pamela "physical" track. |
2719 |
|
* It override TrkLevel2::GetTrack(int it). |
2720 |
|
* @param it Track number, ranging from 0 to GetNTracks(). |
2721 |
|
* @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation. |
2722 |
|
*/ |
2723 |
|
PamTrack *PamLevel2::GetTrack(int it, const char* alg) { |
2724 |
|
|
2725 |
|
TString s(alg); |
2726 |
|
if(!s.CompareTo("") ||!s.CompareTo("STD") )return GetTrackOld(it); //old algorythm |
2727 |
|
|
2728 |
|
|
2729 |
|
SortTracksNew(); |
2730 |
|
// >> fill tsorted, timage and text |
2731 |
|
|
2732 |
|
if ( ( !s.Contains("EXTF", TString::kIgnoreCase) || !EXT )){ //not forced exteded-alg requested (or exteded-data missing) |
2733 |
|
|
2734 |
|
if( s.Contains("NUC")){ |
2735 |
|
if( |
2736 |
|
tsorted_nuc && |
2737 |
|
it < tsorted_nuc->GetEntries() && //enough tracks found |
2738 |
|
it >= 0 && //valid index |
2739 |
|
true) return (PamTrack*)((*tsorted_nuc)[it]); //ok return the track |
2740 |
|
}else{ |
2741 |
|
if( |
2742 |
|
tsorted && |
2743 |
|
it < tsorted->GetEntries() && //enough tracks found |
2744 |
|
it >= 0 && //valid index |
2745 |
|
true )return (PamTrack*)((*tsorted)[it]); //ok return the track |
2746 |
|
} |
2747 |
|
|
2748 |
|
} |
2749 |
|
|
2750 |
|
|
2751 |
|
///////////////////////////////////////////////////////////////////////// |
2752 |
|
/// if requested get track from extended algorythm output |
2753 |
|
///////////////////////////////////////////////////////////////////////// |
2754 |
|
|
2755 |
|
if(s.Contains("EXT", TString::kIgnoreCase) && EXT){//if exteded-alg requested |
2756 |
|
|
2757 |
|
if(s.Contains("NUC")){ |
2758 |
|
if( |
2759 |
|
text_nuc && |
2760 |
|
it < text_nuc->GetEntries() && //enough tracks found |
2761 |
|
it >= 0 && //valid index |
2762 |
|
true) return (PamTrack*)((*text_nuc)[it]); |
2763 |
|
}else{ |
2764 |
|
if( |
2765 |
|
text && |
2766 |
|
it < text->GetEntries() && //enough tracks found |
2767 |
|
it >= 0 && //valid index |
2768 |
|
true) return (PamTrack*)((*text)[it]); |
2769 |
|
} |
2770 |
|
|
2771 |
|
}; |
2772 |
|
|
2773 |
|
|
2774 |
|
cout << "PamTrack *PamLevel2::GetTrack("<<it<<","<<alg<<") -- wrong track number or unrecognised algorithm"<<endl; |
2775 |
|
|
2776 |
|
return NULL; |
2777 |
|
|
2778 |
} |
} |
2779 |
; |
; |
2780 |
|
TClonesArray *PamLevel2::GetTracks() { |
2781 |
|
|
2782 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2783 |
|
SortTracks(); |
2784 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2785 |
|
|
2786 |
|
return tsorted; |
2787 |
|
|
2788 |
|
} |
2789 |
|
; |
2790 |
|
Int_t PamLevel2::GetNTracks(const char* alg) { |
2791 |
|
|
2792 |
|
|
2793 |
|
// cout << " trk_nuc_obj->GetEntries() "<<trk_nuc_obj->GetEntries()<<" trk2_nuc_obj->GetNTracks() "<<trk2_nuc_obj->GetNTracks()<<endl; |
2794 |
|
|
2795 |
|
TString s(alg); |
2796 |
|
|
2797 |
|
if(!s.CompareTo("") || !s.CompareTo("STD"))return trk2_obj->TrkLevel2::GetNTracks(); //standard algorythm |
2798 |
|
|
2799 |
|
if(s.Contains("EXTF", TString::kIgnoreCase) && EXT){ |
2800 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && NUC)return trk_ext_nuc_obj->GetEntries();//ok |
2801 |
|
return trk_ext_obj->GetEntries();//ok |
2802 |
|
} |
2803 |
|
if( s.Contains("EXT", TString::kIgnoreCase) && EXT) { |
2804 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && NUC) |
2805 |
|
return (trk2_nuc_obj->TrkLevel2::GetNTracks() ? trk2_nuc_obj->TrkLevel2::GetNTracks() : trk_ext_nuc_obj->GetEntries() ); |
2806 |
|
return (trk2_obj->TrkLevel2::GetNTracks() ? trk2_obj->TrkLevel2::GetNTracks() : trk_ext_obj->GetEntries() ); |
2807 |
|
} |
2808 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && NUC ) |
2809 |
|
return trk2_nuc_obj->TrkLevel2::GetNTracks(); |
2810 |
|
|
2811 |
|
cout << "Int_t PamLevel2::GetNTracks("<<alg<<") -- unrecognised algorithm"<<endl; |
2812 |
|
|
2813 |
|
return 0; |
2814 |
|
|
2815 |
|
} |
2816 |
|
|
2817 |
|
|
2818 |
//-------------------------------------- |
//-------------------------------------- |
2819 |
// |
// |
2823 |
* 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(). |
2824 |
* @param it Track number, ranging from 0 to GetNTracks(). |
* @param it Track number, ranging from 0 to GetNTracks(). |
2825 |
*/ |
*/ |
2826 |
PamTrack *PamLevel2::GetTrackImage(int it) { |
PamTrack *PamLevel2::GetTrackImageOld(int it) { |
2827 |
|
|
2828 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2829 |
SortTracks(); |
SortTracks(); |
2847 |
}; |
}; |
2848 |
} |
} |
2849 |
else { |
else { |
2850 |
cout << "PamLevel2::GetTrackImage(int) : Tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
cout << "PamLevel2::GetTrackImageOld(int) : Tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
2851 |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
2852 |
}; |
}; |
2853 |
|
|
2854 |
return image; |
return image; |
2855 |
} |
} |
2856 |
|
/** |
2857 |
|
* Retrieves (if present) the image of the it-th Pamela "physical" track, sorted by the method PamLevel2::SortTracks(). |
2858 |
|
* @param it Track number, ranging from 0 to GetNTracks(). |
2859 |
|
* @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation. |
2860 |
|
*/ |
2861 |
|
PamTrack *PamLevel2::GetTrackImage(int it, const char* alg) { |
2862 |
|
|
2863 |
|
TString s(alg); |
2864 |
|
if(!s.CompareTo("") || !s.CompareTo("STD"))return GetTrackImageOld(it); //old algorythm |
2865 |
|
|
2866 |
|
|
2867 |
|
SortTracksNew(); |
2868 |
|
// >> fill tsorted, timage and text |
2869 |
|
|
2870 |
|
if ( ( !s.Contains("EXTF", TString::kIgnoreCase) || !EXT )){ //not forced exteded-alg requested (or exteded-data missing) |
2871 |
|
|
2872 |
|
if( s.Contains("NUC")){ |
2873 |
|
if( |
2874 |
|
tsorted_nuc && |
2875 |
|
it < tsorted_nuc->GetEntries() && //enough tracks found |
2876 |
|
it >= 0 && //valid index |
2877 |
|
true){ |
2878 |
|
TClonesArray &t = *(tsorted_nuc); |
2879 |
|
PamTrack *temp = (PamTrack*) t[it]; |
2880 |
|
if (temp->GetTrkTrack()->HasImage()) { |
2881 |
|
return (PamTrack*)((*timage_nuc)[it]); //ok return the track |
2882 |
|
}else{ |
2883 |
|
return NULL; |
2884 |
|
} |
2885 |
|
|
2886 |
|
} |
2887 |
|
}else{ |
2888 |
|
if( |
2889 |
|
tsorted && |
2890 |
|
it < tsorted->GetEntries() && //enough tracks found |
2891 |
|
it >= 0 && //valid index |
2892 |
|
true ){ |
2893 |
|
TClonesArray &t = *(tsorted); |
2894 |
|
PamTrack *temp = (PamTrack*) t[it]; |
2895 |
|
if (temp->GetTrkTrack()->HasImage()) { |
2896 |
|
return (PamTrack*)((*timage)[it]); //ok return the track |
2897 |
|
}else{ |
2898 |
|
return NULL; |
2899 |
|
} |
2900 |
|
} |
2901 |
|
} |
2902 |
|
|
2903 |
|
} |
2904 |
|
|
2905 |
|
// cout << "PamTrack *PamLevel2::GetTrackImage("<<it<<","<<alg<<") -- wrong track number or unrecognised algorithm"<<endl; |
2906 |
|
|
2907 |
|
return NULL; |
2908 |
|
|
2909 |
|
} |
2910 |
|
; |
2911 |
|
|
2912 |
//-------------------------------------- |
//-------------------------------------- |
2913 |
// |
// |
2997 |
if (!Trout) |
if (!Trout) |
2998 |
Trout = T; |
Trout = T; |
2999 |
else |
else |
3000 |
Trout->AddFriend(T); |
Trout->AddFriend(T); |
3001 |
} |
} |
3002 |
else { |
else { |
3003 |
cout << "Tracker : missing tree" << endl; |
cout << "Tracker : missing tree" << endl; |
3362 |
TChain *G = 0; |
TChain *G = 0; |
3363 |
|
|
3364 |
TChain *L = 0; |
TChain *L = 0; |
3365 |
|
TChain *P = 0; |
3366 |
|
|
3367 |
if (TRK2 || TRK1 || TRKh) |
if (TRK2 || TRK1 || TRKh) |
3368 |
T = new TChain("Tracker"); |
T = new TChain("Tracker"); |
3382 |
B = new TChain("OrbitalInfo"); |
B = new TChain("OrbitalInfo"); |
3383 |
if (GP) |
if (GP) |
3384 |
G = new TChain("h20"); |
G = new TChain("h20"); |
3385 |
|
if (PROC) |
3386 |
|
P = new TChain("ProcessingInfo"); |
3387 |
L = new TChain("SelectionList"); |
L = new TChain("SelectionList"); |
3388 |
|
|
3389 |
// loop over files and create chains |
// loop over files and create chains |
3411 |
B->Add(name); |
B->Add(name); |
3412 |
if (GP) |
if (GP) |
3413 |
G->Add(name); |
G->Add(name); |
3414 |
|
if (P) |
3415 |
|
P->Add(name); |
3416 |
if (SELLI == 1) |
if (SELLI == 1) |
3417 |
L->Add(name); |
L->Add(name); |
3418 |
}; |
}; |
3419 |
}; |
}; |
3420 |
|
|
3421 |
cout << "done chains\n"; |
cout << "done data-tree chains "<< T->GetNtrees() <<" \n"; |
3422 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "----------------------------------------------------" << endl; |
3423 |
|
|
3424 |
// ------------------------------------------- |
// ------------------------------------------- |
3425 |
// make friends |
// make friends |
3502 |
// ===================================== |
// ===================================== |
3503 |
// SET BRANCH-ADDRESS AFTER CHAIN+FRIEND |
// SET BRANCH-ADDRESS AFTER CHAIN+FRIEND |
3504 |
// ===================================== |
// ===================================== |
3505 |
SetBranchAddress(Trout); |
if( Trout->GetNtrees() )SetBranchAddress(Trout); |
3506 |
|
|
3507 |
// ------------------------------------ |
// ------------------------------------ |
3508 |
// finally handle selection trees... |
// finally handle selection trees... |
3509 |
// (it is not friend of pamela tree) |
// (it is not friend of pamela tree) |
3510 |
// ------------------------------------ |
// ------------------------------------ |
3511 |
|
|
3512 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "----------------------------------------------------" << endl; |
3513 |
|
|
3514 |
// Selection List |
// Selection List |
3515 |
if (L && SELLI == 1) { |
if (L && SELLI == 1) { |
3530 |
// if(!Trout)Trout=O; |
// if(!Trout)Trout=O; |
3531 |
// else Trout->AddFriend("SelectionList"); |
// else Trout->AddFriend("SelectionList"); |
3532 |
cout << "+SelectionList" << endl; |
cout << "+SelectionList" << endl; |
3533 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "----------------------------------------------------" << endl; |
3534 |
} |
} |
3535 |
else { |
else { |
3536 |
// cout << "SelectionList : missing tree"<<endl; |
// cout << "SelectionList : missing tree"<<endl; |
3538 |
L->Delete(); |
L->Delete(); |
3539 |
}; |
}; |
3540 |
|
|
3541 |
|
//ProcessingInfo EM |
3542 |
|
if ( P && P->GetEntries() ){ |
3543 |
|
cout << "----------------------------------------------------" << endl; |
3544 |
|
cout << ">>> Found ProcessingInfo <<<" << endl; |
3545 |
|
// L->SetBranchAddress("RunEntry",&irun); |
3546 |
|
P->SetBranchAddress("ProcInfo", &proc_obj);//NEWNEW |
3547 |
|
proc_tree = P; |
3548 |
|
} else { |
3549 |
|
// proc_tree = new TChain("ProcessingInfo","Log of data processing"); |
3550 |
|
// proc_tree->Branch("ProcInfo", "ProcInfo", &proc_obj); |
3551 |
|
cout << "----------------------------------------------------" << endl; |
3552 |
|
cout << ">>> ProcessingInfo not found, PROC set to false and continue (not 10RED files?)<<<" << endl; |
3553 |
|
PROC = false; |
3554 |
|
} |
3555 |
// -------------------------------------------- |
// -------------------------------------------- |
3556 |
// return the pamela chain with all the friends |
// return the pamela chain with all the friends |
3557 |
// -------------------------------------------- |
// -------------------------------------------- |
3558 |
|
|
3559 |
pam_tree = Trout; |
pam_tree = Trout; |
|
|
|
3560 |
return Trout; |
return Trout; |
3561 |
} |
} |
3562 |
|
|
3569 |
*/ |
*/ |
3570 |
void PamLevel2::SetBranchAddress(TTree *t) { |
void PamLevel2::SetBranchAddress(TTree *t) { |
3571 |
|
|
3572 |
TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
// TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
3573 |
TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
// TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
3574 |
TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
// TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
3575 |
CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
// CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
3576 |
CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
// CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
3577 |
TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
// TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
3578 |
TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
// TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
3579 |
S4 = S4 & t->GetBranchStatus("S4Level2"); |
// S4 = S4 & t->GetBranchStatus("S4Level2"); |
3580 |
ND = ND & t->GetBranchStatus("NDLevel2"); |
// ND = ND & t->GetBranchStatus("NDLevel2"); |
3581 |
AC = AC & t->GetBranchStatus("AcLevel2"); |
// AC = AC & t->GetBranchStatus("AcLevel2"); |
3582 |
ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
// ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
3583 |
GP = GP & t->GetBranchStatus("h20"); |
// GP = GP & t->GetBranchStatus("h20"); |
3584 |
|
|
3585 |
|
|
3586 |
// Tracker |
// Tracker |
3587 |
if (TRK1) { |
if (TRK1) { |
3591 |
if (TRK2) { |
if (TRK2) { |
3592 |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel1")); |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel1")); |
3593 |
cout << "Tracker : set branch address TrkLevel2" << endl; |
cout << "Tracker : set branch address TrkLevel2" << endl; |
3594 |
|
NUC = t->GetBranchStatus("TrackNuclei"); |
3595 |
|
EXT = t->GetBranchStatus("RecoveredTrack") && (NUC ? t->GetBranchStatus("RecoveredTrackNuclei"): true ); |
3596 |
}; |
}; |
3597 |
if (TRKh) { |
if (TRKh) { |
3598 |
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
3653 |
|
|
3654 |
cout << "h20 : set branch address GPamela " << endl; |
cout << "h20 : set branch address GPamela " << endl; |
3655 |
}; |
}; |
3656 |
|
if(NUC){ |
3657 |
|
|
3658 |
|
cout << "Found nuclei-track branches" << endl; |
3659 |
|
|
3660 |
|
if( !trk_nuc_obj )trk_nuc_obj = new TClonesArray("TrkTrack"); |
3661 |
|
if( !calo_nuc_obj)calo_nuc_obj= new TClonesArray("CaloTrkVar"); |
3662 |
|
if( !tof_nuc_obj)tof_nuc_obj= new TClonesArray("ToFTrkVar"); |
3663 |
|
if( !orb_nuc_obj)orb_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3664 |
|
if (TRK2)t-> SetBranchAddress("TrackNuclei",&trk_nuc_obj); |
3665 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("TrackNuclei",&calo_nuc_obj); |
3666 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("TrackNuclei",&tof_nuc_obj); |
3667 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("TrackNuclei",&orb_nuc_obj); |
3668 |
|
|
3669 |
|
///copy the vector content inside a "fake" object (all aother info are missing) |
3670 |
|
|
3671 |
|
if( !trk2_nuc_obj )trk2_nuc_obj = new TrkLevel2(); |
3672 |
|
if( !calo2_nuc_obj )calo2_nuc_obj = new CaloLevel2(); |
3673 |
|
if( !tof2_nuc_obj )tof2_nuc_obj = new ToFLevel2(); |
3674 |
|
if( !orb2_nuc_obj )orb2_nuc_obj = new OrbitalInfo(); |
3675 |
|
// *(trk2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*trk_nuc_obj); |
3676 |
|
// *(calo2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*calo_nuc_obj); |
3677 |
|
// *(tof2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*tof_nuc_obj); |
3678 |
|
// *(orb2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*orb_nuc_obj); |
3679 |
|
|
3680 |
|
trk2_nuc_obj->SetTrackArray( trk_nuc_obj ); |
3681 |
|
calo2_nuc_obj->SetTrackArray( calo_nuc_obj ); |
3682 |
|
tof2_nuc_obj->SetTrackArray( tof_nuc_obj ); |
3683 |
|
orb2_nuc_obj->SetTrackArray( orb_nuc_obj ); |
3684 |
|
|
3685 |
|
|
3686 |
|
} |
3687 |
|
|
3688 |
|
if(EXT){ |
3689 |
|
|
3690 |
|
cout << "Found extended tracking algorythm branches" << endl; |
3691 |
|
|
3692 |
|
if( !trk_ext_obj )trk_ext_obj = new TClonesArray("ExtTrack"); |
3693 |
|
if( !calo_ext_obj)calo_ext_obj= new TClonesArray("CaloTrkVar"); |
3694 |
|
if( !tof_ext_obj)tof_ext_obj= new TClonesArray("ToFTrkVar"); |
3695 |
|
if( !orb_ext_obj)orb_ext_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3696 |
|
|
3697 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrack",&trk_ext_obj); |
3698 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrack",&calo_ext_obj); |
3699 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrack",&tof_ext_obj); |
3700 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrack",&orb_ext_obj); |
3701 |
|
|
3702 |
|
|
3703 |
|
if(NUC){ |
3704 |
|
if( !trk_ext_nuc_obj )trk_ext_nuc_obj = new TClonesArray("ExtTrack"); |
3705 |
|
if( !calo_ext_nuc_obj)calo_ext_nuc_obj= new TClonesArray("CaloTrkVar"); |
3706 |
|
if( !tof_ext_nuc_obj)tof_ext_nuc_obj= new TClonesArray("ToFTrkVar"); |
3707 |
|
if( !orb_ext_nuc_obj)orb_ext_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3708 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrackNuclei",&trk_ext_nuc_obj); |
3709 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrackNuclei",&calo_ext_nuc_obj); |
3710 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrackNuclei",&tof_ext_nuc_obj); |
3711 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrackNuclei",&orb_ext_nuc_obj); |
3712 |
|
} |
3713 |
|
} |
3714 |
} |
} |
3715 |
/** |
/** |
3716 |
* Set branch addresses for Pamela friend trees |
* Set branch addresses for Pamela friend trees |
3734 |
if (TRK2) { |
if (TRK2) { |
3735 |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
3736 |
cout << "Tracker : set branch address TrkLevel2" << endl; |
cout << "Tracker : set branch address TrkLevel2" << endl; |
3737 |
|
NUC = t->GetBranchStatus("TrackNuclei"); |
3738 |
|
EXT = t->GetBranchStatus("RecoveredTrack") && (NUC ? t->GetBranchStatus("RecoveredTrackNuclei"): true ); |
3739 |
}; |
}; |
3740 |
if (TRK1) { |
if (TRK1) { |
3741 |
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
3749 |
// Calorimeter |
// Calorimeter |
3750 |
if (CAL2) { |
if (CAL2) { |
3751 |
t->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
t->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
3752 |
cout << "Calorimeter : set branch address CaloLevel2" << endl; |
cout << "Calorimeter : set branch address CaloLevel2" << endl; |
3753 |
}; |
}; |
3754 |
if (CAL1) { |
if (CAL1) { |
3755 |
t->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
t->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
3807 |
// cout << "SelectionList: set branch address EventEntry"<<endl; |
// cout << "SelectionList: set branch address EventEntry"<<endl; |
3808 |
|
|
3809 |
// } |
// } |
3810 |
|
if(NUC){ |
3811 |
|
|
3812 |
|
cout << "Found nuclei-track branches" << endl; |
3813 |
|
|
3814 |
|
if( !trk_nuc_obj )trk_nuc_obj = new TClonesArray("TrkTrack"); |
3815 |
|
if( !calo_nuc_obj)calo_nuc_obj= new TClonesArray("CaloTrkVar"); |
3816 |
|
if( !tof_nuc_obj)tof_nuc_obj= new TClonesArray("ToFTrkVar"); |
3817 |
|
if( !orb_nuc_obj)orb_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3818 |
|
if (TRK2)t-> SetBranchAddress("TrackNuclei",&trk_nuc_obj); |
3819 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("TrackNuclei",&calo_nuc_obj); |
3820 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("TrackNuclei",&tof_nuc_obj); |
3821 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("TrackNuclei",&orb_nuc_obj); |
3822 |
|
|
3823 |
|
///copy the vector content inside a "fake" object (all aother info are missing) |
3824 |
|
|
3825 |
|
if( !trk2_nuc_obj )trk2_nuc_obj = new TrkLevel2(); |
3826 |
|
if( !calo2_nuc_obj )calo2_nuc_obj = new CaloLevel2(); |
3827 |
|
if( !tof2_nuc_obj )tof2_nuc_obj = new ToFLevel2(); |
3828 |
|
if( !orb2_nuc_obj )orb2_nuc_obj = new OrbitalInfo(); |
3829 |
|
|
3830 |
|
// *(trk2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*trk_nuc_obj); |
3831 |
|
// *(calo2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*calo_nuc_obj); |
3832 |
|
// *(tof2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*tof_nuc_obj); |
3833 |
|
// *(orb2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*orb_nuc_obj); |
3834 |
|
trk2_nuc_obj->SetTrackArray( trk_nuc_obj ); |
3835 |
|
calo2_nuc_obj->SetTrackArray( calo_nuc_obj ); |
3836 |
|
tof2_nuc_obj->SetTrackArray( tof_nuc_obj ); |
3837 |
|
orb2_nuc_obj->SetTrackArray( orb_nuc_obj ); |
3838 |
|
|
3839 |
|
} |
3840 |
|
if(EXT){ |
3841 |
|
|
3842 |
|
cout << "Found extended tracking algorythm branches" << endl; |
3843 |
|
|
3844 |
|
t->SetBranchAddress("extAlgFlag",&extAlgFlag); |
3845 |
|
|
3846 |
|
if( !trk_ext_obj )trk_ext_obj = new TClonesArray("ExtTrack"); |
3847 |
|
if( !calo_ext_obj)calo_ext_obj= new TClonesArray("CaloTrkVar"); |
3848 |
|
if( !tof_ext_obj)tof_ext_obj= new TClonesArray("ToFTrkVar"); |
3849 |
|
if( !orb_ext_obj)orb_ext_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3850 |
|
|
3851 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrack",&trk_ext_obj); |
3852 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrack",&calo_ext_obj); |
3853 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrack",&tof_ext_obj); |
3854 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrack",&orb_ext_obj); |
3855 |
|
|
3856 |
|
if(NUC){ |
3857 |
|
if( !trk_ext_nuc_obj )trk_ext_nuc_obj = new TClonesArray("ExtTrack"); |
3858 |
|
if( !calo_ext_nuc_obj)calo_ext_nuc_obj= new TClonesArray("CaloTrkVar"); |
3859 |
|
if( !tof_ext_nuc_obj)tof_ext_nuc_obj= new TClonesArray("ToFTrkVar"); |
3860 |
|
if( !orb_ext_nuc_obj)orb_ext_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3861 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrackNuclei",&trk_ext_nuc_obj); |
3862 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrackNuclei",&calo_ext_nuc_obj); |
3863 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrackNuclei",&tof_ext_nuc_obj); |
3864 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrackNuclei",&orb_ext_nuc_obj); |
3865 |
|
} |
3866 |
|
} |
3867 |
|
|
3868 |
} |
} |
3869 |
|
|
3870 |
|
/** |
3871 |
|
* Set the tracking algorythm |
3872 |
|
* @param alg String to choose the track. |
3873 |
|
* "" --> take the output of the standard tracking algorythm |
3874 |
|
* "STD" --> take the output of the standard tracking algorythm |
3875 |
|
* "NUC" --> take the output of the standard tracking algorythm for nuclei cluster selection |
3876 |
|
* "EXT" --> in case the standard tracking algorythm has not found any track, take the output of the extended one |
3877 |
|
* "EXTF" --> force the extended tracking algorythm |
3878 |
|
* "NUCEXT" --> as "EXT", but for nuclei |
3879 |
|
* "NUCEXTF" --> as "EXTF", but for nuclei |
3880 |
|
*/ |
3881 |
|
// void PamLevel2::SetTrackingAlgorythm(const char *alg){ |
3882 |
|
|
3883 |
|
|
3884 |
|
// TString s(alg); |
3885 |
|
// if(s.Contains("NUC", TString::kIgnoreCase) && !NUC) |
3886 |
|
// cout << "Warning! NUC algorythm requested, but branches are missing"<<endl; |
3887 |
|
// if(s.Contains("EXT", TString::kIgnoreCase) && !EXT) |
3888 |
|
// cout << "Warning! EXT algorythm requested, but branches are missing"<<endl;; |
3889 |
|
|
3890 |
|
// trkAlg = alg; |
3891 |
|
|
3892 |
|
// }; |
3893 |
|
// const char* PamLevel2::GetTrackingAlgorythm(){ |
3894 |
|
|
3895 |
|
|
3896 |
|
// cout<<endl<<" Implemented tracking algorythm: "; |
3897 |
|
// cout<<endl<<" \"\" or \"STD\" --> take the output of the standard tracking algorythm"; |
3898 |
|
// cout<<endl<<" \"NUC\" --> take the output of the standard tracking algorythm for nuclei cluster selection"; |
3899 |
|
// cout<<endl<<" \"EXT\" --> in case the standard tracking algorythm has not found any track,"; |
3900 |
|
// cout<<endl<<" take the output of the extended one"; |
3901 |
|
// cout<<endl<<" \"EXTF\" --> force the extended tracking algorythm"; |
3902 |
|
// cout<<endl<<" \"NUCEXT\" --> as \"EXT\", but for nuclei "; |
3903 |
|
// cout<<endl<<" \"NUCEXTF\" --> as \"EXTF\", but for nuclei"; |
3904 |
|
|
3905 |
|
// cout<<endl; |
3906 |
|
// cout<<" <<Currently set algorythm>> "<<trkAlg<<endl; |
3907 |
|
// cout<<endl; |
3908 |
|
|
3909 |
|
// return trkAlg; |
3910 |
|
// }; |
3911 |
|
|
3912 |
|
|
3913 |
|
|
3914 |
//-------------------------------------- |
//-------------------------------------- |
3915 |
// |
// |
3916 |
// |
// |
3944 |
}; |
}; |
3945 |
} |
} |
3946 |
|
|
3947 |
|
cout << "done run chain "<< R->GetNtrees() <<" \n"; |
3948 |
|
|
3949 |
|
|
3950 |
if (RUN && R->GetNtrees()) { |
if (RUN && R->GetNtrees()) { |
3951 |
|
|
3952 |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
3986 |
cout << "----------------------------------------------------" << endl; |
cout << "----------------------------------------------------" << endl; |
3987 |
|
|
3988 |
} |
} |
3989 |
else { |
// else { |
3990 |
delete R; |
// delete R; |
3991 |
R = 0; |
// R = 0; |
3992 |
} |
// } |
3993 |
|
|
3994 |
run_tree = R; |
run_tree = R; |
3995 |
|
|
4067 |
run_tree->GetEntry(irun); |
run_tree->GetEntry(irun); |
4068 |
if (!GetOrbitalInfo()) |
if (!GetOrbitalInfo()) |
4069 |
cout << "** WARNING ** missing OrbitalInfo ---> run info might be not correctly updated " << endl; |
cout << "** WARNING ** missing OrbitalInfo ---> run info might be not correctly updated " << endl; |
4070 |
if (gltsync) |
if ( fUseDBinRunInfo ){ |
4071 |
delete gltsync; //Emiliano |
if (gltsync) |
4072 |
if (!dbc || (dbc && !dbc->IsConnected())) |
delete gltsync; //Emiliano |
4073 |
SetDBConnection(); //Emiliano |
if (!dbc || (dbc && !dbc->IsConnected())) |
4074 |
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 |
4075 |
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) |
4076 |
dbc->Close();// Emiliano |
if (dbc){ |
4077 |
delete dbc; |
dbc->Close();// Emiliano |
4078 |
dbc=0; |
delete dbc; |
4079 |
}; |
dbc=0; |
4080 |
}; |
} |
4081 |
|
} |
4082 |
|
} |
4083 |
// --------------------------------------------------------------- |
// --------------------------------------------------------------- |
4084 |
// retrieve OBT and absolute time of the event |
// retrieve OBT and absolute time of the event |
4085 |
// --------------------------------------------------------------- |
// --------------------------------------------------------------- |
4088 |
prevpktnum = pktnum; |
prevpktnum = pktnum; |
4089 |
if (GetOrbitalInfo()) { |
if (GetOrbitalInfo()) { |
4090 |
abstime = GetOrbitalInfo()->absTime; |
abstime = GetOrbitalInfo()->absTime; |
4091 |
obt = gltsync->DBobt(GetOrbitalInfo()->OBT); // Emiliano |
if ( fUseDBinRunInfo ) obt = gltsync->DBobt(GetOrbitalInfo()->OBT); // Emiliano |
4092 |
pktnum = GetOrbitalInfo()->pkt_num; // Emiliano |
pktnum = GetOrbitalInfo()->pkt_num; // Emiliano |
4093 |
} |
} |
4094 |
else { |
else { |
4095 |
abstime = GetRunInfo()->RUNHEADER_TIME; |
abstime = GetRunInfo()->RUNHEADER_TIME; |
4096 |
obt = gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT); // Emiliano |
if ( fUseDBinRunInfo ) obt = gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT); // Emiliano |
4097 |
pktnum = GetRunInfo()->RUNHEADER_PKT; // Emiliano |
pktnum = GetRunInfo()->RUNHEADER_PKT; // Emiliano |
4098 |
} |
} |
4099 |
|
|
4101 |
printf("0abstime %lld %lld pktnum %d %d obt %lld \n",abstime,prevabstime,pktnum,prevpktnum,obt); |
printf("0abstime %lld %lld pktnum %d %d obt %lld \n",abstime,prevabstime,pktnum,prevpktnum,obt); |
4102 |
printf("0 rth %d %d nevents %d \n",GetRunInfo()->RUNHEADER_TIME,GetRunInfo()->RUNTRAILER_TIME,GetRunInfo()->NEVENTS); |
printf("0 rth %d %d nevents %d \n",GetRunInfo()->RUNHEADER_TIME,GetRunInfo()->RUNTRAILER_TIME,GetRunInfo()->NEVENTS); |
4103 |
printf("0 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
printf("0 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
4104 |
printf("0 rto2 %lld %lld \n",gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT),gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)); |
if ( fUseDBinRunInfo ) printf("0 rto2 %lld %lld \n",gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT),gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)); |
4105 |
printf("0 bo irunentry %lld prevshift %lld irun %lld \n",irunentry,prevshift,irun); |
printf("0 bo irunentry %lld prevshift %lld irun %lld \n",irunentry,prevshift,irun); |
4106 |
printf("0 min %lld iev %lld max %lld tot %lld \n",totrunentrymin,iev,totrunentrymax,totrunentry); |
printf("0 min %lld iev %lld max %lld tot %lld \n",totrunentrymin,iev,totrunentrymax,totrunentry); |
4107 |
} |
} |
4124 |
} |
} |
4125 |
|
|
4126 |
// |
// |
4127 |
|
bool a = true; |
4128 |
|
bool b = true; |
4129 |
|
if ( fUseDBinRunInfo ){ |
4130 |
|
a = false; |
4131 |
|
b = false; |
4132 |
|
if ( obt < gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) ) a = true; |
4133 |
|
if ( obt > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT) ) b = true; |
4134 |
|
} |
4135 |
if ( iev < totrunentrymin || iev > totrunentrymax // entry is outside run limits |
if ( iev < totrunentrymin || iev > totrunentrymax // entry is outside run limits |
4136 |
|| iev == 0 // or it is the first entry |
|| iev == 0 // or it is the first entry |
4137 |
|| (!isSync && ( |
|| (!isSync && ( |
4138 |
(abstime <= GetRunInfo()->RUNHEADER_TIME && obt < gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) ) // or it is outside obt limits (and abstime limits for security reasons) |
(abstime <= GetRunInfo()->RUNHEADER_TIME && a ) // or it is outside obt limits (and abstime limits for security reasons) |
4139 |
|| (abstime >= GetRunInfo()->RUNTRAILER_TIME && obt > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT) ) ))// or it is outside obt limits (and abstime limits for security reasons) |
|| (abstime >= GetRunInfo()->RUNTRAILER_TIME && b ) ))// or it is outside obt limits (and abstime limits for security reasons) |
4140 |
){ // check on abstime and obt needed to handle nested+DV_skipped packets |
){ // check on abstime and obt needed to handle nested+DV_skipped packets |
4141 |
|
|
4142 |
// check for a new run (ma prima il primo!) |
// check for a new run (ma prima il primo!) |
4144 |
printf("1abstime %lld %lld pktnum %d %d obt %lld \n",abstime,prevabstime,pktnum,prevpktnum,obt); |
printf("1abstime %lld %lld pktnum %d %d obt %lld \n",abstime,prevabstime,pktnum,prevpktnum,obt); |
4145 |
printf("1 rth %d %d nevents %d \n",GetRunInfo()->RUNHEADER_TIME,GetRunInfo()->RUNTRAILER_TIME,GetRunInfo()->NEVENTS); |
printf("1 rth %d %d nevents %d \n",GetRunInfo()->RUNHEADER_TIME,GetRunInfo()->RUNTRAILER_TIME,GetRunInfo()->NEVENTS); |
4146 |
printf("1 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
printf("1 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
4147 |
printf("1 rto2 %lld %lld \n",gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT),gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)); |
if ( fUseDBinRunInfo ) printf("1 rto2 %lld %lld \n",gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT),gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)); |
4148 |
printf("1 bo irunentry %lld prevshift %lld irun %lld \n",irunentry,prevshift,irun); |
printf("1 bo irunentry %lld prevshift %lld irun %lld \n",irunentry,prevshift,irun); |
4149 |
printf("1 min %lld iev %lld max %lld tot %lld \n",totrunentrymin,iev,totrunentrymax,totrunentry); |
printf("1 min %lld iev %lld max %lld tot %lld \n",totrunentrymin,iev,totrunentrymax,totrunentry); |
4150 |
} |
} |
4171 |
totrunentry += GetRunInfo()->NEVENTS; |
totrunentry += GetRunInfo()->NEVENTS; |
4172 |
totrunentrymax = totrunentry - 1 - prevshift; // prevshift is needed to handle nested+DV_skipped packets |
totrunentrymax = totrunentry - 1 - prevshift; // prevshift is needed to handle nested+DV_skipped packets |
4173 |
irun = r; |
irun = r; |
4174 |
|
if ( fUseDBinRunInfo ){ |
4175 |
|
a = false; |
4176 |
|
b = false; |
4177 |
|
if ( obt < gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) ) a = true; |
4178 |
|
if ( obt > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT) ) b = true; |
4179 |
|
} |
4180 |
if ( (iev >= totrunentrymin && iev <= totrunentrymax) || // entry is inside run limits |
if ( (iev >= totrunentrymin && iev <= totrunentrymax) || // entry is inside run limits |
4181 |
( !isSync && |
( !isSync && |
4182 |
( abstime >= GetRunInfo()->RUNHEADER_TIME && obt >= gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) // or it is inside obt limits (and abstime limits for security reasons) |
( abstime >= GetRunInfo()->RUNHEADER_TIME && a // or it is inside obt limits (and abstime limits for security reasons) |
4183 |
&& abstime <= GetRunInfo()->RUNTRAILER_TIME && obt <= gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT))) // or it is inside obt limits (and abstime limits for security reasons) |
&& abstime <= GetRunInfo()->RUNTRAILER_TIME && b)) // or it is inside obt limits (and abstime limits for security reasons) |
4184 |
){ // check on abstime and obt needed to handle nested+DV_skipped packets |
){ // check on abstime and obt needed to handle nested+DV_skipped packets |
4185 |
if ( totrunentrymin > iev ){ // there is a shift (nested+DV_skipped packets) |
if ( totrunentrymin > iev ){ // there is a shift (nested+DV_skipped packets) |
4186 |
if ( !isSync ){ |
if ( !isSync ){ |
4205 |
|
|
4206 |
|
|
4207 |
// |
// |
4208 |
if (gltsync) |
if ( fUseDBinRunInfo ){ |
4209 |
delete gltsync; // Emiliano |
if (gltsync) |
4210 |
if (!dbc || (dbc && !dbc->IsConnected())) |
delete gltsync; // Emiliano |
4211 |
SetDBConnection(); //Emiliano |
if (!dbc || (dbc && !dbc->IsConnected())) |
4212 |
gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); // Emiliano |
SetDBConnection(); //Emiliano |
4213 |
TrkParams::Set(GetRunInfo(), dbc); |
gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); // Emiliano |
4214 |
if (dbc){ |
TrkParams::Set(GetRunInfo(), dbc); |
4215 |
dbc->Close(); // Emiliano |
if (dbc){ |
4216 |
delete dbc; |
dbc->Close(); // Emiliano |
4217 |
dbc=0; |
delete dbc; |
4218 |
} |
dbc=0; |
4219 |
if (gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)) { // Emiliano |
} |
4220 |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun " << irun |
if (gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)) { // Emiliano |
4221 |
<< " has RUNHEADER_OBT>=RUNTRAILER_OBT " << endl; |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun " << irun |
4222 |
cout |
<< " has RUNHEADER_OBT>=RUNTRAILER_OBT " << endl; |
4223 |
<< " (NB!! in this case some events could be assigned to a wrong run)" |
cout |
4224 |
<< endl; |
<< " (NB!! in this case some events could be assigned to a wrong run)" |
4225 |
|
<< endl; |
4226 |
|
} |
4227 |
} |
} |
4228 |
// |
// |
4229 |
if (DBG) printf(" found \n"); |
if (DBG) printf(" found \n"); |
4280 |
printf("2abstime %lld %lld pktnum %d %d obt %lld \n",abstime,prevabstime,pktnum,prevpktnum,obt); |
printf("2abstime %lld %lld pktnum %d %d obt %lld \n",abstime,prevabstime,pktnum,prevpktnum,obt); |
4281 |
printf("2 rth %d %d nevents %d \n",GetRunInfo()->RUNHEADER_TIME,GetRunInfo()->RUNTRAILER_TIME,GetRunInfo()->NEVENTS); |
printf("2 rth %d %d nevents %d \n",GetRunInfo()->RUNHEADER_TIME,GetRunInfo()->RUNTRAILER_TIME,GetRunInfo()->NEVENTS); |
4282 |
printf("2 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
printf("2 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
4283 |
printf("2 rto2 %lld %lld \n",gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT),gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)); |
if ( fUseDBinRunInfo ) printf("2 rto2 %lld %lld \n",gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT),gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)); |
4284 |
printf("2 bo irunentry %lld prevshift %lld irun %lld \n",irunentry,prevshift,irun); |
printf("2 bo irunentry %lld prevshift %lld irun %lld \n",irunentry,prevshift,irun); |
4285 |
printf("2 min %lld iev %lld max %lld tot %lld \n",totrunentrymin,iev,totrunentrymax,totrunentry); |
printf("2 min %lld iev %lld max %lld tot %lld \n",totrunentrymin,iev,totrunentrymax,totrunentry); |
4286 |
} |
} |
4371 |
// update the tracker parameters |
// update the tracker parameters |
4372 |
// (non ho trovato nessun altro modo sicuro di farlo...) |
// (non ho trovato nessun altro modo sicuro di farlo...) |
4373 |
// ---------------------------------------------------- |
// ---------------------------------------------------- |
4374 |
if (!dbc || (dbc && !dbc->IsConnected())) |
if ( fUseDBinRunInfo ){ |
4375 |
SetDBConnection(); |
if (!dbc || (dbc && !dbc->IsConnected())) |
4376 |
TrkParams::Set(GetRunInfo(), dbc); |
SetDBConnection(); |
4377 |
if (dbc){ |
TrkParams::Set(GetRunInfo(), dbc); |
4378 |
dbc->Close(); |
if (dbc){ |
4379 |
delete dbc; |
dbc->Close(); |
4380 |
dbc=0; |
delete dbc; |
4381 |
}; |
dbc=0; |
4382 |
|
} |
4383 |
|
} |
4384 |
// cout << endl; |
// cout << endl; |
4385 |
prevshift = 0; |
prevshift = 0; |
4386 |
yprevshift = 0; |
yprevshift = 0; |
4648 |
// cout << "Checking file: "<<f->GetName()<<endl; |
// cout << "Checking file: "<<f->GetName()<<endl; |
4649 |
if (!f || f->IsZombie()) { |
if (!f || f->IsZombie()) { |
4650 |
cout << "File: " << f->GetName() << " Non valid root file" << endl; |
cout << "File: " << f->GetName() << " Non valid root file" << endl; |
4651 |
|
fDiscarded = true; |
4652 |
return; |
return; |
4653 |
} |
} |
4654 |
|
|
4855 |
TFile *f = new TFile(name.Data()); |
TFile *f = new TFile(name.Data()); |
4856 |
if (!f || f->IsZombie()) { |
if (!f || f->IsZombie()) { |
4857 |
cout << "File: " << f->GetName() << " discarded ---- Non valid root file" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Non valid root file" << endl; |
4858 |
|
fDiscarded = true; |
4859 |
return false; |
return false; |
4860 |
} |
} |
4861 |
// cout << "Get list of keys: "<<f<<endl; |
// cout << "Get list of keys: "<<f<<endl; |
4894 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4895 |
cout << "File: " << f->GetName() << " discarded ---- SelectionList tree has " << nevt |
cout << "File: " << f->GetName() << " discarded ---- SelectionList tree has " << nevt |
4896 |
<< " events instead of " << nev << endl; |
<< " events instead of " << nev << endl; |
4897 |
|
fDiscarded = true; |
4898 |
return false; |
return false; |
4899 |
} |
} |
4900 |
nev = nevt; |
nev = nevt; |
4909 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4910 |
cout << "File: " << f->GetName() << " discarded ---- Trigger tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Trigger tree has " << nevt << " events instead of " |
4911 |
<< nev << endl; |
<< nev << endl; |
4912 |
|
fDiscarded = true; |
4913 |
return false; |
return false; |
4914 |
} |
} |
4915 |
nev = nevt; |
nev = nevt; |
4923 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4924 |
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 |
4925 |
<< endl; |
<< endl; |
4926 |
|
fDiscarded = true; |
4927 |
return false; |
return false; |
4928 |
} |
} |
4929 |
nev = nevt; |
nev = nevt; |
4937 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4938 |
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 |
4939 |
<< endl; |
<< endl; |
4940 |
|
fDiscarded = true; |
4941 |
return false; |
return false; |
4942 |
} |
} |
4943 |
nev = nevt; |
nev = nevt; |
4952 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4953 |
cout << "File: " << f->GetName() << " discarded ---- NeutronD tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- NeutronD tree has " << nevt << " events instead of " |
4954 |
<< nev << endl; |
<< nev << endl; |
4955 |
|
fDiscarded = true; |
4956 |
return false; |
return false; |
4957 |
} |
} |
4958 |
nev = nevt; |
nev = nevt; |
4966 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4967 |
cout << "File: " << f->GetName() << " discarded ---- Anticounter tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Anticounter tree has " << nevt << " events instead of " |
4968 |
<< nev << endl; |
<< nev << endl; |
4969 |
|
fDiscarded = true; |
4970 |
return false; |
return false; |
4971 |
} |
} |
4972 |
nev = nevt; |
nev = nevt; |
4980 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4981 |
cout << "File: " << f->GetName() << " discarded ---- OrbitalInfo tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- OrbitalInfo tree has " << nevt << " events instead of " |
4982 |
<< nev << endl; |
<< nev << endl; |
4983 |
|
fDiscarded = true; |
4984 |
return false; |
return false; |
4985 |
} |
} |
4986 |
nev = nevt; |
nev = nevt; |
4994 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4995 |
cout << "File: " << f->GetName() << " discarded ---- Tracker tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Tracker tree has " << nevt << " events instead of " |
4996 |
<< nev << endl; |
<< nev << endl; |
4997 |
|
fDiscarded = true; |
4998 |
return false; |
return false; |
4999 |
} |
} |
5000 |
nev = nevt; |
nev = nevt; |
5018 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
5019 |
cout << "File: " << f->GetName() << " discarded ---- Calorimeter tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Calorimeter tree has " << nevt << " events instead of " |
5020 |
<< nev << endl; |
<< nev << endl; |
5021 |
|
fDiscarded = true; |
5022 |
return false; |
return false; |
5023 |
} |
} |
5024 |
nev = nevt; |
nev = nevt; |
5041 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
5042 |
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 |
5043 |
<< endl; |
<< endl; |
5044 |
|
fDiscarded = true; |
5045 |
return false; |
return false; |
5046 |
} |
} |
5047 |
nev = nevt; |
nev = nevt; |
5054 |
SELLI = (Int_t) SELLI__ok; |
SELLI = (Int_t) SELLI__ok; |
5055 |
if (SELLI == 0 && SELLI__ok) { |
if (SELLI == 0 && SELLI__ok) { |
5056 |
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; |
5057 |
|
fDiscarded = true; |
5058 |
return false; |
return false; |
5059 |
} |
} |
5060 |
if (SELLI == 1 && !SELLI__ok) { |
if (SELLI == 1 && !SELLI__ok) { |
5061 |
cout << "File: " << f->GetName() << " discarded ---- SelectionList missing" << endl; |
cout << "File: " << f->GetName() << " discarded ---- SelectionList missing" << endl; |
5062 |
|
fDiscarded = true; |
5063 |
return false; |
return false; |
5064 |
} |
} |
5065 |
|
|
5098 |
|
|
5099 |
if (CAL1 && !CAL1__ok) { |
if (CAL1 && !CAL1__ok) { |
5100 |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel1 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel1 branch" << endl; |
5101 |
|
fDiscarded = true; |
5102 |
return false; |
return false; |
5103 |
}; |
}; |
5104 |
if (CAL2 && !CAL2__ok) { |
if (CAL2 && !CAL2__ok) { |
5105 |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel2 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel2 branch" << endl; |
5106 |
|
fDiscarded = true; |
5107 |
return false; |
return false; |
5108 |
}; |
}; |
5109 |
if (TRK2 && !TRK2__ok) { |
if (TRK2 && !TRK2__ok) { |
5110 |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel2 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel2 branch" << endl; |
5111 |
|
fDiscarded = true; |
5112 |
return false; |
return false; |
5113 |
}; |
}; |
5114 |
if (TRK1 && !TRK1__ok) { |
if (TRK1 && !TRK1__ok) { |
5115 |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel1 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel1 branch" << endl; |
5116 |
|
fDiscarded = true; |
5117 |
return false; |
return false; |
5118 |
}; |
}; |
5119 |
if (TRKh && !TRKh__ok) { |
if (TRKh && !TRKh__ok) { |
5120 |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkHough branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkHough branch" << endl; |
5121 |
|
fDiscarded = true; |
5122 |
return false; |
return false; |
5123 |
}; |
}; |
5124 |
if (ORB && !ORB__ok) { |
if (ORB && !ORB__ok) { |
5125 |
cout << "File: " << f->GetName() << " discarded ---- Missing ORB tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing ORB tree" << endl; |
5126 |
|
fDiscarded = true; |
5127 |
return false; |
return false; |
5128 |
}; |
}; |
5129 |
if (AC && !AC__ok) { |
if (AC && !AC__ok) { |
5130 |
cout << "File: " << f->GetName() << " discarded ---- Missing AC tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing AC tree" << endl; |
5131 |
|
fDiscarded = true; |
5132 |
return false; |
return false; |
5133 |
}; |
}; |
5134 |
if (S4 && !S4__ok) { |
if (S4 && !S4__ok) { |
5135 |
cout << "File: " << f->GetName() << " discarded ---- Missing S4 tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing S4 tree" << endl; |
5136 |
|
fDiscarded = true; |
5137 |
return false; |
return false; |
5138 |
}; |
}; |
5139 |
if (TOF && !TOF__ok) { |
if (TOF && !TOF__ok) { |
5140 |
cout << "File: " << f->GetName() << " discarded ---- Missing ToF tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing ToF tree" << endl; |
5141 |
|
fDiscarded = true; |
5142 |
return false; |
return false; |
5143 |
}; |
}; |
5144 |
|
|
5145 |
if (ND && !ND__ok) { |
if (ND && !ND__ok) { |
5146 |
cout << "File: " << f->GetName() << " discarded ---- Missing ND tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing ND tree" << endl; |
5147 |
|
fDiscarded = true; |
5148 |
return false; |
return false; |
5149 |
}; |
}; |
5150 |
if (TRG && !TRG__ok) { |
if (TRG && !TRG__ok) { |
5151 |
cout << "File: " << f->GetName() << " discarded ---- Missing Trigger tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing Trigger tree" << endl; |
5152 |
|
fDiscarded = true; |
5153 |
return false; |
return false; |
5154 |
}; |
}; |
5155 |
if (GP && !GP__ok) { |
if (GP && !GP__ok) { |
5156 |
cout << "File: " << f->GetName() << " discarded ---- Missing h20 tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing h20 tree" << endl; |
5157 |
|
fDiscarded = true; |
5158 |
return false; |
return false; |
5159 |
}; |
}; |
5160 |
|
|
5254 |
// cout << i<< "\t | "<<GetRunInfo()->ID<<"\t "<<GetRunInfo()->NEVENTS<< "\t "<<GetRunInfo()->RUNHEADER_TIME<<" <---> "<<GetRunInfo()->RUNTRAILER_TIME<<endl; |
// cout << i<< "\t | "<<GetRunInfo()->ID<<"\t "<<GetRunInfo()->NEVENTS<< "\t "<<GetRunInfo()->RUNHEADER_TIME<<" <---> "<<GetRunInfo()->RUNTRAILER_TIME<<endl; |
5255 |
run_tree_clone->Fill(); |
run_tree_clone->Fill(); |
5256 |
} |
} |
5257 |
cout << "----------------------------------------------------" << endl; |
// |
5258 |
|
// replicate processinginfo tree |
5259 |
|
// |
5260 |
|
if ( PROC ){ // EMEMEM |
5261 |
|
proc_tree_clone = new TTree("ProcessingInfo","Log of data processing"); |
5262 |
|
proc_tree_clone->Branch("ProcInfo", "ProcInfo", GetPointerTo("ProcInfo")); |
5263 |
|
cout << "ProcessingInfo: branch ProcessingInfo" << endl; |
5264 |
|
// ------------------ |
5265 |
|
// replicate processinginfo tree |
5266 |
|
// ------------------ |
5267 |
|
// cout << "----------------------------------------------------"<<endl; |
5268 |
|
// cout << "irun\t | RUN\t NEVENTS\t absolute time"<<endl; |
5269 |
|
for (Int_t i = 0; i < proc_tree->GetEntries(); i++) { |
5270 |
|
proc_tree->GetEntry(i); |
5271 |
|
// cout << i<< "\t | "<<endl; |
5272 |
|
proc_tree_clone->Fill(); |
5273 |
|
} |
5274 |
|
if ( SELLI != 2 ){ |
5275 |
|
proc_obj->runID = 0; |
5276 |
|
TTimeStamp *dt = new TTimeStamp(); |
5277 |
|
proc_obj->date = dt->AsString(); |
5278 |
|
delete dt; |
5279 |
|
proc_obj->commandLine = Form("PamelaLevel2 was called: CAL2 %i CAL1 %i CAL0 %i TRK2 %i TRK1 %i TRKh %i TRK0 %i TOF %i TOF0 %i TRG %i \n S4 %i ND %i AC %i ORB %i GP %i EXT %i NUC %i RUN %i ISGP %i SELLI %i \n Custom string = %s",CAL2,CAL1,CAL0,TRK2,TRK1,TRKh,TRK0,TOF,TOF0,TRG,S4,ND,AC,ORB,GP,EXT,NUC,RUN,ISGP,SELLI,customString.Data()); |
5280 |
|
proc_obj->outputFilename = ofile->GetName(); |
5281 |
|
proc_obj->localDir = gSystem->WorkingDirectory(); |
5282 |
|
proc_obj->uname = gSystem->GetFromPipe("uname -a"); |
5283 |
|
if (!dbc || (dbc && !dbc->IsConnected())) SetDBConnection(); |
5284 |
|
proc_obj->DB = Form("mysql://%s/%s",dbc->GetHost(),dbc->GetDB()); |
5285 |
|
dbc->Close(); |
5286 |
|
proc_tree_clone->Fill(); |
5287 |
|
} |
5288 |
|
cout << "----------------------------------------------------" << endl; |
5289 |
|
} |
5290 |
// ------------------------------------ |
// ------------------------------------ |
5291 |
// add branch with dead and live times |
// add branch with dead and live times |
5292 |
// ------------------------------------ |
// ------------------------------------ |
5318 |
pam_tree_clone[i]->Branch("TrkHough", "TrkHough", GetPointerTo("TrkHough")); |
pam_tree_clone[i]->Branch("TrkHough", "TrkHough", GetPointerTo("TrkHough")); |
5319 |
cout << "Tracker : branch TrkHough" << endl; |
cout << "Tracker : branch TrkHough" << endl; |
5320 |
}; |
}; |
5321 |
|
if(NUC){ |
5322 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&trk_nuc_obj); |
5323 |
|
cout << "Tracker : branch TrackNuclei" << endl; |
5324 |
|
} |
5325 |
|
if(EXT){ |
5326 |
|
pam_tree_clone[i]->Branch("extAlgFlag",&extAlgFlag,"extAlgFlag/I"); |
5327 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&trk_ext_obj); |
5328 |
|
cout << "Tracker : branch RecoveredTrack" << endl; |
5329 |
|
if(NUC){ |
5330 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&trk_ext_nuc_obj); |
5331 |
|
cout << "Tracker : branch RecoveredTrackNuclei" << endl; |
5332 |
|
} |
5333 |
|
} |
5334 |
|
|
5335 |
i++; |
i++; |
5336 |
} |
} |
5337 |
|
|
5346 |
pam_tree_clone[i]->Branch("CaloLevel2", "CaloLevel2", GetPointerTo("CaloLevel2")); |
pam_tree_clone[i]->Branch("CaloLevel2", "CaloLevel2", GetPointerTo("CaloLevel2")); |
5347 |
cout << "Calorimeter : branch CaloLevel2" << endl; |
cout << "Calorimeter : branch CaloLevel2" << endl; |
5348 |
}; |
}; |
5349 |
|
if(NUC){ |
5350 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&calo_nuc_obj); |
5351 |
|
cout << "Calorimeter : branch TrackNuclei" << endl; |
5352 |
|
} |
5353 |
|
if(EXT){ |
5354 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&calo_ext_obj); |
5355 |
|
cout << "Calorimeter : branch RecoveredTrack" << endl; |
5356 |
|
if(NUC){ |
5357 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&calo_ext_nuc_obj); |
5358 |
|
cout << "Calorimeter : branch RecoveredTrackNuclei" << endl; |
5359 |
|
} |
5360 |
|
} |
5361 |
i++; |
i++; |
5362 |
} |
} |
5363 |
|
|
5366 |
pam_tree_clone[i] = new TTree("ToF", "PAMELA ToF level2 data "); |
pam_tree_clone[i] = new TTree("ToF", "PAMELA ToF level2 data "); |
5367 |
pam_tree_clone[i]->Branch("ToFLevel2", "ToFLevel2", GetPointerTo("ToFLevel2")); |
pam_tree_clone[i]->Branch("ToFLevel2", "ToFLevel2", GetPointerTo("ToFLevel2")); |
5368 |
cout << "ToF : branch ToFLevel2" << endl; |
cout << "ToF : branch ToFLevel2" << endl; |
5369 |
|
if(NUC){ |
5370 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&tof_nuc_obj); |
5371 |
|
cout << "ToF : branch TrackNuclei" << endl; |
5372 |
|
} |
5373 |
|
if(EXT){ |
5374 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&tof_ext_obj); |
5375 |
|
cout << "ToF : branch RecoveredTrack" << endl; |
5376 |
|
if(NUC){ |
5377 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&tof_ext_nuc_obj); |
5378 |
|
cout << "ToF : branch RecoveredTrackNuclei" << endl; |
5379 |
|
} |
5380 |
|
} |
5381 |
i++; |
i++; |
5382 |
}; |
}; |
5383 |
// Trigger |
// Trigger |
5413 |
pam_tree_clone[i] = new TTree("OrbitalInfo", "PAMELA orbital info "); |
pam_tree_clone[i] = new TTree("OrbitalInfo", "PAMELA orbital info "); |
5414 |
pam_tree_clone[i]->Branch("OrbitalInfo", "OrbitalInfo", GetPointerTo("OrbitalInfo")); |
pam_tree_clone[i]->Branch("OrbitalInfo", "OrbitalInfo", GetPointerTo("OrbitalInfo")); |
5415 |
cout << "OrbitalInfo : branch OrbitalInfo" << endl; |
cout << "OrbitalInfo : branch OrbitalInfo" << endl; |
5416 |
|
if(NUC){ |
5417 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&orb_nuc_obj); |
5418 |
|
cout << "OrbitalInfo : branch TrackNuclei" << endl; |
5419 |
|
} |
5420 |
|
if(EXT){ |
5421 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&orb_ext_obj); |
5422 |
|
cout << "OrbitalInfo : branch RecoveredTrack" << endl; |
5423 |
|
if(NUC){ |
5424 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&orb_ext_nuc_obj); |
5425 |
|
cout << "OrbitalInfo : branch RecoveredTrackNuclei" << endl; |
5426 |
|
} |
5427 |
|
} |
5428 |
i++; |
i++; |
5429 |
}; |
}; |
5430 |
// GPamela |
// GPamela |
5434 |
cout << "GPamela : branch GPamela" << endl; |
cout << "GPamela : branch GPamela" << endl; |
5435 |
i++; |
i++; |
5436 |
}; |
}; |
5437 |
|
|
5438 |
|
|
5439 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
5440 |
|
|
5441 |
} |
} |
5477 |
if (!name.CompareTo(na)) |
if (!name.CompareTo(na)) |
5478 |
return sel_tree_clone; |
return sel_tree_clone; |
5479 |
} |
} |
5480 |
|
if (proc_tree_clone && PROC) { |
5481 |
|
TString na = proc_tree_clone->GetName(); |
5482 |
|
if (!name.CompareTo(na)) |
5483 |
|
return proc_tree_clone; |
5484 |
|
} |
5485 |
return NULL; |
return NULL; |
5486 |
|
|
5487 |
} |
} |
5501 |
for (Int_t i = 0; i < NCLONES; i++) { |
for (Int_t i = 0; i < NCLONES; i++) { |
5502 |
if (pam_tree_clone[i]) { |
if (pam_tree_clone[i]) { |
5503 |
cout << pam_tree_clone[i]->GetName() << endl; |
cout << pam_tree_clone[i]->GetName() << endl; |
5504 |
pam_tree_clone[i]->Write(); |
pam_tree_clone[i]->Write(pam_tree_clone[i]->GetName(),TObject::kOverwrite); |
5505 |
}; |
}; |
5506 |
} |
} |
5507 |
|
|
5508 |
|
if ( PROC ){//EMEMEMEM |
5509 |
|
proc_tree_clone->Write("ProcessingInfo",TObject::kOverwrite); |
5510 |
|
} |
5511 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
5512 |
|
|
5513 |
} |
} |
5770 |
cout << " " << endl; |
cout << " " << endl; |
5771 |
} |
} |
5772 |
if (shift > 0) { |
if (shift > 0) { |
5773 |
cout << " PKTNUM L2 --- " << pktn << " --- L0 --- " << GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
if (DBG) cout << " PKTNUM L2 --- " << pktn << " --- L0 --- " << GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
5774 |
if (DBG) |
if (DBG) |
5775 |
cout << " RUN: ID " << GetRunInfo()->ID << " ID_ROOT_L0 " << run_obj->ID_ROOT_L0 << " ID_RUN_FRAG " |
cout << " RUN: ID " << GetRunInfo()->ID << " ID_ROOT_L0 " << run_obj->ID_ROOT_L0 << " ID_RUN_FRAG " |
5776 |
<< GetRunInfo()->ID_RUN_FRAG << " EV_FROM " << GetRunInfo()->EV_FROM << endl; |
<< GetRunInfo()->ID_RUN_FRAG << " EV_FROM " << GetRunInfo()->EV_FROM << endl; |
5952 |
|
|
5953 |
while ( (obt != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || pktn != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta + (Long64_t) shift) < GetYodaTree()->GetEntries() && shift < maxshift ){ |
while ( (obt != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || pktn != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta + (Long64_t) shift) < GetYodaTree()->GetEntries() && shift < maxshift ){ |
5954 |
if (shift > 0) { |
if (shift > 0) { |
5955 |
cout << " PKTNUM L2 --- " << pktn << " --- L0 --- " << GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
if (DBG) cout << " PKTNUM L2 --- " << pktn << " --- L0 --- " << GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
5956 |
if (DBG) |
if (DBG) |
5957 |
cout << " RUN: ID " << GetRunInfo()->ID << " ID_ROOT_L0 " << run_obj->ID_ROOT_L0 << " ID_RUN_FRAG " |
cout << " RUN: ID " << GetRunInfo()->ID << " ID_ROOT_L0 " << run_obj->ID_ROOT_L0 << " ID_RUN_FRAG " |
5958 |
<< GetRunInfo()->ID_RUN_FRAG << " EV_FROM " << GetRunInfo()->EV_FROM << endl; |
<< GetRunInfo()->ID_RUN_FRAG << " EV_FROM " << GetRunInfo()->EV_FROM << endl; |
6129 |
void PamLevel2::SetSortingMethod(TString how) { |
void PamLevel2::SetSortingMethod(TString how) { |
6130 |
if (howtosort != how) { |
if (howtosort != how) { |
6131 |
issorted = false; |
issorted = false; |
6132 |
|
issorted_new = false; |
6133 |
} |
} |
6134 |
howtosort = how; |
howtosort = how; |
6135 |
} |
} |