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 |
irun = -1LL; |
irun = -1LL; |
576 |
gltsync = 0; // Emiliano |
gltsync = 0; // Emiliano |
577 |
fUpdateRunInfo = true; // Emiliano |
fUpdateRunInfo = true; // Emiliano |
578 |
fUseDBinRunInfo = true; // Emiliano |
fUseDBinRunInfo = true; // Emiliano |
579 |
|
fDiscarded = false; //EM |
580 |
isSync = false; // by default assume that the level2 file(s) is(are) not sinchronized between L0/DB and L2, that is we miss some packets in L2 due to nested/DV-skipped events |
isSync = false; // by default assume that the level2 file(s) is(are) not sinchronized between L0/DB and L2, that is we miss some packets in L2 due to nested/DV-skipped events |
581 |
il0entry = 0LL; |
il0entry = 0LL; |
582 |
// hasL0EE = true; |
// hasL0EE = true; |
641 |
ORB = true; |
ORB = true; |
642 |
GP = false; |
GP = false; |
643 |
|
|
644 |
|
EXT = false; |
645 |
|
NUC = false; |
646 |
|
trkAlg = "STD";//default tracking algorythm |
647 |
|
|
648 |
RUN = true; |
RUN = true; |
649 |
|
|
650 |
SELLI = -1; |
SELLI = -1; |
655 |
|
|
656 |
tsorted = 0; |
tsorted = 0; |
657 |
timage = 0; |
timage = 0; |
658 |
|
text = 0 ; |
659 |
|
|
660 |
|
tsorted_nuc = 0; |
661 |
|
timage_nuc = 0; |
662 |
|
text_nuc = 0 ; |
663 |
|
|
664 |
howtosort = "+CAL+TOF"; |
howtosort = "+CAL+TOF"; |
665 |
//howtosort = "+TOF"; |
//howtosort = "+TOF"; |
667 |
|
|
668 |
issorted = false; |
issorted = false; |
669 |
lastsorted = -1; |
lastsorted = -1; |
670 |
|
issorted_new = false; |
671 |
|
lastsorted_new = -1; |
672 |
|
|
673 |
} |
} |
674 |
; |
; |
699 |
delete calo1_obj; |
delete calo1_obj; |
700 |
if (calo2_obj) |
if (calo2_obj) |
701 |
delete calo2_obj; |
delete calo2_obj; |
702 |
if (tof_obj) |
if (tof2_obj) |
703 |
delete tof_obj; |
delete tof2_obj; |
704 |
if (trig_obj) |
if (trig_obj) |
705 |
delete trig_obj; |
delete trig_obj; |
706 |
if (s4_obj) |
if (s4_obj) |
709 |
delete nd_obj; |
delete nd_obj; |
710 |
if (ac_obj) |
if (ac_obj) |
711 |
delete ac_obj; |
delete ac_obj; |
712 |
if (orb_obj) |
if (orb2_obj) |
713 |
delete orb_obj; |
delete orb2_obj; |
714 |
if (gp_obj) |
if (gp_obj) |
715 |
delete gp_obj; |
delete gp_obj; |
716 |
|
|
717 |
|
if(trk_nuc_obj)trk_nuc_obj->Delete(); |
718 |
|
if(trk_ext_obj)trk_ext_obj->Delete(); |
719 |
|
if(trk_ext_nuc_obj)trk_ext_nuc_obj->Delete(); |
720 |
|
|
721 |
|
if(calo_nuc_obj)calo_nuc_obj->Delete(); |
722 |
|
if(calo_ext_obj)calo_ext_obj->Delete(); |
723 |
|
if(calo_ext_nuc_obj)calo_ext_nuc_obj->Delete(); |
724 |
|
|
725 |
|
if(tof_nuc_obj)tof_nuc_obj->Delete(); |
726 |
|
if(tof_ext_obj)tof_ext_obj->Delete(); |
727 |
|
if(tof_ext_nuc_obj)tof_ext_nuc_obj->Delete(); |
728 |
|
|
729 |
|
if(orb_nuc_obj)orb_nuc_obj->Delete(); |
730 |
|
if(orb_ext_obj)orb_ext_obj->Delete(); |
731 |
|
if(orb_ext_nuc_obj)orb_ext_nuc_obj->Delete(); |
732 |
|
|
733 |
|
|
734 |
|
if(trk2_nuc_obj)trk2_nuc_obj->Delete();; |
735 |
|
if( calo2_nuc_obj)calo2_nuc_obj->Delete();; |
736 |
|
if(tof2_nuc_obj)tof2_nuc_obj->Delete();; |
737 |
|
if(orb2_nuc_obj)orb2_nuc_obj->Delete();; |
738 |
|
|
739 |
|
|
740 |
|
|
741 |
if (tsorted) { |
if (tsorted) { |
742 |
tsorted->Delete(); |
tsorted->Delete(); |
743 |
delete tsorted; |
delete tsorted; |
746 |
timage->Delete(); |
timage->Delete(); |
747 |
delete timage; |
delete timage; |
748 |
} |
} |
749 |
|
if (text) { |
750 |
|
text->Delete(); |
751 |
|
delete text; |
752 |
|
} |
753 |
|
if (tsorted_nuc) { |
754 |
|
tsorted_nuc->Delete(); |
755 |
|
delete tsorted_nuc; |
756 |
|
} |
757 |
|
if (timage_nuc) { |
758 |
|
timage_nuc->Delete(); |
759 |
|
delete timage_nuc; |
760 |
|
} |
761 |
|
if (text_nuc) { |
762 |
|
text_nuc->Delete(); |
763 |
|
delete text_nuc; |
764 |
|
} |
765 |
|
|
766 |
|
|
767 |
|
|
768 |
if (dbc) { |
if (dbc) { |
769 |
dbc->Close(); |
dbc->Close(); |
831 |
if (irunoffset) |
if (irunoffset) |
832 |
delete[] irunoffset; |
delete[] irunoffset; |
833 |
|
|
834 |
|
|
835 |
|
Initialize(); |
836 |
|
|
837 |
} |
} |
838 |
; |
; |
839 |
|
|
867 |
calo1_obj->Clear(); |
calo1_obj->Clear(); |
868 |
if (calo2_obj) |
if (calo2_obj) |
869 |
calo2_obj->Clear(); |
calo2_obj->Clear(); |
870 |
if (tof_obj) |
if (tof2_obj) |
871 |
tof_obj->Clear(); |
tof2_obj->Clear(); |
872 |
if (trig_obj) |
if (trig_obj) |
873 |
trig_obj->Clear(); |
trig_obj->Clear(); |
874 |
if (s4_obj) |
if (s4_obj) |
877 |
nd_obj->Clear(); |
nd_obj->Clear(); |
878 |
if (ac_obj) |
if (ac_obj) |
879 |
ac_obj->Clear(); |
ac_obj->Clear(); |
880 |
if (orb_obj) |
if (orb2_obj) |
881 |
orb_obj->Clear(); |
orb2_obj->Clear(); |
882 |
if (gp_obj) |
if (gp_obj) |
883 |
gp_obj->Clear(); |
gp_obj->Clear(); |
884 |
|
|
885 |
// if(sorted_tracks)sorted_tracks->Clear(); |
// if(sorted_tracks)sorted_tracks->Clear(); |
886 |
// sorted_tracks.Clear(); |
// sorted_tracks.Clear(); |
887 |
|
|
888 |
if (tsorted) { |
if(trk_nuc_obj)trk_nuc_obj->Clear(); |
889 |
tsorted->Delete(); |
if(trk_ext_obj)trk_ext_obj->Clear(); |
890 |
} |
if(trk_ext_nuc_obj)trk_ext_nuc_obj->Clear(); |
891 |
if (timage) { |
|
892 |
timage->Delete(); |
if(calo_nuc_obj)calo_nuc_obj->Clear(); |
893 |
} |
if(calo_ext_obj)calo_ext_obj->Clear(); |
894 |
|
if(calo_ext_nuc_obj)calo_ext_nuc_obj->Clear(); |
895 |
|
|
896 |
|
if(tof_nuc_obj)tof_nuc_obj->Clear(); |
897 |
|
if(tof_ext_obj)tof_ext_obj->Clear(); |
898 |
|
if(tof_ext_nuc_obj)tof_ext_nuc_obj->Clear(); |
899 |
|
|
900 |
|
if(orb_nuc_obj)orb_nuc_obj->Clear(); |
901 |
|
if(orb_ext_obj)orb_ext_obj->Clear(); |
902 |
|
if(orb_ext_nuc_obj)orb_ext_nuc_obj->Clear(); |
903 |
|
|
904 |
|
if(trk2_nuc_obj)trk2_nuc_obj->Clear();; |
905 |
|
if( calo2_nuc_obj)calo2_nuc_obj->Clear();; |
906 |
|
if(tof2_nuc_obj)tof2_nuc_obj->Clear();; |
907 |
|
if(orb2_nuc_obj)orb2_nuc_obj->Clear();; |
908 |
|
|
909 |
|
if (tsorted)tsorted->Delete(); |
910 |
|
if (timage)timage->Delete(); |
911 |
|
if (text) text->Delete(); |
912 |
|
|
913 |
|
if (tsorted_nuc)tsorted_nuc->Delete(); |
914 |
|
if (timage_nuc)timage_nuc->Delete(); |
915 |
|
if (text_nuc) text_nuc->Delete(); |
916 |
} |
} |
917 |
; |
; |
918 |
|
|
977 |
trkh_obj = 0; |
trkh_obj = 0; |
978 |
calo1_obj = 0; |
calo1_obj = 0; |
979 |
calo2_obj = 0; |
calo2_obj = 0; |
980 |
tof_obj = 0; |
tof2_obj = 0; |
981 |
trig_obj = 0; |
trig_obj = 0; |
982 |
s4_obj = 0; |
s4_obj = 0; |
983 |
nd_obj = 0; |
nd_obj = 0; |
984 |
ac_obj = 0; |
ac_obj = 0; |
985 |
orb_obj = 0; |
orb2_obj = 0; |
986 |
gp_obj = 0; |
gp_obj = 0; |
987 |
|
|
988 |
|
trk_ext_obj = 0; |
989 |
|
trk_ext_nuc_obj = 0; |
990 |
|
trk_nuc_obj = 0; |
991 |
|
|
992 |
|
calo_ext_obj = 0; |
993 |
|
calo_ext_nuc_obj = 0; |
994 |
|
calo_nuc_obj = 0; |
995 |
|
|
996 |
|
tof_ext_obj = 0; |
997 |
|
tof_ext_nuc_obj = 0; |
998 |
|
tof_nuc_obj = 0; |
999 |
|
|
1000 |
|
orb_ext_obj = 0; |
1001 |
|
orb_ext_nuc_obj = 0; |
1002 |
|
orb_nuc_obj = 0; |
1003 |
|
|
1004 |
|
trk2_nuc_obj = 0; |
1005 |
|
calo2_nuc_obj = 0; |
1006 |
|
tof2_nuc_obj = 0; |
1007 |
|
orb2_nuc_obj = 0; |
1008 |
|
|
1009 |
|
trk2_nuc_obj = 0; |
1010 |
|
calo2_nuc_obj = 0; |
1011 |
|
tof2_nuc_obj = 0; |
1012 |
|
orb2_nuc_obj = 0; |
1013 |
// |
// |
1014 |
// Reset run pointers |
// Reset run pointers |
1015 |
// |
// |
1044 |
if (strict) { |
if (strict) { |
1045 |
if (trk2_obj && trk2_obj->UnpackError() != 0) |
if (trk2_obj && trk2_obj->UnpackError() != 0) |
1046 |
goodev = false; |
goodev = false; |
1047 |
if (tof_obj && tof_obj->unpackError != 0) |
if (tof2_obj && tof2_obj->unpackError != 0) |
1048 |
goodev = false; |
goodev = false; |
1049 |
if (trig_obj && trig_obj->unpackError != 0) |
if (trig_obj && trig_obj->unpackError != 0) |
1050 |
goodev = false; |
goodev = false; |
1054 |
goodev = false; |
goodev = false; |
1055 |
if (ac_obj && (ac_obj->unpackError != 0 || ((ac_obj->status[0] >> 2) & 1) || ((ac_obj->status[1] >> 2) & 1))) |
if (ac_obj && (ac_obj->unpackError != 0 || ((ac_obj->status[0] >> 2) & 1) || ((ac_obj->status[1] >> 2) & 1))) |
1056 |
goodev = false; |
goodev = false; |
1057 |
// if(orb_obj) |
// if(orb2_obj) |
1058 |
} |
} |
1059 |
else { |
else { |
1060 |
if (nd_obj && nd_obj->unpackError != 0) |
if (nd_obj && nd_obj->unpackError != 0) |
1085 |
printf("PamLevel2::SetMaxShift(Int_t) --WARNING-- the default is optimized by checking the level2 file\n it is strongly suggested to let PamLevel2 choose the max shift!\n"); |
printf("PamLevel2::SetMaxShift(Int_t) --WARNING-- the default is optimized by checking the level2 file\n it is strongly suggested to let PamLevel2 choose the max shift!\n"); |
1086 |
maxshift = sh; |
maxshift = sh; |
1087 |
} else { |
} else { |
1088 |
ULong64_t nev = this->GetEntries(); |
ULong64_t nev = GetEntries(); |
1089 |
ULong64_t runnev = 0ULL; |
ULong64_t runnev = 0ULL; |
1090 |
for (Int_t r=0; r< run_tree->GetEntries();r++){ |
for (Int_t r=0; r< run_tree->GetEntries();r++){ |
1091 |
run_tree->GetEntry(r);//update runinfo |
run_tree->GetEntry(r);//update runinfo |
1140 |
return &calo2_obj; |
return &calo2_obj; |
1141 |
}; |
}; |
1142 |
if (!objname.CompareTo("ToFLevel2")) { |
if (!objname.CompareTo("ToFLevel2")) { |
1143 |
if (!tof_obj) { |
if (!tof2_obj) { |
1144 |
tof_obj = new ToFLevel2(); |
tof2_obj = new ToFLevel2(); |
1145 |
tof_obj->Set(); |
tof2_obj->Set(); |
1146 |
} |
} |
1147 |
return &tof_obj; |
return &tof2_obj; |
1148 |
}; |
}; |
1149 |
if (!objname.CompareTo("TrigLevel2")) { |
if (!objname.CompareTo("TrigLevel2")) { |
1150 |
if (!trig_obj) |
if (!trig_obj) |
1167 |
return &ac_obj; |
return &ac_obj; |
1168 |
}; |
}; |
1169 |
if (!objname.CompareTo("OrbitalInfo")) { |
if (!objname.CompareTo("OrbitalInfo")) { |
1170 |
if (!orb_obj) { |
if (!orb2_obj) { |
1171 |
orb_obj = new OrbitalInfo(); |
orb2_obj = new OrbitalInfo(); |
1172 |
orb_obj->Set(); |
orb2_obj->Set(); |
1173 |
} |
} |
1174 |
return &orb_obj; |
return &orb2_obj; |
1175 |
}; |
}; |
1176 |
// if(!objname.CompareTo("OrbitalInfo")){ |
// if(!objname.CompareTo("OrbitalInfo")){ |
1177 |
// if(!orb_obj) orb_obj = new OrbitalInfo(); |
// if(!orb2_obj) orb2_obj = new OrbitalInfo(); |
1178 |
// return &orb_obj; |
// return &orb2_obj; |
1179 |
// }; |
// }; |
1180 |
if (!objname.CompareTo("GPamela")) { |
if (!objname.CompareTo("GPamela")) { |
1181 |
if (!gp_obj) |
if (!gp_obj) |
1239 |
*/ |
*/ |
1240 |
ToFTrkVar *PamLevel2::GetToFStoredTrack(int seqno) { |
ToFTrkVar *PamLevel2::GetToFStoredTrack(int seqno) { |
1241 |
|
|
1242 |
if (!tof_obj) |
if (!tof2_obj) |
1243 |
return 0; |
return 0; |
1244 |
|
|
1245 |
if (tof_obj->ToFLevel2::ntrk() == 0) { |
if (tof2_obj->ToFLevel2::ntrk() == 0) { |
1246 |
cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo " << seqno << " but no ToF tracks are stored" |
cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo " << seqno << " but no ToF tracks are stored" |
1247 |
<< endl; |
<< endl; |
1248 |
return NULL; |
return NULL; |
1252 |
Int_t it_tof = 0; |
Int_t it_tof = 0; |
1253 |
|
|
1254 |
do { |
do { |
1255 |
c = tof_obj->ToFLevel2::GetToFTrkVar(it_tof); |
c = tof2_obj->ToFLevel2::GetToFTrkVar(it_tof); |
1256 |
it_tof++; |
it_tof++; |
1257 |
} while (c && seqno != c->trkseqno && it_tof < tof_obj->ToFLevel2::ntrk()); |
} while (c && seqno != c->trkseqno && it_tof < tof2_obj->ToFLevel2::ntrk()); |
1258 |
|
|
1259 |
if (!c || seqno != c->trkseqno) { |
if (!c || seqno != c->trkseqno) { |
1260 |
c = 0; |
c = 0; |
1277 |
*/ |
*/ |
1278 |
OrbitalInfoTrkVar *PamLevel2::GetOrbitalInfoStoredTrack(int seqno) { |
OrbitalInfoTrkVar *PamLevel2::GetOrbitalInfoStoredTrack(int seqno) { |
1279 |
|
|
1280 |
if (!orb_obj) |
if (!orb2_obj) |
1281 |
return 0; |
return 0; |
1282 |
|
|
1283 |
if (orb_obj->OrbitalInfo::ntrk() == 0) { |
if (orb2_obj->OrbitalInfo::ntrk() == 0) { |
1284 |
// // TRICK BEGIN |
// // TRICK BEGIN |
1285 |
// OrbitalInfoTrkVar *r = new OrbitalInfoTrkVar(); // TEMPORARY TRICK |
// OrbitalInfoTrkVar *r = new OrbitalInfoTrkVar(); // TEMPORARY TRICK |
1286 |
// Int_t nn = 0; |
// Int_t nn = 0; |
1287 |
// TClonesArray &tor = *orb_obj->OrbitalInfoTrk; |
// TClonesArray &tor = *orb2_obj->OrbitalInfoTrk; |
1288 |
// for(Int_t nt=0; nt < tof_obj->ToFLevel2::ntrk(); nt++){ |
// for(Int_t nt=0; nt < tof2_obj->ToFLevel2::ntrk(); nt++){ |
1289 |
// // |
// // |
1290 |
// ToFTrkVar *ptt = tof_obj->ToFLevel2::GetToFTrkVar(nt); |
// ToFTrkVar *ptt = tof2_obj->ToFLevel2::GetToFTrkVar(nt); |
1291 |
// if ( ptt->trkseqno != -1 ){ |
// if ( ptt->trkseqno != -1 ){ |
1292 |
// // |
// // |
1293 |
// r->trkseqno = ptt->trkseqno; |
// r->trkseqno = ptt->trkseqno; |
1309 |
// }; |
// }; |
1310 |
// delete r; |
// delete r; |
1311 |
// OrbitalInfoTrkVar *c = 0; |
// OrbitalInfoTrkVar *c = 0; |
1312 |
// c = orb_obj->OrbitalInfo::GetOrbitalInfoTrkVar(0); |
// c = orb2_obj->OrbitalInfo::GetOrbitalInfoTrkVar(0); |
1313 |
// return c; |
// return c; |
1314 |
// //TRICK END |
// //TRICK END |
1315 |
cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo " << seqno |
cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo " << seqno |
1321 |
Int_t it_tof = 0; |
Int_t it_tof = 0; |
1322 |
|
|
1323 |
do { |
do { |
1324 |
c = orb_obj->OrbitalInfo::GetOrbitalInfoTrkVar(it_tof); |
c = orb2_obj->OrbitalInfo::GetOrbitalInfoTrkVar(it_tof); |
1325 |
it_tof++; |
it_tof++; |
1326 |
} while (c && seqno != c->trkseqno && it_tof < orb_obj->OrbitalInfo::ntrk()); |
} while (c && seqno != c->trkseqno && it_tof < orb2_obj->OrbitalInfo::ntrk()); |
1327 |
|
|
1328 |
if (!c || seqno != c->trkseqno) { |
if (!c || seqno != c->trkseqno) { |
1329 |
c = 0; |
c = 0; |
1454 |
// create TCloneArrays to store tracks and its images |
// create TCloneArrays to store tracks and its images |
1455 |
if (!tsorted) |
if (!tsorted) |
1456 |
tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
1457 |
tsorted->Delete(); |
tsorted->Clear("C+C");//Delete(); |
1458 |
TClonesArray &ttsorted = *tsorted; |
TClonesArray &ttsorted = *tsorted; |
1459 |
|
|
1460 |
if (!timage) |
if (!timage) |
1461 |
timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
1462 |
timage->Delete(); |
timage->Clear("C+C");//Delete(); |
1463 |
TClonesArray &ttimage = *timage; |
TClonesArray &ttimage = *timage; |
1464 |
|
|
1465 |
|
|
1466 |
|
|
1467 |
//-------------------------------------------------- |
//-------------------------------------------------- |
1468 |
// retrieve sorting method |
// retrieve sorting method |
1469 |
//-------------------------------------------------- |
//-------------------------------------------------- |
1579 |
// ----------------------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------------------- |
1580 |
// check the number of hit pmts along the track |
// check the number of hit pmts along the track |
1581 |
// on S12 S21 and S32, where paddles are parallel to Y axis |
// on S12 S21 and S32, where paddles are parallel to Y axis |
1582 |
if ((use_TOF || use_S1 || use_S2 || use_S3) && !tof_obj) { |
if ((use_TOF || use_S1 || use_S2 || use_S3) && !tof2_obj) { |
1583 |
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but ToFLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but ToFLevel2 not loaded !!!"; |
1584 |
return; |
return; |
1585 |
}; |
}; |
1596 |
// |
// |
1597 |
Float_t sen = 0.; |
Float_t sen = 0.; |
1598 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1599 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1600 |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
1601 |
sen += (op->dedx).At(ih); |
sen += (op->dedx).At(ih); |
1602 |
}; |
}; |
1603 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1604 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1605 |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
1606 |
sen += (oi->dedx).At(ih); |
sen += (oi->dedx).At(ih); |
1607 |
}; |
}; |
1614 |
Int_t nz = 6; |
Int_t nz = 6; |
1615 |
Float_t zin[6]; // << define TOF z-coordinates |
Float_t zin[6]; // << define TOF z-coordinates |
1616 |
for (Int_t ip = 0; ip < nz; ip++) |
for (Int_t ip = 0; ip < nz; ip++) |
1617 |
zin[ip] = tof_obj->ToFLevel2::GetZTOF(tof_obj->ToFLevel2::GetToFPlaneID(ip)); // << read ToF plane z-coordinates |
zin[ip] = tof2_obj->ToFLevel2::GetZTOF(tof2_obj->ToFLevel2::GetToFPlaneID(ip)); // << read ToF plane z-coordinates |
1618 |
Trajectory *tr = new Trajectory(nz, zin); |
Trajectory *tr = new Trajectory(nz, zin); |
1619 |
// |
// |
1620 |
Int_t nphit_p = 0; |
Int_t nphit_p = 0; |
1623 |
Float_t enhit_i = 0.; |
Float_t enhit_i = 0.; |
1624 |
// |
// |
1625 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1626 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1627 |
if (pl == 1 || pl == 2 || pl == 5) { |
if (pl == 1 || pl == 2 || pl == 5) { |
1628 |
nphit_p++; |
nphit_p++; |
1629 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1634 |
// |
// |
1635 |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
1636 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1637 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1638 |
if (pl == 0) { |
if (pl == 0) { |
1639 |
nphit_p++; |
nphit_p++; |
1640 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1643 |
}; |
}; |
1644 |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
1645 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1646 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1647 |
if (pl == 3) { |
if (pl == 3) { |
1648 |
nphit_p++; |
nphit_p++; |
1649 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1652 |
}; |
}; |
1653 |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
1654 |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
1655 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmtadc).At(ih)); |
1656 |
if (pl == 4) { |
if (pl == 4) { |
1657 |
nphit_p++; |
nphit_p++; |
1658 |
enhit_p += (op->dedx).At(ih); |
enhit_p += (op->dedx).At(ih); |
1661 |
}; |
}; |
1662 |
|
|
1663 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1664 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1665 |
if (pl == 1 || pl == 2 || pl == 5) { |
if (pl == 1 || pl == 2 || pl == 5) { |
1666 |
nphit_i++; |
nphit_i++; |
1667 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1672 |
// |
// |
1673 |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
1674 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1675 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1676 |
if (pl == 0) { |
if (pl == 0) { |
1677 |
nphit_i++; |
nphit_i++; |
1678 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1681 |
}; |
}; |
1682 |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
1683 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1684 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1685 |
if (pl == 3) { |
if (pl == 3) { |
1686 |
nphit_i++; |
nphit_i++; |
1687 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1690 |
}; |
}; |
1691 |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
1692 |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
1693 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmtadc).At(ih)); |
1694 |
if (pl == 4) { |
if (pl == 4) { |
1695 |
nphit_i++; |
nphit_i++; |
1696 |
enhit_i += (op->dedx).At(ih); |
enhit_i += (op->dedx).At(ih); |
1734 |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
1735 |
|
|
1736 |
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
1737 |
// Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
// Int_t pl = tof2_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
1738 |
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
1739 |
// }; |
// }; |
1740 |
|
|
1741 |
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
1742 |
// Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
// Int_t pl = tof2_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
1743 |
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
1744 |
// }; |
// }; |
1745 |
// --- modified to count tdc signals (more efficient?) |
// --- modified to count tdc signals (more efficient?) |
1746 |
// --- and to implement check on tdcflag |
// --- and to implement check on tdcflag |
1747 |
for (Int_t ih = 0; ih < op->npmttdc; ih++) { |
for (Int_t ih = 0; ih < op->npmttdc; ih++) { |
1748 |
Int_t pl = tof_obj->GetPlaneIndex((op->pmttdc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((op->pmttdc).At(ih)); |
1749 |
// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; |
// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; |
1750 |
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
1751 |
|| (use_S3 && (pl == 4 || pl == 5))) { |
|| (use_S3 && (pl == 4 || pl == 5))) { |
1755 |
}; |
}; |
1756 |
|
|
1757 |
for (Int_t ih = 0; ih < oi->npmttdc; ih++) { |
for (Int_t ih = 0; ih < oi->npmttdc; ih++) { |
1758 |
Int_t pl = tof_obj->GetPlaneIndex((oi->pmttdc).At(ih)); |
Int_t pl = tof2_obj->GetPlaneIndex((oi->pmttdc).At(ih)); |
1759 |
// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; |
// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; |
1760 |
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
1761 |
|| (use_S3 && (pl == 4 || pl == 5))) { |
|| (use_S3 && (pl == 4 || pl == 5))) { |
1930 |
|
|
1931 |
} |
} |
1932 |
; |
; |
1933 |
|
// |
1934 |
|
//-------------------------------------- |
1935 |
|
/** |
1936 |
|
* Sort physical (tracker) tracks. |
1937 |
|
* @param how String to set the sorting cryterium (es: "CAL" or "TRK+CAL+TOF" ecc...). |
1938 |
|
* Sorting cryteria: |
1939 |
|
* TRK: lower chi**2 |
1940 |
|
* CAL: lower Y spatial residual on the first calorimeter plane |
1941 |
|
* TOF: bigger numebr of hit PMTs along the track, on S12 S21 S32 (where paddles are along the Y axis). |
1942 |
|
* S1: (ask Emiliano) |
1943 |
|
* S2: (ask Emiliano) |
1944 |
|
* S3: (ask Emiliano) |
1945 |
|
* GP: more GP hits |
1946 |
|
* The default sorting cryterium is "TOF+CAL". |
1947 |
|
* |
1948 |
|
* The total number of physical tracks is always given by GetNTracks() and the it-th physical track can be retrieved by means of the methods GetTrack(int it) and GetTrack(int it, TString how). |
1949 |
|
* |
1950 |
|
* New version, with handling of extended tracks and nuclei tracks. |
1951 |
|
*/ |
1952 |
|
void PamLevel2::SortTracksNew() { |
1953 |
|
|
1954 |
|
//-------------------------------------------------- |
1955 |
|
//Check if the current event has already been sorted |
1956 |
|
//-------------------------------------------------- |
1957 |
|
if (issorted_new && lastsorted_new == GetReadEntry()) { |
1958 |
|
return; //already done for this event |
1959 |
|
} |
1960 |
|
|
1961 |
|
|
1962 |
|
// cout << "SORT" << endl; |
1963 |
|
|
1964 |
|
//Reset the sort flags, just in case something will go wrong... |
1965 |
|
issorted_new = false; |
1966 |
|
lastsorted_new = -1; |
1967 |
|
|
1968 |
|
//-------------------------------------------------- |
1969 |
|
// set input variables |
1970 |
|
//-------------------------------------------------- |
1971 |
|
|
1972 |
|
TString how = howtosort; |
1973 |
|
//Save current Object count |
1974 |
|
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
1975 |
|
|
1976 |
|
|
1977 |
|
|
1978 |
|
|
1979 |
|
TrkLevel2 * trk2 ; |
1980 |
|
CaloLevel2 * calo2; |
1981 |
|
ToFLevel2 * tof2 ; |
1982 |
|
OrbitalInfo * orb2 ; |
1983 |
|
|
1984 |
|
TClonesArray * trkext ; |
1985 |
|
TClonesArray * caloext; |
1986 |
|
TClonesArray * tofext ; |
1987 |
|
TClonesArray * orbext ; |
1988 |
|
|
1989 |
|
|
1990 |
|
// cout << "trk2_obj" << trk2_obj<< endl; |
1991 |
|
// cout << "trk2_nuc_obj" << trk2_nuc_obj<< endl; |
1992 |
|
// cout << " trk_ext_obj "<<trk_ext_obj<< endl; |
1993 |
|
// cout << " trk_ext_nuc_obj "<<trk_ext_nuc_obj<< endl; |
1994 |
|
|
1995 |
|
//----------------------------------------------------------- |
1996 |
|
// create/reset TCloneArrays to store tracks and their images |
1997 |
|
//----------------------------------------------------------- |
1998 |
|
|
1999 |
|
// cout << " PamLevel2::SortTracksNew() --- Clear TClonesArray objects"<<endl; |
2000 |
|
|
2001 |
|
// main tracks from standard alg |
2002 |
|
// if (!tsorted) |
2003 |
|
// tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2004 |
|
// tsorted->Clear("C+C");//Delete(); |
2005 |
|
// // track images from standard alg |
2006 |
|
// if (!timage) |
2007 |
|
// timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2008 |
|
// timage->Clear("C+C");//Delete(); |
2009 |
|
// // tracks from extended algorythm |
2010 |
|
// if(EXT && !text) |
2011 |
|
// text = new TClonesArray("PamTrack",trk_ext_obj->GetEntries()); |
2012 |
|
// if(text)text->Clear("C+C");//Delete(); |
2013 |
|
|
2014 |
|
if(tsorted)delete tsorted; |
2015 |
|
if(timage) delete timage; |
2016 |
|
if(text) delete text; |
2017 |
|
tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2018 |
|
timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks()); |
2019 |
|
text = new TClonesArray("PamTrack",trk_ext_obj->GetEntries()); |
2020 |
|
|
2021 |
|
//----------------------------------------------------------- |
2022 |
|
// create/reset TCloneArrays to store tracks and their images |
2023 |
|
//----------------------------------------------------------- |
2024 |
|
if(NUC){ |
2025 |
|
|
2026 |
|
|
2027 |
|
if(tsorted_nuc)delete tsorted_nuc; |
2028 |
|
if(timage_nuc) delete timage_nuc; |
2029 |
|
if(text_nuc) delete text_nuc; |
2030 |
|
tsorted_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2031 |
|
timage_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2032 |
|
text_nuc = new TClonesArray("PamTrack",trk_ext_nuc_obj->GetEntries()); |
2033 |
|
|
2034 |
|
// main tracks from standard alg |
2035 |
|
// if (!tsorted_nuc) |
2036 |
|
// tsorted_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2037 |
|
// tsorted_nuc->Clear("C+C");//Delete(); |
2038 |
|
// // track images from standard alg |
2039 |
|
// if (!timage_nuc) |
2040 |
|
// timage_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks()); |
2041 |
|
// timage_nuc->Clear("C+C");//Delete(); |
2042 |
|
// // tracks from extended algorythm |
2043 |
|
// if(EXT && !text_nuc) |
2044 |
|
// text_nuc = new TClonesArray("PamTrack",trk_ext_nuc_obj->GetEntries()); |
2045 |
|
// if(text_nuc)text_nuc->Clear("C+C");//Delete(); |
2046 |
|
|
2047 |
|
} |
2048 |
|
//-------------------------------------------------- |
2049 |
|
// retrieve sorting method |
2050 |
|
//-------------------------------------------------- |
2051 |
|
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
2052 |
|
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
2053 |
|
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
2054 |
|
Bool_t use_S1 = how.Contains("S1", TString::kIgnoreCase); |
2055 |
|
Bool_t use_S2 = how.Contains("S2", TString::kIgnoreCase); |
2056 |
|
Bool_t use_S3 = how.Contains("S3", TString::kIgnoreCase); |
2057 |
|
Bool_t use_GP = how.Contains("GP", TString::kIgnoreCase); |
2058 |
|
|
2059 |
|
if (use_TOF) { |
2060 |
|
use_S1 = true; |
2061 |
|
use_S2 = true; |
2062 |
|
use_S3 = true; |
2063 |
|
}; |
2064 |
|
if (!CAL2 && use_CAL) |
2065 |
|
use_CAL = false; |
2066 |
|
if (!TOF) { |
2067 |
|
use_TOF = false; |
2068 |
|
use_S1 = false; |
2069 |
|
use_S2 = false; |
2070 |
|
use_S3 = false; |
2071 |
|
} |
2072 |
|
if (!GP) { |
2073 |
|
use_GP = false; |
2074 |
|
} |
2075 |
|
|
2076 |
|
if (!TRK2) { |
2077 |
|
cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
2078 |
|
return; |
2079 |
|
}; |
2080 |
|
|
2081 |
|
|
2082 |
|
/////////////////////////////////////////////////////////////////////////////////// |
2083 |
|
// |
2084 |
|
// sort tracks and fill PamTrack arrays |
2085 |
|
// |
2086 |
|
/////////////////////////////////////////////////////////////////////////////////// |
2087 |
|
for(int doit=0; doit<2; doit++){ |
2088 |
|
|
2089 |
|
// cout << "doit "<<doit<<endl; |
2090 |
|
|
2091 |
|
|
2092 |
|
if(doit == 0){ |
2093 |
|
|
2094 |
|
trk2 = trk2_obj; |
2095 |
|
calo2 = calo2_obj; |
2096 |
|
tof2 = tof2_obj; |
2097 |
|
orb2 = orb2_obj; |
2098 |
|
|
2099 |
|
trkext = trk_ext_obj; |
2100 |
|
caloext = calo_ext_obj; |
2101 |
|
tofext = tof_ext_obj; |
2102 |
|
orbext = orb_ext_obj; |
2103 |
|
|
2104 |
|
|
2105 |
|
|
2106 |
|
|
2107 |
|
|
2108 |
|
}else if (doit == 1){ |
2109 |
|
|
2110 |
|
if(!NUC)break; |
2111 |
|
|
2112 |
|
|
2113 |
|
trk2 = trk2_nuc_obj; |
2114 |
|
calo2 = calo2_nuc_obj; |
2115 |
|
tof2 = tof2_nuc_obj; |
2116 |
|
orb2 = orb2_nuc_obj; |
2117 |
|
|
2118 |
|
trkext = trk_ext_nuc_obj; |
2119 |
|
caloext = calo_ext_nuc_obj; |
2120 |
|
tofext = tof_ext_nuc_obj; |
2121 |
|
orbext = orb_ext_nuc_obj; |
2122 |
|
|
2123 |
|
|
2124 |
|
|
2125 |
|
|
2126 |
|
} |
2127 |
|
|
2128 |
|
// cout << "trk2" << trk2<<endl; |
2129 |
|
// cout << "calo2" << calo2<<endl; |
2130 |
|
// cout << "tof2" << tof2<<endl; |
2131 |
|
// cout << "orb2" << orb2<<endl; |
2132 |
|
// cout << "trkext" <<trkext <<endl; |
2133 |
|
// cout << "tofext" << tofext<<endl; |
2134 |
|
// cout << "caloext" << caloext<<endl; |
2135 |
|
// cout << "orbext" << orbext<<endl; |
2136 |
|
|
2137 |
|
TClonesArray &ttext = (doit==0 ? *text : *text_nuc); |
2138 |
|
TClonesArray &ttimage = (doit==0 ? *timage : *timage_nuc); |
2139 |
|
TClonesArray &ttsorted = (doit==0 ? *tsorted : *tsorted_nuc); |
2140 |
|
|
2141 |
|
// cout << "tsorted + timage "<<doit<<endl; |
2142 |
|
|
2143 |
|
//-------------------------------------------------- |
2144 |
|
// loop over "physical" tracks sorted by the tracker |
2145 |
|
//-------------------------------------------------- |
2146 |
|
for (Int_t i = 0; i < trk2->TrkLevel2::GetNTracks(); i++) { |
2147 |
|
|
2148 |
|
TrkTrack *ts = 0; |
2149 |
|
CaloTrkVar *cs = 0; |
2150 |
|
ToFTrkVar *os = 0; |
2151 |
|
OrbitalInfoTrkVar *rs = 0; |
2152 |
|
|
2153 |
|
// get tracker tracks |
2154 |
|
TrkTrack *tp = trk2->GetTrack(i); //tracker |
2155 |
|
CaloTrkVar *cp = calo2->GetCaloStoredTrack(tp->GetSeqNo()); |
2156 |
|
ToFTrkVar *op = tof2->GetToFStoredTrack(tp->GetSeqNo()); |
2157 |
|
OrbitalInfoTrkVar *rp = orb2->GetOrbitalInfoStoredTrack(tp->GetSeqNo()); |
2158 |
|
|
2159 |
|
TrkTrack *ti = 0; //tracker (image) |
2160 |
|
CaloTrkVar *ci = 0; |
2161 |
|
ToFTrkVar *oi = 0; |
2162 |
|
OrbitalInfoTrkVar *ri = 0; |
2163 |
|
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
2164 |
|
// if track has an image, check image selection |
2165 |
|
|
2166 |
|
Int_t tp_score = 0; //main track sorted by the tracker |
2167 |
|
Int_t ti_score = 0; //image track |
2168 |
|
Int_t totp_score = 0; //main track sorted by the tracker |
2169 |
|
Int_t toti_score = 0; //image track |
2170 |
|
|
2171 |
|
if (tp->HasImage()) { |
2172 |
|
|
2173 |
|
ti = trk2->GetTrackImage(i); //tracker (image) |
2174 |
|
ci = calo2->GetCaloStoredTrack(ti->GetSeqNo()); |
2175 |
|
oi = tof2->GetToFStoredTrack(ti->GetSeqNo()); |
2176 |
|
ri = orb2->GetOrbitalInfoStoredTrack(ti->GetSeqNo()); |
2177 |
|
|
2178 |
|
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
2179 |
|
|
2180 |
|
//assign starting scores |
2181 |
|
tp_score = 0; //main track sorted by the tracker |
2182 |
|
ti_score = 0; //image track |
2183 |
|
|
2184 |
|
// ----------------------------------------------------------------------------------------- |
2185 |
|
// ***************************************************************************************** |
2186 |
|
// ----------------------------------------------------------------------------------------- |
2187 |
|
// calorimeter check |
2188 |
|
// ----------------------------------------------------------------------------------------- |
2189 |
|
if (use_CAL && !calo2) { |
2190 |
|
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but CaloLevel2 not loaded !!!"; |
2191 |
|
return; |
2192 |
|
}; |
2193 |
|
if (use_CAL && !cp && ci) { |
2194 |
|
ti_score++; |
2195 |
|
toti_score++; |
2196 |
|
}; |
2197 |
|
if (use_CAL && cp && !ci) { |
2198 |
|
tp_score++; |
2199 |
|
totp_score++; |
2200 |
|
}; |
2201 |
|
if (use_CAL && cp && ci && true) { |
2202 |
|
|
2203 |
|
if (cp->npresh > ci->npresh && true) { |
2204 |
|
tp_score++; |
2205 |
|
totp_score++; |
2206 |
|
}; |
2207 |
|
if (cp->npresh < ci->npresh && true) { |
2208 |
|
ti_score++; |
2209 |
|
toti_score++; |
2210 |
|
}; |
2211 |
|
|
2212 |
|
// cout << "CALO "<<tp_score<<ti_score<<endl; |
2213 |
|
|
2214 |
|
}; |
2215 |
|
// ----------------------------------------------------------------------------------------- |
2216 |
|
// ***************************************************************************************** |
2217 |
|
// ----------------------------------------------------------------------------------------- |
2218 |
|
// TOF check |
2219 |
|
// ----------------------------------------------------------------------------------------- |
2220 |
|
// check the number of hit pmts along the track |
2221 |
|
// on S12 S21 and S32, where paddles are parallel to Y axis |
2222 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && !tof2) { |
2223 |
|
cout << "void PamLevel2::SortTracks(): howtosort= " << how << " but ToFLevel2 not loaded !!!"; |
2224 |
|
return; |
2225 |
|
}; |
2226 |
|
// |
2227 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && !op && oi) { |
2228 |
|
ti_score++; |
2229 |
|
toti_score++; |
2230 |
|
}; |
2231 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && op && !oi) { |
2232 |
|
tp_score++; |
2233 |
|
totp_score++; |
2234 |
|
}; |
2235 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && op && oi) { |
2236 |
|
// |
2237 |
|
Float_t sen = 0.; |
2238 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2239 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2240 |
|
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
2241 |
|
sen += (op->dedx).At(ih); |
2242 |
|
}; |
2243 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2244 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2245 |
|
if (pl == 2 || pl == 3 || pl == 4 || pl == 5) |
2246 |
|
sen += (oi->dedx).At(ih); |
2247 |
|
}; |
2248 |
|
// |
2249 |
|
if (sen >= sortthr && false) { // temporary disabled NUCLEI special algorithm since the new one should work for every particle (to be checked!) |
2250 |
|
//printf(" IS A NUCLEUS! en = %f \n",sen); |
2251 |
|
// |
2252 |
|
// is a nucleus use a different algorithm |
2253 |
|
// |
2254 |
|
Int_t nz = 6; |
2255 |
|
Float_t zin[6]; // << define TOF z-coordinates |
2256 |
|
for (Int_t ip = 0; ip < nz; ip++) |
2257 |
|
zin[ip] = tof2->GetZTOF(tof2->GetToFPlaneID(ip)); // << read ToF plane z-coordinates |
2258 |
|
Trajectory *tr = new Trajectory(nz, zin); |
2259 |
|
// |
2260 |
|
Int_t nphit_p = 0; |
2261 |
|
Int_t nphit_i = 0; |
2262 |
|
Float_t enhit_p = 0.; |
2263 |
|
Float_t enhit_i = 0.; |
2264 |
|
// |
2265 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2266 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2267 |
|
if (pl == 1 || pl == 2 || pl == 5) { |
2268 |
|
nphit_p++; |
2269 |
|
enhit_p += (op->dedx).At(ih); |
2270 |
|
}; |
2271 |
|
}; |
2272 |
|
// |
2273 |
|
tp->DoTrack2(tr); |
2274 |
|
// |
2275 |
|
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
2276 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2277 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2278 |
|
if (pl == 0) { |
2279 |
|
nphit_p++; |
2280 |
|
enhit_p += (op->dedx).At(ih); |
2281 |
|
}; |
2282 |
|
}; |
2283 |
|
}; |
2284 |
|
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
2285 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2286 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2287 |
|
if (pl == 3) { |
2288 |
|
nphit_p++; |
2289 |
|
enhit_p += (op->dedx).At(ih); |
2290 |
|
}; |
2291 |
|
}; |
2292 |
|
}; |
2293 |
|
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
2294 |
|
for (Int_t ih = 0; ih < op->npmtadc; ih++) { |
2295 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmtadc).At(ih)); |
2296 |
|
if (pl == 4) { |
2297 |
|
nphit_p++; |
2298 |
|
enhit_p += (op->dedx).At(ih); |
2299 |
|
}; |
2300 |
|
}; |
2301 |
|
}; |
2302 |
|
|
2303 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2304 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2305 |
|
if (pl == 1 || pl == 2 || pl == 5) { |
2306 |
|
nphit_i++; |
2307 |
|
enhit_i += (op->dedx).At(ih); |
2308 |
|
}; |
2309 |
|
}; |
2310 |
|
// |
2311 |
|
ti->DoTrack2(tr); |
2312 |
|
// |
2313 |
|
if (fabs(tr->y[0] - oi->ytofpos[0]) < 2.) { |
2314 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2315 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2316 |
|
if (pl == 0) { |
2317 |
|
nphit_i++; |
2318 |
|
enhit_i += (op->dedx).At(ih); |
2319 |
|
}; |
2320 |
|
}; |
2321 |
|
}; |
2322 |
|
if (fabs(tr->y[3] - oi->ytofpos[1]) < 2.) { |
2323 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2324 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2325 |
|
if (pl == 3) { |
2326 |
|
nphit_i++; |
2327 |
|
enhit_i += (op->dedx).At(ih); |
2328 |
|
}; |
2329 |
|
}; |
2330 |
|
}; |
2331 |
|
if (fabs(tr->y[4] - oi->ytofpos[2]) < 2.) { |
2332 |
|
for (Int_t ih = 0; ih < oi->npmtadc; ih++) { |
2333 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmtadc).At(ih)); |
2334 |
|
if (pl == 4) { |
2335 |
|
nphit_i++; |
2336 |
|
enhit_i += (op->dedx).At(ih); |
2337 |
|
}; |
2338 |
|
}; |
2339 |
|
}; |
2340 |
|
|
2341 |
|
if ((use_TOF || use_S1 || use_S2 || use_S3) && (nphit_p + nphit_i) != 0 && true) { |
2342 |
|
|
2343 |
|
// printf(" seqno %i nphit_p %i nphit_i %i enhit_p %f enhit_i %f \n",trk2_obj->TrkLevel2::GetSeqNo(i),nphit_p,nphit_i,enhit_p,enhit_i); |
2344 |
|
// printf(" score p %i score i %i \n",tp_score,ti_score); |
2345 |
|
// if( enhit_p > enhit_i ) tp_score++; |
2346 |
|
// if( nphit_p >= nphit_i && enhit_p > enhit_i ) tp_score++; |
2347 |
|
if (nphit_p > nphit_i) |
2348 |
|
tp_score++; |
2349 |
|
if (nphit_p < nphit_i) |
2350 |
|
ti_score++; |
2351 |
|
if (nphit_p == nphit_i) { |
2352 |
|
if (enhit_p > enhit_i) |
2353 |
|
tp_score++; |
2354 |
|
else |
2355 |
|
ti_score++; |
2356 |
|
}; |
2357 |
|
// printf(" dopo score p %i score i %i \n",tp_score,ti_score); |
2358 |
|
}; |
2359 |
|
delete tr; |
2360 |
|
// |
2361 |
|
} |
2362 |
|
else { |
2363 |
|
// ------------- |
2364 |
|
// NOT a NUCLEUS |
2365 |
|
// ------------- |
2366 |
|
//printf(" NOT a NUCLEUS! en = %f \n",sen); |
2367 |
|
|
2368 |
|
Int_t nphit_p = 0; |
2369 |
|
Int_t nphit_i = 0; |
2370 |
|
|
2371 |
|
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
2372 |
|
cout << "track: npmttdc "<< op->npmttdc << endl; |
2373 |
|
cout << "image: npmtadc "<< oi->npmtadc << endl; |
2374 |
|
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
2375 |
|
|
2376 |
|
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
2377 |
|
// Int_t pl = tof2_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
2378 |
|
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
2379 |
|
// }; |
2380 |
|
|
2381 |
|
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
2382 |
|
// Int_t pl = tof2_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
2383 |
|
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
2384 |
|
// }; |
2385 |
|
// --- modified to count tdc signals (more efficient?) |
2386 |
|
// --- and to implement check on tdcflag |
2387 |
|
for (Int_t ih = 0; ih < op->npmttdc; ih++) { |
2388 |
|
Int_t pl = tof2->GetPlaneIndex((op->pmttdc).At(ih)); |
2389 |
|
// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; |
2390 |
|
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
2391 |
|
|| (use_S3 && (pl == 4 || pl == 5))) { |
2392 |
|
if ((op->tdcflag).At(ih) == 0) |
2393 |
|
nphit_p++; |
2394 |
|
}; |
2395 |
|
}; |
2396 |
|
|
2397 |
|
for (Int_t ih = 0; ih < oi->npmttdc; ih++) { |
2398 |
|
Int_t pl = tof2->GetPlaneIndex((oi->pmttdc).At(ih)); |
2399 |
|
// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; |
2400 |
|
if ((use_S1 && (pl == 0 || pl == 1)) || (use_S2 && (pl == 2 || pl == 3)) |
2401 |
|
|| (use_S3 && (pl == 4 || pl == 5))) { |
2402 |
|
if ((oi->tdcflag).At(ih) == 0) |
2403 |
|
nphit_i++; |
2404 |
|
}; |
2405 |
|
}; |
2406 |
|
|
2407 |
|
if ((nphit_p + nphit_i) != 0 && true) { |
2408 |
|
|
2409 |
|
if (nphit_p != nphit_i) { |
2410 |
|
totp_score += nphit_p; |
2411 |
|
toti_score += nphit_i; |
2412 |
|
tp_score += nphit_p; |
2413 |
|
ti_score += nphit_i; |
2414 |
|
}; |
2415 |
|
// if ( nphit_p > nphit_i) tp_score+=nphit_p; |
2416 |
|
// else if( nphit_p < nphit_i) ti_score+=nphit_i; |
2417 |
|
// else ;//niente |
2418 |
|
}; |
2419 |
|
}; |
2420 |
|
// cout << "TOF "<<tp_score<<ti_score<<endl; |
2421 |
|
}; |
2422 |
|
|
2423 |
|
// if(tp_score == ti_score) use_TRK = true; |
2424 |
|
|
2425 |
|
|
2426 |
|
// ----------------------------------------------------------------------------------------- |
2427 |
|
// ***************************************************************************************** |
2428 |
|
// ----------------------------------------------------------------------------------------- |
2429 |
|
// tracker check |
2430 |
|
// ----------------------------------------------------------------------------------------- |
2431 |
|
// chi**2 difference is not always large enough to distinguish among |
2432 |
|
// the real track and its image. |
2433 |
|
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
2434 |
|
// *** MODIFIED ON AUGUST 2007 *** |
2435 |
|
if (use_TRK) { |
2436 |
|
// if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
2437 |
|
// else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
2438 |
|
|
2439 |
|
// CHECK 1 : number of points along X |
2440 |
|
if (tp->GetNX() >= ti->GetNX()) { |
2441 |
|
tp_score++; |
2442 |
|
totp_score++; |
2443 |
|
}; |
2444 |
|
if (tp->GetNX() <= ti->GetNX()) { |
2445 |
|
ti_score++; |
2446 |
|
toti_score++; |
2447 |
|
}; |
2448 |
|
// CHECK 2 : number of points along Y |
2449 |
|
if (tp->GetNY() >= ti->GetNY()) { |
2450 |
|
tp_score++; |
2451 |
|
totp_score++; |
2452 |
|
}; |
2453 |
|
if (tp->GetNY() <= ti->GetNY()) { |
2454 |
|
ti_score++; |
2455 |
|
toti_score++; |
2456 |
|
}; |
2457 |
|
|
2458 |
|
// cout << "TRK "<<tp_score<<ti_score<<endl; |
2459 |
|
}; |
2460 |
|
|
2461 |
|
// ----------------------------------------------------------------------------------------- |
2462 |
|
// ***************************************************************************************** |
2463 |
|
// ----------------------------------------------------------------------------------------- |
2464 |
|
// GPamela check |
2465 |
|
// ----------------------------------------------------------------------------------------- |
2466 |
|
|
2467 |
|
//--------------------------------------------------- |
2468 |
|
// count the number of GP hits |
2469 |
|
//--------------------------------------------------- |
2470 |
|
if (use_GP) { |
2471 |
|
int ngphits_p = 0; |
2472 |
|
int ngphits_i = 0; |
2473 |
|
float toll = 0.02; //200 micron |
2474 |
|
for (int ih = 0; ih < GetGPamela()->Nthspe; ih++) { |
2475 |
|
int ip = (Int_t) GetGPamela()->Itrpb[ih] - 1; |
2476 |
|
if (tp && tp->YGood(ip) && fabs(tp->ym[ip] - GetGPamela()->Yavspe[ih]) < toll && true) |
2477 |
|
ngphits_p++; |
2478 |
|
if (ti && ti->YGood(ip) && fabs(ti->ym[ip] - GetGPamela()->Yavspe[ih]) < toll && true) |
2479 |
|
ngphits_i++; |
2480 |
|
} |
2481 |
|
if (ngphits_p > ngphits_i && true) { |
2482 |
|
tp_score++; |
2483 |
|
totp_score++; |
2484 |
|
} |
2485 |
|
if (ngphits_p < ngphits_i && true) { |
2486 |
|
ti_score++; |
2487 |
|
toti_score++; |
2488 |
|
} |
2489 |
|
} |
2490 |
|
|
2491 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2492 |
|
// the winner is.... |
2493 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2494 |
|
if (tp_score > ti_score) { |
2495 |
|
|
2496 |
|
} |
2497 |
|
else if (tp_score < ti_score) { |
2498 |
|
|
2499 |
|
ts = ti;//its image!! |
2500 |
|
cs = ci; |
2501 |
|
os = oi; |
2502 |
|
rs = ri; |
2503 |
|
Int_t totis = toti_score; |
2504 |
|
|
2505 |
|
ti = tp;//its image!! |
2506 |
|
ci = cp; |
2507 |
|
oi = op; |
2508 |
|
ri = rp; |
2509 |
|
|
2510 |
|
tp = ts;//its image!! |
2511 |
|
cp = cs; |
2512 |
|
op = os; |
2513 |
|
rp = rs; |
2514 |
|
|
2515 |
|
toti_score = totp_score; |
2516 |
|
totp_score = totis; |
2517 |
|
|
2518 |
|
} |
2519 |
|
else { |
2520 |
|
|
2521 |
|
// cout << "Warning - track image ambiguity not solved" << endl; |
2522 |
|
|
2523 |
|
}; |
2524 |
|
|
2525 |
|
} |
2526 |
|
else { |
2527 |
|
totp_score = 1; |
2528 |
|
toti_score = 0; |
2529 |
|
|
2530 |
|
// ts = tp; |
2531 |
|
// cs = cp; |
2532 |
|
// os = op; |
2533 |
|
}; |
2534 |
|
|
2535 |
|
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
2536 |
|
// sorted_tracks->Add(ts);//save the track in the sorted array |
2537 |
|
// sorted_tracks.Add(ts);//save the track in the sorted array |
2538 |
|
// sorted_tracks.Add(tp);//save the track in the sorted array |
2539 |
|
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
2540 |
|
// cout<<"o "<<tp<<endl; |
2541 |
|
// cout<<"o "<<cp<<endl; |
2542 |
|
// cout<<"o "<<op<<endl; |
2543 |
|
|
2544 |
|
new (ttsorted[i]) PamTrack(tp, cp, op, rp); |
2545 |
|
new (ttimage[i]) PamTrack(ti, ci, oi, ri); |
2546 |
|
|
2547 |
|
((PamTrack*) (ttsorted[i]))->SetPScore(totp_score); |
2548 |
|
((PamTrack*) (ttsorted[i]))->SetIScore(toti_score); |
2549 |
|
((PamTrack*) (ttimage[i]))->SetPScore(totp_score); |
2550 |
|
((PamTrack*) (ttimage[i]))->SetIScore(toti_score); |
2551 |
|
}; |
2552 |
|
|
2553 |
|
|
2554 |
|
|
2555 |
|
|
2556 |
|
|
2557 |
|
// if (tsorted->GetEntries() != trk2->GetNTracks()) { |
2558 |
|
// cout << "void PamLevel2::SortTracks(): tsorted->GetEntries() " << tsorted->GetEntries() |
2559 |
|
// << " != trk2->GetNTracks() = " << trk2->GetNTracks() << endl; |
2560 |
|
// tsorted->Delete(); |
2561 |
|
// tsorted = 0; |
2562 |
|
// timage->Delete(); |
2563 |
|
// timage = 0; |
2564 |
|
// } |
2565 |
|
|
2566 |
|
|
2567 |
|
// cout << "text "<<doit<<endl; |
2568 |
|
|
2569 |
|
|
2570 |
|
//-------------------------------------------------- |
2571 |
|
// fill array with extended tracks (this is easy...) |
2572 |
|
//-------------------------------------------------- |
2573 |
|
if(EXT){ |
2574 |
|
for(int it=0; it<trkext->GetEntries(); it++){ |
2575 |
|
|
2576 |
|
new (ttext[it]) PamTrack((ExtTrack*)(*trkext)[it], (CaloTrkVar*)(*caloext)[it], (ToFTrkVar*)(*tofext)[it], (OrbitalInfoTrkVar*)(*orbext)[it]); |
2577 |
|
|
2578 |
|
} |
2579 |
|
} |
2580 |
|
|
2581 |
|
|
2582 |
|
|
2583 |
|
}; |
2584 |
|
|
2585 |
|
|
2586 |
|
//Restore Object count |
2587 |
|
//To save space in the table keeping track of all referenced objects |
2588 |
|
//We reset the object count to what it was at the beginning of the event. |
2589 |
|
TProcessID::SetObjectCount(ObjectNumber); |
2590 |
|
|
2591 |
|
//Everything went fine so the current event can be tagged as sorted |
2592 |
|
issorted_new = true; |
2593 |
|
lastsorted_new = GetReadEntry(); |
2594 |
|
|
2595 |
|
// cout << " tsorted "<< tsorted << " "<<(tsorted ? tsorted->GetEntries() : 0)<<endl; |
2596 |
|
// cout << " timage "<< timage << " "<<(timage ? timage->GetEntries() : 0)<<endl; |
2597 |
|
// cout << " text "<< text << " "<<(text ? text->GetEntries() : 0)<<endl; |
2598 |
|
|
2599 |
|
|
2600 |
|
}; |
2601 |
//-------------------------------------- |
//-------------------------------------- |
2602 |
// |
// |
2603 |
// |
// |
2606 |
* This method overrides TrkLevel2::GetTracks(), where sorting is done by decreasing number of fit points and increasing chi^2. |
* This method overrides TrkLevel2::GetTracks(), where sorting is done by decreasing number of fit points and increasing chi^2. |
2607 |
* PamLevel2::GetTracks() keeps the same track order given by TrkLevel2::GetTracks(), but checks image selection by using calorimeter and ToF tracking information. |
* PamLevel2::GetTracks() keeps the same track order given by TrkLevel2::GetTracks(), but checks image selection by using calorimeter and ToF tracking information. |
2608 |
*/ |
*/ |
2609 |
|
|
2610 |
// TRefArray *PamLevel2::GetTracks(){ |
// TRefArray *PamLevel2::GetTracks(){ |
2611 |
|
|
2612 |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
2617 |
// return &sorted_tracks; |
// return &sorted_tracks; |
2618 |
|
|
2619 |
// }; |
// }; |
|
TClonesArray *PamLevel2::GetTracks() { |
|
|
|
|
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
|
|
SortTracks(); |
|
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
|
2620 |
|
|
|
return tsorted; |
|
2621 |
|
|
|
} |
|
|
; |
|
2622 |
//-------------------------------------- |
//-------------------------------------- |
2623 |
// |
// |
2624 |
// |
// |
2625 |
//-------------------------------------- |
//-------------------------------------- |
2626 |
|
|
2627 |
/** |
/** |
2628 |
* Retrieves the it-th Pamela "physical" track. |
* Retrieves the it-th Pamela "physical" track. |
2629 |
* It override TrkLevel2::GetTrack(int it). |
* It override TrkLevel2::GetTrack(int it). |
2630 |
* @param it Track number, ranging from 0 to GetNTracks(). |
* @param it Track number, ranging from 0 to GetNTracks(). |
2631 |
*/ |
*/ |
2632 |
PamTrack *PamLevel2::GetTrack(int it) { |
PamTrack *PamLevel2::GetTrackOld(int it) { |
|
|
|
|
// if(!trk2_obj) return 0; |
|
2633 |
|
|
2634 |
// // *-*-*-*+-*-*-*-*-*-*-*-*-* |
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; |
|
2635 |
|
|
|
// cout << "PamLevel2::GetTrack(int it) "<<endl; |
|
2636 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2637 |
SortTracks(); |
SortTracks(); |
2638 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2639 |
if (!tsorted) |
if (!tsorted) |
2640 |
return 0; |
return track; |
2641 |
if (!tsorted->GetEntries()) |
if (!tsorted->GetEntries()) |
2642 |
return 0; |
return track; |
2643 |
|
|
|
PamTrack *track = 0; |
|
2644 |
|
|
2645 |
if (it >= 0 && it < trk2_obj->TrkLevel2::GetNTracks()) { |
if (it >= 0 && it < trk2_obj->TrkLevel2::GetNTracks()) { |
|
// TrkTrack *t = (TrkTrack*)sorted_tracks.At(it); |
|
|
// track = GetPamTrackAlong(t); |
|
|
//TClonesArray &t = *(tsorted); |
|
|
//track = (PamTrack*)t[it]; |
|
2646 |
track = (PamTrack*)((*tsorted)[it]); |
track = (PamTrack*)((*tsorted)[it]); |
2647 |
} |
} |
2648 |
else { |
else { |
2649 |
cout << "PamLevel2::GetTrack(int) : tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
cout << "PamLevel2::GetTrackOld(int) : tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
2650 |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
2651 |
}; |
}; |
2652 |
|
|
2653 |
return track; |
return track; |
2654 |
|
|
2655 |
|
}; |
2656 |
|
|
2657 |
|
//PamTrack *PamLevel2::GetTrack(int it) { return GetTrack(it,trkAlg); }; |
2658 |
|
|
2659 |
|
/** |
2660 |
|
* Retrieves the it-th Pamela "physical" track. |
2661 |
|
* It override TrkLevel2::GetTrack(int it). |
2662 |
|
* @param it Track number, ranging from 0 to GetNTracks(). |
2663 |
|
* @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation. |
2664 |
|
*/ |
2665 |
|
PamTrack *PamLevel2::GetTrack(int it, const char* alg) { |
2666 |
|
|
2667 |
|
TString s(alg); |
2668 |
|
if(!s.CompareTo("") ||!s.CompareTo("STD") )return GetTrackOld(it); //old algorythm |
2669 |
|
|
2670 |
|
|
2671 |
|
SortTracksNew(); |
2672 |
|
// >> fill tsorted, timage and text |
2673 |
|
|
2674 |
|
if ( ( !s.Contains("EXTF", TString::kIgnoreCase) || !EXT )){ //not forced exteded-alg requested (or exteded-data missing) |
2675 |
|
|
2676 |
|
if( s.Contains("NUC")){ |
2677 |
|
if( |
2678 |
|
tsorted_nuc && |
2679 |
|
it < tsorted_nuc->GetEntries() && //enough tracks found |
2680 |
|
it >= 0 && //valid index |
2681 |
|
true) return (PamTrack*)((*tsorted_nuc)[it]); //ok return the track |
2682 |
|
}else{ |
2683 |
|
if( |
2684 |
|
tsorted && |
2685 |
|
it < tsorted->GetEntries() && //enough tracks found |
2686 |
|
it >= 0 && //valid index |
2687 |
|
true )return (PamTrack*)((*tsorted)[it]); //ok return the track |
2688 |
|
} |
2689 |
|
|
2690 |
|
} |
2691 |
|
|
2692 |
|
|
2693 |
|
///////////////////////////////////////////////////////////////////////// |
2694 |
|
/// if requested get track from extended algorythm output |
2695 |
|
///////////////////////////////////////////////////////////////////////// |
2696 |
|
|
2697 |
|
if(s.Contains("EXT", TString::kIgnoreCase) && EXT){//if exteded-alg requested |
2698 |
|
|
2699 |
|
if(s.Contains("NUC")){ |
2700 |
|
if( |
2701 |
|
text_nuc && |
2702 |
|
it < text_nuc->GetEntries() && //enough tracks found |
2703 |
|
it >= 0 && //valid index |
2704 |
|
true) return (PamTrack*)((*text_nuc)[it]); |
2705 |
|
}else{ |
2706 |
|
if( |
2707 |
|
text && |
2708 |
|
it < text->GetEntries() && //enough tracks found |
2709 |
|
it >= 0 && //valid index |
2710 |
|
true) return (PamTrack*)((*text)[it]); |
2711 |
|
} |
2712 |
|
|
2713 |
|
}; |
2714 |
|
|
2715 |
|
|
2716 |
|
cout << "PamTrack *PamLevel2::GetTrack("<<it<<","<<alg<<") -- wrong track number or unrecognised algorithm"<<endl; |
2717 |
|
|
2718 |
|
return NULL; |
2719 |
|
|
2720 |
} |
} |
2721 |
; |
; |
2722 |
|
TClonesArray *PamLevel2::GetTracks() { |
2723 |
|
|
2724 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2725 |
|
SortTracks(); |
2726 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2727 |
|
|
2728 |
|
return tsorted; |
2729 |
|
|
2730 |
|
} |
2731 |
|
; |
2732 |
|
Int_t PamLevel2::GetNTracks(const char* alg) { |
2733 |
|
|
2734 |
|
|
2735 |
|
// cout << " trk_nuc_obj->GetEntries() "<<trk_nuc_obj->GetEntries()<<" trk2_nuc_obj->GetNTracks() "<<trk2_nuc_obj->GetNTracks()<<endl; |
2736 |
|
|
2737 |
|
TString s(alg); |
2738 |
|
|
2739 |
|
if(!s.CompareTo("") || !s.CompareTo("STD"))return trk2_obj->TrkLevel2::GetNTracks(); //standard algorythm |
2740 |
|
|
2741 |
|
if(s.Contains("EXTF", TString::kIgnoreCase) && EXT){ |
2742 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && NUC)return trk_ext_nuc_obj->GetEntries();//ok |
2743 |
|
return trk_ext_obj->GetEntries();//ok |
2744 |
|
} |
2745 |
|
if( s.Contains("EXT", TString::kIgnoreCase) && EXT) { |
2746 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && NUC) |
2747 |
|
return (trk2_nuc_obj->TrkLevel2::GetNTracks() ? trk2_nuc_obj->TrkLevel2::GetNTracks() : trk_ext_nuc_obj->GetEntries() ); |
2748 |
|
return (trk2_obj->TrkLevel2::GetNTracks() ? trk2_obj->TrkLevel2::GetNTracks() : trk_ext_obj->GetEntries() ); |
2749 |
|
} |
2750 |
|
if(s.Contains("NUC", TString::kIgnoreCase) && NUC ) |
2751 |
|
return trk2_nuc_obj->TrkLevel2::GetNTracks(); |
2752 |
|
|
2753 |
|
cout << "Int_t PamLevel2::GetNTracks("<<alg<<") -- unrecognised algorithm"<<endl; |
2754 |
|
|
2755 |
|
return 0; |
2756 |
|
|
2757 |
|
} |
2758 |
|
|
2759 |
|
|
2760 |
//-------------------------------------- |
//-------------------------------------- |
2761 |
// |
// |
2765 |
* Retrieves (if present) the image of the it-th Pamela "physical" track, sorted by the method PamLevel2::SortTracks(). |
* Retrieves (if present) the image of the it-th Pamela "physical" track, sorted by the method PamLevel2::SortTracks(). |
2766 |
* @param it Track number, ranging from 0 to GetNTracks(). |
* @param it Track number, ranging from 0 to GetNTracks(). |
2767 |
*/ |
*/ |
2768 |
PamTrack *PamLevel2::GetTrackImage(int it) { |
PamTrack *PamLevel2::GetTrackImageOld(int it) { |
2769 |
|
|
2770 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
2771 |
SortTracks(); |
SortTracks(); |
2789 |
}; |
}; |
2790 |
} |
} |
2791 |
else { |
else { |
2792 |
cout << "PamLevel2::GetTrackImage(int) : Tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
cout << "PamLevel2::GetTrackImageOld(int) : Tracker track SeqNo " << it << " does not exist (GetNTracks() = " |
2793 |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
<< trk2_obj->TrkLevel2::GetNTracks() << ")" << endl; |
2794 |
}; |
}; |
2795 |
|
|
2796 |
return image; |
return image; |
2797 |
} |
} |
2798 |
|
/** |
2799 |
|
* Retrieves (if present) the image of the it-th Pamela "physical" track, sorted by the method PamLevel2::SortTracks(). |
2800 |
|
* @param it Track number, ranging from 0 to GetNTracks(). |
2801 |
|
* @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation. |
2802 |
|
*/ |
2803 |
|
PamTrack *PamLevel2::GetTrackImage(int it, const char* alg) { |
2804 |
|
|
2805 |
|
TString s(alg); |
2806 |
|
if(!s.CompareTo("") || !s.CompareTo("STD"))return GetTrackImageOld(it); //old algorythm |
2807 |
|
|
2808 |
|
|
2809 |
|
SortTracksNew(); |
2810 |
|
// >> fill tsorted, timage and text |
2811 |
|
|
2812 |
|
if ( ( !s.Contains("EXTF", TString::kIgnoreCase) || !EXT )){ //not forced exteded-alg requested (or exteded-data missing) |
2813 |
|
|
2814 |
|
if( s.Contains("NUC")){ |
2815 |
|
if( |
2816 |
|
tsorted_nuc && |
2817 |
|
it < tsorted_nuc->GetEntries() && //enough tracks found |
2818 |
|
it >= 0 && //valid index |
2819 |
|
true){ |
2820 |
|
TClonesArray &t = *(tsorted_nuc); |
2821 |
|
PamTrack *temp = (PamTrack*) t[it]; |
2822 |
|
if (temp->GetTrkTrack()->HasImage()) { |
2823 |
|
return (PamTrack*)((*timage_nuc)[it]); //ok return the track |
2824 |
|
}else{ |
2825 |
|
return NULL; |
2826 |
|
} |
2827 |
|
|
2828 |
|
} |
2829 |
|
}else{ |
2830 |
|
if( |
2831 |
|
tsorted && |
2832 |
|
it < tsorted->GetEntries() && //enough tracks found |
2833 |
|
it >= 0 && //valid index |
2834 |
|
true ){ |
2835 |
|
TClonesArray &t = *(tsorted); |
2836 |
|
PamTrack *temp = (PamTrack*) t[it]; |
2837 |
|
if (temp->GetTrkTrack()->HasImage()) { |
2838 |
|
return (PamTrack*)((*timage)[it]); //ok return the track |
2839 |
|
}else{ |
2840 |
|
return NULL; |
2841 |
|
} |
2842 |
|
} |
2843 |
|
} |
2844 |
|
|
2845 |
|
} |
2846 |
|
|
2847 |
|
cout << "PamTrack *PamLevel2::GetTrackImage("<<it<<","<<alg<<") -- wrong track number or unrecognised algorithm"<<endl; |
2848 |
|
|
2849 |
|
return NULL; |
2850 |
|
|
2851 |
|
} |
2852 |
|
; |
2853 |
|
|
2854 |
//-------------------------------------- |
//-------------------------------------- |
2855 |
// |
// |
2939 |
if (!Trout) |
if (!Trout) |
2940 |
Trout = T; |
Trout = T; |
2941 |
else |
else |
2942 |
Trout->AddFriend(T); |
Trout->AddFriend(T); |
2943 |
} |
} |
2944 |
else { |
else { |
2945 |
cout << "Tracker : missing tree" << endl; |
cout << "Tracker : missing tree" << endl; |
3352 |
G->Add(name); |
G->Add(name); |
3353 |
if (SELLI == 1) |
if (SELLI == 1) |
3354 |
L->Add(name); |
L->Add(name); |
3355 |
}; |
}; |
3356 |
}; |
}; |
3357 |
|
|
3358 |
cout << "done chains\n"; |
cout << "done data-tree chains "<< T->GetNtrees() <<" \n"; |
3359 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "----------------------------------------------------" << endl; |
3360 |
|
|
3361 |
// ------------------------------------------- |
// ------------------------------------------- |
3362 |
// make friends |
// make friends |
3439 |
// ===================================== |
// ===================================== |
3440 |
// SET BRANCH-ADDRESS AFTER CHAIN+FRIEND |
// SET BRANCH-ADDRESS AFTER CHAIN+FRIEND |
3441 |
// ===================================== |
// ===================================== |
3442 |
SetBranchAddress(Trout); |
if( Trout->GetNtrees() )SetBranchAddress(Trout); |
3443 |
|
|
3444 |
// ------------------------------------ |
// ------------------------------------ |
3445 |
// finally handle selection trees... |
// finally handle selection trees... |
3446 |
// (it is not friend of pamela tree) |
// (it is not friend of pamela tree) |
3447 |
// ------------------------------------ |
// ------------------------------------ |
3448 |
|
|
3449 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "----------------------------------------------------" << endl; |
3450 |
|
|
3451 |
// Selection List |
// Selection List |
3452 |
if (L && SELLI == 1) { |
if (L && SELLI == 1) { |
3467 |
// if(!Trout)Trout=O; |
// if(!Trout)Trout=O; |
3468 |
// else Trout->AddFriend("SelectionList"); |
// else Trout->AddFriend("SelectionList"); |
3469 |
cout << "+SelectionList" << endl; |
cout << "+SelectionList" << endl; |
3470 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "----------------------------------------------------" << endl; |
3471 |
} |
} |
3472 |
else { |
else { |
3473 |
// cout << "SelectionList : missing tree"<<endl; |
// cout << "SelectionList : missing tree"<<endl; |
3493 |
*/ |
*/ |
3494 |
void PamLevel2::SetBranchAddress(TTree *t) { |
void PamLevel2::SetBranchAddress(TTree *t) { |
3495 |
|
|
3496 |
TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
// TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
3497 |
TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
// TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
3498 |
TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
// TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
3499 |
CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
// CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
3500 |
CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
// CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
3501 |
TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
// TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
3502 |
TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
// TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
3503 |
S4 = S4 & t->GetBranchStatus("S4Level2"); |
// S4 = S4 & t->GetBranchStatus("S4Level2"); |
3504 |
ND = ND & t->GetBranchStatus("NDLevel2"); |
// ND = ND & t->GetBranchStatus("NDLevel2"); |
3505 |
AC = AC & t->GetBranchStatus("AcLevel2"); |
// AC = AC & t->GetBranchStatus("AcLevel2"); |
3506 |
ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
// ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
3507 |
GP = GP & t->GetBranchStatus("h20"); |
// GP = GP & t->GetBranchStatus("h20"); |
3508 |
|
|
3509 |
|
|
3510 |
// Tracker |
// Tracker |
3511 |
if (TRK1) { |
if (TRK1) { |
3515 |
if (TRK2) { |
if (TRK2) { |
3516 |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel1")); |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel1")); |
3517 |
cout << "Tracker : set branch address TrkLevel2" << endl; |
cout << "Tracker : set branch address TrkLevel2" << endl; |
3518 |
|
NUC = t->GetBranchStatus("TrackNuclei"); |
3519 |
|
EXT = t->GetBranchStatus("RecoveredTrack") && (NUC ? t->GetBranchStatus("RecoveredTrackNuclei"): true ); |
3520 |
}; |
}; |
3521 |
if (TRKh) { |
if (TRKh) { |
3522 |
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
3577 |
|
|
3578 |
cout << "h20 : set branch address GPamela " << endl; |
cout << "h20 : set branch address GPamela " << endl; |
3579 |
}; |
}; |
3580 |
|
if(NUC){ |
3581 |
|
|
3582 |
|
cout << "Found nuclei-track branches" << endl; |
3583 |
|
|
3584 |
|
if( !trk_nuc_obj )trk_nuc_obj = new TClonesArray("TrkTrack"); |
3585 |
|
if( !calo_nuc_obj)calo_nuc_obj= new TClonesArray("CaloTrkVar"); |
3586 |
|
if( !tof_nuc_obj)tof_nuc_obj= new TClonesArray("ToFTrkVar"); |
3587 |
|
if( !orb_nuc_obj)orb_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3588 |
|
if (TRK2)t-> SetBranchAddress("TrackNuclei",&trk_nuc_obj); |
3589 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("TrackNuclei",&calo_nuc_obj); |
3590 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("TrackNuclei",&tof_nuc_obj); |
3591 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("TrackNuclei",&orb_nuc_obj); |
3592 |
|
|
3593 |
|
///copy the vector content inside a "fake" object (all aother info are missing) |
3594 |
|
|
3595 |
|
if( !trk2_nuc_obj )trk2_nuc_obj = new TrkLevel2(); |
3596 |
|
if( !calo2_nuc_obj )calo2_nuc_obj = new CaloLevel2(); |
3597 |
|
if( !tof2_nuc_obj )tof2_nuc_obj = new ToFLevel2(); |
3598 |
|
if( !orb2_nuc_obj )orb2_nuc_obj = new OrbitalInfo(); |
3599 |
|
// *(trk2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*trk_nuc_obj); |
3600 |
|
// *(calo2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*calo_nuc_obj); |
3601 |
|
// *(tof2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*tof_nuc_obj); |
3602 |
|
// *(orb2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*orb_nuc_obj); |
3603 |
|
|
3604 |
|
trk2_nuc_obj->SetTrackArray( trk_nuc_obj ); |
3605 |
|
calo2_nuc_obj->SetTrackArray( calo_nuc_obj ); |
3606 |
|
tof2_nuc_obj->SetTrackArray( tof_nuc_obj ); |
3607 |
|
orb2_nuc_obj->SetTrackArray( orb_nuc_obj ); |
3608 |
|
|
3609 |
|
|
3610 |
|
} |
3611 |
|
|
3612 |
|
if(EXT){ |
3613 |
|
|
3614 |
|
cout << "Found extended tracking algorythm branches" << endl; |
3615 |
|
|
3616 |
|
if( !trk_ext_obj )trk_ext_obj = new TClonesArray("ExtTrack"); |
3617 |
|
if( !calo_ext_obj)calo_ext_obj= new TClonesArray("CaloTrkVar"); |
3618 |
|
if( !tof_ext_obj)tof_ext_obj= new TClonesArray("ToFTrkVar"); |
3619 |
|
if( !orb_ext_obj)orb_ext_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3620 |
|
|
3621 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrack",&trk_ext_obj); |
3622 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrack",&calo_ext_obj); |
3623 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrack",&tof_ext_obj); |
3624 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrack",&orb_ext_obj); |
3625 |
|
|
3626 |
|
|
3627 |
|
if(NUC){ |
3628 |
|
if( !trk_ext_nuc_obj )trk_ext_nuc_obj = new TClonesArray("ExtTrack"); |
3629 |
|
if( !calo_ext_nuc_obj)calo_ext_nuc_obj= new TClonesArray("CaloTrkVar"); |
3630 |
|
if( !tof_ext_nuc_obj)tof_ext_nuc_obj= new TClonesArray("ToFTrkVar"); |
3631 |
|
if( !orb_ext_nuc_obj)orb_ext_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3632 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrackNuclei",&trk_ext_nuc_obj); |
3633 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrackNuclei",&calo_ext_nuc_obj); |
3634 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrackNuclei",&tof_ext_nuc_obj); |
3635 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrackNuclei",&orb_ext_nuc_obj); |
3636 |
|
} |
3637 |
|
} |
3638 |
} |
} |
3639 |
/** |
/** |
3640 |
* Set branch addresses for Pamela friend trees |
* Set branch addresses for Pamela friend trees |
3658 |
if (TRK2) { |
if (TRK2) { |
3659 |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
3660 |
cout << "Tracker : set branch address TrkLevel2" << endl; |
cout << "Tracker : set branch address TrkLevel2" << endl; |
3661 |
|
NUC = t->GetBranchStatus("TrackNuclei"); |
3662 |
|
EXT = t->GetBranchStatus("RecoveredTrack") && (NUC ? t->GetBranchStatus("RecoveredTrackNuclei"): true ); |
3663 |
}; |
}; |
3664 |
if (TRK1) { |
if (TRK1) { |
3665 |
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
3673 |
// Calorimeter |
// Calorimeter |
3674 |
if (CAL2) { |
if (CAL2) { |
3675 |
t->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
t->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
3676 |
cout << "Calorimeter : set branch address CaloLevel2" << endl; |
cout << "Calorimeter : set branch address CaloLevel2" << endl; |
3677 |
}; |
}; |
3678 |
if (CAL1) { |
if (CAL1) { |
3679 |
t->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
t->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
3731 |
// cout << "SelectionList: set branch address EventEntry"<<endl; |
// cout << "SelectionList: set branch address EventEntry"<<endl; |
3732 |
|
|
3733 |
// } |
// } |
3734 |
|
if(NUC){ |
3735 |
|
|
3736 |
|
cout << "Found nuclei-track branches" << endl; |
3737 |
|
|
3738 |
|
if( !trk_nuc_obj )trk_nuc_obj = new TClonesArray("TrkTrack"); |
3739 |
|
if( !calo_nuc_obj)calo_nuc_obj= new TClonesArray("CaloTrkVar"); |
3740 |
|
if( !tof_nuc_obj)tof_nuc_obj= new TClonesArray("ToFTrkVar"); |
3741 |
|
if( !orb_nuc_obj)orb_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3742 |
|
if (TRK2)t-> SetBranchAddress("TrackNuclei",&trk_nuc_obj); |
3743 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("TrackNuclei",&calo_nuc_obj); |
3744 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("TrackNuclei",&tof_nuc_obj); |
3745 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("TrackNuclei",&orb_nuc_obj); |
3746 |
|
|
3747 |
|
///copy the vector content inside a "fake" object (all aother info are missing) |
3748 |
|
|
3749 |
|
if( !trk2_nuc_obj )trk2_nuc_obj = new TrkLevel2(); |
3750 |
|
if( !calo2_nuc_obj )calo2_nuc_obj = new CaloLevel2(); |
3751 |
|
if( !tof2_nuc_obj )tof2_nuc_obj = new ToFLevel2(); |
3752 |
|
if( !orb2_nuc_obj )orb2_nuc_obj = new OrbitalInfo(); |
3753 |
|
|
3754 |
|
// *(trk2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*trk_nuc_obj); |
3755 |
|
// *(calo2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*calo_nuc_obj); |
3756 |
|
// *(tof2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*tof_nuc_obj); |
3757 |
|
// *(orb2_nuc_obj->GetPointerToTrackArray()) = new TClonesArray(*orb_nuc_obj); |
3758 |
|
trk2_nuc_obj->SetTrackArray( trk_nuc_obj ); |
3759 |
|
calo2_nuc_obj->SetTrackArray( calo_nuc_obj ); |
3760 |
|
tof2_nuc_obj->SetTrackArray( tof_nuc_obj ); |
3761 |
|
orb2_nuc_obj->SetTrackArray( orb_nuc_obj ); |
3762 |
|
|
3763 |
|
} |
3764 |
|
if(EXT){ |
3765 |
|
|
3766 |
|
cout << "Found extended tracking algorythm branches" << endl; |
3767 |
|
|
3768 |
|
t->SetBranchAddress("extAlgFlag",&extAlgFlag); |
3769 |
|
|
3770 |
|
if( !trk_ext_obj )trk_ext_obj = new TClonesArray("ExtTrack"); |
3771 |
|
if( !calo_ext_obj)calo_ext_obj= new TClonesArray("CaloTrkVar"); |
3772 |
|
if( !tof_ext_obj)tof_ext_obj= new TClonesArray("ToFTrkVar"); |
3773 |
|
if( !orb_ext_obj)orb_ext_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3774 |
|
|
3775 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrack",&trk_ext_obj); |
3776 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrack",&calo_ext_obj); |
3777 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrack",&tof_ext_obj); |
3778 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrack",&orb_ext_obj); |
3779 |
|
|
3780 |
|
if(NUC){ |
3781 |
|
if( !trk_ext_nuc_obj )trk_ext_nuc_obj = new TClonesArray("ExtTrack"); |
3782 |
|
if( !calo_ext_nuc_obj)calo_ext_nuc_obj= new TClonesArray("CaloTrkVar"); |
3783 |
|
if( !tof_ext_nuc_obj)tof_ext_nuc_obj= new TClonesArray("ToFTrkVar"); |
3784 |
|
if( !orb_ext_nuc_obj)orb_ext_nuc_obj= new TClonesArray("OrbitalInfoTrkVar"); |
3785 |
|
if (TRK2)t-> SetBranchAddress("RecoveredTrackNuclei",&trk_ext_nuc_obj); |
3786 |
|
if (CAL2)t->GetFriend("Calorimeter")->SetBranchAddress("RecoveredTrackNuclei",&calo_ext_nuc_obj); |
3787 |
|
if (TOF )t->GetFriend("ToF")-> SetBranchAddress("RecoveredTrackNuclei",&tof_ext_nuc_obj); |
3788 |
|
if (ORB )t->GetFriend("OrbitalInfo")->SetBranchAddress("RecoveredTrackNuclei",&orb_ext_nuc_obj); |
3789 |
|
} |
3790 |
|
} |
3791 |
|
|
3792 |
} |
} |
3793 |
|
|
3794 |
|
/** |
3795 |
|
* Set the tracking algorythm |
3796 |
|
* @param alg String to choose the track. |
3797 |
|
* "" --> take the output of the standard tracking algorythm |
3798 |
|
* "STD" --> take the output of the standard tracking algorythm |
3799 |
|
* "NUC" --> take the output of the standard tracking algorythm for nuclei cluster selection |
3800 |
|
* "EXT" --> in case the standard tracking algorythm has not found any track, take the output of the extended one |
3801 |
|
* "EXTF" --> force the extended tracking algorythm |
3802 |
|
* "NUCEXT" --> as "EXT", but for nuclei |
3803 |
|
* "NUCEXTF" --> as "EXTF", but for nuclei |
3804 |
|
*/ |
3805 |
|
// void PamLevel2::SetTrackingAlgorythm(const char *alg){ |
3806 |
|
|
3807 |
|
|
3808 |
|
// TString s(alg); |
3809 |
|
// if(s.Contains("NUC", TString::kIgnoreCase) && !NUC) |
3810 |
|
// cout << "Warning! NUC algorythm requested, but branches are missing"<<endl; |
3811 |
|
// if(s.Contains("EXT", TString::kIgnoreCase) && !EXT) |
3812 |
|
// cout << "Warning! EXT algorythm requested, but branches are missing"<<endl;; |
3813 |
|
|
3814 |
|
// trkAlg = alg; |
3815 |
|
|
3816 |
|
// }; |
3817 |
|
// const char* PamLevel2::GetTrackingAlgorythm(){ |
3818 |
|
|
3819 |
|
|
3820 |
|
// cout<<endl<<" Implemented tracking algorythm: "; |
3821 |
|
// cout<<endl<<" \"\" or \"STD\" --> take the output of the standard tracking algorythm"; |
3822 |
|
// cout<<endl<<" \"NUC\" --> take the output of the standard tracking algorythm for nuclei cluster selection"; |
3823 |
|
// cout<<endl<<" \"EXT\" --> in case the standard tracking algorythm has not found any track,"; |
3824 |
|
// cout<<endl<<" take the output of the extended one"; |
3825 |
|
// cout<<endl<<" \"EXTF\" --> force the extended tracking algorythm"; |
3826 |
|
// cout<<endl<<" \"NUCEXT\" --> as \"EXT\", but for nuclei "; |
3827 |
|
// cout<<endl<<" \"NUCEXTF\" --> as \"EXTF\", but for nuclei"; |
3828 |
|
|
3829 |
|
// cout<<endl; |
3830 |
|
// cout<<" <<Currently set algorythm>> "<<trkAlg<<endl; |
3831 |
|
// cout<<endl; |
3832 |
|
|
3833 |
|
// return trkAlg; |
3834 |
|
// }; |
3835 |
|
|
3836 |
|
|
3837 |
|
|
3838 |
//-------------------------------------- |
//-------------------------------------- |
3839 |
// |
// |
3840 |
// |
// |
3868 |
}; |
}; |
3869 |
} |
} |
3870 |
|
|
3871 |
|
cout << "done run chain "<< R->GetNtrees() <<" \n"; |
3872 |
|
|
3873 |
|
|
3874 |
if (RUN && R->GetNtrees()) { |
if (RUN && R->GetNtrees()) { |
3875 |
|
|
3876 |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
3910 |
cout << "----------------------------------------------------" << endl; |
cout << "----------------------------------------------------" << endl; |
3911 |
|
|
3912 |
} |
} |
3913 |
else { |
// else { |
3914 |
delete R; |
// delete R; |
3915 |
R = 0; |
// R = 0; |
3916 |
} |
// } |
3917 |
|
|
3918 |
run_tree = R; |
run_tree = R; |
3919 |
|
|
4778 |
TFile *f = new TFile(name.Data()); |
TFile *f = new TFile(name.Data()); |
4779 |
if (!f || f->IsZombie()) { |
if (!f || f->IsZombie()) { |
4780 |
cout << "File: " << f->GetName() << " discarded ---- Non valid root file" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Non valid root file" << endl; |
4781 |
|
fDiscarded = true; |
4782 |
return false; |
return false; |
4783 |
} |
} |
4784 |
// cout << "Get list of keys: "<<f<<endl; |
// cout << "Get list of keys: "<<f<<endl; |
4817 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4818 |
cout << "File: " << f->GetName() << " discarded ---- SelectionList tree has " << nevt |
cout << "File: " << f->GetName() << " discarded ---- SelectionList tree has " << nevt |
4819 |
<< " events instead of " << nev << endl; |
<< " events instead of " << nev << endl; |
4820 |
|
fDiscarded = true; |
4821 |
return false; |
return false; |
4822 |
} |
} |
4823 |
nev = nevt; |
nev = nevt; |
4832 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4833 |
cout << "File: " << f->GetName() << " discarded ---- Trigger tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Trigger tree has " << nevt << " events instead of " |
4834 |
<< nev << endl; |
<< nev << endl; |
4835 |
|
fDiscarded = true; |
4836 |
return false; |
return false; |
4837 |
} |
} |
4838 |
nev = nevt; |
nev = nevt; |
4846 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4847 |
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 |
4848 |
<< endl; |
<< endl; |
4849 |
|
fDiscarded = true; |
4850 |
return false; |
return false; |
4851 |
} |
} |
4852 |
nev = nevt; |
nev = nevt; |
4860 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4861 |
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 |
4862 |
<< endl; |
<< endl; |
4863 |
|
fDiscarded = true; |
4864 |
return false; |
return false; |
4865 |
} |
} |
4866 |
nev = nevt; |
nev = nevt; |
4875 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4876 |
cout << "File: " << f->GetName() << " discarded ---- NeutronD tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- NeutronD tree has " << nevt << " events instead of " |
4877 |
<< nev << endl; |
<< nev << endl; |
4878 |
|
fDiscarded = true; |
4879 |
return false; |
return false; |
4880 |
} |
} |
4881 |
nev = nevt; |
nev = nevt; |
4889 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4890 |
cout << "File: " << f->GetName() << " discarded ---- Anticounter tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Anticounter tree has " << nevt << " events instead of " |
4891 |
<< nev << endl; |
<< nev << endl; |
4892 |
|
fDiscarded = true; |
4893 |
return false; |
return false; |
4894 |
} |
} |
4895 |
nev = nevt; |
nev = nevt; |
4903 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4904 |
cout << "File: " << f->GetName() << " discarded ---- OrbitalInfo tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- OrbitalInfo tree has " << nevt << " events instead of " |
4905 |
<< nev << endl; |
<< nev << endl; |
4906 |
|
fDiscarded = true; |
4907 |
return false; |
return false; |
4908 |
} |
} |
4909 |
nev = nevt; |
nev = nevt; |
4917 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4918 |
cout << "File: " << f->GetName() << " discarded ---- Tracker tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Tracker tree has " << nevt << " events instead of " |
4919 |
<< nev << endl; |
<< nev << endl; |
4920 |
|
fDiscarded = true; |
4921 |
return false; |
return false; |
4922 |
} |
} |
4923 |
nev = nevt; |
nev = nevt; |
4941 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4942 |
cout << "File: " << f->GetName() << " discarded ---- Calorimeter tree has " << nevt << " events instead of " |
cout << "File: " << f->GetName() << " discarded ---- Calorimeter tree has " << nevt << " events instead of " |
4943 |
<< nev << endl; |
<< nev << endl; |
4944 |
|
fDiscarded = true; |
4945 |
return false; |
return false; |
4946 |
} |
} |
4947 |
nev = nevt; |
nev = nevt; |
4964 |
if (nev && nevt != nev) { |
if (nev && nevt != nev) { |
4965 |
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 |
4966 |
<< endl; |
<< endl; |
4967 |
|
fDiscarded = true; |
4968 |
return false; |
return false; |
4969 |
} |
} |
4970 |
nev = nevt; |
nev = nevt; |
4977 |
SELLI = (Int_t) SELLI__ok; |
SELLI = (Int_t) SELLI__ok; |
4978 |
if (SELLI == 0 && SELLI__ok) { |
if (SELLI == 0 && SELLI__ok) { |
4979 |
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; |
4980 |
|
fDiscarded = true; |
4981 |
return false; |
return false; |
4982 |
} |
} |
4983 |
if (SELLI == 1 && !SELLI__ok) { |
if (SELLI == 1 && !SELLI__ok) { |
4984 |
cout << "File: " << f->GetName() << " discarded ---- SelectionList missing" << endl; |
cout << "File: " << f->GetName() << " discarded ---- SelectionList missing" << endl; |
4985 |
|
fDiscarded = true; |
4986 |
return false; |
return false; |
4987 |
} |
} |
4988 |
|
|
5021 |
|
|
5022 |
if (CAL1 && !CAL1__ok) { |
if (CAL1 && !CAL1__ok) { |
5023 |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel1 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel1 branch" << endl; |
5024 |
|
fDiscarded = true; |
5025 |
return false; |
return false; |
5026 |
}; |
}; |
5027 |
if (CAL2 && !CAL2__ok) { |
if (CAL2 && !CAL2__ok) { |
5028 |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel2 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel2 branch" << endl; |
5029 |
|
fDiscarded = true; |
5030 |
return false; |
return false; |
5031 |
}; |
}; |
5032 |
if (TRK2 && !TRK2__ok) { |
if (TRK2 && !TRK2__ok) { |
5033 |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel2 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel2 branch" << endl; |
5034 |
|
fDiscarded = true; |
5035 |
return false; |
return false; |
5036 |
}; |
}; |
5037 |
if (TRK1 && !TRK1__ok) { |
if (TRK1 && !TRK1__ok) { |
5038 |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel1 branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel1 branch" << endl; |
5039 |
|
fDiscarded = true; |
5040 |
return false; |
return false; |
5041 |
}; |
}; |
5042 |
if (TRKh && !TRKh__ok) { |
if (TRKh && !TRKh__ok) { |
5043 |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkHough branch" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing TrkHough branch" << endl; |
5044 |
|
fDiscarded = true; |
5045 |
return false; |
return false; |
5046 |
}; |
}; |
5047 |
if (ORB && !ORB__ok) { |
if (ORB && !ORB__ok) { |
5048 |
cout << "File: " << f->GetName() << " discarded ---- Missing ORB tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing ORB tree" << endl; |
5049 |
|
fDiscarded = true; |
5050 |
return false; |
return false; |
5051 |
}; |
}; |
5052 |
if (AC && !AC__ok) { |
if (AC && !AC__ok) { |
5053 |
cout << "File: " << f->GetName() << " discarded ---- Missing AC tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing AC tree" << endl; |
5054 |
|
fDiscarded = true; |
5055 |
return false; |
return false; |
5056 |
}; |
}; |
5057 |
if (S4 && !S4__ok) { |
if (S4 && !S4__ok) { |
5058 |
cout << "File: " << f->GetName() << " discarded ---- Missing S4 tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing S4 tree" << endl; |
5059 |
|
fDiscarded = true; |
5060 |
return false; |
return false; |
5061 |
}; |
}; |
5062 |
if (TOF && !TOF__ok) { |
if (TOF && !TOF__ok) { |
5063 |
cout << "File: " << f->GetName() << " discarded ---- Missing ToF tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing ToF tree" << endl; |
5064 |
|
fDiscarded = true; |
5065 |
return false; |
return false; |
5066 |
}; |
}; |
5067 |
|
|
5068 |
if (ND && !ND__ok) { |
if (ND && !ND__ok) { |
5069 |
cout << "File: " << f->GetName() << " discarded ---- Missing ND tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing ND tree" << endl; |
5070 |
|
fDiscarded = true; |
5071 |
return false; |
return false; |
5072 |
}; |
}; |
5073 |
if (TRG && !TRG__ok) { |
if (TRG && !TRG__ok) { |
5074 |
cout << "File: " << f->GetName() << " discarded ---- Missing Trigger tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing Trigger tree" << endl; |
5075 |
|
fDiscarded = true; |
5076 |
return false; |
return false; |
5077 |
}; |
}; |
5078 |
if (GP && !GP__ok) { |
if (GP && !GP__ok) { |
5079 |
cout << "File: " << f->GetName() << " discarded ---- Missing h20 tree" << endl; |
cout << "File: " << f->GetName() << " discarded ---- Missing h20 tree" << endl; |
5080 |
|
fDiscarded = true; |
5081 |
return false; |
return false; |
5082 |
}; |
}; |
5083 |
|
|
5210 |
pam_tree_clone[i]->Branch("TrkHough", "TrkHough", GetPointerTo("TrkHough")); |
pam_tree_clone[i]->Branch("TrkHough", "TrkHough", GetPointerTo("TrkHough")); |
5211 |
cout << "Tracker : branch TrkHough" << endl; |
cout << "Tracker : branch TrkHough" << endl; |
5212 |
}; |
}; |
5213 |
|
if(NUC){ |
5214 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&trk_nuc_obj); |
5215 |
|
cout << "Tracker : branch TrackNuclei" << endl; |
5216 |
|
} |
5217 |
|
if(EXT){ |
5218 |
|
pam_tree_clone[i]->Branch("extAlgFlag",&extAlgFlag,"extAlgFlag/I"); |
5219 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&trk_ext_obj); |
5220 |
|
cout << "Tracker : branch RecoveredTrack" << endl; |
5221 |
|
if(NUC){ |
5222 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&trk_ext_nuc_obj); |
5223 |
|
cout << "Tracker : branch RecoveredTrackNuclei" << endl; |
5224 |
|
} |
5225 |
|
} |
5226 |
|
|
5227 |
i++; |
i++; |
5228 |
} |
} |
5229 |
|
|
5238 |
pam_tree_clone[i]->Branch("CaloLevel2", "CaloLevel2", GetPointerTo("CaloLevel2")); |
pam_tree_clone[i]->Branch("CaloLevel2", "CaloLevel2", GetPointerTo("CaloLevel2")); |
5239 |
cout << "Calorimeter : branch CaloLevel2" << endl; |
cout << "Calorimeter : branch CaloLevel2" << endl; |
5240 |
}; |
}; |
5241 |
|
if(NUC){ |
5242 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&calo_nuc_obj); |
5243 |
|
cout << "Calorimeter : branch TrackNuclei" << endl; |
5244 |
|
} |
5245 |
|
if(EXT){ |
5246 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&calo_ext_obj); |
5247 |
|
cout << "Calorimeter : branch RecoveredTrack" << endl; |
5248 |
|
if(NUC){ |
5249 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&calo_ext_nuc_obj); |
5250 |
|
cout << "Calorimeter : branch RecoveredTrackNuclei" << endl; |
5251 |
|
} |
5252 |
|
} |
5253 |
i++; |
i++; |
5254 |
} |
} |
5255 |
|
|
5258 |
pam_tree_clone[i] = new TTree("ToF", "PAMELA ToF level2 data "); |
pam_tree_clone[i] = new TTree("ToF", "PAMELA ToF level2 data "); |
5259 |
pam_tree_clone[i]->Branch("ToFLevel2", "ToFLevel2", GetPointerTo("ToFLevel2")); |
pam_tree_clone[i]->Branch("ToFLevel2", "ToFLevel2", GetPointerTo("ToFLevel2")); |
5260 |
cout << "ToF : branch ToFLevel2" << endl; |
cout << "ToF : branch ToFLevel2" << endl; |
5261 |
|
if(NUC){ |
5262 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&tof_nuc_obj); |
5263 |
|
cout << "ToF : branch TrackNuclei" << endl; |
5264 |
|
} |
5265 |
|
if(EXT){ |
5266 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&tof_ext_obj); |
5267 |
|
cout << "ToF : branch RecoveredTrack" << endl; |
5268 |
|
if(NUC){ |
5269 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&tof_ext_nuc_obj); |
5270 |
|
cout << "ToF : branch RecoveredTrackNuclei" << endl; |
5271 |
|
} |
5272 |
|
} |
5273 |
i++; |
i++; |
5274 |
}; |
}; |
5275 |
// Trigger |
// Trigger |
5305 |
pam_tree_clone[i] = new TTree("OrbitalInfo", "PAMELA orbital info "); |
pam_tree_clone[i] = new TTree("OrbitalInfo", "PAMELA orbital info "); |
5306 |
pam_tree_clone[i]->Branch("OrbitalInfo", "OrbitalInfo", GetPointerTo("OrbitalInfo")); |
pam_tree_clone[i]->Branch("OrbitalInfo", "OrbitalInfo", GetPointerTo("OrbitalInfo")); |
5307 |
cout << "OrbitalInfo : branch OrbitalInfo" << endl; |
cout << "OrbitalInfo : branch OrbitalInfo" << endl; |
5308 |
|
if(NUC){ |
5309 |
|
pam_tree_clone[i]->Branch("TrackNuclei","TClonesArray",&orb_nuc_obj); |
5310 |
|
cout << "OrbitalInfo : branch TrackNuclei" << endl; |
5311 |
|
} |
5312 |
|
if(EXT){ |
5313 |
|
pam_tree_clone[i]->Branch("RecoveredTrack","TClonesArray",&orb_ext_obj); |
5314 |
|
cout << "OrbitalInfo : branch RecoveredTrack" << endl; |
5315 |
|
if(NUC){ |
5316 |
|
pam_tree_clone[i]->Branch("RecoveredTrackNuclei","TClonesArray",&orb_ext_nuc_obj); |
5317 |
|
cout << "OrbitalInfo : branch RecoveredTrackNuclei" << endl; |
5318 |
|
} |
5319 |
|
} |
5320 |
i++; |
i++; |
5321 |
}; |
}; |
5322 |
// GPamela |
// GPamela |
5326 |
cout << "GPamela : branch GPamela" << endl; |
cout << "GPamela : branch GPamela" << endl; |
5327 |
i++; |
i++; |
5328 |
}; |
}; |
5329 |
|
|
5330 |
|
|
5331 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
5332 |
|
|
5333 |
} |
} |
5388 |
for (Int_t i = 0; i < NCLONES; i++) { |
for (Int_t i = 0; i < NCLONES; i++) { |
5389 |
if (pam_tree_clone[i]) { |
if (pam_tree_clone[i]) { |
5390 |
cout << pam_tree_clone[i]->GetName() << endl; |
cout << pam_tree_clone[i]->GetName() << endl; |
5391 |
pam_tree_clone[i]->Write(); |
pam_tree_clone[i]->Write(pam_tree_clone[i]->GetName(),TObject::kOverwrite); |
5392 |
}; |
}; |
5393 |
} |
} |
5394 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl; |
6012 |
void PamLevel2::SetSortingMethod(TString how) { |
void PamLevel2::SetSortingMethod(TString how) { |
6013 |
if (howtosort != how) { |
if (howtosort != how) { |
6014 |
issorted = false; |
issorted = false; |
6015 |
|
issorted_new = false; |
6016 |
} |
} |
6017 |
howtosort = how; |
howtosort = how; |
6018 |
} |
} |