278 |
*/ |
*/ |
279 |
PamTrack::PamTrack() { |
PamTrack::PamTrack() { |
280 |
trk_track = 0; |
trk_track = 0; |
281 |
|
trk_ext_track = 0; |
282 |
calo_track = 0; |
calo_track = 0; |
283 |
tof_track = 0; |
tof_track = 0; |
284 |
orb_track = 0; |
orb_track = 0; |
296 |
*/ |
*/ |
297 |
PamTrack::PamTrack(TrkTrack* t, CaloTrkVar* c, ToFTrkVar* o, OrbitalInfoTrkVar *r) { |
PamTrack::PamTrack(TrkTrack* t, CaloTrkVar* c, ToFTrkVar* o, OrbitalInfoTrkVar *r) { |
298 |
|
|
299 |
|
trk_ext_track = 0; |
300 |
trk_track = 0; |
trk_track = 0; |
301 |
calo_track = 0; |
calo_track = 0; |
302 |
tof_track = 0; |
tof_track = 0; |
304 |
// if(t)trk_track = new TrkTrack(*t); |
// if(t)trk_track = new TrkTrack(*t); |
305 |
// if(c)calo_track = new CaloTrkVar(*c); |
// if(c)calo_track = new CaloTrkVar(*c); |
306 |
// if(o)tof_track = new ToFTrkVar(*o); |
// if(o)tof_track = new ToFTrkVar(*o); |
307 |
if (t) |
// if (t) |
308 |
trk_track = t; |
// trk_track = t; |
309 |
|
// if (c) |
310 |
|
// calo_track = c; |
311 |
|
// if (o) |
312 |
|
// tof_track = o; |
313 |
|
// if (r) |
314 |
|
// orb_track = r; |
315 |
|
|
316 |
|
// candeleteobj = 0; |
317 |
|
|
318 |
|
|
319 |
|
if (t){ |
320 |
|
trk_track = new TrkTrack(*t); |
321 |
|
trk_ext_track = new ExtTrack(*t);//NB!! ha dimensione 6 invece che 8 |
322 |
|
} |
323 |
if (c) |
if (c) |
324 |
calo_track = c; |
calo_track = new CaloTrkVar(*c); |
325 |
if (o) |
if (o) |
326 |
tof_track = o; |
tof_track = new ToFTrkVar(*o); |
327 |
if (r) |
if (r) |
328 |
orb_track = r; |
orb_track = new OrbitalInfoTrkVar(*r); |
329 |
|
candeleteobj = 1; |
330 |
|
|
331 |
candeleteobj = 0; |
} |
332 |
|
; |
333 |
|
/** |
334 |
|
* Constructor |
335 |
|
*/ |
336 |
|
PamTrack::PamTrack(ExtTrack* t, CaloTrkVar* c, ToFTrkVar* o, OrbitalInfoTrkVar *r) { |
337 |
|
|
338 |
|
trk_ext_track = 0; |
339 |
|
trk_track = 0; |
340 |
|
calo_track = 0; |
341 |
|
tof_track = 0; |
342 |
|
orb_track = 0; |
343 |
|
// if(t)trk_track = new TrkTrack(*t); |
344 |
|
// if(c)calo_track = new CaloTrkVar(*c); |
345 |
|
// if(o)tof_track = new ToFTrkVar(*o); |
346 |
|
// if (t) |
347 |
|
// trk_track = t; |
348 |
|
// if (c) |
349 |
|
// calo_track = c; |
350 |
|
// if (o) |
351 |
|
// tof_track = o; |
352 |
|
// if (r) |
353 |
|
// orb_track = r; |
354 |
|
|
355 |
|
// candeleteobj = 0; |
356 |
|
|
357 |
|
|
358 |
|
if (t){ |
359 |
|
//// trk_track = new TrkTrack(*t);//in this case TrkTrack object remains null |
360 |
|
trk_ext_track = new ExtTrack(*t); |
361 |
|
} |
362 |
|
if (c) |
363 |
|
calo_track = new CaloTrkVar(*c); |
364 |
|
if (o) |
365 |
|
tof_track = new ToFTrkVar(*o); |
366 |
|
if (r) |
367 |
|
orb_track = new OrbitalInfoTrkVar(*r); |
368 |
|
candeleteobj = 1; |
369 |
|
pscore = 0; |
370 |
|
iscore = 0; |
371 |
|
|
372 |
} |
} |
373 |
; |
; |
391 |
if (r) |
if (r) |
392 |
orb_track = new OrbitalInfoTrkVar(*r); |
orb_track = new OrbitalInfoTrkVar(*r); |
393 |
candeleteobj = 1; |
candeleteobj = 1; |
394 |
|
pscore = 0; |
395 |
|
iscore = 0; |
396 |
|
|
397 |
} |
} |
398 |
void PamTrack::Clear() { |
void PamTrack::Clear() { |
399 |
|
|
400 |
// cout << "PamTrack::Clear() "<<candeleteobj<<endl; |
// cout << "PamTrack::Clear() "<<candeleteobj<<endl; |
401 |
if (candeleteobj) { |
if (candeleteobj) { |
402 |
|
|
403 |
|
if (trk_ext_track) |
404 |
|
trk_ext_track->ExtTrack::Clear(); |
405 |
if (trk_track) |
if (trk_track) |
406 |
trk_track->TrkTrack::Clear(); |
trk_track->TrkTrack::Clear(); |
407 |
if (calo_track) |
if (calo_track) |
412 |
orb_track->OrbitalInfoTrkVar::Clear();//??? |
orb_track->OrbitalInfoTrkVar::Clear();//??? |
413 |
} |
} |
414 |
else { |
else { |
415 |
|
trk_ext_track = 0; |
416 |
trk_track = 0; |
trk_track = 0; |
417 |
calo_track = 0; |
calo_track = 0; |
418 |
tof_track = 0; |
tof_track = 0; |
425 |
void PamTrack::Delete() { |
void PamTrack::Delete() { |
426 |
// cout << "PamTrack::Delete() "<<candeleteobj<<endl; |
// cout << "PamTrack::Delete() "<<candeleteobj<<endl; |
427 |
if (candeleteobj) { |
if (candeleteobj) { |
428 |
|
if (trk_ext_track) { |
429 |
|
trk_ext_track->ExtTrack::Clear(); |
430 |
|
delete trk_ext_track; |
431 |
|
} |
432 |
if (trk_track) { |
if (trk_track) { |
433 |
trk_track->TrkTrack::Clear(); |
trk_track->TrkTrack::Clear(); |
434 |
delete trk_track; |
delete trk_track; |
450 |
Clear(); |
Clear(); |
451 |
} |
} |
452 |
} |
} |
453 |
|
|
454 |
|
|
455 |
|
|
456 |
|
|
457 |
//-------------------------------------- |
//-------------------------------------- |
458 |
// |
// |
459 |
// |
// |
487 |
GetPamTree(listf, detlist); |
GetPamTree(listf, detlist); |
488 |
if (listf) |
if (listf) |
489 |
GetRunTree(listf); |
GetRunTree(listf); |
490 |
this->SetMaxShift(-1); |
SetMaxShift(-1); |
491 |
} |
} |
492 |
|
|
493 |
|
|
495 |
Initialize(); |
Initialize(); |
496 |
GetPamTree(llist, detlist); |
GetPamTree(llist, detlist); |
497 |
GetRunTree(llist); |
GetRunTree(llist); |
498 |
this->SetMaxShift(-1); |
SetMaxShift(-1); |
499 |
} |
} |
500 |
|
|
501 |
/** |
/** |
507 |
*/ |
*/ |
508 |
PamLevel2::PamLevel2(TString ddir, TString llist) { |
PamLevel2::PamLevel2(TString ddir, TString llist) { |
509 |
Initialize(); |
Initialize(); |
510 |
TList* listf = GetListOfLevel2Files(ddir, llist); |
TList* listf = GetListOfLevel2Files(ddir, llist); |
511 |
|
cout << "GetPamTree: "<<endl; |
512 |
GetPamTree(listf, ""); |
GetPamTree(listf, ""); |
513 |
|
cout << "GetRunTree: "<<endl; |
514 |
GetRunTree(listf); |
GetRunTree(listf); |
515 |
this->SetMaxShift(-1); |
SetMaxShift(-1); |
516 |
} |
} |
517 |
|
|
518 |
|
|
527 |
trkh_obj = 0; |
trkh_obj = 0; |
528 |
calo1_obj = 0; |
calo1_obj = 0; |
529 |
calo2_obj = 0; |
calo2_obj = 0; |
530 |
tof_obj = 0; |
tof2_obj = 0; |
531 |
trig_obj = 0; |
trig_obj = 0; |
532 |
s4_obj = 0; |
s4_obj = 0; |
533 |
nd_obj = 0; |
nd_obj = 0; |
534 |
ac_obj = 0; |
ac_obj = 0; |
535 |
orb_obj = 0; |
orb2_obj = 0; |
536 |
gp_obj = 0; |
gp_obj = 0; |
537 |
|
|
538 |
|
extAlgFlag=0; |
539 |
|
|
540 |
|
trk_ext_obj = 0; |
541 |
|
trk_ext_nuc_obj = 0; |
542 |
|
trk_nuc_obj = 0; |
543 |
|
|
544 |
|
calo_ext_obj = 0; |
545 |
|
calo_ext_nuc_obj = 0; |
546 |
|
calo_nuc_obj = 0; |
547 |
|
|
548 |
|
tof_ext_obj = 0; |
549 |
|
tof_ext_nuc_obj = 0; |
550 |
|
tof_nuc_obj = 0; |
551 |
|
|
552 |
|
orb_ext_obj = 0; |
553 |
|
orb_ext_nuc_obj = 0; |
554 |
|
orb_nuc_obj = 0; |
555 |
|
|
556 |
|
trk2_nuc_obj = 0; |
557 |
|
calo2_nuc_obj = 0; |
558 |
|
tof2_nuc_obj = 0; |
559 |
|
orb2_nuc_obj = 0; |
560 |
|
|
561 |
|
|
562 |
run_obj = 0;//new GL_RUN(); |
run_obj = 0;//new GL_RUN(); |
563 |
soft_obj = 0;// Emiliano |
soft_obj = 0;// Emiliano |
564 |
irun = -1LL; |
irun = -1LL; |
635 |
ORB = true; |
ORB = true; |
636 |
GP = false; |
GP = false; |
637 |
|
|
638 |
|
EXT = false; |
639 |
|
NUC = false; |
640 |
|
trkAlg = "";//default tracking algorythm |
641 |
|
|
642 |
RUN = true; |
RUN = true; |
643 |
|
|
644 |
SELLI = -1; |
SELLI = -1; |
649 |
|
|
650 |
tsorted = 0; |
tsorted = 0; |
651 |
timage = 0; |
timage = 0; |
652 |
|
text = 0 ; |
653 |
|
|
654 |
|
tsorted_nuc = 0; |
655 |
|
timage_nuc = 0; |
656 |
|
text_nuc = 0 ; |
657 |
|
|
658 |
howtosort = "+CAL+TOF"; |
howtosort = "+CAL+TOF"; |
659 |
//howtosort = "+TOF"; |
//howtosort = "+TOF"; |
661 |
|
|
662 |
issorted = false; |
issorted = false; |
663 |
lastsorted = -1; |
lastsorted = -1; |
664 |
|
issorted_new = false; |
665 |
|
lastsorted_new = -1; |
666 |
|
|
667 |
} |
} |
668 |
; |
; |
693 |
delete calo1_obj; |
delete calo1_obj; |
694 |
if (calo2_obj) |
if (calo2_obj) |
695 |
delete calo2_obj; |
delete calo2_obj; |
696 |
if (tof_obj) |
if (tof2_obj) |
697 |
delete tof_obj; |
delete tof2_obj; |
698 |
if (trig_obj) |
if (trig_obj) |
699 |
delete trig_obj; |
delete trig_obj; |
700 |
if (s4_obj) |
if (s4_obj) |
703 |
delete nd_obj; |
delete nd_obj; |
704 |
if (ac_obj) |
if (ac_obj) |
705 |
delete ac_obj; |
delete ac_obj; |
706 |
if (orb_obj) |
if (orb2_obj) |
707 |
delete orb_obj; |
delete orb2_obj; |
708 |
if (gp_obj) |
if (gp_obj) |
709 |
delete gp_obj; |
delete gp_obj; |
710 |
|
|
711 |
|
if(trk_nuc_obj)trk_nuc_obj->Delete(); |
712 |
|
if(trk_ext_obj)trk_ext_obj->Delete(); |
713 |
|
if(trk_ext_nuc_obj)trk_ext_nuc_obj->Delete(); |
714 |
|
|
715 |
|
if(calo_nuc_obj)calo_nuc_obj->Delete(); |
716 |
|
if(calo_ext_obj)calo_ext_obj->Delete(); |
717 |
|
if(calo_ext_nuc_obj)calo_ext_nuc_obj->Delete(); |
718 |
|
|
719 |
|
if(tof_nuc_obj)tof_nuc_obj->Delete(); |
720 |
|
if(tof_ext_obj)tof_ext_obj->Delete(); |
721 |
|
if(tof_ext_nuc_obj)tof_ext_nuc_obj->Delete(); |
722 |
|
|
723 |
|
if(orb_nuc_obj)orb_nuc_obj->Delete(); |
724 |
|
if(orb_ext_obj)orb_ext_obj->Delete(); |
725 |
|
if(orb_ext_nuc_obj)orb_ext_nuc_obj->Delete(); |
726 |
|
|
727 |
|
|
728 |
|
if(trk2_nuc_obj)trk2_nuc_obj->Delete();; |
729 |
|
if( calo2_nuc_obj)calo2_nuc_obj->Delete();; |
730 |
|
if(tof2_nuc_obj)tof2_nuc_obj->Delete();; |
731 |
|
if(orb2_nuc_obj)orb2_nuc_obj->Delete();; |
732 |
|
|
733 |
|
|
734 |
|
|
735 |
if (tsorted) { |
if (tsorted) { |
736 |
tsorted->Delete(); |
tsorted->Delete(); |
737 |
delete tsorted; |
delete tsorted; |
740 |
timage->Delete(); |
timage->Delete(); |
741 |
delete timage; |
delete timage; |
742 |
} |
} |
743 |
|
if (text) { |
744 |
|
text->Delete(); |
745 |
|
delete text; |
746 |
|
} |
747 |
|
if (tsorted_nuc) { |
748 |
|
tsorted_nuc->Delete(); |
749 |
|
delete tsorted_nuc; |
750 |
|
} |
751 |
|
if (timage_nuc) { |
752 |
|
timage_nuc->Delete(); |
753 |
|
delete timage_nuc; |
754 |
|
} |
755 |
|
if (text_nuc) { |
756 |
|
text_nuc->Delete(); |
757 |
|
delete text_nuc; |
758 |
|
} |
759 |
|
|
760 |
|
|
761 |
|
|
762 |
if (dbc) { |
if (dbc) { |
763 |
dbc->Close(); |
dbc->Close(); |
825 |
if (irunoffset) |
if (irunoffset) |
826 |
delete[] irunoffset; |
delete[] irunoffset; |
827 |
|
|
828 |
|
|
829 |
|
Initialize(); |
830 |
|
|
831 |
} |
} |
832 |
; |
; |
833 |
|
|
861 |
calo1_obj->Clear(); |
calo1_obj->Clear(); |
862 |
if (calo2_obj) |
if (calo2_obj) |
863 |
calo2_obj->Clear(); |
calo2_obj->Clear(); |
864 |
if (tof_obj) |
if (tof2_obj) |
865 |
tof_obj->Clear(); |
tof2_obj->Clear(); |
866 |
if (trig_obj) |
if (trig_obj) |
867 |
trig_obj->Clear(); |
trig_obj->Clear(); |
868 |
if (s4_obj) |
if (s4_obj) |
871 |
nd_obj->Clear(); |
nd_obj->Clear(); |
872 |
if (ac_obj) |
if (ac_obj) |
873 |
ac_obj->Clear(); |
ac_obj->Clear(); |
874 |
if (orb_obj) |
if (orb2_obj) |
875 |
orb_obj->Clear(); |
orb2_obj->Clear(); |
876 |
if (gp_obj) |
if (gp_obj) |
877 |
gp_obj->Clear(); |
gp_obj->Clear(); |
878 |
|
|
879 |
// if(sorted_tracks)sorted_tracks->Clear(); |
// if(sorted_tracks)sorted_tracks->Clear(); |
880 |
// sorted_tracks.Clear(); |
// sorted_tracks.Clear(); |
881 |
|
|
882 |
if (tsorted) { |
if(trk_nuc_obj)trk_nuc_obj->Clear(); |
883 |
tsorted->Delete(); |
if(trk_ext_obj)trk_ext_obj->Clear(); |
884 |
} |
if(trk_ext_nuc_obj)trk_ext_nuc_obj->Clear(); |
885 |
if (timage) { |
|
886 |
timage->Delete(); |
if(calo_nuc_obj)calo_nuc_obj->Clear(); |
887 |
} |
if(calo_ext_obj)calo_ext_obj->Clear(); |
888 |
|
if(calo_ext_nuc_obj)calo_ext_nuc_obj->Clear(); |
889 |
|
|
890 |
|
if(tof_nuc_obj)tof_nuc_obj->Clear(); |
891 |
|
if(tof_ext_obj)tof_ext_obj->Clear(); |
892 |
|
if(tof_ext_nuc_obj)tof_ext_nuc_obj->Clear(); |
893 |
|
|
894 |
|
if(orb_nuc_obj)orb_nuc_obj->Clear(); |
895 |
|
if(orb_ext_obj)orb_ext_obj->Clear(); |
896 |
|
if(orb_ext_nuc_obj)orb_ext_nuc_obj->Clear(); |
897 |
|
|
898 |
|
if(trk2_nuc_obj)trk2_nuc_obj->Clear();; |
899 |
|
if( calo2_nuc_obj)calo2_nuc_obj->Clear();; |
900 |
|
if(tof2_nuc_obj)tof2_nuc_obj->Clear();; |
901 |
|
if(orb2_nuc_obj)orb2_nuc_obj->Clear();; |
902 |
|
|
903 |
|
if (tsorted)tsorted->Delete(); |
904 |
|
if (timage)timage->Delete(); |
905 |
|
if (text) text->Delete(); |
906 |
|
|
907 |
|
if (tsorted_nuc)tsorted_nuc->Delete(); |
908 |
|
if (timage_nuc)timage_nuc->Delete(); |
909 |
|
if (text_nuc) text_nuc->Delete(); |
910 |
} |
} |
911 |
; |
; |
912 |
|
|
971 |
trkh_obj = 0; |
trkh_obj = 0; |
972 |
calo1_obj = 0; |
calo1_obj = 0; |
973 |
calo2_obj = 0; |
calo2_obj = 0; |
974 |
tof_obj = 0; |
tof2_obj = 0; |
975 |
trig_obj = 0; |
trig_obj = 0; |
976 |
s4_obj = 0; |
s4_obj = 0; |
977 |
nd_obj = 0; |
nd_obj = 0; |
978 |
ac_obj = 0; |
ac_obj = 0; |
979 |
orb_obj = 0; |
orb2_obj = 0; |
980 |
gp_obj = 0; |
gp_obj = 0; |
981 |
|
|
982 |
|
trk_ext_obj = 0; |
983 |
|
trk_ext_nuc_obj = 0; |
984 |
|
trk_nuc_obj = 0; |
985 |
|
|
986 |
|
calo_ext_obj = 0; |
987 |
|
calo_ext_nuc_obj = 0; |
988 |
|
calo_nuc_obj = 0; |
989 |
|
|
990 |
|
tof_ext_obj = 0; |
991 |
|
tof_ext_nuc_obj = 0; |
992 |
|
tof_nuc_obj = 0; |
993 |
|
|
994 |
|
orb_ext_obj = 0; |
995 |
|
orb_ext_nuc_obj = 0; |
996 |
|
orb_nuc_obj = 0; |
997 |
|
|
998 |
|
trk2_nuc_obj = 0; |
999 |
|
calo2_nuc_obj = 0; |
1000 |
|
tof2_nuc_obj = 0; |
1001 |
|
orb2_nuc_obj = 0; |
1002 |
|
|
1003 |
|
trk2_nuc_obj = 0; |
1004 |
|
calo2_nuc_obj = 0; |
1005 |
|
tof2_nuc_obj = 0; |
1006 |
|
orb2_nuc_obj = 0; |
1007 |
// |
// |
1008 |
// Reset run pointers |
// Reset run pointers |
1009 |
// |
// |
1038 |
if (strict) { |
if (strict) { |
1039 |
if (trk2_obj && trk2_obj->UnpackError() != 0) |
if (trk2_obj && trk2_obj->UnpackError() != 0) |
1040 |
goodev = false; |
goodev = false; |
1041 |
if (tof_obj && tof_obj->unpackError != 0) |
if (tof2_obj && tof2_obj->unpackError != 0) |
1042 |
goodev = false; |
goodev = false; |
1043 |
if (trig_obj && trig_obj->unpackError != 0) |
if (trig_obj && trig_obj->unpackError != 0) |
1044 |
goodev = false; |
goodev = false; |
1048 |
goodev = false; |
goodev = false; |
1049 |
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))) |
1050 |
goodev = false; |
goodev = false; |
1051 |
// if(orb_obj) |
// if(orb2_obj) |
1052 |
} |
} |
1053 |
else { |
else { |
1054 |
if (nd_obj && nd_obj->unpackError != 0) |
if (nd_obj && nd_obj->unpackError != 0) |
1079 |
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"); |
1080 |
maxshift = sh; |
maxshift = sh; |
1081 |
} else { |
} else { |
1082 |
ULong64_t nev = this->GetEntries(); |
ULong64_t nev = GetEntries(); |
1083 |
ULong64_t runnev = 0ULL; |
ULong64_t runnev = 0ULL; |
1084 |
for (Int_t r=0; r< run_tree->GetEntries();r++){ |
for (Int_t r=0; r< run_tree->GetEntries();r++){ |
1085 |
run_tree->GetEntry(r);//update runinfo |
run_tree->GetEntry(r);//update runinfo |
1134 |
return &calo2_obj; |
return &calo2_obj; |
1135 |
}; |
}; |
1136 |
if (!objname.CompareTo("ToFLevel2")) { |
if (!objname.CompareTo("ToFLevel2")) { |
1137 |
if (!tof_obj) { |
if (!tof2_obj) { |
1138 |
tof_obj = new ToFLevel2(); |
tof2_obj = new ToFLevel2(); |
1139 |
tof_obj->Set(); |
tof2_obj->Set(); |
1140 |
} |
} |
1141 |
return &tof_obj; |
return &tof2_obj; |
1142 |
}; |
}; |
1143 |
if (!objname.CompareTo("TrigLevel2")) { |
if (!objname.CompareTo("TrigLevel2")) { |
1144 |
if (!trig_obj) |
if (!trig_obj) |
1161 |
return &ac_obj; |
return &ac_obj; |
1162 |
}; |
}; |
1163 |
if (!objname.CompareTo("OrbitalInfo")) { |
if (!objname.CompareTo("OrbitalInfo")) { |
1164 |
if (!orb_obj) { |
if (!orb2_obj) { |
1165 |
orb_obj = new OrbitalInfo(); |
orb2_obj = new OrbitalInfo(); |
1166 |
orb_obj->Set(); |
orb2_obj->Set(); |
1167 |
} |
} |
1168 |
return &orb_obj; |
return &orb2_obj; |
1169 |
}; |
}; |
1170 |
// if(!objname.CompareTo("OrbitalInfo")){ |
// if(!objname.CompareTo("OrbitalInfo")){ |
1171 |
// if(!orb_obj) orb_obj = new OrbitalInfo(); |
// if(!orb2_obj) orb2_obj = new OrbitalInfo(); |
1172 |
// return &orb_obj; |
// return &orb2_obj; |
1173 |
// }; |
// }; |
1174 |
if (!objname.CompareTo("GPamela")) { |
if (!objname.CompareTo("GPamela")) { |
1175 |
if (!gp_obj) |
if (!gp_obj) |
1233 |
*/ |
*/ |
1234 |
ToFTrkVar *PamLevel2::GetToFStoredTrack(int seqno) { |
ToFTrkVar *PamLevel2::GetToFStoredTrack(int seqno) { |
1235 |
|
|
1236 |
if (!tof_obj) |
if (!tof2_obj) |
1237 |
return 0; |
return 0; |
1238 |
|
|
1239 |
if (tof_obj->ToFLevel2::ntrk() == 0) { |
if (tof2_obj->ToFLevel2::ntrk() == 0) { |
1240 |
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" |
1241 |
<< endl; |
<< endl; |
1242 |
return NULL; |
return NULL; |
1246 |
Int_t it_tof = 0; |
Int_t it_tof = 0; |
1247 |
|
|
1248 |
do { |
do { |
1249 |
c = tof_obj->ToFLevel2::GetToFTrkVar(it_tof); |
c = tof2_obj->ToFLevel2::GetToFTrkVar(it_tof); |
1250 |
it_tof++; |
it_tof++; |
1251 |
} while (c && seqno != c->trkseqno && it_tof < tof_obj->ToFLevel2::ntrk()); |
} while (c && seqno != c->trkseqno && it_tof < tof2_obj->ToFLevel2::ntrk()); |
1252 |
|
|
1253 |
if (!c || seqno != c->trkseqno) { |
if (!c || seqno != c->trkseqno) { |
1254 |
c = 0; |
c = 0; |
1271 |
*/ |
*/ |
1272 |
OrbitalInfoTrkVar *PamLevel2::GetOrbitalInfoStoredTrack(int seqno) { |
OrbitalInfoTrkVar *PamLevel2::GetOrbitalInfoStoredTrack(int seqno) { |
1273 |
|
|
1274 |
if (!orb_obj) |
if (!orb2_obj) |
1275 |
return 0; |
return 0; |
1276 |
|
|
1277 |
if (orb_obj->OrbitalInfo::ntrk() == 0) { |
if (orb2_obj->OrbitalInfo::ntrk() == 0) { |
1278 |
// // TRICK BEGIN |
// // TRICK BEGIN |
1279 |
// OrbitalInfoTrkVar *r = new OrbitalInfoTrkVar(); // TEMPORARY TRICK |
// OrbitalInfoTrkVar *r = new OrbitalInfoTrkVar(); // TEMPORARY TRICK |
1280 |
// Int_t nn = 0; |
// Int_t nn = 0; |
1281 |
// TClonesArray &tor = *orb_obj->OrbitalInfoTrk; |
// TClonesArray &tor = *orb2_obj->OrbitalInfoTrk; |
1282 |
// for(Int_t nt=0; nt < tof_obj->ToFLevel2::ntrk(); nt++){ |
// for(Int_t nt=0; nt < tof2_obj->ToFLevel2::ntrk(); nt++){ |
1283 |
// // |
// // |
1284 |
// ToFTrkVar *ptt = tof_obj->ToFLevel2::GetToFTrkVar(nt); |
// ToFTrkVar *ptt = tof2_obj->ToFLevel2::GetToFTrkVar(nt); |
1285 |
// if ( ptt->trkseqno != -1 ){ |
// if ( ptt->trkseqno != -1 ){ |
1286 |
// // |
// // |
1287 |
// r->trkseqno = ptt->trkseqno; |
// r->trkseqno = ptt->trkseqno; |
1303 |
// }; |
// }; |
1304 |
// delete r; |
// delete r; |
1305 |
// OrbitalInfoTrkVar *c = 0; |
// OrbitalInfoTrkVar *c = 0; |
1306 |
// c = orb_obj->OrbitalInfo::GetOrbitalInfoTrkVar(0); |
// c = orb2_obj->OrbitalInfo::GetOrbitalInfoTrkVar(0); |
1307 |
// return c; |
// return c; |
1308 |
// //TRICK END |
// //TRICK END |
1309 |
cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo " << seqno |
cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo " << seqno |
1315 |
Int_t it_tof = 0; |
Int_t it_tof = 0; |
1316 |
|
|
1317 |
do { |
do { |
1318 |
c = orb_obj->OrbitalInfo::GetOrbitalInfoTrkVar(it_tof); |
c = orb2_obj->OrbitalInfo::GetOrbitalInfoTrkVar(it_tof); |
1319 |
it_tof++; |
it_tof++; |
1320 |
} while (c && seqno != c->trkseqno && it_tof < orb_obj->OrbitalInfo::ntrk()); |
} while (c && seqno != c->trkseqno && it_tof < orb2_obj->OrbitalInfo::ntrk()); |
1321 |
|
|
1322 |
if (!c || seqno != c->trkseqno) { |
if (!c || seqno != c->trkseqno) { |
1323 |
c = 0; |
c = 0; |
1456 |
timage->Delete(); |
timage->Delete(); |
1457 |
TClonesArray &ttimage = *timage; |
TClonesArray &ttimage = *timage; |
1458 |
|
|
1459 |
|
|
1460 |
|
|
1461 |
//-------------------------------------------------- |
//-------------------------------------------------- |
1462 |
// retrieve sorting method |
// retrieve sorting method |
1463 |
//-------------------------------------------------- |
//-------------------------------------------------- |
1573 |
// ----------------------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------------------- |
1574 |
// check the number of hit pmts along the track |
// check the number of hit pmts along the track |
1575 |
// on S12 S21 and S32, where paddles are parallel to Y axis |
// on S12 S21 and S32, where paddles are parallel to Y axis |
1576 |
if ((use_TOF || use_S1 || use_S2 || use_S3) && !tof_obj) { |
if ((use_TOF || use_S1 || use_S2 || use_S3) && !tof2_obj) { |
1577 |
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but ToFLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but ToFLevel2 not loaded !!!"; |
1578 |
return; |
return; |
1579 |
}; |
}; |
1590 |
// |
// |
1591 |
Float_t sen = 0.; |
Float_t sen = 0.; |
1592 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1593 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1594 |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
1595 |
sen += (op->dedx).At(ih); |
sen += (op->dedx).At(ih); |
1596 |
}; |
}; |
1597 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1598 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1599 |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
1600 |
sen += (oi->dedx).At(ih); |
sen += (oi->dedx).At(ih); |
1601 |
}; |
}; |
1608 |
Int_t nz = 6; |
Int_t nz = 6; |
1609 |
Float_t zin[6]; // << define TOF z-coordinates |
Float_t zin[6]; // << define TOF z-coordinates |
1610 |
for (Int_t ip = 0; ip < nz; ip++) |
for (Int_t ip = 0; ip < nz; ip++) |
1611 |
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 |
1612 |
Trajectory *tr = new Trajectory(nz, zin); |
Trajectory *tr = new Trajectory(nz, zin); |
1613 |
// |
// |
1614 |
Int_t nphit_p = 0; |
Int_t nphit_p = 0; |
1617 |
Float_t enhit_i = 0.; |
Float_t enhit_i = 0.; |
1618 |
// |
// |
1619 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1620 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1621 |
if (pl == 1 || pl == 2 || pl == 5) { |
if (pl == 1 || pl == 2 || pl == 5) { |
1622 |
nphit_p++; |
nphit_p++; |
1623 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1628 |
// |
// |
1629 |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
1630 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1631 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1632 |
if (pl == 0) { |
if (pl == 0) { |
1633 |
nphit_p++; |
nphit_p++; |
1634 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1637 |
}; |
}; |
1638 |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
1639 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1640 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1641 |
if (pl == 3) { |
if (pl == 3) { |
1642 |
nphit_p++; |
nphit_p++; |
1643 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1646 |
}; |
}; |
1647 |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
1648 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1649 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1650 |
if (pl == 4) { |
if (pl == 4) { |
1651 |
nphit_p++; |
nphit_p++; |
1652 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1655 |
}; |
}; |
1656 |
|
|
1657 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1658 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1659 |
if (pl == 1 || pl == 2 || pl == 5) { |
if (pl == 1 || pl == 2 || pl == 5) { |
1660 |
nphit_i++; |
nphit_i++; |
1661 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1666 |
// |
// |
1667 |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
1668 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1669 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1670 |
if (pl == 0) { |
if (pl == 0) { |
1671 |
nphit_i++; |
nphit_i++; |
1672 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1675 |
}; |
}; |
1676 |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
1677 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1678 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1679 |
if (pl == 3) { |
if (pl == 3) { |
1680 |
nphit_i++; |
nphit_i++; |
1681 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1684 |
}; |
}; |
1685 |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
1686 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1687 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1688 |
if (pl == 4) { |
if (pl == 4) { |
1689 |
nphit_i++; |
nphit_i++; |
1690 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1728 |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
1729 |
|
|
1730 |
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
1731 |
// Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
// Int_t pl = tof2_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
1732 |
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
1733 |
// }; |
// }; |
1734 |
|
|
1735 |
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
1736 |
// Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
// Int_t pl = tof2_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
1737 |
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
1738 |
// }; |
// }; |
1739 |
// --- modified to count tdc signals (more efficient?) |
// --- modified to count tdc signals (more efficient?) |
1740 |
// --- and to implement check on tdcflag |
// --- and to implement check on tdcflag |
1741 |
for (Int_t ih = 0; ih < op->npmttdc; ih++) { |
for (Int_t ih = 0; ih < op->npmttdc; ih++) { |
1742 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmttdc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmttdc).At(ih)); |
1743 |
// 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++; |
1744 |
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)) |
1745 |
|| (use_S3 && (pl == 4 || pl == 5))) { |
|| (use_S3 && (pl == 4 || pl == 5))) { |
1749 |
}; |
}; |
1750 |
|
|
1751 |
for (Int_t ih = 0; ih < oi->npmttdc; ih++) { |
for (Int_t ih = 0; ih < oi->npmttdc; ih++) { |
1752 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmttdc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmttdc).At(ih)); |
1753 |
// 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++; |
1754 |
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)) |
1755 |
|| (use_S3 && (pl == 4 || pl == 5))) { |
|| (use_S3 && (pl == 4 || pl == 5))) { |
1924 |
|
|
1925 |
} |
} |
1926 |
; |
; |
1927 |
|
// |
1928 |
|
//-------------------------------------- |
1929 |
|
/** |
1930 |
|
* Sort physical (tracker) tracks. |
1931 |
|
* @param how String to set the sorting cryterium (es: "CAL" or "TRK+CAL+TOF" ecc...). |
1932 |
|
* Sorting cryteria: |
1933 |
|
* TRK: lower chi**2 |
1934 |
|
* CAL: lower Y spatial residual on the first calorimeter plane |
1935 |
|
* TOF: bigger numebr of hit PMTs along the track, on S12 S21 S32 (where paddles are along the Y axis). |
1936 |
|
* S1: (ask Emiliano) |
1937 |
|
* S2: (ask Emiliano) |
1938 |
|
* S3: (ask Emiliano) |
1939 |
|
* GP: more GP hits |
1940 |
|
* The default sorting cryterium is "TOF+CAL". |
1941 |
|
* |
1942 |
|
* 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). |
1943 |
|
* |
1944 |
|
* New version, with handling of extended tracks and nuclei tracks. |
1945 |
|
*/ |
1946 |
|
void PamLevel2::SortTracksNew() { |
1947 |
|
|
1948 |
|
//-------------------------------------------------- |
1949 |
|
//Check if the current event has already been sorted |
1950 |
|
//-------------------------------------------------- |
1951 |
|
if (issorted_new && lastsorted_new == GetReadEntry()) { |
1952 |
|
return; //already done for this event |
1953 |
|
} |
1954 |
|
|
1955 |
|
|
1956 |
|
// cout << "SORT" << endl; |
1957 |
|
|
1958 |
|
//Reset the sort flags, just in case something will go wrong... |
1959 |
|
issorted_new = false; |
1960 |
|
lastsorted_new = -1; |
1961 |
|
|
1962 |
|
//-------------------------------------------------- |
1963 |
|
// set input variables |
1964 |
|
//-------------------------------------------------- |
1965 |
|
|
1966 |
|
TString how = howtosort; |
1967 |
|
//Save current Object count |
1968 |
|
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
1969 |
|
|
1970 |
|
|
1971 |
|
|
1972 |
|
|
1973 |
|
TrkLevel2 * trk2 ; |
1974 |
|
CaloLevel2 * calo2; |
1975 |
|
ToFLevel2 * tof2 ; |
1976 |
|
OrbitalInfo * orb2 ; |
1977 |
|
|
1978 |
|
TClonesArray * trkext ; |
1979 |
|
TClonesArray * caloext; |
1980 |
|
TClonesArray * tofext ; |
1981 |
|
TClonesArray * orbext ; |
1982 |
|
|
1983 |
|
|
1984 |
|
// cout << "trk2_obj" << trk2_obj<< endl; |
1985 |
|
// cout << "trk2_nuc_obj" << trk2_nuc_obj<< endl; |
1986 |
|
// cout << " trk_ext_obj "<<trk_ext_obj<< endl; |
1987 |
|
// cout << " trk_ext_nuc_obj "<<trk_ext_nuc_obj<< endl; |
1988 |
|
|
1989 |
|
//----------------------------------------------------------- |
1990 |
|
// create/reset TCloneArrays to store tracks and their images |
1991 |
|
//----------------------------------------------------------- |
1992 |
|
|
1993 |
|
// main tracks from standard alg |
1994 |
|
if (!tsorted) |
1995 |
|
tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
1996 |
|
tsorted->Delete(); |
1997 |
|
// track images from standard alg |
1998 |
|
if (!timage) |
1999 |
|
timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2000 |
|
timage->Delete(); |
2001 |
|
// tracks from extended algorythm |
2002 |
|
if(EXT && !text) |
2003 |
|
text = new TClonesArray("PamTrack",trk_ext_obj->GetEntries()); |
2004 |
|
if(text)text->Delete(); |
2005 |
|
|
2006 |
|
//----------------------------------------------------------- |
2007 |
|
// create/reset TCloneArrays to store tracks and their images |
2008 |
|
//----------------------------------------------------------- |
2009 |
|
if(NUC){ |
2010 |
|
// main tracks from standard alg |
2011 |
|
if (!tsorted_nuc) |
2012 |
|
tsorted_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2013 |
|
tsorted_nuc->Delete(); |
2014 |
|
// track images from standard alg |
2015 |
|
if (!timage_nuc) |
2016 |
|
timage_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2017 |
|
timage_nuc->Delete(); |
2018 |
|
// tracks from extended algorythm |
2019 |
|
if(EXT && !text_nuc) |
2020 |
|
text_nuc = new TClonesArray("PamTrack",trk_ext_nuc_obj->GetEntries()); |
2021 |
|
if(text_nuc)text_nuc->Delete(); |
2022 |
|
} |
2023 |
|
//-------------------------------------------------- |
2024 |
|
// retrieve sorting method |
2025 |
|
//-------------------------------------------------- |
2026 |
|
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
2027 |
|
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
2028 |
|
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
2029 |
|
Bool_t use_S1 = how.Contains("S1", TString::kIgnoreCase); |
2030 |
|
Bool_t use_S2 = how.Contains("S2", TString::kIgnoreCase); |
2031 |
|
Bool_t use_S3 = how.Contains("S3", TString::kIgnoreCase); |
2032 |
|
Bool_t use_GP = how.Contains("GP", TString::kIgnoreCase); |
2033 |
|
|
2034 |
|
if (use_TOF) { |
2035 |
|
use_S1 = true; |
2036 |
|
use_S2 = true; |
2037 |
|
use_S3 = true; |
2038 |
|
}; |
2039 |
|
if (!CAL2 && use_CAL) |
2040 |
|
use_CAL = false; |
2041 |
|
if (!TOF) { |
2042 |
|
use_TOF = false; |
2043 |
|
use_S1 = false; |
2044 |
|
use_S2 = false; |
2045 |
|
use_S3 = false; |
2046 |
|
} |
2047 |
|
if (!GP) { |
2048 |
|
use_GP = false; |
2049 |
|
} |
2050 |
|
|
2051 |
|
if (!TRK2) { |
2052 |
|
cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
2053 |
|
return; |
2054 |
|
}; |
2055 |
|
|
2056 |
|
|
2057 |
|
/////////////////////////////////////////////////////////////////////////////////// |
2058 |
|
// |
2059 |
|
// sort tracks and fill PamTrack arrays |
2060 |
|
// |
2061 |
|
/////////////////////////////////////////////////////////////////////////////////// |
2062 |
|
for(int doit=0; doit<2; doit++){ |
2063 |
|
|
2064 |
|
// cout << "doit "<<doit<<endl; |
2065 |
|
|
2066 |
|
|
2067 |
|
if(doit == 0){ |
2068 |
|
|
2069 |
|
trk2 = trk2_obj; |
2070 |
|
calo2 = calo2_obj; |
2071 |
|
tof2 = tof2_obj; |
2072 |
|
orb2 = orb2_obj; |
2073 |
|
|
2074 |
|
trkext = trk_ext_obj; |
2075 |
|
caloext = calo_ext_obj; |
2076 |
|
tofext = tof_ext_obj; |
2077 |
|
orbext = orb_ext_obj; |
2078 |
|
|
2079 |
|
|
2080 |
|
|
2081 |
|
|
2082 |
|
|
2083 |
|
}else if (doit == 1){ |
2084 |
|
|
2085 |
|
if(!NUC)break; |
2086 |
|
|
2087 |
|
|
2088 |
|
trk2 = trk2_nuc_obj; |
2089 |
|
calo2 = calo2_nuc_obj; |
2090 |
|
tof2 = tof2_nuc_obj; |
2091 |
|
orb2 = orb2_nuc_obj; |
2092 |
|
|
2093 |
|
trkext = trk_ext_nuc_obj; |
2094 |
|
caloext = calo_ext_nuc_obj; |
2095 |
|
tofext = tof_ext_nuc_obj; |
2096 |
|
orbext = orb_ext_nuc_obj; |
2097 |
|
|
2098 |
|
|
2099 |
|
|
2100 |
|
|
2101 |
|
} |
2102 |
|
|
2103 |
|
// cout << "trk2" << trk2<<endl; |
2104 |
|
// cout << "calo2" << calo2<<endl; |
2105 |
|
// cout << "tof2" << tof2<<endl; |
2106 |
|
// cout << "orb2" << orb2<<endl; |
2107 |
|
// cout << "trkext" <<trkext <<endl; |
2108 |
|
// cout << "tofext" << tofext<<endl; |
2109 |
|
// cout << "caloext" << caloext<<endl; |
2110 |
|
// cout << "orbext" << orbext<<endl; |
2111 |
|
|
2112 |
|
TClonesArray &ttext = (doit==0 ? *text : *text_nuc); |
2113 |
|
TClonesArray &ttimage = (doit==0 ? *timage : *timage_nuc); |
2114 |
|
TClonesArray &ttsorted = (doit==0 ? *tsorted : *tsorted_nuc); |
2115 |
|
|
2116 |
|
// cout << "tsorted + timage "<<doit<<endl; |
2117 |
|
|
2118 |
|
//-------------------------------------------------- |
2119 |
|
// loop over "physical" tracks sorted by the tracker |
2120 |
|
//-------------------------------------------------- |
2121 |
|
for (Int_t i = 0; i < trk2->TrkLevel2::GetNTracks(); i++) { |
2122 |
|
|
2123 |
|
TrkTrack *ts = 0; |
2124 |
|
CaloTrkVar *cs = 0; |
2125 |
|
ToFTrkVar *os = 0; |
2126 |
|
OrbitalInfoTrkVar *rs = 0; |
2127 |
|
|
2128 |
|
// get tracker tracks |
2129 |
|
TrkTrack *tp = trk2->GetTrack(i); //tracker |
2130 |
|
CaloTrkVar *cp = calo2->GetCaloStoredTrack(tp->GetSeqNo()); |
2131 |
|
ToFTrkVar *op = tof2->GetToFStoredTrack(tp->GetSeqNo()); |
2132 |
|
OrbitalInfoTrkVar *rp = orb2->GetOrbitalInfoStoredTrack(tp->GetSeqNo()); |
2133 |
|
|
2134 |
|
TrkTrack *ti = 0; //tracker (image) |
2135 |
|
CaloTrkVar *ci = 0; |
2136 |
|
ToFTrkVar *oi = 0; |
2137 |
|
OrbitalInfoTrkVar *ri = 0; |
2138 |
|
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
2139 |
|
// if track has an image, check image selection |
2140 |
|
|
2141 |
|
Int_t tp_score = 0; //main track sorted by the tracker |
2142 |
|
Int_t ti_score = 0; //image track |
2143 |
|
Int_t totp_score = 0; //main track sorted by the tracker |
2144 |
|
Int_t toti_score = 0; //image track |
2145 |
|
|
2146 |
|
if (tp->HasImage()) { |
2147 |
|
|
2148 |
|
ti = trk2->GetTrackImage(i); //tracker (image) |
2149 |
|
ci = calo2->GetCaloStoredTrack(ti->GetSeqNo()); |
2150 |
|
oi = tof2->GetToFStoredTrack(ti->GetSeqNo()); |
2151 |
|
ri = orb2->GetOrbitalInfoStoredTrack(ti->GetSeqNo()); |
2152 |
|
|
2153 |
|
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
2154 |
|
|
2155 |
|
//assign starting scores |
2156 |
|
tp_score = 0; //main track sorted by the tracker |
2157 |
|
ti_score = 0; //image track |
2158 |
|
|
2159 |
|
// ----------------------------------------------------------------------------------------- |
2160 |
|
// ***************************************************************************************** |
2161 |
|
// ----------------------------------------------------------------------------------------- |
2162 |
|
// calorimeter check |
2163 |
|
// ----------------------------------------------------------------------------------------- |
2164 |
|
if (use_CAL && !calo2) { |
2165 |
|
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but CaloLevel2 not loaded !!!"; |
2166 |
|
return; |
2167 |
|
}; |
2168 |
|
if (use_CAL && !cp && ci) { |
2169 |
|
ti_score++; |
2170 |
|
toti_score++; |
2171 |
|
}; |
2172 |
|
if (use_CAL && cp && !ci) { |
2173 |
|
tp_score++; |
2174 |
|
totp_score++; |
2175 |
|
}; |
2176 |
|
if (use_CAL && cp && ci && true) { |
2177 |
|
|
2178 |
|
if (cp->npresh > ci->npresh && true) { |
2179 |
|
tp_score++; |
2180 |
|
totp_score++; |
2181 |
|
}; |
2182 |
|
if (cp->npresh < ci->npresh && true) { |
2183 |
|
ti_score++; |
2184 |
|
toti_score++; |
2185 |
|
}; |
2186 |
|
|
2187 |
|
// cout << "CALO "<<tp_score<<ti_score<<endl; |
2188 |
|
|
2189 |
|
}; |
2190 |
|
// ----------------------------------------------------------------------------------------- |
2191 |
|
// ***************************************************************************************** |
2192 |
|
// ----------------------------------------------------------------------------------------- |
2193 |
|
// TOF check |
2194 |
|
// ----------------------------------------------------------------------------------------- |
2195 |
|
// check the number of hit pmts along the track |
2196 |
|
// on S12 S21 and S32, where paddles are parallel to Y axis |
2197 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && !tof2) { |
2198 |
|
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but ToFLevel2 not loaded !!!"; |
2199 |
|
return; |
2200 |
|
}; |
2201 |
|
// |
2202 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && !op && oi) { |
2203 |
|
ti_score++; |
2204 |
|
toti_score++; |
2205 |
|
}; |
2206 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && op && !oi) { |
2207 |
|
tp_score++; |
2208 |
|
totp_score++; |
2209 |
|
}; |
2210 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && op && oi) { |
2211 |
|
// |
2212 |
|
Float_t sen = 0.; |
2213 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2214 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2215 |
|
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
2216 |
|
sen += (op->dedx).At(ih); |
2217 |
|
}; |
2218 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2219 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2220 |
|
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
2221 |
|
sen += (oi->dedx).At(ih); |
2222 |
|
}; |
2223 |
|
// |
2224 |
|
if (sen >= sortthr && false) { // temporary disabled NUCLEI special algorithm since the new one should work for every particle (to be checked!) |
2225 |
|
//printf(" IS A NUCLEUS! en = %f \n",sen); |
2226 |
|
// |
2227 |
|
// is a nucleus use a different algorithm |
2228 |
|
// |
2229 |
|
Int_t nz = 6; |
2230 |
|
Float_t zin[6]; // << define TOF z-coordinates |
2231 |
|
for (Int_t ip = 0; ip < nz; ip++) |
2232 |
|
zin[ip] = tof2->GetZTOF(tof2->GetToFPlaneID(ip)); // << read ToF plane z-coordinates |
2233 |
|
Trajectory *tr = new Trajectory(nz, zin); |
2234 |
|
// |
2235 |
|
Int_t nphit_p = 0; |
2236 |
|
Int_t nphit_i = 0; |
2237 |
|
Float_t enhit_p = 0.; |
2238 |
|
Float_t enhit_i = 0.; |
2239 |
|
// |
2240 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2241 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2242 |
|
if (pl == 1 || pl == 2 || pl == 5) { |
2243 |
|
nphit_p++; |
2244 |
|
enhit_p += (op->dedx).At(ih); |
2245 |
|
}; |
2246 |
|
}; |
2247 |
|
// |
2248 |
|
tp->DoTrack2(tr); |
2249 |
|
// |
2250 |
|
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
2251 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2252 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2253 |
|
if (pl == 0) { |
2254 |
|
nphit_p++; |
2255 |
|
enhit_p += (op->dedx).At(ih); |
2256 |
|
}; |
2257 |
|
}; |
2258 |
|
}; |
2259 |
|
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
2260 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2261 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2262 |
|
if (pl == 3) { |
2263 |
|
nphit_p++; |
2264 |
|
enhit_p += (op->dedx).At(ih); |
2265 |
|
}; |
2266 |
|
}; |
2267 |
|
}; |
2268 |
|
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
2269 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2270 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2271 |
|
if (pl == 4) { |
2272 |
|
nphit_p++; |
2273 |
|
enhit_p += (op->dedx).At(ih); |
2274 |
|
}; |
2275 |
|
}; |
2276 |
|
}; |
2277 |
|
|
2278 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2279 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2280 |
|
if (pl == 1 || pl == 2 || pl == 5) { |
2281 |
|
nphit_i++; |
2282 |
|
enhit_i += (op->dedx).At(ih); |
2283 |
|
}; |
2284 |
|
}; |
2285 |
|
// |
2286 |
|
ti->DoTrack2(tr); |
2287 |
|
// |
2288 |
|
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
2289 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2290 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2291 |
|
if (pl == 0) { |
2292 |
|
nphit_i++; |
2293 |
|
enhit_i += (op->dedx).At(ih); |
2294 |
|
}; |
2295 |
|
}; |
2296 |
|
}; |
2297 |
|
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
2298 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2299 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2300 |
|
if (pl == 3) { |
2301 |
|
nphit_i++; |
2302 |
|
enhit_i += (op->dedx).At(ih); |
2303 |
|
}; |
2304 |
|
}; |
2305 |
|
}; |
2306 |
|
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
2307 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2308 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2309 |
|
if (pl == 4) { |
2310 |
|
nphit_i++; |
2311 |
|
enhit_i += (op->dedx).At(ih); |
2312 |
|
}; |
2313 |
|
}; |
2314 |
|
}; |
2315 |
|
|
2316 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && (nphit_p + nphit_i) != 0 && true) { |
2317 |
|
|
2318 |
|
// 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); |
2319 |
|
// printf(" score p %i score i %i \n",tp_score,ti_score); |
2320 |
|
// if( enhit_p > enhit_i ) tp_score++; |
2321 |
|
// if( nphit_p >= nphit_i && enhit_p > enhit_i ) tp_score++; |
2322 |
|
if (nphit_p > nphit_i) |
2323 |
|
tp_score++; |
2324 |
|
if (nphit_p < nphit_i) |
2325 |
|
ti_score++; |
2326 |
|
if (nphit_p == nphit_i) { |
2327 |
|
if (enhit_p > enhit_i) |
2328 |
|
tp_score++; |
2329 |
|
else |
2330 |
|
ti_score++; |
2331 |
|
}; |
2332 |
|
// printf(" dopo score p %i score i %i \n",tp_score,ti_score); |
2333 |
|
}; |
2334 |
|
delete tr; |
2335 |
|
// |
2336 |
|
} |
2337 |
|
else { |
2338 |
|
// ------------- |
2339 |
|
// NOT a NUCLEUS |
2340 |
|
// ------------- |
2341 |
|
//printf(" NOT a NUCLEUS! en = %f \n",sen); |
2342 |
|
|
2343 |
|
Int_t nphit_p = 0; |
2344 |
|
Int_t nphit_i = 0; |
2345 |
|
|
2346 |
|
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
2347 |
|
cout << "track: npmttdc "<< op->npmttdc << endl; |
2348 |
|
cout << "image: npmtadc "<< oi->npmtadc << endl; |
2349 |
|
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
2350 |
|
|
2351 |
|
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
2352 |
|
// Int_t pl = tof2_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
2353 |
|
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
2354 |
|
// }; |
2355 |
|
|
2356 |
|
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
2357 |
|
// Int_t pl = tof2_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
2358 |
|
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
2359 |
|
// }; |
2360 |
|
// --- modified to count tdc signals (more efficient?) |
2361 |
|
// --- and to implement check on tdcflag |
2362 |
|
for (Int_t ih = 0; ih < op->npmttdc; ih++) { |
2363 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmttdc).At(ih)); |
2364 |
|
// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; |
2365 |
|
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
2366 |
|
|| (use_S3 && (pl == 4 || pl == 5))) { |
2367 |
|
if ((op->tdcflag).At(ih) == 0) |
2368 |
|
nphit_p++; |
2369 |
|
}; |
2370 |
|
}; |
2371 |
|
|
2372 |
|
for (Int_t ih = 0; ih < oi->npmttdc; ih++) { |
2373 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmttdc).At(ih)); |
2374 |
|
// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; |
2375 |
|
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
2376 |
|
|| (use_S3 && (pl == 4 || pl == 5))) { |
2377 |
|
if ((oi->tdcflag).At(ih) == 0) |
2378 |
|
nphit_i++; |
2379 |
|
}; |
2380 |
|
}; |
2381 |
|
|
2382 |
|
if ((nphit_p + nphit_i) != 0 && true) { |
2383 |
|
|
2384 |
|
if (nphit_p != nphit_i) { |
2385 |
|
totp_score += nphit_p; |
2386 |
|
toti_score += nphit_i; |
2387 |
|
tp_score += nphit_p; |
2388 |
|
ti_score += nphit_i; |
2389 |
|
}; |
2390 |
|
// if ( nphit_p > nphit_i) tp_score+=nphit_p; |
2391 |
|
// else if( nphit_p < nphit_i) ti_score+=nphit_i; |
2392 |
|
// else ;//niente |
2393 |
|
}; |
2394 |
|
}; |
2395 |
|
// cout << "TOF "<<tp_score<<ti_score<<endl; |
2396 |
|
}; |
2397 |
|
|
2398 |
|
// if(tp_score == ti_score) use_TRK = true; |
2399 |
|
|
2400 |
|
|
2401 |
|
// ----------------------------------------------------------------------------------------- |
2402 |
|
// ***************************************************************************************** |
2403 |
|
// ----------------------------------------------------------------------------------------- |
2404 |
|
// tracker check |
2405 |
|
// ----------------------------------------------------------------------------------------- |
2406 |
|
// chi**2 difference is not always large enough to distinguish among |
2407 |
|
// the real track and its image. |
2408 |
|
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
2409 |
|
// *** MODIFIED ON AUGUST 2007 *** |
2410 |
|
if (use_TRK) { |
2411 |
|
// if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
2412 |
|
// else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
2413 |
|
|
2414 |
|
// CHECK 1 : number of points along X |
2415 |
|
if (tp->GetNX() >= ti->GetNX()) { |
2416 |
|
tp_score++; |
2417 |
|
totp_score++; |
2418 |
|
}; |
2419 |
|
if (tp->GetNX() <= ti->GetNX()) { |
2420 |
|
ti_score++; |
2421 |
|
toti_score++; |
2422 |
|
}; |
2423 |
|
// CHECK 2 : number of points along Y |
2424 |
|
if (tp->GetNY() >= ti->GetNY()) { |
2425 |
|
tp_score++; |
2426 |
|
totp_score++; |
2427 |
|
}; |
2428 |
|
if (tp->GetNY() <= ti->GetNY()) { |
2429 |
|
ti_score++; |
2430 |
|
toti_score++; |
2431 |
|
}; |
2432 |
|
|
2433 |
|
// cout << "TRK "<<tp_score<<ti_score<<endl; |
2434 |
|
}; |
2435 |
|
|
2436 |
|
// ----------------------------------------------------------------------------------------- |
2437 |
|
// ***************************************************************************************** |
2438 |
|
// ----------------------------------------------------------------------------------------- |
2439 |
|
// GPamela check |
2440 |
|
// ----------------------------------------------------------------------------------------- |
2441 |
|
|
2442 |
|
//--------------------------------------------------- |
2443 |
|
// count the number of GP hits |
2444 |
|
//--------------------------------------------------- |
2445 |
|
if (use_GP) { |
2446 |
|
int ngphits_p = 0; |
2447 |
|
int ngphits_i = 0; |
2448 |
|
float toll = 0.02; //200 micron |
2449 |
|
for (int ih = 0; ih < GetGPamela()->Nthspe; ih++) { |
2450 |
|
int ip = (Int_t) GetGPamela()->Itrpb[ih] - 1; |
2451 |
|
if (tp && tp->YGood(ip) && fabs(tp->ym[ip] - GetGPamela()->Yavspe[ih]) < toll && true) |
2452 |
|
ngphits_p++; |
2453 |
|
if (ti && ti->YGood(ip) && fabs(ti->ym[ip] - GetGPamela()->Yavspe[ih]) < toll && true) |
2454 |
|
ngphits_i++; |
2455 |
|
} |
2456 |
|
if (ngphits_p > ngphits_i && true) { |
2457 |
|
tp_score++; |
2458 |
|
totp_score++; |
2459 |
|
} |
2460 |
|
if (ngphits_p < ngphits_i && true) { |
2461 |
|
ti_score++; |
2462 |
|
toti_score++; |
2463 |
|
} |
2464 |
|
} |
2465 |
|
|
2466 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2467 |
|
// the winner is.... |
2468 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2469 |
|
if (tp_score > ti_score) { |
2470 |
|
|
2471 |
|
} |
2472 |
|
else if (tp_score < ti_score) { |
2473 |
|
|
2474 |
|
ts = ti;//its image!! |
2475 |
|
cs = ci; |
2476 |
|
os = oi; |
2477 |
|
rs = ri; |
2478 |
|
Int_t totis = toti_score; |
2479 |
|
|
2480 |
|
ti = tp;//its image!! |
2481 |
|
ci = cp; |
2482 |
|
oi = op; |
2483 |
|
ri = rp; |
2484 |
|
|
2485 |
|
tp = ts;//its image!! |
2486 |
|
cp = cs; |
2487 |
|
op = os; |
2488 |
|
rp = rs; |
2489 |
|
|
2490 |
|
toti_score = totp_score; |
2491 |
|
totp_score = totis; |
2492 |
|
|
2493 |
|
} |
2494 |
|
else { |
2495 |
|
|
2496 |
|
// cout << "Warning - track image ambiguity not solved" << endl; |
2497 |
|
|
2498 |
|
}; |
2499 |
|
|
2500 |
|
} |
2501 |
|
else { |
2502 |
|
totp_score = 1; |
2503 |
|
toti_score = 0; |
2504 |
|
|
2505 |
|
// ts = tp; |
2506 |
|
// cs = cp; |
2507 |
|
// os = op; |
2508 |
|
}; |
2509 |
|
|
2510 |
|
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
2511 |
|
// sorted_tracks->Add(ts);//save the track in the sorted array |
2512 |
|
// sorted_tracks.Add(ts);//save the track in the sorted array |
2513 |
|
// sorted_tracks.Add(tp);//save the track in the sorted array |
2514 |
|
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
2515 |
|
// cout<<"o "<<tp<<endl; |
2516 |
|
// cout<<"o "<<cp<<endl; |
2517 |
|
// cout<<"o "<<op<<endl; |
2518 |
|
|
2519 |
|
new (ttsorted[i]) PamTrack(tp, cp, op, rp); |
2520 |
|
new (ttimage[i]) PamTrack(ti, ci, oi, ri); |
2521 |
|
|
2522 |
|
((PamTrack*) (ttsorted[i]))->SetPScore(totp_score); |
2523 |
|
((PamTrack*) (ttsorted[i]))->SetIScore(toti_score); |
2524 |
|
((PamTrack*) (ttimage[i]))->SetPScore(totp_score); |
2525 |
|
((PamTrack*) (ttimage[i]))->SetIScore(toti_score); |
2526 |
|
}; |
2527 |
|
|
2528 |
|
|
2529 |
|
|
2530 |
|
|
2531 |
|
|
2532 |
|
// if (tsorted->GetEntries() != trk2->GetNTracks()) { |
2533 |
|
// cout << "void PamLevel2::SortTracks(): tsorted->GetEntries() " << tsorted->GetEntries() |
2534 |
|
// << " != trk2->GetNTracks() = " << trk2->GetNTracks() << endl; |
2535 |
|
// tsorted->Delete(); |
2536 |
|
// tsorted = 0; |
2537 |
|
// timage->Delete(); |
2538 |
|
// timage = 0; |
2539 |
|
// } |
2540 |
|
|
2541 |
|
|
2542 |
|
// cout << "text "<<doit<<endl; |
2543 |
|
|
2544 |
|
|
2545 |
|
//-------------------------------------------------- |
2546 |
|
// fill array with extended tracks (this is easy...) |
2547 |
|
//-------------------------------------------------- |
2548 |
|
if(EXT){ |
2549 |
|
for(int it=0; it<trkext->GetEntries(); it++){ |
2550 |
|
|
2551 |
|
new (ttext[it]) PamTrack((ExtTrack*)(*trkext)[it], (CaloTrkVar*)(*caloext)[it], (ToFTrkVar*)(*tofext)[it], (OrbitalInfoTrkVar*)(*orbext)[it]); |
2552 |
|
|
2553 |
|
} |
2554 |
|
} |
2555 |
|
|
2556 |
|
|
2557 |
|
|
2558 |
|
}; |
2559 |
|
|
2560 |
|
|
2561 |
|
//Restore Object count |
2562 |
|
//To save space in the table keeping track of all referenced objects |
2563 |
|
//We reset the object count to what it was at the beginning of the event. |
2564 |
|
TProcessID::SetObjectCount(ObjectNumber); |
2565 |
|
|
2566 |
|
//Everything went fine so the current event can be tagged as sorted |
2567 |
|
issorted_new = true; |
2568 |
|
lastsorted_new = GetReadEntry(); |
2569 |
|
|
2570 |
|
// cout << " tsorted "<< tsorted << " "<<(tsorted ? tsorted->GetEntries() : 0)<<endl; |
2571 |
|
// cout << " timage "<< timage << " "<<(timage ? timage->GetEntries() : 0)<<endl; |
2572 |
|
// cout << " text "<< text << " "<<(text ? text->GetEntries() : 0)<<endl; |
2573 |
|
|
2574 |
|
|
2575 |
|
}; |
2576 |
//-------------------------------------- |
//-------------------------------------- |
2577 |
// |
// |
2578 |
// |
// |
2580 |
/** |
/** |
2581 |
* 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. |
2582 |
* 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. |
2583 |
*/ |
/* |
2584 |
|
|
2585 |
// TRefArray *PamLevel2::GetTracks(){ |
// TRefArray *PamLevel2::GetTracks(){ |
2586 |
|
|
2587 |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
2592 |
// return &sorted_tracks; |
// return &sorted_tracks; |
2593 |
|
|
2594 |
// }; |
// }; |
|
TClonesArray *PamLevel2::GetTracks() { |
|
|
|
|
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
|
|
SortTracks(); |
|
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
|
2595 |
|
|
|
return tsorted; |
|
2596 |
|
|
|
} |
|
|
; |
|
2597 |
//-------------------------------------- |
//-------------------------------------- |
2598 |
// |
// |
2599 |
// |
// |
2605 |
*/ |
*/ |
2606 |
PamTrack *PamLevel2::GetTrack(int it) { |
PamTrack *PamLevel2::GetTrack(int it) { |
2607 |
|
|
2608 |
// 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; |
|
|
// }; |
|
|
|
|
|
// return track; |
|
2609 |
|
|
|
// cout << "PamLevel2::GetTrack(int it) "<<endl; |
|
2610 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2611 |
SortTracks(); |
SortTracks(); |
2612 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2613 |
if (!tsorted) |
if (!tsorted) |
2614 |
return 0; |
return track; |
2615 |
if (!tsorted->GetEntries()) |
if (!tsorted->GetEntries()) |
2616 |
return 0; |
return track; |
2617 |
|
|
|
PamTrack *track = 0; |
|
2618 |
|
|
2619 |
if (it >= 0 && it < trk2_obj->TrkLevel2::GetNTracks()) { |
if (it >= 0 && it < trk2_obj->TrkLevel2::GetNTracks()) { |
|
// TrkTrack *t = (TrkTrack*)sorted_tracks.At(it); |
|
|
// track = GetPamTrackAlong(t); |
|
|
//TClonesArray &t = *(tsorted); |
|
|
//track = (PamTrack*)t[it]; |
|
2620 |
track = (PamTrack*)((*tsorted)[it]); |
track = (PamTrack*)((*tsorted)[it]); |
2621 |
} |
} |
2622 |
else { |
else { |
2626 |
|
|
2627 |
return track; |
return track; |
2628 |
|
|
2629 |
|
}; |
2630 |
|
|
2631 |
|
//PamTrack *PamLevel2::GetTrack(int it) { return GetTrack(it,trkAlg); }; |
2632 |
|
|
2633 |
|
/** |
2634 |
|
* Retrieves the it-th Pamela "physical" track. |
2635 |
|
* It override TrkLevel2::GetTrack(int it). |
2636 |
|
* @param it Track number, ranging from 0 to GetNTracks(). |
2637 |
|
* @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation. |
2638 |
|
*/ |
2639 |
|
PamTrack *PamLevel2::GetTrack(int it, char* alg) { |
2640 |
|
|
2641 |
|
TString s(alg); |
2642 |
|
if(!s.CompareTo("") ||!s.CompareTo("STD") )return GetTrack(it); //old algorythm |
2643 |
|
|
2644 |
|
|
2645 |
|
SortTracksNew(); |
2646 |
|
// >> fill tsorted, timage and text |
2647 |
|
|
2648 |
|
if ( ( !s.Contains("EXTF", TString::kIgnoreCase) || !EXT )){ //not forced exteded-alg requested (or exteded-data missing) |
2649 |
|
|
2650 |
|
if( s.Contains("NUC")){ |
2651 |
|
if( |
2652 |
|
tsorted_nuc && |
2653 |
|
it < tsorted_nuc->GetEntries() && //enough tracks found |
2654 |
|
it >= 0 && //valid index |
2655 |
|
true) return (PamTrack*)((*tsorted_nuc)[it]); //ok return the track |
2656 |
|
}else{ |
2657 |
|
if( |
2658 |
|
tsorted && |
2659 |
|
it < tsorted->GetEntries() && //enough tracks found |
2660 |
|
it >= 0 && //valid index |
2661 |
|
true )return (PamTrack*)((*tsorted)[it]); //ok return the track |
2662 |
|
} |
2663 |
|
|
2664 |
|
} |
2665 |
|
|
2666 |
|
|
2667 |
|
///////////////////////////////////////////////////////////////////////// |
2668 |
|
/// if requested get track from extended algorythm output |
2669 |
|
///////////////////////////////////////////////////////////////////////// |
2670 |
|
|
2671 |
|
if(s.Contains("EXT", TString::kIgnoreCase) && EXT){//if exteded-alg requested |
2672 |
|
|
2673 |
|
if(s.Contains("NUC")){ |
2674 |
|
if( |
2675 |
|
text_nuc && |
2676 |
|
it < text_nuc->GetEntries() && //enough tracks found |
2677 |
|
it >= 0 && //valid index |
2678 |
|
true) return (PamTrack*)((*text_nuc)[it]); |
2679 |
|
}else{ |
2680 |
|
if( |
2681 |
|
text && |
2682 |
|
it < text->GetEntries() && //enough tracks found |
2683 |
|
it >= 0 && //valid index |
2684 |
|
true) return (PamTrack*)((*text)[it]); |
2685 |
|
} |
2686 |
|
|
2687 |
|
}; |
2688 |
|
|
2689 |
|
|
2690 |
|
|
2691 |
|
return NULL; |
2692 |
|
|
2693 |
|
} |
2694 |
|
; |
2695 |
|
TClonesArray *PamLevel2::GetTracks() { |
2696 |
|
|
2697 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2698 |
|
SortTracks(); |
2699 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2700 |
|
|
2701 |
|
return tsorted; |
2702 |
|
|
2703 |
} |
} |
2704 |
; |
; |
2705 |
|
Int_t PamLevel2::GetNTracks(char* alg) { |
2706 |
|
|
2707 |
|
|
2708 |
|
// cout << " trk_nuc_obj->GetEntries() "<<trk_nuc_obj->GetEntries()<<" trk2_nuc_obj->GetNTracks() "<<trk2_nuc_obj->GetNTracks()<<endl; |
2709 |
|
|
2710 |
|
TString s(alg); |
2711 |
|
|
2712 |
|
if(!s.CompareTo("") || !s.CompareTo("STD"))return trk2_obj->TrkLevel2::GetNTracks(); //standard algorythm |
2713 |
|
|
2714 |
|
if(s.Contains("EXTF", TString::kIgnoreCase) && EXT){ |
2715 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && NUC)return trk_ext_nuc_obj->GetEntries();//ok |
2716 |
|
return trk_ext_obj->GetEntries();//ok |
2717 |
|
} |
2718 |
|
if( s.Contains("EXT", TString::kIgnoreCase) && EXT) { |
2719 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && NUC) |
2720 |
|
return (trk2_nuc_obj->TrkLevel2::GetNTracks() ? trk2_nuc_obj->TrkLevel2::GetNTracks() : trk_ext_nuc_obj->GetEntries() ); |
2721 |
|
return (trk2_obj->TrkLevel2::GetNTracks() ? trk2_obj->TrkLevel2::GetNTracks() : trk_ext_obj->GetEntries() ); |
2722 |
|
} |
2723 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && NUC ) |
2724 |
|
return trk2_nuc_obj->TrkLevel2::GetNTracks(); |
2725 |
|
|
2726 |
|
return 0; |
2727 |
|
|
2728 |
|
} |
2729 |
|
|
2730 |
|
|
2731 |
//-------------------------------------- |
//-------------------------------------- |
2732 |
// |
// |
2766 |
|
|
2767 |
return image; |
return image; |
2768 |
} |
} |
2769 |
|
/** |
2770 |
|
* Retrieves (if present) the image of the it-th Pamela "physical" track, sorted by the method PamLevel2::SortTracks(). |
2771 |
|
* @param it Track number, ranging from 0 to GetNTracks(). |
2772 |
|
* @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation. |
2773 |
|
*/ |
2774 |
|
PamTrack *PamLevel2::GetTrackImage(int it, char* alg) { |
2775 |
|
|
2776 |
|
TString s(alg); |
2777 |
|
if(!s.CompareTo("") || !s.CompareTo("STD"))return GetTrack(it); //old algorythm |
2778 |
|
|
2779 |
|
|
2780 |
|
SortTracksNew(); |
2781 |
|
// >> fill tsorted, timage and text |
2782 |
|
|
2783 |
|
if ( ( !s.Contains("EXTF", TString::kIgnoreCase) || !EXT )){ //not forced exteded-alg requested (or exteded-data missing) |
2784 |
|
|
2785 |
|
if( s.Contains("NUC")){ |
2786 |
|
if( |
2787 |
|
tsorted_nuc && |
2788 |
|
it < tsorted_nuc->GetEntries() && //enough tracks found |
2789 |
|
it >= 0 && //valid index |
2790 |
|
true){ |
2791 |
|
TClonesArray &t = *(tsorted_nuc); |
2792 |
|
PamTrack *temp = (PamTrack*) t[it]; |
2793 |
|
if (temp->GetTrkTrack()->HasImage()) { |
2794 |
|
return (PamTrack*)((*timage_nuc)[it]); //ok return the track |
2795 |
|
} |
2796 |
|
|
2797 |
|
} |
2798 |
|
}else{ |
2799 |
|
if( |
2800 |
|
tsorted && |
2801 |
|
it < tsorted->GetEntries() && //enough tracks found |
2802 |
|
it >= 0 && //valid index |
2803 |
|
true ){ |
2804 |
|
TClonesArray &t = *(tsorted); |
2805 |
|
PamTrack *temp = (PamTrack*) t[it]; |
2806 |
|
if (temp->GetTrkTrack()->HasImage()) { |
2807 |
|
return (PamTrack*)((*timage)[it]); //ok return the track |
2808 |
|
} |
2809 |
|
} |
2810 |
|
} |
2811 |
|
|
2812 |
|
} |
2813 |
|
|
2814 |
|
return NULL; |
2815 |
|
|
2816 |
|
} |
2817 |
|
; |
2818 |
|
|
2819 |
//-------------------------------------- |
//-------------------------------------- |
2820 |
// |
// |
2904 |
if (!Trout) |
if (!Trout) |
2905 |
Trout = T; |
Trout = T; |
2906 |
else |
else |
2907 |
Trout->AddFriend(T); |
Trout->AddFriend(T); |
2908 |
} |
} |
2909 |
else { |
else { |
2910 |
cout << "Tracker : missing tree" << endl; |
cout << "Tracker : missing tree" << endl; |
3317 |
G->Add(name); |
G->Add(name); |
3318 |
if (SELLI == 1) |
if (SELLI == 1) |
3319 |
L->Add(name); |
L->Add(name); |
3320 |
}; |
}; |
3321 |
}; |
}; |
3322 |
|
|
3323 |
cout << "done chains\n"; |
cout << "done data-tree chains "<< T->GetNtrees() <<" \n"; |
3324 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "----------------------------------------------------" << endl; |
3325 |
|
|
3326 |
// ------------------------------------------- |
// ------------------------------------------- |
3327 |
// make friends |
// make friends |
3404 |
// ===================================== |
// ===================================== |
3405 |
// SET BRANCH-ADDRESS AFTER CHAIN+FRIEND |
// SET BRANCH-ADDRESS AFTER CHAIN+FRIEND |
3406 |
// ===================================== |
// ===================================== |
3407 |
SetBranchAddress(Trout); |
if( Trout->GetNtrees() )SetBranchAddress(Trout); |
3408 |
|
|
3409 |
// ------------------------------------ |
// ------------------------------------ |
3410 |
// finally handle selection trees... |
// finally handle selection trees... |
3411 |
// (it is not friend of pamela tree) |
// (it is not friend of pamela tree) |
3412 |
// ------------------------------------ |
// ------------------------------------ |
3413 |
|
|
3414 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "----------------------------------------------------" << endl; |
3415 |
|
|
3416 |
// Selection List |
// Selection List |
3417 |
if (L && SELLI == 1) { |
if (L && SELLI == 1) { |
3432 |
// if(!Trout)Trout=O; |
// if(!Trout)Trout=O; |
3433 |
// else Trout->AddFriend("SelectionList"); |
// else Trout->AddFriend("SelectionList"); |
3434 |
cout << "+SelectionList" << endl; |
cout << "+SelectionList" << endl; |
3435 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "----------------------------------------------------" << endl; |
3436 |
} |
} |
3437 |
else { |
else { |
3438 |
// cout << "SelectionList : missing tree"<<endl; |
// cout << "SelectionList : missing tree"<<endl; |
3458 |
*/ |
*/ |
3459 |
void PamLevel2::SetBranchAddress(TTree *t) { |
void PamLevel2::SetBranchAddress(TTree *t) { |
3460 |
|
|
3461 |
TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
// TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
3462 |
TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
// TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
3463 |
TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
// TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
3464 |
CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
// CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
3465 |
CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
// CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
3466 |
TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
// TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
3467 |
TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
// TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
3468 |
S4 = S4 & t->GetBranchStatus("S4Level2"); |
// S4 = S4 & t->GetBranchStatus("S4Level2"); |
3469 |
ND = ND & t->GetBranchStatus("NDLevel2"); |
// ND = ND & t->GetBranchStatus("NDLevel2"); |
3470 |
AC = AC & t->GetBranchStatus("AcLevel2"); |
// AC = AC & t->GetBranchStatus("AcLevel2"); |
3471 |
ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
// ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
3472 |
GP = GP & t->GetBranchStatus("h20"); |
// GP = GP & t->GetBranchStatus("h20"); |
3473 |
|
|
3474 |
|
|
3475 |
// Tracker |
// Tracker |
3476 |
if (TRK1) { |
if (TRK1) { |
3480 |
if (TRK2) { |
if (TRK2) { |
3481 |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel1")); |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel1")); |
3482 |
cout << "Tracker : set branch address TrkLevel2" << endl; |
cout << "Tracker : set branch address TrkLevel2" << endl; |
3483 |
|
NUC = t->GetBranchStatus("TrackNuclei"); |
3484 |
|
EXT = t->GetBranchStatus("RecoveredTrack") && (NUC ? t->GetBranchStatus("RecoveredTrackNuclei"): true ); |
3485 |
}; |
}; |
3486 |
if (TRKh) { |
if (TRKh) { |
3487 |
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
3542 |
|
|
3543 |
cout << "h20 : set branch address GPamela " << endl; |
cout << "h20 : set branch address GPamela " << endl; |
3544 |
}; |
}; |
3545 |
|
if(NUC){ |
3546 |
|
|
3547 |
|
cout << "Found nuclei-track branches" << endl; |
3548 |
|
|
3549 |
|
if( !trk_nuc_obj )trk_nuc_obj = new TClonesArray("TrkTrack"); |
3550 |
|
if( !calo_nuc_obj)calo_nuc_obj= new TClonesArray("CaloTrkVar"); |
3551 |
|
if( !tof_nuc_obj)tof_nuc_obj= new TClonesArray("ToFTrkVar"); |
3552 |
|
if( !orb_nuc_obj)orb_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3553 |
|
if (TRK2)t-> SetBranchAddress("TrackNuclei",&trk_nuc_obj); |
3554 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("TrackNuclei",&calo_nuc_obj); |
3555 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("TrackNuclei",&tof_nuc_obj); |
3556 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("TrackNuclei",&orb_nuc_obj); |
3557 |
|
|
3558 |
|
///copy the vector content inside a "fake" object (all aother info are missing) |
3559 |
|
|
3560 |
|
if( !trk2_nuc_obj )trk2_nuc_obj = new TrkLevel2(); |
3561 |
|
if( !calo2_nuc_obj )calo2_nuc_obj = new CaloLevel2(); |
3562 |
|
if( !tof2_nuc_obj )tof2_nuc_obj = new ToFLevel2(); |
3563 |
|
if( !orb2_nuc_obj )orb2_nuc_obj = new OrbitalInfo(); |
3564 |
|
// *(trk2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*trk_nuc_obj); |
3565 |
|
// *(calo2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*calo_nuc_obj); |
3566 |
|
// *(tof2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*tof_nuc_obj); |
3567 |
|
// *(orb2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*orb_nuc_obj); |
3568 |
|
|
3569 |
|
trk2_nuc_obj->SetTrackArray( trk_nuc_obj ); |
3570 |
|
calo2_nuc_obj->SetTrackArray( calo_nuc_obj ); |
3571 |
|
tof2_nuc_obj->SetTrackArray( tof_nuc_obj ); |
3572 |
|
orb2_nuc_obj->SetTrackArray( orb_nuc_obj ); |
3573 |
|
|
3574 |
|
|
3575 |
|
} |
3576 |
|
|
3577 |
|
if(EXT){ |
3578 |
|
|
3579 |
|
cout << "Found extended tracking algorythm branches" << endl; |
3580 |
|
|
3581 |
|
if( !trk_ext_obj )trk_ext_obj = new TClonesArray("ExtTrack"); |
3582 |
|
if( !calo_ext_obj)calo_ext_obj= new TClonesArray("CaloTrkVar"); |
3583 |
|
if( !tof_ext_obj)tof_ext_obj= new TClonesArray("ToFTrkVar"); |
3584 |
|
if( !orb_ext_obj)orb_ext_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3585 |
|
|
3586 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrack",&trk_ext_obj); |
3587 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrack",&calo_ext_obj); |
3588 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrack",&tof_ext_obj); |
3589 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrack",&orb_ext_obj); |
3590 |
|
|
3591 |
|
|
3592 |
|
if(NUC){ |
3593 |
|
if( !trk_ext_nuc_obj )trk_ext_nuc_obj = new TClonesArray("ExtTrack"); |
3594 |
|
if( !calo_ext_nuc_obj)calo_ext_nuc_obj= new TClonesArray("CaloTrkVar"); |
3595 |
|
if( !tof_ext_nuc_obj)tof_ext_nuc_obj= new TClonesArray("ToFTrkVar"); |
3596 |
|
if( !orb_ext_nuc_obj)orb_ext_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3597 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrackNuclei",&trk_ext_nuc_obj); |
3598 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrackNuclei",&calo_ext_nuc_obj); |
3599 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrackNuclei",&tof_ext_nuc_obj); |
3600 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrackNuclei",&orb_ext_nuc_obj); |
3601 |
|
} |
3602 |
|
} |
3603 |
} |
} |
3604 |
/** |
/** |
3605 |
* Set branch addresses for Pamela friend trees |
* Set branch addresses for Pamela friend trees |
3623 |
if (TRK2) { |
if (TRK2) { |
3624 |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
3625 |
cout << "Tracker : set branch address TrkLevel2" << endl; |
cout << "Tracker : set branch address TrkLevel2" << endl; |
3626 |
|
NUC = t->GetBranchStatus("TrackNuclei"); |
3627 |
|
EXT = t->GetBranchStatus("RecoveredTrack") && (NUC ? t->GetBranchStatus("RecoveredTrackNuclei"): true ); |
3628 |
}; |
}; |
3629 |
if (TRK1) { |
if (TRK1) { |
3630 |
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
3638 |
// Calorimeter |
// Calorimeter |
3639 |
if (CAL2) { |
if (CAL2) { |
3640 |
t->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
t->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
3641 |
cout << "Calorimeter : set branch address CaloLevel2" << endl; |
cout << "Calorimeter : set branch address CaloLevel2" << endl; |
3642 |
}; |
}; |
3643 |
if (CAL1) { |
if (CAL1) { |
3644 |
t->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
t->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
3696 |
// cout << "SelectionList: set branch address EventEntry"<<endl; |
// cout << "SelectionList: set branch address EventEntry"<<endl; |
3697 |
|
|
3698 |
// } |
// } |
3699 |
|
if(NUC){ |
3700 |
|
|
3701 |
|
cout << "Found nuclei-track branches" << endl; |
3702 |
|
|
3703 |
|
if( !trk_nuc_obj )trk_nuc_obj = new TClonesArray("TrkTrack"); |
3704 |
|
if( !calo_nuc_obj)calo_nuc_obj= new TClonesArray("CaloTrkVar"); |
3705 |
|
if( !tof_nuc_obj)tof_nuc_obj= new TClonesArray("ToFTrkVar"); |
3706 |
|
if( !orb_nuc_obj)orb_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3707 |
|
if (TRK2)t-> SetBranchAddress("TrackNuclei",&trk_nuc_obj); |
3708 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("TrackNuclei",&calo_nuc_obj); |
3709 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("TrackNuclei",&tof_nuc_obj); |
3710 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("TrackNuclei",&orb_nuc_obj); |
3711 |
|
|
3712 |
|
///copy the vector content inside a "fake" object (all aother info are missing) |
3713 |
|
|
3714 |
|
if( !trk2_nuc_obj )trk2_nuc_obj = new TrkLevel2(); |
3715 |
|
if( !calo2_nuc_obj )calo2_nuc_obj = new CaloLevel2(); |
3716 |
|
if( !tof2_nuc_obj )tof2_nuc_obj = new ToFLevel2(); |
3717 |
|
if( !orb2_nuc_obj )orb2_nuc_obj = new OrbitalInfo(); |
3718 |
|
|
3719 |
|
// *(trk2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*trk_nuc_obj); |
3720 |
|
// *(calo2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*calo_nuc_obj); |
3721 |
|
// *(tof2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*tof_nuc_obj); |
3722 |
|
// *(orb2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*orb_nuc_obj); |
3723 |
|
trk2_nuc_obj->SetTrackArray( trk_nuc_obj ); |
3724 |
|
calo2_nuc_obj->SetTrackArray( calo_nuc_obj ); |
3725 |
|
tof2_nuc_obj->SetTrackArray( tof_nuc_obj ); |
3726 |
|
orb2_nuc_obj->SetTrackArray( orb_nuc_obj ); |
3727 |
|
|
3728 |
|
} |
3729 |
|
if(EXT){ |
3730 |
|
|
3731 |
|
cout << "Found extended tracking algorythm branches" << endl; |
3732 |
|
|
3733 |
|
t->SetBranchAddress("extAlgFlag",&extAlgFlag); |
3734 |
|
|
3735 |
|
if( !trk_ext_obj )trk_ext_obj = new TClonesArray("ExtTrack"); |
3736 |
|
if( !calo_ext_obj)calo_ext_obj= new TClonesArray("CaloTrkVar"); |
3737 |
|
if( !tof_ext_obj)tof_ext_obj= new TClonesArray("ToFTrkVar"); |
3738 |
|
if( !orb_ext_obj)orb_ext_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3739 |
|
|
3740 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrack",&trk_ext_obj); |
3741 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrack",&calo_ext_obj); |
3742 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrack",&tof_ext_obj); |
3743 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrack",&orb_ext_obj); |
3744 |
|
|
3745 |
|
if(NUC){ |
3746 |
|
if( !trk_ext_nuc_obj )trk_ext_nuc_obj = new TClonesArray("ExtTrack"); |
3747 |
|
if( !calo_ext_nuc_obj)calo_ext_nuc_obj= new TClonesArray("CaloTrkVar"); |
3748 |
|
if( !tof_ext_nuc_obj)tof_ext_nuc_obj= new TClonesArray("ToFTrkVar"); |
3749 |
|
if( !orb_ext_nuc_obj)orb_ext_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3750 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrackNuclei",&trk_ext_nuc_obj); |
3751 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrackNuclei",&calo_ext_nuc_obj); |
3752 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrackNuclei",&tof_ext_nuc_obj); |
3753 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrackNuclei",&orb_ext_nuc_obj); |
3754 |
|
} |
3755 |
|
} |
3756 |
|
|
3757 |
} |
} |
3758 |
|
|
3759 |
|
/** |
3760 |
|
* Set the tracking algorythm |
3761 |
|
* @param alg String to choose the track. |
3762 |
|
* "" --> take the output of the standard tracking algorythm |
3763 |
|
* "STD" --> take the output of the standard tracking algorythm |
3764 |
|
* "NUC" --> take the output of the standard tracking algorythm for nuclei cluster selection |
3765 |
|
* "EXT" --> in case the standard tracking algorythm has not found any track, take the output of the extended one |
3766 |
|
* "EXTF" --> force the extended tracking algorythm |
3767 |
|
* "NUCEXT" --> as "EXT", but for nuclei |
3768 |
|
* "NUCEXTF" --> as "EXTF", but for nuclei |
3769 |
|
*/ |
3770 |
|
void PamLevel2::SetTrakingAlgorythm(char *alg){ |
3771 |
|
|
3772 |
|
|
3773 |
|
TString s(alg); |
3774 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && !NUC) |
3775 |
|
cout << "Warning! NUC algorythm requested, but branches are missing"<<endl; |
3776 |
|
if(s.Contains("EXT", TString::kIgnoreCase) && !EXT) |
3777 |
|
cout << "Warning! EXT algorythm requested, but branches are missing"<<endl;; |
3778 |
|
|
3779 |
|
trkAlg = alg; |
3780 |
|
|
3781 |
|
}; |
3782 |
|
char* PamLevel2::GetTrakingAlgorythm(){ |
3783 |
|
|
3784 |
|
|
3785 |
|
cout<<endl<<" Implemented tracking algorythm: "; |
3786 |
|
cout<<endl<<" \"\" or \"STD\" --> take the output of the standard tracking algorythm"; |
3787 |
|
cout<<endl<<" \"NUC\" --> take the output of the standard tracking algorythm for nuclei cluster selection"; |
3788 |
|
cout<<endl<<" \"EXT\" --> in case the standard tracking algorythm has not found any track,"; |
3789 |
|
cout<<endl<<" take the output of the extended one"; |
3790 |
|
cout<<endl<<" \"EXTF\" --> force the extended tracking algorythm"; |
3791 |
|
cout<<endl<<" \"NUCEXT\" --> as \"EXT\", but for nuclei "; |
3792 |
|
cout<<endl<<" \"NUCEXTF\" --> as \"EXTF\", but for nuclei"; |
3793 |
|
|
3794 |
|
cout<<endl; |
3795 |
|
cout<<" <<Currently set algorythm>> "<<trkAlg<<endl; |
3796 |
|
cout<<endl; |
3797 |
|
|
3798 |
|
return trkAlg; |
3799 |
|
}; |
3800 |
|
|
3801 |
|
|
3802 |
|
|
3803 |
//-------------------------------------- |
//-------------------------------------- |
3804 |
// |
// |
3805 |
// |
// |
3833 |
}; |
}; |
3834 |
} |
} |
3835 |
|
|
3836 |
|
cout << "done run chain "<< R->GetNtrees() <<" \n"; |
3837 |
|
|
3838 |
|
|
3839 |
if (RUN && R->GetNtrees()) { |
if (RUN && R->GetNtrees()) { |
3840 |
|
|
3841 |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
3875 |
cout << "----------------------------------------------------" << endl; |
cout << "----------------------------------------------------" << endl; |
3876 |
|
|
3877 |
} |
} |
3878 |
else { |
// else { |
3879 |
delete R; |
// delete R; |
3880 |
R = 0; |
// R = 0; |
3881 |
} |
// } |
3882 |
|
|
3883 |
run_tree = R; |
run_tree = R; |
3884 |
|
|
5150 |
pam_tree_clone[i]->Branch("TrkHough", "TrkHough", GetPointerTo("TrkHough")); |
pam_tree_clone[i]->Branch("TrkHough", "TrkHough", GetPointerTo("TrkHough")); |
5151 |
cout << "Tracker : branch TrkHough" << endl; |
cout << "Tracker : branch TrkHough" << endl; |
5152 |
}; |
}; |
5153 |
|
if(NUC){ |
5154 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&trk_nuc_obj); |
5155 |
|
cout << "Tracker : branch TrackNuclei" << endl; |
5156 |
|
} |
5157 |
|
if(EXT){ |
5158 |
|
pam_tree_clone[i]->Branch("extAlgFlag",&extAlgFlag,"extAlgFlag/I"); |
5159 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&trk_ext_obj); |
5160 |
|
cout << "Tracker : branch RecoveredTrack" << endl; |
5161 |
|
if(NUC){ |
5162 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&trk_ext_nuc_obj); |
5163 |
|
cout << "Tracker : branch RecoveredTrackNuclei" << endl; |
5164 |
|
} |
5165 |
|
} |
5166 |
|
|
5167 |
i++; |
i++; |
5168 |
} |
} |
5169 |
|
|
5178 |
pam_tree_clone[i]->Branch("CaloLevel2", "CaloLevel2", GetPointerTo("CaloLevel2")); |
pam_tree_clone[i]->Branch("CaloLevel2", "CaloLevel2", GetPointerTo("CaloLevel2")); |
5179 |
cout << "Calorimeter : branch CaloLevel2" << endl; |
cout << "Calorimeter : branch CaloLevel2" << endl; |
5180 |
}; |
}; |
5181 |
|
if(NUC){ |
5182 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&calo_nuc_obj); |
5183 |
|
cout << "Calorimeter : branch TrackNuclei" << endl; |
5184 |
|
} |
5185 |
|
if(EXT){ |
5186 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&calo_ext_obj); |
5187 |
|
cout << "Calorimeter : branch RecoveredTrack" << endl; |
5188 |
|
if(NUC){ |
5189 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&calo_ext_nuc_obj); |
5190 |
|
cout << "Calorimeter : branch RecoveredTrackNuclei" << endl; |
5191 |
|
} |
5192 |
|
} |
5193 |
i++; |
i++; |
5194 |
} |
} |
5195 |
|
|
5198 |
pam_tree_clone[i] = new TTree("ToF", "PAMELA ToF level2 data "); |
pam_tree_clone[i] = new TTree("ToF", "PAMELA ToF level2 data "); |
5199 |
pam_tree_clone[i]->Branch("ToFLevel2", "ToFLevel2", GetPointerTo("ToFLevel2")); |
pam_tree_clone[i]->Branch("ToFLevel2", "ToFLevel2", GetPointerTo("ToFLevel2")); |
5200 |
cout << "ToF : branch ToFLevel2" << endl; |
cout << "ToF : branch ToFLevel2" << endl; |
5201 |
|
if(NUC){ |
5202 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&tof_nuc_obj); |
5203 |
|
cout << "ToF : branch TrackNuclei" << endl; |
5204 |
|
} |
5205 |
|
if(EXT){ |
5206 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&tof_ext_obj); |
5207 |
|
cout << "ToF : branch RecoveredTrack" << endl; |
5208 |
|
if(NUC){ |
5209 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&tof_ext_nuc_obj); |
5210 |
|
cout << "ToF : branch RecoveredTrackNuclei" << endl; |
5211 |
|
} |
5212 |
|
} |
5213 |
i++; |
i++; |
5214 |
}; |
}; |
5215 |
// Trigger |
// Trigger |
5245 |
pam_tree_clone[i] = new TTree("OrbitalInfo", "PAMELA orbital info "); |
pam_tree_clone[i] = new TTree("OrbitalInfo", "PAMELA orbital info "); |
5246 |
pam_tree_clone[i]->Branch("OrbitalInfo", "OrbitalInfo", GetPointerTo("OrbitalInfo")); |
pam_tree_clone[i]->Branch("OrbitalInfo", "OrbitalInfo", GetPointerTo("OrbitalInfo")); |
5247 |
cout << "OrbitalInfo : branch OrbitalInfo" << endl; |
cout << "OrbitalInfo : branch OrbitalInfo" << endl; |
5248 |
|
if(NUC){ |
5249 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&orb_nuc_obj); |
5250 |
|
cout << "OrbitalInfo : branch TrackNuclei" << endl; |
5251 |
|
} |
5252 |
|
if(EXT){ |
5253 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&orb_ext_obj); |
5254 |
|
cout << "OrbitalInfo : branch RecoveredTrack" << endl; |
5255 |
|
if(NUC){ |
5256 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&orb_ext_nuc_obj); |
5257 |
|
cout << "OrbitalInfo : branch RecoveredTrackNuclei" << endl; |
5258 |
|
} |
5259 |
|
} |
5260 |
i++; |
i++; |
5261 |
}; |
}; |
5262 |
// GPamela |
// GPamela |
5266 |
cout << "GPamela : branch GPamela" << endl; |
cout << "GPamela : branch GPamela" << endl; |
5267 |
i++; |
i++; |
5268 |
}; |
}; |
5269 |
|
|
5270 |
|
|
5271 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
5272 |
|
|
5273 |
} |
} |
5952 |
void PamLevel2::SetSortingMethod(TString how) { |
void PamLevel2::SetSortingMethod(TString how) { |
5953 |
if (howtosort != how) { |
if (howtosort != how) { |
5954 |
issorted = false; |
issorted = false; |
5955 |
|
issorted_new = false; |
5956 |
} |
} |
5957 |
howtosort = how; |
howtosort = how; |
5958 |
} |
} |