278 |
*/ |
*/ |
279 |
PamTrack::PamTrack() { |
PamTrack::PamTrack() { |
280 |
trk_track = 0; |
trk_track = 0; |
281 |
|
trk_ext_track = 0; |
282 |
calo_track = 0; |
calo_track = 0; |
283 |
tof_track = 0; |
tof_track = 0; |
284 |
orb_track = 0; |
orb_track = 0; |
296 |
*/ |
*/ |
297 |
PamTrack::PamTrack(TrkTrack* t, CaloTrkVar* c, ToFTrkVar* o, OrbitalInfoTrkVar *r) { |
PamTrack::PamTrack(TrkTrack* t, CaloTrkVar* c, ToFTrkVar* o, OrbitalInfoTrkVar *r) { |
298 |
|
|
299 |
|
trk_ext_track = 0; |
300 |
trk_track = 0; |
trk_track = 0; |
301 |
calo_track = 0; |
calo_track = 0; |
302 |
tof_track = 0; |
tof_track = 0; |
304 |
// if(t)trk_track = new TrkTrack(*t); |
// if(t)trk_track = new TrkTrack(*t); |
305 |
// if(c)calo_track = new CaloTrkVar(*c); |
// if(c)calo_track = new CaloTrkVar(*c); |
306 |
// if(o)tof_track = new ToFTrkVar(*o); |
// if(o)tof_track = new ToFTrkVar(*o); |
307 |
if (t) |
// if (t) |
308 |
trk_track = t; |
// trk_track = t; |
309 |
|
// if (c) |
310 |
|
// calo_track = c; |
311 |
|
// if (o) |
312 |
|
// tof_track = o; |
313 |
|
// if (r) |
314 |
|
// orb_track = r; |
315 |
|
|
316 |
|
// candeleteobj = 0; |
317 |
|
|
318 |
|
|
319 |
|
if (t){ |
320 |
|
trk_track = new TrkTrack(*t); |
321 |
|
trk_ext_track = new ExtTrack(*t);//NB!! ha dimensione 6 invece che 8 |
322 |
|
} |
323 |
if (c) |
if (c) |
324 |
calo_track = c; |
calo_track = new CaloTrkVar(*c); |
325 |
if (o) |
if (o) |
326 |
tof_track = o; |
tof_track = new ToFTrkVar(*o); |
327 |
if (r) |
if (r) |
328 |
orb_track = r; |
orb_track = new OrbitalInfoTrkVar(*r); |
329 |
|
candeleteobj = 1; |
330 |
|
|
331 |
candeleteobj = 0; |
} |
332 |
|
; |
333 |
|
/** |
334 |
|
* Constructor |
335 |
|
*/ |
336 |
|
PamTrack::PamTrack(ExtTrack* t, CaloTrkVar* c, ToFTrkVar* o, OrbitalInfoTrkVar *r) { |
337 |
|
|
338 |
|
trk_ext_track = 0; |
339 |
|
trk_track = 0; |
340 |
|
calo_track = 0; |
341 |
|
tof_track = 0; |
342 |
|
orb_track = 0; |
343 |
|
// if(t)trk_track = new TrkTrack(*t); |
344 |
|
// if(c)calo_track = new CaloTrkVar(*c); |
345 |
|
// if(o)tof_track = new ToFTrkVar(*o); |
346 |
|
// if (t) |
347 |
|
// trk_track = t; |
348 |
|
// if (c) |
349 |
|
// calo_track = c; |
350 |
|
// if (o) |
351 |
|
// tof_track = o; |
352 |
|
// if (r) |
353 |
|
// orb_track = r; |
354 |
|
|
355 |
|
// candeleteobj = 0; |
356 |
|
|
357 |
|
|
358 |
|
if (t){ |
359 |
|
//// trk_track = new TrkTrack(*t);//in this case TrkTrack object remains null |
360 |
|
trk_ext_track = new ExtTrack(*t); |
361 |
|
} |
362 |
|
if (c) |
363 |
|
calo_track = new CaloTrkVar(*c); |
364 |
|
if (o) |
365 |
|
tof_track = new ToFTrkVar(*o); |
366 |
|
if (r) |
367 |
|
orb_track = new OrbitalInfoTrkVar(*r); |
368 |
|
candeleteobj = 1; |
369 |
|
pscore = 0; |
370 |
|
iscore = 0; |
371 |
|
|
372 |
} |
} |
373 |
; |
; |
374 |
PamTrack::PamTrack(const PamTrack& track) { |
PamTrack::PamTrack(const PamTrack& track) { |
375 |
|
|
376 |
TrkTrack *t = track.trk_track; |
TrkTrack *t = track.trk_track; |
377 |
|
ExtTrack *e = track.trk_ext_track; |
378 |
CaloTrkVar *c = track.calo_track; |
CaloTrkVar *c = track.calo_track; |
379 |
ToFTrkVar *o = track.tof_track; |
ToFTrkVar *o = track.tof_track; |
380 |
OrbitalInfoTrkVar *r = track.orb_track; |
OrbitalInfoTrkVar *r = track.orb_track; |
381 |
|
|
382 |
trk_track = 0; |
trk_ext_track = 0; |
383 |
calo_track = 0; |
trk_track = 0; |
384 |
tof_track = 0; |
calo_track = 0; |
385 |
orb_track = 0; |
tof_track = 0; |
386 |
|
orb_track = 0; |
387 |
|
if(e) |
388 |
|
trk_ext_track = new ExtTrack(*e); |
389 |
if (t) |
if (t) |
390 |
trk_track = new TrkTrack(*t); |
trk_track = new TrkTrack(*t); |
391 |
if (c) |
if (c) |
394 |
tof_track = new ToFTrkVar(*o); |
tof_track = new ToFTrkVar(*o); |
395 |
if (r) |
if (r) |
396 |
orb_track = new OrbitalInfoTrkVar(*r); |
orb_track = new OrbitalInfoTrkVar(*r); |
397 |
|
|
398 |
candeleteobj = 1; |
candeleteobj = 1; |
399 |
|
pscore = 0; |
400 |
|
iscore = 0; |
401 |
|
|
402 |
} |
} |
403 |
void PamTrack::Clear() { |
void PamTrack::Clear(Option_t *option) { |
404 |
|
|
405 |
// cout << "PamTrack::Clear() "<<candeleteobj<<endl; |
// cout << "PamTrack::Clear( "<<option<<" ) "<<candeleteobj<<endl; |
406 |
if (candeleteobj) { |
if (candeleteobj) { |
407 |
|
|
408 |
|
if (trk_ext_track) |
409 |
|
trk_ext_track->ExtTrack::Clear(option); |
410 |
if (trk_track) |
if (trk_track) |
411 |
trk_track->TrkTrack::Clear(); |
trk_track->TrkTrack::Clear(); |
412 |
if (calo_track) |
if (calo_track) |
417 |
orb_track->OrbitalInfoTrkVar::Clear();//??? |
orb_track->OrbitalInfoTrkVar::Clear();//??? |
418 |
} |
} |
419 |
else { |
else { |
420 |
|
trk_ext_track = 0; |
421 |
trk_track = 0; |
trk_track = 0; |
422 |
calo_track = 0; |
calo_track = 0; |
423 |
tof_track = 0; |
tof_track = 0; |
430 |
void PamTrack::Delete() { |
void PamTrack::Delete() { |
431 |
// cout << "PamTrack::Delete() "<<candeleteobj<<endl; |
// cout << "PamTrack::Delete() "<<candeleteobj<<endl; |
432 |
if (candeleteobj) { |
if (candeleteobj) { |
433 |
|
if (trk_ext_track) { |
434 |
|
trk_ext_track->ExtTrack::Clear("C"); |
435 |
|
delete trk_ext_track; |
436 |
|
} |
437 |
if (trk_track) { |
if (trk_track) { |
438 |
trk_track->TrkTrack::Clear(); |
trk_track->TrkTrack::Clear(); |
439 |
delete trk_track; |
delete trk_track; |
455 |
Clear(); |
Clear(); |
456 |
} |
} |
457 |
} |
} |
458 |
|
|
459 |
|
|
460 |
|
|
461 |
|
|
462 |
//-------------------------------------- |
//-------------------------------------- |
463 |
// |
// |
464 |
// |
// |
492 |
GetPamTree(listf, detlist); |
GetPamTree(listf, detlist); |
493 |
if (listf) |
if (listf) |
494 |
GetRunTree(listf); |
GetRunTree(listf); |
495 |
this->SetMaxShift(-1); |
SetMaxShift(-1); |
496 |
} |
} |
497 |
|
|
498 |
|
|
500 |
Initialize(); |
Initialize(); |
501 |
GetPamTree(llist, detlist); |
GetPamTree(llist, detlist); |
502 |
GetRunTree(llist); |
GetRunTree(llist); |
503 |
this->SetMaxShift(-1); |
SetMaxShift(-1); |
504 |
} |
} |
505 |
|
|
506 |
/** |
/** |
512 |
*/ |
*/ |
513 |
PamLevel2::PamLevel2(TString ddir, TString llist) { |
PamLevel2::PamLevel2(TString ddir, TString llist) { |
514 |
Initialize(); |
Initialize(); |
515 |
TList* listf = GetListOfLevel2Files(ddir, llist); |
TList* listf = GetListOfLevel2Files(ddir, llist); |
516 |
|
cout << "GetPamTree: "<<endl; |
517 |
GetPamTree(listf, ""); |
GetPamTree(listf, ""); |
518 |
|
cout << "GetRunTree: "<<endl; |
519 |
GetRunTree(listf); |
GetRunTree(listf); |
520 |
this->SetMaxShift(-1); |
SetMaxShift(-1); |
521 |
} |
} |
522 |
|
|
523 |
|
|
532 |
trkh_obj = 0; |
trkh_obj = 0; |
533 |
calo1_obj = 0; |
calo1_obj = 0; |
534 |
calo2_obj = 0; |
calo2_obj = 0; |
535 |
tof_obj = 0; |
tof2_obj = 0; |
536 |
trig_obj = 0; |
trig_obj = 0; |
537 |
s4_obj = 0; |
s4_obj = 0; |
538 |
nd_obj = 0; |
nd_obj = 0; |
539 |
ac_obj = 0; |
ac_obj = 0; |
540 |
orb_obj = 0; |
orb2_obj = 0; |
541 |
gp_obj = 0; |
gp_obj = 0; |
542 |
|
|
543 |
|
extAlgFlag=0; |
544 |
|
|
545 |
|
trk_ext_obj = 0; |
546 |
|
trk_ext_nuc_obj = 0; |
547 |
|
trk_nuc_obj = 0; |
548 |
|
|
549 |
|
calo_ext_obj = 0; |
550 |
|
calo_ext_nuc_obj = 0; |
551 |
|
calo_nuc_obj = 0; |
552 |
|
|
553 |
|
tof_ext_obj = 0; |
554 |
|
tof_ext_nuc_obj = 0; |
555 |
|
tof_nuc_obj = 0; |
556 |
|
|
557 |
|
orb_ext_obj = 0; |
558 |
|
orb_ext_nuc_obj = 0; |
559 |
|
orb_nuc_obj = 0; |
560 |
|
|
561 |
|
trk2_nuc_obj = 0; |
562 |
|
calo2_nuc_obj = 0; |
563 |
|
tof2_nuc_obj = 0; |
564 |
|
orb2_nuc_obj = 0; |
565 |
|
|
566 |
|
|
567 |
run_obj = 0;//new GL_RUN(); |
run_obj = 0;//new GL_RUN(); |
568 |
soft_obj = 0;// Emiliano |
soft_obj = 0;// Emiliano |
569 |
|
proc_obj = 0;// Emiliano |
570 |
irun = -1LL; |
irun = -1LL; |
571 |
irunt = -1LL; |
irunt = -1LL; |
572 |
totrunentry = 0LL; |
totrunentry = 0LL; |
576 |
runlastentry = 0LL; |
runlastentry = 0LL; |
577 |
gltsync = 0; // Emiliano |
gltsync = 0; // Emiliano |
578 |
fUpdateRunInfo = true; // Emiliano |
fUpdateRunInfo = true; // Emiliano |
579 |
|
fUseDBinRunInfo = true; // Emiliano |
580 |
|
fDiscarded = false; //EM |
581 |
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 |
582 |
il0entry = 0LL; |
il0entry = 0LL; |
583 |
// hasL0EE = true; |
// hasL0EE = true; |
593 |
|
|
594 |
run_tree = NULL; |
run_tree = NULL; |
595 |
run_tree_clone = NULL; |
run_tree_clone = NULL; |
596 |
|
|
597 |
|
proc_tree = NULL; |
598 |
|
proc_tree_clone = NULL; |
599 |
|
|
600 |
sel_tree = NULL; |
sel_tree = NULL; |
601 |
sel_tree_clone = NULL; |
sel_tree_clone = NULL; |
602 |
|
|
644 |
ND = true; |
ND = true; |
645 |
AC = true; |
AC = true; |
646 |
ORB = true; |
ORB = true; |
647 |
|
PROC = true; |
648 |
GP = false; |
GP = false; |
649 |
|
|
650 |
|
EXT = false; |
651 |
|
NUC = false; |
652 |
|
trkAlg = "STD";//default tracking algorythm |
653 |
|
|
654 |
RUN = true; |
RUN = true; |
655 |
|
|
656 |
SELLI = -1; |
SELLI = -1; |
661 |
|
|
662 |
tsorted = 0; |
tsorted = 0; |
663 |
timage = 0; |
timage = 0; |
664 |
|
text = 0 ; |
665 |
|
|
666 |
|
tsorted_nuc = 0; |
667 |
|
timage_nuc = 0; |
668 |
|
text_nuc = 0 ; |
669 |
|
|
670 |
howtosort = "+CAL+TOF"; |
howtosort = "+CAL+TOF"; |
671 |
//howtosort = "+TOF"; |
//howtosort = "+TOF"; |
673 |
|
|
674 |
issorted = false; |
issorted = false; |
675 |
lastsorted = -1; |
lastsorted = -1; |
676 |
|
issorted_new = false; |
677 |
|
lastsorted_new = -1; |
678 |
|
|
679 |
} |
} |
680 |
; |
; |
687 |
delete run_obj; |
delete run_obj; |
688 |
if (soft_obj) |
if (soft_obj) |
689 |
delete soft_obj; //Emiliano |
delete soft_obj; //Emiliano |
690 |
|
if (proc_obj) |
691 |
|
delete proc_obj; //Emiliano |
692 |
|
|
693 |
// cout << "void PamLevel2::Clear()"<<endl; |
// cout << "void PamLevel2::Clear()"<<endl; |
694 |
if (h0_obj) |
if (h0_obj) |
707 |
delete calo1_obj; |
delete calo1_obj; |
708 |
if (calo2_obj) |
if (calo2_obj) |
709 |
delete calo2_obj; |
delete calo2_obj; |
710 |
if (tof_obj) |
if (tof2_obj) |
711 |
delete tof_obj; |
delete tof2_obj; |
712 |
if (trig_obj) |
if (trig_obj) |
713 |
delete trig_obj; |
delete trig_obj; |
714 |
if (s4_obj) |
if (s4_obj) |
717 |
delete nd_obj; |
delete nd_obj; |
718 |
if (ac_obj) |
if (ac_obj) |
719 |
delete ac_obj; |
delete ac_obj; |
720 |
if (orb_obj) |
if (orb2_obj) |
721 |
delete orb_obj; |
delete orb2_obj; |
722 |
if (gp_obj) |
if (gp_obj) |
723 |
delete gp_obj; |
delete gp_obj; |
724 |
|
|
725 |
|
if(trk_nuc_obj)trk_nuc_obj->Delete(); |
726 |
|
if(trk_ext_obj)trk_ext_obj->Delete(); |
727 |
|
if(trk_ext_nuc_obj)trk_ext_nuc_obj->Delete(); |
728 |
|
|
729 |
|
if(calo_nuc_obj)calo_nuc_obj->Delete(); |
730 |
|
if(calo_ext_obj)calo_ext_obj->Delete(); |
731 |
|
if(calo_ext_nuc_obj)calo_ext_nuc_obj->Delete(); |
732 |
|
|
733 |
|
if(tof_nuc_obj)tof_nuc_obj->Delete(); |
734 |
|
if(tof_ext_obj)tof_ext_obj->Delete(); |
735 |
|
if(tof_ext_nuc_obj)tof_ext_nuc_obj->Delete(); |
736 |
|
|
737 |
|
if(orb_nuc_obj)orb_nuc_obj->Delete(); |
738 |
|
if(orb_ext_obj)orb_ext_obj->Delete(); |
739 |
|
if(orb_ext_nuc_obj)orb_ext_nuc_obj->Delete(); |
740 |
|
|
741 |
|
|
742 |
|
if(trk2_nuc_obj)trk2_nuc_obj->Delete();; |
743 |
|
if( calo2_nuc_obj)calo2_nuc_obj->Delete();; |
744 |
|
if(tof2_nuc_obj)tof2_nuc_obj->Delete();; |
745 |
|
if(orb2_nuc_obj)orb2_nuc_obj->Delete();; |
746 |
|
|
747 |
|
|
748 |
|
|
749 |
if (tsorted) { |
if (tsorted) { |
750 |
tsorted->Delete(); |
tsorted->Delete(); |
751 |
delete tsorted; |
delete tsorted; |
754 |
timage->Delete(); |
timage->Delete(); |
755 |
delete timage; |
delete timage; |
756 |
} |
} |
757 |
|
if (text) { |
758 |
|
text->Delete(); |
759 |
|
delete text; |
760 |
|
} |
761 |
|
if (tsorted_nuc) { |
762 |
|
tsorted_nuc->Delete(); |
763 |
|
delete tsorted_nuc; |
764 |
|
} |
765 |
|
if (timage_nuc) { |
766 |
|
timage_nuc->Delete(); |
767 |
|
delete timage_nuc; |
768 |
|
} |
769 |
|
if (text_nuc) { |
770 |
|
text_nuc->Delete(); |
771 |
|
delete text_nuc; |
772 |
|
} |
773 |
|
|
774 |
|
|
775 |
|
|
776 |
if (dbc) { |
if (dbc) { |
777 |
dbc->Close(); |
dbc->Close(); |
839 |
if (irunoffset) |
if (irunoffset) |
840 |
delete[] irunoffset; |
delete[] irunoffset; |
841 |
|
|
842 |
|
|
843 |
|
Initialize(); |
844 |
|
|
845 |
} |
} |
846 |
; |
; |
847 |
|
|
875 |
calo1_obj->Clear(); |
calo1_obj->Clear(); |
876 |
if (calo2_obj) |
if (calo2_obj) |
877 |
calo2_obj->Clear(); |
calo2_obj->Clear(); |
878 |
if (tof_obj) |
if (tof2_obj) |
879 |
tof_obj->Clear(); |
tof2_obj->Clear(); |
880 |
if (trig_obj) |
if (trig_obj) |
881 |
trig_obj->Clear(); |
trig_obj->Clear(); |
882 |
if (s4_obj) |
if (s4_obj) |
885 |
nd_obj->Clear(); |
nd_obj->Clear(); |
886 |
if (ac_obj) |
if (ac_obj) |
887 |
ac_obj->Clear(); |
ac_obj->Clear(); |
888 |
if (orb_obj) |
if (orb2_obj) |
889 |
orb_obj->Clear(); |
orb2_obj->Clear(); |
890 |
if (gp_obj) |
if (gp_obj) |
891 |
gp_obj->Clear(); |
gp_obj->Clear(); |
892 |
|
if (proc_obj) |
893 |
|
proc_obj->Clear(); |
894 |
|
|
895 |
// if(sorted_tracks)sorted_tracks->Clear(); |
// if(sorted_tracks)sorted_tracks->Clear(); |
896 |
// sorted_tracks.Clear(); |
// sorted_tracks.Clear(); |
897 |
|
|
898 |
if (tsorted) { |
if(trk_nuc_obj)trk_nuc_obj->Clear(); |
899 |
tsorted->Delete(); |
if(trk_ext_obj)trk_ext_obj->Clear(); |
900 |
} |
if(trk_ext_nuc_obj)trk_ext_nuc_obj->Clear(); |
901 |
if (timage) { |
|
902 |
timage->Delete(); |
if(calo_nuc_obj)calo_nuc_obj->Clear(); |
903 |
} |
if(calo_ext_obj)calo_ext_obj->Clear(); |
904 |
|
if(calo_ext_nuc_obj)calo_ext_nuc_obj->Clear(); |
905 |
|
|
906 |
|
if(tof_nuc_obj)tof_nuc_obj->Clear(); |
907 |
|
if(tof_ext_obj)tof_ext_obj->Clear(); |
908 |
|
if(tof_ext_nuc_obj)tof_ext_nuc_obj->Clear(); |
909 |
|
|
910 |
|
if(orb_nuc_obj)orb_nuc_obj->Clear(); |
911 |
|
if(orb_ext_obj)orb_ext_obj->Clear(); |
912 |
|
if(orb_ext_nuc_obj)orb_ext_nuc_obj->Clear(); |
913 |
|
|
914 |
|
if(trk2_nuc_obj)trk2_nuc_obj->Clear();; |
915 |
|
if( calo2_nuc_obj)calo2_nuc_obj->Clear();; |
916 |
|
if(tof2_nuc_obj)tof2_nuc_obj->Clear();; |
917 |
|
if(orb2_nuc_obj)orb2_nuc_obj->Clear();; |
918 |
|
|
919 |
|
if (tsorted)tsorted->Delete(); |
920 |
|
if (timage)timage->Delete(); |
921 |
|
if (text) text->Delete(); |
922 |
|
|
923 |
|
if (tsorted_nuc)tsorted_nuc->Delete(); |
924 |
|
if (timage_nuc)timage_nuc->Delete(); |
925 |
|
if (text_nuc) text_nuc->Delete(); |
926 |
} |
} |
927 |
; |
; |
928 |
|
|
971 |
if (sel_tree) |
if (sel_tree) |
972 |
sel_tree->Delete();; |
sel_tree->Delete();; |
973 |
sel_tree = NULL; |
sel_tree = NULL; |
974 |
|
|
975 |
|
if (proc_tree) |
976 |
|
proc_tree->Delete(); |
977 |
|
proc_tree = NULL; |
978 |
// |
// |
979 |
// Close file |
// Close file |
980 |
// |
// |
991 |
trkh_obj = 0; |
trkh_obj = 0; |
992 |
calo1_obj = 0; |
calo1_obj = 0; |
993 |
calo2_obj = 0; |
calo2_obj = 0; |
994 |
tof_obj = 0; |
tof2_obj = 0; |
995 |
trig_obj = 0; |
trig_obj = 0; |
996 |
s4_obj = 0; |
s4_obj = 0; |
997 |
nd_obj = 0; |
nd_obj = 0; |
998 |
ac_obj = 0; |
ac_obj = 0; |
999 |
orb_obj = 0; |
orb2_obj = 0; |
1000 |
gp_obj = 0; |
gp_obj = 0; |
1001 |
|
proc_obj = 0; |
1002 |
|
|
1003 |
|
trk_ext_obj = 0; |
1004 |
|
trk_ext_nuc_obj = 0; |
1005 |
|
trk_nuc_obj = 0; |
1006 |
|
|
1007 |
|
calo_ext_obj = 0; |
1008 |
|
calo_ext_nuc_obj = 0; |
1009 |
|
calo_nuc_obj = 0; |
1010 |
|
|
1011 |
|
tof_ext_obj = 0; |
1012 |
|
tof_ext_nuc_obj = 0; |
1013 |
|
tof_nuc_obj = 0; |
1014 |
|
|
1015 |
|
orb_ext_obj = 0; |
1016 |
|
orb_ext_nuc_obj = 0; |
1017 |
|
orb_nuc_obj = 0; |
1018 |
|
|
1019 |
|
trk2_nuc_obj = 0; |
1020 |
|
calo2_nuc_obj = 0; |
1021 |
|
tof2_nuc_obj = 0; |
1022 |
|
orb2_nuc_obj = 0; |
1023 |
|
|
1024 |
|
trk2_nuc_obj = 0; |
1025 |
|
calo2_nuc_obj = 0; |
1026 |
|
tof2_nuc_obj = 0; |
1027 |
|
orb2_nuc_obj = 0; |
1028 |
// |
// |
1029 |
// Reset run pointers |
// Reset run pointers |
1030 |
// |
// |
1031 |
run_obj = 0;//new GL_RUN(); |
run_obj = 0;//new GL_RUN(); |
1032 |
soft_obj = 0;// Emiliano |
soft_obj = 0;// Emiliano |
1033 |
|
proc_obj = 0;// Emiliano |
1034 |
irun = -1; |
irun = -1; |
1035 |
irunt = -1; |
irunt = -1; |
1036 |
totrunentry = 0LL; |
totrunentry = 0LL; |
1060 |
if (strict) { |
if (strict) { |
1061 |
if (trk2_obj && trk2_obj->UnpackError() != 0) |
if (trk2_obj && trk2_obj->UnpackError() != 0) |
1062 |
goodev = false; |
goodev = false; |
1063 |
if (tof_obj && tof_obj->unpackError != 0) |
if (tof2_obj && tof2_obj->unpackError != 0) |
1064 |
goodev = false; |
goodev = false; |
1065 |
if (trig_obj && trig_obj->unpackError != 0) |
if (trig_obj && trig_obj->unpackError != 0) |
1066 |
goodev = false; |
goodev = false; |
1070 |
goodev = false; |
goodev = false; |
1071 |
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))) |
1072 |
goodev = false; |
goodev = false; |
1073 |
// if(orb_obj) |
// if(orb2_obj) |
1074 |
} |
} |
1075 |
else { |
else { |
1076 |
if (nd_obj && nd_obj->unpackError != 0) |
if (nd_obj && nd_obj->unpackError != 0) |
1101 |
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"); |
1102 |
maxshift = sh; |
maxshift = sh; |
1103 |
} else { |
} else { |
1104 |
ULong64_t nev = this->GetEntries(); |
ULong64_t nev = GetEntries(); |
1105 |
ULong64_t runnev = 0ULL; |
ULong64_t runnev = 0ULL; |
1106 |
for (Int_t r=0; r< run_tree->GetEntries();r++){ |
for (Int_t r=0; r< run_tree->GetEntries();r++){ |
1107 |
run_tree->GetEntry(r);//update runinfo |
run_tree->GetEntry(r);//update runinfo |
1156 |
return &calo2_obj; |
return &calo2_obj; |
1157 |
}; |
}; |
1158 |
if (!objname.CompareTo("ToFLevel2")) { |
if (!objname.CompareTo("ToFLevel2")) { |
1159 |
if (!tof_obj) { |
if (!tof2_obj) { |
1160 |
tof_obj = new ToFLevel2(); |
tof2_obj = new ToFLevel2(); |
1161 |
tof_obj->Set(); |
tof2_obj->Set(); |
1162 |
} |
} |
1163 |
return &tof_obj; |
return &tof2_obj; |
1164 |
}; |
}; |
1165 |
if (!objname.CompareTo("TrigLevel2")) { |
if (!objname.CompareTo("TrigLevel2")) { |
1166 |
if (!trig_obj) |
if (!trig_obj) |
1183 |
return &ac_obj; |
return &ac_obj; |
1184 |
}; |
}; |
1185 |
if (!objname.CompareTo("OrbitalInfo")) { |
if (!objname.CompareTo("OrbitalInfo")) { |
1186 |
if (!orb_obj) { |
if (!orb2_obj) { |
1187 |
orb_obj = new OrbitalInfo(); |
orb2_obj = new OrbitalInfo(); |
1188 |
orb_obj->Set(); |
orb2_obj->Set(); |
1189 |
} |
} |
1190 |
return &orb_obj; |
return &orb2_obj; |
1191 |
}; |
}; |
1192 |
// if(!objname.CompareTo("OrbitalInfo")){ |
// if(!objname.CompareTo("OrbitalInfo")){ |
1193 |
// if(!orb_obj) orb_obj = new OrbitalInfo(); |
// if(!orb2_obj) orb2_obj = new OrbitalInfo(); |
1194 |
// return &orb_obj; |
// return &orb2_obj; |
1195 |
// }; |
// }; |
1196 |
if (!objname.CompareTo("GPamela")) { |
if (!objname.CompareTo("GPamela")) { |
1197 |
if (!gp_obj) |
if (!gp_obj) |
1205 |
if (!objname.CompareTo("SoftInfo")) |
if (!objname.CompareTo("SoftInfo")) |
1206 |
return &soft_obj; // Emiliano |
return &soft_obj; // Emiliano |
1207 |
|
|
1208 |
|
if (!objname.CompareTo("ProcInfo")){ |
1209 |
|
if (!proc_obj) |
1210 |
|
proc_obj = new ProcInfo(); |
1211 |
|
return &proc_obj; // Emiliano |
1212 |
|
} |
1213 |
|
|
1214 |
return NULL; |
return NULL; |
1215 |
} |
} |
1216 |
; |
; |
1261 |
*/ |
*/ |
1262 |
ToFTrkVar *PamLevel2::GetToFStoredTrack(int seqno) { |
ToFTrkVar *PamLevel2::GetToFStoredTrack(int seqno) { |
1263 |
|
|
1264 |
if (!tof_obj) |
if (!tof2_obj) |
1265 |
return 0; |
return 0; |
1266 |
|
|
1267 |
if (tof_obj->ToFLevel2::ntrk() == 0) { |
if (tof2_obj->ToFLevel2::ntrk() == 0) { |
1268 |
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" |
1269 |
<< endl; |
<< endl; |
1270 |
return NULL; |
return NULL; |
1274 |
Int_t it_tof = 0; |
Int_t it_tof = 0; |
1275 |
|
|
1276 |
do { |
do { |
1277 |
c = tof_obj->ToFLevel2::GetToFTrkVar(it_tof); |
c = tof2_obj->ToFLevel2::GetToFTrkVar(it_tof); |
1278 |
it_tof++; |
it_tof++; |
1279 |
} while (c && seqno != c->trkseqno && it_tof < tof_obj->ToFLevel2::ntrk()); |
} while (c && seqno != c->trkseqno && it_tof < tof2_obj->ToFLevel2::ntrk()); |
1280 |
|
|
1281 |
if (!c || seqno != c->trkseqno) { |
if (!c || seqno != c->trkseqno) { |
1282 |
c = 0; |
c = 0; |
1299 |
*/ |
*/ |
1300 |
OrbitalInfoTrkVar *PamLevel2::GetOrbitalInfoStoredTrack(int seqno) { |
OrbitalInfoTrkVar *PamLevel2::GetOrbitalInfoStoredTrack(int seqno) { |
1301 |
|
|
1302 |
if (!orb_obj) |
if (!orb2_obj) |
1303 |
return 0; |
return 0; |
1304 |
|
|
1305 |
if (orb_obj->OrbitalInfo::ntrk() == 0) { |
if (orb2_obj->OrbitalInfo::ntrk() == 0) { |
1306 |
// // TRICK BEGIN |
// // TRICK BEGIN |
1307 |
// OrbitalInfoTrkVar *r = new OrbitalInfoTrkVar(); // TEMPORARY TRICK |
// OrbitalInfoTrkVar *r = new OrbitalInfoTrkVar(); // TEMPORARY TRICK |
1308 |
// Int_t nn = 0; |
// Int_t nn = 0; |
1309 |
// TClonesArray &tor = *orb_obj->OrbitalInfoTrk; |
// TClonesArray &tor = *orb2_obj->OrbitalInfoTrk; |
1310 |
// for(Int_t nt=0; nt < tof_obj->ToFLevel2::ntrk(); nt++){ |
// for(Int_t nt=0; nt < tof2_obj->ToFLevel2::ntrk(); nt++){ |
1311 |
// // |
// // |
1312 |
// ToFTrkVar *ptt = tof_obj->ToFLevel2::GetToFTrkVar(nt); |
// ToFTrkVar *ptt = tof2_obj->ToFLevel2::GetToFTrkVar(nt); |
1313 |
// if ( ptt->trkseqno != -1 ){ |
// if ( ptt->trkseqno != -1 ){ |
1314 |
// // |
// // |
1315 |
// r->trkseqno = ptt->trkseqno; |
// r->trkseqno = ptt->trkseqno; |
1331 |
// }; |
// }; |
1332 |
// delete r; |
// delete r; |
1333 |
// OrbitalInfoTrkVar *c = 0; |
// OrbitalInfoTrkVar *c = 0; |
1334 |
// c = orb_obj->OrbitalInfo::GetOrbitalInfoTrkVar(0); |
// c = orb2_obj->OrbitalInfo::GetOrbitalInfoTrkVar(0); |
1335 |
// return c; |
// return c; |
1336 |
// //TRICK END |
// //TRICK END |
1337 |
cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo " << seqno |
cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo " << seqno |
1343 |
Int_t it_tof = 0; |
Int_t it_tof = 0; |
1344 |
|
|
1345 |
do { |
do { |
1346 |
c = orb_obj->OrbitalInfo::GetOrbitalInfoTrkVar(it_tof); |
c = orb2_obj->OrbitalInfo::GetOrbitalInfoTrkVar(it_tof); |
1347 |
it_tof++; |
it_tof++; |
1348 |
} while (c && seqno != c->trkseqno && it_tof < orb_obj->OrbitalInfo::ntrk()); |
} while (c && seqno != c->trkseqno && it_tof < orb2_obj->OrbitalInfo::ntrk()); |
1349 |
|
|
1350 |
if (!c || seqno != c->trkseqno) { |
if (!c || seqno != c->trkseqno) { |
1351 |
c = 0; |
c = 0; |
1476 |
// create TCloneArrays to store tracks and its images |
// create TCloneArrays to store tracks and its images |
1477 |
if (!tsorted) |
if (!tsorted) |
1478 |
tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
1479 |
tsorted->Delete(); |
tsorted->Clear("C+C");//Delete(); |
1480 |
TClonesArray &ttsorted = *tsorted; |
TClonesArray &ttsorted = *tsorted; |
1481 |
|
|
1482 |
if (!timage) |
if (!timage) |
1483 |
timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
1484 |
timage->Delete(); |
timage->Clear("C+C");//Delete(); |
1485 |
TClonesArray &ttimage = *timage; |
TClonesArray &ttimage = *timage; |
1486 |
|
|
1487 |
|
|
1488 |
|
|
1489 |
//-------------------------------------------------- |
//-------------------------------------------------- |
1490 |
// retrieve sorting method |
// retrieve sorting method |
1491 |
//-------------------------------------------------- |
//-------------------------------------------------- |
1601 |
// ----------------------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------------------- |
1602 |
// check the number of hit pmts along the track |
// check the number of hit pmts along the track |
1603 |
// on S12 S21 and S32, where paddles are parallel to Y axis |
// on S12 S21 and S32, where paddles are parallel to Y axis |
1604 |
if ((use_TOF || use_S1 || use_S2 || use_S3) && !tof_obj) { |
if ((use_TOF || use_S1 || use_S2 || use_S3) && !tof2_obj) { |
1605 |
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but ToFLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but ToFLevel2 not loaded !!!"; |
1606 |
return; |
return; |
1607 |
}; |
}; |
1618 |
// |
// |
1619 |
Float_t sen = 0.; |
Float_t sen = 0.; |
1620 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1621 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1622 |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
1623 |
sen += (op->dedx).At(ih); |
sen += (op->dedx).At(ih); |
1624 |
}; |
}; |
1625 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1626 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1627 |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
1628 |
sen += (oi->dedx).At(ih); |
sen += (oi->dedx).At(ih); |
1629 |
}; |
}; |
1636 |
Int_t nz = 6; |
Int_t nz = 6; |
1637 |
Float_t zin[6]; // << define TOF z-coordinates |
Float_t zin[6]; // << define TOF z-coordinates |
1638 |
for (Int_t ip = 0; ip < nz; ip++) |
for (Int_t ip = 0; ip < nz; ip++) |
1639 |
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 |
1640 |
Trajectory *tr = new Trajectory(nz, zin); |
Trajectory *tr = new Trajectory(nz, zin); |
1641 |
// |
// |
1642 |
Int_t nphit_p = 0; |
Int_t nphit_p = 0; |
1645 |
Float_t enhit_i = 0.; |
Float_t enhit_i = 0.; |
1646 |
// |
// |
1647 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1648 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1649 |
if (pl == 1 || pl == 2 || pl == 5) { |
if (pl == 1 || pl == 2 || pl == 5) { |
1650 |
nphit_p++; |
nphit_p++; |
1651 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1656 |
// |
// |
1657 |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
1658 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1659 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1660 |
if (pl == 0) { |
if (pl == 0) { |
1661 |
nphit_p++; |
nphit_p++; |
1662 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1665 |
}; |
}; |
1666 |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
1667 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1668 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1669 |
if (pl == 3) { |
if (pl == 3) { |
1670 |
nphit_p++; |
nphit_p++; |
1671 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1674 |
}; |
}; |
1675 |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
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 == 4) { |
if (pl == 4) { |
1679 |
nphit_p++; |
nphit_p++; |
1680 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1683 |
}; |
}; |
1684 |
|
|
1685 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1686 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1687 |
if (pl == 1 || pl == 2 || pl == 5) { |
if (pl == 1 || pl == 2 || pl == 5) { |
1688 |
nphit_i++; |
nphit_i++; |
1689 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1694 |
// |
// |
1695 |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
1696 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1697 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1698 |
if (pl == 0) { |
if (pl == 0) { |
1699 |
nphit_i++; |
nphit_i++; |
1700 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1703 |
}; |
}; |
1704 |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
1705 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1706 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1707 |
if (pl == 3) { |
if (pl == 3) { |
1708 |
nphit_i++; |
nphit_i++; |
1709 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1712 |
}; |
}; |
1713 |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
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 == 4) { |
if (pl == 4) { |
1717 |
nphit_i++; |
nphit_i++; |
1718 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1756 |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
1757 |
|
|
1758 |
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
1759 |
// Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
// Int_t pl = tof2_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
1760 |
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
1761 |
// }; |
// }; |
1762 |
|
|
1763 |
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
1764 |
// Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
// Int_t pl = tof2_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
1765 |
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
1766 |
// }; |
// }; |
1767 |
// --- modified to count tdc signals (more efficient?) |
// --- modified to count tdc signals (more efficient?) |
1768 |
// --- and to implement check on tdcflag |
// --- and to implement check on tdcflag |
1769 |
for (Int_t ih = 0; ih < op->npmttdc; ih++) { |
for (Int_t ih = 0; ih < op->npmttdc; ih++) { |
1770 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmttdc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmttdc).At(ih)); |
1771 |
// 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++; |
1772 |
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)) |
1773 |
|| (use_S3 && (pl == 4 || pl == 5))) { |
|| (use_S3 && (pl == 4 || pl == 5))) { |
1777 |
}; |
}; |
1778 |
|
|
1779 |
for (Int_t ih = 0; ih < oi->npmttdc; ih++) { |
for (Int_t ih = 0; ih < oi->npmttdc; ih++) { |
1780 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmttdc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmttdc).At(ih)); |
1781 |
// 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++; |
1782 |
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)) |
1783 |
|| (use_S3 && (pl == 4 || pl == 5))) { |
|| (use_S3 && (pl == 4 || pl == 5))) { |
1952 |
|
|
1953 |
} |
} |
1954 |
; |
; |
1955 |
|
// |
1956 |
|
//-------------------------------------- |
1957 |
|
/** |
1958 |
|
* Sort physical (tracker) tracks. |
1959 |
|
* @param how String to set the sorting cryterium (es: "CAL" or "TRK+CAL+TOF" ecc...). |
1960 |
|
* Sorting cryteria: |
1961 |
|
* TRK: lower chi**2 |
1962 |
|
* CAL: lower Y spatial residual on the first calorimeter plane |
1963 |
|
* TOF: bigger numebr of hit PMTs along the track, on S12 S21 S32 (where paddles are along the Y axis). |
1964 |
|
* S1: (ask Emiliano) |
1965 |
|
* S2: (ask Emiliano) |
1966 |
|
* S3: (ask Emiliano) |
1967 |
|
* GP: more GP hits |
1968 |
|
* The default sorting cryterium is "TOF+CAL". |
1969 |
|
* |
1970 |
|
* 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). |
1971 |
|
* |
1972 |
|
* New version, with handling of extended tracks and nuclei tracks. |
1973 |
|
*/ |
1974 |
|
void PamLevel2::SortTracksNew() { |
1975 |
|
|
1976 |
|
//-------------------------------------------------- |
1977 |
|
//Check if the current event has already been sorted |
1978 |
|
//-------------------------------------------------- |
1979 |
|
if (issorted_new && lastsorted_new == GetReadEntry()) { |
1980 |
|
return; //already done for this event |
1981 |
|
} |
1982 |
|
|
1983 |
|
|
1984 |
|
// cout << "SORT" << endl; |
1985 |
|
|
1986 |
|
//Reset the sort flags, just in case something will go wrong... |
1987 |
|
issorted_new = false; |
1988 |
|
lastsorted_new = -1; |
1989 |
|
|
1990 |
|
//-------------------------------------------------- |
1991 |
|
// set input variables |
1992 |
|
//-------------------------------------------------- |
1993 |
|
|
1994 |
|
TString how = howtosort; |
1995 |
|
//Save current Object count |
1996 |
|
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
1997 |
|
|
1998 |
|
|
1999 |
|
|
2000 |
|
|
2001 |
|
TrkLevel2 * trk2 ; |
2002 |
|
CaloLevel2 * calo2; |
2003 |
|
ToFLevel2 * tof2 ; |
2004 |
|
OrbitalInfo * orb2 ; |
2005 |
|
|
2006 |
|
TClonesArray * trkext ; |
2007 |
|
TClonesArray * caloext; |
2008 |
|
TClonesArray * tofext ; |
2009 |
|
TClonesArray * orbext ; |
2010 |
|
|
2011 |
|
|
2012 |
|
// cout << "trk2_obj" << trk2_obj<< endl; |
2013 |
|
// cout << "trk2_nuc_obj" << trk2_nuc_obj<< endl; |
2014 |
|
// cout << " trk_ext_obj "<<trk_ext_obj<< endl; |
2015 |
|
// cout << " trk_ext_nuc_obj "<<trk_ext_nuc_obj<< endl; |
2016 |
|
|
2017 |
|
//----------------------------------------------------------- |
2018 |
|
// create/reset TCloneArrays to store tracks and their images |
2019 |
|
//----------------------------------------------------------- |
2020 |
|
|
2021 |
|
// cout << " PamLevel2::SortTracksNew() --- Clear TClonesArray objects"<<endl; |
2022 |
|
|
2023 |
|
// main tracks from standard alg |
2024 |
|
// if (!tsorted) |
2025 |
|
// tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2026 |
|
// tsorted->Clear("C+C");//Delete(); |
2027 |
|
// // track images from standard alg |
2028 |
|
// if (!timage) |
2029 |
|
// timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2030 |
|
// timage->Clear("C+C");//Delete(); |
2031 |
|
// // tracks from extended algorythm |
2032 |
|
// if(EXT && !text) |
2033 |
|
// text = new TClonesArray("PamTrack",trk_ext_obj->GetEntries()); |
2034 |
|
// if(text)text->Clear("C+C");//Delete(); |
2035 |
|
|
2036 |
|
if(tsorted)delete tsorted; |
2037 |
|
if(timage) delete timage; |
2038 |
|
if(text) delete text; |
2039 |
|
tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2040 |
|
timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2041 |
|
text = new TClonesArray("PamTrack",trk_ext_obj->GetEntries()); |
2042 |
|
|
2043 |
|
//----------------------------------------------------------- |
2044 |
|
// create/reset TCloneArrays to store tracks and their images |
2045 |
|
//----------------------------------------------------------- |
2046 |
|
if(NUC){ |
2047 |
|
|
2048 |
|
|
2049 |
|
if(tsorted_nuc)delete tsorted_nuc; |
2050 |
|
if(timage_nuc) delete timage_nuc; |
2051 |
|
if(text_nuc) delete text_nuc; |
2052 |
|
tsorted_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2053 |
|
timage_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2054 |
|
text_nuc = new TClonesArray("PamTrack",trk_ext_nuc_obj->GetEntries()); |
2055 |
|
|
2056 |
|
// main tracks from standard alg |
2057 |
|
// if (!tsorted_nuc) |
2058 |
|
// tsorted_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2059 |
|
// tsorted_nuc->Clear("C+C");//Delete(); |
2060 |
|
// // track images from standard alg |
2061 |
|
// if (!timage_nuc) |
2062 |
|
// timage_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2063 |
|
// timage_nuc->Clear("C+C");//Delete(); |
2064 |
|
// // tracks from extended algorythm |
2065 |
|
// if(EXT && !text_nuc) |
2066 |
|
// text_nuc = new TClonesArray("PamTrack",trk_ext_nuc_obj->GetEntries()); |
2067 |
|
// if(text_nuc)text_nuc->Clear("C+C");//Delete(); |
2068 |
|
|
2069 |
|
} |
2070 |
|
//-------------------------------------------------- |
2071 |
|
// retrieve sorting method |
2072 |
|
//-------------------------------------------------- |
2073 |
|
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
2074 |
|
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
2075 |
|
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
2076 |
|
Bool_t use_S1 = how.Contains("S1", TString::kIgnoreCase); |
2077 |
|
Bool_t use_S2 = how.Contains("S2", TString::kIgnoreCase); |
2078 |
|
Bool_t use_S3 = how.Contains("S3", TString::kIgnoreCase); |
2079 |
|
Bool_t use_GP = how.Contains("GP", TString::kIgnoreCase); |
2080 |
|
|
2081 |
|
if (use_TOF) { |
2082 |
|
use_S1 = true; |
2083 |
|
use_S2 = true; |
2084 |
|
use_S3 = true; |
2085 |
|
}; |
2086 |
|
if (!CAL2 && use_CAL) |
2087 |
|
use_CAL = false; |
2088 |
|
if (!TOF) { |
2089 |
|
use_TOF = false; |
2090 |
|
use_S1 = false; |
2091 |
|
use_S2 = false; |
2092 |
|
use_S3 = false; |
2093 |
|
} |
2094 |
|
if (!GP) { |
2095 |
|
use_GP = false; |
2096 |
|
} |
2097 |
|
|
2098 |
|
if (!TRK2) { |
2099 |
|
cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
2100 |
|
return; |
2101 |
|
}; |
2102 |
|
|
2103 |
|
|
2104 |
|
/////////////////////////////////////////////////////////////////////////////////// |
2105 |
|
// |
2106 |
|
// sort tracks and fill PamTrack arrays |
2107 |
|
// |
2108 |
|
/////////////////////////////////////////////////////////////////////////////////// |
2109 |
|
for(int doit=0; doit<2; doit++){ |
2110 |
|
|
2111 |
|
// cout << "doit "<<doit<<endl; |
2112 |
|
|
2113 |
|
|
2114 |
|
if(doit == 0){ |
2115 |
|
|
2116 |
|
trk2 = trk2_obj; |
2117 |
|
calo2 = calo2_obj; |
2118 |
|
tof2 = tof2_obj; |
2119 |
|
orb2 = orb2_obj; |
2120 |
|
|
2121 |
|
trkext = trk_ext_obj; |
2122 |
|
caloext = calo_ext_obj; |
2123 |
|
tofext = tof_ext_obj; |
2124 |
|
orbext = orb_ext_obj; |
2125 |
|
|
2126 |
|
|
2127 |
|
|
2128 |
|
|
2129 |
|
|
2130 |
|
}else if (doit == 1){ |
2131 |
|
|
2132 |
|
if(!NUC)break; |
2133 |
|
|
2134 |
|
|
2135 |
|
trk2 = trk2_nuc_obj; |
2136 |
|
calo2 = calo2_nuc_obj; |
2137 |
|
tof2 = tof2_nuc_obj; |
2138 |
|
orb2 = orb2_nuc_obj; |
2139 |
|
|
2140 |
|
trkext = trk_ext_nuc_obj; |
2141 |
|
caloext = calo_ext_nuc_obj; |
2142 |
|
tofext = tof_ext_nuc_obj; |
2143 |
|
orbext = orb_ext_nuc_obj; |
2144 |
|
|
2145 |
|
|
2146 |
|
|
2147 |
|
|
2148 |
|
} |
2149 |
|
|
2150 |
|
// cout << "trk2" << trk2<<endl; |
2151 |
|
// cout << "calo2" << calo2<<endl; |
2152 |
|
// cout << "tof2" << tof2<<endl; |
2153 |
|
// cout << "orb2" << orb2<<endl; |
2154 |
|
// cout << "trkext" <<trkext <<endl; |
2155 |
|
// cout << "tofext" << tofext<<endl; |
2156 |
|
// cout << "caloext" << caloext<<endl; |
2157 |
|
// cout << "orbext" << orbext<<endl; |
2158 |
|
|
2159 |
|
TClonesArray &ttext = (doit==0 ? *text : *text_nuc); |
2160 |
|
TClonesArray &ttimage = (doit==0 ? *timage : *timage_nuc); |
2161 |
|
TClonesArray &ttsorted = (doit==0 ? *tsorted : *tsorted_nuc); |
2162 |
|
|
2163 |
|
// cout << "tsorted + timage "<<doit<<endl; |
2164 |
|
|
2165 |
|
//-------------------------------------------------- |
2166 |
|
// loop over "physical" tracks sorted by the tracker |
2167 |
|
//-------------------------------------------------- |
2168 |
|
for (Int_t i = 0; i < trk2->TrkLevel2::GetNTracks(); i++) { |
2169 |
|
|
2170 |
|
TrkTrack *ts = 0; |
2171 |
|
CaloTrkVar *cs = 0; |
2172 |
|
ToFTrkVar *os = 0; |
2173 |
|
OrbitalInfoTrkVar *rs = 0; |
2174 |
|
|
2175 |
|
// get tracker tracks |
2176 |
|
TrkTrack *tp = trk2->GetTrack(i); //tracker |
2177 |
|
CaloTrkVar *cp = calo2->GetCaloStoredTrack(tp->GetSeqNo()); |
2178 |
|
ToFTrkVar *op = tof2->GetToFStoredTrack(tp->GetSeqNo()); |
2179 |
|
OrbitalInfoTrkVar *rp = orb2->GetOrbitalInfoStoredTrack(tp->GetSeqNo()); |
2180 |
|
|
2181 |
|
TrkTrack *ti = 0; //tracker (image) |
2182 |
|
CaloTrkVar *ci = 0; |
2183 |
|
ToFTrkVar *oi = 0; |
2184 |
|
OrbitalInfoTrkVar *ri = 0; |
2185 |
|
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
2186 |
|
// if track has an image, check image selection |
2187 |
|
|
2188 |
|
Int_t tp_score = 0; //main track sorted by the tracker |
2189 |
|
Int_t ti_score = 0; //image track |
2190 |
|
Int_t totp_score = 0; //main track sorted by the tracker |
2191 |
|
Int_t toti_score = 0; //image track |
2192 |
|
|
2193 |
|
if (tp->HasImage()) { |
2194 |
|
|
2195 |
|
ti = trk2->GetTrackImage(i); //tracker (image) |
2196 |
|
ci = calo2->GetCaloStoredTrack(ti->GetSeqNo()); |
2197 |
|
oi = tof2->GetToFStoredTrack(ti->GetSeqNo()); |
2198 |
|
ri = orb2->GetOrbitalInfoStoredTrack(ti->GetSeqNo()); |
2199 |
|
|
2200 |
|
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
2201 |
|
|
2202 |
|
//assign starting scores |
2203 |
|
tp_score = 0; //main track sorted by the tracker |
2204 |
|
ti_score = 0; //image track |
2205 |
|
|
2206 |
|
// ----------------------------------------------------------------------------------------- |
2207 |
|
// ***************************************************************************************** |
2208 |
|
// ----------------------------------------------------------------------------------------- |
2209 |
|
// calorimeter check |
2210 |
|
// ----------------------------------------------------------------------------------------- |
2211 |
|
if (use_CAL && !calo2) { |
2212 |
|
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but CaloLevel2 not loaded !!!"; |
2213 |
|
return; |
2214 |
|
}; |
2215 |
|
if (use_CAL && !cp && ci) { |
2216 |
|
ti_score++; |
2217 |
|
toti_score++; |
2218 |
|
}; |
2219 |
|
if (use_CAL && cp && !ci) { |
2220 |
|
tp_score++; |
2221 |
|
totp_score++; |
2222 |
|
}; |
2223 |
|
if (use_CAL && cp && ci && true) { |
2224 |
|
|
2225 |
|
if (cp->npresh > ci->npresh && true) { |
2226 |
|
tp_score++; |
2227 |
|
totp_score++; |
2228 |
|
}; |
2229 |
|
if (cp->npresh < ci->npresh && true) { |
2230 |
|
ti_score++; |
2231 |
|
toti_score++; |
2232 |
|
}; |
2233 |
|
|
2234 |
|
// cout << "CALO "<<tp_score<<ti_score<<endl; |
2235 |
|
|
2236 |
|
}; |
2237 |
|
// ----------------------------------------------------------------------------------------- |
2238 |
|
// ***************************************************************************************** |
2239 |
|
// ----------------------------------------------------------------------------------------- |
2240 |
|
// TOF check |
2241 |
|
// ----------------------------------------------------------------------------------------- |
2242 |
|
// check the number of hit pmts along the track |
2243 |
|
// on S12 S21 and S32, where paddles are parallel to Y axis |
2244 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && !tof2) { |
2245 |
|
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but ToFLevel2 not loaded !!!"; |
2246 |
|
return; |
2247 |
|
}; |
2248 |
|
// |
2249 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && !op && oi) { |
2250 |
|
ti_score++; |
2251 |
|
toti_score++; |
2252 |
|
}; |
2253 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && op && !oi) { |
2254 |
|
tp_score++; |
2255 |
|
totp_score++; |
2256 |
|
}; |
2257 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && op && oi) { |
2258 |
|
// |
2259 |
|
Float_t sen = 0.; |
2260 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2261 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2262 |
|
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
2263 |
|
sen += (op->dedx).At(ih); |
2264 |
|
}; |
2265 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2266 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2267 |
|
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
2268 |
|
sen += (oi->dedx).At(ih); |
2269 |
|
}; |
2270 |
|
// |
2271 |
|
if (sen >= sortthr && false) { // temporary disabled NUCLEI special algorithm since the new one should work for every particle (to be checked!) |
2272 |
|
//printf(" IS A NUCLEUS! en = %f \n",sen); |
2273 |
|
// |
2274 |
|
// is a nucleus use a different algorithm |
2275 |
|
// |
2276 |
|
Int_t nz = 6; |
2277 |
|
Float_t zin[6]; // << define TOF z-coordinates |
2278 |
|
for (Int_t ip = 0; ip < nz; ip++) |
2279 |
|
zin[ip] = tof2->GetZTOF(tof2->GetToFPlaneID(ip)); // << read ToF plane z-coordinates |
2280 |
|
Trajectory *tr = new Trajectory(nz, zin); |
2281 |
|
// |
2282 |
|
Int_t nphit_p = 0; |
2283 |
|
Int_t nphit_i = 0; |
2284 |
|
Float_t enhit_p = 0.; |
2285 |
|
Float_t enhit_i = 0.; |
2286 |
|
// |
2287 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2288 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2289 |
|
if (pl == 1 || pl == 2 || pl == 5) { |
2290 |
|
nphit_p++; |
2291 |
|
enhit_p += (op->dedx).At(ih); |
2292 |
|
}; |
2293 |
|
}; |
2294 |
|
// |
2295 |
|
tp->DoTrack2(tr); |
2296 |
|
// |
2297 |
|
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
2298 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2299 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2300 |
|
if (pl == 0) { |
2301 |
|
nphit_p++; |
2302 |
|
enhit_p += (op->dedx).At(ih); |
2303 |
|
}; |
2304 |
|
}; |
2305 |
|
}; |
2306 |
|
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
2307 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2308 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2309 |
|
if (pl == 3) { |
2310 |
|
nphit_p++; |
2311 |
|
enhit_p += (op->dedx).At(ih); |
2312 |
|
}; |
2313 |
|
}; |
2314 |
|
}; |
2315 |
|
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
2316 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2317 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2318 |
|
if (pl == 4) { |
2319 |
|
nphit_p++; |
2320 |
|
enhit_p += (op->dedx).At(ih); |
2321 |
|
}; |
2322 |
|
}; |
2323 |
|
}; |
2324 |
|
|
2325 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2326 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2327 |
|
if (pl == 1 || pl == 2 || pl == 5) { |
2328 |
|
nphit_i++; |
2329 |
|
enhit_i += (op->dedx).At(ih); |
2330 |
|
}; |
2331 |
|
}; |
2332 |
|
// |
2333 |
|
ti->DoTrack2(tr); |
2334 |
|
// |
2335 |
|
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
2336 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2337 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2338 |
|
if (pl == 0) { |
2339 |
|
nphit_i++; |
2340 |
|
enhit_i += (op->dedx).At(ih); |
2341 |
|
}; |
2342 |
|
}; |
2343 |
|
}; |
2344 |
|
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
2345 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2346 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2347 |
|
if (pl == 3) { |
2348 |
|
nphit_i++; |
2349 |
|
enhit_i += (op->dedx).At(ih); |
2350 |
|
}; |
2351 |
|
}; |
2352 |
|
}; |
2353 |
|
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
2354 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2355 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2356 |
|
if (pl == 4) { |
2357 |
|
nphit_i++; |
2358 |
|
enhit_i += (op->dedx).At(ih); |
2359 |
|
}; |
2360 |
|
}; |
2361 |
|
}; |
2362 |
|
|
2363 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && (nphit_p + nphit_i) != 0 && true) { |
2364 |
|
|
2365 |
|
// 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); |
2366 |
|
// printf(" score p %i score i %i \n",tp_score,ti_score); |
2367 |
|
// if( enhit_p > enhit_i ) tp_score++; |
2368 |
|
// if( nphit_p >= nphit_i && enhit_p > enhit_i ) tp_score++; |
2369 |
|
if (nphit_p > nphit_i) |
2370 |
|
tp_score++; |
2371 |
|
if (nphit_p < nphit_i) |
2372 |
|
ti_score++; |
2373 |
|
if (nphit_p == nphit_i) { |
2374 |
|
if (enhit_p > enhit_i) |
2375 |
|
tp_score++; |
2376 |
|
else |
2377 |
|
ti_score++; |
2378 |
|
}; |
2379 |
|
// printf(" dopo score p %i score i %i \n",tp_score,ti_score); |
2380 |
|
}; |
2381 |
|
delete tr; |
2382 |
|
// |
2383 |
|
} |
2384 |
|
else { |
2385 |
|
// ------------- |
2386 |
|
// NOT a NUCLEUS |
2387 |
|
// ------------- |
2388 |
|
//printf(" NOT a NUCLEUS! en = %f \n",sen); |
2389 |
|
|
2390 |
|
Int_t nphit_p = 0; |
2391 |
|
Int_t nphit_i = 0; |
2392 |
|
|
2393 |
|
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
2394 |
|
cout << "track: npmttdc "<< op->npmttdc << endl; |
2395 |
|
cout << "image: npmtadc "<< oi->npmtadc << endl; |
2396 |
|
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
2397 |
|
|
2398 |
|
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
2399 |
|
// Int_t pl = tof2_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
2400 |
|
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
2401 |
|
// }; |
2402 |
|
|
2403 |
|
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
2404 |
|
// Int_t pl = tof2_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
2405 |
|
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
2406 |
|
// }; |
2407 |
|
// --- modified to count tdc signals (more efficient?) |
2408 |
|
// --- and to implement check on tdcflag |
2409 |
|
for (Int_t ih = 0; ih < op->npmttdc; ih++) { |
2410 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmttdc).At(ih)); |
2411 |
|
// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; |
2412 |
|
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
2413 |
|
|| (use_S3 && (pl == 4 || pl == 5))) { |
2414 |
|
if ((op->tdcflag).At(ih) == 0) |
2415 |
|
nphit_p++; |
2416 |
|
}; |
2417 |
|
}; |
2418 |
|
|
2419 |
|
for (Int_t ih = 0; ih < oi->npmttdc; ih++) { |
2420 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmttdc).At(ih)); |
2421 |
|
// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; |
2422 |
|
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
2423 |
|
|| (use_S3 && (pl == 4 || pl == 5))) { |
2424 |
|
if ((oi->tdcflag).At(ih) == 0) |
2425 |
|
nphit_i++; |
2426 |
|
}; |
2427 |
|
}; |
2428 |
|
|
2429 |
|
if ((nphit_p + nphit_i) != 0 && true) { |
2430 |
|
|
2431 |
|
if (nphit_p != nphit_i) { |
2432 |
|
totp_score += nphit_p; |
2433 |
|
toti_score += nphit_i; |
2434 |
|
tp_score += nphit_p; |
2435 |
|
ti_score += nphit_i; |
2436 |
|
}; |
2437 |
|
// if ( nphit_p > nphit_i) tp_score+=nphit_p; |
2438 |
|
// else if( nphit_p < nphit_i) ti_score+=nphit_i; |
2439 |
|
// else ;//niente |
2440 |
|
}; |
2441 |
|
}; |
2442 |
|
// cout << "TOF "<<tp_score<<ti_score<<endl; |
2443 |
|
}; |
2444 |
|
|
2445 |
|
// if(tp_score == ti_score) use_TRK = true; |
2446 |
|
|
2447 |
|
|
2448 |
|
// ----------------------------------------------------------------------------------------- |
2449 |
|
// ***************************************************************************************** |
2450 |
|
// ----------------------------------------------------------------------------------------- |
2451 |
|
// tracker check |
2452 |
|
// ----------------------------------------------------------------------------------------- |
2453 |
|
// chi**2 difference is not always large enough to distinguish among |
2454 |
|
// the real track and its image. |
2455 |
|
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
2456 |
|
// *** MODIFIED ON AUGUST 2007 *** |
2457 |
|
if (use_TRK) { |
2458 |
|
// if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
2459 |
|
// else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
2460 |
|
|
2461 |
|
// CHECK 1 : number of points along X |
2462 |
|
if (tp->GetNX() >= ti->GetNX()) { |
2463 |
|
tp_score++; |
2464 |
|
totp_score++; |
2465 |
|
}; |
2466 |
|
if (tp->GetNX() <= ti->GetNX()) { |
2467 |
|
ti_score++; |
2468 |
|
toti_score++; |
2469 |
|
}; |
2470 |
|
// CHECK 2 : number of points along Y |
2471 |
|
if (tp->GetNY() >= ti->GetNY()) { |
2472 |
|
tp_score++; |
2473 |
|
totp_score++; |
2474 |
|
}; |
2475 |
|
if (tp->GetNY() <= ti->GetNY()) { |
2476 |
|
ti_score++; |
2477 |
|
toti_score++; |
2478 |
|
}; |
2479 |
|
|
2480 |
|
// cout << "TRK "<<tp_score<<ti_score<<endl; |
2481 |
|
}; |
2482 |
|
|
2483 |
|
// ----------------------------------------------------------------------------------------- |
2484 |
|
// ***************************************************************************************** |
2485 |
|
// ----------------------------------------------------------------------------------------- |
2486 |
|
// GPamela check |
2487 |
|
// ----------------------------------------------------------------------------------------- |
2488 |
|
|
2489 |
|
//--------------------------------------------------- |
2490 |
|
// count the number of GP hits |
2491 |
|
//--------------------------------------------------- |
2492 |
|
if (use_GP) { |
2493 |
|
int ngphits_p = 0; |
2494 |
|
int ngphits_i = 0; |
2495 |
|
float toll = 0.02; //200 micron |
2496 |
|
for (int ih = 0; ih < GetGPamela()->Nthspe; ih++) { |
2497 |
|
int ip = (Int_t) GetGPamela()->Itrpb[ih] - 1; |
2498 |
|
if (tp && tp->YGood(ip) && fabs(tp->ym[ip] - GetGPamela()->Yavspe[ih]) < toll && true) |
2499 |
|
ngphits_p++; |
2500 |
|
if (ti && ti->YGood(ip) && fabs(ti->ym[ip] - GetGPamela()->Yavspe[ih]) < toll && true) |
2501 |
|
ngphits_i++; |
2502 |
|
} |
2503 |
|
if (ngphits_p > ngphits_i && true) { |
2504 |
|
tp_score++; |
2505 |
|
totp_score++; |
2506 |
|
} |
2507 |
|
if (ngphits_p < ngphits_i && true) { |
2508 |
|
ti_score++; |
2509 |
|
toti_score++; |
2510 |
|
} |
2511 |
|
} |
2512 |
|
|
2513 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2514 |
|
// the winner is.... |
2515 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2516 |
|
if (tp_score > ti_score) { |
2517 |
|
|
2518 |
|
} |
2519 |
|
else if (tp_score < ti_score) { |
2520 |
|
|
2521 |
|
ts = ti;//its image!! |
2522 |
|
cs = ci; |
2523 |
|
os = oi; |
2524 |
|
rs = ri; |
2525 |
|
Int_t totis = toti_score; |
2526 |
|
|
2527 |
|
ti = tp;//its image!! |
2528 |
|
ci = cp; |
2529 |
|
oi = op; |
2530 |
|
ri = rp; |
2531 |
|
|
2532 |
|
tp = ts;//its image!! |
2533 |
|
cp = cs; |
2534 |
|
op = os; |
2535 |
|
rp = rs; |
2536 |
|
|
2537 |
|
toti_score = totp_score; |
2538 |
|
totp_score = totis; |
2539 |
|
|
2540 |
|
} |
2541 |
|
else { |
2542 |
|
|
2543 |
|
// cout << "Warning - track image ambiguity not solved" << endl; |
2544 |
|
|
2545 |
|
}; |
2546 |
|
|
2547 |
|
} |
2548 |
|
else { |
2549 |
|
totp_score = 1; |
2550 |
|
toti_score = 0; |
2551 |
|
|
2552 |
|
// ts = tp; |
2553 |
|
// cs = cp; |
2554 |
|
// os = op; |
2555 |
|
}; |
2556 |
|
|
2557 |
|
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
2558 |
|
// sorted_tracks->Add(ts);//save the track in the sorted array |
2559 |
|
// sorted_tracks.Add(ts);//save the track in the sorted array |
2560 |
|
// sorted_tracks.Add(tp);//save the track in the sorted array |
2561 |
|
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
2562 |
|
// cout<<"o "<<tp<<endl; |
2563 |
|
// cout<<"o "<<cp<<endl; |
2564 |
|
// cout<<"o "<<op<<endl; |
2565 |
|
|
2566 |
|
new (ttsorted[i]) PamTrack(tp, cp, op, rp); |
2567 |
|
new (ttimage[i]) PamTrack(ti, ci, oi, ri); |
2568 |
|
|
2569 |
|
((PamTrack*) (ttsorted[i]))->SetPScore(totp_score); |
2570 |
|
((PamTrack*) (ttsorted[i]))->SetIScore(toti_score); |
2571 |
|
((PamTrack*) (ttimage[i]))->SetPScore(totp_score); |
2572 |
|
((PamTrack*) (ttimage[i]))->SetIScore(toti_score); |
2573 |
|
}; |
2574 |
|
|
2575 |
|
|
2576 |
|
|
2577 |
|
|
2578 |
|
|
2579 |
|
// if (tsorted->GetEntries() != trk2->GetNTracks()) { |
2580 |
|
// cout << "void PamLevel2::SortTracks(): tsorted->GetEntries() " << tsorted->GetEntries() |
2581 |
|
// << " != trk2->GetNTracks() = " << trk2->GetNTracks() << endl; |
2582 |
|
// tsorted->Delete(); |
2583 |
|
// tsorted = 0; |
2584 |
|
// timage->Delete(); |
2585 |
|
// timage = 0; |
2586 |
|
// } |
2587 |
|
|
2588 |
|
|
2589 |
|
// cout << "text "<<doit<<endl; |
2590 |
|
|
2591 |
|
|
2592 |
|
//-------------------------------------------------- |
2593 |
|
// fill array with extended tracks (this is easy...) |
2594 |
|
//-------------------------------------------------- |
2595 |
|
if(EXT){ |
2596 |
|
for(int it=0; it<trkext->GetEntries(); it++){ |
2597 |
|
|
2598 |
|
new (ttext[it]) PamTrack((ExtTrack*)(*trkext)[it], (CaloTrkVar*)(*caloext)[it], (ToFTrkVar*)(*tofext)[it], (OrbitalInfoTrkVar*)(*orbext)[it]); |
2599 |
|
|
2600 |
|
} |
2601 |
|
} |
2602 |
|
|
2603 |
|
|
2604 |
|
|
2605 |
|
}; |
2606 |
|
|
2607 |
|
|
2608 |
|
//Restore Object count |
2609 |
|
//To save space in the table keeping track of all referenced objects |
2610 |
|
//We reset the object count to what it was at the beginning of the event. |
2611 |
|
TProcessID::SetObjectCount(ObjectNumber); |
2612 |
|
|
2613 |
|
//Everything went fine so the current event can be tagged as sorted |
2614 |
|
issorted_new = true; |
2615 |
|
lastsorted_new = GetReadEntry(); |
2616 |
|
|
2617 |
|
// cout << " tsorted "<< tsorted << " "<<(tsorted ? tsorted->GetEntries() : 0)<<endl; |
2618 |
|
// cout << " timage "<< timage << " "<<(timage ? timage->GetEntries() : 0)<<endl; |
2619 |
|
// cout << " text "<< text << " "<<(text ? text->GetEntries() : 0)<<endl; |
2620 |
|
|
2621 |
|
|
2622 |
|
}; |
2623 |
//-------------------------------------- |
//-------------------------------------- |
2624 |
// |
// |
2625 |
// |
// |
2628 |
* 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. |
2629 |
* 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. |
2630 |
*/ |
*/ |
2631 |
|
|
2632 |
// TRefArray *PamLevel2::GetTracks(){ |
// TRefArray *PamLevel2::GetTracks(){ |
2633 |
|
|
2634 |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
2639 |
// return &sorted_tracks; |
// return &sorted_tracks; |
2640 |
|
|
2641 |
// }; |
// }; |
|
TClonesArray *PamLevel2::GetTracks() { |
|
|
|
|
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
|
|
SortTracks(); |
|
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
|
2642 |
|
|
|
return tsorted; |
|
2643 |
|
|
|
} |
|
|
; |
|
2644 |
//-------------------------------------- |
//-------------------------------------- |
2645 |
// |
// |
2646 |
// |
// |
2647 |
//-------------------------------------- |
//-------------------------------------- |
2648 |
|
|
2649 |
/** |
/** |
2650 |
* Retrieves the it-th Pamela "physical" track. |
* Retrieves the it-th Pamela "physical" track. |
2651 |
* It override TrkLevel2::GetTrack(int it). |
* It override TrkLevel2::GetTrack(int it). |
2652 |
* @param it Track number, ranging from 0 to GetNTracks(). |
* @param it Track number, ranging from 0 to GetNTracks(). |
2653 |
*/ |
*/ |
2654 |
PamTrack *PamLevel2::GetTrack(int it) { |
PamTrack *PamLevel2::GetTrackOld(int it) { |
|
|
|
|
// if(!trk2_obj) return 0; |
|
2655 |
|
|
2656 |
// // *-*-*-*+-*-*-*-*-*-*-*-*-* |
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; |
|
2657 |
|
|
|
// cout << "PamLevel2::GetTrack(int it) "<<endl; |
|
2658 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2659 |
SortTracks(); |
SortTracks(); |
2660 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2661 |
if (!tsorted) |
if (!tsorted) |
2662 |
return 0; |
return track; |
2663 |
if (!tsorted->GetEntries()) |
if (!tsorted->GetEntries()) |
2664 |
return 0; |
return track; |
2665 |
|
|
|
PamTrack *track = 0; |
|
2666 |
|
|
2667 |
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]; |
|
2668 |
track = (PamTrack*)((*tsorted)[it]); |
track = (PamTrack*)((*tsorted)[it]); |
2669 |
} |
} |
2670 |
else { |
else { |
2671 |
cout << "PamLevel2::GetTrack(int) : tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
cout << "PamLevel2::GetTrackOld(int) : tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
2672 |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
2673 |
}; |
}; |
2674 |
|
|
2675 |
return track; |
return track; |
2676 |
|
|
2677 |
|
}; |
2678 |
|
|
2679 |
|
//PamTrack *PamLevel2::GetTrack(int it) { return GetTrack(it,trkAlg); }; |
2680 |
|
|
2681 |
|
/** |
2682 |
|
* Retrieves the it-th Pamela "physical" track. |
2683 |
|
* It override TrkLevel2::GetTrack(int it). |
2684 |
|
* @param it Track number, ranging from 0 to GetNTracks(). |
2685 |
|
* @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation. |
2686 |
|
*/ |
2687 |
|
PamTrack *PamLevel2::GetTrack(int it, const char* alg) { |
2688 |
|
|
2689 |
|
TString s(alg); |
2690 |
|
if(!s.CompareTo("") ||!s.CompareTo("STD") )return GetTrackOld(it); //old algorythm |
2691 |
|
|
2692 |
|
|
2693 |
|
SortTracksNew(); |
2694 |
|
// >> fill tsorted, timage and text |
2695 |
|
|
2696 |
|
if ( ( !s.Contains("EXTF", TString::kIgnoreCase) || !EXT )){ //not forced exteded-alg requested (or exteded-data missing) |
2697 |
|
|
2698 |
|
if( s.Contains("NUC")){ |
2699 |
|
if( |
2700 |
|
tsorted_nuc && |
2701 |
|
it < tsorted_nuc->GetEntries() && //enough tracks found |
2702 |
|
it >= 0 && //valid index |
2703 |
|
true) return (PamTrack*)((*tsorted_nuc)[it]); //ok return the track |
2704 |
|
}else{ |
2705 |
|
if( |
2706 |
|
tsorted && |
2707 |
|
it < tsorted->GetEntries() && //enough tracks found |
2708 |
|
it >= 0 && //valid index |
2709 |
|
true )return (PamTrack*)((*tsorted)[it]); //ok return the track |
2710 |
|
} |
2711 |
|
|
2712 |
|
} |
2713 |
|
|
2714 |
|
|
2715 |
|
///////////////////////////////////////////////////////////////////////// |
2716 |
|
/// if requested get track from extended algorythm output |
2717 |
|
///////////////////////////////////////////////////////////////////////// |
2718 |
|
|
2719 |
|
if(s.Contains("EXT", TString::kIgnoreCase) && EXT){//if exteded-alg requested |
2720 |
|
|
2721 |
|
if(s.Contains("NUC")){ |
2722 |
|
if( |
2723 |
|
text_nuc && |
2724 |
|
it < text_nuc->GetEntries() && //enough tracks found |
2725 |
|
it >= 0 && //valid index |
2726 |
|
true) return (PamTrack*)((*text_nuc)[it]); |
2727 |
|
}else{ |
2728 |
|
if( |
2729 |
|
text && |
2730 |
|
it < text->GetEntries() && //enough tracks found |
2731 |
|
it >= 0 && //valid index |
2732 |
|
true) return (PamTrack*)((*text)[it]); |
2733 |
|
} |
2734 |
|
|
2735 |
|
}; |
2736 |
|
|
2737 |
|
|
2738 |
|
cout << "PamTrack *PamLevel2::GetTrack("<<it<<","<<alg<<") -- wrong track number or unrecognised algorithm"<<endl; |
2739 |
|
|
2740 |
|
return NULL; |
2741 |
|
|
2742 |
|
} |
2743 |
|
; |
2744 |
|
TClonesArray *PamLevel2::GetTracks() { |
2745 |
|
|
2746 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2747 |
|
SortTracks(); |
2748 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2749 |
|
|
2750 |
|
return tsorted; |
2751 |
|
|
2752 |
} |
} |
2753 |
; |
; |
2754 |
|
Int_t PamLevel2::GetNTracks(const char* alg) { |
2755 |
|
|
2756 |
|
|
2757 |
|
// cout << " trk_nuc_obj->GetEntries() "<<trk_nuc_obj->GetEntries()<<" trk2_nuc_obj->GetNTracks() "<<trk2_nuc_obj->GetNTracks()<<endl; |
2758 |
|
|
2759 |
|
TString s(alg); |
2760 |
|
|
2761 |
|
if(!s.CompareTo("") || !s.CompareTo("STD"))return trk2_obj->TrkLevel2::GetNTracks(); //standard algorythm |
2762 |
|
|
2763 |
|
if(s.Contains("EXTF", TString::kIgnoreCase) && EXT){ |
2764 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && NUC)return trk_ext_nuc_obj->GetEntries();//ok |
2765 |
|
return trk_ext_obj->GetEntries();//ok |
2766 |
|
} |
2767 |
|
if( s.Contains("EXT", TString::kIgnoreCase) && EXT) { |
2768 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && NUC) |
2769 |
|
return (trk2_nuc_obj->TrkLevel2::GetNTracks() ? trk2_nuc_obj->TrkLevel2::GetNTracks() : trk_ext_nuc_obj->GetEntries() ); |
2770 |
|
return (trk2_obj->TrkLevel2::GetNTracks() ? trk2_obj->TrkLevel2::GetNTracks() : trk_ext_obj->GetEntries() ); |
2771 |
|
} |
2772 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && NUC ) |
2773 |
|
return trk2_nuc_obj->TrkLevel2::GetNTracks(); |
2774 |
|
|
2775 |
|
cout << "Int_t PamLevel2::GetNTracks("<<alg<<") -- unrecognised algorithm"<<endl; |
2776 |
|
|
2777 |
|
return 0; |
2778 |
|
|
2779 |
|
} |
2780 |
|
|
2781 |
|
|
2782 |
//-------------------------------------- |
//-------------------------------------- |
2783 |
// |
// |
2787 |
* 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(). |
2788 |
* @param it Track number, ranging from 0 to GetNTracks(). |
* @param it Track number, ranging from 0 to GetNTracks(). |
2789 |
*/ |
*/ |
2790 |
PamTrack *PamLevel2::GetTrackImage(int it) { |
PamTrack *PamLevel2::GetTrackImageOld(int it) { |
2791 |
|
|
2792 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2793 |
SortTracks(); |
SortTracks(); |
2811 |
}; |
}; |
2812 |
} |
} |
2813 |
else { |
else { |
2814 |
cout << "PamLevel2::GetTrackImage(int) : Tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
cout << "PamLevel2::GetTrackImageOld(int) : Tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
2815 |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
2816 |
}; |
}; |
2817 |
|
|
2818 |
return image; |
return image; |
2819 |
} |
} |
2820 |
|
/** |
2821 |
|
* Retrieves (if present) the image of the it-th Pamela "physical" track, sorted by the method PamLevel2::SortTracks(). |
2822 |
|
* @param it Track number, ranging from 0 to GetNTracks(). |
2823 |
|
* @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation. |
2824 |
|
*/ |
2825 |
|
PamTrack *PamLevel2::GetTrackImage(int it, const char* alg) { |
2826 |
|
|
2827 |
|
TString s(alg); |
2828 |
|
if(!s.CompareTo("") || !s.CompareTo("STD"))return GetTrackImageOld(it); //old algorythm |
2829 |
|
|
2830 |
|
|
2831 |
|
SortTracksNew(); |
2832 |
|
// >> fill tsorted, timage and text |
2833 |
|
|
2834 |
|
if ( ( !s.Contains("EXTF", TString::kIgnoreCase) || !EXT )){ //not forced exteded-alg requested (or exteded-data missing) |
2835 |
|
|
2836 |
|
if( s.Contains("NUC")){ |
2837 |
|
if( |
2838 |
|
tsorted_nuc && |
2839 |
|
it < tsorted_nuc->GetEntries() && //enough tracks found |
2840 |
|
it >= 0 && //valid index |
2841 |
|
true){ |
2842 |
|
TClonesArray &t = *(tsorted_nuc); |
2843 |
|
PamTrack *temp = (PamTrack*) t[it]; |
2844 |
|
if (temp->GetTrkTrack()->HasImage()) { |
2845 |
|
return (PamTrack*)((*timage_nuc)[it]); //ok return the track |
2846 |
|
}else{ |
2847 |
|
return NULL; |
2848 |
|
} |
2849 |
|
|
2850 |
|
} |
2851 |
|
}else{ |
2852 |
|
if( |
2853 |
|
tsorted && |
2854 |
|
it < tsorted->GetEntries() && //enough tracks found |
2855 |
|
it >= 0 && //valid index |
2856 |
|
true ){ |
2857 |
|
TClonesArray &t = *(tsorted); |
2858 |
|
PamTrack *temp = (PamTrack*) t[it]; |
2859 |
|
if (temp->GetTrkTrack()->HasImage()) { |
2860 |
|
return (PamTrack*)((*timage)[it]); //ok return the track |
2861 |
|
}else{ |
2862 |
|
return NULL; |
2863 |
|
} |
2864 |
|
} |
2865 |
|
} |
2866 |
|
|
2867 |
|
} |
2868 |
|
|
2869 |
|
cout << "PamTrack *PamLevel2::GetTrackImage("<<it<<","<<alg<<") -- wrong track number or unrecognised algorithm"<<endl; |
2870 |
|
|
2871 |
|
return NULL; |
2872 |
|
|
2873 |
|
} |
2874 |
|
; |
2875 |
|
|
2876 |
//-------------------------------------- |
//-------------------------------------- |
2877 |
// |
// |
2961 |
if (!Trout) |
if (!Trout) |
2962 |
Trout = T; |
Trout = T; |
2963 |
else |
else |
2964 |
Trout->AddFriend(T); |
Trout->AddFriend(T); |
2965 |
} |
} |
2966 |
else { |
else { |
2967 |
cout << "Tracker : missing tree" << endl; |
cout << "Tracker : missing tree" << endl; |
3326 |
TChain *G = 0; |
TChain *G = 0; |
3327 |
|
|
3328 |
TChain *L = 0; |
TChain *L = 0; |
3329 |
|
TChain *P = 0; |
3330 |
|
|
3331 |
if (TRK2 || TRK1 || TRKh) |
if (TRK2 || TRK1 || TRKh) |
3332 |
T = new TChain("Tracker"); |
T = new TChain("Tracker"); |
3346 |
B = new TChain("OrbitalInfo"); |
B = new TChain("OrbitalInfo"); |
3347 |
if (GP) |
if (GP) |
3348 |
G = new TChain("h20"); |
G = new TChain("h20"); |
3349 |
|
if (PROC) |
3350 |
|
P = new TChain("ProcessingInfo"); |
3351 |
L = new TChain("SelectionList"); |
L = new TChain("SelectionList"); |
3352 |
|
|
3353 |
// loop over files and create chains |
// loop over files and create chains |
3375 |
B->Add(name); |
B->Add(name); |
3376 |
if (GP) |
if (GP) |
3377 |
G->Add(name); |
G->Add(name); |
3378 |
|
if (P) |
3379 |
|
P->Add(name); |
3380 |
if (SELLI == 1) |
if (SELLI == 1) |
3381 |
L->Add(name); |
L->Add(name); |
3382 |
}; |
}; |
3383 |
}; |
}; |
3384 |
|
|
3385 |
cout << "done chains\n"; |
cout << "done data-tree chains "<< T->GetNtrees() <<" \n"; |
3386 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "----------------------------------------------------" << endl; |
3387 |
|
|
3388 |
// ------------------------------------------- |
// ------------------------------------------- |
3389 |
// make friends |
// make friends |
3466 |
// ===================================== |
// ===================================== |
3467 |
// SET BRANCH-ADDRESS AFTER CHAIN+FRIEND |
// SET BRANCH-ADDRESS AFTER CHAIN+FRIEND |
3468 |
// ===================================== |
// ===================================== |
3469 |
SetBranchAddress(Trout); |
if( Trout->GetNtrees() )SetBranchAddress(Trout); |
3470 |
|
|
3471 |
// ------------------------------------ |
// ------------------------------------ |
3472 |
// finally handle selection trees... |
// finally handle selection trees... |
3473 |
// (it is not friend of pamela tree) |
// (it is not friend of pamela tree) |
3474 |
// ------------------------------------ |
// ------------------------------------ |
3475 |
|
|
3476 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "----------------------------------------------------" << endl; |
3477 |
|
|
3478 |
// Selection List |
// Selection List |
3479 |
if (L && SELLI == 1) { |
if (L && SELLI == 1) { |
3494 |
// if(!Trout)Trout=O; |
// if(!Trout)Trout=O; |
3495 |
// else Trout->AddFriend("SelectionList"); |
// else Trout->AddFriend("SelectionList"); |
3496 |
cout << "+SelectionList" << endl; |
cout << "+SelectionList" << endl; |
3497 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "----------------------------------------------------" << endl; |
3498 |
} |
} |
3499 |
else { |
else { |
3500 |
// cout << "SelectionList : missing tree"<<endl; |
// cout << "SelectionList : missing tree"<<endl; |
3502 |
L->Delete(); |
L->Delete(); |
3503 |
}; |
}; |
3504 |
|
|
3505 |
|
//ProcessingInfo EM |
3506 |
|
if ( P && P->GetEntries() ){ |
3507 |
|
cout << "----------------------------------------------------" << endl; |
3508 |
|
cout << ">>> Found ProcessingInfo <<<" << endl; |
3509 |
|
// L->SetBranchAddress("RunEntry",&irun); |
3510 |
|
P->SetBranchAddress("ProcInfo", &proc_obj);//NEWNEW |
3511 |
|
proc_tree = P; |
3512 |
|
} |
3513 |
// -------------------------------------------- |
// -------------------------------------------- |
3514 |
// return the pamela chain with all the friends |
// return the pamela chain with all the friends |
3515 |
// -------------------------------------------- |
// -------------------------------------------- |
3516 |
|
|
3517 |
pam_tree = Trout; |
pam_tree = Trout; |
|
|
|
3518 |
return Trout; |
return Trout; |
3519 |
} |
} |
3520 |
|
|
3527 |
*/ |
*/ |
3528 |
void PamLevel2::SetBranchAddress(TTree *t) { |
void PamLevel2::SetBranchAddress(TTree *t) { |
3529 |
|
|
3530 |
TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
// TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
3531 |
TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
// TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
3532 |
TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
// TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
3533 |
CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
// CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
3534 |
CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
// CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
3535 |
TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
// TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
3536 |
TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
// TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
3537 |
S4 = S4 & t->GetBranchStatus("S4Level2"); |
// S4 = S4 & t->GetBranchStatus("S4Level2"); |
3538 |
ND = ND & t->GetBranchStatus("NDLevel2"); |
// ND = ND & t->GetBranchStatus("NDLevel2"); |
3539 |
AC = AC & t->GetBranchStatus("AcLevel2"); |
// AC = AC & t->GetBranchStatus("AcLevel2"); |
3540 |
ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
// ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
3541 |
GP = GP & t->GetBranchStatus("h20"); |
// GP = GP & t->GetBranchStatus("h20"); |
3542 |
|
|
3543 |
|
|
3544 |
// Tracker |
// Tracker |
3545 |
if (TRK1) { |
if (TRK1) { |
3549 |
if (TRK2) { |
if (TRK2) { |
3550 |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel1")); |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel1")); |
3551 |
cout << "Tracker : set branch address TrkLevel2" << endl; |
cout << "Tracker : set branch address TrkLevel2" << endl; |
3552 |
|
NUC = t->GetBranchStatus("TrackNuclei"); |
3553 |
|
EXT = t->GetBranchStatus("RecoveredTrack") && (NUC ? t->GetBranchStatus("RecoveredTrackNuclei"): true ); |
3554 |
}; |
}; |
3555 |
if (TRKh) { |
if (TRKh) { |
3556 |
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
3611 |
|
|
3612 |
cout << "h20 : set branch address GPamela " << endl; |
cout << "h20 : set branch address GPamela " << endl; |
3613 |
}; |
}; |
3614 |
|
if(NUC){ |
3615 |
|
|
3616 |
|
cout << "Found nuclei-track branches" << endl; |
3617 |
|
|
3618 |
|
if( !trk_nuc_obj )trk_nuc_obj = new TClonesArray("TrkTrack"); |
3619 |
|
if( !calo_nuc_obj)calo_nuc_obj= new TClonesArray("CaloTrkVar"); |
3620 |
|
if( !tof_nuc_obj)tof_nuc_obj= new TClonesArray("ToFTrkVar"); |
3621 |
|
if( !orb_nuc_obj)orb_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3622 |
|
if (TRK2)t-> SetBranchAddress("TrackNuclei",&trk_nuc_obj); |
3623 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("TrackNuclei",&calo_nuc_obj); |
3624 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("TrackNuclei",&tof_nuc_obj); |
3625 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("TrackNuclei",&orb_nuc_obj); |
3626 |
|
|
3627 |
|
///copy the vector content inside a "fake" object (all aother info are missing) |
3628 |
|
|
3629 |
|
if( !trk2_nuc_obj )trk2_nuc_obj = new TrkLevel2(); |
3630 |
|
if( !calo2_nuc_obj )calo2_nuc_obj = new CaloLevel2(); |
3631 |
|
if( !tof2_nuc_obj )tof2_nuc_obj = new ToFLevel2(); |
3632 |
|
if( !orb2_nuc_obj )orb2_nuc_obj = new OrbitalInfo(); |
3633 |
|
// *(trk2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*trk_nuc_obj); |
3634 |
|
// *(calo2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*calo_nuc_obj); |
3635 |
|
// *(tof2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*tof_nuc_obj); |
3636 |
|
// *(orb2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*orb_nuc_obj); |
3637 |
|
|
3638 |
|
trk2_nuc_obj->SetTrackArray( trk_nuc_obj ); |
3639 |
|
calo2_nuc_obj->SetTrackArray( calo_nuc_obj ); |
3640 |
|
tof2_nuc_obj->SetTrackArray( tof_nuc_obj ); |
3641 |
|
orb2_nuc_obj->SetTrackArray( orb_nuc_obj ); |
3642 |
|
|
3643 |
|
|
3644 |
|
} |
3645 |
|
|
3646 |
|
if(EXT){ |
3647 |
|
|
3648 |
|
cout << "Found extended tracking algorythm branches" << endl; |
3649 |
|
|
3650 |
|
if( !trk_ext_obj )trk_ext_obj = new TClonesArray("ExtTrack"); |
3651 |
|
if( !calo_ext_obj)calo_ext_obj= new TClonesArray("CaloTrkVar"); |
3652 |
|
if( !tof_ext_obj)tof_ext_obj= new TClonesArray("ToFTrkVar"); |
3653 |
|
if( !orb_ext_obj)orb_ext_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3654 |
|
|
3655 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrack",&trk_ext_obj); |
3656 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrack",&calo_ext_obj); |
3657 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrack",&tof_ext_obj); |
3658 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrack",&orb_ext_obj); |
3659 |
|
|
3660 |
|
|
3661 |
|
if(NUC){ |
3662 |
|
if( !trk_ext_nuc_obj )trk_ext_nuc_obj = new TClonesArray("ExtTrack"); |
3663 |
|
if( !calo_ext_nuc_obj)calo_ext_nuc_obj= new TClonesArray("CaloTrkVar"); |
3664 |
|
if( !tof_ext_nuc_obj)tof_ext_nuc_obj= new TClonesArray("ToFTrkVar"); |
3665 |
|
if( !orb_ext_nuc_obj)orb_ext_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3666 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrackNuclei",&trk_ext_nuc_obj); |
3667 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrackNuclei",&calo_ext_nuc_obj); |
3668 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrackNuclei",&tof_ext_nuc_obj); |
3669 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrackNuclei",&orb_ext_nuc_obj); |
3670 |
|
} |
3671 |
|
} |
3672 |
} |
} |
3673 |
/** |
/** |
3674 |
* Set branch addresses for Pamela friend trees |
* Set branch addresses for Pamela friend trees |
3692 |
if (TRK2) { |
if (TRK2) { |
3693 |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
3694 |
cout << "Tracker : set branch address TrkLevel2" << endl; |
cout << "Tracker : set branch address TrkLevel2" << endl; |
3695 |
|
NUC = t->GetBranchStatus("TrackNuclei"); |
3696 |
|
EXT = t->GetBranchStatus("RecoveredTrack") && (NUC ? t->GetBranchStatus("RecoveredTrackNuclei"): true ); |
3697 |
}; |
}; |
3698 |
if (TRK1) { |
if (TRK1) { |
3699 |
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
3707 |
// Calorimeter |
// Calorimeter |
3708 |
if (CAL2) { |
if (CAL2) { |
3709 |
t->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
t->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
3710 |
cout << "Calorimeter : set branch address CaloLevel2" << endl; |
cout << "Calorimeter : set branch address CaloLevel2" << endl; |
3711 |
}; |
}; |
3712 |
if (CAL1) { |
if (CAL1) { |
3713 |
t->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
t->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
3765 |
// cout << "SelectionList: set branch address EventEntry"<<endl; |
// cout << "SelectionList: set branch address EventEntry"<<endl; |
3766 |
|
|
3767 |
// } |
// } |
3768 |
|
if(NUC){ |
3769 |
|
|
3770 |
|
cout << "Found nuclei-track branches" << endl; |
3771 |
|
|
3772 |
|
if( !trk_nuc_obj )trk_nuc_obj = new TClonesArray("TrkTrack"); |
3773 |
|
if( !calo_nuc_obj)calo_nuc_obj= new TClonesArray("CaloTrkVar"); |
3774 |
|
if( !tof_nuc_obj)tof_nuc_obj= new TClonesArray("ToFTrkVar"); |
3775 |
|
if( !orb_nuc_obj)orb_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3776 |
|
if (TRK2)t-> SetBranchAddress("TrackNuclei",&trk_nuc_obj); |
3777 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("TrackNuclei",&calo_nuc_obj); |
3778 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("TrackNuclei",&tof_nuc_obj); |
3779 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("TrackNuclei",&orb_nuc_obj); |
3780 |
|
|
3781 |
|
///copy the vector content inside a "fake" object (all aother info are missing) |
3782 |
|
|
3783 |
|
if( !trk2_nuc_obj )trk2_nuc_obj = new TrkLevel2(); |
3784 |
|
if( !calo2_nuc_obj )calo2_nuc_obj = new CaloLevel2(); |
3785 |
|
if( !tof2_nuc_obj )tof2_nuc_obj = new ToFLevel2(); |
3786 |
|
if( !orb2_nuc_obj )orb2_nuc_obj = new OrbitalInfo(); |
3787 |
|
|
3788 |
|
// *(trk2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*trk_nuc_obj); |
3789 |
|
// *(calo2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*calo_nuc_obj); |
3790 |
|
// *(tof2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*tof_nuc_obj); |
3791 |
|
// *(orb2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*orb_nuc_obj); |
3792 |
|
trk2_nuc_obj->SetTrackArray( trk_nuc_obj ); |
3793 |
|
calo2_nuc_obj->SetTrackArray( calo_nuc_obj ); |
3794 |
|
tof2_nuc_obj->SetTrackArray( tof_nuc_obj ); |
3795 |
|
orb2_nuc_obj->SetTrackArray( orb_nuc_obj ); |
3796 |
|
|
3797 |
|
} |
3798 |
|
if(EXT){ |
3799 |
|
|
3800 |
|
cout << "Found extended tracking algorythm branches" << endl; |
3801 |
|
|
3802 |
|
t->SetBranchAddress("extAlgFlag",&extAlgFlag); |
3803 |
|
|
3804 |
|
if( !trk_ext_obj )trk_ext_obj = new TClonesArray("ExtTrack"); |
3805 |
|
if( !calo_ext_obj)calo_ext_obj= new TClonesArray("CaloTrkVar"); |
3806 |
|
if( !tof_ext_obj)tof_ext_obj= new TClonesArray("ToFTrkVar"); |
3807 |
|
if( !orb_ext_obj)orb_ext_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3808 |
|
|
3809 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrack",&trk_ext_obj); |
3810 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrack",&calo_ext_obj); |
3811 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrack",&tof_ext_obj); |
3812 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrack",&orb_ext_obj); |
3813 |
|
|
3814 |
|
if(NUC){ |
3815 |
|
if( !trk_ext_nuc_obj )trk_ext_nuc_obj = new TClonesArray("ExtTrack"); |
3816 |
|
if( !calo_ext_nuc_obj)calo_ext_nuc_obj= new TClonesArray("CaloTrkVar"); |
3817 |
|
if( !tof_ext_nuc_obj)tof_ext_nuc_obj= new TClonesArray("ToFTrkVar"); |
3818 |
|
if( !orb_ext_nuc_obj)orb_ext_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3819 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrackNuclei",&trk_ext_nuc_obj); |
3820 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrackNuclei",&calo_ext_nuc_obj); |
3821 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrackNuclei",&tof_ext_nuc_obj); |
3822 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrackNuclei",&orb_ext_nuc_obj); |
3823 |
|
} |
3824 |
|
} |
3825 |
|
|
3826 |
} |
} |
3827 |
|
|
3828 |
|
/** |
3829 |
|
* Set the tracking algorythm |
3830 |
|
* @param alg String to choose the track. |
3831 |
|
* "" --> take the output of the standard tracking algorythm |
3832 |
|
* "STD" --> take the output of the standard tracking algorythm |
3833 |
|
* "NUC" --> take the output of the standard tracking algorythm for nuclei cluster selection |
3834 |
|
* "EXT" --> in case the standard tracking algorythm has not found any track, take the output of the extended one |
3835 |
|
* "EXTF" --> force the extended tracking algorythm |
3836 |
|
* "NUCEXT" --> as "EXT", but for nuclei |
3837 |
|
* "NUCEXTF" --> as "EXTF", but for nuclei |
3838 |
|
*/ |
3839 |
|
// void PamLevel2::SetTrackingAlgorythm(const char *alg){ |
3840 |
|
|
3841 |
|
|
3842 |
|
// TString s(alg); |
3843 |
|
// if(s.Contains("NUC", TString::kIgnoreCase) && !NUC) |
3844 |
|
// cout << "Warning! NUC algorythm requested, but branches are missing"<<endl; |
3845 |
|
// if(s.Contains("EXT", TString::kIgnoreCase) && !EXT) |
3846 |
|
// cout << "Warning! EXT algorythm requested, but branches are missing"<<endl;; |
3847 |
|
|
3848 |
|
// trkAlg = alg; |
3849 |
|
|
3850 |
|
// }; |
3851 |
|
// const char* PamLevel2::GetTrackingAlgorythm(){ |
3852 |
|
|
3853 |
|
|
3854 |
|
// cout<<endl<<" Implemented tracking algorythm: "; |
3855 |
|
// cout<<endl<<" \"\" or \"STD\" --> take the output of the standard tracking algorythm"; |
3856 |
|
// cout<<endl<<" \"NUC\" --> take the output of the standard tracking algorythm for nuclei cluster selection"; |
3857 |
|
// cout<<endl<<" \"EXT\" --> in case the standard tracking algorythm has not found any track,"; |
3858 |
|
// cout<<endl<<" take the output of the extended one"; |
3859 |
|
// cout<<endl<<" \"EXTF\" --> force the extended tracking algorythm"; |
3860 |
|
// cout<<endl<<" \"NUCEXT\" --> as \"EXT\", but for nuclei "; |
3861 |
|
// cout<<endl<<" \"NUCEXTF\" --> as \"EXTF\", but for nuclei"; |
3862 |
|
|
3863 |
|
// cout<<endl; |
3864 |
|
// cout<<" <<Currently set algorythm>> "<<trkAlg<<endl; |
3865 |
|
// cout<<endl; |
3866 |
|
|
3867 |
|
// return trkAlg; |
3868 |
|
// }; |
3869 |
|
|
3870 |
|
|
3871 |
|
|
3872 |
//-------------------------------------- |
//-------------------------------------- |
3873 |
// |
// |
3874 |
// |
// |
3902 |
}; |
}; |
3903 |
} |
} |
3904 |
|
|
3905 |
|
cout << "done run chain "<< R->GetNtrees() <<" \n"; |
3906 |
|
|
3907 |
|
|
3908 |
if (RUN && R->GetNtrees()) { |
if (RUN && R->GetNtrees()) { |
3909 |
|
|
3910 |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
3944 |
cout << "----------------------------------------------------" << endl; |
cout << "----------------------------------------------------" << endl; |
3945 |
|
|
3946 |
} |
} |
3947 |
else { |
// else { |
3948 |
delete R; |
// delete R; |
3949 |
R = 0; |
// R = 0; |
3950 |
} |
// } |
3951 |
|
|
3952 |
run_tree = R; |
run_tree = R; |
3953 |
|
|
4025 |
run_tree->GetEntry(irun); |
run_tree->GetEntry(irun); |
4026 |
if (!GetOrbitalInfo()) |
if (!GetOrbitalInfo()) |
4027 |
cout << "** WARNING ** missing OrbitalInfo ---> run info might be not correctly updated " << endl; |
cout << "** WARNING ** missing OrbitalInfo ---> run info might be not correctly updated " << endl; |
4028 |
if (gltsync) |
if ( fUseDBinRunInfo ){ |
4029 |
delete gltsync; //Emiliano |
if (gltsync) |
4030 |
if (!dbc || (dbc && !dbc->IsConnected())) |
delete gltsync; //Emiliano |
4031 |
SetDBConnection(); //Emiliano |
if (!dbc || (dbc && !dbc->IsConnected())) |
4032 |
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 |
4033 |
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) |
4034 |
dbc->Close();// Emiliano |
if (dbc){ |
4035 |
delete dbc; |
dbc->Close();// Emiliano |
4036 |
dbc=0; |
delete dbc; |
4037 |
}; |
dbc=0; |
4038 |
}; |
} |
4039 |
|
} |
4040 |
|
} |
4041 |
// --------------------------------------------------------------- |
// --------------------------------------------------------------- |
4042 |
// retrieve OBT and absolute time of the event |
// retrieve OBT and absolute time of the event |
4043 |
// --------------------------------------------------------------- |
// --------------------------------------------------------------- |
4046 |
prevpktnum = pktnum; |
prevpktnum = pktnum; |
4047 |
if (GetOrbitalInfo()) { |
if (GetOrbitalInfo()) { |
4048 |
abstime = GetOrbitalInfo()->absTime; |
abstime = GetOrbitalInfo()->absTime; |
4049 |
obt = gltsync->DBobt(GetOrbitalInfo()->OBT); // Emiliano |
if ( fUseDBinRunInfo ) obt = gltsync->DBobt(GetOrbitalInfo()->OBT); // Emiliano |
4050 |
pktnum = GetOrbitalInfo()->pkt_num; // Emiliano |
pktnum = GetOrbitalInfo()->pkt_num; // Emiliano |
4051 |
} |
} |
4052 |
else { |
else { |
4053 |
abstime = GetRunInfo()->RUNHEADER_TIME; |
abstime = GetRunInfo()->RUNHEADER_TIME; |
4054 |
obt = gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT); // Emiliano |
if ( fUseDBinRunInfo ) obt = gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT); // Emiliano |
4055 |
pktnum = GetRunInfo()->RUNHEADER_PKT; // Emiliano |
pktnum = GetRunInfo()->RUNHEADER_PKT; // Emiliano |
4056 |
} |
} |
4057 |
|
|
4059 |
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); |
4060 |
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); |
4061 |
printf("0 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
printf("0 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
4062 |
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)); |
4063 |
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); |
4064 |
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); |
4065 |
} |
} |
4082 |
} |
} |
4083 |
|
|
4084 |
// |
// |
4085 |
|
bool a = true; |
4086 |
|
bool b = true; |
4087 |
|
if ( fUseDBinRunInfo ){ |
4088 |
|
a = false; |
4089 |
|
b = false; |
4090 |
|
if ( obt < gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) ) a = true; |
4091 |
|
if ( obt > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT) ) b = true; |
4092 |
|
} |
4093 |
if ( iev < totrunentrymin || iev > totrunentrymax // entry is outside run limits |
if ( iev < totrunentrymin || iev > totrunentrymax // entry is outside run limits |
4094 |
|| iev == 0 // or it is the first entry |
|| iev == 0 // or it is the first entry |
4095 |
|| (!isSync && ( |
|| (!isSync && ( |
4096 |
(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) |
4097 |
|| (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) |
4098 |
){ // check on abstime and obt needed to handle nested+DV_skipped packets |
){ // check on abstime and obt needed to handle nested+DV_skipped packets |
4099 |
|
|
4100 |
// check for a new run (ma prima il primo!) |
// check for a new run (ma prima il primo!) |
4102 |
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); |
4103 |
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); |
4104 |
printf("1 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
printf("1 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
4105 |
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)); |
4106 |
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); |
4107 |
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); |
4108 |
} |
} |
4129 |
totrunentry += GetRunInfo()->NEVENTS; |
totrunentry += GetRunInfo()->NEVENTS; |
4130 |
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 |
4131 |
irun = r; |
irun = r; |
4132 |
|
if ( fUseDBinRunInfo ){ |
4133 |
|
a = false; |
4134 |
|
b = false; |
4135 |
|
if ( obt < gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) ) a = true; |
4136 |
|
if ( obt > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT) ) b = true; |
4137 |
|
} |
4138 |
if ( (iev >= totrunentrymin && iev <= totrunentrymax) || // entry is inside run limits |
if ( (iev >= totrunentrymin && iev <= totrunentrymax) || // entry is inside run limits |
4139 |
( !isSync && |
( !isSync && |
4140 |
( 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) |
4141 |
&& 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) |
4142 |
){ // check on abstime and obt needed to handle nested+DV_skipped packets |
){ // check on abstime and obt needed to handle nested+DV_skipped packets |
4143 |
if ( totrunentrymin > iev ){ // there is a shift (nested+DV_skipped packets) |
if ( totrunentrymin > iev ){ // there is a shift (nested+DV_skipped packets) |
4144 |
if ( !isSync ){ |
if ( !isSync ){ |
4163 |
|
|
4164 |
|
|
4165 |
// |
// |
4166 |
if (gltsync) |
if ( fUseDBinRunInfo ){ |
4167 |
delete gltsync; // Emiliano |
if (gltsync) |
4168 |
if (!dbc || (dbc && !dbc->IsConnected())) |
delete gltsync; // Emiliano |
4169 |
SetDBConnection(); //Emiliano |
if (!dbc || (dbc && !dbc->IsConnected())) |
4170 |
gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); // Emiliano |
SetDBConnection(); //Emiliano |
4171 |
TrkParams::Set(GetRunInfo(), dbc); |
gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0, "ID", dbc, false); // Emiliano |
4172 |
if (dbc){ |
TrkParams::Set(GetRunInfo(), dbc); |
4173 |
dbc->Close(); // Emiliano |
if (dbc){ |
4174 |
delete dbc; |
dbc->Close(); // Emiliano |
4175 |
dbc=0; |
delete dbc; |
4176 |
} |
dbc=0; |
4177 |
if (gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)) { // Emiliano |
} |
4178 |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun " << irun |
if (gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) > gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)) { // Emiliano |
4179 |
<< " has RUNHEADER_OBT>=RUNTRAILER_OBT " << endl; |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun " << irun |
4180 |
cout |
<< " has RUNHEADER_OBT>=RUNTRAILER_OBT " << endl; |
4181 |
<< " (NB!! in this case some events could be assigned to a wrong run)" |
cout |
4182 |
<< endl; |
<< " (NB!! in this case some events could be assigned to a wrong run)" |
4183 |
|
<< endl; |
4184 |
|
} |
4185 |
} |
} |
4186 |
// |
// |
4187 |
if (DBG) printf(" found \n"); |
if (DBG) printf(" found \n"); |
4238 |
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); |
4239 |
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); |
4240 |
printf("2 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
printf("2 rto %d %d \n",GetRunInfo()->RUNHEADER_OBT,GetRunInfo()->RUNTRAILER_OBT); |
4241 |
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)); |
4242 |
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); |
4243 |
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); |
4244 |
} |
} |
4329 |
// update the tracker parameters |
// update the tracker parameters |
4330 |
// (non ho trovato nessun altro modo sicuro di farlo...) |
// (non ho trovato nessun altro modo sicuro di farlo...) |
4331 |
// ---------------------------------------------------- |
// ---------------------------------------------------- |
4332 |
if (!dbc || (dbc && !dbc->IsConnected())) |
if ( fUseDBinRunInfo ){ |
4333 |
SetDBConnection(); |
if (!dbc || (dbc && !dbc->IsConnected())) |
4334 |
TrkParams::Set(GetRunInfo(), dbc); |
SetDBConnection(); |
4335 |
if (dbc){ |
TrkParams::Set(GetRunInfo(), dbc); |
4336 |
dbc->Close(); |
if (dbc){ |
4337 |
delete dbc; |
dbc->Close(); |
4338 |
dbc=0; |
delete dbc; |
4339 |
}; |
dbc=0; |
4340 |
|
} |
4341 |
|
} |
4342 |
// cout << endl; |
// cout << endl; |
4343 |
prevshift = 0; |
prevshift = 0; |
4344 |
yprevshift = 0; |
yprevshift = 0; |
4606 |
// cout << "Checking file: "<<f->GetName()<<endl; |
// cout << "Checking file: "<<f->GetName()<<endl; |
4607 |
if (!f || f->IsZombie()) { |
if (!f || f->IsZombie()) { |
4608 |
cout << "File: " << f->GetName() << " Non valid root file" << endl; |
cout << "File: " << f->GetName() << " Non valid root file" << endl; |
4609 |
|
fDiscarded = true; |
4610 |
return; |
return; |
4611 |
} |
} |
4612 |
|
|
4813 |
TFile *f = new TFile(name.Data()); |
TFile *f = new TFile(name.Data()); |
4814 |
if (!f || f->IsZombie()) { |
if (!f || f->IsZombie()) { |
4815 |
cout << "File: " << f->GetName() << " discarded ---- Non valid root file" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Non valid root file" << endl; |
4816 |
|
fDiscarded = true; |
4817 |
return false; |
return false; |
4818 |
} |
} |
4819 |
// cout << "Get list of keys: "<<f<<endl; |
// cout << "Get list of keys: "<<f<<endl; |
4852 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4853 |
cout << "File: " << f->GetName() << " discarded ---- SelectionList tree has " << nevt |
cout << "File: " << f->GetName() << " discarded ---- SelectionList tree has " << nevt |
4854 |
<< " events instead of " << nev << endl; |
<< " events instead of " << nev << endl; |
4855 |
|
fDiscarded = true; |
4856 |
return false; |
return false; |
4857 |
} |
} |
4858 |
nev = nevt; |
nev = nevt; |
4867 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4868 |
cout << "File: " << f->GetName() << " discarded ---- Trigger tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Trigger tree has " << nevt << " events instead of " |
4869 |
<< nev << endl; |
<< nev << endl; |
4870 |
|
fDiscarded = true; |
4871 |
return false; |
return false; |
4872 |
} |
} |
4873 |
nev = nevt; |
nev = nevt; |
4881 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4882 |
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 |
4883 |
<< endl; |
<< endl; |
4884 |
|
fDiscarded = true; |
4885 |
return false; |
return false; |
4886 |
} |
} |
4887 |
nev = nevt; |
nev = nevt; |
4895 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4896 |
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 |
4897 |
<< endl; |
<< endl; |
4898 |
|
fDiscarded = true; |
4899 |
return false; |
return false; |
4900 |
} |
} |
4901 |
nev = nevt; |
nev = nevt; |
4910 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4911 |
cout << "File: " << f->GetName() << " discarded ---- NeutronD tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- NeutronD tree has " << nevt << " events instead of " |
4912 |
<< nev << endl; |
<< nev << endl; |
4913 |
|
fDiscarded = true; |
4914 |
return false; |
return false; |
4915 |
} |
} |
4916 |
nev = nevt; |
nev = nevt; |
4924 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4925 |
cout << "File: " << f->GetName() << " discarded ---- Anticounter tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Anticounter tree has " << nevt << " events instead of " |
4926 |
<< nev << endl; |
<< nev << endl; |
4927 |
|
fDiscarded = true; |
4928 |
return false; |
return false; |
4929 |
} |
} |
4930 |
nev = nevt; |
nev = nevt; |
4938 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4939 |
cout << "File: " << f->GetName() << " discarded ---- OrbitalInfo tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- OrbitalInfo tree has " << nevt << " events instead of " |
4940 |
<< nev << endl; |
<< nev << endl; |
4941 |
|
fDiscarded = true; |
4942 |
return false; |
return false; |
4943 |
} |
} |
4944 |
nev = nevt; |
nev = nevt; |
4952 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4953 |
cout << "File: " << f->GetName() << " discarded ---- Tracker tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Tracker 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; |
4976 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4977 |
cout << "File: " << f->GetName() << " discarded ---- Calorimeter tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Calorimeter tree has " << nevt << " events instead of " |
4978 |
<< nev << endl; |
<< nev << endl; |
4979 |
|
fDiscarded = true; |
4980 |
return false; |
return false; |
4981 |
} |
} |
4982 |
nev = nevt; |
nev = nevt; |
4999 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
5000 |
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 |
5001 |
<< endl; |
<< endl; |
5002 |
|
fDiscarded = true; |
5003 |
return false; |
return false; |
5004 |
} |
} |
5005 |
nev = nevt; |
nev = nevt; |
5012 |
SELLI = (Int_t) SELLI__ok; |
SELLI = (Int_t) SELLI__ok; |
5013 |
if (SELLI == 0 && SELLI__ok) { |
if (SELLI == 0 && SELLI__ok) { |
5014 |
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; |
5015 |
|
fDiscarded = true; |
5016 |
return false; |
return false; |
5017 |
} |
} |
5018 |
if (SELLI == 1 && !SELLI__ok) { |
if (SELLI == 1 && !SELLI__ok) { |
5019 |
cout << "File: " << f->GetName() << " discarded ---- SelectionList missing" << endl; |
cout << "File: " << f->GetName() << " discarded ---- SelectionList missing" << endl; |
5020 |
|
fDiscarded = true; |
5021 |
return false; |
return false; |
5022 |
} |
} |
5023 |
|
|
5056 |
|
|
5057 |
if (CAL1 && !CAL1__ok) { |
if (CAL1 && !CAL1__ok) { |
5058 |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel1 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel1 branch" << endl; |
5059 |
|
fDiscarded = true; |
5060 |
return false; |
return false; |
5061 |
}; |
}; |
5062 |
if (CAL2 && !CAL2__ok) { |
if (CAL2 && !CAL2__ok) { |
5063 |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel2 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel2 branch" << endl; |
5064 |
|
fDiscarded = true; |
5065 |
return false; |
return false; |
5066 |
}; |
}; |
5067 |
if (TRK2 && !TRK2__ok) { |
if (TRK2 && !TRK2__ok) { |
5068 |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel2 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel2 branch" << endl; |
5069 |
|
fDiscarded = true; |
5070 |
return false; |
return false; |
5071 |
}; |
}; |
5072 |
if (TRK1 && !TRK1__ok) { |
if (TRK1 && !TRK1__ok) { |
5073 |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel1 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel1 branch" << endl; |
5074 |
|
fDiscarded = true; |
5075 |
return false; |
return false; |
5076 |
}; |
}; |
5077 |
if (TRKh && !TRKh__ok) { |
if (TRKh && !TRKh__ok) { |
5078 |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkHough branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkHough branch" << endl; |
5079 |
|
fDiscarded = true; |
5080 |
return false; |
return false; |
5081 |
}; |
}; |
5082 |
if (ORB && !ORB__ok) { |
if (ORB && !ORB__ok) { |
5083 |
cout << "File: " << f->GetName() << " discarded ---- Missing ORB tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing ORB tree" << endl; |
5084 |
|
fDiscarded = true; |
5085 |
return false; |
return false; |
5086 |
}; |
}; |
5087 |
if (AC && !AC__ok) { |
if (AC && !AC__ok) { |
5088 |
cout << "File: " << f->GetName() << " discarded ---- Missing AC tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing AC tree" << endl; |
5089 |
|
fDiscarded = true; |
5090 |
return false; |
return false; |
5091 |
}; |
}; |
5092 |
if (S4 && !S4__ok) { |
if (S4 && !S4__ok) { |
5093 |
cout << "File: " << f->GetName() << " discarded ---- Missing S4 tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing S4 tree" << endl; |
5094 |
|
fDiscarded = true; |
5095 |
return false; |
return false; |
5096 |
}; |
}; |
5097 |
if (TOF && !TOF__ok) { |
if (TOF && !TOF__ok) { |
5098 |
cout << "File: " << f->GetName() << " discarded ---- Missing ToF tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing ToF tree" << endl; |
5099 |
|
fDiscarded = true; |
5100 |
return false; |
return false; |
5101 |
}; |
}; |
5102 |
|
|
5103 |
if (ND && !ND__ok) { |
if (ND && !ND__ok) { |
5104 |
cout << "File: " << f->GetName() << " discarded ---- Missing ND tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing ND tree" << endl; |
5105 |
|
fDiscarded = true; |
5106 |
return false; |
return false; |
5107 |
}; |
}; |
5108 |
if (TRG && !TRG__ok) { |
if (TRG && !TRG__ok) { |
5109 |
cout << "File: " << f->GetName() << " discarded ---- Missing Trigger tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing Trigger tree" << endl; |
5110 |
|
fDiscarded = true; |
5111 |
return false; |
return false; |
5112 |
}; |
}; |
5113 |
if (GP && !GP__ok) { |
if (GP && !GP__ok) { |
5114 |
cout << "File: " << f->GetName() << " discarded ---- Missing h20 tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing h20 tree" << endl; |
5115 |
|
fDiscarded = true; |
5116 |
return false; |
return false; |
5117 |
}; |
}; |
5118 |
|
|
5212 |
// 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; |
5213 |
run_tree_clone->Fill(); |
run_tree_clone->Fill(); |
5214 |
} |
} |
5215 |
cout << "----------------------------------------------------" << endl; |
// |
5216 |
|
// replicate processinginfo tree |
5217 |
|
// |
5218 |
|
if ( PROC ){ // EMEMEM |
5219 |
|
proc_tree_clone = new TTree("ProcessingInfo","Log of data processing"); |
5220 |
|
proc_tree_clone->Branch("ProcInfo", "ProcInfo", GetPointerTo("ProcInfo")); |
5221 |
|
cout << "ProcessingInfo: branch ProcessingInfo" << endl; |
5222 |
|
// ------------------ |
5223 |
|
// replicate processinginfo tree |
5224 |
|
// ------------------ |
5225 |
|
// cout << "----------------------------------------------------"<<endl; |
5226 |
|
// cout << "irun\t | RUN\t NEVENTS\t absolute time"<<endl; |
5227 |
|
for (Int_t i = 0; i < proc_tree->GetEntries(); i++) { |
5228 |
|
proc_tree->GetEntry(i); |
5229 |
|
// cout << i<< "\t | "<<endl; |
5230 |
|
proc_tree_clone->Fill(); |
5231 |
|
} |
5232 |
|
if ( SELLI != 2 ){ |
5233 |
|
proc_obj->runID = 0; |
5234 |
|
TTimeStamp *dt = new TTimeStamp(); |
5235 |
|
proc_obj->date = dt->AsString(); |
5236 |
|
delete dt; |
5237 |
|
proc_obj->commandLine = Form("PamelaLevel2 was called"); |
5238 |
|
proc_obj->outputFilename = ""; |
5239 |
|
proc_obj->localDir = gSystem->WorkingDirectory(); |
5240 |
|
proc_obj->uname = gSystem->GetFromPipe("uname -a"); |
5241 |
|
// proc_obj->DB = Form("mysql://%s/%s",dbc->GetHost(),dbc->GetDB()); |
5242 |
|
proc_obj->DB = ""; |
5243 |
|
proc_tree_clone->Fill(); |
5244 |
|
} |
5245 |
|
cout << "----------------------------------------------------" << endl; |
5246 |
|
} |
5247 |
// ------------------------------------ |
// ------------------------------------ |
5248 |
// add branch with dead and live times |
// add branch with dead and live times |
5249 |
// ------------------------------------ |
// ------------------------------------ |
5275 |
pam_tree_clone[i]->Branch("TrkHough", "TrkHough", GetPointerTo("TrkHough")); |
pam_tree_clone[i]->Branch("TrkHough", "TrkHough", GetPointerTo("TrkHough")); |
5276 |
cout << "Tracker : branch TrkHough" << endl; |
cout << "Tracker : branch TrkHough" << endl; |
5277 |
}; |
}; |
5278 |
|
if(NUC){ |
5279 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&trk_nuc_obj); |
5280 |
|
cout << "Tracker : branch TrackNuclei" << endl; |
5281 |
|
} |
5282 |
|
if(EXT){ |
5283 |
|
pam_tree_clone[i]->Branch("extAlgFlag",&extAlgFlag,"extAlgFlag/I"); |
5284 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&trk_ext_obj); |
5285 |
|
cout << "Tracker : branch RecoveredTrack" << endl; |
5286 |
|
if(NUC){ |
5287 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&trk_ext_nuc_obj); |
5288 |
|
cout << "Tracker : branch RecoveredTrackNuclei" << endl; |
5289 |
|
} |
5290 |
|
} |
5291 |
|
|
5292 |
i++; |
i++; |
5293 |
} |
} |
5294 |
|
|
5303 |
pam_tree_clone[i]->Branch("CaloLevel2", "CaloLevel2", GetPointerTo("CaloLevel2")); |
pam_tree_clone[i]->Branch("CaloLevel2", "CaloLevel2", GetPointerTo("CaloLevel2")); |
5304 |
cout << "Calorimeter : branch CaloLevel2" << endl; |
cout << "Calorimeter : branch CaloLevel2" << endl; |
5305 |
}; |
}; |
5306 |
|
if(NUC){ |
5307 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&calo_nuc_obj); |
5308 |
|
cout << "Calorimeter : branch TrackNuclei" << endl; |
5309 |
|
} |
5310 |
|
if(EXT){ |
5311 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&calo_ext_obj); |
5312 |
|
cout << "Calorimeter : branch RecoveredTrack" << endl; |
5313 |
|
if(NUC){ |
5314 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&calo_ext_nuc_obj); |
5315 |
|
cout << "Calorimeter : branch RecoveredTrackNuclei" << endl; |
5316 |
|
} |
5317 |
|
} |
5318 |
i++; |
i++; |
5319 |
} |
} |
5320 |
|
|
5323 |
pam_tree_clone[i] = new TTree("ToF", "PAMELA ToF level2 data "); |
pam_tree_clone[i] = new TTree("ToF", "PAMELA ToF level2 data "); |
5324 |
pam_tree_clone[i]->Branch("ToFLevel2", "ToFLevel2", GetPointerTo("ToFLevel2")); |
pam_tree_clone[i]->Branch("ToFLevel2", "ToFLevel2", GetPointerTo("ToFLevel2")); |
5325 |
cout << "ToF : branch ToFLevel2" << endl; |
cout << "ToF : branch ToFLevel2" << endl; |
5326 |
|
if(NUC){ |
5327 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&tof_nuc_obj); |
5328 |
|
cout << "ToF : branch TrackNuclei" << endl; |
5329 |
|
} |
5330 |
|
if(EXT){ |
5331 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&tof_ext_obj); |
5332 |
|
cout << "ToF : branch RecoveredTrack" << endl; |
5333 |
|
if(NUC){ |
5334 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&tof_ext_nuc_obj); |
5335 |
|
cout << "ToF : branch RecoveredTrackNuclei" << endl; |
5336 |
|
} |
5337 |
|
} |
5338 |
i++; |
i++; |
5339 |
}; |
}; |
5340 |
// Trigger |
// Trigger |
5370 |
pam_tree_clone[i] = new TTree("OrbitalInfo", "PAMELA orbital info "); |
pam_tree_clone[i] = new TTree("OrbitalInfo", "PAMELA orbital info "); |
5371 |
pam_tree_clone[i]->Branch("OrbitalInfo", "OrbitalInfo", GetPointerTo("OrbitalInfo")); |
pam_tree_clone[i]->Branch("OrbitalInfo", "OrbitalInfo", GetPointerTo("OrbitalInfo")); |
5372 |
cout << "OrbitalInfo : branch OrbitalInfo" << endl; |
cout << "OrbitalInfo : branch OrbitalInfo" << endl; |
5373 |
|
if(NUC){ |
5374 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&orb_nuc_obj); |
5375 |
|
cout << "OrbitalInfo : branch TrackNuclei" << endl; |
5376 |
|
} |
5377 |
|
if(EXT){ |
5378 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&orb_ext_obj); |
5379 |
|
cout << "OrbitalInfo : branch RecoveredTrack" << endl; |
5380 |
|
if(NUC){ |
5381 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&orb_ext_nuc_obj); |
5382 |
|
cout << "OrbitalInfo : branch RecoveredTrackNuclei" << endl; |
5383 |
|
} |
5384 |
|
} |
5385 |
i++; |
i++; |
5386 |
}; |
}; |
5387 |
// GPamela |
// GPamela |
5391 |
cout << "GPamela : branch GPamela" << endl; |
cout << "GPamela : branch GPamela" << endl; |
5392 |
i++; |
i++; |
5393 |
}; |
}; |
5394 |
|
|
5395 |
|
|
5396 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
5397 |
|
|
5398 |
} |
} |
5434 |
if (!name.CompareTo(na)) |
if (!name.CompareTo(na)) |
5435 |
return sel_tree_clone; |
return sel_tree_clone; |
5436 |
} |
} |
5437 |
|
if (proc_tree_clone && PROC) { |
5438 |
|
TString na = proc_tree_clone->GetName(); |
5439 |
|
if (!name.CompareTo(na)) |
5440 |
|
return proc_tree_clone; |
5441 |
|
} |
5442 |
return NULL; |
return NULL; |
5443 |
|
|
5444 |
} |
} |
5458 |
for (Int_t i = 0; i < NCLONES; i++) { |
for (Int_t i = 0; i < NCLONES; i++) { |
5459 |
if (pam_tree_clone[i]) { |
if (pam_tree_clone[i]) { |
5460 |
cout << pam_tree_clone[i]->GetName() << endl; |
cout << pam_tree_clone[i]->GetName() << endl; |
5461 |
pam_tree_clone[i]->Write(); |
pam_tree_clone[i]->Write(pam_tree_clone[i]->GetName(),TObject::kOverwrite); |
5462 |
}; |
}; |
5463 |
} |
} |
5464 |
|
|
5465 |
|
if ( PROC ){//EMEMEMEM |
5466 |
|
proc_tree_clone->Write("ProcessingInfo",TObject::kOverwrite); |
5467 |
|
} |
5468 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
5469 |
|
|
5470 |
} |
} |
6086 |
void PamLevel2::SetSortingMethod(TString how) { |
void PamLevel2::SetSortingMethod(TString how) { |
6087 |
if (howtosort != how) { |
if (howtosort != how) { |
6088 |
issorted = false; |
issorted = false; |
6089 |
|
issorted_new = false; |
6090 |
} |
} |
6091 |
howtosort = how; |
howtosort = how; |
6092 |
} |
} |