11 |
calo_track = 0; |
calo_track = 0; |
12 |
tof_track = 0; |
tof_track = 0; |
13 |
candeleteobj = 0; |
candeleteobj = 0; |
14 |
|
pscore = 0; |
15 |
|
iscore = 0; |
16 |
}; |
}; |
17 |
//-------------------------------------- |
//-------------------------------------- |
18 |
// |
// |
62 |
calo_track = 0; |
calo_track = 0; |
63 |
tof_track = 0; |
tof_track = 0; |
64 |
} |
} |
65 |
|
pscore = 0; |
66 |
|
iscore = 0; |
67 |
|
|
68 |
} |
} |
69 |
void PamTrack::Delete(){ |
void PamTrack::Delete(){ |
70 |
// cout << "PamTrack::Delete() "<<candeleteobj<<endl; |
// cout << "PamTrack::Delete() "<<candeleteobj<<endl; |
636 |
void PamLevel2::SortTracks(){ |
void PamLevel2::SortTracks(){ |
637 |
TString how = howtosort; |
TString how = howtosort; |
638 |
|
|
639 |
// cout <<" PamLevel2::SortTracks(TString how) "<<endl; |
// cout <<" PamLevel2::SortTracks(TString how) "<<endl; |
640 |
if( !trk2_obj ){ |
if( !trk2_obj ){ |
641 |
cout << "void PamLevel2::SortTracks(): TrkLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): TrkLevel2 not loaded !!!"; |
642 |
return; |
return; |
666 |
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
667 |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
668 |
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
669 |
|
Bool_t use_S1 = how.Contains("S1", TString::kIgnoreCase); |
670 |
|
Bool_t use_S2 = how.Contains("S2", TString::kIgnoreCase); |
671 |
|
Bool_t use_S3 = how.Contains("S3", TString::kIgnoreCase); |
672 |
|
|
673 |
|
if ( use_TOF ){ |
674 |
|
use_S1 = true; |
675 |
|
use_S2 = true; |
676 |
|
use_S3 = true; |
677 |
|
}; |
678 |
if( !CAL2 && use_CAL) use_CAL = false; |
if( !CAL2 && use_CAL) use_CAL = false; |
679 |
if( !TOF && use_TOF) use_TOF = false; |
if( !TOF ){ |
680 |
|
use_TOF = false; |
681 |
|
use_S1 = false; |
682 |
|
use_S2 = false; |
683 |
|
use_S3 = false; |
684 |
|
} |
685 |
|
|
686 |
if( !TRK2 ){ |
if( !TRK2 ){ |
687 |
// cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
// cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
688 |
return; |
return; |
710 |
ToFTrkVar *oi = 0; |
ToFTrkVar *oi = 0; |
711 |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
712 |
// if track has an image, check image selection |
// if track has an image, check image selection |
713 |
|
|
714 |
|
Int_t tp_score = 0; //main track sorted by the tracker |
715 |
|
Int_t ti_score = 0; //image track |
716 |
|
Int_t totp_score = 0; //main track sorted by the tracker |
717 |
|
Int_t toti_score = 0; //image track |
718 |
|
|
719 |
if(tp->HasImage()){ |
if(tp->HasImage()){ |
720 |
|
|
721 |
ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) |
ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) |
725 |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
726 |
|
|
727 |
//assign starting scores |
//assign starting scores |
728 |
Int_t tp_score = 0; //main track sorted by the tracker |
tp_score = 0; //main track sorted by the tracker |
729 |
Int_t ti_score = 0; //image track |
ti_score = 0; //image track |
730 |
|
|
731 |
// ----------------------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------------------- |
732 |
// calorimeter check |
// calorimeter check |
737 |
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but CaloLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but CaloLevel2 not loaded !!!"; |
738 |
return; |
return; |
739 |
}; |
}; |
740 |
if( use_CAL && !cp && ci )ti_score++; |
if( use_CAL && !cp && ci ){ |
741 |
if( use_CAL && cp && !ci )tp_score++; |
ti_score++; |
742 |
|
toti_score++; |
743 |
|
}; |
744 |
|
if( use_CAL && cp && !ci ){ |
745 |
|
tp_score++; |
746 |
|
totp_score++; |
747 |
|
}; |
748 |
if( |
if( |
749 |
use_CAL && |
use_CAL && |
750 |
// calo2_obj->npcfit[1] > 5 && //no. of fit planes on Y view |
// calo2_obj->npcfit[1] > 5 && //no. of fit planes on Y view |
760 |
// else ti_score++; |
// else ti_score++; |
761 |
|
|
762 |
|
|
763 |
if( cp->npresh > ci->npresh) tp_score++; |
if( cp->npresh > ci->npresh){ |
764 |
if( cp->npresh < ci->npresh) ti_score++; |
tp_score++; |
765 |
else ;//niente |
totp_score++; |
766 |
|
}; |
767 |
|
if( cp->npresh < ci->npresh){ |
768 |
|
ti_score++; |
769 |
|
toti_score++; |
770 |
|
}; |
771 |
|
|
772 |
// cout << "CALO "<<tp_score<<ti_score<<endl; |
// cout << "CALO "<<tp_score<<ti_score<<endl; |
773 |
|
|
777 |
// ----------------------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------------------- |
778 |
// check the number of hit pmts along the track |
// check the number of hit pmts along the track |
779 |
// on S12 S21 and S32, where paddles are parallel to Y axis |
// on S12 S21 and S32, where paddles are parallel to Y axis |
780 |
if( use_TOF && !tof_obj ){ |
if( (use_TOF || use_S1 || use_S2 || use_S3 ) && !tof_obj ){ |
781 |
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but ToFLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but ToFLevel2 not loaded !!!"; |
782 |
return; |
return; |
783 |
}; |
}; |
784 |
if( use_TOF && !op && oi )ti_score++; |
// |
785 |
if( use_TOF && op && !oi )tp_score++; |
if( (use_TOF || use_S1 || use_S2 || use_S3 ) && !op && oi ){ |
786 |
if( use_TOF && op && oi ){ |
ti_score++; |
787 |
|
toti_score++; |
788 |
|
}; |
789 |
|
if( (use_TOF || use_S1 || use_S2 || use_S3 ) && op && !oi ){ |
790 |
|
tp_score++; |
791 |
|
totp_score++; |
792 |
|
}; |
793 |
|
if( (use_TOF || use_S1 || use_S2 || use_S3 ) && op && oi ){ |
794 |
// |
// |
795 |
Float_t sen = 0.; |
Float_t sen = 0.; |
796 |
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
802 |
if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (oi->dedx).At(ih); |
if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (oi->dedx).At(ih); |
803 |
}; |
}; |
804 |
// |
// |
805 |
if ( sen >= sortthr ){ |
if ( sen >= sortthr && false){ // temporary disabled NUCLEI special algorithm since the new one should work for every particle (to be checked!) |
806 |
//printf(" IS A NUCLEUS! en = %f \n",sen); |
//printf(" IS A NUCLEUS! en = %f \n",sen); |
807 |
// |
// |
808 |
// is a nucleus use a different algorithm |
// is a nucleus use a different algorithm |
895 |
|
|
896 |
|
|
897 |
if( |
if( |
898 |
use_TOF && |
(use_TOF || use_S1 || use_S2 || use_S3) && |
899 |
(nphit_p+nphit_i) !=0 && |
(nphit_p+nphit_i) !=0 && |
900 |
true){ |
true){ |
901 |
|
|
940 |
// --- modified to count tdc signals (more efficient?) |
// --- modified to count tdc signals (more efficient?) |
941 |
// --- and to implement check on tdcflag |
// --- and to implement check on tdcflag |
942 |
for (Int_t ih=0; ih < op->npmttdc; ih++){ |
for (Int_t ih=0; ih < op->npmttdc; ih++){ |
943 |
// Int_t pl = tof_obj->GetPlaneIndex( (op->pmttdc).At(ih) ); |
Int_t pl = tof_obj->GetPlaneIndex( (op->pmttdc).At(ih) ); |
944 |
// 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++; |
945 |
if( (op->tdcflag).At(ih)==0 )nphit_p++; |
if ( (use_S1 && ( pl == 0 || pl == 1 )) || (use_S2 && ( pl == 2 || pl == 3 )) || (use_S3 && ( pl == 4 || pl == 5 )) ){ |
946 |
|
if( (op->tdcflag).At(ih)==0 )nphit_p++; |
947 |
|
}; |
948 |
}; |
}; |
949 |
|
|
950 |
for (Int_t ih=0; ih < oi->npmttdc; ih++){ |
for (Int_t ih=0; ih < oi->npmttdc; ih++){ |
951 |
// Int_t pl = tof_obj->GetPlaneIndex( (oi->pmttdc).At(ih) ); |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmttdc).At(ih) ); |
952 |
// 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++; |
953 |
if( (oi->tdcflag).At(ih)==0 )nphit_i++; |
if ( (use_S1 && ( pl == 0 || pl == 1 )) || (use_S2 && ( pl == 2 || pl == 3 )) || (use_S3 && ( pl == 4 || pl == 5 )) ){ |
954 |
|
if( (oi->tdcflag).At(ih)==0 )nphit_i++; |
955 |
|
}; |
956 |
}; |
}; |
957 |
|
|
958 |
if( |
if( |
959 |
(nphit_p+nphit_i) !=0 && |
(nphit_p+nphit_i) !=0 && |
960 |
true){ |
true){ |
961 |
|
|
962 |
|
if ( nphit_p != nphit_i ){ |
963 |
|
totp_score += nphit_p; |
964 |
|
toti_score += nphit_i; |
965 |
|
}; |
966 |
if ( nphit_p > nphit_i) tp_score++; |
if ( nphit_p > nphit_i) tp_score++; |
967 |
else if( nphit_p < nphit_i) ti_score++; |
else if( nphit_p < nphit_i) ti_score++; |
968 |
else ;//niente |
else ;//niente |
987 |
// else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
// else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
988 |
|
|
989 |
// CHECK 1 : number of points along X |
// CHECK 1 : number of points along X |
990 |
if ( tp->GetNX() >= ti->GetNX() )tp_score++ ; |
if ( tp->GetNX() >= ti->GetNX() ){ |
991 |
if ( tp->GetNX() <= ti->GetNX() )ti_score++ ; |
tp_score++ ; |
992 |
|
totp_score++ ; |
993 |
|
}; |
994 |
|
if ( tp->GetNX() <= ti->GetNX() ){ |
995 |
|
ti_score++ ; |
996 |
|
toti_score++ ; |
997 |
|
}; |
998 |
// CHECK 2 : number of points along Y |
// CHECK 2 : number of points along Y |
999 |
if ( tp->GetNY() >= ti->GetNY() )tp_score++ ; |
if ( tp->GetNY() >= ti->GetNY() ){ |
1000 |
if ( tp->GetNY() <= ti->GetNY() )ti_score++ ; |
tp_score++ ; |
1001 |
|
totp_score++ ; |
1002 |
|
}; |
1003 |
|
if ( tp->GetNY() <= ti->GetNY() ){ |
1004 |
|
ti_score++ ; |
1005 |
|
toti_score++ ; |
1006 |
|
}; |
1007 |
// CHECK 3 : chi**2 along X |
// CHECK 3 : chi**2 along X |
1008 |
// if( tp->GetChi2X() > 0 && (tp->GetChi2X() < ti->GetChi2X() || ti->GetChi2X() <=0) ) tp_score++ ; |
// if( tp->GetChi2X() > 0 && (tp->GetChi2X() < ti->GetChi2X() || ti->GetChi2X() <=0) ) tp_score++ ; |
1009 |
// if( ti->GetChi2X() > 0 && (ti->GetChi2X() < tp->GetChi2X() || tp->GetChi2X() <=0) ) ti_score++ ; |
// if( ti->GetChi2X() > 0 && (ti->GetChi2X() < tp->GetChi2X() || tp->GetChi2X() <=0) ) ti_score++ ; |
1048 |
}; |
}; |
1049 |
|
|
1050 |
}else{ |
}else{ |
1051 |
|
totp_score = 1; |
1052 |
|
toti_score = 0; |
1053 |
|
|
1054 |
// ts = tp; |
// ts = tp; |
1055 |
// cs = cp; |
// cs = cp; |
1056 |
// os = op; |
// os = op; |
1064 |
// cout<<"o "<<tp<<endl; |
// cout<<"o "<<tp<<endl; |
1065 |
// cout<<"o "<<cp<<endl; |
// cout<<"o "<<cp<<endl; |
1066 |
// cout<<"o "<<op<<endl; |
// cout<<"o "<<op<<endl; |
1067 |
|
|
1068 |
new(ttsorted[i]) PamTrack(tp,cp,op); |
new(ttsorted[i]) PamTrack(tp,cp,op); |
1069 |
new(ttimage[i]) PamTrack(ti,ci,oi); |
new(ttimage[i]) PamTrack(ti,ci,oi); |
1070 |
|
|
1071 |
|
((PamTrack*)(ttsorted[i]))->SetPScore(totp_score); |
1072 |
|
((PamTrack*)(ttimage[i]))->SetIScore(toti_score); |
1073 |
}; |
}; |
1074 |
|
|
1075 |
if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){ |
if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){ |