939 |
// ts = tp; |
// ts = tp; |
940 |
// cs = cp; |
// cs = cp; |
941 |
// os = op; |
// os = op; |
942 |
cout << "Warning - track image ambiguity not solved" << endl; |
// cout << "Warning - track image ambiguity not solved" << endl; |
943 |
// cout << ts->GetNtot() << " "<< ts->chi2 << " " << npcfit[1] << " "<< nphit_p << endl; |
// cout << ts->GetNtot() << " "<< ts->chi2 << " " << npcfit[1] << " "<< nphit_p << endl; |
944 |
}; |
}; |
945 |
|
|
1999 |
// ----------------------------------------------------------------------- |
// ----------------------------------------------------------------------- |
2000 |
if ( irun < 0 ){ |
if ( irun < 0 ){ |
2001 |
irun = 0LL; |
irun = 0LL; |
2002 |
|
irunentry = 0; |
2003 |
|
prevshift = 0; |
2004 |
run_tree->GetEntry(irun); |
run_tree->GetEntry(irun); |
2005 |
}; |
}; |
2006 |
// |
// |
2007 |
bool fromfirst = true; // first loop over runs |
bool fromfirst = true; // first loop over runs |
2008 |
|
|
2009 |
|
// Bool_t hasfrag = false; |
2010 |
|
// if( GetRunInfo()->ID_RUN_FRAG!=0 && GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID)hasfrag=true; |
2011 |
|
// ULong64_t fragid = GetRunInfo()->ID_RUN_FRAG; |
2012 |
|
|
2013 |
// ------------------------------------------------------ |
// ------------------------------------------------------ |
2014 |
// loop over runs to find the one that contains the event |
// loop over runs to find the one that contains the event |
2015 |
// ------------------------------------------------------ |
// ------------------------------------------------------ |
2016 |
while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
while ( |
2017 |
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && |
( |
2018 |
!(GetOrbitalInfo()->OBT >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
( |
2019 |
GetOrbitalInfo()->OBT <= GetRunInfo()->RUNTRAILER_OBT) && |
!(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
2020 |
irun < run_tree->GetEntries() ){ |
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && |
2021 |
|
!(GetOrbitalInfo()->OBT >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
2022 |
|
GetOrbitalInfo()->OBT <= GetRunInfo()->RUNTRAILER_OBT) |
2023 |
|
) |
2024 |
|
|| GetRunInfo()->NEVENTS==0 |
2025 |
|
|| !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) |
2026 |
|
) |
2027 |
|
&& irun < run_tree->GetEntries() ){ |
2028 |
|
|
2029 |
irun++; |
irun++; |
2030 |
// ------------------------------------ |
// ------------------------------------ |
2031 |
// if the end of run tree is reached... |
// if the end of run tree is reached... |
2051 |
// 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, |
2052 |
// and read a new run |
// and read a new run |
2053 |
// ------------------------------------------------------------------- |
// ------------------------------------------------------------------- |
2054 |
if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS); |
if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift; |
2055 |
|
irunentry = 0; |
2056 |
|
prevshift = 0; |
2057 |
run_tree->GetEntry(irun); |
run_tree->GetEntry(irun); |
2058 |
if(GetRunInfo()->RUNHEADER_OBT>=GetRunInfo()->RUNTRAILER_OBT ){ |
if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){ |
2059 |
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; |
2060 |
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; |
2061 |
} |
} |
2062 |
|
// if(hasfrag && fragid != GetRunInfo()->ID){ |
2063 |
|
// cout << "... where is the next fragment ??"<<endl; |
2064 |
|
// } |
2065 |
}; |
}; |
2066 |
|
|
2067 |
|
|
2068 |
// -------------------------------------- |
// -------------------------------------- |
2069 |
// if there was no need to update the run |
// if there was no need to update the run |
2070 |
// ---> exit with FALSE |
// ---> exit with FALSE |
2076 |
// ---> exit with TRUE |
// ---> exit with TRUE |
2077 |
// -------------------------------------- |
// -------------------------------------- |
2078 |
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; |
2079 |
prevshift = 0; |
// ---------------------------------------------------- |
2080 |
|
// then check if the run has a fragment |
2081 |
|
// in this case we have to switch to the next fragment |
2082 |
|
// when the end of the first fragment is reached |
2083 |
|
// ---------------------------------------------------- |
2084 |
|
if( |
2085 |
|
GetRunInfo()->ID_RUN_FRAG != 0 && |
2086 |
|
// GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID && |
2087 |
|
true ){ |
2088 |
|
cout << "* fragment *"<<endl; |
2089 |
|
} |
2090 |
|
|
2091 |
return(true); |
return(true); |
2092 |
}; |
}; |
2093 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
2736 |
*/ |
*/ |
2737 |
void PamLevel2::CreateCloneTrees(TFile *ofile){ |
void PamLevel2::CreateCloneTrees(TFile *ofile){ |
2738 |
|
|
2739 |
|
|
2740 |
|
// if the pointer is null, create a default file |
2741 |
|
|
2742 |
|
if(!ofile){ |
2743 |
|
cout << "void PamLevel2::CreateCloneTrees(TFile*) -- WARNING -- Creating file: clone-tree.root "<<endl; |
2744 |
|
ofile = new TFile("clone-tree.root","recreate"); |
2745 |
|
} |
2746 |
|
|
2747 |
ofile->cd(); |
ofile->cd(); |
2748 |
|
|
2749 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
2913 |
//Int_t PamLevel2::GetEntry(Int_t iee){ |
//Int_t PamLevel2::GetEntry(Int_t iee){ |
2914 |
Int_t PamLevel2::GetEntry(Long64_t iee){ |
Int_t PamLevel2::GetEntry(Long64_t iee){ |
2915 |
|
|
2916 |
|
// cout << "-------------------------------------"<<endl; |
2917 |
|
// cout << "Int_t PamLevel2::GetEntry("<<iee<<")"<<endl; |
2918 |
|
|
2919 |
if(!pam_tree){ |
if(!pam_tree){ |
2920 |
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; |
2921 |
return 0; |
return 0; |
2961 |
|
|
2962 |
// cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl; |
// cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl; |
2963 |
|
|
2964 |
// cout << " irunentry "<<irunentry << endl; |
// cout << "irunentry "<<irunentry << endl; |
2965 |
|
// cout << "runfirstentry "<<runfirstentry << endl; |
2966 |
|
// cout << "nevents "<<GetRunInfo()->NEVENTS<< endl; |
2967 |
if( TRK0 || CAL0 || TOF0 ){ |
if( TRK0 || CAL0 || TOF0 ){ |
2968 |
if( !GetYodaEntry( ) ){ |
if( !GetYodaEntry( ) ){ |
2969 |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading level0 tree"<<endl; |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading level0 tree"<<endl; |
2993 |
return NULL; |
return NULL; |
2994 |
} |
} |
2995 |
Int_t irootnew = run_obj->ID_ROOT_L0; |
Int_t irootnew = run_obj->ID_ROOT_L0; |
2996 |
// cout << "iroot "<<iroot<<endl; |
// cout << "iroot "<<iroot<<endl; |
2997 |
// cout << "irootnew "<<irootnew<<endl; |
// cout << "irootnew "<<irootnew<<endl; |
2998 |
|
|
2999 |
//=================================== |
//=================================== |
3000 |
// load the level0 file |
// load the level0 file |
3140 |
Int_t answer = 0; |
Int_t answer = 0; |
3141 |
Int_t shift =0; |
Int_t shift =0; |
3142 |
// printf(" siamo qui %i %i \n",shift,prevshift); |
// printf(" siamo qui %i %i \n",shift,prevshift); |
3143 |
Int_t maxshift = 100; |
Int_t maxshift = 10; |
3144 |
do{ |
do{ |
3145 |
if(shift>0){ |
if(shift>0){ |
3146 |
cout << " PKTNUM L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
cout << " PKTNUM L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
3169 |
|
|
3170 |
}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); |
3171 |
|
|
3172 |
if ( (quellagiusta+(Long64_t)shift) == GetYodaTree()->GetEntries() || shift == maxshift ) { |
if ( (quellagiusta+(Long64_t)shift+(Long64_t)prevshift) > GetYodaTree()->GetEntries() || shift == maxshift ) { |
3173 |
cout << " Big trouble here, no such event in Level0 data! " <<endl; |
cout << " Big trouble here, no such event in Level0 data! " <<endl; |
3174 |
return 0; |
return 0; |
3175 |
} |
} |