304 |
|
|
305 |
if(h0_obj) h0_obj->Clear(); |
if(h0_obj) h0_obj->Clear(); |
306 |
// if(trk0_obj) trk0_obj->Clear(); |
// if(trk0_obj) trk0_obj->Clear(); |
|
if(calo0_obj) calo0_obj->Clear(); |
|
307 |
if(trk1_obj) trk1_obj->Clear(); |
if(trk1_obj) trk1_obj->Clear(); |
308 |
if(trk2_obj) trk2_obj->Clear(); |
if(trk2_obj) trk2_obj->Clear(); |
309 |
if(trkh_obj) trkh_obj->Clear(); |
if(trkh_obj) trkh_obj->Clear(); |
310 |
|
if(calo0_obj) calo0_obj->Clear(); |
311 |
if(calo1_obj)calo1_obj->Clear(); |
if(calo1_obj)calo1_obj->Clear(); |
312 |
if(calo2_obj)calo2_obj->Clear(); |
if(calo2_obj)calo2_obj->Clear(); |
313 |
if(tof_obj) tof_obj->Clear(); |
if(tof_obj) tof_obj->Clear(); |
658 |
TClonesArray &ttimage = *timage; |
TClonesArray &ttimage = *timage; |
659 |
|
|
660 |
|
|
661 |
// loop over the tracks sorted by the tracker |
|
662 |
|
//-------------------------------------------------- |
663 |
|
// retrieve sorting method |
664 |
|
//-------------------------------------------------- |
665 |
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
666 |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
667 |
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
675 |
}; |
}; |
676 |
|
|
677 |
// cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl; |
// cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl; |
678 |
|
|
679 |
|
|
680 |
|
//-------------------------------------------------- |
681 |
|
// loop over "physical" tracks sorted by the tracker |
682 |
|
//-------------------------------------------------- |
683 |
for(Int_t i=0; i < trk2_obj->TrkLevel2::GetNTracks(); i++){ |
for(Int_t i=0; i < trk2_obj->TrkLevel2::GetNTracks(); i++){ |
684 |
|
|
685 |
TrkTrack *ts = 0; |
TrkTrack *ts = 0; |
687 |
ToFTrkVar *os = 0; |
ToFTrkVar *os = 0; |
688 |
|
|
689 |
// get tracker tracks |
// get tracker tracks |
690 |
TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker |
TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker |
691 |
CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); |
CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); |
692 |
ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); |
ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); |
693 |
|
|
694 |
TrkTrack *ti = 0; //tracker (image) |
TrkTrack *ti = 0; //tracker (image) |
695 |
CaloTrkVar *ci = 0; |
CaloTrkVar *ci = 0; |
696 |
ToFTrkVar *oi = 0; |
ToFTrkVar *oi = 0; |
697 |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
708 |
Int_t tp_score = 0; //main track sorted by the tracker |
Int_t tp_score = 0; //main track sorted by the tracker |
709 |
Int_t ti_score = 0; //image track |
Int_t ti_score = 0; //image track |
710 |
|
|
711 |
// ------------------------ |
// ----------------------------------------------------------------------------------------- |
712 |
// calorimeter check |
// calorimeter check |
713 |
// ------------------------ |
// ----------------------------------------------------------------------------------------- |
714 |
// check the Y spatial residual on the first calorimeter plane |
// check the Y spatial residual on the first calorimeter plane |
715 |
// (cut on calorimeter variables from Emiliano) |
// (cut on calorimeter variables from Emiliano) |
716 |
if( use_CAL && !calo2_obj ){ |
if( use_CAL && !calo2_obj ){ |
719 |
}; |
}; |
720 |
if( |
if( |
721 |
use_CAL && |
use_CAL && |
722 |
calo2_obj->npcfit[1] > 5 && //no. of fit planes on Y view |
// calo2_obj->npcfit[1] > 5 && //no. of fit planes on Y view |
723 |
calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
// calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
724 |
cp && ci && |
cp && ci && |
725 |
true){ |
true){ |
726 |
|
|
727 |
|
|
728 |
Float_t resy_p = cp->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_p < 0)resy_p= - resy_p; |
// Float_t resy_p = cp->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_p < 0)resy_p= - resy_p; |
729 |
Float_t resy_i = ci->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_i < 0)resy_i= - resy_i; |
// Float_t resy_i = ci->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_i < 0)resy_i= - resy_i; |
730 |
|
|
731 |
if(resy_p <= resy_i) tp_score++; |
// if(resy_p <= resy_i) tp_score++; |
732 |
else ti_score++; |
// else ti_score++; |
733 |
|
|
734 |
|
|
735 |
|
if( cp->npresh > ci->npresh) tp_score++; |
736 |
|
if( cp->npresh < ci->npresh) ti_score++; |
737 |
|
else ;//niente |
738 |
|
|
739 |
// cout << "CALO "<<tp_score<<ti_score<<endl; |
// cout << "CALO "<<tp_score<<ti_score<<endl; |
740 |
|
|
741 |
}; |
}; |
742 |
// ------------------------ |
// ----------------------------------------------------------------------------------------- |
743 |
// TOF check |
// TOF check |
744 |
// ------------------------ |
// ----------------------------------------------------------------------------------------- |
745 |
// check the number of hit pmts along the track |
// check the number of hit pmts along the track |
746 |
// on S12 S21 and S32, where paddles are parallel to Y axis |
// on S12 S21 and S32, where paddles are parallel to Y axis |
747 |
if( use_TOF && !tof_obj ){ |
if( use_TOF && !tof_obj ){ |
887 |
cout << "image: npmtadc "<< oi->npmtadc << endl; |
cout << "image: npmtadc "<< oi->npmtadc << endl; |
888 |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
889 |
|
|
890 |
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
891 |
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
// Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
892 |
if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
893 |
|
// }; |
894 |
|
|
895 |
|
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
896 |
|
// Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
897 |
|
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
898 |
|
// }; |
899 |
|
// --- modified to count tdc signals (more efficient?) |
900 |
|
// --- and to implement check on tdcflag |
901 |
|
for (Int_t ih=0; ih < op->npmttdc; ih++){ |
902 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmttdc).At(ih) ); |
903 |
|
// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; |
904 |
|
if( (op->tdcflag).At(ih)==0 )nphit_p++; |
905 |
}; |
}; |
906 |
|
|
907 |
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
for (Int_t ih=0; ih < oi->npmttdc; ih++){ |
908 |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmttdc).At(ih) ); |
909 |
if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; |
910 |
|
if( (oi->tdcflag).At(ih)==0 )nphit_i++; |
911 |
}; |
}; |
912 |
|
|
913 |
if( |
if( |
|
use_TOF && |
|
914 |
(nphit_p+nphit_i) !=0 && |
(nphit_p+nphit_i) !=0 && |
915 |
true){ |
true){ |
916 |
|
|
917 |
if( nphit_p >= nphit_i) tp_score++; |
if ( nphit_p > nphit_i) tp_score++; |
918 |
else ti_score++; |
else if( nphit_p < nphit_i) ti_score++; |
919 |
|
else ;//niente |
920 |
}; |
}; |
921 |
}; |
}; |
922 |
// cout << "TOF "<<tp_score<<ti_score<<endl; |
// cout << "TOF "<<tp_score<<ti_score<<endl; |
923 |
}; |
}; |
924 |
if(tp_score == ti_score) use_TRK = true; |
|
925 |
// ------------------------ |
|
926 |
|
// if(tp_score == ti_score) use_TRK = true; |
927 |
|
|
928 |
|
|
929 |
|
// ----------------------------------------------------------------------------------------- |
930 |
// tracker check |
// tracker check |
931 |
// ------------------------ |
// ----------------------------------------------------------------------------------------- |
932 |
// chi**2 difference is not always large enough to distinguish among |
// chi**2 difference is not always large enough to distinguish among |
933 |
// the real track and its image. |
// the real track and its image. |
934 |
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
935 |
|
// *** MODIFIED ON AUGUST 2007 *** |
936 |
if(use_TRK){ |
if(use_TRK){ |
937 |
if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
// if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
938 |
else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
// else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
939 |
|
|
940 |
|
// CHECK 1 : number of points along X |
941 |
|
if ( tp->GetNX() >= ti->GetNX() )tp_score++ ; |
942 |
|
if ( tp->GetNX() <= ti->GetNX() )ti_score++ ; |
943 |
|
// CHECK 2 : number of points along Y |
944 |
|
if ( tp->GetNY() >= ti->GetNY() )tp_score++ ; |
945 |
|
if ( tp->GetNY() <= ti->GetNY() )ti_score++ ; |
946 |
|
// CHECK 3 : chi**2 along X |
947 |
|
// if( tp->GetChi2X() > 0 && (tp->GetChi2X() < ti->GetChi2X() || ti->GetChi2X() <=0) ) tp_score++ ; |
948 |
|
// if( ti->GetChi2X() > 0 && (ti->GetChi2X() < tp->GetChi2X() || tp->GetChi2X() <=0) ) ti_score++ ; |
949 |
|
// CHECK 4 : chi**2 along Y |
950 |
|
// if( tp->GetChi2Y() > 0 && (tp->GetChi2Y() < ti->GetChi2Y() || ti->GetChi2Y() <=0) ) tp_score++ ; |
951 |
|
// if( ti->GetChi2Y() > 0 && (ti->GetChi2Y() < tp->GetChi2Y() || tp->GetChi2Y() <=0) ) ti_score++ ; |
952 |
|
// CHECK 5 : total chi**2 |
953 |
|
// if( tp->chi2 > 0 && (tp->chi2 < ti->chi2 || ti->chi2 <=0) ) tp_score++ ; |
954 |
|
// if( ti->chi2 > 0 && (ti->chi2 < tp->chi2 || tp->chi2 <=0) ) ti_score++ ; |
955 |
|
|
956 |
// cout << "TRK "<<tp_score<<ti_score<<endl; |
// cout << "TRK "<<tp_score<<ti_score<<endl; |
957 |
}; |
}; |
958 |
|
|
959 |
// ------------------------ |
|
960 |
|
|
961 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
962 |
// the winner is.... |
// the winner is.... |
963 |
// ------------------------ |
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
964 |
if (tp_score > ti_score) { |
if (tp_score > ti_score) { |
965 |
// ts = tp;//the track sorted by the tracker!! |
|
|
// cs = cp; |
|
|
// os = op; |
|
|
// cout << "It's primary!" << endl; |
|
966 |
|
|
967 |
}else if (tp_score < ti_score) { |
}else if (tp_score < ti_score) { |
968 |
|
|
|
// cout << "It's image!" << endl; |
|
969 |
|
|
970 |
ts = ti;//its image!! |
ts = ti;//its image!! |
971 |
cs = ci; |
cs = ci; |
981 |
|
|
982 |
|
|
983 |
}else { |
}else { |
984 |
// ts = tp; |
|
985 |
// cs = cp; |
// cout << "Warning - track image ambiguity not solved" << endl; |
986 |
// os = op; |
|
|
cout << "Warning - track image ambiguity not solved" << endl; |
|
|
// cout << ts->GetNtot() << " "<< ts->chi2 << " " << npcfit[1] << " "<< nphit_p << endl; |
|
987 |
}; |
}; |
988 |
|
|
989 |
}else{ |
}else{ |
2042 |
// ----------------------------------------------------------------------- |
// ----------------------------------------------------------------------- |
2043 |
if ( irun < 0 ){ |
if ( irun < 0 ){ |
2044 |
irun = 0LL; |
irun = 0LL; |
2045 |
|
irunentry = 0; |
2046 |
|
prevshift = 0; |
2047 |
run_tree->GetEntry(irun); |
run_tree->GetEntry(irun); |
2048 |
}; |
}; |
2049 |
// |
// |
2050 |
bool fromfirst = true; // first loop over runs |
bool fromfirst = true; // first loop over runs |
2051 |
|
|
2052 |
|
// Bool_t hasfrag = false; |
2053 |
|
// if( GetRunInfo()->ID_RUN_FRAG!=0 && GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID)hasfrag=true; |
2054 |
|
// ULong64_t fragid = GetRunInfo()->ID_RUN_FRAG; |
2055 |
|
|
2056 |
// ------------------------------------------------------ |
// ------------------------------------------------------ |
2057 |
// loop over runs to find the one that contains the event |
// loop over runs to find the one that contains the event |
2058 |
// ------------------------------------------------------ |
// ------------------------------------------------------ |
2059 |
while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
while ( |
2060 |
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && |
( |
2061 |
!(GetOrbitalInfo()->OBT >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
( |
2062 |
GetOrbitalInfo()->OBT <= GetRunInfo()->RUNTRAILER_OBT) && |
!(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
2063 |
irun < run_tree->GetEntries() ){ |
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && |
2064 |
|
!(GetOrbitalInfo()->OBT >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
2065 |
|
GetOrbitalInfo()->OBT <= GetRunInfo()->RUNTRAILER_OBT) |
2066 |
|
) |
2067 |
|
|| GetRunInfo()->NEVENTS==0 |
2068 |
|
|| !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) |
2069 |
|
) |
2070 |
|
&& irun < run_tree->GetEntries() ){ |
2071 |
|
|
2072 |
irun++; |
irun++; |
2073 |
// ------------------------------------ |
// ------------------------------------ |
2074 |
// if the end of run tree is reached... |
// if the end of run tree is reached... |
2094 |
// save the index of the first entry of the run, relative to pam_tree, |
// save the index of the first entry of the run, relative to pam_tree, |
2095 |
// and read a new run |
// and read a new run |
2096 |
// ------------------------------------------------------------------- |
// ------------------------------------------------------------------- |
2097 |
if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS); |
if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift; |
2098 |
|
irunentry = 0; |
2099 |
|
prevshift = 0; |
2100 |
run_tree->GetEntry(irun); |
run_tree->GetEntry(irun); |
2101 |
if(GetRunInfo()->RUNHEADER_OBT>=GetRunInfo()->RUNTRAILER_OBT ){ |
if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){ |
2102 |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<<irun<<" has RUNHEADER_OBT>=RUNTRAILER_OBT " <<endl; |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<<irun<<" has RUNHEADER_OBT>=RUNTRAILER_OBT " <<endl; |
2103 |
cout << " (NB!! in this case some events are assigned to a wrong run)"<<endl; |
cout << " (NB!! in this case some events are assigned to a wrong run)"<<endl; |
2104 |
} |
} |
2105 |
|
// if(hasfrag && fragid != GetRunInfo()->ID){ |
2106 |
|
// cout << "... where is the next fragment ??"<<endl; |
2107 |
|
// } |
2108 |
}; |
}; |
2109 |
|
|
2110 |
|
|
2111 |
// -------------------------------------- |
// -------------------------------------- |
2112 |
// if there was no need to update the run |
// if there was no need to update the run |
2113 |
// ---> exit with FALSE |
// ---> exit with FALSE |
2119 |
// ---> exit with TRUE |
// ---> exit with TRUE |
2120 |
// -------------------------------------- |
// -------------------------------------- |
2121 |
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
2122 |
prevshift = 0; |
// ---------------------------------------------------- |
2123 |
|
// then check if the run has a fragment |
2124 |
|
// in this case we have to switch to the next fragment |
2125 |
|
// when the end of the first fragment is reached |
2126 |
|
// ---------------------------------------------------- |
2127 |
|
if( |
2128 |
|
GetRunInfo()->ID_RUN_FRAG != 0 && |
2129 |
|
// GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID && |
2130 |
|
true ){ |
2131 |
|
cout << "* fragment *"<<endl; |
2132 |
|
} |
2133 |
|
|
2134 |
return(true); |
return(true); |
2135 |
}; |
}; |
2136 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
2779 |
*/ |
*/ |
2780 |
void PamLevel2::CreateCloneTrees(TFile *ofile){ |
void PamLevel2::CreateCloneTrees(TFile *ofile){ |
2781 |
|
|
2782 |
|
|
2783 |
|
// if the pointer is null, create a default file |
2784 |
|
|
2785 |
|
if(!ofile){ |
2786 |
|
cout << "void PamLevel2::CreateCloneTrees(TFile*) -- WARNING -- Creating file: clone-tree.root "<<endl; |
2787 |
|
ofile = new TFile("clone-tree.root","recreate"); |
2788 |
|
} |
2789 |
|
|
2790 |
ofile->cd(); |
ofile->cd(); |
2791 |
|
|
2792 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
2956 |
//Int_t PamLevel2::GetEntry(Int_t iee){ |
//Int_t PamLevel2::GetEntry(Int_t iee){ |
2957 |
Int_t PamLevel2::GetEntry(Long64_t iee){ |
Int_t PamLevel2::GetEntry(Long64_t iee){ |
2958 |
|
|
2959 |
|
// cout << "-------------------------------------"<<endl; |
2960 |
|
// cout << "Int_t PamLevel2::GetEntry("<<iee<<")"<<endl; |
2961 |
|
|
2962 |
if(!pam_tree){ |
if(!pam_tree){ |
2963 |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl; |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl; |
2964 |
return 0; |
return 0; |
3004 |
|
|
3005 |
// cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl; |
// cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl; |
3006 |
|
|
3007 |
// cout << " irunentry "<<irunentry << endl; |
// cout << "irunentry "<<irunentry << endl; |
3008 |
|
// cout << "runfirstentry "<<runfirstentry << endl; |
3009 |
|
// cout << "nevents "<<GetRunInfo()->NEVENTS<< endl; |
3010 |
|
|
3011 |
|
// if( TRK0 || CAL0 || TOF0 ){ |
3012 |
|
// if( !GetYodaEntry( ) ){ |
3013 |
|
// cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading level0 tree"<<endl; |
3014 |
|
// return 0; |
3015 |
|
// } |
3016 |
|
// } |
3017 |
|
|
3018 |
|
|
|
if( TRK0 || CAL0 || TOF0 ){ |
|
|
if( !GetYodaEntry( ) ){ |
|
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading level0 tree"<<endl; |
|
|
return 0; |
|
|
} |
|
|
} |
|
3019 |
return 1; |
return 1; |
3020 |
|
|
3021 |
} |
} |
3022 |
|
|
3023 |
|
TrkLevel0 *PamLevel2::GetTrkLevel0(){ |
3024 |
|
if( !TRK0 )return NULL; |
3025 |
|
if( !GetYodaEntry( ) ){ |
3026 |
|
cout << " Int_t PamLevel2::GetTrkLevel0() -- ERROR -- error reading level0 tree"<<endl; |
3027 |
|
return 0; |
3028 |
|
} |
3029 |
|
return trk0_obj; |
3030 |
|
}; |
3031 |
|
CaloLevel0 *PamLevel2::GetCaloLevel0(){ |
3032 |
|
if( !CAL0 )return NULL; |
3033 |
|
if( !GetYodaEntry( ) ){ |
3034 |
|
cout << " Int_t PamLevel2::GetCaloLevel0() -- ERROR -- error reading level0 tree"<<endl; |
3035 |
|
return 0; |
3036 |
|
} |
3037 |
|
return calo0_obj; |
3038 |
|
}; |
3039 |
|
|
3040 |
|
|
3041 |
/** |
/** |
3042 |
* Method to retrieve the level0 tree (YODA tree) that contains the current event. |
* Method to retrieve the level0 tree (YODA tree) that contains the current event. |
3043 |
* Given the run ID (...), if needed it query the DB and load the proper file. |
* Given the run ID (...), if needed it query the DB and load the proper file. |
3057 |
return NULL; |
return NULL; |
3058 |
} |
} |
3059 |
Int_t irootnew = run_obj->ID_ROOT_L0; |
Int_t irootnew = run_obj->ID_ROOT_L0; |
3060 |
// cout << "iroot "<<iroot<<endl; |
// cout << "iroot "<<iroot<<endl; |
3061 |
// cout << "irootnew "<<irootnew<<endl; |
// cout << "irootnew "<<irootnew<<endl; |
3062 |
|
|
3063 |
//=================================== |
//=================================== |
3064 |
// load the level0 file |
// load the level0 file |
3115 |
}; |
}; |
3116 |
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
3117 |
} |
} |
3118 |
//--------------------------------------------------- |
//-------------------------------------------------- |
3119 |
// CALORIMETER: |
// CALORIMETER: |
3120 |
if(CAL0){ |
if(CAL0){ |
3121 |
if(!calo0_obj){ |
if(!calo0_obj){ |
3204 |
Int_t answer = 0; |
Int_t answer = 0; |
3205 |
Int_t shift =0; |
Int_t shift =0; |
3206 |
// printf(" siamo qui %i %i \n",shift,prevshift); |
// printf(" siamo qui %i %i \n",shift,prevshift); |
3207 |
Int_t maxshift = 100; |
Int_t maxshift = 10; |
3208 |
do{ |
do{ |
3209 |
if(shift>0){ |
if(shift>0){ |
3210 |
cout << " PKTNUM L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
cout << " PKTNUM L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
3233 |
|
|
3234 |
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() && shift < maxshift); |
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() && shift < maxshift); |
3235 |
|
|
3236 |
if ( (quellagiusta+(Long64_t)shift) == GetYodaTree()->GetEntries() || shift == maxshift ) { |
if ( (quellagiusta+(Long64_t)shift+(Long64_t)prevshift) > GetYodaTree()->GetEntries() || shift == maxshift ) { |
3237 |
cout << " Big trouble here, no such event in Level0 data! " <<endl; |
cout << " Big trouble here, no such event in Level0 data! " <<endl; |
3238 |
return 0; |
return 0; |
3239 |
} |
} |
3244 |
return answer; |
return answer; |
3245 |
|
|
3246 |
} |
} |
3247 |
|
/** |
3248 |
|
* \Brief Set DB connection |
3249 |
|
*/ |
3250 |
|
Bool_t PamLevel2::SetDBConnection(){ |
3251 |
|
|
3252 |
|
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
3253 |
|
cout<<"Connecting to DB"<<endl; |
3254 |
|
cout<<"HOST "<<host<<endl; |
3255 |
|
cout<<"USER "<<user<<endl; |
3256 |
|
cout<<"PSW "<<psw<<endl; |
3257 |
|
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
3258 |
|
if( !dbc )return false; |
3259 |
|
if( !dbc->IsConnected() )return false; |
3260 |
|
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
3261 |
|
return true; |
3262 |
|
|
3263 |
|
} |