36 |
*/ |
*/ |
37 |
PamLevel2::PamLevel2(){ |
PamLevel2::PamLevel2(){ |
38 |
|
|
39 |
trk_l1_obj = this->TrkLevel1::GetTrkLevel1(); |
trk2_obj = TrkLevel2::GetTrkLevel2(); |
40 |
trk_obj = this->TrkLevel2::GetTrkLevel2(); |
trk1_obj = TrkLevel1::GetTrkLevel1(); |
41 |
calo_obj = this->CaloLevel2::GetCaloLevel2(); |
trkh_obj = TrkHough::GetTrkHough(); |
42 |
tof_obj = this->ToFLevel2::GetToFLevel2(); |
calo1_obj = CaloLevel1::GetCaloLevel1(); |
43 |
trig_obj = this->TrigLevel2::GetTrigLevel2(); |
calo2_obj = CaloLevel2::GetCaloLevel2(); |
44 |
s4_obj = this->S4Level2::GetS4Level2(); |
tof_obj = ToFLevel2::GetToFLevel2(); |
45 |
nd_obj = this->NDLevel2::GetNDLevel2(); |
trig_obj = TrigLevel2::GetTrigLevel2(); |
46 |
ac_obj = this->AcLevel2::GetAcLevel2(); |
s4_obj = S4Level2::GetS4Level2(); |
47 |
orb_obj = this->OrbitalInfo::GetOrbitalInfo(); |
nd_obj = NDLevel2::GetNDLevel2(); |
48 |
|
ac_obj = AcLevel2::GetAcLevel2(); |
49 |
|
orb_obj = OrbitalInfo::GetOrbitalInfo(); |
50 |
|
|
51 |
run_obj = new GL_RUN(); |
run_obj = new GL_RUN(); |
52 |
|
|
53 |
|
// trk1_clone = 0; |
54 |
|
// trk2_clone = 0; |
55 |
|
// trkh_clone = 0; |
56 |
|
// calo1_clone = 0; |
57 |
|
// calo2_clone = 0; |
58 |
|
// tof_clone = 0; |
59 |
|
// trig_clone = 0; |
60 |
|
// s4_clone = 0; |
61 |
|
// nd_clone = 0; |
62 |
|
// ac_clone = 0; |
63 |
|
// orb_clone = 0; |
64 |
|
|
65 |
|
// T_clone = 0; |
66 |
|
// C_clone = 0; |
67 |
|
// O_clone = 0; |
68 |
|
// R_clone = 0; |
69 |
|
// S_clone = 0; |
70 |
|
// N_clone = 0; |
71 |
|
// A_clone = 0; |
72 |
|
// B_clone = 0; |
73 |
|
|
74 |
|
for(Int_t i=0; i<8; i++ )tree_clone[i]=NULL; |
75 |
|
|
76 |
sorted_tracks = new TRefArray(); |
sorted_tracks = new TRefArray(); |
77 |
|
|
78 |
CAL = true; |
CAL1 = true; |
79 |
TRK = true; |
CAL2 = true; |
80 |
|
TRK2 = true; |
81 |
|
TRK1 = false; |
82 |
|
TRKh = false; |
83 |
TRG = true; |
TRG = true; |
84 |
TOF = true; |
TOF = true; |
85 |
S4 = true; |
S4 = true; |
87 |
AC = true; |
AC = true; |
88 |
ORB = true; |
ORB = true; |
89 |
|
|
90 |
TRK_L1 = false; |
RUN = true; |
91 |
|
|
|
Tout = NULL; |
|
92 |
}; |
}; |
93 |
/** |
/** |
94 |
* Destructor |
* Destructor |
95 |
*/ |
*/ |
96 |
PamLevel2::~PamLevel2(){ |
PamLevel2::~PamLevel2(){ |
|
|
|
|
TrkLevel1::Clear(); |
|
|
|
|
|
TrkLevel2::Clear(); |
|
|
CaloLevel2::Clear(); |
|
|
ToFLevel2::Clear(); |
|
|
TrigLevel2::Clear(); |
|
|
S4Level2::Clear(); |
|
|
NDLevel2::Clear(); |
|
|
AcLevel2::Clear(); |
|
|
OrbitalInfo::Clear(); |
|
|
|
|
97 |
delete run_obj; |
delete run_obj; |
98 |
|
Clear(); |
|
// delete sorted_tracks; |
|
|
sorted_tracks->Delete(); // clean the reference array |
|
|
|
|
|
if(Tout)Tout->Delete(); // delete loaded tree from memory |
|
|
|
|
99 |
}; |
}; |
100 |
/** |
/** |
101 |
* Clear the event |
* Clear the event |
112 |
NDLevel2::Clear(); |
NDLevel2::Clear(); |
113 |
AcLevel2::Clear(); |
AcLevel2::Clear(); |
114 |
OrbitalInfo::Clear(); |
OrbitalInfo::Clear(); |
115 |
|
|
116 |
|
// if(trk1_clone)trk1_clone->Clear(); |
117 |
|
// if(trk2_clone)trk2_clone->Clear(); |
118 |
|
// if(trkh_clone)trkh_clone->Clear(); |
119 |
|
// if(calo1_clone)calo1_clone->Clear(); |
120 |
|
// if(calo2_clone)calo2_clone->Clear(); |
121 |
|
// if(tof_clone)tof_clone->Clear(); |
122 |
|
// if(trig_clone)trig_clone->Clear(); |
123 |
|
// if(s4_clone)s4_clone->Clear(); |
124 |
|
// if(nd_clone)nd_clone->Clear(); |
125 |
|
// if(ac_clone)ac_clone->Clear(); |
126 |
|
// if(orb_clone)orb_clone->Clear(); |
127 |
|
|
128 |
sorted_tracks->Delete(); // clean the reference array |
sorted_tracks->Delete(); // clean the reference array |
129 |
|
|
134 |
// |
// |
135 |
// |
// |
136 |
//-------------------------------------- |
//-------------------------------------- |
137 |
|
void *PamLevel2::GetPointerTo(const char* c ){ |
138 |
|
|
139 |
|
TString objname = c; |
140 |
|
if(!objname.CompareTo("TrkLevel1"))return &trk1_obj; |
141 |
|
if(!objname.CompareTo("TrkLevel2"))return &trk2_obj; |
142 |
|
if(!objname.CompareTo("TrkHough"))return &trkh_obj; |
143 |
|
if(!objname.CompareTo("CaloLevel1"))return &calo1_obj; |
144 |
|
if(!objname.CompareTo("CaloLevel2"))return &calo2_obj; |
145 |
|
if(!objname.CompareTo("ToFLevel2"))return &tof_obj; |
146 |
|
if(!objname.CompareTo("TrigLevel2"))return &trig_obj; |
147 |
|
if(!objname.CompareTo("S4Level2"))return &s4_obj; |
148 |
|
if(!objname.CompareTo("NDLevel2"))return &nd_obj; |
149 |
|
if(!objname.CompareTo("AcLevel2"))return &ac_obj; |
150 |
|
if(!objname.CompareTo("OrbitalInfo"))return &orb_obj; |
151 |
|
if(!objname.CompareTo("RunInfo"))return &run_obj; |
152 |
|
return NULL; |
153 |
|
}; |
154 |
|
//-------------------------------------- |
155 |
|
// |
156 |
|
// |
157 |
|
//-------------------------------------- |
158 |
/** |
/** |
159 |
* Retrieves the calorimeter track matching the seqno-th tracker stored track. |
* Retrieves the calorimeter track matching the seqno-th tracker stored track. |
160 |
* (If seqno = -1 retrieves the self-trigger calorimeter track) |
* (If seqno = -1 retrieves the self-trigger calorimeter track) |
224 |
CaloTrkVar *c = 0; |
CaloTrkVar *c = 0; |
225 |
ToFTrkVar *o = 0; |
ToFTrkVar *o = 0; |
226 |
|
|
227 |
if(CAL) c = GetCaloStoredTrack(t->GetSeqNo()); |
if(CAL2) c = GetCaloStoredTrack(t->GetSeqNo()); |
228 |
if(TOF) o = GetToFStoredTrack(t->GetSeqNo()); |
if(TOF) o = GetToFStoredTrack(t->GetSeqNo()); |
229 |
|
|
230 |
// if(t && c && o)track = new PamTrack(t,c,o); |
// if(t && c && o)track = new PamTrack(t,c,o); |
267 |
* Sort physical (tracker) tracks and stores them in the TRefArray (of TrkTrack objects) which pointer is PamLevel2::sorted_tracks. |
* Sort physical (tracker) tracks and stores them in the TRefArray (of TrkTrack objects) which pointer is PamLevel2::sorted_tracks. |
268 |
* @param how String to set the sorting cryterium (es: "CAL" or "TRK+CAL+TOF" ecc...). |
* @param how String to set the sorting cryterium (es: "CAL" or "TRK+CAL+TOF" ecc...). |
269 |
* Sorting cryteria: |
* Sorting cryteria: |
270 |
* TRK: lower chi**2 |
* TRK: lower chi**2 |
271 |
* CAL: lower Y spatial residual on the first calorimeter plane |
* CAL: lower Y spatial residual on the first calorimeter plane |
272 |
* TOF: bigger numebr of hit PMTs along the track, on S12 S21 S32 (where paddles are along the Y axis). |
* TOF: bigger numebr of hit PMTs along the track, on S12 S21 S32 (where paddles are along the Y axis). |
273 |
* The default sorting cryterium is "TOF+CAL". |
* The default sorting cryterium is "TOF+CAL". |
276 |
*/ |
*/ |
277 |
void PamLevel2::SortTracks(TString how){ |
void PamLevel2::SortTracks(TString how){ |
278 |
|
|
279 |
|
// cout << "call SortTracs() "<<endl; |
280 |
//Save current Object count |
//Save current Object count |
281 |
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
282 |
|
|
283 |
|
// cout << "ObjectNumber "<<ObjectNumber <<endl; |
284 |
|
|
285 |
sorted_tracks->Delete(); //temporaneo??? |
sorted_tracks->Delete(); //temporaneo??? |
286 |
|
|
289 |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
290 |
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
291 |
|
|
292 |
if( !CAL && use_CAL) use_CAL = false; |
if( !CAL2 && use_CAL) use_CAL = false; |
293 |
if( !TOF && use_TOF) use_TOF = false; |
if( !TOF && use_TOF) use_TOF = false; |
294 |
|
|
295 |
if( !TRK ){ |
if( !TRK2 ){ |
296 |
cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
// cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
297 |
return; |
return; |
298 |
}; |
}; |
299 |
|
|
300 |
|
// cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl; |
301 |
|
|
302 |
for(Int_t i=0; i < TrkLevel2::GetNTracks(); i++){ |
for(Int_t i=0; i < TrkLevel2::GetNTracks(); i++){ |
303 |
|
|
305 |
|
|
306 |
// get tracker tracks |
// get tracker tracks |
307 |
TrkTrack *tp = TrkLevel2::GetTrack(i); //tracker |
TrkTrack *tp = TrkLevel2::GetTrack(i); //tracker |
|
// CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); |
|
|
// ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); |
|
308 |
CaloTrkVar *cp = 0; |
CaloTrkVar *cp = 0; |
309 |
ToFTrkVar *op = 0; |
ToFTrkVar *op = 0; |
310 |
|
|
311 |
|
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
312 |
// if track has an image, check image selection |
// if track has an image, check image selection |
313 |
if(tp->HasImage()){ |
if(tp->HasImage()){ |
314 |
|
|
315 |
TrkTrack *ti = TrkLevel2::GetTrackImage(i); //tracker (image) |
TrkTrack *ti = TrkLevel2::GetTrackImage(i); //tracker (image) |
|
// CaloTrkVar *ci = GetCaloStoredTrack(ti->GetSeqNo()); |
|
|
// ToFTrkVar *oi = GetToFStoredTrack(ti->GetSeqNo()); |
|
316 |
CaloTrkVar *ci = 0; |
CaloTrkVar *ci = 0; |
317 |
ToFTrkVar *oi = 0; |
ToFTrkVar *oi = 0; |
318 |
|
|
319 |
|
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
320 |
|
|
321 |
//assign starting scores |
//assign starting scores |
322 |
Int_t tp_score = 0; //main track sorted by the tracker |
Int_t tp_score = 0; //main track sorted by the tracker |
323 |
Int_t ti_score = 0; //image track |
Int_t ti_score = 0; //image track |
332 |
npcfit[1] > 15 && //no. of fit planes on Y view |
npcfit[1] > 15 && //no. of fit planes on Y view |
333 |
varcfit[1] < 1000. && //fit variance on Y view |
varcfit[1] < 1000. && //fit variance on Y view |
334 |
true){ |
true){ |
335 |
|
|
336 |
cp = GetCaloStoredTrack(tp->GetSeqNo()); |
cp = GetCaloStoredTrack(tp->GetSeqNo()); |
337 |
ci = GetCaloStoredTrack(ti->GetSeqNo()); |
ci = GetCaloStoredTrack(ti->GetSeqNo()); |
338 |
|
|
341 |
|
|
342 |
if(resy_p <= resy_i) tp_score++; |
if(resy_p <= resy_i) tp_score++; |
343 |
else ti_score++; |
else ti_score++; |
344 |
|
|
345 |
|
// cout << "CALO "<<tp_score<<ti_score<<endl; |
346 |
|
|
347 |
}; |
}; |
348 |
// ------------------------ |
// ------------------------ |
349 |
// TOF check |
// TOF check |
381 |
if( nphit_p >= nphit_i) tp_score++; |
if( nphit_p >= nphit_i) tp_score++; |
382 |
else ti_score++; |
else ti_score++; |
383 |
}; |
}; |
384 |
|
// cout << "TOF "<<tp_score<<ti_score<<endl; |
385 |
}; |
}; |
386 |
if(tp_score == ti_score) use_TRK = true; |
if(tp_score == ti_score) use_TRK = true; |
387 |
// ------------------------ |
// ------------------------ |
393 |
if(use_TRK){ |
if(use_TRK){ |
394 |
if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
395 |
else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
396 |
|
// cout << "TRK "<<tp_score<<ti_score<<endl; |
397 |
}; |
}; |
398 |
|
|
399 |
// ------------------------ |
// ------------------------ |
411 |
ts = tp; |
ts = tp; |
412 |
}; |
}; |
413 |
|
|
414 |
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
415 |
sorted_tracks->Add(ts);//save the track in the sorted array |
sorted_tracks->Add(ts);//save the track in the sorted array |
416 |
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
417 |
|
|
418 |
}; |
}; |
419 |
//Restore Object count |
//Restore Object count |
431 |
* This method overrides TrkLevel2::GetTracks(), where sorting is done by decreasing number of fit points and increasing chi^2. |
* This method overrides TrkLevel2::GetTracks(), where sorting is done by decreasing number of fit points and increasing chi^2. |
432 |
* PamLevel2::GetTracks() keeps the same track order given by TrkLevel2::GetTracks(), but checks image selection by using calorimeter and ToF tracking information. |
* PamLevel2::GetTracks() keeps the same track order given by TrkLevel2::GetTracks(), but checks image selection by using calorimeter and ToF tracking information. |
433 |
*/ |
*/ |
434 |
TRefArray *PamLevel2::GetTracks(){ |
TRefArray *PamLevel2::GetTracks(){ |
435 |
// |
|
436 |
// SortTracks("+CAL+TOF"); |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
437 |
SortTracks("+CAL+TRK");//TEMP!!!!!!!!!!!!! |
SortTracks("+CAL+TOF"); |
438 |
// |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
439 |
return sorted_tracks; |
|
440 |
|
return sorted_tracks; |
441 |
}; |
}; |
442 |
//-------------------------------------- |
//-------------------------------------- |
443 |
// |
// |
450 |
*/ |
*/ |
451 |
PamTrack *PamLevel2::GetTrack(int it){ |
PamTrack *PamLevel2::GetTrack(int it){ |
452 |
|
|
453 |
// *-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
454 |
// SortTracks("+CAL+TOF"); |
SortTracks("+CAL+TOF"); |
455 |
SortTracks("+CAL+TRK");//TEMP!!!!!!!!!!!!! |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
456 |
// *-*-*-*-*-*-* |
|
|
|
|
457 |
PamTrack *track = 0; |
PamTrack *track = 0; |
458 |
|
|
459 |
if( it >=0 && it < TrkLevel2::GetNTracks() && it<sorted_tracks->GetEntriesFast() ){ |
if( it >=0 && it < TrkLevel2::GetNTracks() && it<sorted_tracks->GetEntriesFast() ){ |
477 |
*/ |
*/ |
478 |
PamTrack *PamLevel2::GetTrackImage(int it){ |
PamTrack *PamLevel2::GetTrackImage(int it){ |
479 |
|
|
480 |
// SortTracks("+CAL+TOF"); |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
481 |
SortTracks("+CAL+TRK");//TEMP!!!!!!!!!!!!! |
SortTracks("+CAL+TOF"); |
482 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
483 |
PamTrack *image = 0; |
|
484 |
|
PamTrack *image = 0; |
485 |
if( it >=0 && it < TrkLevel2::GetNTracks() ){ |
|
486 |
TrkTrack *temp = (TrkTrack*)sorted_tracks->At(it); |
if( it >=0 && it < TrkLevel2::GetNTracks() ){ |
487 |
if( temp->HasImage() ){ |
TrkTrack *temp = (TrkTrack*)sorted_tracks->At(it); |
488 |
TrkTrack *t = TrkLevel2::GetStoredTrack(temp->GetImageSeqNo()); |
if( temp->HasImage() ){ |
489 |
image = GetPamTrackAlong(t); |
TrkTrack *t = TrkLevel2::GetStoredTrack(temp->GetImageSeqNo()); |
490 |
}else{ |
image = GetPamTrackAlong(t); |
|
cout <<"PamLevel2::GetTrackImage(int) : Track SeqNo "<<it<<" does not have image"<<endl; |
|
|
}; |
|
491 |
}else{ |
}else{ |
492 |
cout << "PamLevel2::GetTrackImage(int) : Tracker track SeqNo "<< it <<" does not exist (GetNTracks() = "<<TrkLevel2::GetNTracks()<<")"<<endl; |
cout <<"PamLevel2::GetTrackImage(int) : Track SeqNo "<<it<<" does not have image"<<endl; |
493 |
}; |
}; |
494 |
|
}else{ |
495 |
|
cout << "PamLevel2::GetTrackImage(int) : Tracker track SeqNo "<< it <<" does not exist (GetNTracks() = "<<TrkLevel2::GetNTracks()<<")"<<endl; |
496 |
|
}; |
497 |
|
|
498 |
return image; |
return image; |
499 |
} |
} |
500 |
|
|
501 |
//-------------------------------------- |
//-------------------------------------- |
508 |
* @param detlist String to select trees to be included |
* @param detlist String to select trees to be included |
509 |
* @return Pointer to a TTree |
* @return Pointer to a TTree |
510 |
*/ |
*/ |
511 |
TTree *PamLevel2::GetPamTree(TFile *f, TString detlist="+ALL"){ |
TTree *PamLevel2::GetPamTree(TFile *f, TString detlist ){ |
512 |
|
|
513 |
// cout << "WARNING!!! -- obsolete method -- \n"; |
// if( !detlist.IsNull() ) SetWhichTrees(detlist); |
514 |
// cout << "better use TChain *PamLevel2::GetPamTree(TList*, TString) \n"; |
// else GetWhichTrees(f); |
|
|
|
|
TTree *Trout =0; |
|
|
|
|
515 |
SetWhichTrees(detlist); |
SetWhichTrees(detlist); |
516 |
|
|
517 |
|
TTree *Trout =0; |
518 |
|
|
519 |
|
TString fname = f->GetName(); |
520 |
|
if(!CheckLevel2File(fname))return NULL; |
521 |
|
|
522 |
|
UInt_t *found=0; |
523 |
|
|
524 |
|
cout<< "GetPamTree(TFile*,TString): detector list --> "; |
525 |
|
if(TRK1)cout<<"TRK1 "; |
526 |
|
if(TRK2)cout<<"TRK2 "; |
527 |
|
if(TRKh)cout<<"TRKH "; |
528 |
|
if(CAL1)cout<<"CAL1 "; |
529 |
|
if(CAL2)cout<<"CAL2 "; |
530 |
|
if(TOF)cout<<"TOF "; |
531 |
|
if(TRG)cout<<"TRG "; |
532 |
|
if(AC)cout<<"AC "; |
533 |
|
if(ND)cout<<"ND "; |
534 |
|
if(S4)cout<<"S4 "; |
535 |
|
if(ORB)cout<<"ORB "; |
536 |
|
cout << endl; |
537 |
|
|
538 |
|
f->cd(); |
539 |
|
|
540 |
// Tracker |
// Tracker |
541 |
TTree *T = (TTree*)f->Get("Tracker"); |
TTree *T = (TTree*)f->Get("Tracker"); |
542 |
if(T && TRK) { |
if(T && (TRK2||TRK1||TRKh)) { |
543 |
if(TRK_L1){ |
if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
544 |
T->SetBranchAddress("TrkLevel1", GetPointerToTrk(1)); |
else T->SetBranchStatus("TrkLevel2",0,found); |
545 |
cout << "Tracker : set branch address TrkLevel1"<<endl; |
if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
546 |
}; |
if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
547 |
T->SetBranchAddress("TrkLevel2", GetPointerToTrk(2)); |
else T->SetBranchStatus("TrkLevel1",0,found); |
548 |
cout << "Tracker : set branch address TrkLevel2"<<endl; |
if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
549 |
Trout=T; |
if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
550 |
|
else T->SetBranchStatus("TrkHough",0,found); |
551 |
|
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
552 |
|
if(!Trout)Trout=T; |
553 |
|
else Trout->AddFriend(T); |
554 |
}else{ |
}else{ |
555 |
cout << "Tracker : missing tree"<<endl; |
cout << "Tracker : missing tree"<<endl; |
556 |
}; |
}; |
557 |
// Calorimeter |
// Calorimeter |
558 |
TTree *C = (TTree*)f->Get("Calorimeter"); |
TTree *C = (TTree*)f->Get("Calorimeter"); |
559 |
if(C && CAL) { |
if(C && (CAL2||CAL1)) { |
560 |
C->SetBranchAddress("CaloLevel2", GetPointerToCalo()); |
if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
561 |
cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
else C->SetBranchStatus("CaloLevel2",0,found); |
562 |
|
if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
563 |
|
if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
564 |
|
else C->SetBranchStatus("CaloLevel1",0,found); |
565 |
|
if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
566 |
if(!Trout)Trout=C; |
if(!Trout)Trout=C; |
567 |
else Trout->AddFriend(C); |
else Trout->AddFriend(C); |
568 |
}else{ |
}else{ |
569 |
cout << "Calorimeter : missing tree"<<endl; |
cout << "Calorimeter : missing tree"<<endl; |
570 |
}; |
}; |
571 |
|
|
572 |
// ToF |
// ToF |
573 |
TTree *O = (TTree*)f->Get("ToF"); |
TTree *O = (TTree*)f->Get("ToF"); |
574 |
if(O && TOF) { |
if(O && TOF) { |
575 |
O->SetBranchAddress("ToFLevel2", GetPointerToToF()); |
O->SetBranchAddress("ToFLevel2", GetPointerTo("ToFLevel2")); |
576 |
cout << "ToF : set branch address ToFLevel2"<<endl; |
cout << "ToF : set branch address ToFLevel2"<<endl; |
577 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
578 |
else Trout->AddFriend(O); |
else Trout->AddFriend(O); |
582 |
// Trigger |
// Trigger |
583 |
TTree *R = (TTree*)f->Get("Trigger"); |
TTree *R = (TTree*)f->Get("Trigger"); |
584 |
if(R && TRG) { |
if(R && TRG) { |
585 |
R->SetBranchAddress("TrigLevel2", GetPointerToTrig()); |
R->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
586 |
cout << "Trigger : set branch address TrigLevel2"<<endl; |
cout << "Trigger : set branch address TrigLevel2"<<endl; |
587 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
588 |
else Trout->AddFriend(R); |
else Trout->AddFriend(R); |
592 |
// S4 |
// S4 |
593 |
TTree *S = (TTree*)f->Get("S4"); |
TTree *S = (TTree*)f->Get("S4"); |
594 |
if(S && S4) { |
if(S && S4) { |
595 |
S->SetBranchAddress("S4Level2", GetPointerToS4()); |
S->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
596 |
cout << "S4 : set branch address S4Level2"<<endl; |
cout << "S4 : set branch address S4Level2"<<endl; |
597 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
598 |
else Trout->AddFriend(S); |
else Trout->AddFriend(S); |
602 |
// Neutron Detector |
// Neutron Detector |
603 |
TTree *N = (TTree*)f->Get("NeutronD"); |
TTree *N = (TTree*)f->Get("NeutronD"); |
604 |
if(N && ND) { |
if(N && ND) { |
605 |
N->SetBranchAddress("NDLevel2", GetPointerToND()); |
N->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
606 |
cout << "NeutronD : set branch address NDLevel2"<<endl; |
cout << "NeutronD : set branch address NDLevel2"<<endl; |
607 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
608 |
else Trout->AddFriend(N); |
else Trout->AddFriend(N); |
612 |
// Anticounters |
// Anticounters |
613 |
TTree *A = (TTree*)f->Get("Anticounter"); |
TTree *A = (TTree*)f->Get("Anticounter"); |
614 |
if(A && AC) { |
if(A && AC) { |
615 |
A->SetBranchAddress("AcLevel2", GetPointerToAc()); |
A->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
616 |
cout << "Anticounter : set branch address AcLevel2"<<endl; |
cout << "Anticounter : set branch address AcLevel2"<<endl; |
617 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
618 |
else Trout->AddFriend(A); |
else Trout->AddFriend(A); |
620 |
cout << "Anticounter : missing tree"<<endl; |
cout << "Anticounter : missing tree"<<endl; |
621 |
}; |
}; |
622 |
// Orbital Info |
// Orbital Info |
623 |
TTree *B = (TTree*)f->Get("OrbitalInfo"); |
TTree *B = (TTree*)f->Get("OrbitalInfo"); |
624 |
if(B && ORB) { |
if(B && ORB) { |
625 |
B->SetBranchAddress("OrbitalInfo", GetPointerToOrb()); |
B->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
626 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
627 |
if(!Trout)Trout=O; |
if(!Trout)Trout=O; |
628 |
else Trout->AddFriend(B); |
else Trout->AddFriend(B); |
629 |
}else{ |
}else{ |
630 |
cout << "OrbitalInfo : missing tree"<<endl; |
cout << "OrbitalInfo : missing tree"<<endl; |
631 |
}; |
}; |
632 |
|
|
633 |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
634 |
|
|
635 |
return Trout; |
return Trout; |
636 |
|
|
637 |
} |
} |
638 |
//-------------------------------------- |
//-------------------------------------- |
662 |
// if no input file list is given: |
// if no input file list is given: |
663 |
if ( flisttxt != "" ){ |
if ( flisttxt != "" ){ |
664 |
|
|
665 |
if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) )return 0; |
if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){ |
666 |
|
cout <<"File "<<flisttxt<<" not found"<<endl; |
667 |
|
return 0; |
668 |
|
} |
669 |
// flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
// flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
670 |
flisttxt = fullpath; |
flisttxt = fullpath; |
671 |
|
|
672 |
if( !gSystem->ChangeDirectory(ddir) )return 0; |
if( !gSystem->ChangeDirectory(ddir) ){ |
673 |
|
cout << "Cannot change directory : "<<ddir<<endl; |
674 |
|
return 0; |
675 |
|
} |
676 |
|
|
677 |
cout <<"Input file list : " << flisttxt <<endl; |
cout <<"Input file list : " << flisttxt <<endl; |
678 |
ifstream in; |
ifstream in; |
679 |
in.open(flisttxt, ios::in); //open input file list |
in.open(flisttxt, ios::in); //open input file list |
680 |
|
int line=0; |
681 |
while (1) { |
while (1) { |
682 |
TString file; |
TString file; |
683 |
in >> file; |
in >> file; |
684 |
if (!in.good()) break; |
if (!in.good()) break; |
685 |
|
line++; |
686 |
|
// cout <<"(1) " << file << endl; |
687 |
|
if(file.IsNull()){ |
688 |
|
cout << "-- list interrupted at line "<<line <<endl; |
689 |
|
break; |
690 |
|
} |
691 |
|
if(file.Contains("#"))file = file(0,file.First("#")); |
692 |
|
// cout <<"(2) " << file << endl; |
693 |
if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
694 |
// contents->Add(new TSystemDirectory(fullpath,ddir)); // add file to the list |
|
|
// contents->Add(new TSystemFile(fullpath,ddir)); // add file to the list |
|
695 |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
696 |
|
|
697 |
}else{ |
}else{ |
698 |
cout << "warning! --- File "<<file<<" does not exists"<< endl; |
// if(file.Data()!="")cout << "File: "<<file<<" ---> missing "<< endl; |
699 |
}; |
}; |
700 |
}; |
}; |
701 |
in.close(); |
in.close(); |
745 |
* @param detlist String to select trees to be included |
* @param detlist String to select trees to be included |
746 |
* @return Pointer to a TChain |
* @return Pointer to a TChain |
747 |
*/ |
*/ |
748 |
TChain *PamLevel2::GetPamTree(TList *fl, TString detlist="+ALL"){ |
TChain *PamLevel2::GetPamTree(TList *fl, TString detlist ){ |
|
|
|
|
// TChain *Tout=0; |
|
|
if(Tout)Tout->Delete(); |
|
|
Tout = NULL; |
|
749 |
|
|
750 |
|
TChain *Trout =0; |
751 |
|
|
752 |
|
// if( !detlist.IsNull() )SetWhichTrees(detlist); |
753 |
SetWhichTrees(detlist); |
SetWhichTrees(detlist); |
754 |
|
|
755 |
|
cout<< "GetPamTree(TList*,TString): detector list --> "; |
756 |
|
if(TRK1)cout<<"TRK1 "; |
757 |
|
if(TRK2)cout<<"TRK2 "; |
758 |
|
if(TRKh)cout<<"TRKH "; |
759 |
|
if(CAL1)cout<<"CAL1 "; |
760 |
|
if(CAL2)cout<<"CAL2 "; |
761 |
|
if(TOF)cout<<"TOF "; |
762 |
|
if(TRG)cout<<"TRG "; |
763 |
|
if(AC)cout<<"AC "; |
764 |
|
if(ND)cout<<"ND "; |
765 |
|
if(S4)cout<<"S4 "; |
766 |
|
if(ORB)cout<<"ORB "; |
767 |
|
cout << endl; |
768 |
|
|
769 |
|
|
770 |
|
|
771 |
TChain *T = 0; |
TChain *T = 0; |
772 |
TChain *C = 0; |
TChain *C = 0; |
773 |
TChain *O = 0; |
TChain *O = 0; |
777 |
TChain *A = 0; |
TChain *A = 0; |
778 |
TChain *B = 0; |
TChain *B = 0; |
779 |
|
|
780 |
if(TRK) T = new TChain("Tracker"); |
if(TRK2||TRK1||TRKh) T = new TChain("Tracker"); |
781 |
if(CAL) C = new TChain("Calorimeter"); |
if(CAL2||CAL1) C = new TChain("Calorimeter"); |
782 |
if(TOF) O = new TChain("ToF"); |
if(TOF) O = new TChain("ToF"); |
783 |
if(TRG) R = new TChain("Trigger"); |
if(TRG) R = new TChain("Trigger"); |
784 |
if(S4) S = new TChain("S4"); |
if(S4) S = new TChain("S4"); |
785 |
if(ND) N = new TChain("NeutronD"); |
if(ND) N = new TChain("NeutronD"); |
786 |
if(AC) A = new TChain("Anticounter"); |
if(AC) A = new TChain("Anticounter"); |
787 |
if(ORB) B = new TChain("OrbitalInfo"); |
if(ORB) B = new TChain("OrbitalInfo"); |
788 |
|
|
789 |
// loop over files and create chains |
// loop over files and create chains |
790 |
TIter next(fl); |
TIter next(fl); |
791 |
TSystemFile *questo = 0; |
TSystemFile *questo = 0; |
792 |
while ( (questo = (TSystemFile*) next()) ) { |
while ( (questo = (TSystemFile*) next()) ) { |
793 |
TString name = questo->GetName(); |
TString name = questo->GetName(); |
794 |
// cout << "File: "<< name << endl; |
// cout << "File: "<< name << endl; |
795 |
if( CheckLevel2File(name) ){ |
if( CheckLevel2File(name) ){ |
796 |
if(TRK) T->Add(name); |
if(TRK2||TRK1||TRKh) T->Add(name); |
797 |
if(CAL) C->Add(name); |
if(CAL1||CAL2) C->Add(name); |
798 |
if(TOF) O->Add(name); |
if(TOF) O->Add(name); |
799 |
if(TRG) R->Add(name); |
if(TRG) R->Add(name); |
800 |
if(S4) S->Add(name); |
if(S4) S->Add(name); |
801 |
if(ND) N->Add(name); |
if(ND) N->Add(name); |
802 |
if(AC) A->Add(name); |
if(AC) A->Add(name); |
803 |
if(ORB) B->Add(name); |
if(ORB) B->Add(name); |
804 |
}; |
}; |
805 |
} |
} |
806 |
|
|
807 |
cout << "done chain \n"; |
cout << "done chain \n"; |
808 |
|
|
809 |
// Tracker |
UInt_t *found=0; |
810 |
if(TRK) if(!Tout)Tout=T; |
// Tracker |
811 |
|
if(T && (TRK2||TRK1||TRKh)) { |
812 |
|
if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
813 |
|
else T->SetBranchStatus("TrkLevel2",0,found); |
814 |
|
if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
815 |
|
if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
816 |
|
else T->SetBranchStatus("TrkLevel1",0,found); |
817 |
|
if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
818 |
|
if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
819 |
|
else T->SetBranchStatus("TrkHough",0,found); |
820 |
|
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
821 |
|
if(!Trout)Trout=T; |
822 |
|
else Trout->AddFriend("Tracker"); |
823 |
|
}else{ |
824 |
|
cout << "Tracker : missing tree"<<endl; |
825 |
|
}; |
826 |
// Calorimeter |
// Calorimeter |
827 |
if(CAL) { |
if(C && (CAL2||CAL1)) { |
828 |
if(!Tout)Tout=C; |
if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
829 |
else Tout->AddFriend("Calorimeter"); |
else C->SetBranchStatus("CaloLevel2",0,found); |
830 |
|
if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
831 |
|
if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
832 |
|
else C->SetBranchStatus("CaloLevel1",0,found); |
833 |
|
if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
834 |
|
if(!Trout)Trout=C; |
835 |
|
else Trout->AddFriend("Calorimeter"); |
836 |
|
}else{ |
837 |
|
cout << "Calorimeter : missing tree"<<endl; |
838 |
}; |
}; |
839 |
// ToF |
// ToF |
840 |
if(TOF) { |
if(O && TOF) { |
841 |
if(!Tout)Tout=O; |
O->SetBranchAddress("ToFLevel2", GetPointerTo("ToFLevel2")); |
842 |
else Tout->AddFriend("ToF"); |
cout << "ToF : set branch address ToFLevel2"<<endl; |
843 |
|
if(!Trout)Trout=O; |
844 |
|
else Trout->AddFriend("ToF"); |
845 |
|
}else{ |
846 |
|
cout << "ToF : missing tree"<<endl; |
847 |
}; |
}; |
848 |
// Trigger |
// Trigger |
849 |
if(TRG) { |
if(R && TRG) { |
850 |
if(!Tout)Tout=O; |
R->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
851 |
else Tout->AddFriend("Trigger"); |
cout << "Trigger : set branch address TrigLevel2"<<endl; |
852 |
|
if(!Trout)Trout=O; |
853 |
|
else Trout->AddFriend("Trigger"); |
854 |
|
}else{ |
855 |
|
cout << "Trigger : missing tree"<<endl; |
856 |
}; |
}; |
857 |
// S4 |
// S4 |
858 |
if(S4) { |
if(S && S4) { |
859 |
if(!Tout)Tout=O; |
S->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
860 |
else Tout->AddFriend("S4"); |
cout << "S4 : set branch address S4Level2"<<endl; |
861 |
|
if(!Trout)Trout=O; |
862 |
|
else Trout->AddFriend("S4"); |
863 |
|
}else{ |
864 |
|
cout << "S4 : missing tree"<<endl; |
865 |
}; |
}; |
866 |
// Neutron Detector |
// Neutron Detector |
867 |
if(ND) { |
if(N && ND) { |
868 |
if(!Tout)Tout=O; |
N->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
869 |
else Tout->AddFriend("NeutronD"); |
cout << "NeutronD : set branch address NDLevel2"<<endl; |
870 |
|
if(!Trout)Trout=O; |
871 |
|
else Trout->AddFriend("NeutronD"); |
872 |
|
}else{ |
873 |
|
cout << "NeutronD : missing tree"<<endl; |
874 |
}; |
}; |
875 |
// Anticounters |
// Anticounters |
876 |
if(AC) { |
if(A && AC) { |
877 |
if(!Tout)Tout=O; |
A->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
878 |
else Tout->AddFriend("Anticounter"); |
cout << "Anticounter : set branch address AcLevel2"<<endl; |
879 |
|
if(!Trout)Trout=O; |
880 |
|
else Trout->AddFriend("Anticounter"); |
881 |
|
}else{ |
882 |
|
cout << "Anticounter : missing tree"<<endl; |
883 |
}; |
}; |
884 |
// OrbitalInfo |
// Orbital Info |
885 |
if(ORB) { |
if(B && ORB) { |
886 |
if(!Tout)Tout=O; |
B->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
887 |
else Tout->AddFriend("OrbitalInfo"); |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
888 |
|
if(!Trout)Trout=O; |
889 |
|
else Trout->AddFriend("OrbitalInfo"); |
890 |
|
}else{ |
891 |
|
cout << "OrbitalInfo : missing tree"<<endl; |
892 |
}; |
}; |
893 |
|
|
894 |
|
// cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
895 |
|
|
896 |
|
|
897 |
|
// // Tracker |
898 |
|
// if(TRK2||TRK1||TRKh){ |
899 |
|
// if(!Tout)Tout=T; |
900 |
|
// else Tout->AddFriend("Tracker"); |
901 |
|
// } |
902 |
|
// // Calorimeter |
903 |
|
// if(CAL2||CAL1) { |
904 |
|
// if(!Tout)Tout=C; |
905 |
|
// else Tout->AddFriend("Calorimeter"); |
906 |
|
// }; |
907 |
|
// // ToF |
908 |
|
// if(TOF) { |
909 |
|
// if(!Tout)Tout=O; |
910 |
|
// else Tout->AddFriend("ToF"); |
911 |
|
// }; |
912 |
|
// // Trigger |
913 |
|
// if(TRG) { |
914 |
|
// if(!Tout)Tout=R; |
915 |
|
// else Tout->AddFriend("Trigger"); |
916 |
|
// }; |
917 |
|
// // S4 |
918 |
|
// if(S4) { |
919 |
|
// if(!Tout)Tout=S; |
920 |
|
// else Tout->AddFriend("S4"); |
921 |
|
// }; |
922 |
|
// // Neutron Detector |
923 |
|
// if(ND) { |
924 |
|
// if(!Tout)Tout=N; |
925 |
|
// else Tout->AddFriend("NeutronD"); |
926 |
|
// }; |
927 |
|
// // Anticounters |
928 |
|
// if(AC) { |
929 |
|
// if(!Tout)Tout=A; |
930 |
|
// else Tout->AddFriend("Anticounter"); |
931 |
|
// }; |
932 |
|
// // OrbitalInfo |
933 |
|
// if(ORB) { |
934 |
|
// if(!Tout)Tout=B; |
935 |
|
// else Tout->AddFriend("OrbitalInfo"); |
936 |
|
// }; |
937 |
|
|
938 |
// cout<<endl<<" Number of entries: "<<Tout->GetEntries()<<endl<<endl; |
// cout<<endl<<" Number of entries: "<<Tout->GetEntries()<<endl<<endl; |
939 |
|
|
940 |
if( Tout->GetEntries() )PamLevel2::SetBranchAddress(); |
// if( Tout->GetEntries() )PamLevel2::SetBranchAddress( Tout ); |
941 |
|
|
942 |
return Tout; |
return Trout; |
943 |
} |
} |
944 |
|
|
945 |
|
|
946 |
|
|
947 |
//-------------------------------------- |
//-------------------------------------- |
948 |
// |
// |
949 |
// |
// |
951 |
/** |
/** |
952 |
* Set branch addresses for Pamela friend trees |
* Set branch addresses for Pamela friend trees |
953 |
*/ |
*/ |
954 |
void PamLevel2::SetBranchAddress(){ |
void PamLevel2::SetBranchAddress(TTree *t){ |
955 |
|
|
956 |
|
TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
957 |
|
TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
958 |
|
TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
959 |
|
CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
960 |
|
CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
961 |
|
TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
962 |
|
TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
963 |
|
S4 = S4 & t->GetBranchStatus("S4Level2"); |
964 |
|
ND = ND & t->GetBranchStatus("NDLevel2"); |
965 |
|
AC = AC & t->GetBranchStatus("AcLevel2"); |
966 |
|
ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
967 |
|
|
968 |
|
|
969 |
// Tracker |
// Tracker |
970 |
if(TRK) { |
if(TRK1) { |
971 |
if(TRK_L1){ |
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel2")); |
972 |
Tout->SetBranchAddress("TrkLevel1", GetPointerToTrk(1)); |
cout << "Tracker : set branch address TrkLevel1"<<endl; |
973 |
cout << "Tracker : set branch address TrkLevel1"<<endl; |
}; |
974 |
}; |
if(TRK2) { |
975 |
Tout->SetBranchAddress("TrkLevel2", GetPointerToTrk(2)); |
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel1")); |
976 |
cout << "Tracker : set branch address TrkLevel2"<<endl; |
cout << "Tracker : set branch address TrkLevel2"<<endl; |
977 |
}; |
}; |
978 |
|
if(TRKh) { |
979 |
|
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
980 |
|
cout << "Tracker : set branch address TrkHough"<<endl; |
981 |
|
}; |
982 |
|
|
983 |
// Calorimeter |
// Calorimeter |
984 |
if(CAL) { |
if(CAL1) { |
985 |
Tout->SetBranchAddress("CaloLevel2", GetPointerToCalo()); |
t->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
986 |
|
cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
987 |
|
}; |
988 |
|
if(CAL2) { |
989 |
|
t->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
990 |
cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
991 |
}; |
}; |
992 |
|
|
993 |
// ToF |
// ToF |
994 |
if(TOF) { |
if(TOF) { |
995 |
Tout->SetBranchAddress("ToFLevel2", GetPointerToToF()); |
t->SetBranchAddress("ToFLevel2", GetPointerTo("ToFLevel2")); |
996 |
cout << "ToF : set branch address ToFLevel2"<<endl; |
cout << "ToF : set branch address ToFLevel2"<<endl; |
997 |
}; |
}; |
998 |
// Trigger |
// Trigger |
999 |
if(TRG) { |
if(TRG) { |
1000 |
Tout->SetBranchAddress("TrigLevel2", GetPointerToTrig()); |
t->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
1001 |
cout << "Trigger : set branch address TrigLevel2"<<endl; |
cout << "Trigger : set branch address TrigLevel2"<<endl; |
1002 |
}; |
}; |
1003 |
// S4 |
// S4 |
1004 |
if(S4) { |
if(S4) { |
1005 |
Tout->SetBranchAddress("S4Level2", GetPointerToS4()); |
t->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
1006 |
cout << "S4 : set branch address S4Level2"<<endl; |
cout << "S4 : set branch address S4Level2"<<endl; |
1007 |
}; |
}; |
1008 |
// Neutron Detector |
// Neutron Detector |
1009 |
if(ND) { |
if(ND) { |
1010 |
Tout->SetBranchAddress("NDLevel2", GetPointerToND()); |
t->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
1011 |
cout << "NeutronD : set branch address NDLevel2"<<endl; |
cout << "NeutronD : set branch address NDLevel2"<<endl; |
1012 |
}; |
}; |
1013 |
// Anticounters |
// Anticounters |
1014 |
if(AC) { |
if(AC) { |
1015 |
Tout->SetBranchAddress("AcLevel2", GetPointerToAc()); |
t->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
1016 |
cout << "Anticounter : set branch address AcLevel2"<<endl; |
cout << "Anticounter : set branch address AcLevel2"<<endl; |
1017 |
}; |
}; |
1018 |
// OrbitalInfo |
// OrbitalInfo |
1019 |
if(ORB) { |
if(ORB) { |
1020 |
Tout->SetBranchAddress("OrbitalInfo", GetPointerToOrb()); |
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
1021 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
1022 |
}; |
}; |
1023 |
|
|
1024 |
} |
} |
1025 |
|
/** |
1026 |
|
* Set branch addresses for Pamela friend trees |
1027 |
|
*/ |
1028 |
|
void PamLevel2::SetBranchAddress(TChain *t){ |
1029 |
|
|
1030 |
//-------------------------------------- |
TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
1031 |
// |
TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
1032 |
// |
TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
1033 |
//-------------------------------------- |
CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
1034 |
void *PamLevel2::GetPointerTo(const char* c ){ |
CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
1035 |
// cout << "objname "<< objname << endl; |
TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
1036 |
TString objname = c; |
TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
1037 |
if(!objname.CompareTo("TrkLevel1"))return &trk_l1_obj; |
S4 = S4 & t->GetBranchStatus("S4Level2"); |
1038 |
if(!objname.CompareTo("TrkLevel2"))return &trk_obj; |
ND = ND & t->GetBranchStatus("NDLevel2"); |
1039 |
|
AC = AC & t->GetBranchStatus("AcLevel2"); |
1040 |
|
ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
1041 |
|
|
1042 |
|
// Tracker |
1043 |
|
if(TRK2) { |
1044 |
|
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
1045 |
|
cout << "Tracker : set branch address TrkLevel2"<<endl; |
1046 |
|
}; |
1047 |
|
if(TRK1) { |
1048 |
|
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
1049 |
|
cout << "Tracker : set branch address TrkLevel1"<<endl; |
1050 |
|
}; |
1051 |
|
if(TRKh) { |
1052 |
|
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
1053 |
|
cout << "Tracker : set branch address TrkHough"<<endl; |
1054 |
|
}; |
1055 |
|
|
1056 |
return NULL; |
// Calorimeter |
1057 |
}; |
if(CAL2) { |
1058 |
|
t->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
1059 |
|
cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
1060 |
|
}; |
1061 |
|
if(CAL1) { |
1062 |
|
t->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
1063 |
|
cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
1064 |
|
}; |
1065 |
|
|
1066 |
|
// ToF |
1067 |
|
if(TOF) { |
1068 |
|
t->SetBranchAddress("ToFLevel2", GetPointerTo("ToFLevel2")); |
1069 |
|
cout << "ToF : set branch address ToFLevel2"<<endl; |
1070 |
|
}; |
1071 |
|
// Trigger |
1072 |
|
if(TRG) { |
1073 |
|
t->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
1074 |
|
cout << "Trigger : set branch address TrigLevel2"<<endl; |
1075 |
|
}; |
1076 |
|
// S4 |
1077 |
|
if(S4) { |
1078 |
|
t->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
1079 |
|
cout << "S4 : set branch address S4Level2"<<endl; |
1080 |
|
}; |
1081 |
|
// Neutron Detector |
1082 |
|
if(ND) { |
1083 |
|
t->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
1084 |
|
cout << "NeutronD : set branch address NDLevel2"<<endl; |
1085 |
|
}; |
1086 |
|
// Anticounters |
1087 |
|
if(AC) { |
1088 |
|
t->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
1089 |
|
cout << "Anticounter : set branch address AcLevel2"<<endl; |
1090 |
|
}; |
1091 |
|
// OrbitalInfo |
1092 |
|
if(ORB) { |
1093 |
|
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
1094 |
|
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
1095 |
|
}; |
1096 |
|
|
1097 |
|
} |
1098 |
|
|
1099 |
|
|
1100 |
//-------------------------------------- |
//-------------------------------------- |
1101 |
// |
// |
1102 |
// |
// |
1121 |
}; |
}; |
1122 |
} |
} |
1123 |
|
|
1124 |
R->SetBranchAddress("RunInfo", GetPointerToRun()); |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
1125 |
cout << "Run : set branch address RunInfo"<<endl; |
cout << "Run : set branch address RunInfo"<<endl; |
1126 |
|
|
1127 |
return R; |
return R; |
1141 |
|
|
1142 |
TTree *R = (TTree*)f->Get("Run"); |
TTree *R = (TTree*)f->Get("Run"); |
1143 |
|
|
1144 |
R->SetBranchAddress("RunInfo", GetPointerToRun()); |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
1145 |
cout << "Run : set branch address RunInfo"<<endl; |
cout << "Run : set branch address RunInfo"<<endl; |
1146 |
|
|
1147 |
return R; |
return R; |
1152 |
// |
// |
1153 |
//-------------------------------------- |
//-------------------------------------- |
1154 |
/** |
/** |
1155 |
* Set which trees should be analysed |
* Set which trees shoul be analysed |
1156 |
* @param detlist TString containing the sequence of trees required |
* @param detlist TString containing the sequence of trees required |
1157 |
*/ |
*/ |
1158 |
void PamLevel2::SetWhichTrees(TString detlist){ |
void PamLevel2::SetWhichTrees(TString detlist){ |
1159 |
|
|
1160 |
if(detlist.Contains("+ALL", TString::kIgnoreCase)){ |
if(detlist.IsNull() || detlist.Contains("+ALL", TString::kIgnoreCase)){ |
1161 |
CAL = true; |
CAL1 = true; |
1162 |
TRK = true; |
CAL2 = true; |
1163 |
TRK_L1 = false; |
TRK2 = true; |
1164 |
|
TRK1 = false; |
1165 |
|
TRKh = false; |
1166 |
TRG = true; |
TRG = true; |
1167 |
TOF = true; |
TOF = true; |
1168 |
S4 = true; |
S4 = true; |
1170 |
AC = true; |
AC = true; |
1171 |
ORB = true; |
ORB = true; |
1172 |
}else if( detlist.Contains("-ALL", TString::kIgnoreCase) ){ |
}else if( detlist.Contains("-ALL", TString::kIgnoreCase) ){ |
1173 |
CAL = false; |
CAL1 = false; |
1174 |
TRK = false; |
CAL2 = false; |
1175 |
TRK_L1 = false; |
TRK2 = false; |
1176 |
|
TRK1 = false; |
1177 |
|
TRKh = false; |
1178 |
TRG = false; |
TRG = false; |
1179 |
TOF = false; |
TOF = false; |
1180 |
S4 = false; |
S4 = false; |
1183 |
ORB = false; |
ORB = false; |
1184 |
}; |
}; |
1185 |
|
|
1186 |
if( detlist.Contains("-CAL", TString::kIgnoreCase) )CAL = false; |
// ------------------------------------------------------------------------- |
1187 |
else if( detlist.Contains("+CAL", TString::kIgnoreCase) )CAL = true; |
if( detlist.Contains("CAL1", TString::kIgnoreCase) ){ |
1188 |
|
if ( detlist.Contains("-CAL1", TString::kIgnoreCase) )CAL1=false; |
1189 |
if( detlist.Contains("-TRK", TString::kIgnoreCase) )TRK = false; |
if ( detlist.Contains("+CAL1", TString::kIgnoreCase) )CAL1=true; |
1190 |
else if( detlist.Contains("+TRK", TString::kIgnoreCase) )TRK = true; |
}; |
1191 |
|
|
1192 |
if( detlist.Contains("-TRK1", TString::kIgnoreCase) )TRK_L1 = false; |
if( detlist.Contains("CAL2", TString::kIgnoreCase)){ |
1193 |
else if( detlist.Contains("+TRK1", TString::kIgnoreCase) )TRK_L1 = true; |
if ( detlist.Contains("-CAL2", TString::kIgnoreCase) )CAL2=false; |
1194 |
|
if ( detlist.Contains("+CAL2", TString::kIgnoreCase) )CAL2=true; |
1195 |
|
}; |
1196 |
|
|
1197 |
|
if( detlist.Contains("+CAL", TString::kIgnoreCase) && !CAL1 && !CAL2 )CAL2=true; |
1198 |
|
if( detlist.Contains("-CAL", TString::kIgnoreCase) && CAL1 && CAL2 ){ |
1199 |
|
CAL2=false; |
1200 |
|
CAL1=false; |
1201 |
|
} |
1202 |
|
// ------------------------------------------------------------------------- |
1203 |
|
if( detlist.Contains("TRK1", TString::kIgnoreCase) ){ |
1204 |
|
if ( detlist.Contains("-TRK1", TString::kIgnoreCase) )TRK1=false; |
1205 |
|
if ( detlist.Contains("+TRK1", TString::kIgnoreCase) )TRK1=true; |
1206 |
|
}; |
1207 |
|
|
1208 |
|
if( detlist.Contains("TRK2", TString::kIgnoreCase)){ |
1209 |
|
if ( detlist.Contains("-TRK2", TString::kIgnoreCase) )TRK2=false; |
1210 |
|
if ( detlist.Contains("+TRK2", TString::kIgnoreCase) )TRK2=true; |
1211 |
|
}; |
1212 |
|
|
1213 |
|
if( detlist.Contains("TRKh", TString::kIgnoreCase)){ |
1214 |
|
if ( detlist.Contains("-TRKh", TString::kIgnoreCase) )TRKh=false; |
1215 |
|
if ( detlist.Contains("+TRKh", TString::kIgnoreCase) )TRKh=true; |
1216 |
|
}; |
1217 |
|
|
1218 |
|
if( detlist.Contains("+TRK", TString::kIgnoreCase) && !TRK1 && !TRK2 && !TRKh )TRK2=true; |
1219 |
|
if( detlist.Contains("-TRK", TString::kIgnoreCase) && TRK1 && TRK2 && TRKh){ |
1220 |
|
TRK2=false; |
1221 |
|
TRK1=false; |
1222 |
|
TRKh=false; |
1223 |
|
} |
1224 |
|
// ------------------------------------------------------------------------- |
1225 |
|
|
1226 |
if( detlist.Contains("-TRG", TString::kIgnoreCase) )TRG = false; |
if( detlist.Contains("-TRG", TString::kIgnoreCase) )TRG = false; |
1227 |
else if( detlist.Contains("+TRG", TString::kIgnoreCase) )TRG = true; |
else if( detlist.Contains("+TRG", TString::kIgnoreCase) )TRG = true; |
1240 |
|
|
1241 |
if( detlist.Contains("-ORB", TString::kIgnoreCase) )ORB = false; |
if( detlist.Contains("-ORB", TString::kIgnoreCase) )ORB = false; |
1242 |
else if( detlist.Contains("+ORB", TString::kIgnoreCase) )ORB = true; |
else if( detlist.Contains("+ORB", TString::kIgnoreCase) )ORB = true; |
1243 |
|
|
1244 |
|
// cout<< "Set detector list --> "; |
1245 |
|
// if(TRK1)cout<<"TRK1 "; |
1246 |
|
// if(TRK2)cout<<"TRK2 "; |
1247 |
|
// if(TRKh)cout<<"TRKH "; |
1248 |
|
// if(CAL1)cout<<"CAL1 "; |
1249 |
|
// if(CAL2)cout<<"CAL2 "; |
1250 |
|
// if(TOF)cout<<"TOF "; |
1251 |
|
// if(TRG)cout<<"TRG "; |
1252 |
|
// if(AC)cout<<"AC "; |
1253 |
|
// if(ND)cout<<"ND "; |
1254 |
|
// if(S4)cout<<"S4 "; |
1255 |
|
// if(ORB)cout<<"ORB "; |
1256 |
|
// cout << endl; |
1257 |
|
|
1258 |
|
}; |
1259 |
|
|
1260 |
|
|
1261 |
|
/** |
1262 |
|
* Set tree/branch detector flags from the content of a tree |
1263 |
|
*/ |
1264 |
|
void PamLevel2::GetWhichTrees(TFile* f){ |
1265 |
|
|
1266 |
|
|
1267 |
|
// ----------- |
1268 |
|
// reset flags |
1269 |
|
// ----------- |
1270 |
|
CAL1 = false; |
1271 |
|
CAL2 = false; |
1272 |
|
TRK2 = false; |
1273 |
|
TRK1 = false; |
1274 |
|
TRKh = false; |
1275 |
|
TRG = false; |
1276 |
|
TOF = false; |
1277 |
|
S4 = false; |
1278 |
|
ND = false; |
1279 |
|
AC = false; |
1280 |
|
ORB = false; |
1281 |
|
|
1282 |
|
RUN = false; |
1283 |
|
|
1284 |
|
cout << "Checking file: "<<f->GetName()<<endl; |
1285 |
|
if( !f || f->IsZombie() ){ |
1286 |
|
cout << "File: "<< f->GetName() <<" Non valid root file"<< endl; |
1287 |
|
return; |
1288 |
|
} |
1289 |
|
|
1290 |
|
TList *lk = f->GetListOfKeys(); |
1291 |
|
TIter next(lk); |
1292 |
|
TKey *key =0; |
1293 |
|
|
1294 |
|
Int_t nev = 0; |
1295 |
|
|
1296 |
|
while( (key = (TKey*)next()) ){ |
1297 |
|
|
1298 |
|
if( !strcmp(key->GetName(),"Run" ) )RUN = true; |
1299 |
|
|
1300 |
|
//========================================================= |
1301 |
|
if( !strcmp(key->GetName(),"Trigger" ) ){ |
1302 |
|
TRG = true; |
1303 |
|
Int_t nevt = ((TTree*)f->Get("Trigger"))->GetEntries(); |
1304 |
|
if( nev && nevt!=nev){ |
1305 |
|
cout << "File: "<< f->GetName() <<" Trigger tree has "<<nevt<<" events instead of "<<nev<< endl; |
1306 |
|
TRG = false; |
1307 |
|
}else nev=nevt; |
1308 |
|
} |
1309 |
|
//========================================================= |
1310 |
|
if( !strcmp(key->GetName(),"ToF" ) ){ |
1311 |
|
TOF = true; |
1312 |
|
Int_t nevt = ((TTree*)f->Get("ToF"))->GetEntries(); |
1313 |
|
if( nev && nevt!=nev){ |
1314 |
|
cout << "File: "<< f->GetName() <<" ToF tree has "<<nevt<<" events instead of "<<nev<< endl; |
1315 |
|
TOF = false; |
1316 |
|
}else nev=nevt; |
1317 |
|
} |
1318 |
|
//========================================================= |
1319 |
|
if( !strcmp(key->GetName(),"S4" ) ){ |
1320 |
|
S4 = true; |
1321 |
|
Int_t nevt = ((TTree*)f->Get("S4"))->GetEntries(); |
1322 |
|
if( nev && nevt!=nev){ |
1323 |
|
cout << "File: "<< f->GetName() <<" S4 tree has "<<nevt<<" events instead of "<<nev<< endl; |
1324 |
|
S4 = false; |
1325 |
|
}else nev=nevt; |
1326 |
|
} |
1327 |
|
//========================================================= |
1328 |
|
|
1329 |
|
if( !strcmp(key->GetName(),"NeutronD" ) ){ |
1330 |
|
ND = true; |
1331 |
|
Int_t nevt = ((TTree*)f->Get("NeutronD"))->GetEntries(); |
1332 |
|
if( nev && nevt!=nev){ |
1333 |
|
cout << "File: "<< f->GetName() <<"NeutronD tree has "<<nevt<<" events instead of "<<nev<< endl; |
1334 |
|
ND =false; |
1335 |
|
}else nev=nevt; |
1336 |
|
} |
1337 |
|
//========================================================= |
1338 |
|
if( !strcmp(key->GetName(),"Anticounter") ){ |
1339 |
|
AC = true; |
1340 |
|
Int_t nevt = ((TTree*)f->Get("Anticounter"))->GetEntries(); |
1341 |
|
if( nev && nevt!=nev){ |
1342 |
|
cout << "File: "<< f->GetName() <<" Anticounter tree has "<<nevt<<" events instead of "<<nev<< endl; |
1343 |
|
AC =false; |
1344 |
|
}else nev=nevt; |
1345 |
|
} |
1346 |
|
//========================================================= |
1347 |
|
if( !strcmp(key->GetName(),"OrbitalInfo") ){ |
1348 |
|
ORB = true; |
1349 |
|
Int_t nevt = ((TTree*)f->Get("OrbitalInfo"))->GetEntries(); |
1350 |
|
if( nev && nevt!=nev){ |
1351 |
|
cout << "File: "<< f->GetName() <<" OrbitalInfo tree has "<<nevt<<" events instead of "<<nev<< endl; |
1352 |
|
ORB = false; |
1353 |
|
}else nev=nevt; |
1354 |
|
} |
1355 |
|
//========================================================= |
1356 |
|
if( !strcmp(key->GetName(),"Tracker" ) ){ |
1357 |
|
TTree *T = (TTree*)f->Get("Tracker"); |
1358 |
|
for(Int_t i=0; i<T->GetListOfBranches()->GetEntries(); i++){ |
1359 |
|
TString name = T->GetListOfBranches()->At(i)->GetName(); |
1360 |
|
if( !name.CompareTo("TrkLevel1") )TRK1=true; |
1361 |
|
if( !name.CompareTo("TrkLevel2") )TRK2=true; |
1362 |
|
if( !name.CompareTo("TrkHough") )TRKh=true; |
1363 |
|
}; |
1364 |
|
Int_t nevt = T->GetEntries(); |
1365 |
|
if( nev && nevt!=nev){ |
1366 |
|
cout << "File: "<< f->GetName() <<" Tracker tree has "<<nevt<<" events instead of "<<nev<< endl; |
1367 |
|
TRK1 = false; |
1368 |
|
TRK2 = false; |
1369 |
|
TRKh = false; |
1370 |
|
}else nev=nevt; |
1371 |
|
T->Delete(); |
1372 |
|
}; |
1373 |
|
//========================================================= |
1374 |
|
if( !strcmp(key->GetName(),"Calorimeter" ) ){ |
1375 |
|
TTree *T = (TTree*)f->Get("Calorimeter"); |
1376 |
|
for(Int_t i=0; i<T->GetListOfBranches()->GetEntries(); i++){ |
1377 |
|
TString name = T->GetListOfBranches()->At(i)->GetName(); |
1378 |
|
if( !name.CompareTo("CaloLevel1") )CAL1=true; |
1379 |
|
if( !name.CompareTo("CaloLevel2") )CAL2=true; |
1380 |
|
}; |
1381 |
|
Int_t nevt = T->GetEntries(); |
1382 |
|
if( nev && nevt!=nev){ |
1383 |
|
cout << "File: "<< f->GetName() <<" Calorimeter tree has "<<nevt<<" events instead of "<<nev<< endl; |
1384 |
|
CAL1 = false; |
1385 |
|
CAL2 = false; |
1386 |
|
}else nev=nevt; |
1387 |
|
T->Delete(); |
1388 |
|
}; |
1389 |
|
|
1390 |
|
}; |
1391 |
|
|
1392 |
|
lk->Delete(); |
1393 |
|
|
1394 |
|
// cout<< "Get detector list from input file --> "; |
1395 |
|
// if(TRK1)cout<<"TRK1 "; |
1396 |
|
// if(TRK2)cout<<"TRK2 "; |
1397 |
|
// if(TRKh)cout<<"TRKH "; |
1398 |
|
// if(CAL1)cout<<"CAL1 "; |
1399 |
|
// if(CAL2)cout<<"CAL2 "; |
1400 |
|
// if(TOF)cout<<"TOF "; |
1401 |
|
// if(TRG)cout<<"TRG "; |
1402 |
|
// if(AC)cout<<"AC "; |
1403 |
|
// if(ND)cout<<"ND "; |
1404 |
|
// if(S4)cout<<"S4 "; |
1405 |
|
// if(ORB)cout<<"ORB "; |
1406 |
|
// cout << endl; |
1407 |
|
|
1408 |
|
return ; |
1409 |
|
|
1410 |
}; |
}; |
1411 |
|
|
1412 |
|
|
1413 |
//-------------------------------------- |
//-------------------------------------- |
1414 |
// |
// |
1415 |
// |
// |
1421 |
*/ |
*/ |
1422 |
Bool_t PamLevel2::CheckLevel2File(TString name){ |
Bool_t PamLevel2::CheckLevel2File(TString name){ |
1423 |
|
|
1424 |
Bool_t CAL__ok = false; |
Bool_t CAL1__ok = false; |
1425 |
Bool_t TRK__ok = false; |
Bool_t CAL2__ok = false; |
1426 |
Bool_t TRK_L1__ok = false; |
Bool_t TRK2__ok = false; |
1427 |
Bool_t TRG__ok = false; |
Bool_t TRK1__ok = false; |
1428 |
Bool_t TOF__ok = false; |
Bool_t TRKh__ok = false; |
1429 |
Bool_t S4__ok = false; |
Bool_t TRG__ok = false; |
1430 |
Bool_t ND__ok = false; |
Bool_t TOF__ok = false; |
1431 |
Bool_t AC__ok = false; |
Bool_t S4__ok = false; |
1432 |
Bool_t ORB__ok = false; |
Bool_t ND__ok = false; |
1433 |
|
Bool_t AC__ok = false; |
1434 |
|
Bool_t ORB__ok = false; |
1435 |
|
|
1436 |
|
Bool_t RUN__ok = false; |
1437 |
|
|
|
Bool_t RUN__ok = false; |
|
1438 |
|
|
1439 |
// cout << "Checking file: "<<name<<endl; |
|
1440 |
|
cout << "Checking file: "<<name<<endl; |
1441 |
TFile *f = new TFile(name.Data()); |
TFile *f = new TFile(name.Data()); |
1442 |
if( !f || f->IsZombie() ){ |
if( !f || f->IsZombie() ){ |
1443 |
cout << "File: "<< f->GetName() <<" discarded ---- Non valid root file"<< endl; return false; |
cout << "File: "<< f->GetName() <<" discarded ---- Non valid root file"<< endl; return false; |
1444 |
} |
} |
1445 |
// cout << "Get list of keys: "<<f<<endl; |
// cout << "Get list of keys: "<<f<<endl; |
1446 |
TList *lk = f->GetListOfKeys(); |
TList *lk = f->GetListOfKeys(); |
1447 |
// lk->Print(); |
// lk->Print(); |
1448 |
TIter next(lk); |
TIter next(lk); |
1449 |
TKey *key =0; |
TKey *key =0; |
1450 |
Int_t nev =0; |
|
1451 |
Int_t nev_previous =0; |
Int_t nev = 0; |
1452 |
|
|
1453 |
while( (key = (TKey*)next()) ){ |
while( (key = (TKey*)next()) ){ |
1454 |
|
|
1455 |
nev_previous = nev; |
// cout << key->GetName() << ""<<key->GetClassName()<<endl; |
1456 |
nev = ((TTree*)f->Get(key->GetName()))->GetEntries(); |
// cout << " Get tree: " << f->Get(key->GetName())<<endl; |
1457 |
if( key->GetClassName()=="TTree" && nev_previous && nev != nev_previous ){ |
// nev_previous = nev; |
1458 |
cout << "File: "<< f->GetName() <<" discarded ---- "<< key->GetName() << " tree: n.entries does not match "<<nev<<" "<<nev_previous<< endl; |
// cout << " n.entries "<< nev <<endl; |
1459 |
return false; |
// if( key->GetClassName()=="TTree" && nev_previous && nev != nev_previous ){ |
1460 |
}; |
// nev = ((TTree*)f->Get(key->GetName()))->GetEntries(); |
1461 |
|
// cout << "File: "<< f->GetName() <<" discarded ---- "<< key->GetName() << " tree: n.entries does not match "<<nev<<" "<<nev_previous<< endl; |
1462 |
|
// return false; |
1463 |
|
// }; |
1464 |
|
|
|
if( !strcmp(key->GetName(),"Calorimeter") )CAL__ok = true; |
|
|
if( !strcmp(key->GetName(),"Trigger" ) )TRG__ok = true; |
|
|
if( !strcmp(key->GetName(),"ToF" ) )TOF__ok = true; |
|
|
if( !strcmp(key->GetName(),"S4" ) )S4__ok = true; |
|
|
if( !strcmp(key->GetName(),"NeutronD" ) )ND__ok = true; |
|
|
if( !strcmp(key->GetName(),"Anticounter") )AC__ok = true; |
|
|
if( !strcmp(key->GetName(),"OrbitalInfo") )ORB__ok = true; |
|
1465 |
if( !strcmp(key->GetName(),"Run" ) )RUN__ok = true; |
if( !strcmp(key->GetName(),"Run" ) )RUN__ok = true; |
1466 |
|
|
1467 |
|
//========================================================= |
1468 |
|
if( !strcmp(key->GetName(),"Trigger" ) ){ |
1469 |
|
TRG__ok = true; |
1470 |
|
if(TRG){ |
1471 |
|
Int_t nevt = ((TTree*)f->Get("Trigger"))->GetEntries(); |
1472 |
|
if( nev && nevt!=nev){ |
1473 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Trigger tree has "<<nevt<<" events instead of "<<nev<< endl; |
1474 |
|
return false; |
1475 |
|
} |
1476 |
|
nev=nevt; |
1477 |
|
} |
1478 |
|
} |
1479 |
|
//========================================================= |
1480 |
|
if( !strcmp(key->GetName(),"ToF" ) ){ |
1481 |
|
TOF__ok = true; |
1482 |
|
if(TOF){ |
1483 |
|
Int_t nevt = ((TTree*)f->Get("ToF"))->GetEntries(); |
1484 |
|
if( nev && nevt!=nev){ |
1485 |
|
cout << "File: "<< f->GetName() <<" discarded ---- ToF tree has "<<nevt<<" events instead of "<<nev<< endl; |
1486 |
|
return false; |
1487 |
|
} |
1488 |
|
nev=nevt; |
1489 |
|
} |
1490 |
|
} |
1491 |
|
//========================================================= |
1492 |
|
if( !strcmp(key->GetName(),"S4" ) ){ |
1493 |
|
S4__ok = true; |
1494 |
|
if(S4){ |
1495 |
|
Int_t nevt = ((TTree*)f->Get("S4"))->GetEntries(); |
1496 |
|
if( nev && nevt!=nev){ |
1497 |
|
cout << "File: "<< f->GetName() <<" discarded ---- S4 tree has "<<nevt<<" events instead of "<<nev<< endl; |
1498 |
|
return false; |
1499 |
|
} |
1500 |
|
nev=nevt; |
1501 |
|
} |
1502 |
|
} |
1503 |
|
//========================================================= |
1504 |
|
|
1505 |
|
if( !strcmp(key->GetName(),"NeutronD" ) ){ |
1506 |
|
ND__ok = true; |
1507 |
|
if(ND){ |
1508 |
|
Int_t nevt = ((TTree*)f->Get("NeutronD"))->GetEntries(); |
1509 |
|
if( nev && nevt!=nev){ |
1510 |
|
cout << "File: "<< f->GetName() <<" discarded ---- NeutronD tree has "<<nevt<<" events instead of "<<nev<< endl; |
1511 |
|
return false; |
1512 |
|
} |
1513 |
|
nev=nevt; |
1514 |
|
} |
1515 |
|
} |
1516 |
|
//========================================================= |
1517 |
|
if( !strcmp(key->GetName(),"Anticounter") ){ |
1518 |
|
AC__ok = true; |
1519 |
|
if(AC){ |
1520 |
|
Int_t nevt = ((TTree*)f->Get("Anticounter"))->GetEntries(); |
1521 |
|
if( nev && nevt!=nev){ |
1522 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Anticounter tree has "<<nevt<<" events instead of "<<nev<< endl; |
1523 |
|
return false; |
1524 |
|
} |
1525 |
|
nev=nevt; |
1526 |
|
} |
1527 |
|
} |
1528 |
|
//========================================================= |
1529 |
|
if( !strcmp(key->GetName(),"OrbitalInfo") ){ |
1530 |
|
ORB__ok = true; |
1531 |
|
if(ORB){ |
1532 |
|
Int_t nevt = ((TTree*)f->Get("OrbitalInfo"))->GetEntries(); |
1533 |
|
if( nev && nevt!=nev){ |
1534 |
|
cout << "File: "<< f->GetName() <<" discarded ---- OrbitalInfo tree has "<<nevt<<" events instead of "<<nev<< endl; |
1535 |
|
return false; |
1536 |
|
} |
1537 |
|
nev=nevt; |
1538 |
|
} |
1539 |
|
} |
1540 |
|
//========================================================= |
1541 |
if( !strcmp(key->GetName(),"Tracker" ) ){ |
if( !strcmp(key->GetName(),"Tracker" ) ){ |
|
TRK__ok = true; |
|
1542 |
TTree *T = (TTree*)f->Get("Tracker"); |
TTree *T = (TTree*)f->Get("Tracker"); |
1543 |
|
if(TRK1||TRK2||TRKh){ |
1544 |
|
Int_t nevt = T->GetEntries(); |
1545 |
|
if( nev && nevt!=nev){ |
1546 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Tracker tree has "<<nevt<<" events instead of "<<nev<< endl; |
1547 |
|
return false; |
1548 |
|
} |
1549 |
|
nev=nevt; |
1550 |
|
} |
1551 |
for(Int_t i=0; i<T->GetListOfBranches()->GetEntries(); i++){ |
for(Int_t i=0; i<T->GetListOfBranches()->GetEntries(); i++){ |
1552 |
TString name = T->GetListOfBranches()->At(i)->GetName(); |
TString name = T->GetListOfBranches()->At(i)->GetName(); |
1553 |
if( !name.CompareTo("TrkLevel1") )TRK_L1__ok=true; |
if( !name.CompareTo("TrkLevel1") )TRK1__ok=true; |
1554 |
}; |
if( !name.CompareTo("TrkLevel2") )TRK2__ok=true; |
1555 |
|
if( !name.CompareTo("TrkHough") )TRKh__ok=true; |
1556 |
|
}; |
1557 |
|
T->Delete(); |
1558 |
}; |
}; |
1559 |
|
//========================================================= |
1560 |
|
if( !strcmp(key->GetName(),"Calorimeter" ) ){ |
1561 |
|
TTree *T = (TTree*)f->Get("Calorimeter"); |
1562 |
|
if(CAL1||CAL2){ |
1563 |
|
Int_t nevt = T->GetEntries(); |
1564 |
|
if( nev && nevt!=nev){ |
1565 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Calorimeter tree has "<<nevt<<" events instead of "<<nev<< endl; |
1566 |
|
return false; |
1567 |
|
} |
1568 |
|
nev=nevt; |
1569 |
|
} |
1570 |
|
for(Int_t i=0; i<T->GetListOfBranches()->GetEntries(); i++){ |
1571 |
|
TString name = T->GetListOfBranches()->At(i)->GetName(); |
1572 |
|
if( !name.CompareTo("CaloLevel1") )CAL1__ok=true; |
1573 |
|
if( !name.CompareTo("CaloLevel2") )CAL2__ok=true; |
1574 |
|
}; |
1575 |
|
T->Delete(); |
1576 |
|
}; |
1577 |
|
|
1578 |
}; |
}; |
1579 |
|
|
1580 |
lk->Delete(); |
// cout<< "CheckLevel2File(TString): detector list --> "; |
1581 |
f->Close(); |
// if(TRK1__ok)cout<<"TRK1 "; |
1582 |
|
// if(TRK2__ok)cout<<"TRK2 "; |
1583 |
Bool_t FLAG = true; |
// if(TRKh__ok)cout<<"TRKH "; |
1584 |
|
// if(CAL1__ok)cout<<"CAL1 "; |
1585 |
|
// if(CAL2__ok)cout<<"CAL2 "; |
1586 |
|
// if(TOF__ok)cout<<"TOF "; |
1587 |
|
// if(TRG__ok)cout<<"TRG "; |
1588 |
|
// if(AC__ok)cout<<"AC "; |
1589 |
|
// if(ND__ok)cout<<"ND "; |
1590 |
|
// if(S4__ok)cout<<"S4 "; |
1591 |
|
// if(ORB__ok)cout<<"ORB "; |
1592 |
|
// cout << endl; |
1593 |
|
|
1594 |
|
|
1595 |
if(!RUN__ok) { |
if(!RUN__ok) { |
1596 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing RunInfo tree"<< endl; return false; |
cout << "File: "<< f->GetName() <<" *WARNING* ---- Missing RunInfo tree"<< endl; |
1597 |
// FLAG = false; |
// return false; |
1598 |
}; |
}; |
1599 |
if(CAL && !CAL__ok){ |
|
1600 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing Calorimeter tree"<< endl; return false; |
if(CAL1 && !CAL1__ok){ |
1601 |
// FLAG = false; |
cout << "File: "<< f->GetName() <<" discarded ---- Missing CaloLevel1 branch"<< endl; |
1602 |
}; |
return false; |
1603 |
if(TRK && !TRK__ok){ |
}; |
1604 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing Tracker tree"<< endl; return false; |
if(CAL2 && !CAL2__ok){ |
1605 |
// FLAG = false; |
cout << "File: "<< f->GetName() <<" discarded ---- Missing CaloLevel2 branch"<< endl; |
1606 |
}; |
return false; |
1607 |
if(TRK_L1 && !TRK_L1__ok){ |
}; |
1608 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing Tracker Level1 Branch"<< endl; return false; |
if(TRK2 && !TRK2__ok){ |
1609 |
// FLAG = false; |
cout << "File: "<< f->GetName() <<" discarded ---- Missing TrkLevel2 branch"<< endl; |
1610 |
|
return false; |
1611 |
|
}; |
1612 |
|
if(TRK1 && !TRK1__ok){ |
1613 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Missing TrkLevel1 branch"<< endl; |
1614 |
|
return false; |
1615 |
|
}; |
1616 |
|
if(TRKh && !TRKh__ok){ |
1617 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Missing TrkHough branch"<< endl; |
1618 |
|
return false; |
1619 |
}; |
}; |
1620 |
if(TRG && !TRG__ok){ |
if(ORB && !ORB__ok){ |
1621 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing Trigger tree"<< endl; return false; |
cout << "File: "<< f->GetName() <<" discarded ---- Missing ORB tree"<< endl; |
1622 |
// FLAG = false; |
return false; |
1623 |
}; |
}; |
1624 |
if(TOF && !TOF__ok){ |
if(AC && !AC__ok){ |
1625 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing ToF tree"<< endl; return false; |
cout << "File: "<< f->GetName() <<" discarded ---- Missing AC tree"<< endl; |
1626 |
// FLAG = false; |
return false; |
1627 |
}; |
}; |
1628 |
if(S4 && !S4__ok){ |
if(S4 && !S4__ok){ |
1629 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing S4 tree"<< endl; return false; |
cout << "File: "<< f->GetName() <<" discarded ---- Missing S4 tree"<< endl; |
1630 |
// FLAG = false; |
return false; |
1631 |
}; |
}; |
1632 |
if(ND && !ND__ok){ |
if(TOF && !TOF__ok){ |
1633 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing ND tree"<< endl; return false; |
cout << "File: "<< f->GetName() <<" discarded ---- Missing ToF tree"<< endl; |
1634 |
// FLAG = false; |
return false; |
1635 |
}; |
}; |
1636 |
if(AC && !AC__ok){ |
|
1637 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing AC tree"<< endl; return false; |
if(ND && !ND__ok){ |
1638 |
// FLAG = false; |
cout << "File: "<< f->GetName() <<" discarded ---- Missing ND tree"<< endl; |
1639 |
|
return false; |
1640 |
}; |
}; |
1641 |
if(ORB && !ORB__ok){ |
if(TRG && !TRG__ok){ |
1642 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing ORB tree"<< endl; return false; |
cout << "File: "<< f->GetName() <<" discarded ---- Missing Trigger tree"<< endl; |
1643 |
// FLAG = false; |
return false; |
1644 |
}; |
}; |
1645 |
|
|
1646 |
return FLAG; |
|
1647 |
|
lk->Delete(); |
1648 |
|
f->Close(); |
1649 |
|
|
1650 |
|
// cout<< "CheckLevel2File(TString): detector list --> "; |
1651 |
|
// if(TRK1)cout<<"TRK1 "; |
1652 |
|
// if(TRK2)cout<<"TRK2 "; |
1653 |
|
// if(TRKh)cout<<"TRKH "; |
1654 |
|
// if(CAL1)cout<<"CAL1 "; |
1655 |
|
// if(CAL2)cout<<"CAL2 "; |
1656 |
|
// if(TOF)cout<<"TOF "; |
1657 |
|
// if(TRG)cout<<"TRG "; |
1658 |
|
// if(AC)cout<<"AC "; |
1659 |
|
// if(ND)cout<<"ND "; |
1660 |
|
// if(S4)cout<<"S4 "; |
1661 |
|
// if(ORB)cout<<"ORB "; |
1662 |
|
// cout << endl; |
1663 |
|
|
1664 |
|
return true; |
1665 |
|
|
1666 |
}; |
}; |
1667 |
|
|
1668 |
|
|
1669 |
|
/** |
1670 |
|
* Create clone-trees |
1671 |
|
*/ |
1672 |
|
void PamLevel2::CreateCloneTrees0( TChain *fChain, TFile *ofile ){ |
1673 |
|
|
1674 |
|
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
1675 |
|
cout << "Create clones of PAMELA trees "<<endl; |
1676 |
|
|
1677 |
|
Int_t i=0; |
1678 |
|
tree_clone[i] = fChain->GetTree()->CloneTree(0); |
1679 |
|
TString name = tree_clone[i]->GetName(); |
1680 |
|
name.Append("_clone"); |
1681 |
|
// tree_clone[i]->SetName(name.Data()); |
1682 |
|
cout << tree_clone[i]->GetName() <<endl; |
1683 |
|
i++; |
1684 |
|
|
1685 |
|
TList *li = fChain->GetListOfFriends(); |
1686 |
|
TIter next(li); |
1687 |
|
TFriendElement* T_friend=0; |
1688 |
|
ofile->cd(); |
1689 |
|
while( (T_friend = (TFriendElement*)next()) ){ |
1690 |
|
// cout<<T_friend->IsA()->GetName()<<" "<<T_friend->GetName()<<hex << T_friend->GetTree() << dec<<endl; |
1691 |
|
// cout<<T_friend->GetTree()->GetName()<< endl; |
1692 |
|
tree_clone[i] = T_friend->GetTree()->CloneTree(0); |
1693 |
|
tree_clone[i]->SetAutoSave(1000000); |
1694 |
|
name = tree_clone[i]->GetName(); |
1695 |
|
name.Append("_clone"); |
1696 |
|
// tree_clone[i]->SetName(name.Data()); |
1697 |
|
cout << tree_clone[i]->GetName() << endl; |
1698 |
|
i++; |
1699 |
|
} |
1700 |
|
|
1701 |
|
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
1702 |
|
|
1703 |
|
} |
1704 |
|
|
1705 |
|
/** |
1706 |
|
* Create clone-trees |
1707 |
|
*/ |
1708 |
|
void PamLevel2::CreateCloneTrees(TFile *ofile){ |
1709 |
|
|
1710 |
|
ofile->cd(); |
1711 |
|
|
1712 |
|
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
1713 |
|
cout << "Create new PAMELA trees "<<endl; |
1714 |
|
|
1715 |
|
Int_t i=0; |
1716 |
|
|
1717 |
|
if(TRK1||TRK2||TRKh){ |
1718 |
|
tree_clone[i] = new TTree("Tracker","PAMELA tracker level2 data "); |
1719 |
|
if(TRK1) { |
1720 |
|
tree_clone[i]->Branch("TrkLevel1","TrkLevel1", GetPointerTo("TrkLevel1")); |
1721 |
|
tree_clone[i]->BranchRef(); |
1722 |
|
cout << "Tracker : branch TrkLevel1"<<endl; |
1723 |
|
}; |
1724 |
|
if(TRK2) { |
1725 |
|
tree_clone[i]->Branch("TrkLevel2", "TrkLevel2",GetPointerTo("TrkLevel2")); |
1726 |
|
cout << "Tracker : branch TrkLevel2"<<endl; |
1727 |
|
}; |
1728 |
|
if(TRKh) { |
1729 |
|
tree_clone[i]->Branch("TrkHough","TrkHough", GetPointerTo("TrkHough")); |
1730 |
|
cout << "Tracker : branch TrkHough"<<endl; |
1731 |
|
}; |
1732 |
|
i++; |
1733 |
|
} |
1734 |
|
|
1735 |
|
// Calorimeter |
1736 |
|
if(CAL1||CAL2){ |
1737 |
|
tree_clone[i] = new TTree("Calorimeter","PAMELA calorimeter level2 data "); |
1738 |
|
if(CAL1) { |
1739 |
|
tree_clone[i]->Branch("CaloLevel1", "CaloLevel1", GetPointerTo("CaloLevel1")); |
1740 |
|
cout << "Calorimeter : branch CaloLevel1"<<endl; |
1741 |
|
}; |
1742 |
|
if(CAL2) { |
1743 |
|
tree_clone[i]->Branch("CaloLevel2","CaloLevel2", GetPointerTo("CaloLevel2")); |
1744 |
|
cout << "Calorimeter : branch CaloLevel2"<<endl; |
1745 |
|
}; |
1746 |
|
i++; |
1747 |
|
} |
1748 |
|
|
1749 |
|
// ToF |
1750 |
|
if(TOF) { |
1751 |
|
tree_clone[i] = new TTree("ToF","PAMELA ToF level2 data "); |
1752 |
|
tree_clone[i]->Branch("ToFLevel2","ToFLevel2", GetPointerTo("ToFLevel2")); |
1753 |
|
cout << "ToF : branch ToFLevel2"<<endl; |
1754 |
|
i++; |
1755 |
|
}; |
1756 |
|
// Trigger |
1757 |
|
if(TRG) { |
1758 |
|
tree_clone[i] = new TTree("Trigger","PAMELA trigger level2 data "); |
1759 |
|
tree_clone[i]->Branch("TrigLevel2","TrigLevel2", GetPointerTo("TrigLevel2")); |
1760 |
|
cout << "Trigger : branch TrigLevel2"<<endl; |
1761 |
|
i++; |
1762 |
|
}; |
1763 |
|
// S4 |
1764 |
|
if(S4) { |
1765 |
|
tree_clone[i] = new TTree("S4","PAMELA S4 level2 data "); |
1766 |
|
tree_clone[i]->Branch("S4Level2","S4Level2", GetPointerTo("S4Level2")); |
1767 |
|
cout << "S4 : branch S4Level2"<<endl; |
1768 |
|
i++; |
1769 |
|
}; |
1770 |
|
// Neutron Detector |
1771 |
|
if(ND) { |
1772 |
|
tree_clone[i] = new TTree("NeutronD","PAMELA neutron detector level2 data "); |
1773 |
|
tree_clone[i]->Branch("NDLevel2","NDLevel2", GetPointerTo("NDLevel2")); |
1774 |
|
cout << "NeutronD : branch NDLevel2"<<endl; |
1775 |
|
i++; |
1776 |
|
}; |
1777 |
|
// Anticounters |
1778 |
|
if(AC) { |
1779 |
|
tree_clone[i] = new TTree("Anticounter","PAMELA anticounter detector level2 data "); |
1780 |
|
tree_clone[i]->Branch("AcLevel2","AcLevel2", GetPointerTo("AcLevel2")); |
1781 |
|
cout << "Anticounter : branch AcLevel2"<<endl; |
1782 |
|
i++; |
1783 |
|
}; |
1784 |
|
// OrbitalInfo |
1785 |
|
if(ORB) { |
1786 |
|
tree_clone[i] = new TTree("OrbitalInfo","PAMELA oribital info "); |
1787 |
|
tree_clone[i]->Branch("OrbitalInfo","OrbitalInfo", GetPointerTo("OrbitalInfo")); |
1788 |
|
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
1789 |
|
i++; |
1790 |
|
}; |
1791 |
|
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
1792 |
|
|
1793 |
|
} |
1794 |
|
|
1795 |
|
// /** |
1796 |
|
// * Create clone-trees |
1797 |
|
// */ |
1798 |
|
// void PamLevel2::CreateCloneTrees(){ |
1799 |
|
|
1800 |
|
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
1801 |
|
// cout << "Create new PAMELA trees "<<endl; |
1802 |
|
|
1803 |
|
// if(TRK1||TRK2||TRKh){ |
1804 |
|
// T_clone = new TTree("Tracker_clone","PAMELA tracker level2 data "); |
1805 |
|
// if(TRK1) { |
1806 |
|
// trk1_clone = new TrkLevel1(); |
1807 |
|
// T_clone->Branch("TrkLevel1","TrkLevel1", &trk1_clone); |
1808 |
|
// T_clone->BranchRef(); |
1809 |
|
// cout << "Tracker : branch TrkLevel1"<<endl; |
1810 |
|
// }; |
1811 |
|
// if(TRK2) { |
1812 |
|
// trk2_clone = new TrkLevel2(); |
1813 |
|
// T_clone->Branch("TrkLevel2", "TrkLevel2",&trk2_clone); |
1814 |
|
// cout << "Tracker : branch TrkLevel2"<<endl; |
1815 |
|
// }; |
1816 |
|
// if(TRKh) { |
1817 |
|
// trkh_clone = new TrkHough(); |
1818 |
|
// T_clone->Branch("TrkHough","TrkHough", &trkh_clone); |
1819 |
|
// cout << "Tracker : branch TrkHough"<<endl; |
1820 |
|
// }; |
1821 |
|
// cout << hex << T_clone << dec << endl; |
1822 |
|
// } |
1823 |
|
|
1824 |
|
// // Calorimeter |
1825 |
|
// if(CAL1||CAL2){ |
1826 |
|
// C_clone = new TTree("Calorimeter_clone","PAMELA calorimeter level2 data "); |
1827 |
|
// if(CAL1) { |
1828 |
|
// calo1_clone = new CaloLevel1(); |
1829 |
|
// C_clone->Branch("CaloLevel1", "CaloLevel1", &calo1_clone); |
1830 |
|
// cout << "Calorimeter : branch CaloLevel1"<<endl; |
1831 |
|
// }; |
1832 |
|
// if(CAL2) { |
1833 |
|
// calo2_clone = new CaloLevel2(); |
1834 |
|
// C_clone->Branch("CaloLevel2","CaloLevel2", &calo2_clone); |
1835 |
|
// cout << "Calorimeter : branch CaloLevel2"<<endl; |
1836 |
|
// }; |
1837 |
|
// } |
1838 |
|
|
1839 |
|
// // ToF |
1840 |
|
// if(TOF) { |
1841 |
|
// O_clone = new TTree("ToF_clone","PAMELA ToF level2 data "); |
1842 |
|
// tof_clone = new ToFLevel2(); |
1843 |
|
// O_clone->Branch("ToFLevel2","ToFLevel2", &tof_clone); |
1844 |
|
// cout << "ToF : branch ToFLevel2"<<endl; |
1845 |
|
// }; |
1846 |
|
// // Trigger |
1847 |
|
// if(TRG) { |
1848 |
|
// R_clone = new TTree("Trigger_clone","PAMELA trigger level2 data "); |
1849 |
|
// trig_clone = new TrigLevel2(); |
1850 |
|
// R_clone->Branch("TrigLevel2","TrigLevel2", &trig_clone); |
1851 |
|
// cout << "Trigger : branch TrigLevel2"<<endl; |
1852 |
|
// }; |
1853 |
|
// // S4 |
1854 |
|
// if(S4) { |
1855 |
|
// S_clone = new TTree("S4_clone","PAMELA S4 level2 data "); |
1856 |
|
// s4_clone = new S4Level2(); |
1857 |
|
// S_clone->Branch("S4Level2","S4Level2", &s4_clone); |
1858 |
|
// cout << "S4 : branch S4Level2"<<endl; |
1859 |
|
// }; |
1860 |
|
// // Neutron Detector |
1861 |
|
// if(ND) { |
1862 |
|
// N_clone = new TTree("NeutronD_clone","PAMELA neutron detector level2 data "); |
1863 |
|
// nd_clone = new NDLevel2(); |
1864 |
|
// N_clone->Branch("NDLevel2","NDLevel2", &nd_clone); |
1865 |
|
// cout << "NeutronD : branch NDLevel2"<<endl; |
1866 |
|
// }; |
1867 |
|
// // Anticounters |
1868 |
|
// if(AC) { |
1869 |
|
// A_clone = new TTree("Anticounter_clone","PAMELA anticounter detector level2 data "); |
1870 |
|
// ac_clone = new AcLevel2(); |
1871 |
|
// A_clone->Branch("AcLevel2","AcLevel2", &ac_clone); |
1872 |
|
// cout << "Anticounter : branch AcLevel2"<<endl; |
1873 |
|
// }; |
1874 |
|
// // OrbitalInfo |
1875 |
|
// if(ORB) { |
1876 |
|
// B_clone = new TTree("OrbitalInfo_clone","PAMELA oribital info "); |
1877 |
|
// orb_clone = new OrbitalInfo(); |
1878 |
|
// B_clone->Branch("OrbitalInfo","OrbitalInfo", &orb_clone); |
1879 |
|
// cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
1880 |
|
// }; |
1881 |
|
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
1882 |
|
|
1883 |
|
// } |
1884 |
|
|
1885 |
|
/** |
1886 |
|
* Fill tree (created with CreateCloneTrees) |
1887 |
|
* |
1888 |
|
*/ |
1889 |
|
//void PamLevel2::FillNewPamTree(TTree *T){ |
1890 |
|
void PamLevel2::FillCloneTrees(){ |
1891 |
|
|
1892 |
|
// // -------------------------------------- |
1893 |
|
// // copy the event |
1894 |
|
// // -------------------------------------- |
1895 |
|
// if(trk1_clone) *trk1_clone = *trk1_obj; |
1896 |
|
// if(trk2_clone){ |
1897 |
|
// trk2_clone->Clear(); |
1898 |
|
// trk2_obj->Copy(*trk2_clone); |
1899 |
|
// // *trk2_clone = *trk2_obj; |
1900 |
|
// } |
1901 |
|
// if(trkh_clone) *trkh_clone = *trkh_obj; |
1902 |
|
// if(calo1_clone){ |
1903 |
|
// // *calo1_clone = *calo1_obj; |
1904 |
|
// calo1_clone->Clear(); |
1905 |
|
// calo1_obj->Copy(*calo1_clone); |
1906 |
|
// } |
1907 |
|
// if(calo2_clone){ |
1908 |
|
// // *calo2_clone = *calo2_obj; |
1909 |
|
// calo2_clone->Clear(); |
1910 |
|
// calo2_obj->Copy(*calo2_clone); |
1911 |
|
// } |
1912 |
|
// if(tof_clone) *tof_clone = *tof_obj; |
1913 |
|
// if(trig_clone) *trig_clone = *trig_obj; |
1914 |
|
// if(s4_clone) *s4_clone = *s4_obj; |
1915 |
|
// if(nd_clone) *nd_clone = *nd_obj; |
1916 |
|
// if(ac_clone) *ac_clone = *ac_obj; |
1917 |
|
// if(orb_clone) *orb_clone = *orb_obj; |
1918 |
|
|
1919 |
|
// if(T_clone)T_clone->Fill(); |
1920 |
|
// if(C_clone)C_clone->Fill(); |
1921 |
|
// if(O_clone)O_clone->Fill(); |
1922 |
|
// if(R_clone)R_clone->Fill(); |
1923 |
|
// if(S_clone)S_clone->Fill(); |
1924 |
|
// if(N_clone)N_clone->Fill(); |
1925 |
|
// if(A_clone)A_clone->Fill(); |
1926 |
|
// if(O_clone)O_clone->Fill(); |
1927 |
|
|
1928 |
|
for(Int_t i=0; i<8; i++){ |
1929 |
|
if(tree_clone[i])tree_clone[i]->Fill(); |
1930 |
|
} |
1931 |
|
} |
1932 |
|
|
1933 |
|
|
1934 |
|
TTree* PamLevel2::GetCloneTree(TString name){ |
1935 |
|
|
1936 |
|
for(Int_t i=0; i<8; i++){ |
1937 |
|
if(tree_clone[i]){ |
1938 |
|
TString na = tree_clone[i]->GetName(); |
1939 |
|
if(!name.CompareTo(na))return tree_clone[i]; |
1940 |
|
}; |
1941 |
|
} |
1942 |
|
return NULL; |
1943 |
|
|
1944 |
|
} |
1945 |
|
void PamLevel2::WriteCloneTrees(){ |
1946 |
|
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
1947 |
|
cout << "Write clones of PAMELA trees "<<endl; |
1948 |
|
for(Int_t i=0; i<8; i++){ |
1949 |
|
if(tree_clone[i]){ |
1950 |
|
cout << tree_clone[i]->GetName()<<endl; |
1951 |
|
tree_clone[i]->Write(); |
1952 |
|
}; |
1953 |
|
} |
1954 |
|
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
1955 |
|
|
1956 |
|
} |
1957 |
|
|
1958 |
|
/** |
1959 |
|
* Create a new (empty) Pamela trees |
1960 |
|
*/ |
1961 |
|
// TTree* PamLevel2::GetNewPamTree(){ |
1962 |
|
|
1963 |
|
// if(tree_clone)return tree_clone; |
1964 |
|
|
1965 |
|
// TTree *Tout = 0; |
1966 |
|
|
1967 |
|
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
1968 |
|
// cout << "Create new PAMELA trees "<<endl; |
1969 |
|
|
1970 |
|
|
1971 |
|
// if(TRK1||TRK2||TRKh){ |
1972 |
|
// TTree *T = new TTree("Tracker_clone","PAMELA tracker level2 data "); |
1973 |
|
// if(TRK1) { |
1974 |
|
// trk1_clone = new TrkLevel1(); |
1975 |
|
// T->Branch("TrkLevel1","TrkLevel1", &trk1_clone); |
1976 |
|
// T->BranchRef(); |
1977 |
|
// cout << "Tracker : branch TrkLevel1"<<endl; |
1978 |
|
// }; |
1979 |
|
// if(TRK2) { |
1980 |
|
// trk2_clone = new TrkLevel2(); |
1981 |
|
// T->Branch("TrkLevel2", "TrkLevel2",&trk2_clone); |
1982 |
|
// cout << "Tracker : branch TrkLevel2"<<endl; |
1983 |
|
// }; |
1984 |
|
// if(TRKh) { |
1985 |
|
// trkh_clone = new TrkHough(); |
1986 |
|
// T->Branch("TrkHough","TrkHough", &trkh_clone); |
1987 |
|
// cout << "Tracker : branch TrkHough"<<endl; |
1988 |
|
// }; |
1989 |
|
// if(!Tout)Tout=T; |
1990 |
|
// else Tout->AddFriend("Tracker_clone"); |
1991 |
|
// } |
1992 |
|
|
1993 |
|
// // Calorimeter |
1994 |
|
// if(CAL1||CAL2){ |
1995 |
|
// TTree *C = new TTree("Calorimeter_clone","PAMELA calorimeter level2 data "); |
1996 |
|
// if(CAL1) { |
1997 |
|
// calo1_clone = new CaloLevel1(); |
1998 |
|
// C->Branch("CaloLevel1", "CaloLevel1", &calo1_clone); |
1999 |
|
// cout << "Calorimeter : branch CaloLevel1"<<endl; |
2000 |
|
// }; |
2001 |
|
// if(CAL2) { |
2002 |
|
// calo2_clone = new CaloLevel2(); |
2003 |
|
// C->Branch("CaloLevel2","CaloLevel2", &calo2_clone); |
2004 |
|
// cout << "Calorimeter : branch CaloLevel2"<<endl; |
2005 |
|
// }; |
2006 |
|
// if(!Tout)Tout=C; |
2007 |
|
// else Tout->AddFriend("Calorimeter_clone"); |
2008 |
|
// } |
2009 |
|
|
2010 |
|
// // ToF |
2011 |
|
// if(TOF) { |
2012 |
|
// TTree *O = new TTree("ToF_clone","PAMELA ToF level2 data "); |
2013 |
|
// tof_clone = new ToFLevel2(); |
2014 |
|
// O->Branch("ToFLevel2","ToFLevel2", &tof_clone); |
2015 |
|
// cout << "ToF : branch ToFLevel2"<<endl; |
2016 |
|
// if(!Tout)Tout=O; |
2017 |
|
// else Tout->AddFriend("ToF_clone"); |
2018 |
|
// }; |
2019 |
|
// // Trigger |
2020 |
|
// if(TRG) { |
2021 |
|
// TTree *R = new TTree("Trigger_clone","PAMELA trigger level2 data "); |
2022 |
|
// trig_clone = new TrigLevel2(); |
2023 |
|
// R->Branch("TrigLevel2","TrigLevel2", &trig_clone); |
2024 |
|
// cout << "Trigger : branch TrigLevel2"<<endl; |
2025 |
|
// if(!Tout)Tout=R; |
2026 |
|
// else Tout->AddFriend("Trigger_clone"); |
2027 |
|
// }; |
2028 |
|
// // S4 |
2029 |
|
// if(S4) { |
2030 |
|
// TTree *S = new TTree("S4_clone","PAMELA S4 level2 data "); |
2031 |
|
// s4_clone = new S4Level2(); |
2032 |
|
// S->Branch("S4Level2","S4Level2", &s4_clone); |
2033 |
|
// cout << "S4 : branch S4Level2"<<endl; |
2034 |
|
// if(!Tout)Tout=S; |
2035 |
|
// else Tout->AddFriend("S4_clone"); |
2036 |
|
// }; |
2037 |
|
// // Neutron Detector |
2038 |
|
// if(ND) { |
2039 |
|
// TTree *N = new TTree("NeutronD_clone","PAMELA neutron detector level2 data "); |
2040 |
|
// nd_clone = new NDLevel2(); |
2041 |
|
// N->Branch("NDLevel2","NDLevel2", &nd_clone); |
2042 |
|
// cout << "NeutronD : branch NDLevel2"<<endl; |
2043 |
|
// if(!Tout)Tout=N; |
2044 |
|
// else Tout->AddFriend("NeutronD_clone"); |
2045 |
|
// }; |
2046 |
|
// // Anticounters |
2047 |
|
// if(AC) { |
2048 |
|
// TTree *A = new TTree("Anticounter_clone","PAMELA anticounter detector level2 data "); |
2049 |
|
// ac_clone = new AcLevel2(); |
2050 |
|
// A->Branch("AcLevel2","AcLevel2", &ac_clone); |
2051 |
|
// cout << "Anticounter : branch AcLevel2"<<endl; |
2052 |
|
// if(!Tout)Tout=A; |
2053 |
|
// else Tout->AddFriend("Anticounter_clone"); |
2054 |
|
// }; |
2055 |
|
// // OrbitalInfo |
2056 |
|
// if(ORB) { |
2057 |
|
// TTree *B = new TTree("OrbitalInfo_clone","PAMELA oribital info "); |
2058 |
|
// orb_clone = new OrbitalInfo(); |
2059 |
|
// B->Branch("OrbitalInfo","OrbitalInfo", &orb_clone); |
2060 |
|
// cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
2061 |
|
// if(!Tout)Tout=B; |
2062 |
|
// else Tout->AddFriend("OrbitalInfo_clone"); |
2063 |
|
// }; |
2064 |
|
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
2065 |
|
|
2066 |
|
// tree_clone = Tout; |
2067 |
|
// tree_clone->SetDirectory(0); |
2068 |
|
|
2069 |
|
// return Tout; |
2070 |
|
// } |
2071 |
|
// /** |
2072 |
|
// * Fill a tree (created with GetNewPamTree) |
2073 |
|
// * |
2074 |
|
// */ |
2075 |
|
// //void PamLevel2::FillNewPamTree(TTree *T){ |
2076 |
|
// void PamLevel2::FillNewPamTree(){ |
2077 |
|
|
2078 |
|
|
2079 |
|
// if(trk1_clone) *trk1_clone = *trk1_obj; |
2080 |
|
// if(trk2_clone){ |
2081 |
|
// trk2_clone->Clear(); |
2082 |
|
// trk2_obj->Copy(*trk2_clone); |
2083 |
|
// // *trk2_clone = *trk2_obj; |
2084 |
|
// } |
2085 |
|
// if(trkh_clone) *trkh_clone = *trkh_obj; |
2086 |
|
// if(calo1_clone){ |
2087 |
|
// // *calo1_clone = *calo1_obj; |
2088 |
|
// calo1_clone->Clear(); |
2089 |
|
// calo1_obj->Copy(*calo1_clone); |
2090 |
|
// } |
2091 |
|
// if(calo2_clone){ |
2092 |
|
// // *calo2_clone = *calo2_obj; |
2093 |
|
// calo2_clone->Clear(); |
2094 |
|
// calo2_obj->Copy(*calo2_clone); |
2095 |
|
// } |
2096 |
|
// if(tof_clone) *tof_clone = *tof_obj; |
2097 |
|
// if(trig_clone) *trig_clone = *trig_obj; |
2098 |
|
// if(s4_clone) *s4_clone = *s4_obj; |
2099 |
|
// if(nd_clone) *nd_clone = *nd_obj; |
2100 |
|
// if(ac_clone) *ac_clone = *ac_obj; |
2101 |
|
// if(orb_clone) *orb_clone = *orb_obj; |
2102 |
|
|
2103 |
|
// TTree *T = tree_clone; |
2104 |
|
|
2105 |
|
// T->Fill(); //fill main tree |
2106 |
|
// // cout<<T->IsA()->GetName()<<" "<<T->GetName()<<endl; |
2107 |
|
// TList *li = T->GetListOfFriends(); |
2108 |
|
// TIter next(li); |
2109 |
|
// TFriendElement* T_friend=0; |
2110 |
|
// while( (T_friend = (TFriendElement*)next()) ){ |
2111 |
|
// // cout<<T_friend->IsA()->GetName()<<" "<<T_friend->GetName()<<hex << T_friend->GetTree() << dec<<endl; |
2112 |
|
// T_friend->GetTree()->Fill();//fill friends |
2113 |
|
// } |
2114 |
|
|
2115 |
|
// } |