85 |
// |
// |
86 |
//-------------------------------------- |
//-------------------------------------- |
87 |
/** |
/** |
88 |
* Constructor |
* Default Constructor |
89 |
*/ |
*/ |
90 |
PamLevel2::PamLevel2(){ |
PamLevel2::PamLevel2(){ |
91 |
|
Initialize(); |
92 |
|
}; |
93 |
|
|
94 |
|
/** |
95 |
|
* Constructor with given dir, list and detectors |
96 |
|
*/ |
97 |
|
PamLevel2::PamLevel2(TString ddir,TString list,TString detlist){ |
98 |
|
Initialize(); |
99 |
|
GetPamTree(GetListOfLevel2Files(ddir,list),detlist); |
100 |
|
GetRunTree(GetListOfLevel2Files(ddir,list)); |
101 |
|
}; |
102 |
|
|
103 |
|
/** |
104 |
|
* Constructor with given dir and list |
105 |
|
*/ |
106 |
|
PamLevel2::PamLevel2(TString ddir,TString list){ |
107 |
|
Initialize(); |
108 |
|
GetPamTree(GetListOfLevel2Files(ddir,list),""); |
109 |
|
GetRunTree(GetListOfLevel2Files(ddir,list)); |
110 |
|
}; |
111 |
|
|
112 |
|
|
113 |
|
void PamLevel2::Initialize(){ |
114 |
|
|
115 |
// trk2_obj = TrkLevel2::GetTrkLevel2(); |
// trk2_obj = TrkLevel2::GetTrkLevel2(); |
116 |
// trk1_obj = TrkLevel1::GetTrkLevel1(); |
// trk1_obj = TrkLevel1::GetTrkLevel1(); |
123 |
// nd_obj = NDLevel2::GetNDLevel2(); |
// nd_obj = NDLevel2::GetNDLevel2(); |
124 |
// ac_obj = AcLevel2::GetAcLevel2(); |
// ac_obj = AcLevel2::GetAcLevel2(); |
125 |
// orb_obj = OrbitalInfo::GetOrbitalInfo(); |
// orb_obj = OrbitalInfo::GetOrbitalInfo(); |
126 |
|
|
127 |
|
h0_obj = 0; |
128 |
|
trk0_obj = 0; |
129 |
|
calo0_obj = 0; |
130 |
|
|
131 |
trk2_obj = 0; |
trk2_obj = 0; |
132 |
trk1_obj = 0; |
trk1_obj = 0; |
133 |
trkh_obj = 0; |
trkh_obj = 0; |
142 |
|
|
143 |
run_obj = 0;//new GL_RUN(); |
run_obj = 0;//new GL_RUN(); |
144 |
soft_obj = 0;// Emiliano |
soft_obj = 0;// Emiliano |
145 |
irun = -1; |
irun = -1LL; |
146 |
runfirstentry = 0ULL; |
runfirstentry = 0LL; |
147 |
runlastentry = 0ULL; |
runlastentry = 0LL; |
148 |
|
|
149 |
|
l0_file = NULL; |
150 |
|
l0_tree = NULL; |
151 |
|
iroot = -1; |
152 |
|
dbc = 0; |
153 |
|
|
154 |
|
prevshift = 0; |
155 |
|
|
156 |
|
run_tree = NULL; |
157 |
|
run_tree_clone = NULL; |
158 |
|
sel_tree = NULL; |
159 |
|
sel_tree_clone = NULL; |
160 |
|
|
161 |
|
irunentry = -1LL; |
162 |
|
pam_tree = NULL; |
163 |
|
for(Int_t i=0; i<NCLONES; i++ )pam_tree_clone[i]=NULL; |
164 |
|
|
165 |
|
host = "mysql://localhost/pamelaprod"; |
166 |
|
user = "anonymous"; |
167 |
|
psw = ""; |
168 |
|
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
169 |
|
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
170 |
|
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
171 |
|
if ( !pamdbhost ) pamdbhost = ""; |
172 |
|
if ( !pamdbuser ) pamdbuser = ""; |
173 |
|
if ( !pamdbpsw ) pamdbpsw = ""; |
174 |
|
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
175 |
|
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
176 |
|
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
177 |
|
|
178 |
for(Int_t i=0; i<8; i++ )tree_clone[i]=NULL; |
|
179 |
|
|
180 |
// sorted_tracks = 0;//new TRefArray(); |
// sorted_tracks = 0;//new TRefArray(); |
181 |
|
|
182 |
|
CAL0 = false; |
183 |
CAL1 = true; |
CAL1 = true; |
184 |
CAL2 = true; |
CAL2 = true; |
185 |
TRK2 = true; |
TRK2 = true; |
186 |
TRK1 = false; |
TRK1 = false; |
187 |
TRKh = false; |
TRKh = false; |
188 |
TRG = true; |
TRKh = false; |
189 |
TOF = true; |
TRG = true; |
190 |
S4 = true; |
TOF = true; |
191 |
ND = true; |
TOF0 = false; |
192 |
AC = true; |
S4 = true; |
193 |
ORB = true; |
ND = true; |
194 |
|
AC = true; |
195 |
|
ORB = true; |
196 |
|
|
197 |
RUN = true; |
RUN = true; |
198 |
|
|
199 |
|
SELLI = -1; |
200 |
|
|
201 |
tsorted=0; |
tsorted=0; |
202 |
timage=0; |
timage=0; |
203 |
|
|
204 |
|
howtosort = "+CAL+TOF"; |
205 |
|
//howtosort = "+TOF"; |
206 |
|
sortthr = 100.; |
207 |
|
|
208 |
}; |
}; |
209 |
/** |
/** |
215 |
if(soft_obj)delete soft_obj; //Emiliano |
if(soft_obj)delete soft_obj; //Emiliano |
216 |
|
|
217 |
// cout << "void PamLevel2::Clear()"<<endl; |
// cout << "void PamLevel2::Clear()"<<endl; |
218 |
|
if(h0_obj) delete h0_obj; |
219 |
|
if(trk0_obj) delete trk0_obj; |
220 |
|
if(calo0_obj) delete calo0_obj; |
221 |
if(trk1_obj) delete trk1_obj; |
if(trk1_obj) delete trk1_obj; |
222 |
if(trk2_obj) delete trk2_obj; |
if(trk2_obj) delete trk2_obj; |
223 |
if(trkh_obj) delete trkh_obj; |
if(trkh_obj) delete trkh_obj; |
238 |
timage->Delete(); |
timage->Delete(); |
239 |
delete timage; |
delete timage; |
240 |
} |
} |
241 |
|
|
242 |
|
if(dbc){ |
243 |
|
dbc->Close(); |
244 |
|
delete dbc; |
245 |
|
} |
246 |
|
|
247 |
|
if(l0_file)l0_file->Close(); |
248 |
|
// if(pam_tree)pam_tree->Delete();; |
249 |
|
|
250 |
|
if ( pam_tree ){ |
251 |
|
// |
252 |
|
// we have first to find which chains we have to delete, then delete the main chain and only after delete the friend chains. Any other order causes a segfault... |
253 |
|
// |
254 |
|
TList *temp = pam_tree->GetListOfFriends(); |
255 |
|
TList *contents = new TList; // create chain friend list |
256 |
|
contents->SetOwner(); |
257 |
|
TIter next(temp); |
258 |
|
TChain *questo = 0; |
259 |
|
while ( (questo = (TChain*) next()) ){ |
260 |
|
TString name = questo->GetName(); |
261 |
|
contents->Add((TChain*)gROOT->FindObject(name.Data()));// add object to the list |
262 |
|
}; |
263 |
|
// |
264 |
|
// deleting the main chain |
265 |
|
// |
266 |
|
pam_tree->Delete(); |
267 |
|
// |
268 |
|
// deleting the friends... |
269 |
|
// |
270 |
|
TIter next2(contents); |
271 |
|
TChain *questa = 0; |
272 |
|
while ( questa = (TChain*)next2() ){ |
273 |
|
TString name = questa->GetName(); |
274 |
|
questa->Delete(); |
275 |
|
questa=NULL; |
276 |
|
}; |
277 |
|
// |
278 |
|
}; |
279 |
|
pam_tree = NULL; |
280 |
|
|
281 |
|
if(run_tree)run_tree->Delete();; |
282 |
|
if(sel_tree)sel_tree->Delete();; |
283 |
|
for(Int_t i=0; i<NCLONES; i++ )if(pam_tree_clone[i])pam_tree_clone[i]->Delete();; |
284 |
|
if(run_tree_clone)run_tree_clone->Delete();; |
285 |
|
if(sel_tree_clone)sel_tree_clone->Delete();; |
286 |
|
|
287 |
|
|
288 |
}; |
}; |
289 |
|
|
290 |
/** |
/** |
302 |
// if(run_obj) run_obj->Clear(); // Emiliano: Do not deallocate run_obj here, it will give segmentation fault! call clear instead |
// if(run_obj) run_obj->Clear(); // Emiliano: Do not deallocate run_obj here, it will give segmentation fault! call clear instead |
303 |
// if(soft_obj) soft_obj->Clear(); |
// if(soft_obj) soft_obj->Clear(); |
304 |
|
|
305 |
|
if(h0_obj) h0_obj->Clear(); |
306 |
|
// if(trk0_obj) trk0_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(); |
326 |
if(timage){ |
if(timage){ |
327 |
timage->Delete(); |
timage->Delete(); |
328 |
} |
} |
|
|
|
329 |
}; |
}; |
330 |
|
|
331 |
|
void PamLevel2::Reset(){ |
332 |
|
// |
333 |
|
// First of all clear everything |
334 |
|
// |
335 |
|
Clear(); |
336 |
|
// |
337 |
|
// close and reset chains and pointers |
338 |
|
// |
339 |
|
if ( pam_tree ){ |
340 |
|
// |
341 |
|
// we have first to find which chains we have to delete, then delete the main chain and only after delete the friend chains. Any other order causes a segfault... |
342 |
|
// |
343 |
|
TList *temp = pam_tree->GetListOfFriends(); |
344 |
|
TList *contents = new TList; // create chain friend list |
345 |
|
contents->SetOwner(); |
346 |
|
TIter next(temp); |
347 |
|
TChain *questo = 0; |
348 |
|
while ( (questo = (TChain*) next()) ){ |
349 |
|
TString name = questo->GetName(); |
350 |
|
contents->Add((TChain*)gROOT->FindObject(name.Data()));// add object to the list |
351 |
|
}; |
352 |
|
// |
353 |
|
// deleting the main chain |
354 |
|
// |
355 |
|
pam_tree->Delete(); |
356 |
|
// |
357 |
|
// deleting the friends... |
358 |
|
// |
359 |
|
TIter next2(contents); |
360 |
|
TChain *questa = 0; |
361 |
|
while ( questa = (TChain*)next2() ){ |
362 |
|
TString name = questa->GetName(); |
363 |
|
questa->Delete(); |
364 |
|
questa=NULL; |
365 |
|
}; |
366 |
|
// |
367 |
|
}; |
368 |
|
pam_tree = NULL; |
369 |
|
// |
370 |
|
if(run_tree)run_tree->Delete();; |
371 |
|
run_tree = NULL; |
372 |
|
if(sel_tree)sel_tree->Delete();; |
373 |
|
sel_tree = NULL; |
374 |
|
// |
375 |
|
// Close file |
376 |
|
// |
377 |
|
if(l0_file)l0_file->Close("R"); |
378 |
|
l0_file = NULL; |
379 |
|
// |
380 |
|
h0_obj = 0; |
381 |
|
trk0_obj = 0; |
382 |
|
calo0_obj = 0; |
383 |
|
// |
384 |
|
trk2_obj = 0; |
385 |
|
trk1_obj = 0; |
386 |
|
trkh_obj = 0; |
387 |
|
calo1_obj = 0; |
388 |
|
calo2_obj = 0; |
389 |
|
tof_obj = 0; |
390 |
|
trig_obj = 0; |
391 |
|
s4_obj = 0; |
392 |
|
nd_obj = 0; |
393 |
|
ac_obj = 0; |
394 |
|
orb_obj = 0; |
395 |
|
// |
396 |
|
// Reset run pointers |
397 |
|
// |
398 |
|
run_obj = 0;//new GL_RUN(); |
399 |
|
soft_obj = 0;// Emiliano |
400 |
|
irun = -1; |
401 |
|
runfirstentry = 0ULL; |
402 |
|
runlastentry = 0ULL; |
403 |
|
// |
404 |
|
}; |
405 |
|
|
406 |
|
Bool_t PamLevel2::IsGood(){ |
407 |
|
Bool_t goodev=true; |
408 |
|
// if(trk2_obj && trk2_obj->UnpackError() != 0 ) goodev = false; |
409 |
|
if(calo2_obj && calo2_obj->good != 1) goodev = false; |
410 |
|
if(tof_obj && tof_obj->unpackError != 0) goodev = false; |
411 |
|
if(trig_obj && trig_obj->unpackError != 0) goodev = false; |
412 |
|
if(s4_obj && s4_obj->unpackError != 0) goodev = false; |
413 |
|
if(nd_obj && nd_obj->unpackError != 0) goodev = false; |
414 |
|
if(ac_obj && ac_obj->unpackError != 255) goodev = false; |
415 |
|
// if(orb_obj) |
416 |
|
return goodev; |
417 |
|
}; |
418 |
|
|
419 |
//-------------------------------------- |
//-------------------------------------- |
420 |
// |
// |
609 |
} |
} |
610 |
//-------------------------------------- |
//-------------------------------------- |
611 |
// |
// |
612 |
|
|
613 |
|
/** |
614 |
|
* Sort physical (tracker) tracks and stores them in the TRefArray (of TrkTrack objects) which pointer is PamLevel2::sorted_tracks. Left here as backward compatibility method. |
615 |
|
**/ |
616 |
|
void PamLevel2::SortTracks(TString how){ |
617 |
|
printf(" WARNING! obsolete, use SortTracks() and SetSortingMethod(TString) instead! \n Setting sorting method to %s \n",how.Data()); |
618 |
|
howtosort = how; |
619 |
|
SortTracks(); |
620 |
|
}; |
621 |
|
|
622 |
// |
// |
623 |
//-------------------------------------- |
//-------------------------------------- |
624 |
/** |
/** |
632 |
* |
* |
633 |
* 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). |
* 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). |
634 |
*/ |
*/ |
635 |
void PamLevel2::SortTracks(TString how){ |
void PamLevel2::SortTracks(){ |
636 |
|
TString how = howtosort; |
637 |
|
|
638 |
// cout <<" PamLevel2::SortTracks(TString how) "<<endl; |
// cout <<" PamLevel2::SortTracks(TString how) "<<endl; |
639 |
if( !trk2_obj ){ |
if( !trk2_obj ){ |
640 |
cout << "void PamLevel2::SortTracks(TString how): TrkLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): TrkLevel2 not loaded !!!"; |
641 |
return; |
return; |
642 |
}; |
}; |
643 |
// cout << "call SortTracs() "<<endl; |
// cout << "call SortTracs() "<<endl; |
644 |
//Save current Object count |
//Save current Object count |
645 |
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
646 |
|
|
647 |
// cout << "ObjectNumber "<<ObjectNumber <<endl; |
// cout << "ObjectNumber "<<ObjectNumber <<endl; |
648 |
|
|
649 |
// if(!sorted_tracks)sorted_tracks = new TRefArray(); |
// if(!sorted_tracks)sorted_tracks = new TRefArray(); |
650 |
// sorted_tracks->Clear(); |
// sorted_tracks->Clear(); |
651 |
// sorted_tracks.Clear(); |
// sorted_tracks.Clear(); |
652 |
|
|
653 |
if(!tsorted)tsorted = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
if(!tsorted)tsorted = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
654 |
tsorted->Delete(); |
tsorted->Delete(); |
655 |
TClonesArray &ttsorted = *tsorted; |
TClonesArray &ttsorted = *tsorted; |
656 |
if(!timage)timage = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
if(!timage)timage = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
657 |
timage->Delete(); |
timage->Delete(); |
658 |
TClonesArray &ttimage = *timage; |
TClonesArray &ttimage = *timage; |
659 |
|
|
660 |
|
|
661 |
// loop over the tracks sorted by the tracker |
|
662 |
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
//-------------------------------------------------- |
663 |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
// retrieve sorting method |
664 |
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
//-------------------------------------------------- |
665 |
|
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
666 |
|
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
667 |
|
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
668 |
|
|
669 |
if( !CAL2 && use_CAL) use_CAL = false; |
if( !CAL2 && use_CAL) use_CAL = false; |
670 |
if( !TOF && use_TOF) use_TOF = false; |
if( !TOF && use_TOF) use_TOF = false; |
671 |
|
|
672 |
if( !TRK2 ){ |
if( !TRK2 ){ |
673 |
// cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
// cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
674 |
return; |
return; |
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 |
for(Int_t i=0; i < trk2_obj->TrkLevel2::GetNTracks(); i++){ |
|
680 |
|
//-------------------------------------------------- |
681 |
TrkTrack *ts = 0; |
// loop over "physical" tracks sorted by the tracker |
682 |
CaloTrkVar *cs = 0; |
//-------------------------------------------------- |
683 |
ToFTrkVar *os = 0; |
for(Int_t i=0; i < trk2_obj->TrkLevel2::GetNTracks(); i++){ |
684 |
|
|
685 |
// get tracker tracks |
TrkTrack *ts = 0; |
686 |
TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker |
CaloTrkVar *cs = 0; |
687 |
CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); |
ToFTrkVar *os = 0; |
688 |
ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); |
|
689 |
|
// get tracker tracks |
690 |
TrkTrack *ti = 0; //tracker (image) |
TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker |
691 |
CaloTrkVar *ci = 0; |
CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); |
692 |
ToFTrkVar *oi = 0; |
ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); |
693 |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
|
694 |
// if track has an image, check image selection |
TrkTrack *ti = 0; //tracker (image) |
695 |
if(tp->HasImage()){ |
CaloTrkVar *ci = 0; |
696 |
|
ToFTrkVar *oi = 0; |
697 |
|
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
698 |
|
// if track has an image, check image selection |
699 |
|
if(tp->HasImage()){ |
700 |
|
|
701 |
ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) |
ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) |
702 |
ci = GetCaloStoredTrack(ti->GetSeqNo()); |
ci = GetCaloStoredTrack(ti->GetSeqNo()); |
703 |
oi = GetToFStoredTrack(ti->GetSeqNo()); |
oi = GetToFStoredTrack(ti->GetSeqNo()); |
704 |
|
|
705 |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
706 |
|
|
707 |
//assign starting scores |
//assign starting scores |
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 ){ |
717 |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but CaloLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but CaloLevel2 not loaded !!!"; |
718 |
return; |
return; |
719 |
}; |
}; |
720 |
if( |
if( |
721 |
use_CAL && |
use_CAL && |
722 |
calo2_obj->npcfit[1] > 15 && //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 |
true){ |
cp && ci && |
725 |
|
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 |
|
else ti_score++; |
737 |
|
|
738 |
|
// cout << "CALO "<<tp_score<<ti_score<<endl; |
739 |
|
|
740 |
// cout << "CALO "<<tp_score<<ti_score<<endl; |
}; |
741 |
|
// ----------------------------------------------------------------------------------------- |
742 |
|
// TOF check |
743 |
|
// ----------------------------------------------------------------------------------------- |
744 |
|
// check the number of hit pmts along the track |
745 |
|
// on S12 S21 and S32, where paddles are parallel to Y axis |
746 |
|
if( use_TOF && !tof_obj ){ |
747 |
|
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but ToFLevel2 not loaded !!!"; |
748 |
|
return; |
749 |
|
}; |
750 |
|
if( use_TOF && op && oi ){ |
751 |
|
|
752 |
|
// |
753 |
|
Float_t sen = 0.; |
754 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
755 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
756 |
|
if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (op->dedx).At(ih); |
757 |
|
}; |
758 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
759 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
760 |
|
if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (oi->dedx).At(ih); |
761 |
|
}; |
762 |
|
// |
763 |
|
if ( sen >= sortthr ){ |
764 |
|
//printf(" IS A NUCLEUS! en = %f \n",sen); |
765 |
|
// |
766 |
|
// is a nucleus use a different algorithm |
767 |
|
// |
768 |
|
Int_t nz = 6; Float_t zin[6]; // << define TOF z-coordinates |
769 |
|
for(Int_t ip=0; ip<nz; ip++) |
770 |
|
zin[ip] = tof_obj->ToFLevel2::GetZTOF(tof_obj->ToFLevel2::GetToFPlaneID(ip)); // << read ToF plane z-coordinates |
771 |
|
Trajectory *tr = new Trajectory(nz,zin); |
772 |
|
// |
773 |
|
Int_t nphit_p =0; |
774 |
|
Int_t nphit_i =0; |
775 |
|
Float_t enhit_p = 0.; |
776 |
|
Float_t enhit_i = 0.; |
777 |
|
// |
778 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
779 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
780 |
|
if(pl == 1 || pl == 2 || pl == 5){ |
781 |
|
nphit_p++; |
782 |
|
enhit_p += (op->dedx).At(ih); |
783 |
|
}; |
784 |
|
}; |
785 |
|
// |
786 |
|
tp->DoTrack2(tr); |
787 |
|
// |
788 |
|
if ( fabs(tr->y[0]-oi->ytofpos[0]) < 2. ){ |
789 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
790 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
791 |
|
if(pl == 0){ |
792 |
|
nphit_p++; |
793 |
|
enhit_p += (op->dedx).At(ih); |
794 |
|
}; |
795 |
|
}; |
796 |
|
}; |
797 |
|
if ( fabs(tr->y[3]-oi->ytofpos[1]) < 2. ){ |
798 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
799 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
800 |
|
if(pl == 3){ |
801 |
|
nphit_p++; |
802 |
|
enhit_p += (op->dedx).At(ih); |
803 |
|
}; |
804 |
|
}; |
805 |
|
}; |
806 |
|
if ( fabs(tr->y[4]-oi->ytofpos[2]) < 2. ){ |
807 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
808 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
809 |
|
if(pl == 4){ |
810 |
|
nphit_p++; |
811 |
|
enhit_p += (op->dedx).At(ih); |
812 |
|
}; |
813 |
|
}; |
814 |
|
}; |
815 |
|
|
816 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
817 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
818 |
|
if(pl == 1 || pl == 2 || pl == 5){ |
819 |
|
nphit_i++; |
820 |
|
enhit_i += (op->dedx).At(ih); |
821 |
|
}; |
822 |
|
}; |
823 |
|
// |
824 |
|
ti->DoTrack2(tr); |
825 |
|
// |
826 |
|
if ( fabs(tr->y[0]-oi->ytofpos[0]) < 2. ){ |
827 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
828 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
829 |
|
if(pl == 0){ |
830 |
|
nphit_i++; |
831 |
|
enhit_i += (op->dedx).At(ih); |
832 |
|
}; |
833 |
|
}; |
834 |
|
}; |
835 |
|
if ( fabs(tr->y[3]-oi->ytofpos[1]) < 2. ){ |
836 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
837 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
838 |
|
if(pl == 3){ |
839 |
|
nphit_i++; |
840 |
|
enhit_i += (op->dedx).At(ih); |
841 |
|
}; |
842 |
}; |
}; |
843 |
// ------------------------ |
}; |
844 |
// TOF check |
if ( fabs(tr->y[4]-oi->ytofpos[2]) < 2. ){ |
845 |
// ------------------------ |
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
846 |
// check the number of hit pmts along the track |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
847 |
// on S12 S21 and S32, where paddles are parallel to Y axis |
if(pl == 4){ |
848 |
if( use_TOF && !tof_obj ){ |
nphit_i++; |
849 |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!"; |
enhit_i += (op->dedx).At(ih); |
850 |
return; |
}; |
851 |
}; |
}; |
852 |
if( use_TOF ){ |
}; |
853 |
|
|
854 |
|
|
855 |
|
if( |
856 |
|
use_TOF && |
857 |
|
(nphit_p+nphit_i) !=0 && |
858 |
|
true){ |
859 |
|
|
860 |
|
// 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); |
861 |
|
// printf(" score p %i score i %i \n",tp_score,ti_score); |
862 |
|
// if( enhit_p > enhit_i ) tp_score++; |
863 |
|
// if( nphit_p >= nphit_i && enhit_p > enhit_i ) tp_score++; |
864 |
|
if ( nphit_p > nphit_i ) tp_score++; |
865 |
|
if ( nphit_p < nphit_i ) ti_score++; |
866 |
|
if ( nphit_p == nphit_i ){ |
867 |
|
if ( enhit_p > enhit_i ) tp_score++; |
868 |
|
else ti_score++; |
869 |
|
}; |
870 |
|
// printf(" dopo score p %i score i %i \n",tp_score,ti_score); |
871 |
|
}; |
872 |
|
delete tr; |
873 |
|
// |
874 |
|
} else { |
875 |
|
// |
876 |
|
// NOT a NUCLEUS |
877 |
|
// |
878 |
|
//printf(" NOT a NUCLEUS! en = %f \n",sen); |
879 |
|
|
880 |
|
Int_t nphit_p =0; |
881 |
|
Int_t nphit_i =0; |
882 |
|
|
|
Int_t nphit_p =0; |
|
|
Int_t nphit_i =0; |
|
883 |
|
|
884 |
|
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
885 |
|
cout << "track: npmttdc "<< op->npmttdc << endl; |
886 |
|
cout << "image: npmtadc "<< oi->npmtadc << endl; |
887 |
|
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
888 |
|
|
889 |
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
890 |
cout << "track: npmttdc "<< op->npmttdc << endl; |
// Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
891 |
cout << "image: npmtadc "<< oi->npmtadc << endl; |
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
892 |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
// }; |
893 |
|
|
894 |
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
895 |
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
// Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
896 |
if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
897 |
}; |
// }; |
898 |
|
// --- modified to count tdc signals (more efficient?) |
899 |
|
// --- and to implement check on tdcflag |
900 |
|
for (Int_t ih=0; ih < op->npmttdc; ih++){ |
901 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmttdc).At(ih) ); |
902 |
|
// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; |
903 |
|
if( (op->tdcflag).At(ih)==0 )nphit_p++; |
904 |
|
}; |
905 |
|
|
906 |
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
for (Int_t ih=0; ih < oi->npmttdc; ih++){ |
907 |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmttdc).At(ih) ); |
908 |
if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; |
909 |
}; |
if( (oi->tdcflag).At(ih)==0 )nphit_i++; |
910 |
|
}; |
911 |
|
|
912 |
if( |
if( |
913 |
use_TOF && |
(nphit_p+nphit_i) !=0 && |
914 |
(nphit_p+nphit_i) !=0 && |
true){ |
|
true){ |
|
915 |
|
|
916 |
if( nphit_p >= nphit_i) tp_score++; |
if( nphit_p >= nphit_i) tp_score++; |
917 |
else ti_score++; |
else ti_score++; |
918 |
}; |
}; |
919 |
// cout << "TOF "<<tp_score<<ti_score<<endl; |
}; |
920 |
}; |
// cout << "TOF "<<tp_score<<ti_score<<endl; |
921 |
if(tp_score == ti_score) use_TRK = true; |
}; |
922 |
// ------------------------ |
|
923 |
// tracker check |
|
924 |
// ------------------------ |
// if(tp_score == ti_score) use_TRK = true; |
925 |
// chi**2 difference is not always large enough to distinguish among |
|
926 |
// the real track and its image. |
|
927 |
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
// ----------------------------------------------------------------------------------------- |
928 |
if(use_TRK){ |
// tracker check |
929 |
if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
// ----------------------------------------------------------------------------------------- |
930 |
else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
// chi**2 difference is not always large enough to distinguish among |
931 |
// cout << "TRK "<<tp_score<<ti_score<<endl; |
// the real track and its image. |
932 |
}; |
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
933 |
|
// *** MODIFIED ON AUGUST 2007 *** |
934 |
|
if(use_TRK){ |
935 |
|
// if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
936 |
|
// else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
937 |
|
|
938 |
|
// CHECK 1 : number of points along X |
939 |
|
if ( tp->GetNX() >= ti->GetNX() )tp_score++ ; |
940 |
|
if ( tp->GetNX() <= ti->GetNX() )ti_score++ ; |
941 |
|
// CHECK 2 : number of points along Y |
942 |
|
if ( tp->GetNY() >= ti->GetNY() )tp_score++ ; |
943 |
|
if ( tp->GetNY() <= ti->GetNY() )ti_score++ ; |
944 |
|
// CHECK 3 : chi**2 along X |
945 |
|
// if( tp->GetChi2X() > 0 && (tp->GetChi2X() < ti->GetChi2X() || ti->GetChi2X() <=0) ) tp_score++ ; |
946 |
|
// if( ti->GetChi2X() > 0 && (ti->GetChi2X() < tp->GetChi2X() || tp->GetChi2X() <=0) ) ti_score++ ; |
947 |
|
// CHECK 4 : chi**2 along Y |
948 |
|
// if( tp->GetChi2Y() > 0 && (tp->GetChi2Y() < ti->GetChi2Y() || ti->GetChi2Y() <=0) ) tp_score++ ; |
949 |
|
// if( ti->GetChi2Y() > 0 && (ti->GetChi2Y() < tp->GetChi2Y() || tp->GetChi2Y() <=0) ) ti_score++ ; |
950 |
|
// CHECK 5 : total chi**2 |
951 |
|
// if( tp->chi2 > 0 && (tp->chi2 < ti->chi2 || ti->chi2 <=0) ) tp_score++ ; |
952 |
|
// if( ti->chi2 > 0 && (ti->chi2 < tp->chi2 || tp->chi2 <=0) ) ti_score++ ; |
953 |
|
|
954 |
|
// cout << "TRK "<<tp_score<<ti_score<<endl; |
955 |
|
}; |
956 |
|
|
957 |
// ------------------------ |
|
958 |
// the winner is.... |
|
959 |
// ------------------------ |
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
960 |
if (tp_score > ti_score) { |
// the winner is.... |
961 |
// ts = tp;//the track sorted by the tracker!! |
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
962 |
// cs = cp; |
if (tp_score > ti_score) { |
963 |
// os = op; |
|
964 |
}else if (tp_score < ti_score) { |
|
965 |
ts = ti;//its image!! |
}else if (tp_score < ti_score) { |
966 |
cs = ci; |
|
967 |
os = oi; |
|
968 |
|
ts = ti;//its image!! |
969 |
ti = tp;//its image!! |
cs = ci; |
970 |
ci = cp; |
os = oi; |
971 |
oi = op; |
|
972 |
|
ti = tp;//its image!! |
973 |
tp = ts;//its image!! |
ci = cp; |
974 |
cp = cs; |
oi = op; |
975 |
op = os; |
|
976 |
|
tp = ts;//its image!! |
977 |
|
cp = cs; |
978 |
|
op = os; |
979 |
|
|
980 |
|
|
981 |
}else { |
}else { |
982 |
// ts = tp; |
|
983 |
// cs = cp; |
// cout << "Warning - track image ambiguity not solved" << endl; |
984 |
// os = op; |
|
985 |
// cout << "Warning - track image ambiguity not solved" << endl; |
}; |
|
// cout << ts->GetNtot() << " "<< ts->chi2 << " " << npcfit[1] << " "<< nphit_p << endl; |
|
|
}; |
|
986 |
|
|
987 |
}else{ |
}else{ |
988 |
// ts = tp; |
// ts = tp; |
989 |
// cs = cp; |
// cs = cp; |
990 |
// os = op; |
// os = op; |
991 |
}; |
}; |
992 |
|
|
993 |
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
994 |
// sorted_tracks->Add(ts);//save the track in the sorted array |
// sorted_tracks->Add(ts);//save the track in the sorted array |
995 |
// sorted_tracks.Add(ts);//save the track in the sorted array |
// sorted_tracks.Add(ts);//save the track in the sorted array |
996 |
// sorted_tracks.Add(tp);//save the track in the sorted array |
// sorted_tracks.Add(tp);//save the track in the sorted array |
997 |
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
998 |
// cout<<"o "<<tp<<endl; |
// cout<<"o "<<tp<<endl; |
999 |
// cout<<"o "<<cp<<endl; |
// cout<<"o "<<cp<<endl; |
1000 |
// cout<<"o "<<op<<endl; |
// cout<<"o "<<op<<endl; |
1001 |
new(ttsorted[i]) PamTrack(tp,cp,op); |
new(ttsorted[i]) PamTrack(tp,cp,op); |
1002 |
new(ttimage[i]) PamTrack(ti,ci,oi); |
new(ttimage[i]) PamTrack(ti,ci,oi); |
1003 |
}; |
}; |
1004 |
|
|
1005 |
if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){ |
if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){ |
1006 |
cout << "void PamLevel2::SortTracks(TString how): tsorted->GetEntries() "<<tsorted->GetEntries()<<" != trk2_obj->GetNTracks() = "<<trk2_obj->GetNTracks() <<endl; |
cout << "void PamLevel2::SortTracks(): tsorted->GetEntries() "<<tsorted->GetEntries()<<" != trk2_obj->GetNTracks() = "<<trk2_obj->GetNTracks() <<endl; |
1007 |
tsorted->Delete(); tsorted=0; |
tsorted->Delete(); tsorted=0; |
1008 |
timage->Delete(); timage=0; |
timage->Delete(); timage=0; |
1009 |
} |
} |
1010 |
|
|
1011 |
//Restore Object count |
//Restore Object count |
1012 |
//To save space in the table keeping track of all referenced objects |
//To save space in the table keeping track of all referenced objects |
1013 |
//We reset the object count to what it was at the beginning of the event. |
//We reset the object count to what it was at the beginning of the event. |
1014 |
TProcessID::SetObjectCount(ObjectNumber); |
TProcessID::SetObjectCount(ObjectNumber); |
1015 |
|
|
1016 |
}; |
}; |
1017 |
//-------------------------------------- |
//-------------------------------------- |
1035 |
TClonesArray *PamLevel2::GetTracks(){ |
TClonesArray *PamLevel2::GetTracks(){ |
1036 |
|
|
1037 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
1038 |
SortTracks("+CAL+TOF"); |
SortTracks(); |
1039 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
1040 |
|
|
1041 |
return tsorted; |
return tsorted; |
1054 |
|
|
1055 |
// if(!trk2_obj) return 0; |
// if(!trk2_obj) return 0; |
1056 |
|
|
1057 |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
// // *-*-*-*+-*-*-*-*-*-*-*-*-* |
1058 |
// SortTracks("+CAL+TOF"); |
// SortTracks("+CAL+TOF"); |
1059 |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
1060 |
// // if(!sorted_tracks)return 0; |
// // if(!sorted_tracks)return 0; |
1073 |
|
|
1074 |
// cout << "PamLevel2::GetTrack(int it) "<<endl; |
// cout << "PamLevel2::GetTrack(int it) "<<endl; |
1075 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
1076 |
SortTracks("+CAL+TOF"); |
SortTracks(); |
1077 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
1078 |
if(!tsorted)return 0; |
if(!tsorted)return 0; |
1079 |
if(!tsorted->GetEntries())return 0; |
if(!tsorted->GetEntries())return 0; |
1130 |
|
|
1131 |
|
|
1132 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
1133 |
SortTracks("+CAL+TOF"); |
SortTracks(); |
1134 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
1135 |
if(!timage)return 0; |
if(!timage)return 0; |
1136 |
if(!timage->GetEntries())return 0; |
if(!timage->GetEntries())return 0; |
1167 |
|
|
1168 |
// if( !detlist.IsNull() ) SetWhichTrees(detlist); |
// if( !detlist.IsNull() ) SetWhichTrees(detlist); |
1169 |
// else GetWhichTrees(f); |
// else GetWhichTrees(f); |
1170 |
|
if ( pam_tree ){ |
1171 |
|
printf("WARNING: TTree *PamLevel2::GetPamTree(TFile *fl, TString detlist) -- pam_tree already exists!\n "); |
1172 |
|
return pam_tree; |
1173 |
|
}; |
1174 |
|
// |
1175 |
|
|
1176 |
|
cout << "TTree *PamLevel2::GetPamTree(TFile *f, TString detlist ) -- obsolte "<<endl; |
1177 |
|
|
1178 |
SetWhichTrees(detlist); |
SetWhichTrees(detlist); |
1179 |
|
|
1180 |
TTree *Trout =0; |
TTree *Trout =0; |
1182 |
TString fname = f->GetName(); |
TString fname = f->GetName(); |
1183 |
if(!CheckLevel2File(fname))return NULL; |
if(!CheckLevel2File(fname))return NULL; |
1184 |
|
|
1185 |
UInt_t *found=0; |
// UInt_t *found=0; |
1186 |
|
|
1187 |
cout<< "GetPamTree(TFile*,TString): detector list --> "; |
cout<< "GetPamTree(TFile*,TString): detector list --> "; |
1188 |
if(TRK1)cout<<"TRK1 "; |
if(TRK1)cout<<"TRK1 "; |
1197 |
if(S4)cout<<"S4 "; |
if(S4)cout<<"S4 "; |
1198 |
if(ORB)cout<<"ORB "; |
if(ORB)cout<<"ORB "; |
1199 |
cout << endl; |
cout << endl; |
1200 |
|
if(SELLI)cout<<">>> Found selection-list <<<"<<endl; |
1201 |
|
|
1202 |
f->cd(); |
f->cd(); |
1203 |
|
|
1205 |
TTree *T = (TTree*)f->Get("Tracker"); |
TTree *T = (TTree*)f->Get("Tracker"); |
1206 |
if(T && (TRK2||TRK1||TRKh)) { |
if(T && (TRK2||TRK1||TRKh)) { |
1207 |
if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
1208 |
else T->SetBranchStatus("TrkLevel2",0,found); |
// else T->SetBranchStatus("TrkLevel2",0,found); |
1209 |
if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
1210 |
if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
1211 |
else T->SetBranchStatus("TrkLevel1",0,found); |
// else T->SetBranchStatus("TrkLevel1",0,found); |
1212 |
if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
1213 |
if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
1214 |
else T->SetBranchStatus("TrkHough",0,found); |
// else T->SetBranchStatus("TrkHough",0,found); |
1215 |
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
1216 |
if(!Trout)Trout=T; |
if(!Trout)Trout=T; |
1217 |
else Trout->AddFriend(T); |
else Trout->AddFriend(T); |
1222 |
TTree *C = (TTree*)f->Get("Calorimeter"); |
TTree *C = (TTree*)f->Get("Calorimeter"); |
1223 |
if(C && (CAL2||CAL1)) { |
if(C && (CAL2||CAL1)) { |
1224 |
if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
1225 |
else C->SetBranchStatus("CaloLevel2",0,found); |
// else C->SetBranchStatus("CaloLevel2",0,found); |
1226 |
if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
1227 |
if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
1228 |
else C->SetBranchStatus("CaloLevel1",0,found); |
// else C->SetBranchStatus("CaloLevel1",0,found); |
1229 |
if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
1230 |
if(!Trout)Trout=C; |
if(!Trout)Trout=C; |
1231 |
else Trout->AddFriend(C); |
else Trout->AddFriend(C); |
1248 |
if(R && TRG) { |
if(R && TRG) { |
1249 |
R->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
R->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
1250 |
cout << "Trigger : set branch address TrigLevel2"<<endl; |
cout << "Trigger : set branch address TrigLevel2"<<endl; |
1251 |
if(!Trout)Trout=O; |
if(!Trout)Trout=R; |
1252 |
else Trout->AddFriend(R); |
else Trout->AddFriend(R); |
1253 |
}else{ |
}else{ |
1254 |
cout << "Trigger : missing tree"<<endl; |
cout << "Trigger : missing tree"<<endl; |
1258 |
if(S && S4) { |
if(S && S4) { |
1259 |
S->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
S->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
1260 |
cout << "S4 : set branch address S4Level2"<<endl; |
cout << "S4 : set branch address S4Level2"<<endl; |
1261 |
if(!Trout)Trout=O; |
if(!Trout)Trout=S; |
1262 |
else Trout->AddFriend(S); |
else Trout->AddFriend(S); |
1263 |
}else{ |
}else{ |
1264 |
cout << "S4 : missing tree"<<endl; |
cout << "S4 : missing tree"<<endl; |
1268 |
if(N && ND) { |
if(N && ND) { |
1269 |
N->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
N->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
1270 |
cout << "NeutronD : set branch address NDLevel2"<<endl; |
cout << "NeutronD : set branch address NDLevel2"<<endl; |
1271 |
if(!Trout)Trout=O; |
if(!Trout)Trout=N; |
1272 |
else Trout->AddFriend(N); |
else Trout->AddFriend(N); |
1273 |
}else{ |
}else{ |
1274 |
cout << "NeutronD : missing tree"<<endl; |
cout << "NeutronD : missing tree"<<endl; |
1278 |
if(A && AC) { |
if(A && AC) { |
1279 |
A->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
A->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
1280 |
cout << "Anticounter : set branch address AcLevel2"<<endl; |
cout << "Anticounter : set branch address AcLevel2"<<endl; |
1281 |
if(!Trout)Trout=O; |
if(!Trout)Trout=A; |
1282 |
else Trout->AddFriend(A); |
else Trout->AddFriend(A); |
1283 |
}else{ |
}else{ |
1284 |
cout << "Anticounter : missing tree"<<endl; |
cout << "Anticounter : missing tree"<<endl; |
1288 |
if(B && ORB) { |
if(B && ORB) { |
1289 |
B->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
B->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
1290 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
1291 |
if(!Trout)Trout=O; |
if(!Trout)Trout=B; |
1292 |
else Trout->AddFriend(B); |
else Trout->AddFriend(B); |
1293 |
}else{ |
}else{ |
1294 |
cout << "OrbitalInfo : missing tree"<<endl; |
cout << "OrbitalInfo : missing tree"<<endl; |
1295 |
}; |
}; |
1296 |
|
|
1297 |
|
TTree *L = (TTree*)f->Get("SelectionList"); |
1298 |
|
if(L && SELLI==1) { |
1299 |
|
// L->SetBranchAddress("RunEntry",&irun); |
1300 |
|
// cout << "SelectionList: set branch address RunEntry"<<endl; |
1301 |
|
// L->SetBranchAddress("EventEntry",&irunentry); |
1302 |
|
// cout << "SelectionList: set branch address EventEntry"<<endl; |
1303 |
|
// if(!Trout)Trout=O; |
1304 |
|
// else Trout->AddFriend("SelectionList"); |
1305 |
|
cout << " TTree *PamLevel2::GetPamTree(TFile, TString) >>> SelectionList not implemente!!!!"<<endl; |
1306 |
|
sel_tree = 0; |
1307 |
|
}else{ |
1308 |
|
cout << "SelectionList : missing tree"<<endl; |
1309 |
|
}; |
1310 |
|
|
1311 |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
1312 |
|
|
1313 |
|
pam_tree = (TChain*)Trout; |
1314 |
|
|
1315 |
return Trout; |
return Trout; |
1316 |
|
|
1330 |
|
|
1331 |
TString wdir = gSystem->WorkingDirectory(); |
TString wdir = gSystem->WorkingDirectory(); |
1332 |
|
|
1333 |
if(ddir=="")ddir = wdir; |
// if(ddir=="")ddir = wdir; |
1334 |
// TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
// TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
1335 |
cout << "Level2 data directory : "<< ddir << endl; |
if ( ddir != ""){ |
1336 |
|
cout << "Level2 data directory : "<< ddir << endl; |
1337 |
|
} else { |
1338 |
|
cout << "Level2 data directory not given as input: trying to evaluate from list or taking working directory " << endl; |
1339 |
|
}; |
1340 |
TList *contents = new TList; // create output list |
TList *contents = new TList; // create output list |
1341 |
contents->SetOwner(); |
contents->SetOwner(); |
1342 |
|
|
1352 |
// return 0; |
// return 0; |
1353 |
// } |
// } |
1354 |
// flisttxt = fullpath; |
// flisttxt = fullpath; |
1355 |
|
if ( !flisttxt.EndsWith(".root") ){ |
1356 |
|
|
1357 |
flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
1358 |
|
|
1384 |
// cout <<"(2) " << file << endl; |
// cout <<"(2) " << file << endl; |
1385 |
// if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
// if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
1386 |
// if( (fullpath = gSystem->FindFile(ddir,file)) ){ |
// if( (fullpath = gSystem->FindFile(ddir,file)) ){ |
1387 |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(ddir),gSystem->BaseName(file)); |
if( file.EndsWith(".root") ){ |
1388 |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
TString filedir; |
1389 |
delete fullpath; |
if (ddir != ""){ |
1390 |
|
filedir = ddir; // take the input dir |
1391 |
|
} else { |
1392 |
|
gSystem->ChangeDirectory(wdir); // back to the working directory |
1393 |
|
filedir = gSystem->DirName(file); // this will take the path if exist in the list otherwise it will return automatically the working dir |
1394 |
|
}; |
1395 |
|
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(filedir),gSystem->BaseName(file)); |
1396 |
|
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
1397 |
|
delete fullpath; |
1398 |
|
} |
1399 |
// }else{ |
// }else{ |
1400 |
// if(file.Data()!="")cout << "File: "<<file<<" ---> missing "<< endl; |
// if(file.Data()!="")cout << "File: "<<file<<" ---> missing "<< endl; |
1401 |
// }; |
// }; |
1402 |
}; |
}; |
1403 |
in.close(); |
in.close(); |
1404 |
|
} else { |
1405 |
|
if(flisttxt.Contains("#"))flisttxt = flisttxt(0,flisttxt.First("#")); |
1406 |
|
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
1407 |
|
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
1408 |
|
delete fullpath; |
1409 |
|
}; |
1410 |
}else{ |
}else{ |
1411 |
|
|
1412 |
cout << "No input file list given."<<endl; |
cout << "No input file list given."<<endl; |
1413 |
cout << "Check for existing root files."<<endl; |
cout << "Check for existing root files."<<endl; |
1414 |
// cout << "Warking directory: "<< gSystem->WorkingDirectory()<< endl; |
// cout << "Warking directory: "<< gSystem->WorkingDirectory()<< endl; |
1415 |
|
if ( ddir == "" ){ |
1416 |
|
ddir = wdir; |
1417 |
|
cout << "Level2 data directory : "<< ddir << endl; |
1418 |
|
}; |
1419 |
|
|
1420 |
TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
1421 |
TList *temp = datadir->GetListOfFiles(); |
TList *temp = datadir->GetListOfFiles(); |
1422 |
// temp->Print(); |
// temp->Print(); |
1460 |
* @return Pointer to a TChain |
* @return Pointer to a TChain |
1461 |
*/ |
*/ |
1462 |
TChain *PamLevel2::GetPamTree(TList *fl, TString detlist ){ |
TChain *PamLevel2::GetPamTree(TList *fl, TString detlist ){ |
1463 |
|
// |
1464 |
|
// |
1465 |
|
// |
1466 |
|
if ( pam_tree ){ |
1467 |
|
printf("WARNING: TChain *PamLevel2::GetPamTree(TList *fl, TString detlist) -- pam_tree already exists!\n "); |
1468 |
|
return pam_tree; |
1469 |
|
}; |
1470 |
|
// |
1471 |
|
|
1472 |
TChain *Trout =0; |
TChain *Trout =0; |
1473 |
|
|
1488 |
if(ORB)cout<<"ORB "; |
if(ORB)cout<<"ORB "; |
1489 |
cout << endl; |
cout << endl; |
1490 |
|
|
1491 |
TChain *T = 0; |
TChain *T = 0; |
1492 |
TChain *C = 0; |
TChain *C = 0; |
1493 |
TChain *O = 0; |
TChain *O = 0; |
1494 |
TChain *R = 0; |
TChain *R = 0; |
1495 |
TChain *S = 0; |
TChain *S = 0; |
1496 |
TChain *N = 0; |
TChain *N = 0; |
1497 |
TChain *A = 0; |
TChain *A = 0; |
1498 |
TChain *B = 0; |
TChain *B = 0; |
1499 |
|
|
1500 |
|
TChain *L = 0; |
1501 |
|
|
1502 |
if(TRK2||TRK1||TRKh) T = new TChain("Tracker"); |
if(TRK2||TRK1||TRKh) T = new TChain("Tracker"); |
1503 |
if(CAL2||CAL1) C = new TChain("Calorimeter"); |
if(CAL2||CAL1) C = new TChain("Calorimeter"); |
1507 |
if(ND) N = new TChain("NeutronD"); |
if(ND) N = new TChain("NeutronD"); |
1508 |
if(AC) A = new TChain("Anticounter"); |
if(AC) A = new TChain("Anticounter"); |
1509 |
if(ORB) B = new TChain("OrbitalInfo"); |
if(ORB) B = new TChain("OrbitalInfo"); |
1510 |
|
L = new TChain("SelectionList"); |
1511 |
|
|
1512 |
// loop over files and create chains |
// loop over files and create chains |
1513 |
TIter next(fl); |
TIter next(fl); |
1524 |
if(ND) N->Add(name); |
if(ND) N->Add(name); |
1525 |
if(AC) A->Add(name); |
if(AC) A->Add(name); |
1526 |
if(ORB) B->Add(name); |
if(ORB) B->Add(name); |
1527 |
|
if(SELLI==1) L->Add(name); |
1528 |
}; |
}; |
1529 |
} |
}; |
1530 |
|
|
1531 |
cout << "done chain \n"; |
cout << "done chain \n"; |
1532 |
|
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
1533 |
|
|
1534 |
UInt_t *found=0; |
// UInt_t *found=0; |
1535 |
// Tracker |
// Tracker |
1536 |
if(T && (TRK2||TRK1||TRKh)) { |
if(T && (TRK2||TRK1||TRKh)) { |
1537 |
if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
1538 |
else T->SetBranchStatus("TrkLevel2",0,found); |
// else T->SetBranchStatus("TrkLevel2",0,found); |
1539 |
if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
1540 |
if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
1541 |
else T->SetBranchStatus("TrkLevel1",0,found); |
// else T->SetBranchStatus("TrkLevel1",0,found); |
1542 |
if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
1543 |
if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
1544 |
else T->SetBranchStatus("TrkHough",0,found); |
// else T->SetBranchStatus("TrkHough",0,found); |
1545 |
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
1546 |
if(!Trout)Trout=T; |
if(!Trout)Trout=T; |
1547 |
else Trout->AddFriend("Tracker"); |
else Trout->AddFriend("Tracker"); |
1548 |
}else{ |
}else{ |
1549 |
cout << "Tracker : missing tree"<<endl; |
cout << "Tracker : missing tree"<<endl; |
1550 |
}; |
}; |
1551 |
// Calorimeter |
// Calorimeter |
1552 |
if(C && (CAL2||CAL1)) { |
if(C && (CAL2||CAL1)) { |
1553 |
if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
1554 |
else C->SetBranchStatus("CaloLevel2",0,found); |
// else C->SetBranchStatus("CaloLevel2",0,found); |
1555 |
if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
1556 |
if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
1557 |
else C->SetBranchStatus("CaloLevel1",0,found); |
// else C->SetBranchStatus("CaloLevel1",0,found); |
1558 |
if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
1559 |
if(!Trout)Trout=C; |
if(!Trout)Trout=C; |
1560 |
else Trout->AddFriend("Calorimeter"); |
else Trout->AddFriend("Calorimeter"); |
1615 |
}else{ |
}else{ |
1616 |
cout << "OrbitalInfo : missing tree"<<endl; |
cout << "OrbitalInfo : missing tree"<<endl; |
1617 |
}; |
}; |
1618 |
|
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
1619 |
|
|
1620 |
|
// Selection List |
1621 |
|
if(L && SELLI==1) { |
1622 |
|
cout<<">>> Found selection-list <<<"<<endl; |
1623 |
|
L->SetBranchAddress("RunEntry",&irun); |
1624 |
|
cout << "SelectionList: set branch address RunEntry"<<endl; |
1625 |
|
L->SetBranchAddress("EventEntry",&irunentry); |
1626 |
|
cout << "SelectionList: set branch address EventEntry"<<endl; |
1627 |
|
sel_tree = L; |
1628 |
|
// if(!Trout)Trout=O; |
1629 |
|
// else Trout->AddFriend("SelectionList"); |
1630 |
|
cout << "----------------------------------------------------" <<endl; |
1631 |
|
}else{ |
1632 |
|
// cout << "SelectionList : missing tree"<<endl; |
1633 |
|
if(L)L->Delete(); |
1634 |
|
}; |
1635 |
|
|
1636 |
// cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
// cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
1637 |
|
|
1638 |
|
pam_tree = Trout; |
1639 |
// // Tracker |
|
|
// if(TRK2||TRK1||TRKh){ |
|
|
// if(!Tout)Tout=T; |
|
|
// else Tout->AddFriend("Tracker"); |
|
|
// } |
|
|
// // Calorimeter |
|
|
// if(CAL2||CAL1) { |
|
|
// if(!Tout)Tout=C; |
|
|
// else Tout->AddFriend("Calorimeter"); |
|
|
// }; |
|
|
// // ToF |
|
|
// if(TOF) { |
|
|
// if(!Tout)Tout=O; |
|
|
// else Tout->AddFriend("ToF"); |
|
|
// }; |
|
|
// // Trigger |
|
|
// if(TRG) { |
|
|
// if(!Tout)Tout=R; |
|
|
// else Tout->AddFriend("Trigger"); |
|
|
// }; |
|
|
// // S4 |
|
|
// if(S4) { |
|
|
// if(!Tout)Tout=S; |
|
|
// else Tout->AddFriend("S4"); |
|
|
// }; |
|
|
// // Neutron Detector |
|
|
// if(ND) { |
|
|
// if(!Tout)Tout=N; |
|
|
// else Tout->AddFriend("NeutronD"); |
|
|
// }; |
|
|
// // Anticounters |
|
|
// if(AC) { |
|
|
// if(!Tout)Tout=A; |
|
|
// else Tout->AddFriend("Anticounter"); |
|
|
// }; |
|
|
// // OrbitalInfo |
|
|
// if(ORB) { |
|
|
// if(!Tout)Tout=B; |
|
|
// else Tout->AddFriend("OrbitalInfo"); |
|
|
// }; |
|
|
|
|
|
// cout<<endl<<" Number of entries: "<<Tout->GetEntries()<<endl<<endl; |
|
|
|
|
|
// if( Tout->GetEntries() )PamLevel2::SetBranchAddress( Tout ); |
|
|
|
|
1640 |
return Trout; |
return Trout; |
1641 |
} |
} |
1642 |
|
|
1718 |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
1719 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
1720 |
}; |
}; |
1721 |
|
// SelectionList |
1722 |
|
if(SELLI==1) { |
1723 |
|
t->SetBranchAddress("RunEntry", &irun); |
1724 |
|
cout << "SelectionList: set branch address RunEntry"<<endl; |
1725 |
|
t->SetBranchAddress("EventEntry", &irunentry); |
1726 |
|
cout << "SelectionList: set branch address EventEntry"<<endl; |
1727 |
|
}; |
1728 |
|
|
1729 |
} |
} |
1730 |
/** |
/** |
1798 |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
1799 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
1800 |
}; |
}; |
1801 |
|
// SelectionList |
1802 |
|
if(SELLI==1) { |
1803 |
|
t->SetBranchAddress("RunEntry", &irun); |
1804 |
|
cout << "SelectionList: set branch address RunEntry"<<endl; |
1805 |
|
t->SetBranchAddress("EventEntry", &irunentry); |
1806 |
|
cout << "SelectionList: set branch address EventEntry"<<endl; |
1807 |
|
}; |
1808 |
|
|
1809 |
} |
} |
1810 |
|
|
1819 |
* @return Pointer to a TChain |
* @return Pointer to a TChain |
1820 |
*/ |
*/ |
1821 |
TChain *PamLevel2::GetRunTree(TList *fl){ |
TChain *PamLevel2::GetRunTree(TList *fl){ |
1822 |
|
// |
1823 |
TChain *R = new TChain("Run"); |
// |
1824 |
|
// |
1825 |
|
if ( run_tree ){ |
1826 |
|
printf("WARNING: TChain *PamLevel2::GetRunTree(TList *fl) -- run_tree already exists!\n "); |
1827 |
|
return run_tree; |
1828 |
|
}; |
1829 |
|
// |
1830 |
|
TChain *R = new TChain("Run"); |
1831 |
|
|
1832 |
// loop over files and create chains |
// loop over files and create chains |
1833 |
TIter next(fl); |
TIter next(fl); |
1839 |
R->Add(name); |
R->Add(name); |
1840 |
}; |
}; |
1841 |
} |
} |
1842 |
|
|
1843 |
|
if(R->GetNtrees()){ |
1844 |
|
|
1845 |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
1846 |
cout << "Run : set branch address RunInfo"<<endl; |
cout << "Run : set branch address RunInfo"<<endl; |
1847 |
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
1848 |
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
1849 |
|
}else{ |
1850 |
|
delete R; |
1851 |
|
R=0; |
1852 |
|
} |
1853 |
|
|
1854 |
|
run_tree = R; |
1855 |
|
|
1856 |
return R; |
return R; |
1857 |
|
|
1858 |
} |
} |
1866 |
* @return Pointer to a TTree |
* @return Pointer to a TTree |
1867 |
*/ |
*/ |
1868 |
TTree *PamLevel2::GetRunTree(TFile *f){ |
TTree *PamLevel2::GetRunTree(TFile *f){ |
1869 |
|
if ( run_tree ){ |
1870 |
|
printf("WARNING: TTree *PamLevel2::GetRunTree(TFile *f) -- run_tree already exists!\n "); |
1871 |
|
return run_tree; |
1872 |
|
}; |
1873 |
|
|
1874 |
|
|
1875 |
|
cout << "TTree *PamLevel2::GetRunTree(TFile *f) -- obsolte "<<endl; |
1876 |
|
|
1877 |
TTree *R = (TTree*)f->Get("Run"); |
TTree *T = (TTree*)f->Get("Run"); |
|
|
|
|
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
|
|
cout << "Run : set branch address RunInfo"<<endl; |
|
|
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
|
|
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
|
1878 |
|
|
1879 |
return R; |
if(T){ |
1880 |
|
T->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
1881 |
|
cout << "Run : set branch address RunInfo"<<endl; |
1882 |
|
T->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
1883 |
|
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
1884 |
|
} |
1885 |
|
|
1886 |
|
run_tree = (TChain*)T; |
1887 |
|
|
1888 |
|
return T; |
1889 |
|
|
1890 |
} |
} |
1891 |
/** |
/** |
1893 |
* @param run Pointer to the chain/tree which contains run infos |
* @param run Pointer to the chain/tree which contains run infos |
1894 |
* @return true if a new run has been read, false if it is still the same run |
* @return true if a new run has been read, false if it is still the same run |
1895 |
*/ |
*/ |
1896 |
Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev){ |
Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev){ |
1897 |
// |
// |
1898 |
// check if we have already called once GetEntry, if not call it |
// check if we have already called once GetEntry, if not call it |
1899 |
// |
// |
1900 |
if ( run->GetEntries() <= 0 ) return(false); |
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev) --- NON FUNZIONA BENISSIMO.... "<<endl; |
1901 |
|
if(!run){ |
1902 |
|
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing RunInfo tree "<<endl; |
1903 |
|
return(false); |
1904 |
|
} |
1905 |
|
if ( run->GetEntries() <= 0 ) return(false); |
1906 |
// |
// |
1907 |
Int_t oldrun = irun; |
|
1908 |
if ( irun < 0 ){ |
// Int_t oldrun = irun; |
1909 |
irun = 0; |
Long64_t oldrun = irun; |
1910 |
run->GetEntry(0); |
|
1911 |
runfirstentry = 0ULL; |
// -------------------------------------- |
1912 |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS) - 1ULL; |
// if it is a full file (not preselected) |
1913 |
|
// -------------------------------------- |
1914 |
|
if(SELLI==0){ |
1915 |
|
|
1916 |
|
// |
1917 |
|
// the absolute time is necessary to relate the event with the run |
1918 |
|
// |
1919 |
|
if( !GetOrbitalInfo() ){ |
1920 |
|
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl; |
1921 |
|
return(false); |
1922 |
|
} |
1923 |
|
|
1924 |
|
// |
1925 |
|
// the first time the routine is called, set run search from the beginning |
1926 |
|
// |
1927 |
|
if ( irun < 0LL ){ |
1928 |
|
irun = 0LL; |
1929 |
|
run->GetEntry(irun); |
1930 |
|
runfirstentry = 0LL; |
1931 |
|
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
1932 |
|
if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL; |
1933 |
|
}; |
1934 |
|
// |
1935 |
|
if ( irun == run->GetEntries()-1LL && |
1936 |
|
!(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && |
1937 |
|
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) |
1938 |
|
){ |
1939 |
|
irun = -1LL; |
1940 |
|
runfirstentry = 0LL; |
1941 |
|
runlastentry = -1LL; |
1942 |
|
}; |
1943 |
|
// modificato il controllo sull'aggiornamento del run, per evitare problemi |
1944 |
|
// dovuti agli eventi annidati (NB! NEVENTS conta anche questi!!) |
1945 |
|
// |
1946 |
|
bool fromfirst = true; |
1947 |
|
// |
1948 |
|
while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries()-1LL ){ |
1949 |
|
// while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
1950 |
|
irun++; |
1951 |
|
run->GetEntry(irun); |
1952 |
|
runfirstentry = runlastentry; |
1953 |
|
if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runfirstentry += 1LL; |
1954 |
|
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
1955 |
|
// cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
1956 |
|
// cout << "runfirstentry "<<runfirstentry<<endl; |
1957 |
|
// printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); |
1958 |
|
// printf(" abstime %u trailertime %u \n",GetOrbitalInfo()->absTime,GetRunInfo()->RUNTRAILER_TIME); |
1959 |
|
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
1960 |
|
// |
1961 |
|
// prevshift = 0; |
1962 |
|
// |
1963 |
|
if ( irun == (Long64_t)(run->GetEntries()-1LL) && fromfirst && !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME)){ |
1964 |
|
printf(" resetting irun (it should NOT happen!!!)\n"); |
1965 |
|
fromfirst = false; |
1966 |
|
irun = 0; |
1967 |
|
run->GetEntry(irun); |
1968 |
|
runfirstentry = 0ULL; |
1969 |
|
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
1970 |
|
if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL; |
1971 |
|
}; |
1972 |
|
// |
1973 |
|
}; |
1974 |
|
// |
1975 |
|
if ( |
1976 |
|
!(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && |
1977 |
|
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) |
1978 |
|
) { |
1979 |
|
printf(" Something very wrong here: cannot find RUN containing absolute time %u \n",GetOrbitalInfo()->absTime); |
1980 |
|
return false; |
1981 |
|
} |
1982 |
|
// |
1983 |
|
if ( irun == oldrun || irun >= run->GetEntries() ) return(false); |
1984 |
|
// |
1985 |
|
// printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry); |
1986 |
|
// |
1987 |
|
prevshift = 0; |
1988 |
|
cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
1989 |
|
// cout << "runfirstentry "<<runfirstentry<<endl; |
1990 |
|
return(true); |
1991 |
}; |
}; |
1992 |
while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
// ---------------------------------------------------- |
1993 |
// printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); |
// if it is a preselected file (there is SelectionList) |
1994 |
irun++; |
// NBNB - the event tree MUST be read first |
1995 |
run->GetEntry(irun); |
// ---------------------------------------------------- |
1996 |
runfirstentry = runlastentry+1ULL; |
if(SELLI==1){ |
1997 |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS); |
sel_tree->GetEntry(iev); |
1998 |
}; |
// cout << irun << " "<< irunentry << endl; |
1999 |
// |
if(irun != oldrun){ |
2000 |
if ( irun == oldrun || irun >= run->GetEntries() ) return(false); |
run->GetEntry(irun); |
2001 |
// |
cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
2002 |
// printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry); |
prevshift = 0; |
2003 |
// |
return true; |
2004 |
return(true); |
} |
2005 |
|
return false; |
2006 |
|
} |
2007 |
|
|
2008 |
|
return false; |
2009 |
// |
// |
2010 |
}; |
}; |
2011 |
|
|
2012 |
|
Bool_t PamLevel2::UpdateRunInfo(Long64_t iev){ |
2013 |
|
|
2014 |
|
if(!run_tree){ |
2015 |
|
cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree not loaded"<<endl; |
2016 |
|
return false; |
2017 |
|
} |
2018 |
|
if ( run_tree->GetEntries() <= 0 ) { |
2019 |
|
cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree is empty"<<endl; |
2020 |
|
return(false); |
2021 |
|
} |
2022 |
|
|
2023 |
|
Int_t oldrun = irun; // store current run index |
2024 |
|
|
2025 |
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
2026 |
|
// if it is a full file (not preselected) |
2027 |
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
2028 |
|
if(SELLI==0){ |
2029 |
|
|
2030 |
|
// --------------------------------------------------------------- |
2031 |
|
// the absolute time is necessary to relate the event with the run |
2032 |
|
// --------------------------------------------------------------- |
2033 |
|
if( !GetOrbitalInfo() ){ |
2034 |
|
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- ERROR -- missing OrbitalInfo "<<endl; |
2035 |
|
return(false); |
2036 |
|
} |
2037 |
|
|
2038 |
|
// ----------------------------------------------------------------------- |
2039 |
|
// the first time the routine is called, set run search from the beginning |
2040 |
|
// ----------------------------------------------------------------------- |
2041 |
|
if ( irun < 0 ){ |
2042 |
|
irun = 0LL; |
2043 |
|
irunentry = 0; |
2044 |
|
prevshift = 0; |
2045 |
|
run_tree->GetEntry(irun); |
2046 |
|
}; |
2047 |
|
// |
2048 |
|
bool fromfirst = true; // first loop over runs |
2049 |
|
|
2050 |
|
// Bool_t hasfrag = false; |
2051 |
|
// if( GetRunInfo()->ID_RUN_FRAG!=0 && GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID)hasfrag=true; |
2052 |
|
// ULong64_t fragid = GetRunInfo()->ID_RUN_FRAG; |
2053 |
|
|
2054 |
|
// ------------------------------------------------------ |
2055 |
|
// loop over runs to find the one that contains the event |
2056 |
|
// ------------------------------------------------------ |
2057 |
|
while ( |
2058 |
|
( |
2059 |
|
( |
2060 |
|
!(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
2061 |
|
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && |
2062 |
|
!(GetOrbitalInfo()->OBT >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
2063 |
|
GetOrbitalInfo()->OBT <= GetRunInfo()->RUNTRAILER_OBT) |
2064 |
|
) |
2065 |
|
|| GetRunInfo()->NEVENTS==0 |
2066 |
|
|| !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) |
2067 |
|
) |
2068 |
|
&& irun < run_tree->GetEntries() ){ |
2069 |
|
|
2070 |
|
irun++; |
2071 |
|
// ------------------------------------ |
2072 |
|
// if the end of run tree is reached... |
2073 |
|
// ------------------------------------ |
2074 |
|
if( irun == run_tree->GetEntries() ){ |
2075 |
|
if(!fromfirst){ |
2076 |
|
// ----------------------------------------------------- |
2077 |
|
// if it happened already once and the run was not found |
2078 |
|
// ---> exit with error |
2079 |
|
// ----------------------------------------------------- |
2080 |
|
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- ERROR -- event entry #"<<iev<<" does not belong to any run (should not happen)" <<endl; |
2081 |
|
return false; |
2082 |
|
} |
2083 |
|
// ----------------------------------------- |
2084 |
|
// ...otherwise repeat search from beginning |
2085 |
|
// ----------------------------------------- |
2086 |
|
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- reached end of run tree. searchin again from beginning " <<endl; |
2087 |
|
fromfirst = false; |
2088 |
|
irun = 0LL; |
2089 |
|
runfirstentry = 0LL; |
2090 |
|
} |
2091 |
|
// ------------------------------------------------------------------- |
2092 |
|
// save the index of the first entry of the run, relative to pam_tree, |
2093 |
|
// and read a new run |
2094 |
|
// ------------------------------------------------------------------- |
2095 |
|
if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift; |
2096 |
|
irunentry = 0; |
2097 |
|
prevshift = 0; |
2098 |
|
run_tree->GetEntry(irun); |
2099 |
|
if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){ |
2100 |
|
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<<irun<<" has RUNHEADER_OBT>=RUNTRAILER_OBT " <<endl; |
2101 |
|
cout << " (NB!! in this case some events are assigned to a wrong run)"<<endl; |
2102 |
|
} |
2103 |
|
// if(hasfrag && fragid != GetRunInfo()->ID){ |
2104 |
|
// cout << "... where is the next fragment ??"<<endl; |
2105 |
|
// } |
2106 |
|
}; |
2107 |
|
|
2108 |
|
|
2109 |
|
// -------------------------------------- |
2110 |
|
// if there was no need to update the run |
2111 |
|
// ---> exit with FALSE |
2112 |
|
// -------------------------------------- |
2113 |
|
if ( irun == oldrun ) return(false); |
2114 |
|
|
2115 |
|
// -------------------------------------- |
2116 |
|
// ... otherwise |
2117 |
|
// ---> exit with TRUE |
2118 |
|
// -------------------------------------- |
2119 |
|
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
2120 |
|
// ---------------------------------------------------- |
2121 |
|
// then check if the run has a fragment |
2122 |
|
// in this case we have to switch to the next fragment |
2123 |
|
// when the end of the first fragment is reached |
2124 |
|
// ---------------------------------------------------- |
2125 |
|
if( |
2126 |
|
GetRunInfo()->ID_RUN_FRAG != 0 && |
2127 |
|
// GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID && |
2128 |
|
true ){ |
2129 |
|
cout << "* fragment *"<<endl; |
2130 |
|
} |
2131 |
|
|
2132 |
|
return(true); |
2133 |
|
}; |
2134 |
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
2135 |
|
// if it is a preselected file (there is SelectionList) |
2136 |
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
2137 |
|
if(SELLI==1){ |
2138 |
|
sel_tree->GetEntry(iev); |
2139 |
|
if(irun != oldrun){ |
2140 |
|
run_tree->GetEntry(irun); |
2141 |
|
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
2142 |
|
prevshift = 0; |
2143 |
|
return true; |
2144 |
|
} |
2145 |
|
return false; |
2146 |
|
} |
2147 |
|
|
2148 |
|
return false; |
2149 |
|
// |
2150 |
|
}; |
2151 |
/** |
/** |
2152 |
* Update the runinfo informations (to be used to have Run infos event by event basis) |
* Update the runinfo informations (to be used to have Run infos event by event basis) |
2153 |
* @param run Pointer to the chain/tree which contains run infos |
* @param run Pointer to the chain/tree which contains run infos |
2154 |
* @return true if a new run has been read, false if it is still the same run |
* @return true if a new run has been read, false if it is still the same run |
2155 |
*/ |
*/ |
2156 |
Bool_t PamLevel2::UpdateRunInfo(TTree *run, ULong64_t iev){ |
Bool_t PamLevel2::UpdateRunInfo(TTree *run, Long64_t iev){ |
2157 |
return(UpdateRunInfo((TChain*)run,iev)); |
return(UpdateRunInfo((TChain*)run,iev)); |
2158 |
}; |
}; |
2159 |
|
|
2168 |
void PamLevel2::SetWhichTrees(TString detlist){ |
void PamLevel2::SetWhichTrees(TString detlist){ |
2169 |
|
|
2170 |
if(detlist.IsNull() || detlist.Contains("+ALL", TString::kIgnoreCase)){ |
if(detlist.IsNull() || detlist.Contains("+ALL", TString::kIgnoreCase)){ |
2171 |
|
CAL0 = false; |
2172 |
CAL1 = true; |
CAL1 = true; |
2173 |
CAL2 = true; |
CAL2 = true; |
2174 |
TRK2 = true; |
TRK2 = true; |
2175 |
TRK1 = false; |
TRK1 = false; |
2176 |
TRKh = false; |
TRKh = false; |
2177 |
|
TRK0 = false; |
2178 |
TRG = true; |
TRG = true; |
2179 |
TOF = true; |
TOF = true; |
2180 |
|
TOF0 = false; |
2181 |
S4 = true; |
S4 = true; |
2182 |
ND = true; |
ND = true; |
2183 |
AC = true; |
AC = true; |
2184 |
ORB = true; |
ORB = true; |
2185 |
}else if( detlist.Contains("-ALL", TString::kIgnoreCase) ){ |
}else if( detlist.Contains("-ALL", TString::kIgnoreCase) ){ |
2186 |
|
CAL0 = false; |
2187 |
CAL1 = false; |
CAL1 = false; |
2188 |
CAL2 = false; |
CAL2 = false; |
2189 |
TRK2 = false; |
TRK2 = false; |
2190 |
TRK1 = false; |
TRK1 = false; |
2191 |
TRKh = false; |
TRKh = false; |
2192 |
|
TRK0 = false; |
2193 |
TRG = false; |
TRG = false; |
2194 |
TOF = false; |
TOF = false; |
2195 |
|
TOF0 = false; |
2196 |
S4 = false; |
S4 = false; |
2197 |
ND = false; |
ND = false; |
2198 |
AC = false; |
AC = false; |
2204 |
if ( detlist.Contains("-CAL1", TString::kIgnoreCase) )CAL1=false; |
if ( detlist.Contains("-CAL1", TString::kIgnoreCase) )CAL1=false; |
2205 |
if ( detlist.Contains("+CAL1", TString::kIgnoreCase) )CAL1=true; |
if ( detlist.Contains("+CAL1", TString::kIgnoreCase) )CAL1=true; |
2206 |
}; |
}; |
2207 |
|
|
2208 |
|
if( detlist.Contains("CAL0", TString::kIgnoreCase) ){ |
2209 |
|
if ( detlist.Contains("-CAL0", TString::kIgnoreCase) )CAL0=false; |
2210 |
|
if ( detlist.Contains("+CAL0", TString::kIgnoreCase) )CAL0=true; |
2211 |
|
}; |
2212 |
|
|
2213 |
if( detlist.Contains("CAL2", TString::kIgnoreCase)){ |
if( detlist.Contains("CAL2", TString::kIgnoreCase)){ |
2214 |
if ( detlist.Contains("-CAL2", TString::kIgnoreCase) )CAL2=false; |
if ( detlist.Contains("-CAL2", TString::kIgnoreCase) )CAL2=false; |
2221 |
CAL1=false; |
CAL1=false; |
2222 |
} |
} |
2223 |
// ------------------------------------------------------------------------- |
// ------------------------------------------------------------------------- |
2224 |
|
if( detlist.Contains("TRK0", TString::kIgnoreCase) ){ |
2225 |
|
if ( detlist.Contains("-TRK0", TString::kIgnoreCase) )TRK0=false; |
2226 |
|
if ( detlist.Contains("+TRK0", TString::kIgnoreCase) )TRK0=true; |
2227 |
|
}; |
2228 |
|
|
2229 |
if( detlist.Contains("TRK1", TString::kIgnoreCase) ){ |
if( detlist.Contains("TRK1", TString::kIgnoreCase) ){ |
2230 |
if ( detlist.Contains("-TRK1", TString::kIgnoreCase) )TRK1=false; |
if ( detlist.Contains("-TRK1", TString::kIgnoreCase) )TRK1=false; |
2231 |
if ( detlist.Contains("+TRK1", TString::kIgnoreCase) )TRK1=true; |
if ( detlist.Contains("+TRK1", TString::kIgnoreCase) )TRK1=true; |
2254 |
|
|
2255 |
if( detlist.Contains("-TOF", TString::kIgnoreCase) )TOF = false; |
if( detlist.Contains("-TOF", TString::kIgnoreCase) )TOF = false; |
2256 |
else if( detlist.Contains("+TOF", TString::kIgnoreCase) )TOF = true; |
else if( detlist.Contains("+TOF", TString::kIgnoreCase) )TOF = true; |
2257 |
|
|
2258 |
|
if( detlist.Contains("-TOF0", TString::kIgnoreCase) )TOF0 = false; |
2259 |
|
else if( detlist.Contains("+TOF0", TString::kIgnoreCase) )TOF0 = true; |
2260 |
|
|
2261 |
if( detlist.Contains("-S4", TString::kIgnoreCase) )S4 = false; |
if( detlist.Contains("-S4", TString::kIgnoreCase) )S4 = false; |
2262 |
else if( detlist.Contains("+S4", TString::kIgnoreCase) )S4 = true; |
else if( detlist.Contains("+S4", TString::kIgnoreCase) )S4 = true; |
2291 |
* Set tree/branch detector flags from the content of a tree |
* Set tree/branch detector flags from the content of a tree |
2292 |
*/ |
*/ |
2293 |
void PamLevel2::GetWhichTrees(TFile* f){ |
void PamLevel2::GetWhichTrees(TFile* f){ |
2294 |
|
|
2295 |
|
|
2296 |
|
|
2297 |
|
cout << "void PamLevel2::GetWhichTrees(TFile* f) --- WARNING!! --- ...potrebbe non funzionare "<<endl; |
2298 |
// ----------- |
// ----------- |
2299 |
// reset flags |
// reset flags |
2300 |
// ----------- |
// ----------- |
2466 |
|
|
2467 |
Bool_t RUN__ok = false; |
Bool_t RUN__ok = false; |
2468 |
|
|
2469 |
|
Bool_t SELLI__ok = false; |
2470 |
|
|
2471 |
cout << "Checking file: "<<name<<endl; |
cout << "Checking file: "<<name<<endl; |
2472 |
TFile *f = new TFile(name.Data()); |
TFile *f = new TFile(name.Data()); |
2483 |
|
|
2484 |
while( (key = (TKey*)next()) ){ |
while( (key = (TKey*)next()) ){ |
2485 |
|
|
2486 |
|
// cout << key->GetName() << endl; |
2487 |
// cout << key->GetName() << ""<<key->GetClassName()<<endl; |
// cout << key->GetName() << ""<<key->GetClassName()<<endl; |
2488 |
// cout << " Get tree: " << f->Get(key->GetName())<<endl; |
// cout << " Get tree: " << f->Get(key->GetName())<<endl; |
2489 |
// nev_previous = nev; |
// nev_previous = nev; |
2494 |
// return false; |
// return false; |
2495 |
// }; |
// }; |
2496 |
|
|
2497 |
|
|
2498 |
if( !strcmp(key->GetName(),"Run" ) )RUN__ok = true; |
if( !strcmp(key->GetName(),"Run" ) )RUN__ok = true; |
2499 |
|
|
2500 |
//========================================================= |
//========================================================= |
2501 |
|
if( !strcmp(key->GetName(),"SelectionList" ) ){ |
2502 |
|
SELLI__ok = true; |
2503 |
|
if(SELLI==1){ |
2504 |
|
Int_t nevt = ((TTree*)f->Get("SelectionList"))->GetEntries(); |
2505 |
|
if( nev && nevt!=nev){ |
2506 |
|
cout << "File: "<< f->GetName() <<" discarded ---- SelectionList tree has "<<nevt<<" events instead of "<<nev<< endl; |
2507 |
|
return false; |
2508 |
|
} |
2509 |
|
nev=nevt; |
2510 |
|
} |
2511 |
|
} |
2512 |
|
|
2513 |
|
//========================================================= |
2514 |
if( !strcmp(key->GetName(),"Trigger" ) ){ |
if( !strcmp(key->GetName(),"Trigger" ) ){ |
2515 |
TRG__ok = true; |
TRG__ok = true; |
2516 |
if(TRG){ |
if(TRG){ |
2622 |
}; |
}; |
2623 |
|
|
2624 |
}; |
}; |
2625 |
|
|
2626 |
|
if( SELLI==-1 )SELLI = (Int_t)SELLI__ok; |
2627 |
|
if( SELLI==0 && SELLI__ok ){ |
2628 |
|
cout << "File: "<< f->GetName() <<" discarded ---- found SelectionList (it is not a full-event file)" << endl; |
2629 |
|
return false; |
2630 |
|
} |
2631 |
|
if( SELLI==1 && !SELLI__ok ){ |
2632 |
|
cout << "File: "<< f->GetName() <<" discarded ---- SelectionList missing" << endl; |
2633 |
|
return false; |
2634 |
|
} |
2635 |
|
|
2636 |
|
// cout << "SELLI "<<SELLI<<endl; |
2637 |
|
|
2638 |
// cout<< "CheckLevel2File(TString): detector list --> "; |
// cout<< "CheckLevel2File(TString): detector list --> "; |
2639 |
// if(TRK1__ok)cout<<"TRK1 "; |
// if(TRK1__ok)cout<<"TRK1 "; |
2640 |
// if(TRK2__ok)cout<<"TRK2 "; |
// if(TRK2__ok)cout<<"TRK2 "; |
2743 |
cout << "Create clones of PAMELA trees "<<endl; |
cout << "Create clones of PAMELA trees "<<endl; |
2744 |
|
|
2745 |
Int_t i=0; |
Int_t i=0; |
2746 |
tree_clone[i] = fChain->GetTree()->CloneTree(0); |
pam_tree_clone[i] = fChain->GetTree()->CloneTree(0); |
2747 |
TString name = tree_clone[i]->GetName(); |
TString name = pam_tree_clone[i]->GetName(); |
2748 |
name.Append("_clone"); |
name.Append("_clone"); |
2749 |
// tree_clone[i]->SetName(name.Data()); |
// pam_tree_clone[i]->SetName(name.Data()); |
2750 |
cout << tree_clone[i]->GetName() <<endl; |
cout << pam_tree_clone[i]->GetName() <<endl; |
2751 |
i++; |
i++; |
2752 |
|
|
2753 |
TList *li = fChain->GetListOfFriends(); |
TList *li = fChain->GetListOfFriends(); |
2757 |
while( (T_friend = (TFriendElement*)next()) ){ |
while( (T_friend = (TFriendElement*)next()) ){ |
2758 |
// cout<<T_friend->IsA()->GetName()<<" "<<T_friend->GetName()<<hex << T_friend->GetTree() << dec<<endl; |
// cout<<T_friend->IsA()->GetName()<<" "<<T_friend->GetName()<<hex << T_friend->GetTree() << dec<<endl; |
2759 |
// cout<<T_friend->GetTree()->GetName()<< endl; |
// cout<<T_friend->GetTree()->GetName()<< endl; |
2760 |
tree_clone[i] = T_friend->GetTree()->CloneTree(0); |
pam_tree_clone[i] = T_friend->GetTree()->CloneTree(0); |
2761 |
tree_clone[i]->SetAutoSave(1000000); |
pam_tree_clone[i]->SetAutoSave(1000000); |
2762 |
name = tree_clone[i]->GetName(); |
name = pam_tree_clone[i]->GetName(); |
2763 |
name.Append("_clone"); |
name.Append("_clone"); |
2764 |
// tree_clone[i]->SetName(name.Data()); |
// pam_tree_clone[i]->SetName(name.Data()); |
2765 |
cout << tree_clone[i]->GetName() << endl; |
cout << pam_tree_clone[i]->GetName() << endl; |
2766 |
i++; |
i++; |
2767 |
} |
} |
2768 |
|
|
2777 |
*/ |
*/ |
2778 |
void PamLevel2::CreateCloneTrees(TFile *ofile){ |
void PamLevel2::CreateCloneTrees(TFile *ofile){ |
2779 |
|
|
2780 |
|
|
2781 |
|
// if the pointer is null, create a default file |
2782 |
|
|
2783 |
|
if(!ofile){ |
2784 |
|
cout << "void PamLevel2::CreateCloneTrees(TFile*) -- WARNING -- Creating file: clone-tree.root "<<endl; |
2785 |
|
ofile = new TFile("clone-tree.root","recreate"); |
2786 |
|
} |
2787 |
|
|
2788 |
ofile->cd(); |
ofile->cd(); |
2789 |
|
|
2790 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
2791 |
cout << "Create new PAMELA trees "<<endl; |
cout << "Create new PAMELA trees "<<endl; |
2792 |
|
|
|
Int_t i=0; |
|
2793 |
|
|
2794 |
|
run_tree_clone = new TTree("Run","PAMELA Level2 data from the GL_RUN table "); |
2795 |
|
run_tree_clone->Branch("RunInfo","GL_RUN",GetPointerTo("RunInfo")); |
2796 |
|
cout << "Run : branch RunInfo"<<endl; |
2797 |
|
run_tree_clone->Branch("SoftInfo","SoftInfo",GetPointerTo("SoftInfo")); |
2798 |
|
cout << "Run : branch SoftInfo"<<endl; |
2799 |
|
// ------------------ |
2800 |
|
// replicate run tree |
2801 |
|
// ------------------ |
2802 |
|
cout << "----------------------------------------------------"<<endl; |
2803 |
|
cout << "irun\t | RUN\t NEVENTS\t absolute time"<<endl; |
2804 |
|
for (Int_t i=0; i<run_tree->GetEntries(); i++){ |
2805 |
|
run_tree->GetEntry(i); |
2806 |
|
cout << i<< "\t | "<<GetRunInfo()->ID<<"\t "<<GetRunInfo()->NEVENTS<< "\t "<<GetRunInfo()->RUNHEADER_TIME<<" <---> "<<GetRunInfo()->RUNTRAILER_TIME<<endl; |
2807 |
|
run_tree_clone->Fill(); |
2808 |
|
} |
2809 |
|
cout << "----------------------------------------------------"<<endl; |
2810 |
|
|
2811 |
|
|
2812 |
|
sel_tree_clone = new TTree("SelectionList","List of selected events "); |
2813 |
|
sel_tree_clone->Branch("RunEntry",&irun,"runentry/L"); |
2814 |
|
sel_tree_clone->Branch("EventEntry",&irunentry,"eventry/L"); |
2815 |
|
|
2816 |
|
|
2817 |
|
Int_t i=0; |
2818 |
if(TRK1||TRK2||TRKh){ |
if(TRK1||TRK2||TRKh){ |
2819 |
tree_clone[i] = new TTree("Tracker","PAMELA tracker level2 data "); |
pam_tree_clone[i] = new TTree("Tracker","PAMELA tracker level2 data "); |
2820 |
if(TRK1) { |
if(TRK1) { |
2821 |
tree_clone[i]->Branch("TrkLevel1","TrkLevel1", GetPointerTo("TrkLevel1")); |
pam_tree_clone[i]->Branch("TrkLevel1","TrkLevel1", GetPointerTo("TrkLevel1")); |
2822 |
tree_clone[i]->BranchRef(); |
pam_tree_clone[i]->BranchRef(); |
2823 |
cout << "Tracker : branch TrkLevel1"<<endl; |
cout << "Tracker : branch TrkLevel1"<<endl; |
2824 |
|
// cout << "CreateCloneTrees " << GetTrkLevel1()<<endl; |
2825 |
}; |
}; |
2826 |
if(TRK2) { |
if(TRK2) { |
2827 |
tree_clone[i]->Branch("TrkLevel2", "TrkLevel2",GetPointerTo("TrkLevel2")); |
pam_tree_clone[i]->Branch("TrkLevel2", "TrkLevel2",GetPointerTo("TrkLevel2")); |
2828 |
cout << "Tracker : branch TrkLevel2"<<endl; |
cout << "Tracker : branch TrkLevel2"<<endl; |
2829 |
}; |
}; |
2830 |
if(TRKh) { |
if(TRKh) { |
2831 |
tree_clone[i]->Branch("TrkHough","TrkHough", GetPointerTo("TrkHough")); |
pam_tree_clone[i]->Branch("TrkHough","TrkHough", GetPointerTo("TrkHough")); |
2832 |
cout << "Tracker : branch TrkHough"<<endl; |
cout << "Tracker : branch TrkHough"<<endl; |
2833 |
}; |
}; |
2834 |
i++; |
i++; |
2836 |
|
|
2837 |
// Calorimeter |
// Calorimeter |
2838 |
if(CAL1||CAL2){ |
if(CAL1||CAL2){ |
2839 |
tree_clone[i] = new TTree("Calorimeter","PAMELA calorimeter level2 data "); |
pam_tree_clone[i] = new TTree("Calorimeter","PAMELA calorimeter level2 data "); |
2840 |
if(CAL1) { |
if(CAL1) { |
2841 |
tree_clone[i]->Branch("CaloLevel1", "CaloLevel1", GetPointerTo("CaloLevel1")); |
pam_tree_clone[i]->Branch("CaloLevel1", "CaloLevel1", GetPointerTo("CaloLevel1")); |
2842 |
cout << "Calorimeter : branch CaloLevel1"<<endl; |
cout << "Calorimeter : branch CaloLevel1"<<endl; |
2843 |
}; |
}; |
2844 |
if(CAL2) { |
if(CAL2) { |
2845 |
tree_clone[i]->Branch("CaloLevel2","CaloLevel2", GetPointerTo("CaloLevel2")); |
pam_tree_clone[i]->Branch("CaloLevel2","CaloLevel2", GetPointerTo("CaloLevel2")); |
2846 |
cout << "Calorimeter : branch CaloLevel2"<<endl; |
cout << "Calorimeter : branch CaloLevel2"<<endl; |
2847 |
}; |
}; |
2848 |
i++; |
i++; |
2850 |
|
|
2851 |
// ToF |
// ToF |
2852 |
if(TOF) { |
if(TOF) { |
2853 |
tree_clone[i] = new TTree("ToF","PAMELA ToF level2 data "); |
pam_tree_clone[i] = new TTree("ToF","PAMELA ToF level2 data "); |
2854 |
tree_clone[i]->Branch("ToFLevel2","ToFLevel2", GetPointerTo("ToFLevel2")); |
pam_tree_clone[i]->Branch("ToFLevel2","ToFLevel2", GetPointerTo("ToFLevel2")); |
2855 |
cout << "ToF : branch ToFLevel2"<<endl; |
cout << "ToF : branch ToFLevel2"<<endl; |
2856 |
i++; |
i++; |
2857 |
}; |
}; |
2858 |
// Trigger |
// Trigger |
2859 |
if(TRG) { |
if(TRG) { |
2860 |
tree_clone[i] = new TTree("Trigger","PAMELA trigger level2 data "); |
pam_tree_clone[i] = new TTree("Trigger","PAMELA trigger level2 data "); |
2861 |
tree_clone[i]->Branch("TrigLevel2","TrigLevel2", GetPointerTo("TrigLevel2")); |
pam_tree_clone[i]->Branch("TrigLevel2","TrigLevel2", GetPointerTo("TrigLevel2")); |
2862 |
cout << "Trigger : branch TrigLevel2"<<endl; |
cout << "Trigger : branch TrigLevel2"<<endl; |
2863 |
i++; |
i++; |
2864 |
}; |
}; |
2865 |
// S4 |
// S4 |
2866 |
if(S4) { |
if(S4) { |
2867 |
tree_clone[i] = new TTree("S4","PAMELA S4 level2 data "); |
pam_tree_clone[i] = new TTree("S4","PAMELA S4 level2 data "); |
2868 |
tree_clone[i]->Branch("S4Level2","S4Level2", GetPointerTo("S4Level2")); |
pam_tree_clone[i]->Branch("S4Level2","S4Level2", GetPointerTo("S4Level2")); |
2869 |
cout << "S4 : branch S4Level2"<<endl; |
cout << "S4 : branch S4Level2"<<endl; |
2870 |
i++; |
i++; |
2871 |
}; |
}; |
2872 |
// Neutron Detector |
// Neutron Detector |
2873 |
if(ND) { |
if(ND) { |
2874 |
tree_clone[i] = new TTree("NeutronD","PAMELA neutron detector level2 data "); |
pam_tree_clone[i] = new TTree("NeutronD","PAMELA neutron detector level2 data "); |
2875 |
tree_clone[i]->Branch("NDLevel2","NDLevel2", GetPointerTo("NDLevel2")); |
pam_tree_clone[i]->Branch("NDLevel2","NDLevel2", GetPointerTo("NDLevel2")); |
2876 |
cout << "NeutronD : branch NDLevel2"<<endl; |
cout << "NeutronD : branch NDLevel2"<<endl; |
2877 |
i++; |
i++; |
2878 |
}; |
}; |
2879 |
// Anticounters |
// Anticounters |
2880 |
if(AC) { |
if(AC) { |
2881 |
tree_clone[i] = new TTree("Anticounter","PAMELA anticounter detector level2 data "); |
pam_tree_clone[i] = new TTree("Anticounter","PAMELA anticounter detector level2 data "); |
2882 |
tree_clone[i]->Branch("AcLevel2","AcLevel2", GetPointerTo("AcLevel2")); |
pam_tree_clone[i]->Branch("AcLevel2","AcLevel2", GetPointerTo("AcLevel2")); |
2883 |
cout << "Anticounter : branch AcLevel2"<<endl; |
cout << "Anticounter : branch AcLevel2"<<endl; |
2884 |
i++; |
i++; |
2885 |
}; |
}; |
2886 |
// OrbitalInfo |
// OrbitalInfo |
2887 |
if(ORB) { |
if(ORB) { |
2888 |
tree_clone[i] = new TTree("OrbitalInfo","PAMELA oribital info "); |
pam_tree_clone[i] = new TTree("OrbitalInfo","PAMELA oribital info "); |
2889 |
tree_clone[i]->Branch("OrbitalInfo","OrbitalInfo", GetPointerTo("OrbitalInfo")); |
pam_tree_clone[i]->Branch("OrbitalInfo","OrbitalInfo", GetPointerTo("OrbitalInfo")); |
2890 |
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
2891 |
i++; |
i++; |
2892 |
}; |
}; |
2901 |
*/ |
*/ |
2902 |
//void PamLevel2::FillNewPamTree(TTree *T){ |
//void PamLevel2::FillNewPamTree(TTree *T){ |
2903 |
void PamLevel2::FillCloneTrees(){ |
void PamLevel2::FillCloneTrees(){ |
2904 |
|
|
2905 |
for(Int_t i=0; i<8; i++){ |
// cout << "PamLevel2::FillCloneTrees()" << irunentry << endl; |
2906 |
if(tree_clone[i])tree_clone[i]->Fill(); |
|
2907 |
|
for(Int_t i=0; i<NCLONES; i++){ |
2908 |
|
if(pam_tree_clone[i])pam_tree_clone[i]->Fill(); |
2909 |
} |
} |
2910 |
|
if(sel_tree_clone)sel_tree_clone->Fill(); |
2911 |
|
|
2912 |
} |
} |
2913 |
|
|
2914 |
|
|
2915 |
TTree* PamLevel2::GetCloneTree(TString name){ |
TTree* PamLevel2::GetCloneTree(TString name){ |
2916 |
|
|
2917 |
for(Int_t i=0; i<8; i++){ |
for(Int_t i=0; i<NCLONES; i++){ |
2918 |
if(tree_clone[i]){ |
if(pam_tree_clone[i]){ |
2919 |
TString na = tree_clone[i]->GetName(); |
TString na = pam_tree_clone[i]->GetName(); |
2920 |
if(!name.CompareTo(na))return tree_clone[i]; |
if(!name.CompareTo(na))return pam_tree_clone[i]; |
2921 |
}; |
}; |
2922 |
} |
} |
2923 |
|
if(run_tree_clone){ |
2924 |
|
TString na = run_tree_clone->GetName(); |
2925 |
|
if(!name.CompareTo(na))return run_tree_clone; |
2926 |
|
} |
2927 |
|
if(sel_tree_clone){ |
2928 |
|
TString na = sel_tree_clone->GetName(); |
2929 |
|
if(!name.CompareTo(na))return sel_tree_clone; |
2930 |
|
} |
2931 |
return NULL; |
return NULL; |
2932 |
|
|
2933 |
} |
} |
2934 |
void PamLevel2::WriteCloneTrees(){ |
void PamLevel2::WriteCloneTrees(){ |
2935 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
2936 |
cout << "Write clones of PAMELA trees "<<endl; |
cout << "Write clones of PAMELA trees "<<endl; |
2937 |
for(Int_t i=0; i<8; i++){ |
cout << run_tree_clone->GetName()<<endl; |
2938 |
if(tree_clone[i]){ |
run_tree_clone->Write(); |
2939 |
cout << tree_clone[i]->GetName()<<endl; |
cout << sel_tree_clone->GetName()<<endl; |
2940 |
tree_clone[i]->Write(); |
sel_tree_clone->Write(); |
2941 |
|
for(Int_t i=0; i<NCLONES; i++){ |
2942 |
|
if(pam_tree_clone[i]){ |
2943 |
|
cout << pam_tree_clone[i]->GetName()<<endl; |
2944 |
|
pam_tree_clone[i]->Write(); |
2945 |
}; |
}; |
2946 |
} |
} |
2947 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
2949 |
} |
} |
2950 |
|
|
2951 |
/** |
/** |
2952 |
* Create a new (empty) Pamela trees |
* Method to get level2-trees entry, the corresponding run entry and (if required) the level0 entry. |
2953 |
*/ |
*/ |
2954 |
// TTree* PamLevel2::GetNewPamTree(){ |
//Int_t PamLevel2::GetEntry(Int_t iee){ |
2955 |
|
Int_t PamLevel2::GetEntry(Long64_t iee){ |
2956 |
|
|
2957 |
|
// cout << "-------------------------------------"<<endl; |
2958 |
|
// cout << "Int_t PamLevel2::GetEntry("<<iee<<")"<<endl; |
2959 |
|
|
2960 |
// if(tree_clone)return tree_clone; |
if(!pam_tree){ |
2961 |
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl; |
2962 |
|
return 0; |
2963 |
|
} |
2964 |
|
|
2965 |
// TTree *Tout = 0; |
|
2966 |
|
// |
2967 |
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
// This is a sort of bug: if you don't have the run tree you don't want to exit here you want to have loaded the event anyway... |
2968 |
// cout << "Create new PAMELA trees "<<endl; |
// |
2969 |
|
// if(!run_tree ){ |
2970 |
|
// cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loeaded"<<endl; |
2971 |
|
// return 0; |
2972 |
|
// } |
2973 |
|
|
2974 |
|
Long64_t ii=0; |
2975 |
|
//------------------------------- |
2976 |
|
ii = iee; |
2977 |
|
if( !pam_tree->GetEntry(ii) ){ |
2978 |
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading pam tree"<<endl; |
2979 |
|
return 0; |
2980 |
|
} |
2981 |
|
// |
2982 |
|
// ... that's way I put it here. Notice that nothing change in the code (is backward compatible) since in any case you return with 0. |
2983 |
|
// in theory one would like to return 1 if run is not loaded but now I don't have the will to add that 2 lines of code and it is not |
2984 |
|
// a problem if you don't check the return code of getentry. |
2985 |
|
// |
2986 |
|
if(!run_tree ){ |
2987 |
|
if ( TRK0 || CAL0 || TOF0 || RUN ) { //forse cosi` va bene per tornare 1? |
2988 |
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl; |
2989 |
|
return 0; |
2990 |
|
} else { |
2991 |
|
return 1; //cosi` se non c'e` run esce qua... |
2992 |
|
} |
2993 |
|
} |
2994 |
|
|
2995 |
|
//------------------------------- |
2996 |
|
ii = iee; |
2997 |
|
// Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
2998 |
|
// Bool_t UPDATED = UpdateRunInfo(ii); |
2999 |
|
UpdateRunInfo(ii); |
3000 |
|
if(SELLI==0)irunentry = iee-runfirstentry; |
3001 |
|
// if(UPDATED && run_tree_clone)run_tree_clone->Fill(); |
3002 |
|
|
3003 |
|
// cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl; |
3004 |
|
|
3005 |
|
// cout << "irunentry "<<irunentry << endl; |
3006 |
|
// cout << "runfirstentry "<<runfirstentry << endl; |
3007 |
|
// cout << "nevents "<<GetRunInfo()->NEVENTS<< endl; |
3008 |
|
|
3009 |
|
// if( TRK0 || CAL0 || TOF0 ){ |
3010 |
|
// if( !GetYodaEntry( ) ){ |
3011 |
|
// cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading level0 tree"<<endl; |
3012 |
|
// return 0; |
3013 |
|
// } |
3014 |
|
// } |
3015 |
|
|
3016 |
|
|
3017 |
|
return 1; |
3018 |
|
|
3019 |
|
} |
3020 |
|
|
3021 |
|
TrkLevel0 *PamLevel2::GetTrkLevel0(){ |
3022 |
|
if( !TRK0 )return NULL; |
3023 |
|
if( !GetYodaEntry( ) ){ |
3024 |
|
cout << " Int_t PamLevel2::GetTrkLevel0() -- ERROR -- error reading level0 tree"<<endl; |
3025 |
|
return 0; |
3026 |
|
} |
3027 |
|
return trk0_obj; |
3028 |
|
}; |
3029 |
|
CaloLevel0 *PamLevel2::GetCaloLevel0(){ |
3030 |
|
if( !CAL0 )return NULL; |
3031 |
|
if( !GetYodaEntry( ) ){ |
3032 |
|
cout << " Int_t PamLevel2::GetCaloLevel0() -- ERROR -- error reading level0 tree"<<endl; |
3033 |
|
return 0; |
3034 |
|
} |
3035 |
|
return calo0_obj; |
3036 |
|
}; |
3037 |
|
|
3038 |
|
|
3039 |
|
/** |
3040 |
|
* Method to retrieve the level0 tree (YODA tree) that contains the current event. |
3041 |
|
* Given the run ID (...), if needed it query the DB and load the proper file. |
3042 |
|
* @return Pointer to the tree |
3043 |
|
*/ |
3044 |
|
|
3045 |
|
|
3046 |
|
TTree* PamLevel2::GetYodaTree( ){ |
3047 |
|
|
3048 |
|
// cout << "TTree* PamLevel2::GetYodaTree( )"<<endl; |
3049 |
|
//=================================== |
3050 |
|
// check if iroot has changed |
3051 |
|
//=================================== |
3052 |
|
if( irun<0 ){ |
3053 |
|
cout << "PamLevel2::GetYodaTree() -- ERROR -- irun = "<<irun<<endl; |
3054 |
|
// cout << "In order to use this method you have to first load the RunInfo tree "<<endl; |
3055 |
|
return NULL; |
3056 |
|
} |
3057 |
|
Int_t irootnew = run_obj->ID_ROOT_L0; |
3058 |
|
// cout << "iroot "<<iroot<<endl; |
3059 |
|
// cout << "irootnew "<<irootnew<<endl; |
3060 |
|
|
3061 |
|
//=================================== |
3062 |
|
// load the level0 file |
3063 |
|
// (if not already loaded) |
3064 |
|
//=================================== |
3065 |
|
if( iroot != irootnew || !l0_tree){ |
3066 |
|
iroot = irootnew; |
3067 |
|
//=================================== |
3068 |
|
// open the DB connection |
3069 |
|
// (if not already opened) |
3070 |
|
//=================================== |
3071 |
|
if(!dbc || (dbc && !dbc->IsConnected())){ |
3072 |
|
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
3073 |
|
cout<<"Connecting to DB"<<endl; |
3074 |
|
cout<<"HOST "<<host<<endl; |
3075 |
|
cout<<"USER "<<user<<endl; |
3076 |
|
cout<<"PSW "<<psw<<endl; |
3077 |
|
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
3078 |
|
if( !dbc )return NULL; |
3079 |
|
if( !dbc->IsConnected() )return NULL; |
3080 |
|
// cout<<"...done"<<endl; |
3081 |
|
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
3082 |
|
}else{ |
3083 |
|
// cout<<"DB already connected"<<endl; |
3084 |
|
} |
3085 |
|
GL_ROOT glroot = GL_ROOT(); |
3086 |
|
if( glroot.Query_GL_ROOT(iroot,dbc) ){ |
3087 |
|
cout << "TTree* PamLevel2::GetYodaTree( ) -- ERROR -- level0 file iroot = "<<iroot<< " does not exists"<<endl; |
3088 |
|
return NULL; |
3089 |
|
}; |
3090 |
|
TString filename = glroot.PATH + glroot.NAME; |
3091 |
|
if(l0_file){ |
3092 |
|
l0_file->Close(); |
3093 |
|
l0_file->Delete(); |
3094 |
|
} |
3095 |
|
cout << "Opening LEVEL0 file: "<< filename << endl; |
3096 |
|
FileStat_t t; |
3097 |
|
if( gSystem->GetPathInfo(filename.Data(),t) ){ |
3098 |
|
cout << " PamLevel2::GetYodaTree() -- ERROR opening file "<<endl; |
3099 |
|
return NULL; |
3100 |
|
} |
3101 |
|
l0_file = new TFile(filename); |
3102 |
|
if( !l0_file )return NULL; |
3103 |
|
l0_tree = (TTree*)l0_file->Get("Physics"); |
3104 |
|
if(!h0_obj)h0_obj = new EventHeader(); |
3105 |
|
l0_tree->SetBranchAddress("Header" ,&h0_obj); |
3106 |
|
prevshift = 0; |
3107 |
|
//--------------------------------------------------- |
3108 |
|
// TRACKER: |
3109 |
|
if(TRK0){ |
3110 |
|
if(!trk0_obj){ |
3111 |
|
trk0_obj = new TrkLevel0(); |
3112 |
|
trk0_obj->Set(); |
3113 |
|
}; |
3114 |
|
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
3115 |
|
} |
3116 |
|
//-------------------------------------------------- |
3117 |
|
// CALORIMETER: |
3118 |
|
if(CAL0){ |
3119 |
|
if(!calo0_obj){ |
3120 |
|
calo0_obj = new CaloLevel0(); |
3121 |
|
calo0_obj->Set(); |
3122 |
|
}; |
3123 |
|
l0_tree->SetBranchAddress("Calorimeter" ,calo0_obj->GetPointerToCalorimeterEvent()); |
3124 |
|
// cout << "PamLevel2::GetYodaTree() --- level0 calorimeter not implemented "<<endl; |
3125 |
|
} |
3126 |
|
//--------------------------------------------------- |
3127 |
|
// TOF: |
3128 |
|
if(TOF0){ |
3129 |
|
cout << "PamLevel2::GetYodaTree() --- level0 TOF not implemented "<<endl; |
3130 |
|
} |
3131 |
|
|
3132 |
|
}; |
3133 |
|
|
3134 |
|
if(!dbc || (dbc && !dbc->IsConnected())){ |
3135 |
|
cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl; |
3136 |
|
} |
3137 |
|
|
3138 |
|
if ( TRK0 ){ |
3139 |
|
TrkParams::Load(6); |
3140 |
|
if( !TrkParams::IsLoaded(6) ){ |
3141 |
|
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- VK-mask not loaded"<<endl; |
3142 |
|
}; |
3143 |
|
TrkParams::SetCalib(run_obj,dbc); |
3144 |
|
TrkParams::LoadCalib( ); |
3145 |
|
if( !TrkParams::CalibIsLoaded() ){ |
3146 |
|
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- Calibration not loaded"<<endl; |
3147 |
|
}; |
3148 |
|
} |
3149 |
|
|
3150 |
|
// cout << l0_tree << endl; |
3151 |
|
|
3152 |
|
return l0_tree; |
3153 |
|
|
3154 |
|
} |
3155 |
|
|
3156 |
|
/** |
3157 |
|
* Method to retrieve the level0 tree (YODA tree) that contains the current event. |
3158 |
|
*/ |
3159 |
|
Int_t PamLevel2::GetYodaEntry(){ |
3160 |
|
|
3161 |
|
// cout << "Int_t PamLevel2::GetYodaEntry()"<<endl; |
3162 |
|
if(!GetYodaTree())return 0; |
3163 |
|
|
3164 |
// if(TRK1||TRK2||TRKh){ |
// patch |
3165 |
// TTree *T = new TTree("Tracker_clone","PAMELA tracker level2 data "); |
if( irunentry < 0){ |
3166 |
// if(TRK1) { |
// cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl; |
3167 |
// trk1_clone = new TrkLevel1(); |
irunentry=0LL; |
3168 |
// T->Branch("TrkLevel1","TrkLevel1", &trk1_clone); |
} |
3169 |
// T->BranchRef(); |
// --------------------------------- |
3170 |
// cout << "Tracker : branch TrkLevel1"<<endl; |
// if file is NOT a preselected file |
3171 |
// }; |
// --------------------------------- |
3172 |
// if(TRK2) { |
Long64_t quellagiusta = irunentry + (Long64_t)(run_obj->EV_FROM); |
3173 |
// trk2_clone = new TrkLevel2(); |
// cout << " irunentry "<<irunentry<<endl; |
3174 |
// T->Branch("TrkLevel2", "TrkLevel2",&trk2_clone); |
// cout << " EV_FROM "<<run_obj->EV_FROM<<endl; |
3175 |
// cout << "Tracker : branch TrkLevel2"<<endl; |
// cout << " quellagiusta = irunentry + EV_FROM "<< quellagiusta << endl; |
3176 |
// }; |
|
3177 |
// if(TRKh) { |
// cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl; |
3178 |
// trkh_clone = new TrkHough(); |
// cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl; |
3179 |
// T->Branch("TrkHough","TrkHough", &trkh_clone); |
// cout << " time "<< GetOrbitalInfo()->absTime << endl; |
3180 |
// cout << "Tracker : branch TrkHough"<<endl; |
// cout << " trk_calib_used "<<run_obj->TRK_CALIB_USED<< endl; |
3181 |
// }; |
|
3182 |
// if(!Tout)Tout=T; |
if( !GetOrbitalInfo() ){ |
3183 |
// else Tout->AddFriend("Tracker_clone"); |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl; |
3184 |
// } |
return 0; |
3185 |
|
} |
3186 |
|
if( GetOrbitalInfo()->OBT==0 && GetOrbitalInfo()->pkt_num==0 ){ |
3187 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- level2 event corrupted ?? "<<endl; |
3188 |
|
return 0; |
3189 |
|
} |
3190 |
|
|
3191 |
// // Calorimeter |
// --------------------------------------------------------------------- |
3192 |
// if(CAL1||CAL2){ |
// ATTENTION!!! |
3193 |
// TTree *C = new TTree("Calorimeter_clone","PAMELA calorimeter level2 data "); |
// If data are not pre-processed with cleaner, the level0 tree may contain |
3194 |
// if(CAL1) { |
// spurious nested physics packets. |
3195 |
// calo1_clone = new CaloLevel1(); |
// The GL_RUN variables EV_FROM, EV_TO and NEVENTS counts also these entries |
3196 |
// C->Branch("CaloLevel1", "CaloLevel1", &calo1_clone); |
// while level2 tree DOES NOT!! |
3197 |
// cout << "Calorimeter : branch CaloLevel1"<<endl; |
// This means that "quellagiusta" in these cases is not correct. |
3198 |
// }; |
// In order to retrieve the correct level0 event, I implemented a check |
3199 |
// if(CAL2) { |
// of the OBT and pkt-number. In case of mismatch, the level0 entry number |
3200 |
// calo2_clone = new CaloLevel2(); |
// is shift forward until when the packets match. |
3201 |
// C->Branch("CaloLevel2","CaloLevel2", &calo2_clone); |
// --------------------------------------------------------------------- |
3202 |
// cout << "Calorimeter : branch CaloLevel2"<<endl; |
Int_t answer = 0; |
3203 |
// }; |
Int_t shift =0; |
3204 |
// if(!Tout)Tout=C; |
// printf(" siamo qui %i %i \n",shift,prevshift); |
3205 |
// else Tout->AddFriend("Calorimeter_clone"); |
Int_t maxshift = 10; |
3206 |
// } |
do{ |
3207 |
|
if(shift>0){ |
3208 |
// // ToF |
cout << " PKTNUM L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
3209 |
// if(TOF) { |
cout << " RUN: ID "<< GetRunInfo()->ID << " ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<" ID_RUN_FRAG "<<GetRunInfo()->ID_RUN_FRAG << " EV_FROM "<<GetRunInfo()->EV_FROM <<endl; |
3210 |
// TTree *O = new TTree("ToF_clone","PAMELA ToF level2 data "); |
cout << " L2 <--> L0 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" prevshift "<<prevshift<<" )"<<endl; |
3211 |
// tof_clone = new ToFLevel2(); |
} |
3212 |
// O->Branch("ToFLevel2","ToFLevel2", &tof_clone); |
answer = l0_tree->GetEntry(quellagiusta+(Long64_t)shift+(Long64_t)prevshift); |
3213 |
// cout << "ToF : branch ToFLevel2"<<endl; |
shift++; |
3214 |
// if(!Tout)Tout=O; |
if( !GetEventHeader() ){ |
3215 |
// else Tout->AddFriend("ToF_clone"); |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl; |
3216 |
// }; |
return 0; |
3217 |
// // Trigger |
} |
3218 |
// if(TRG) { |
// cout << "PKTNUM "<<shift<<" == L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
3219 |
// TTree *R = new TTree("Trigger_clone","PAMELA trigger level2 data "); |
// cout << " L2 --- "<< GetOrbitalInfo()->OBT << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime()<<endl; |
3220 |
// trig_clone = new TrigLevel2(); |
// if( (quellagiusta+shift) == l0_tree->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl; |
3221 |
// R->Branch("TrigLevel2","TrigLevel2", &trig_clone); |
// cout << " GetOrbitalInfo()->OBT "<< GetOrbitalInfo()->OBT << endl; |
3222 |
// cout << "Trigger : branch TrigLevel2"<<endl; |
// cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl; |
3223 |
// if(!Tout)Tout=R; |
// cout << " GetOrbitalInfo()->pkt_num "<< GetOrbitalInfo()->pkt_num << endl; |
3224 |
// else Tout->AddFriend("Trigger_clone"); |
// cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
3225 |
// }; |
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
3226 |
// // S4 |
// |
3227 |
// if(S4) { |
if ( prevshift != 0 && (quellagiusta+(Long64_t)shift) == GetYodaTree()->GetEntries() ){ |
3228 |
// TTree *S = new TTree("S4_clone","PAMELA S4 level2 data "); |
prevshift = 0; |
3229 |
// s4_clone = new S4Level2(); |
shift = -1; |
3230 |
// S->Branch("S4Level2","S4Level2", &s4_clone); |
}; |
|
// cout << "S4 : branch S4Level2"<<endl; |
|
|
// if(!Tout)Tout=S; |
|
|
// else Tout->AddFriend("S4_clone"); |
|
|
// }; |
|
|
// // Neutron Detector |
|
|
// if(ND) { |
|
|
// TTree *N = new TTree("NeutronD_clone","PAMELA neutron detector level2 data "); |
|
|
// nd_clone = new NDLevel2(); |
|
|
// N->Branch("NDLevel2","NDLevel2", &nd_clone); |
|
|
// cout << "NeutronD : branch NDLevel2"<<endl; |
|
|
// if(!Tout)Tout=N; |
|
|
// else Tout->AddFriend("NeutronD_clone"); |
|
|
// }; |
|
|
// // Anticounters |
|
|
// if(AC) { |
|
|
// TTree *A = new TTree("Anticounter_clone","PAMELA anticounter detector level2 data "); |
|
|
// ac_clone = new AcLevel2(); |
|
|
// A->Branch("AcLevel2","AcLevel2", &ac_clone); |
|
|
// cout << "Anticounter : branch AcLevel2"<<endl; |
|
|
// if(!Tout)Tout=A; |
|
|
// else Tout->AddFriend("Anticounter_clone"); |
|
|
// }; |
|
|
// // OrbitalInfo |
|
|
// if(ORB) { |
|
|
// TTree *B = new TTree("OrbitalInfo_clone","PAMELA oribital info "); |
|
|
// orb_clone = new OrbitalInfo(); |
|
|
// B->Branch("OrbitalInfo","OrbitalInfo", &orb_clone); |
|
|
// cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
|
|
// if(!Tout)Tout=B; |
|
|
// else Tout->AddFriend("OrbitalInfo_clone"); |
|
|
// }; |
|
|
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
|
3231 |
|
|
3232 |
// tree_clone = Tout; |
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() && shift < maxshift); |
|
// tree_clone->SetDirectory(0); |
|
3233 |
|
|
3234 |
// return Tout; |
if ( (quellagiusta+(Long64_t)shift+(Long64_t)prevshift) > GetYodaTree()->GetEntries() || shift == maxshift ) { |
3235 |
// } |
cout << " Big trouble here, no such event in Level0 data! " <<endl; |
3236 |
// /** |
return 0; |
3237 |
// * Fill a tree (created with GetNewPamTree) |
} |
3238 |
// * |
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
3239 |
// */ |
// return GetYodaTree()->GetEntry(quellagiusta); |
3240 |
// //void PamLevel2::FillNewPamTree(TTree *T){ |
if ( shift > 1 ) prevshift += (shift-1); |
3241 |
// void PamLevel2::FillNewPamTree(){ |
|
3242 |
|
return answer; |
3243 |
|
|
3244 |
|
} |
3245 |
|
/** |
3246 |
|
* \Brief Set DB connection |
3247 |
|
*/ |
3248 |
|
Bool_t PamLevel2::SetDBConnection(){ |
3249 |
|
|
3250 |
// if(trk1_clone) *trk1_clone = *trk1_obj; |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
3251 |
// if(trk2_clone){ |
cout<<"Connecting to DB"<<endl; |
3252 |
// trk2_clone->Clear(); |
cout<<"HOST "<<host<<endl; |
3253 |
// trk2_obj->Copy(*trk2_clone); |
cout<<"USER "<<user<<endl; |
3254 |
// // *trk2_clone = *trk2_obj; |
cout<<"PSW "<<psw<<endl; |
3255 |
// } |
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
3256 |
// if(trkh_clone) *trkh_clone = *trkh_obj; |
if( !dbc )return false; |
3257 |
// if(calo1_clone){ |
if( !dbc->IsConnected() )return false; |
3258 |
// // *calo1_clone = *calo1_obj; |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
3259 |
// calo1_clone->Clear(); |
return true; |
|
// calo1_obj->Copy(*calo1_clone); |
|
|
// } |
|
|
// if(calo2_clone){ |
|
|
// // *calo2_clone = *calo2_obj; |
|
|
// calo2_clone->Clear(); |
|
|
// calo2_obj->Copy(*calo2_clone); |
|
|
// } |
|
|
// if(tof_clone) *tof_clone = *tof_obj; |
|
|
// if(trig_clone) *trig_clone = *trig_obj; |
|
|
// if(s4_clone) *s4_clone = *s4_obj; |
|
|
// if(nd_clone) *nd_clone = *nd_obj; |
|
|
// if(ac_clone) *ac_clone = *ac_obj; |
|
|
// if(orb_clone) *orb_clone = *orb_obj; |
|
|
|
|
|
// TTree *T = tree_clone; |
|
|
|
|
|
// T->Fill(); //fill main tree |
|
|
// // cout<<T->IsA()->GetName()<<" "<<T->GetName()<<endl; |
|
|
// TList *li = T->GetListOfFriends(); |
|
|
// TIter next(li); |
|
|
// TFriendElement* T_friend=0; |
|
|
// while( (T_friend = (TFriendElement*)next()) ){ |
|
|
// // cout<<T_friend->IsA()->GetName()<<" "<<T_friend->GetName()<<hex << T_friend->GetTree() << dec<<endl; |
|
|
// T_friend->GetTree()->Fill();//fill friends |
|
|
// } |
|
3260 |
|
|
3261 |
// } |
} |