| 24 |
tof_track = this->ToFTrkVar::GetToFTrkVar(); |
tof_track = this->ToFTrkVar::GetToFTrkVar(); |
| 25 |
if(t) *trk_track = *t; |
if(t) *trk_track = *t; |
| 26 |
if(c) *calo_track = *c; |
if(c) *calo_track = *c; |
| 27 |
if(o) *tof_track = *o; |
if(o) *tof_track = *o; |
| 28 |
}; |
}; |
| 29 |
|
|
| 30 |
//-------------------------------------- |
//-------------------------------------- |
| 36 |
*/ |
*/ |
| 37 |
PamLevel2::PamLevel2(){ |
PamLevel2::PamLevel2(){ |
| 38 |
|
|
| 39 |
trk_obj = this->TrkLevel2::GetTrkLevel2(); |
trk2_obj = TrkLevel2::GetTrkLevel2(); |
| 40 |
calo_obj = this->CaloLevel2::GetCaloLevel2(); |
trk1_obj = TrkLevel1::GetTrkLevel1(); |
| 41 |
tof_obj = this->ToFLevel2::GetToFLevel2(); |
trkh_obj = TrkHough::GetTrkHough(); |
| 42 |
trig_obj = this->TrigLevel2::GetTrigLevel2(); |
calo1_obj = CaloLevel1::GetCaloLevel1(); |
| 43 |
s4_obj = this->S4Level2::GetS4Level2(); |
calo2_obj = CaloLevel2::GetCaloLevel2(); |
| 44 |
nd_obj = this->NDLevel2::GetNDLevel2(); |
tof_obj = ToFLevel2::GetToFLevel2(); |
| 45 |
ac_obj = this->AcLevel2::GetAcLevel2(); |
trig_obj = TrigLevel2::GetTrigLevel2(); |
| 46 |
orb_obj = this->OrbitalInfo::GetOrbitalInfo(); |
s4_obj = S4Level2::GetS4Level2(); |
| 47 |
|
nd_obj = NDLevel2::GetNDLevel2(); |
| 48 |
|
ac_obj = AcLevel2::GetAcLevel2(); |
| 49 |
|
orb_obj = OrbitalInfo::GetOrbitalInfo(); |
| 50 |
|
|
| 51 |
sorted_tracks = new TRefArray(); |
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 |
CAL = true; |
for(Int_t i=0; i<8; i++ )tree_clone[i]=NULL; |
| 75 |
TRK = true; |
|
| 76 |
TRG = true; |
sorted_tracks = new TRefArray(); |
| 77 |
TOF = true; |
|
| 78 |
S4 = true; |
CAL1 = true; |
| 79 |
ND = true; |
CAL2 = true; |
| 80 |
AC = true; |
TRK2 = true; |
| 81 |
ORB = true; |
TRK1 = false; |
| 82 |
|
TRKh = false; |
| 83 |
|
TRG = true; |
| 84 |
|
TOF = true; |
| 85 |
|
S4 = true; |
| 86 |
|
ND = true; |
| 87 |
|
AC = true; |
| 88 |
|
ORB = true; |
| 89 |
|
|
| 90 |
|
|
| 91 |
}; |
}; |
| 92 |
/** |
/** |
| 93 |
* Destructor |
* Destructor |
| 94 |
*/ |
*/ |
| 95 |
PamLevel2::~PamLevel2(){ |
PamLevel2::~PamLevel2(){ |
| 96 |
|
delete run_obj; |
| 97 |
delete sorted_tracks; |
Clear(); |
|
|
|
| 98 |
}; |
}; |
| 99 |
/** |
/** |
| 100 |
* Clear the event |
* Clear the event |
| 101 |
*/ |
*/ |
| 102 |
void PamLevel2::Clear(){ |
void PamLevel2::Clear(){ |
|
|
|
|
sorted_tracks->Delete(); |
|
| 103 |
|
|
| 104 |
|
TrkLevel1::Clear(); |
| 105 |
|
|
| 106 |
|
TrkLevel2::Clear(); |
| 107 |
|
CaloLevel2::Clear(); |
| 108 |
|
ToFLevel2::Clear(); |
| 109 |
|
TrigLevel2::Clear(); |
| 110 |
|
S4Level2::Clear(); |
| 111 |
|
NDLevel2::Clear(); |
| 112 |
|
AcLevel2::Clear(); |
| 113 |
|
OrbitalInfo::Clear(); |
| 114 |
|
|
| 115 |
|
// if(trk1_clone)trk1_clone->Clear(); |
| 116 |
|
// if(trk2_clone)trk2_clone->Clear(); |
| 117 |
|
// if(trkh_clone)trkh_clone->Clear(); |
| 118 |
|
// if(calo1_clone)calo1_clone->Clear(); |
| 119 |
|
// if(calo2_clone)calo2_clone->Clear(); |
| 120 |
|
// if(tof_clone)tof_clone->Clear(); |
| 121 |
|
// if(trig_clone)trig_clone->Clear(); |
| 122 |
|
// if(s4_clone)s4_clone->Clear(); |
| 123 |
|
// if(nd_clone)nd_clone->Clear(); |
| 124 |
|
// if(ac_clone)ac_clone->Clear(); |
| 125 |
|
// if(orb_clone)orb_clone->Clear(); |
| 126 |
|
|
| 127 |
|
sorted_tracks->Delete(); // clean the reference array |
| 128 |
|
|
| 129 |
}; |
}; |
| 130 |
|
|
| 131 |
|
|
| 133 |
// |
// |
| 134 |
// |
// |
| 135 |
//-------------------------------------- |
//-------------------------------------- |
| 136 |
|
void *PamLevel2::GetPointerTo(const char* c ){ |
| 137 |
|
|
| 138 |
|
TString objname = c; |
| 139 |
|
if(!objname.CompareTo("TrkLevel1"))return &trk1_obj; |
| 140 |
|
if(!objname.CompareTo("TrkLevel2"))return &trk2_obj; |
| 141 |
|
if(!objname.CompareTo("TrkHough"))return &trkh_obj; |
| 142 |
|
if(!objname.CompareTo("CaloLevel1"))return &calo1_obj; |
| 143 |
|
if(!objname.CompareTo("CaloLevel2"))return &calo2_obj; |
| 144 |
|
if(!objname.CompareTo("ToFLevel2"))return &tof_obj; |
| 145 |
|
if(!objname.CompareTo("TrigLevel2"))return &trig_obj; |
| 146 |
|
if(!objname.CompareTo("S4Level2"))return &s4_obj; |
| 147 |
|
if(!objname.CompareTo("NDLevel2"))return &nd_obj; |
| 148 |
|
if(!objname.CompareTo("AcLevel2"))return &ac_obj; |
| 149 |
|
if(!objname.CompareTo("OrbitalInfo"))return &orb_obj; |
| 150 |
|
if(!objname.CompareTo("RunInfo"))return &run_obj; |
| 151 |
|
return NULL; |
| 152 |
|
}; |
| 153 |
|
//-------------------------------------- |
| 154 |
|
// |
| 155 |
|
// |
| 156 |
|
//-------------------------------------- |
| 157 |
|
/** |
| 158 |
|
* Retrieves the calorimeter track matching the seqno-th tracker stored track. |
| 159 |
|
* (If seqno = -1 retrieves the self-trigger calorimeter track) |
| 160 |
|
*/ |
| 161 |
|
CaloTrkVar *PamLevel2::GetCaloStoredTrack(int seqno){ |
| 162 |
|
|
| 163 |
|
if( CaloLevel2::ntrk()==0 ){ |
| 164 |
|
cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no Calorimeter tracks are stored"<<endl; |
| 165 |
|
return NULL; |
| 166 |
|
}; |
| 167 |
|
|
| 168 |
|
CaloTrkVar *c = 0; |
| 169 |
|
Int_t it_calo=0; |
| 170 |
|
|
| 171 |
|
do{ |
| 172 |
|
c = CaloLevel2::GetCaloTrkVar(it_calo); |
| 173 |
|
it_calo++; |
| 174 |
|
} while( c && seqno != c->trkseqno && it_calo < CaloLevel2::ntrk()); |
| 175 |
|
|
| 176 |
|
if(!c || seqno != c->trkseqno){ |
| 177 |
|
c = 0; |
| 178 |
|
if(seqno!=-1)cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo "<< seqno <<" does not match Calorimeter stored tracks"<<endl; |
| 179 |
|
}; |
| 180 |
|
return c; |
| 181 |
|
|
| 182 |
|
}; |
| 183 |
|
//-------------------------------------- |
| 184 |
|
// |
| 185 |
|
// |
| 186 |
|
//-------------------------------------- |
| 187 |
|
/** |
| 188 |
|
* Retrieves the ToF track matching the seqno-th tracker stored track. |
| 189 |
|
* (If seqno = -1 retrieves the tracker-independent tof track) |
| 190 |
|
*/ |
| 191 |
|
ToFTrkVar *PamLevel2::GetToFStoredTrack(int seqno){ |
| 192 |
|
|
| 193 |
|
if( ToFLevel2::ntrk()==0 ){ |
| 194 |
|
cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no ToF tracks are stored"<<endl; |
| 195 |
|
return NULL; |
| 196 |
|
}; |
| 197 |
|
|
| 198 |
|
ToFTrkVar *c = 0; |
| 199 |
|
Int_t it_tof=0; |
| 200 |
|
|
| 201 |
|
do{ |
| 202 |
|
c = ToFLevel2::GetToFTrkVar(it_tof); |
| 203 |
|
it_tof++; |
| 204 |
|
} while( c && seqno != c->trkseqno && it_tof < ToFLevel2::ntrk()); |
| 205 |
|
|
| 206 |
|
if(!c || seqno != c->trkseqno){ |
| 207 |
|
c = 0; |
| 208 |
|
if(seqno!=-1)cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo "<< seqno <<" does not match ToF stored tracks"<<endl; |
| 209 |
|
}; |
| 210 |
|
return c; |
| 211 |
|
|
| 212 |
|
}; |
| 213 |
|
|
| 214 |
|
//-------------------------------------- |
| 215 |
|
// |
| 216 |
|
// |
| 217 |
|
//-------------------------------------- |
| 218 |
|
/** |
| 219 |
|
* Give the pamela track associated to a tracker track, retrieving related calorimeter and tof track information. |
| 220 |
|
*/ |
| 221 |
|
PamTrack* PamLevel2::GetPamTrackAlong(TrkTrack* t){ |
| 222 |
|
|
| 223 |
|
CaloTrkVar *c = 0; |
| 224 |
|
ToFTrkVar *o = 0; |
| 225 |
|
|
| 226 |
|
if(CAL2) c = GetCaloStoredTrack(t->GetSeqNo()); |
| 227 |
|
if(TOF) o = GetToFStoredTrack(t->GetSeqNo()); |
| 228 |
|
|
| 229 |
|
// if(t && c && o)track = new PamTrack(t,c,o); |
| 230 |
|
PamTrack *track = new PamTrack(t,c,o); |
| 231 |
|
|
| 232 |
|
return track; |
| 233 |
|
|
| 234 |
|
}; |
| 235 |
|
//-------------------------------------- |
| 236 |
|
// |
| 237 |
|
// |
| 238 |
|
//-------------------------------------- |
| 239 |
/** |
/** |
| 240 |
* Retrieves the it-th stored track. |
* Retrieves the it-th stored track. |
| 241 |
* It override TrkLevel2::GetTrack(int it). |
* It override TrkLevel2::GetTrack(int it). |
| 244 |
|
|
| 245 |
PamTrack* PamLevel2::GetStoredTrack(Int_t itrk){ |
PamTrack* PamLevel2::GetStoredTrack(Int_t itrk){ |
| 246 |
|
|
|
TrkTrack *t = 0; |
|
|
CaloTrkVar *c = 0; |
|
|
ToFTrkVar *o = 0; |
|
|
|
|
|
if( itrk >=0 && itrk < TrkLevel2::ntrk() ){ |
|
|
t = TrkLevel2::GetStoredTrack(itrk); |
|
|
/* c = CaloLevel2::GetCaloTrkVar(t->GetSeqNo()); |
|
|
o = ToFLevel2::GetToFTrkVar(t->GetSeqNo()); */ |
|
|
Int_t it_calo=0; |
|
|
do{ |
|
|
c = CaloLevel2::GetCaloTrkVar(it_calo); |
|
|
it_calo++; |
|
|
} while(t->GetSeqNo() != c->trkseqno && it_calo < CaloLevel2::ntrk()); |
|
|
if( t->GetSeqNo() != c->trkseqno )cout << "PamLevel2::GetStoredTrack(int) : tracker SeqNo "<< t->GetSeqNo() <<" does not match Calorimeter SeqNo"<< c->trkseqno<<endl; |
|
|
|
|
|
Int_t it_tof=0; |
|
|
do{ |
|
|
o = ToFLevel2::GetToFTrkVar(it_tof); |
|
|
it_tof++; |
|
|
} while(t->GetSeqNo() != o->trkseqno && it_tof < ToFLevel2::ntrk()); |
|
|
if( t->GetSeqNo() != o->trkseqno )cout << "PamLevel2::GetStoredTrack(int) : tracker SeqNo "<< t->GetSeqNo() <<" does not match ToF SeqNo "<< o->trkseqno <<endl; |
|
|
|
|
|
}else{ |
|
|
cout << "PamLevel2::GetStoredTrack(int) : tracker track SeqNo "<< itrk <<" does not exist (GetNTracks() = "<<TrkLevel2::GetNTracks()<<")"<<endl; |
|
|
}; |
|
|
|
|
|
// hence create a "PamTrack" object |
|
| 247 |
PamTrack *track = 0; |
PamTrack *track = 0; |
| 248 |
if(t && c && o)track = new PamTrack(t,c,o); |
|
| 249 |
return track; |
if( itrk >=0 && itrk < TrkLevel2::ntrk() ){ |
| 250 |
|
|
| 251 |
|
TrkTrack *t = TrkLevel2::GetStoredTrack(itrk); |
| 252 |
|
track = GetPamTrackAlong(t); |
| 253 |
|
|
| 254 |
|
}else{ |
| 255 |
|
cout << "PamLevel2::GetStoredTrack(int) : tracker track SeqNo "<< itrk <<" does not exist (GetNTracks() = "<<TrkLevel2::GetNTracks()<<")"<<endl; |
| 256 |
|
}; |
| 257 |
|
|
| 258 |
|
return track; |
| 259 |
|
|
| 260 |
} |
} |
| 261 |
//-------------------------------------- |
//-------------------------------------- |
| 262 |
// |
// |
| 263 |
// |
// |
| 264 |
//-------------------------------------- |
//-------------------------------------- |
| 265 |
/** |
/** |
| 266 |
* Sort physical (tracker) tracks and stores them in a TObjectArray (of TrkTrack objects). |
* Sort physical (tracker) tracks and stores them in the TRefArray (of TrkTrack objects) which pointer is PamLevel2::sorted_tracks. |
| 267 |
* The total number of physical tracks is given by GetNTracks() and the it-th physical track can be retrieved by means of the method GetTrack(int it). |
* @param how String to set the sorting cryterium (es: "CAL" or "TRK+CAL+TOF" ecc...). |
| 268 |
|
* Sorting cryteria: |
| 269 |
|
* TRK: lower chi**2 |
| 270 |
|
* CAL: lower Y spatial residual on the first calorimeter plane |
| 271 |
|
* TOF: bigger numebr of hit PMTs along the track, on S12 S21 S32 (where paddles are along the Y axis). |
| 272 |
|
* The default sorting cryterium is "TOF+CAL". |
| 273 |
|
* |
| 274 |
|
* 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). |
| 275 |
*/ |
*/ |
| 276 |
void PamLevel2::SortTracks(){ |
void PamLevel2::SortTracks(TString how){ |
| 277 |
|
|
| 278 |
sorted_tracks->Delete(); //temporaneo |
// cout << "call SortTracs() "<<endl; |
| 279 |
// loop over the tracks sorted by the tracker |
//Save current Object count |
| 280 |
for(Int_t i=0; i < TrkLevel2::GetNTracks(); i++){ |
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
| 281 |
|
|
| 282 |
TrkTrack *ts = 0; |
// cout << "ObjectNumber "<<ObjectNumber <<endl; |
| 283 |
|
|
| 284 |
|
sorted_tracks->Delete(); //temporaneo??? |
| 285 |
|
|
| 286 |
|
// loop over the tracks sorted by the tracker |
| 287 |
|
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
| 288 |
|
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
| 289 |
|
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
| 290 |
|
|
| 291 |
|
if( !CAL2 && use_CAL) use_CAL = false; |
| 292 |
|
if( !TOF && use_TOF) use_TOF = false; |
| 293 |
|
|
| 294 |
|
if( !TRK2 ){ |
| 295 |
|
// cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
| 296 |
|
return; |
| 297 |
|
}; |
| 298 |
|
|
| 299 |
|
// cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl; |
| 300 |
|
|
| 301 |
|
for(Int_t i=0; i < TrkLevel2::GetNTracks(); i++){ |
| 302 |
|
|
| 303 |
|
TrkTrack *ts = 0; |
| 304 |
|
|
| 305 |
// get tracker tracks |
// get tracker tracks |
| 306 |
TrkTrack *tp = TrkLevel2::GetTrack(i); //tracker |
TrkTrack *tp = TrkLevel2::GetTrack(i); //tracker |
| 307 |
CaloTrkVar *cp = CaloLevel2::GetCaloTrkVar(tp->GetSeqNo()); //calorimeter |
CaloTrkVar *cp = 0; |
| 308 |
ToFTrkVar *op = ToFLevel2::GetToFTrkVar(tp->GetSeqNo()); //tof |
ToFTrkVar *op = 0; |
| 309 |
|
|
| 310 |
|
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
| 311 |
// if track has an image, check image selection |
// if track has an image, check image selection |
| 312 |
if(tp->HasImage()){ |
if(tp->HasImage()){ |
| 313 |
TrkTrack *ti = TrkLevel2::GetTrackImage(i); //tracker (image) |
|
| 314 |
CaloTrkVar *ci = CaloLevel2::GetCaloTrkVar(ti->GetSeqNo());//calorimeter (image) |
TrkTrack *ti = TrkLevel2::GetTrackImage(i); //tracker (image) |
| 315 |
ToFTrkVar *oi = ToFLevel2::GetToFTrkVar(ti->GetSeqNo()); //tof (image) |
CaloTrkVar *ci = 0; |
| 316 |
|
ToFTrkVar *oi = 0; |
| 317 |
|
|
| 318 |
|
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
| 319 |
|
|
| 320 |
//assign starting scores |
//assign starting scores |
| 321 |
Int_t tp_score = 1; //"principal" track, sorted by the tracker |
Int_t tp_score = 0; //main track sorted by the tracker |
| 322 |
Int_t ti_score = 0; //image track |
Int_t ti_score = 0; //image track |
| 323 |
|
|
| 324 |
// ------------------------ |
// ------------------------ |
| 325 |
// calorimeter check |
// calorimeter check |
| 326 |
// ------------------------ |
// ------------------------ |
| 327 |
if( |
// check the Y spatial residual on the first calorimeter plane |
| 328 |
npcfit[1] > 3 && //no. of fit planes on Y view |
// (cut on calorimeter variables from Emiliano) |
| 329 |
// varcfit[1] < 50.&& //fit variance on Y view |
if( |
| 330 |
true){ |
use_CAL && |
| 331 |
|
npcfit[1] > 15 && //no. of fit planes on Y view |
| 332 |
Float_t resy_p = cp->tbar[0][1] - cbar[0][1];if(resy_p < 0)resy_p= - resy_p; |
varcfit[1] < 1000. && //fit variance on Y view |
| 333 |
Float_t resy_i = ci->tbar[0][1] - cbar[0][1];if(resy_i < 0)resy_i= - resy_i; |
true){ |
| 334 |
|
|
| 335 |
if(resy_p <= resy_i) tp_score++; |
cp = GetCaloStoredTrack(tp->GetSeqNo()); |
| 336 |
else ti_score++; |
ci = GetCaloStoredTrack(ti->GetSeqNo()); |
| 337 |
}; |
|
| 338 |
|
Float_t resy_p = cp->tbar[0][1] - cbar[0][1]; if(resy_p < 0)resy_p= - resy_p; |
| 339 |
|
Float_t resy_i = ci->tbar[0][1] - cbar[0][1]; if(resy_i < 0)resy_i= - resy_i; |
| 340 |
|
|
| 341 |
|
if(resy_p <= resy_i) tp_score++; |
| 342 |
|
else ti_score++; |
| 343 |
|
|
| 344 |
|
// cout << "CALO "<<tp_score<<ti_score<<endl; |
| 345 |
|
|
| 346 |
|
}; |
| 347 |
// ------------------------ |
// ------------------------ |
| 348 |
// TOF check |
// TOF check |
| 349 |
// ------------------------ |
// ------------------------ |
| 350 |
|
// check the number of hit pmts along the track |
| 351 |
|
// on S12 S21 and S32, where paddles are parallel to Y axis |
| 352 |
|
if( use_TOF ){ |
| 353 |
|
|
| 354 |
|
Int_t nphit_p =0; |
| 355 |
|
Int_t nphit_i =0; |
| 356 |
|
|
| 357 |
|
op = GetToFStoredTrack(tp->GetSeqNo()); |
| 358 |
|
oi = GetToFStoredTrack(ti->GetSeqNo()); |
| 359 |
|
|
| 360 |
|
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
| 361 |
|
cout << "track: npmttdc "<< op->npmttdc << endl; |
| 362 |
|
cout << "image: npmtadc "<< oi->npmtadc << endl; |
| 363 |
|
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
| 364 |
|
|
| 365 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
| 366 |
|
Int_t pl = GetPlaneIndex( (op->pmtadc).At(ih) ); |
| 367 |
|
if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
| 368 |
|
}; |
| 369 |
|
|
| 370 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
| 371 |
|
Int_t pl = GetPlaneIndex( (oi->pmtadc).At(ih) ); |
| 372 |
|
if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
| 373 |
|
}; |
| 374 |
|
|
| 375 |
|
if( |
| 376 |
|
use_TOF && |
| 377 |
|
(nphit_p+nphit_i) !=0 && |
| 378 |
|
true){ |
| 379 |
|
|
| 380 |
|
if( nphit_p >= nphit_i) tp_score++; |
| 381 |
|
else ti_score++; |
| 382 |
|
}; |
| 383 |
|
// cout << "TOF "<<tp_score<<ti_score<<endl; |
| 384 |
|
}; |
| 385 |
|
if(tp_score == ti_score) use_TRK = true; |
| 386 |
|
// ------------------------ |
| 387 |
|
// tracker check |
| 388 |
|
// ------------------------ |
| 389 |
|
// chi**2 difference is not always large enough to distinguish among |
| 390 |
|
// the real track and its image. |
| 391 |
|
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
| 392 |
|
if(use_TRK){ |
| 393 |
|
if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
| 394 |
|
else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
| 395 |
|
// cout << "TRK "<<tp_score<<ti_score<<endl; |
| 396 |
|
}; |
| 397 |
|
|
| 398 |
// ------------------------ |
// ------------------------ |
| 399 |
// the winner is.... |
// the winner is.... |
| 400 |
// ------------------------ |
// ------------------------ |
| 401 |
if(tp_score > ti_score) ts = tp;//the track sorted by the tracker!! |
if (tp_score > ti_score) ts = tp;//the track sorted by the tracker!! |
| 402 |
else ts = ti;//its image!! |
else if (tp_score < ti_score) ts = ti;//its image!! |
| 403 |
|
else { |
| 404 |
}else{ |
ts = tp; |
| 405 |
ts = tp; |
// cout << "Warning - track image ambiguity not solved" << endl; |
| 406 |
}; |
// cout << ts->GetNtot() << " "<< ts->chi2 << " " << npcfit[1] << " "<< nphit_p << endl; |
| 407 |
|
}; |
| 408 |
sorted_tracks->Add(ts);//save the track in the sorted array |
|
| 409 |
|
}else{ |
| 410 |
|
ts = tp; |
| 411 |
}; |
}; |
| 412 |
|
|
| 413 |
|
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
| 414 |
|
sorted_tracks->Add(ts);//save the track in the sorted array |
| 415 |
|
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
| 416 |
|
|
| 417 |
|
}; |
| 418 |
|
//Restore Object count |
| 419 |
|
//To save space in the table keeping track of all referenced objects |
| 420 |
|
//we assume that our events do not address each other. We reset the |
| 421 |
|
//object count to what it was at the beginning of the event. |
| 422 |
|
TProcessID::SetObjectCount(ObjectNumber); |
| 423 |
|
|
| 424 |
}; |
}; |
| 425 |
//-------------------------------------- |
//-------------------------------------- |
| 426 |
// |
// |
| 430 |
* 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. |
| 431 |
* 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. |
| 432 |
*/ |
*/ |
| 433 |
TRefArray *PamLevel2::GetTracks(){ |
TRefArray *PamLevel2::GetTracks(){ |
| 434 |
// if(!sorted_tracks->GetEntries()) SortTracks(); |
|
| 435 |
SortTracks(); |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 436 |
return sorted_tracks; |
SortTracks("+CAL+TOF"); |
| 437 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 438 |
|
|
| 439 |
|
return sorted_tracks; |
| 440 |
}; |
}; |
| 441 |
//-------------------------------------- |
//-------------------------------------- |
| 442 |
// |
// |
| 443 |
// |
// |
| 444 |
//-------------------------------------- |
//-------------------------------------- |
| 445 |
/** |
/** |
| 446 |
* Retrieves the it-th Pamela "physical" track. |
* Retrieves the it-th Pamela "physical" track. |
| 448 |
* @param it Track number, ranging from 0 to GetNTracks(). |
* @param it Track number, ranging from 0 to GetNTracks(). |
| 449 |
*/ |
*/ |
| 450 |
PamTrack *PamLevel2::GetTrack(int it){ |
PamTrack *PamLevel2::GetTrack(int it){ |
|
|
|
|
SortTracks(); |
|
| 451 |
|
|
| 452 |
TrkTrack *t = 0; |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 453 |
CaloTrkVar *c = 0; |
SortTracks("+CAL+TOF"); |
| 454 |
ToFTrkVar *o = 0; |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 455 |
|
|
| 456 |
if( it >=0 && it < TrkLevel2::GetNTracks() ){ |
PamTrack *track = 0; |
| 457 |
|
|
| 458 |
t = (TrkTrack*)sorted_tracks->At(it); |
if( it >=0 && it < TrkLevel2::GetNTracks() && it<sorted_tracks->GetEntriesFast() ){ |
| 459 |
|
TrkTrack *t = (TrkTrack*)sorted_tracks->At(it); |
| 460 |
Int_t it_calo=0; |
track = GetPamTrackAlong(t); |
| 461 |
do{ |
}else{ |
| 462 |
c = CaloLevel2::GetCaloTrkVar(it_calo); |
cout << "PamLevel2::GetTrack(int) : tracker track SeqNo "<< it <<" does not exist (GetNTracks() = "<<TrkLevel2::GetNTracks()<<")"<<endl; |
| 463 |
it_calo++; |
}; |
| 464 |
} while(t->GetSeqNo() != c->trkseqno && it_calo < CaloLevel2::ntrk()); |
|
| 465 |
if( t->GetSeqNo() != c->trkseqno )cout << "PamLevel2::GetTrack(int) : tracker SeqNo "<< t->GetSeqNo() <<" does not match Calorimeter SeqNo"<< c->trkseqno<<endl; |
return track; |
|
|
|
|
Int_t it_tof=0; |
|
|
do{ |
|
|
o = ToFLevel2::GetToFTrkVar(it_tof); |
|
|
it_tof++; |
|
|
} while(t->GetSeqNo() != o->trkseqno && it_tof < ToFLevel2::ntrk()); |
|
|
if( t->GetSeqNo() != o->trkseqno )cout << "PamLevel2::GetTrack(int) : tracker SeqNo "<< t->GetSeqNo() <<" does not match ToF SeqNo "<< o->trkseqno <<endl; |
|
|
|
|
|
}else{ |
|
|
cout << "PamLevel2::GetTrack(int) : tracker track SeqNo "<< it <<" does not exist (GetNTracks() = "<<TrkLevel2::GetNTracks()<<")"<<endl; |
|
|
}; |
|
| 466 |
|
|
|
// hence create a "PamTrack" object |
|
|
PamTrack *track = 0; |
|
|
if(t && c && o)track = new PamTrack(t,c,o); |
|
|
|
|
|
return track; |
|
|
|
|
| 467 |
}; |
}; |
| 468 |
|
|
| 469 |
//-------------------------------------- |
//-------------------------------------- |
| 470 |
// |
// |
| 471 |
// |
// |
| 472 |
//-------------------------------------- |
//-------------------------------------- |
| 473 |
/** |
/** |
| 474 |
* Retrieves (if present) the image of the it-th Pamela "physical" track, sorted by the method PamLevel2::GetTracks(). |
* Retrieves (if present) the image of the it-th Pamela "physical" track, sorted by the method PamLevel2::SortTracks(). |
| 475 |
* @param it Track number, ranging from 0 to GetNTracks(). |
* @param it Track number, ranging from 0 to GetNTracks(). |
| 476 |
*/ |
*/ |
| 477 |
PamTrack *PamLevel2::GetTrackImage(int it){ |
PamTrack *PamLevel2::GetTrackImage(int it){ |
| 478 |
|
|
| 479 |
// if(!sorted_tracks->GetEntries()) SortTracks(); |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 480 |
SortTracks(); |
SortTracks("+CAL+TOF"); |
| 481 |
|
// *-*-*-*-*-*-*-*-*-*-*-*-* |
|
TrkTrack *t = 0; |
|
|
CaloTrkVar *c = 0; |
|
|
ToFTrkVar *o = 0; |
|
|
|
|
|
if( it >=0 && it < TrkLevel2::GetNTracks() ){ |
|
|
TrkTrack *temp = (TrkTrack*)sorted_tracks->At(it); |
|
|
if( temp->HasImage() ){ |
|
|
|
|
|
t = TrkLevel2::GetStoredTrack(temp->GetImageSeqNo()); |
|
|
|
|
|
/* c = CaloLevel2::GetCaloTrkVar(temp->GetImageSeqNo()); |
|
|
o = ToFLevel2::GetToFTrkVar(temp->GetImageSeqNo());*/ |
|
|
|
|
|
Int_t it_calo=0; |
|
|
do{ |
|
|
c = CaloLevel2::GetCaloTrkVar(it_calo); |
|
|
it_calo++; |
|
|
} while(t->GetSeqNo() != c->trkseqno && it_calo < CaloLevel2::ntrk()); |
|
|
if( t->GetSeqNo() != c->trkseqno )cout << "PamLevel2::GetTrackImage(int) : tracker SeqNo "<< t->GetSeqNo() <<" does not match Calorimeter SeqNo"<< c->trkseqno<<endl; |
|
|
|
|
|
Int_t it_tof=0; |
|
|
do{ |
|
|
o = ToFLevel2::GetToFTrkVar(it_tof); |
|
|
it_tof++; |
|
|
} while(t->GetSeqNo() != o->trkseqno && it_tof < ToFLevel2::ntrk()); |
|
|
if( t->GetSeqNo() != o->trkseqno )cout << "PamLevel2::GetTrackImage(int) : tracker SeqNo "<< t->GetSeqNo() <<" does not match ToF SeqNo "<< o->trkseqno <<endl; |
|
|
}else{ |
|
|
cout <<"PamLevel2::GetTrackImage(int) : Track SeqNo "<<it<<" does not have image"<<endl; |
|
|
}; |
|
|
}else{ |
|
|
cout << "PamLevel2::GetTrackImage(int) : Tracker track SeqNo "<< it <<" does not exist (GetNTracks() = "<<TrkLevel2::GetNTracks()<<")"<<endl; |
|
|
}; |
|
| 482 |
|
|
|
// hence create a "PamTrack" object |
|
| 483 |
PamTrack *image = 0; |
PamTrack *image = 0; |
|
if(t && c && o)image = new PamTrack(t,c,o); |
|
| 484 |
|
|
| 485 |
return image; |
if( it >=0 && it < TrkLevel2::GetNTracks() ){ |
| 486 |
|
TrkTrack *temp = (TrkTrack*)sorted_tracks->At(it); |
| 487 |
|
if( temp->HasImage() ){ |
| 488 |
|
TrkTrack *t = TrkLevel2::GetStoredTrack(temp->GetImageSeqNo()); |
| 489 |
|
image = GetPamTrackAlong(t); |
| 490 |
|
}else{ |
| 491 |
|
cout <<"PamLevel2::GetTrackImage(int) : Track SeqNo "<<it<<" does not have image"<<endl; |
| 492 |
|
}; |
| 493 |
|
}else{ |
| 494 |
|
cout << "PamLevel2::GetTrackImage(int) : Tracker track SeqNo "<< it <<" does not exist (GetNTracks() = "<<TrkLevel2::GetNTracks()<<")"<<endl; |
| 495 |
|
}; |
| 496 |
|
|
| 497 |
|
return image; |
| 498 |
} |
} |
| 499 |
|
|
| 500 |
//-------------------------------------- |
//-------------------------------------- |
| 507 |
* @param detlist String to select trees to be included |
* @param detlist String to select trees to be included |
| 508 |
* @return Pointer to a TTree |
* @return Pointer to a TTree |
| 509 |
*/ |
*/ |
| 510 |
TTree *PamLevel2::LoadPamTrees(TFile *f, TString detlist="+ALL"){ |
TTree *PamLevel2::GetPamTree(TFile *f, TString detlist="+ALL"){ |
| 511 |
|
|
| 512 |
|
// cout << "WARNING!!! -- obsolete method -- \n"; |
| 513 |
|
// cout << "better use TChain *PamLevel2::GetPamTree(TList*, TString) \n"; |
| 514 |
|
|
| 515 |
|
SetWhichTrees(detlist); |
| 516 |
|
TTree *Trout =0; |
| 517 |
|
|
| 518 |
|
|
| 519 |
|
TString fname = f->GetName(); |
| 520 |
|
if(!CheckLevel2File(fname))return NULL; |
| 521 |
|
|
| 522 |
|
|
| 523 |
TTree *Tout =0; |
// Tracker |
|
|
|
|
SetWhichTrees(detlist); |
|
|
|
|
|
// Tracker |
|
| 524 |
TTree *T = (TTree*)f->Get("Tracker"); |
TTree *T = (TTree*)f->Get("Tracker"); |
| 525 |
if(T && TRK) { |
if(T && (TRK2||TRK1||TRKh)) { |
| 526 |
T->SetBranchAddress("TrkLevel2", GetPointerToTrk()); |
if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); |
| 527 |
cout << "Tracker : set branch address TrkLevel2"<<endl; |
if(TRK2)cout << "Tracker : set branch address TrkLevel2"<<endl; |
| 528 |
if(!Tout)Tout=T; |
if(TRK1)T->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
| 529 |
|
if(TRK1)cout << "Tracker : set branch address TrkLevel1"<<endl; |
| 530 |
|
if(TRKh)T->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
| 531 |
|
if(TRKh)cout << "Tracker : set branch address TrkHough"<<endl; |
| 532 |
|
if(!Trout)Trout=T; |
| 533 |
|
else Trout->AddFriend(T); |
| 534 |
}else{ |
}else{ |
| 535 |
cout << "Tracker : missing tree"<<endl; |
cout << "Tracker : missing tree"<<endl; |
| 536 |
}; |
}; |
| 537 |
// Calorimeter |
// Calorimeter |
| 538 |
TTree *C = (TTree*)f->Get("Calorimeter"); |
TTree *C = (TTree*)f->Get("Calorimeter"); |
| 539 |
if(C && CAL) { |
if(C && (CAL2||CAL1)) { |
| 540 |
C->SetBranchAddress("CaloLevel2", GetPointerToCalo()); |
if(CAL2)C->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
| 541 |
cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
| 542 |
if(!Tout)Tout=C; |
if(CAL1)C->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
| 543 |
else Tout->AddFriend(C); |
if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
| 544 |
|
if(!Trout)Trout=C; |
| 545 |
|
else Trout->AddFriend(C); |
| 546 |
}else{ |
}else{ |
| 547 |
cout << "Calorimeter : missing tree"<<endl; |
cout << "Calorimeter : missing tree"<<endl; |
| 548 |
}; |
}; |
| 549 |
// ToF |
// ToF |
| 550 |
TTree *O = (TTree*)f->Get("ToF"); |
TTree *O = (TTree*)f->Get("ToF"); |
| 551 |
if(O && TOF) { |
if(O && TOF) { |
| 552 |
O->SetBranchAddress("ToFLevel2", GetPointerToToF()); |
O->SetBranchAddress("ToFLevel2", GetPointerTo("ToFLevel2")); |
| 553 |
cout << "ToF : set branch address ToFLevel2"<<endl; |
cout << "ToF : set branch address ToFLevel2"<<endl; |
| 554 |
if(!Tout)Tout=O; |
if(!Trout)Trout=O; |
| 555 |
else Tout->AddFriend(O); |
else Trout->AddFriend(O); |
| 556 |
}else{ |
}else{ |
| 557 |
cout << "ToF : missing tree"<<endl; |
cout << "ToF : missing tree"<<endl; |
| 558 |
}; |
}; |
| 559 |
// Trigger |
// Trigger |
| 560 |
TTree *R = (TTree*)f->Get("Trigger"); |
TTree *R = (TTree*)f->Get("Trigger"); |
| 561 |
if(R && TRG) { |
if(R && TRG) { |
| 562 |
R->SetBranchAddress("TrigLevel2", GetPointerToTrig()); |
R->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
| 563 |
cout << "Trigger : set branch address TrigLevel2"<<endl; |
cout << "Trigger : set branch address TrigLevel2"<<endl; |
| 564 |
if(!Tout)Tout=O; |
if(!Trout)Trout=O; |
| 565 |
else Tout->AddFriend(R); |
else Trout->AddFriend(R); |
| 566 |
}else{ |
}else{ |
| 567 |
cout << "Trigger : missing tree"<<endl; |
cout << "Trigger : missing tree"<<endl; |
| 568 |
}; |
}; |
| 569 |
// S4 |
// S4 |
| 570 |
TTree *S = (TTree*)f->Get("S4"); |
TTree *S = (TTree*)f->Get("S4"); |
| 571 |
if(S && S4) { |
if(S && S4) { |
| 572 |
S->SetBranchAddress("S4Level2", GetPointerToS4()); |
S->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
| 573 |
cout << "S4 : set branch address S4Level2"<<endl; |
cout << "S4 : set branch address S4Level2"<<endl; |
| 574 |
if(!Tout)Tout=O; |
if(!Trout)Trout=O; |
| 575 |
else Tout->AddFriend(S); |
else Trout->AddFriend(S); |
| 576 |
}else{ |
}else{ |
| 577 |
cout << "S4 : missing tree"<<endl; |
cout << "S4 : missing tree"<<endl; |
| 578 |
}; |
}; |
| 579 |
// Neutron Detector |
// Neutron Detector |
| 580 |
TTree *N = (TTree*)f->Get("NeutronD"); |
TTree *N = (TTree*)f->Get("NeutronD"); |
| 581 |
if(N && ND) { |
if(N && ND) { |
| 582 |
N->SetBranchAddress("NDLevel2", GetPointerToND()); |
N->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
| 583 |
cout << "NeutronD : set branch address NDLevel2"<<endl; |
cout << "NeutronD : set branch address NDLevel2"<<endl; |
| 584 |
if(!Tout)Tout=O; |
if(!Trout)Trout=O; |
| 585 |
else Tout->AddFriend(N); |
else Trout->AddFriend(N); |
| 586 |
}else{ |
}else{ |
| 587 |
cout << "NeutronD : missing tree"<<endl; |
cout << "NeutronD : missing tree"<<endl; |
| 588 |
}; |
}; |
| 589 |
// Anticounters |
// Anticounters |
| 590 |
TTree *A = (TTree*)f->Get("Anticounter"); |
TTree *A = (TTree*)f->Get("Anticounter"); |
| 591 |
if(A && AC) { |
if(A && AC) { |
| 592 |
A->SetBranchAddress("AcLevel2", GetPointerToAc()); |
A->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
| 593 |
cout << "Anticounter : set branch address AcLevel2"<<endl; |
cout << "Anticounter : set branch address AcLevel2"<<endl; |
| 594 |
if(!Tout)Tout=O; |
if(!Trout)Trout=O; |
| 595 |
else Tout->AddFriend(A); |
else Trout->AddFriend(A); |
| 596 |
}else{ |
}else{ |
| 597 |
cout << "Anticounter : missing tree"<<endl; |
cout << "Anticounter : missing tree"<<endl; |
| 598 |
}; |
}; |
| 599 |
// Orbital Info |
// Orbital Info |
| 600 |
TTree *B = (TTree*)f->Get("OrbitalInfo"); |
TTree *B = (TTree*)f->Get("OrbitalInfo"); |
| 601 |
if(B && ORB) { |
if(B && ORB) { |
| 602 |
B->SetBranchAddress("OrbitalInfo", GetPointerToOrb()); |
B->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
|
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
|
|
if(!Tout)Tout=O; |
|
|
else Tout->AddFriend(B); |
|
|
}else{ |
|
|
cout << "OrbitalInfo : missing tree"<<endl; |
|
|
}; |
|
|
|
|
|
return Tout; |
|
|
|
|
|
} |
|
|
//-------------------------------------- |
|
|
// |
|
|
// |
|
|
//-------------------------------------- |
|
|
/** |
|
|
* Get the Pamela detector trees in a single file and make them friends. |
|
|
* @param f TFile pointer |
|
|
* @return Pointer to a TTree |
|
|
*/ |
|
|
TTree *PamLevel2::LoadPamTrees(TFile *f){ |
|
|
|
|
|
TTree *Tout =0; |
|
|
|
|
|
SetWhichTrees("+ALL"); |
|
|
|
|
|
// Tracker |
|
|
TTree *T = (TTree*)f->Get("Tracker"); |
|
|
if(T && TRK) { |
|
|
T->SetBranchAddress("TrkLevel2", GetPointerToTrk()); |
|
|
cout << "Tracker : set branch address TrkLevel2"<<endl; |
|
|
if(!Tout)Tout=T; |
|
|
}else{ |
|
|
cout << "Tracker : missing tree"<<endl; |
|
|
}; |
|
|
// Calorimeter |
|
|
TTree *C = (TTree*)f->Get("Calorimeter"); |
|
|
if(C && CAL) { |
|
|
C->SetBranchAddress("CaloLevel2", GetPointerToCalo()); |
|
|
cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
|
|
if(!Tout)Tout=C; |
|
|
else Tout->AddFriend(C); |
|
|
}else{ |
|
|
cout << "Calorimeter : missing tree"<<endl; |
|
|
}; |
|
|
// ToF |
|
|
TTree *O = (TTree*)f->Get("ToF"); |
|
|
if(O && TOF) { |
|
|
O->SetBranchAddress("ToFLevel2", GetPointerToToF()); |
|
|
cout << "ToF : set branch address ToFLevel2"<<endl; |
|
|
if(!Tout)Tout=O; |
|
|
else Tout->AddFriend(O); |
|
|
}else{ |
|
|
cout << "ToF : missing tree"<<endl; |
|
|
}; |
|
|
// Trigger |
|
|
TTree *R = (TTree*)f->Get("Trigger"); |
|
|
if(R && TRG) { |
|
|
R->SetBranchAddress("TrigLevel2", GetPointerToTrig()); |
|
|
cout << "Trigger : set branch address TrigLevel2"<<endl; |
|
|
if(!Tout)Tout=O; |
|
|
else Tout->AddFriend(R); |
|
|
}else{ |
|
|
cout << "Trigger : missing tree"<<endl; |
|
|
}; |
|
|
// S4 |
|
|
TTree *S = (TTree*)f->Get("S4"); |
|
|
if(S && S4) { |
|
|
S->SetBranchAddress("S4Level2", GetPointerToS4()); |
|
|
cout << "S4 : set branch address S4Level2"<<endl; |
|
|
if(!Tout)Tout=O; |
|
|
else Tout->AddFriend(S); |
|
|
}else{ |
|
|
cout << "S4 : missing tree"<<endl; |
|
|
}; |
|
|
// Neutron Detector |
|
|
TTree *N = (TTree*)f->Get("NeutronD"); |
|
|
if(N && ND) { |
|
|
N->SetBranchAddress("NDLevel2", GetPointerToND()); |
|
|
cout << "NeutronD : set branch address NDLevel2"<<endl; |
|
|
if(!Tout)Tout=O; |
|
|
else Tout->AddFriend(N); |
|
|
}else{ |
|
|
cout << "NeutronD : missing tree"<<endl; |
|
|
}; |
|
|
// Anticounters |
|
|
TTree *A = (TTree*)f->Get("Anticounter"); |
|
|
if(A && AC) { |
|
|
A->SetBranchAddress("AcLevel2", GetPointerToAc()); |
|
|
cout << "Anticounter : set branch address AcLevel2"<<endl; |
|
|
if(!Tout)Tout=O; |
|
|
else Tout->AddFriend(A); |
|
|
}else{ |
|
|
cout << "Anticounter : missing tree"<<endl; |
|
|
}; |
|
|
// Orbital Info |
|
|
TTree *B = (TTree*)f->Get("OrbitalInfo"); |
|
|
if(B && ORB) { |
|
|
B->SetBranchAddress("OrbitalInfo", GetPointerToOrb()); |
|
| 603 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
| 604 |
if(!Tout)Tout=O; |
if(!Trout)Trout=O; |
| 605 |
else Tout->AddFriend(B); |
else Trout->AddFriend(B); |
| 606 |
}else{ |
}else{ |
| 607 |
cout << "OrbitalInfo : missing tree"<<endl; |
cout << "OrbitalInfo : missing tree"<<endl; |
| 608 |
}; |
}; |
| 609 |
|
|
| 610 |
return Tout; |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
| 611 |
|
|
| 612 |
|
return Trout; |
| 613 |
|
|
| 614 |
} |
} |
| 615 |
//-------------------------------------- |
//-------------------------------------- |
| 625 |
*/ |
*/ |
| 626 |
TList* PamLevel2::GetListOfLevel2Files(TString ddir, TString flisttxt = ""){ |
TList* PamLevel2::GetListOfLevel2Files(TString ddir, TString flisttxt = ""){ |
| 627 |
|
|
| 628 |
TString wdir = gSystem->WorkingDirectory(); |
TString wdir = gSystem->WorkingDirectory(); |
| 629 |
|
|
| 630 |
|
if(ddir=="")ddir = wdir; |
| 631 |
|
// TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
| 632 |
|
cout << "Level2 data directory : "<< ddir << endl; |
| 633 |
|
|
| 634 |
|
TList *contents = new TList; // create output list |
| 635 |
|
contents->SetOwner(); |
| 636 |
|
|
| 637 |
|
char *fullpath; |
| 638 |
|
|
| 639 |
|
// if no input file list is given: |
| 640 |
|
if ( flisttxt != "" ){ |
| 641 |
|
|
| 642 |
|
if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) )return 0; |
| 643 |
|
|
| 644 |
if(ddir=="")ddir = wdir; |
// flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
| 645 |
TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
flisttxt = fullpath; |
|
cout << "Level2 data directory : "<< endl << ddir << endl; |
|
|
|
|
|
TList *contents = new TList; // create output list |
|
|
contents->SetOwner(); |
|
|
|
|
|
// if no input file list is given: |
|
|
if ( flisttxt != "" ){ |
|
|
|
|
|
if( !gSystem->ChangeDirectory(ddir) )return 0; |
|
| 646 |
|
|
| 647 |
flisttxt = gSystem->ConcatFileName(wdir,gSystem->BaseName(flisttxt)); |
if( !gSystem->ChangeDirectory(ddir) )return 0; |
| 648 |
|
|
| 649 |
cout <<"Input file list : "<< endl << flisttxt <<endl; |
cout <<"Input file list : " << flisttxt <<endl; |
| 650 |
ifstream in; |
ifstream in; |
| 651 |
in.open(flisttxt, ios::in); |
in.open(flisttxt, ios::in); //open input file list |
| 652 |
while (1) { |
int line=0; |
| 653 |
TString file; |
while (1) { |
| 654 |
in >> file; |
TString file; |
| 655 |
if (!in.good()) break; |
in >> file; |
| 656 |
char *fullpath; |
if (!in.good()) break; |
| 657 |
if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
line++; |
| 658 |
// contents->Add(new TSystemDirectory(fullpath,ddir)); // add file to the list |
// cout <<"(1) " << file << endl; |
| 659 |
// contents->Add(new TSystemFile(fullpath,ddir)); // add file to the list |
if(file.IsNull()){ |
| 660 |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
cout << "-- list interrupted at line "<<line <<endl; |
| 661 |
}else{ |
break; |
| 662 |
cout << "warning! --- File "<<file<<" does not exists"<< endl; |
} |
| 663 |
}; |
if(file.Contains("#"))file = file(0,file.First("#")); |
| 664 |
}; |
// cout <<"(2) " << file << endl; |
| 665 |
in.close(); |
if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
| 666 |
|
|
| 667 |
}else{ |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
| 668 |
|
|
| 669 |
|
}else{ |
| 670 |
|
// if(file.Data()!="")cout << "File: "<<file<<" ---> missing "<< endl; |
| 671 |
|
}; |
| 672 |
|
}; |
| 673 |
|
in.close(); |
| 674 |
|
|
| 675 |
|
}else{ |
| 676 |
|
|
| 677 |
cout << "No input file list given."<<endl; |
cout << "No input file list given."<<endl; |
| 678 |
cout << "Check for existing root files."<<endl; |
cout << "Check for existing root files."<<endl; |
| 679 |
// cout << "Warking directory: "<< gSystem->WorkingDirectory()<< endl; |
// cout << "Warking directory: "<< gSystem->WorkingDirectory()<< endl; |
| 680 |
|
|
| 681 |
TList *temp = datadir->GetListOfFiles(); |
TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); |
| 682 |
|
TList *temp = datadir->GetListOfFiles(); |
| 683 |
// temp->Print(); |
// temp->Print(); |
| 684 |
// cout << "*************************************" << endl; |
// cout << "*************************************" << endl; |
|
|
|
|
TIter next(temp); |
|
|
TSystemFile *questo = 0; |
|
|
|
|
|
|
|
|
while ( (questo = (TSystemFile*) next()) ) { |
|
|
TString name = questo-> GetName(); |
|
|
if( name.EndsWith(".root") ){ |
|
|
char *fullpath; |
|
|
gSystem->IsFileInIncludePath(name,&fullpath); |
|
|
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath))); |
|
|
}; |
|
|
} |
|
|
delete temp; |
|
| 685 |
|
|
| 686 |
}; |
TIter next(temp); |
| 687 |
gSystem->ChangeDirectory(wdir); |
TSystemFile *questo = 0; |
| 688 |
cout << endl << "Selected files:" << endl; |
|
| 689 |
contents->Print(); |
|
| 690 |
cout << endl; |
while ( (questo = (TSystemFile*) next()) ) { |
| 691 |
// cout << "Warking directory: "<< gSystem->WorkingDirectory()<< endl; |
TString name = questo-> GetName(); |
| 692 |
return contents; |
if( name.EndsWith(".root") ){ |
| 693 |
|
char *fullpath; |
| 694 |
|
gSystem->IsFileInIncludePath(name,&fullpath); |
| 695 |
|
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath))); |
| 696 |
|
}; |
| 697 |
|
} |
| 698 |
|
delete temp; |
| 699 |
|
delete datadir; |
| 700 |
|
|
| 701 |
|
}; |
| 702 |
|
gSystem->ChangeDirectory(wdir); // back to the working directory |
| 703 |
|
// cout << endl << "Selected files:" << endl; |
| 704 |
|
// contents->Print(); |
| 705 |
|
cout << contents->GetEntries()<<" files selected\n"; |
| 706 |
|
// cout << endl; |
| 707 |
|
// cout << "Working directory: "<< gSystem->WorkingDirectory()<< endl; |
| 708 |
|
return contents; |
| 709 |
}; |
}; |
| 710 |
//-------------------------------------- |
//-------------------------------------- |
| 711 |
// |
// |
| 717 |
* @param detlist String to select trees to be included |
* @param detlist String to select trees to be included |
| 718 |
* @return Pointer to a TChain |
* @return Pointer to a TChain |
| 719 |
*/ |
*/ |
| 720 |
TChain *PamLevel2::LoadPamTrees(TList *fl, TString detlist="+ALL"){ |
TChain *PamLevel2::GetPamTree(TList *fl, TString detlist="+ALL"){ |
| 721 |
|
|
| 722 |
TChain *Tout=0; |
// TChain *Tout=0; |
| 723 |
|
// if(Tout)Tout->Delete(); |
| 724 |
SetWhichTrees(detlist); |
// Tout = NULL; |
| 725 |
|
|
| 726 |
TChain *T = 0; |
TChain *Tout =0; |
| 727 |
TChain *C = 0; |
|
| 728 |
TChain *O = 0; |
SetWhichTrees(detlist); |
| 729 |
TChain *R = 0; |
|
| 730 |
TChain *S = 0; |
TChain *T = 0; |
| 731 |
TChain *N = 0; |
TChain *C = 0; |
| 732 |
TChain *A = 0; |
TChain *O = 0; |
| 733 |
TChain *B = 0; |
TChain *R = 0; |
| 734 |
|
TChain *S = 0; |
| 735 |
if(TRK) T = new TChain("Tracker"); |
TChain *N = 0; |
| 736 |
if(CAL) C = new TChain("Calorimeter"); |
TChain *A = 0; |
| 737 |
if(TOF) O = new TChain("ToF"); |
TChain *B = 0; |
| 738 |
if(TRG) R = new TChain("Trigger"); |
|
| 739 |
if(S4) S = new TChain("S4"); |
if(TRK2||TRK1||TRKh) T = new TChain("Tracker"); |
| 740 |
if(ND) N = new TChain("NeutronD"); |
if(CAL2||CAL1) C = new TChain("Calorimeter"); |
| 741 |
if(AC) A = new TChain("Anticounter"); |
if(TOF) O = new TChain("ToF"); |
| 742 |
if(ORB) B = new TChain("OrbitalInfo"); |
if(TRG) R = new TChain("Trigger"); |
| 743 |
|
if(S4) S = new TChain("S4"); |
| 744 |
// loop over files and create chains |
if(ND) N = new TChain("NeutronD"); |
| 745 |
TIter next(fl); |
if(AC) A = new TChain("Anticounter"); |
| 746 |
TSystemFile *questo = 0; |
if(ORB) B = new TChain("OrbitalInfo"); |
| 747 |
while ( (questo = (TSystemFile*) next()) ) { |
|
| 748 |
TString name = questo->GetName(); |
// loop over files and create chains |
| 749 |
|
TIter next(fl); |
| 750 |
|
TSystemFile *questo = 0; |
| 751 |
|
while ( (questo = (TSystemFile*) next()) ) { |
| 752 |
|
TString name = questo->GetName(); |
| 753 |
// cout << "File: "<< name << endl; |
// cout << "File: "<< name << endl; |
| 754 |
if( CheckLevel2File(name) ){ |
if( CheckLevel2File(name) ){ |
| 755 |
if(TRK) T->Add(name); |
if(TRK2||TRK1||TRKh) T->Add(name); |
| 756 |
if(CAL) C->Add(name); |
if(CAL1||CAL2) C->Add(name); |
| 757 |
if(TOF) O->Add(name); |
if(TOF) O->Add(name); |
| 758 |
if(TRG) R->Add(name); |
if(TRG) R->Add(name); |
| 759 |
if(S4) S->Add(name); |
if(S4) S->Add(name); |
| 760 |
if(ND) N->Add(name); |
if(ND) N->Add(name); |
| 761 |
if(AC) A->Add(name); |
if(AC) A->Add(name); |
| 762 |
if(ORB) B->Add(name); |
if(ORB) B->Add(name); |
|
}; |
|
|
} |
|
|
|
|
|
// Tracker |
|
|
if(TRK) { |
|
|
T->SetBranchAddress("TrkLevel2", GetPointerToTrk()); |
|
|
cout << "Tracker : set branch address TrkLevel2"<<endl; |
|
|
if(!Tout)Tout=T; |
|
| 763 |
}; |
}; |
| 764 |
|
} |
| 765 |
|
|
| 766 |
// Calorimeter |
cout << "done chain \n"; |
| 767 |
if(CAL) { |
|
| 768 |
C->SetBranchAddress("CaloLevel2", GetPointerToCalo()); |
// Calorimeter |
| 769 |
cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
if(CAL2||CAL1) { |
| 770 |
if(!Tout)Tout=C; |
if(!Tout)Tout=C; |
| 771 |
else Tout->AddFriend("Calorimeter"); |
else Tout->AddFriend("Calorimeter"); |
| 772 |
}; |
}; |
|
|
|
| 773 |
// ToF |
// ToF |
| 774 |
if(TOF) { |
if(TOF) { |
| 775 |
O->SetBranchAddress("ToFLevel2", GetPointerToToF()); |
if(!Tout)Tout=O; |
| 776 |
cout << "ToF : set branch address ToFLevel2"<<endl; |
else Tout->AddFriend("ToF"); |
| 777 |
if(!Tout)Tout=O; |
}; |
| 778 |
else Tout->AddFriend("ToF"); |
// Tracker |
| 779 |
}; |
if(TRK2||TRK1||TRKh){ |
| 780 |
|
if(!Tout)Tout=T; |
| 781 |
|
else Tout->AddFriend("Tracker"); |
| 782 |
|
} |
| 783 |
// Trigger |
// Trigger |
| 784 |
if(TRG) { |
if(TRG) { |
| 785 |
R->SetBranchAddress("TrigLevel2", GetPointerToTrig()); |
if(!Tout)Tout=R; |
| 786 |
cout << "Trigger : set branch address TrigLevel2"<<endl; |
else Tout->AddFriend("Trigger"); |
| 787 |
if(!Tout)Tout=O; |
}; |
|
else Tout->AddFriend("Trigger"); |
|
|
}; |
|
| 788 |
// S4 |
// S4 |
| 789 |
if(S4) { |
if(S4) { |
| 790 |
S->SetBranchAddress("S4Level2", GetPointerToS4()); |
if(!Tout)Tout=S; |
| 791 |
cout << "S4 : set branch address S4Level2"<<endl; |
else Tout->AddFriend("S4"); |
| 792 |
if(!Tout)Tout=O; |
}; |
|
else Tout->AddFriend("S4"); |
|
|
}; |
|
| 793 |
// Neutron Detector |
// Neutron Detector |
| 794 |
if(ND) { |
if(ND) { |
| 795 |
N->SetBranchAddress("NDLevel2", GetPointerToND()); |
if(!Tout)Tout=N; |
| 796 |
cout << "NeutronD : set branch address NDLevel2"<<endl; |
else Tout->AddFriend("NeutronD"); |
| 797 |
if(!Tout)Tout=O; |
}; |
|
else Tout->AddFriend("NeutronD"); |
|
|
}; |
|
| 798 |
// Anticounters |
// Anticounters |
| 799 |
if(AC) { |
if(AC) { |
| 800 |
A->SetBranchAddress("AcLevel2", GetPointerToAc()); |
if(!Tout)Tout=A; |
| 801 |
cout << "Anticounter : set branch address AcLevel2"<<endl; |
else Tout->AddFriend("Anticounter"); |
| 802 |
if(!Tout)Tout=O; |
}; |
|
else Tout->AddFriend("Anticounter"); |
|
|
}; |
|
| 803 |
// OrbitalInfo |
// OrbitalInfo |
| 804 |
if(ORB) { |
if(ORB) { |
| 805 |
B->SetBranchAddress("OrbitalInfo", GetPointerToOrb()); |
if(!Tout)Tout=B; |
| 806 |
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
else Tout->AddFriend("OrbitalInfo"); |
| 807 |
if(!Tout)Tout=O; |
}; |
| 808 |
else Tout->AddFriend("OrbitalInfo"); |
|
| 809 |
|
// cout<<endl<<" Number of entries: "<<Tout->GetEntries()<<endl<<endl; |
| 810 |
|
|
| 811 |
|
// if( Tout->GetEntries() )PamLevel2::SetBranchAddress(); |
| 812 |
|
if( Tout->GetEntries() )PamLevel2::SetBranchAddress( Tout ); |
| 813 |
|
|
| 814 |
|
return Tout; |
| 815 |
|
} |
| 816 |
|
|
| 817 |
|
|
| 818 |
|
|
| 819 |
|
//-------------------------------------- |
| 820 |
|
// |
| 821 |
|
// |
| 822 |
|
//-------------------------------------- |
| 823 |
|
/** |
| 824 |
|
* Set branch addresses for Pamela friend trees |
| 825 |
|
*/ |
| 826 |
|
void PamLevel2::SetBranchAddress(TTree *t){ |
| 827 |
|
|
| 828 |
|
TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
| 829 |
|
TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
| 830 |
|
TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
| 831 |
|
CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
| 832 |
|
CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
| 833 |
|
TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
| 834 |
|
TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
| 835 |
|
S4 = S4 & t->GetBranchStatus("S4Level2"); |
| 836 |
|
ND = ND & t->GetBranchStatus("NDLevel2"); |
| 837 |
|
AC = AC & t->GetBranchStatus("AcLevel2"); |
| 838 |
|
ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
| 839 |
|
|
| 840 |
|
|
| 841 |
|
// Tracker |
| 842 |
|
if(TRK1) { |
| 843 |
|
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel2")); |
| 844 |
|
cout << "Tracker : set branch address TrkLevel1"<<endl; |
| 845 |
|
}; |
| 846 |
|
if(TRK2) { |
| 847 |
|
t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel1")); |
| 848 |
|
cout << "Tracker : set branch address TrkLevel2"<<endl; |
| 849 |
|
}; |
| 850 |
|
if(TRKh) { |
| 851 |
|
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
| 852 |
|
cout << "Tracker : set branch address TrkHough"<<endl; |
| 853 |
|
}; |
| 854 |
|
|
| 855 |
|
// Calorimeter |
| 856 |
|
if(CAL1) { |
| 857 |
|
t->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
| 858 |
|
cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
| 859 |
|
}; |
| 860 |
|
if(CAL2) { |
| 861 |
|
t->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
| 862 |
|
cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
| 863 |
|
}; |
| 864 |
|
|
| 865 |
|
// ToF |
| 866 |
|
if(TOF) { |
| 867 |
|
t->SetBranchAddress("ToFLevel2", GetPointerTo("ToFLevel2")); |
| 868 |
|
cout << "ToF : set branch address ToFLevel2"<<endl; |
| 869 |
|
}; |
| 870 |
|
// Trigger |
| 871 |
|
if(TRG) { |
| 872 |
|
t->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
| 873 |
|
cout << "Trigger : set branch address TrigLevel2"<<endl; |
| 874 |
|
}; |
| 875 |
|
// S4 |
| 876 |
|
if(S4) { |
| 877 |
|
t->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
| 878 |
|
cout << "S4 : set branch address S4Level2"<<endl; |
| 879 |
|
}; |
| 880 |
|
// Neutron Detector |
| 881 |
|
if(ND) { |
| 882 |
|
t->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
| 883 |
|
cout << "NeutronD : set branch address NDLevel2"<<endl; |
| 884 |
|
}; |
| 885 |
|
// Anticounters |
| 886 |
|
if(AC) { |
| 887 |
|
t->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
| 888 |
|
cout << "Anticounter : set branch address AcLevel2"<<endl; |
| 889 |
|
}; |
| 890 |
|
// OrbitalInfo |
| 891 |
|
if(ORB) { |
| 892 |
|
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
| 893 |
|
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
| 894 |
|
}; |
| 895 |
|
|
| 896 |
|
} |
| 897 |
|
/** |
| 898 |
|
* Set branch addresses for Pamela friend trees |
| 899 |
|
*/ |
| 900 |
|
void PamLevel2::SetBranchAddress(TChain *t){ |
| 901 |
|
|
| 902 |
|
TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); |
| 903 |
|
TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); |
| 904 |
|
TRKh = TRKh & t->GetBranchStatus("TrkHough"); |
| 905 |
|
CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); |
| 906 |
|
CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); |
| 907 |
|
TOF = TOF & t->GetBranchStatus("ToFLevel2"); |
| 908 |
|
TRG = TRG & t->GetBranchStatus("TrigLevel2"); |
| 909 |
|
S4 = S4 & t->GetBranchStatus("S4Level2"); |
| 910 |
|
ND = ND & t->GetBranchStatus("NDLevel2"); |
| 911 |
|
AC = AC & t->GetBranchStatus("AcLevel2"); |
| 912 |
|
ORB = ORB & t->GetBranchStatus("OrbitalInfo"); |
| 913 |
|
|
| 914 |
|
// Tracker |
| 915 |
|
if(TRK2) { |
| 916 |
|
t->SetBranchAddress("TrkLevel2", this->GetPointerTo("TrkLevel2")); |
| 917 |
|
cout << "Tracker : set branch address TrkLevel2"<<endl; |
| 918 |
|
}; |
| 919 |
|
if(TRK1) { |
| 920 |
|
t->SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); |
| 921 |
|
cout << "Tracker : set branch address TrkLevel1"<<endl; |
| 922 |
|
}; |
| 923 |
|
if(TRKh) { |
| 924 |
|
t->SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); |
| 925 |
|
cout << "Tracker : set branch address TrkHough"<<endl; |
| 926 |
|
}; |
| 927 |
|
|
| 928 |
|
// Calorimeter |
| 929 |
|
if(CAL2) { |
| 930 |
|
t->SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); |
| 931 |
|
cout << "Calorimeter : set branch address CaloLevel2"<<endl; |
| 932 |
|
}; |
| 933 |
|
if(CAL1) { |
| 934 |
|
t->SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); |
| 935 |
|
cout << "Calorimeter : set branch address CaloLevel1"<<endl; |
| 936 |
|
}; |
| 937 |
|
|
| 938 |
|
// ToF |
| 939 |
|
if(TOF) { |
| 940 |
|
t->SetBranchAddress("ToFLevel2", GetPointerTo("ToFLevel2")); |
| 941 |
|
cout << "ToF : set branch address ToFLevel2"<<endl; |
| 942 |
|
}; |
| 943 |
|
// Trigger |
| 944 |
|
if(TRG) { |
| 945 |
|
t->SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); |
| 946 |
|
cout << "Trigger : set branch address TrigLevel2"<<endl; |
| 947 |
|
}; |
| 948 |
|
// S4 |
| 949 |
|
if(S4) { |
| 950 |
|
t->SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); |
| 951 |
|
cout << "S4 : set branch address S4Level2"<<endl; |
| 952 |
|
}; |
| 953 |
|
// Neutron Detector |
| 954 |
|
if(ND) { |
| 955 |
|
t->SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); |
| 956 |
|
cout << "NeutronD : set branch address NDLevel2"<<endl; |
| 957 |
|
}; |
| 958 |
|
// Anticounters |
| 959 |
|
if(AC) { |
| 960 |
|
t->SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); |
| 961 |
|
cout << "Anticounter : set branch address AcLevel2"<<endl; |
| 962 |
|
}; |
| 963 |
|
// OrbitalInfo |
| 964 |
|
if(ORB) { |
| 965 |
|
t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); |
| 966 |
|
cout << "OrbitalInfo : set branch address OrbitalInfo"<<endl; |
| 967 |
|
}; |
| 968 |
|
|
| 969 |
|
} |
| 970 |
|
|
| 971 |
|
// void* PamLevel2::GetPointerToTrk() {return &trk2_obj;}; |
| 972 |
|
// void* PamLevel2::GetPointerToTrk(int s){ |
| 973 |
|
// switch (s) { |
| 974 |
|
// case 1: return &trk1_obj; |
| 975 |
|
// case 2: return &trk2_obj; |
| 976 |
|
// case 3: return &trkh_obj; |
| 977 |
|
// default: return 0; |
| 978 |
|
// }; |
| 979 |
|
// }; |
| 980 |
|
// void* PamLevel2::GetPointerToCalo() {return &calo2_obj; }; |
| 981 |
|
// void* GetPointerToCalo(int s){ |
| 982 |
|
// switch (s) { |
| 983 |
|
// case 1: return &calo1_obj; |
| 984 |
|
// case 2: return &calo2_obj; |
| 985 |
|
// default: return 0; |
| 986 |
|
// }; |
| 987 |
|
// }; |
| 988 |
|
// void* GetPointerToToF() {return &tof_obj; }; |
| 989 |
|
// void* GetPointerTo("TrigLevel2") {return &trig_obj; }; |
| 990 |
|
// void* GetPointerTo("S4Level2") {return &s4_obj; }; |
| 991 |
|
// void* GetPointerTo("NDLevel2") {return &nd_obj; }; |
| 992 |
|
// void* GetPointerTo("AcLevel2") {return &ac_obj; }; |
| 993 |
|
// void* GetPointerTo("OrbitalInfo") {return &orb_obj; }; |
| 994 |
|
// void* GetPointerTo("RunInfo") {return &run_obj; }; |
| 995 |
|
|
| 996 |
|
//-------------------------------------- |
| 997 |
|
// |
| 998 |
|
// |
| 999 |
|
//-------------------------------------- |
| 1000 |
|
/** |
| 1001 |
|
* Get the Run tree chain from a list of files. |
| 1002 |
|
* @param fl Pointer to a TList of TSystemFiles |
| 1003 |
|
* @return Pointer to a TChain |
| 1004 |
|
*/ |
| 1005 |
|
TChain *PamLevel2::GetRunTree(TList *fl){ |
| 1006 |
|
|
| 1007 |
|
TChain *R = new TChain("Run"); |
| 1008 |
|
|
| 1009 |
|
// loop over files and create chains |
| 1010 |
|
TIter next(fl); |
| 1011 |
|
TSystemFile *questo = 0; |
| 1012 |
|
while ( (questo = (TSystemFile*) next()) ) { |
| 1013 |
|
TString name = questo->GetName(); |
| 1014 |
|
// cout << "File: "<< name << endl; |
| 1015 |
|
if( CheckLevel2File(name) ){ |
| 1016 |
|
R->Add(name); |
| 1017 |
}; |
}; |
| 1018 |
|
} |
| 1019 |
|
|
| 1020 |
|
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
| 1021 |
|
cout << "Run : set branch address RunInfo"<<endl; |
| 1022 |
|
|
| 1023 |
|
return R; |
| 1024 |
|
|
| 1025 |
|
} |
| 1026 |
|
//-------------------------------------- |
| 1027 |
|
// |
| 1028 |
|
// |
| 1029 |
|
//-------------------------------------- |
| 1030 |
|
/** |
| 1031 |
|
* Get the Run tree from a file. |
| 1032 |
|
* @param f Pointer to a TFile |
| 1033 |
|
* @return Pointer to a TTree |
| 1034 |
|
*/ |
| 1035 |
|
TTree *PamLevel2::GetRunTree(TFile *f){ |
| 1036 |
|
|
| 1037 |
|
|
| 1038 |
|
TTree *R = (TTree*)f->Get("Run"); |
| 1039 |
|
|
| 1040 |
|
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
| 1041 |
|
cout << "Run : set branch address RunInfo"<<endl; |
| 1042 |
|
|
| 1043 |
return Tout; |
return R; |
| 1044 |
|
|
| 1045 |
} |
} |
| 1046 |
//-------------------------------------- |
//-------------------------------------- |
| 1048 |
// |
// |
| 1049 |
//-------------------------------------- |
//-------------------------------------- |
| 1050 |
/** |
/** |
| 1051 |
* Set which trees should be analysed |
* Set which trees shoul be analysed |
| 1052 |
* @param detlist TString containing the sequence of trees required |
* @param detlist TString containing the sequence of trees required |
| 1053 |
*/ |
*/ |
| 1054 |
void PamLevel2::SetWhichTrees(TString detlist){ |
void PamLevel2::SetWhichTrees(TString detlist){ |
| 1055 |
|
|
| 1056 |
if(detlist.Contains("+ALL", TString::kIgnoreCase)){ |
if(detlist.Contains("+ALL", TString::kIgnoreCase)){ |
| 1057 |
CAL = true; |
CAL1 = true; |
| 1058 |
TRK = true; |
CAL2 = true; |
| 1059 |
TRG = true; |
TRK2 = true; |
| 1060 |
TOF = true; |
TRK1 = false; |
| 1061 |
S4 = true; |
TRKh = false; |
| 1062 |
ND = true; |
TRG = true; |
| 1063 |
AC = true; |
TOF = true; |
| 1064 |
ORB = true; |
S4 = true; |
| 1065 |
}else if( detlist.Contains("-ALL", TString::kIgnoreCase) ){ |
ND = true; |
| 1066 |
CAL = false; |
AC = true; |
| 1067 |
TRK = false; |
ORB = true; |
| 1068 |
TRG = false; |
}else if( detlist.Contains("-ALL", TString::kIgnoreCase) ){ |
| 1069 |
TOF = false; |
CAL1 = false; |
| 1070 |
S4 = false; |
CAL2 = false; |
| 1071 |
ND = false; |
TRK2 = false; |
| 1072 |
AC = false; |
TRK1 = false; |
| 1073 |
ORB = false; |
TRKh = false; |
| 1074 |
}; |
TRG = false; |
| 1075 |
|
TOF = false; |
| 1076 |
if( detlist.Contains("-CAL", TString::kIgnoreCase) )CAL = false; |
S4 = false; |
| 1077 |
else if( detlist.Contains("+CAL", TString::kIgnoreCase) )CAL = true; |
ND = false; |
| 1078 |
|
AC = false; |
| 1079 |
if( detlist.Contains("-TRK", TString::kIgnoreCase) )TRK = false; |
ORB = false; |
| 1080 |
else if( detlist.Contains("+TRK", TString::kIgnoreCase) )TRK = true; |
}; |
| 1081 |
|
|
| 1082 |
if( detlist.Contains("-TRG", TString::kIgnoreCase) )TRG = false; |
// ------------------------------------------------------------------------- |
| 1083 |
else if( detlist.Contains("+TRG", TString::kIgnoreCase) )TRG = true; |
if( detlist.Contains("CAL1", TString::kIgnoreCase) ){ |
| 1084 |
|
if ( detlist.Contains("-CAL1", TString::kIgnoreCase) )CAL1=false; |
| 1085 |
if( detlist.Contains("-TOF", TString::kIgnoreCase) )TOF = false; |
if ( detlist.Contains("+CAL1", TString::kIgnoreCase) )CAL1=true; |
| 1086 |
else if( detlist.Contains("+TOF", TString::kIgnoreCase) )TOF = true; |
}; |
|
|
|
|
if( detlist.Contains("-S4", TString::kIgnoreCase) )S4 = false; |
|
|
else if( detlist.Contains("+S4", TString::kIgnoreCase) )S4 = true; |
|
| 1087 |
|
|
| 1088 |
if( detlist.Contains("-ND", TString::kIgnoreCase) )ND = false; |
if( detlist.Contains("CAL2", TString::kIgnoreCase)){ |
| 1089 |
else if( detlist.Contains("+ND", TString::kIgnoreCase) )ND = true; |
if ( detlist.Contains("-CAL2", TString::kIgnoreCase) )CAL2=false; |
| 1090 |
|
if ( detlist.Contains("+CAL2", TString::kIgnoreCase) )CAL2=true; |
| 1091 |
|
}; |
| 1092 |
|
|
| 1093 |
if( detlist.Contains("-AC", TString::kIgnoreCase) )AC = false; |
if( detlist.Contains("+CAL", TString::kIgnoreCase) && !CAL1 && !CAL2 )CAL2=true; |
| 1094 |
else if( detlist.Contains("+AC", TString::kIgnoreCase) )AC = true; |
if( detlist.Contains("-CAL", TString::kIgnoreCase) && CAL1 && CAL2 ){ |
| 1095 |
|
CAL2=false; |
| 1096 |
|
CAL1=false; |
| 1097 |
|
} |
| 1098 |
|
// ------------------------------------------------------------------------- |
| 1099 |
|
if( detlist.Contains("TRK1", TString::kIgnoreCase) ){ |
| 1100 |
|
if ( detlist.Contains("-TRK1", TString::kIgnoreCase) )TRK1=false; |
| 1101 |
|
if ( detlist.Contains("+TRK1", TString::kIgnoreCase) )TRK1=true; |
| 1102 |
|
}; |
| 1103 |
|
|
| 1104 |
if( detlist.Contains("-ORB", TString::kIgnoreCase) )ORB = false; |
if( detlist.Contains("TRK2", TString::kIgnoreCase)){ |
| 1105 |
else if( detlist.Contains("+ORB", TString::kIgnoreCase) )ORB = true; |
if ( detlist.Contains("-TRK2", TString::kIgnoreCase) )TRK2=false; |
| 1106 |
|
if ( detlist.Contains("+TRK2", TString::kIgnoreCase) )TRK2=true; |
| 1107 |
|
}; |
| 1108 |
|
|
| 1109 |
|
if( detlist.Contains("TRKh", TString::kIgnoreCase)){ |
| 1110 |
|
if ( detlist.Contains("-TRKh", TString::kIgnoreCase) )TRKh=false; |
| 1111 |
|
if ( detlist.Contains("+TRKh", TString::kIgnoreCase) )TRKh=true; |
| 1112 |
|
}; |
| 1113 |
|
|
| 1114 |
|
if( detlist.Contains("+TRK", TString::kIgnoreCase) && !TRK1 && !TRK2 && !TRKh )TRK2=true; |
| 1115 |
|
if( detlist.Contains("-TRK", TString::kIgnoreCase) && TRK1 && TRK2 && TRKh){ |
| 1116 |
|
TRK2=false; |
| 1117 |
|
TRK1=false; |
| 1118 |
|
TRKh=false; |
| 1119 |
|
} |
| 1120 |
|
// ------------------------------------------------------------------------- |
| 1121 |
|
|
| 1122 |
|
|
| 1123 |
|
|
| 1124 |
|
// if( detlist.Contains("-TRK", TString::kIgnoreCase) )TRK2 = false; |
| 1125 |
|
// else if( detlist.Contains("+TRK", TString::kIgnoreCase) )TRK2 = true; |
| 1126 |
|
|
| 1127 |
|
// if( detlist.Contains("-TRK1", TString::kIgnoreCase) )TRK1 = false; |
| 1128 |
|
// else if( detlist.Contains("+TRK1", TString::kIgnoreCase) )TRK1 = true; |
| 1129 |
|
|
| 1130 |
|
// if( detlist.Contains("-TRKh", TString::kIgnoreCase) )TRKh = false; |
| 1131 |
|
// else if( detlist.Contains("+TRKh", TString::kIgnoreCase) )TRKh = true; |
| 1132 |
|
|
| 1133 |
|
if( detlist.Contains("-TRG", TString::kIgnoreCase) )TRG = false; |
| 1134 |
|
else if( detlist.Contains("+TRG", TString::kIgnoreCase) )TRG = true; |
| 1135 |
|
|
| 1136 |
|
if( detlist.Contains("-TOF", TString::kIgnoreCase) )TOF = false; |
| 1137 |
|
else if( detlist.Contains("+TOF", TString::kIgnoreCase) )TOF = true; |
| 1138 |
|
|
| 1139 |
|
if( detlist.Contains("-S4", TString::kIgnoreCase) )S4 = false; |
| 1140 |
|
else if( detlist.Contains("+S4", TString::kIgnoreCase) )S4 = true; |
| 1141 |
|
|
| 1142 |
|
if( detlist.Contains("-ND", TString::kIgnoreCase) )ND = false; |
| 1143 |
|
else if( detlist.Contains("+ND", TString::kIgnoreCase) )ND = true; |
| 1144 |
|
|
| 1145 |
|
if( detlist.Contains("-AC", TString::kIgnoreCase) )AC = false; |
| 1146 |
|
else if( detlist.Contains("+AC", TString::kIgnoreCase) )AC = true; |
| 1147 |
|
|
| 1148 |
|
if( detlist.Contains("-ORB", TString::kIgnoreCase) )ORB = false; |
| 1149 |
|
else if( detlist.Contains("+ORB", TString::kIgnoreCase) )ORB = true; |
| 1150 |
|
|
| 1151 |
}; |
}; |
| 1152 |
//-------------------------------------- |
//-------------------------------------- |
| 1153 |
// |
// |
| 1154 |
// |
// |
| 1155 |
//-------------------------------------- |
//-------------------------------------- |
| 1156 |
/** |
/** |
| 1157 |
* Check if a file contains required trees. |
* Check if a file contains selected Pamela Level2 trees. |
| 1158 |
* @param name File name |
* @param name File name |
| 1159 |
* @return Pointer to a TChain |
* @return true if the file is ok. |
| 1160 |
*/ |
*/ |
| 1161 |
Bool_t PamLevel2::CheckLevel2File(TString name){ |
Bool_t PamLevel2::CheckLevel2File(TString name){ |
| 1162 |
|
|
| 1163 |
Bool_t CAL__ok = false; |
Bool_t CAL1__ok = false; |
| 1164 |
Bool_t TRK__ok = false; |
Bool_t CAL2__ok = false; |
| 1165 |
Bool_t TRG__ok = false; |
Bool_t TRK2__ok = false; |
| 1166 |
Bool_t TOF__ok = false; |
Bool_t TRK1__ok = false; |
| 1167 |
Bool_t S4__ok = false; |
Bool_t TRKh__ok = false; |
| 1168 |
Bool_t ND__ok = false; |
Bool_t TRG__ok = false; |
| 1169 |
Bool_t AC__ok = false; |
Bool_t TOF__ok = false; |
| 1170 |
Bool_t ORB__ok = false; |
Bool_t S4__ok = false; |
| 1171 |
|
Bool_t ND__ok = false; |
| 1172 |
Bool_t RUN__ok = false; |
Bool_t AC__ok = false; |
| 1173 |
|
Bool_t ORB__ok = false; |
| 1174 |
TFile *f = new TFile(name.Data()); |
|
| 1175 |
TList *lk = f->GetListOfKeys(); |
Bool_t RUN__ok = false; |
| 1176 |
// lk->Print(); |
|
| 1177 |
TIter next(lk); |
|
| 1178 |
TKey *key =0; |
|
| 1179 |
while( (key = (TKey*)next()) ){ |
cout << "Checking file: "<<name<<endl; |
| 1180 |
// cout << key->GetName() << endl; |
TFile *f = new TFile(name.Data()); |
| 1181 |
if( !strcmp(key->GetName(),"Calorimeter") )CAL__ok = true; |
if( !f || f->IsZombie() ){ |
| 1182 |
if( !strcmp(key->GetName(),"Tracker" ) )TRK__ok = true; |
cout << "File: "<< f->GetName() <<" discarded ---- Non valid root file"<< endl; return false; |
| 1183 |
if( !strcmp(key->GetName(),"Trigger" ) )TRG__ok = true; |
} |
| 1184 |
if( !strcmp(key->GetName(),"ToF" ) )TOF__ok = true; |
// cout << "Get list of keys: "<<f<<endl; |
| 1185 |
if( !strcmp(key->GetName(),"S4" ) )S4__ok = true; |
TList *lk = f->GetListOfKeys(); |
| 1186 |
if( !strcmp(key->GetName(),"NeutronD" ) )ND__ok = true; |
// lk->Print(); |
| 1187 |
if( !strcmp(key->GetName(),"Anticounter") )AC__ok = true; |
TIter next(lk); |
| 1188 |
if( !strcmp(key->GetName(),"OrbitalInfo") )ORB__ok = true; |
TKey *key =0; |
| 1189 |
if( !strcmp(key->GetName(),"Run" ) )RUN__ok = true; |
|
| 1190 |
}; |
Int_t nev = 0; |
| 1191 |
|
|
| 1192 |
lk->Delete(); |
while( (key = (TKey*)next()) ){ |
| 1193 |
f->Close(); |
|
| 1194 |
|
// cout << key->GetName() << endl; |
| 1195 |
Bool_t FLAG = true; |
// cout << " Get tree: " << f->Get(key->GetName())<<endl; |
| 1196 |
if(!RUN__ok) { |
// nev_previous = nev; |
| 1197 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing RunInfo tree"<< endl; |
// cout << " n.entries "<< nev <<endl; |
| 1198 |
FLAG = false; |
// if( key->GetClassName()=="TTree" && nev_previous && nev != nev_previous ){ |
| 1199 |
}; |
// nev = ((TTree*)f->Get(key->GetName()))->GetEntries(); |
| 1200 |
if(CAL && !CAL__ok){ |
// cout << "File: "<< f->GetName() <<" discarded ---- "<< key->GetName() << " tree: n.entries does not match "<<nev<<" "<<nev_previous<< endl; |
| 1201 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing Calorimeter tree"<< endl; |
// return false; |
| 1202 |
FLAG = false; |
// }; |
| 1203 |
}; |
|
| 1204 |
if(TRK && !TRK__ok){ |
if( !strcmp(key->GetName(),"Run" ) )RUN__ok = true; |
| 1205 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing Tracker tree"<< endl; |
|
| 1206 |
FLAG = false; |
//========================================================= |
| 1207 |
}; |
if( !strcmp(key->GetName(),"Trigger" ) ){ |
| 1208 |
if(TRG && !TRG__ok){ |
TRG__ok = true; |
| 1209 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing Trigger tree"<< endl; |
if(TRG){ |
| 1210 |
FLAG = false; |
Int_t nevt = ((TTree*)f->Get("Trigger"))->GetEntries(); |
| 1211 |
}; |
if( nev && nevt!=nev){ |
| 1212 |
if(TOF && !TOF__ok){ |
cout << "File: "<< f->GetName() <<" discarded ---- Trigger tree has "<<nevt<<" events instead of "<<nev<< endl; |
| 1213 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing ToF tree"<< endl; |
return false; |
| 1214 |
FLAG = false; |
} |
| 1215 |
}; |
nev=nevt; |
| 1216 |
if(S4 && !S4__ok){ |
} |
| 1217 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing S4 tree"<< endl; |
} |
| 1218 |
FLAG = false; |
//========================================================= |
| 1219 |
}; |
if( !strcmp(key->GetName(),"ToF" ) ){ |
| 1220 |
|
TOF__ok = true; |
| 1221 |
|
if(TOF){ |
| 1222 |
|
Int_t nevt = ((TTree*)f->Get("ToF"))->GetEntries(); |
| 1223 |
|
if( nev && nevt!=nev){ |
| 1224 |
|
cout << "File: "<< f->GetName() <<" discarded ---- ToF tree has "<<nevt<<" events instead of "<<nev<< endl; |
| 1225 |
|
return false; |
| 1226 |
|
} |
| 1227 |
|
nev=nevt; |
| 1228 |
|
} |
| 1229 |
|
} |
| 1230 |
|
//========================================================= |
| 1231 |
|
if( !strcmp(key->GetName(),"S4" ) ){ |
| 1232 |
|
S4__ok = true; |
| 1233 |
|
if(S4){ |
| 1234 |
|
Int_t nevt = ((TTree*)f->Get("S4"))->GetEntries(); |
| 1235 |
|
if( nev && nevt!=nev){ |
| 1236 |
|
cout << "File: "<< f->GetName() <<" discarded ---- S4 tree has "<<nevt<<" events instead of "<<nev<< endl; |
| 1237 |
|
return false; |
| 1238 |
|
} |
| 1239 |
|
nev=nevt; |
| 1240 |
|
} |
| 1241 |
|
} |
| 1242 |
|
//========================================================= |
| 1243 |
|
|
| 1244 |
|
if( !strcmp(key->GetName(),"NeutronD" ) ){ |
| 1245 |
|
ND__ok = true; |
| 1246 |
|
if(ND){ |
| 1247 |
|
Int_t nevt = ((TTree*)f->Get("NeutronD"))->GetEntries(); |
| 1248 |
|
if( nev && nevt!=nev){ |
| 1249 |
|
cout << "File: "<< f->GetName() <<" discarded ---- NeutronD tree has "<<nevt<<" events instead of "<<nev<< endl; |
| 1250 |
|
return false; |
| 1251 |
|
} |
| 1252 |
|
nev=nevt; |
| 1253 |
|
} |
| 1254 |
|
} |
| 1255 |
|
//========================================================= |
| 1256 |
|
if( !strcmp(key->GetName(),"Anticounter") ){ |
| 1257 |
|
AC__ok = true; |
| 1258 |
|
if(AC){ |
| 1259 |
|
Int_t nevt = ((TTree*)f->Get("Anticounter"))->GetEntries(); |
| 1260 |
|
if( nev && nevt!=nev){ |
| 1261 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Anticounter tree has "<<nevt<<" events instead of "<<nev<< endl; |
| 1262 |
|
return false; |
| 1263 |
|
} |
| 1264 |
|
nev=nevt; |
| 1265 |
|
} |
| 1266 |
|
} |
| 1267 |
|
//========================================================= |
| 1268 |
|
if( !strcmp(key->GetName(),"OrbitalInfo") ){ |
| 1269 |
|
ORB__ok = true; |
| 1270 |
|
if(ORB){ |
| 1271 |
|
Int_t nevt = ((TTree*)f->Get("OrbitalInfo"))->GetEntries(); |
| 1272 |
|
if( nev && nevt!=nev){ |
| 1273 |
|
cout << "File: "<< f->GetName() <<" discarded ---- OrbitalInfo tree has "<<nevt<<" events instead of "<<nev<< endl; |
| 1274 |
|
return false; |
| 1275 |
|
} |
| 1276 |
|
nev=nevt; |
| 1277 |
|
} |
| 1278 |
|
} |
| 1279 |
|
//========================================================= |
| 1280 |
|
if( !strcmp(key->GetName(),"Tracker" ) ){ |
| 1281 |
|
TTree *T = (TTree*)f->Get("Tracker"); |
| 1282 |
|
if(TRK1||TRK2||TRKh){ |
| 1283 |
|
Int_t nevt = T->GetEntries(); |
| 1284 |
|
if( nev && nevt!=nev){ |
| 1285 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Tracker tree has "<<nevt<<" events instead of "<<nev<< endl; |
| 1286 |
|
return false; |
| 1287 |
|
} |
| 1288 |
|
nev=nevt; |
| 1289 |
|
} |
| 1290 |
|
for(Int_t i=0; i<T->GetListOfBranches()->GetEntries(); i++){ |
| 1291 |
|
TString name = T->GetListOfBranches()->At(i)->GetName(); |
| 1292 |
|
if( !name.CompareTo("TrkLevel1") )TRK1__ok=true; |
| 1293 |
|
if( !name.CompareTo("TrkLevel2") )TRK2__ok=true; |
| 1294 |
|
if( !name.CompareTo("TrkHough") )TRKh__ok=true; |
| 1295 |
|
}; |
| 1296 |
|
T->Delete(); |
| 1297 |
|
}; |
| 1298 |
|
//========================================================= |
| 1299 |
|
if( !strcmp(key->GetName(),"Calorimeter" ) ){ |
| 1300 |
|
TTree *T = (TTree*)f->Get("Calorimeter"); |
| 1301 |
|
if(CAL1||CAL2){ |
| 1302 |
|
Int_t nevt = T->GetEntries(); |
| 1303 |
|
if( nev && nevt!=nev){ |
| 1304 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Calorimeter tree has "<<nevt<<" events instead of "<<nev<< endl; |
| 1305 |
|
return false; |
| 1306 |
|
} |
| 1307 |
|
nev=nevt; |
| 1308 |
|
} |
| 1309 |
|
for(Int_t i=0; i<T->GetListOfBranches()->GetEntries(); i++){ |
| 1310 |
|
TString name = T->GetListOfBranches()->At(i)->GetName(); |
| 1311 |
|
if( !name.CompareTo("CaloLevel1") )CAL1__ok=true; |
| 1312 |
|
if( !name.CompareTo("CaloLevel2") )CAL2__ok=true; |
| 1313 |
|
}; |
| 1314 |
|
T->Delete(); |
| 1315 |
|
}; |
| 1316 |
|
|
| 1317 |
|
}; |
| 1318 |
|
|
| 1319 |
|
|
| 1320 |
|
|
| 1321 |
|
if(!RUN__ok) { |
| 1322 |
|
cout << "File: "<< f->GetName() <<" *WARNING* ---- Missing RunInfo tree"<< endl; |
| 1323 |
|
// return false; |
| 1324 |
|
}; |
| 1325 |
|
|
| 1326 |
|
if(CAL1 && !CAL1__ok){ |
| 1327 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Missing CaloLevel1 branch"<< endl; |
| 1328 |
|
return false; |
| 1329 |
|
}; |
| 1330 |
|
if(CAL2 && !CAL2__ok){ |
| 1331 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Missing CaloLevel2 branch"<< endl; |
| 1332 |
|
return false; |
| 1333 |
|
}; |
| 1334 |
|
if(TRK2 && !TRK2__ok){ |
| 1335 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Missing TrkLevel2 branch"<< endl; |
| 1336 |
|
return false; |
| 1337 |
|
}; |
| 1338 |
|
if(TRK1 && !TRK1__ok){ |
| 1339 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Missing TrkLevel1 branch"<< endl; |
| 1340 |
|
return false; |
| 1341 |
|
}; |
| 1342 |
|
if(TRKh && !TRKh__ok){ |
| 1343 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Missing TrkHough branch"<< endl; |
| 1344 |
|
return false; |
| 1345 |
|
}; |
| 1346 |
|
if(ORB && !ORB__ok){ |
| 1347 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Missing ORB tree"<< endl; |
| 1348 |
|
return false; |
| 1349 |
|
}; |
| 1350 |
|
if(AC && !AC__ok){ |
| 1351 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Missing AC tree"<< endl; |
| 1352 |
|
return false; |
| 1353 |
|
}; |
| 1354 |
|
if(S4 && !S4__ok){ |
| 1355 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Missing S4 tree"<< endl; |
| 1356 |
|
return false; |
| 1357 |
|
}; |
| 1358 |
|
if(TOF && !TOF__ok){ |
| 1359 |
|
cout << "File: "<< f->GetName() <<" discarded ---- Missing ToF tree"<< endl; |
| 1360 |
|
return false; |
| 1361 |
|
}; |
| 1362 |
|
|
| 1363 |
if(ND && !ND__ok){ |
if(ND && !ND__ok){ |
| 1364 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing ND tree"<< endl; |
cout << "File: "<< f->GetName() <<" discarded ---- Missing ND tree"<< endl; |
| 1365 |
FLAG = false; |
return false; |
| 1366 |
}; |
}; |
| 1367 |
if(AC && !AC__ok){ |
if(TRG && !TRG__ok){ |
| 1368 |
cout << "File: "<< f->GetName() <<" discarded ---- Missing AC tree"<< endl; |
cout << "File: "<< f->GetName() <<" discarded ---- Missing Trigger tree"<< endl; |
| 1369 |
FLAG = false; |
return false; |
|
}; |
|
|
if(ORB && !ORB__ok){ |
|
|
cout << "File: "<< f->GetName() <<" discarded ---- Missing ORB tree"<< endl; |
|
|
FLAG = false; |
|
| 1370 |
}; |
}; |
| 1371 |
|
|
| 1372 |
return FLAG; |
|
| 1373 |
|
|
| 1374 |
|
|
| 1375 |
|
|
| 1376 |
|
lk->Delete(); |
| 1377 |
|
f->Close(); |
| 1378 |
|
|
| 1379 |
|
return true; |
| 1380 |
|
|
| 1381 |
}; |
}; |
| 1382 |
|
|
| 1383 |
|
|
| 1384 |
|
/** |
| 1385 |
|
* Create clone-trees |
| 1386 |
|
*/ |
| 1387 |
|
void PamLevel2::CreateCloneTrees( TChain *fChain ){ |
| 1388 |
|
|
| 1389 |
|
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
| 1390 |
|
cout << "Create clones of PAMELA trees "<<endl; |
| 1391 |
|
|
| 1392 |
|
Int_t i=0; |
| 1393 |
|
tree_clone[i] = fChain->GetTree()->CloneTree(0); |
| 1394 |
|
TString name = tree_clone[i]->GetName(); |
| 1395 |
|
name.Append("_clone"); |
| 1396 |
|
// tree_clone[i]->SetName(name.Data()); |
| 1397 |
|
cout << tree_clone[i]->GetName() <<endl; |
| 1398 |
|
i++; |
| 1399 |
|
|
| 1400 |
|
TList *li = fChain->GetListOfFriends(); |
| 1401 |
|
TIter next(li); |
| 1402 |
|
TFriendElement* T_friend=0; |
| 1403 |
|
while( (T_friend = (TFriendElement*)next()) ){ |
| 1404 |
|
// cout<<T_friend->IsA()->GetName()<<" "<<T_friend->GetName()<<hex << T_friend->GetTree() << dec<<endl; |
| 1405 |
|
// cout<<T_friend->GetTree()->GetName()<< endl; |
| 1406 |
|
tree_clone[i] = T_friend->GetTree()->CloneTree(0); |
| 1407 |
|
name = tree_clone[i]->GetName(); |
| 1408 |
|
name.Append("_clone"); |
| 1409 |
|
// tree_clone[i]->SetName(name.Data()); |
| 1410 |
|
cout << tree_clone[i]->GetName() << endl; |
| 1411 |
|
i++; |
| 1412 |
|
} |
| 1413 |
|
|
| 1414 |
|
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
| 1415 |
|
|
| 1416 |
|
} |
| 1417 |
|
|
| 1418 |
|
// /** |
| 1419 |
|
// * Create clone-trees |
| 1420 |
|
// */ |
| 1421 |
|
// void PamLevel2::CreateCloneTrees(){ |
| 1422 |
|
|
| 1423 |
|
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
| 1424 |
|
// cout << "Create new PAMELA trees "<<endl; |
| 1425 |
|
|
| 1426 |
|
// if(TRK1||TRK2||TRKh){ |
| 1427 |
|
// T_clone = new TTree("Tracker_clone","PAMELA tracker level2 data "); |
| 1428 |
|
// if(TRK1) { |
| 1429 |
|
// trk1_clone = new TrkLevel1(); |
| 1430 |
|
// T_clone->Branch("TrkLevel1","TrkLevel1", GetPointerTo("TrkLevel1")); |
| 1431 |
|
// T_clone->BranchRef(); |
| 1432 |
|
// cout << "Tracker : branch TrkLevel1"<<endl; |
| 1433 |
|
// }; |
| 1434 |
|
// if(TRK2) { |
| 1435 |
|
// trk2_clone = new TrkLevel2(); |
| 1436 |
|
// T_clone->Branch("TrkLevel2", "TrkLevel2",GetPointerTo("TrkLevel2")); |
| 1437 |
|
// cout << "Tracker : branch TrkLevel2"<<endl; |
| 1438 |
|
// }; |
| 1439 |
|
// if(TRKh) { |
| 1440 |
|
// trkh_clone = new TrkHough(); |
| 1441 |
|
// T_clone->Branch("TrkHough","TrkHough", GetPointerTo("TrkHough")); |
| 1442 |
|
// cout << "Tracker : branch TrkHough"<<endl; |
| 1443 |
|
// }; |
| 1444 |
|
// cout << hex << T_clone << dec << endl; |
| 1445 |
|
// } |
| 1446 |
|
|
| 1447 |
|
// // Calorimeter |
| 1448 |
|
// if(CAL1||CAL2){ |
| 1449 |
|
// C_clone = new TTree("Calorimeter_clone","PAMELA calorimeter level2 data "); |
| 1450 |
|
// if(CAL1) { |
| 1451 |
|
// calo1_clone = new CaloLevel1(); |
| 1452 |
|
// C_clone->Branch("CaloLevel1", "CaloLevel1", GetPointerTo("CaloLevel1")); |
| 1453 |
|
// cout << "Calorimeter : branch CaloLevel1"<<endl; |
| 1454 |
|
// }; |
| 1455 |
|
// if(CAL2) { |
| 1456 |
|
// calo2_clone = new CaloLevel2(); |
| 1457 |
|
// C_clone->Branch("CaloLevel2","CaloLevel2", GetPointerTo("CaloLevel2")); |
| 1458 |
|
// cout << "Calorimeter : branch CaloLevel2"<<endl; |
| 1459 |
|
// }; |
| 1460 |
|
// } |
| 1461 |
|
|
| 1462 |
|
// // ToF |
| 1463 |
|
// if(TOF) { |
| 1464 |
|
// O_clone = new TTree("ToF_clone","PAMELA ToF level2 data "); |
| 1465 |
|
// tof_clone = new ToFLevel2(); |
| 1466 |
|
// O_clone->Branch("ToFLevel2","ToFLevel2", GetPointerTo("ToFLevel2")); |
| 1467 |
|
// cout << "ToF : branch ToFLevel2"<<endl; |
| 1468 |
|
// }; |
| 1469 |
|
// // Trigger |
| 1470 |
|
// if(TRG) { |
| 1471 |
|
// R_clone = new TTree("Trigger_clone","PAMELA trigger level2 data "); |
| 1472 |
|
// trig_clone = new TrigLevel2(); |
| 1473 |
|
// R_clone->Branch("TrigLevel2","TrigLevel2", GetPointerTo("TrigLevel2")); |
| 1474 |
|
// cout << "Trigger : branch TrigLevel2"<<endl; |
| 1475 |
|
// }; |
| 1476 |
|
// // S4 |
| 1477 |
|
// if(S4) { |
| 1478 |
|
// S_clone = new TTree("S4_clone","PAMELA S4 level2 data "); |
| 1479 |
|
// s4_clone = new S4Level2(); |
| 1480 |
|
// S_clone->Branch("S4Level2","S4Level2", GetPointerTo("S4Level2")); |
| 1481 |
|
// cout << "S4 : branch S4Level2"<<endl; |
| 1482 |
|
// }; |
| 1483 |
|
// // Neutron Detector |
| 1484 |
|
// if(ND) { |
| 1485 |
|
// N_clone = new TTree("NeutronD_clone","PAMELA neutron detector level2 data "); |
| 1486 |
|
// nd_clone = new NDLevel2(); |
| 1487 |
|
// N_clone->Branch("NDLevel2","NDLevel2", GetPointerTo("NDLevel2")); |
| 1488 |
|
// cout << "NeutronD : branch NDLevel2"<<endl; |
| 1489 |
|
// }; |
| 1490 |
|
// // Anticounters |
| 1491 |
|
// if(AC) { |
| 1492 |
|
// A_clone = new TTree("Anticounter_clone","PAMELA anticounter detector level2 data "); |
| 1493 |
|
// ac_clone = new AcLevel2(); |
| 1494 |
|
// A_clone->Branch("AcLevel2","AcLevel2", GetPointerTo("AcLevel2")); |
| 1495 |
|
// cout << "Anticounter : branch AcLevel2"<<endl; |
| 1496 |
|
// }; |
| 1497 |
|
// // OrbitalInfo |
| 1498 |
|
// if(ORB) { |
| 1499 |
|
// B_clone = new TTree("OrbitalInfo_clone","PAMELA oribital info "); |
| 1500 |
|
// orb_clone = new OrbitalInfo(); |
| 1501 |
|
// B_clone->Branch("OrbitalInfo","OrbitalInfo", GetPointerTo("OrbitalInfo")); |
| 1502 |
|
// cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
| 1503 |
|
// }; |
| 1504 |
|
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
| 1505 |
|
|
| 1506 |
|
// } |
| 1507 |
|
|
| 1508 |
|
// /** |
| 1509 |
|
// * Create clone-trees |
| 1510 |
|
// */ |
| 1511 |
|
// void PamLevel2::CreateCloneTrees(){ |
| 1512 |
|
|
| 1513 |
|
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
| 1514 |
|
// cout << "Create new PAMELA trees "<<endl; |
| 1515 |
|
|
| 1516 |
|
// if(TRK1||TRK2||TRKh){ |
| 1517 |
|
// T_clone = new TTree("Tracker_clone","PAMELA tracker level2 data "); |
| 1518 |
|
// if(TRK1) { |
| 1519 |
|
// trk1_clone = new TrkLevel1(); |
| 1520 |
|
// T_clone->Branch("TrkLevel1","TrkLevel1", &trk1_clone); |
| 1521 |
|
// T_clone->BranchRef(); |
| 1522 |
|
// cout << "Tracker : branch TrkLevel1"<<endl; |
| 1523 |
|
// }; |
| 1524 |
|
// if(TRK2) { |
| 1525 |
|
// trk2_clone = new TrkLevel2(); |
| 1526 |
|
// T_clone->Branch("TrkLevel2", "TrkLevel2",&trk2_clone); |
| 1527 |
|
// cout << "Tracker : branch TrkLevel2"<<endl; |
| 1528 |
|
// }; |
| 1529 |
|
// if(TRKh) { |
| 1530 |
|
// trkh_clone = new TrkHough(); |
| 1531 |
|
// T_clone->Branch("TrkHough","TrkHough", &trkh_clone); |
| 1532 |
|
// cout << "Tracker : branch TrkHough"<<endl; |
| 1533 |
|
// }; |
| 1534 |
|
// cout << hex << T_clone << dec << endl; |
| 1535 |
|
// } |
| 1536 |
|
|
| 1537 |
|
// // Calorimeter |
| 1538 |
|
// if(CAL1||CAL2){ |
| 1539 |
|
// C_clone = new TTree("Calorimeter_clone","PAMELA calorimeter level2 data "); |
| 1540 |
|
// if(CAL1) { |
| 1541 |
|
// calo1_clone = new CaloLevel1(); |
| 1542 |
|
// C_clone->Branch("CaloLevel1", "CaloLevel1", &calo1_clone); |
| 1543 |
|
// cout << "Calorimeter : branch CaloLevel1"<<endl; |
| 1544 |
|
// }; |
| 1545 |
|
// if(CAL2) { |
| 1546 |
|
// calo2_clone = new CaloLevel2(); |
| 1547 |
|
// C_clone->Branch("CaloLevel2","CaloLevel2", &calo2_clone); |
| 1548 |
|
// cout << "Calorimeter : branch CaloLevel2"<<endl; |
| 1549 |
|
// }; |
| 1550 |
|
// } |
| 1551 |
|
|
| 1552 |
|
// // ToF |
| 1553 |
|
// if(TOF) { |
| 1554 |
|
// O_clone = new TTree("ToF_clone","PAMELA ToF level2 data "); |
| 1555 |
|
// tof_clone = new ToFLevel2(); |
| 1556 |
|
// O_clone->Branch("ToFLevel2","ToFLevel2", &tof_clone); |
| 1557 |
|
// cout << "ToF : branch ToFLevel2"<<endl; |
| 1558 |
|
// }; |
| 1559 |
|
// // Trigger |
| 1560 |
|
// if(TRG) { |
| 1561 |
|
// R_clone = new TTree("Trigger_clone","PAMELA trigger level2 data "); |
| 1562 |
|
// trig_clone = new TrigLevel2(); |
| 1563 |
|
// R_clone->Branch("TrigLevel2","TrigLevel2", &trig_clone); |
| 1564 |
|
// cout << "Trigger : branch TrigLevel2"<<endl; |
| 1565 |
|
// }; |
| 1566 |
|
// // S4 |
| 1567 |
|
// if(S4) { |
| 1568 |
|
// S_clone = new TTree("S4_clone","PAMELA S4 level2 data "); |
| 1569 |
|
// s4_clone = new S4Level2(); |
| 1570 |
|
// S_clone->Branch("S4Level2","S4Level2", &s4_clone); |
| 1571 |
|
// cout << "S4 : branch S4Level2"<<endl; |
| 1572 |
|
// }; |
| 1573 |
|
// // Neutron Detector |
| 1574 |
|
// if(ND) { |
| 1575 |
|
// N_clone = new TTree("NeutronD_clone","PAMELA neutron detector level2 data "); |
| 1576 |
|
// nd_clone = new NDLevel2(); |
| 1577 |
|
// N_clone->Branch("NDLevel2","NDLevel2", &nd_clone); |
| 1578 |
|
// cout << "NeutronD : branch NDLevel2"<<endl; |
| 1579 |
|
// }; |
| 1580 |
|
// // Anticounters |
| 1581 |
|
// if(AC) { |
| 1582 |
|
// A_clone = new TTree("Anticounter_clone","PAMELA anticounter detector level2 data "); |
| 1583 |
|
// ac_clone = new AcLevel2(); |
| 1584 |
|
// A_clone->Branch("AcLevel2","AcLevel2", &ac_clone); |
| 1585 |
|
// cout << "Anticounter : branch AcLevel2"<<endl; |
| 1586 |
|
// }; |
| 1587 |
|
// // OrbitalInfo |
| 1588 |
|
// if(ORB) { |
| 1589 |
|
// B_clone = new TTree("OrbitalInfo_clone","PAMELA oribital info "); |
| 1590 |
|
// orb_clone = new OrbitalInfo(); |
| 1591 |
|
// B_clone->Branch("OrbitalInfo","OrbitalInfo", &orb_clone); |
| 1592 |
|
// cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
| 1593 |
|
// }; |
| 1594 |
|
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
| 1595 |
|
|
| 1596 |
|
// } |
| 1597 |
|
|
| 1598 |
|
/** |
| 1599 |
|
* Fill tree (created with CreateCloneTrees) |
| 1600 |
|
* |
| 1601 |
|
*/ |
| 1602 |
|
//void PamLevel2::FillNewPamTree(TTree *T){ |
| 1603 |
|
void PamLevel2::FillCloneTrees(){ |
| 1604 |
|
|
| 1605 |
|
// // -------------------------------------- |
| 1606 |
|
// // copy the event |
| 1607 |
|
// // -------------------------------------- |
| 1608 |
|
// if(trk1_clone) *trk1_clone = *trk1_obj; |
| 1609 |
|
// if(trk2_clone){ |
| 1610 |
|
// trk2_clone->Clear(); |
| 1611 |
|
// trk2_obj->Copy(*trk2_clone); |
| 1612 |
|
// // *trk2_clone = *trk2_obj; |
| 1613 |
|
// } |
| 1614 |
|
// if(trkh_clone) *trkh_clone = *trkh_obj; |
| 1615 |
|
// if(calo1_clone){ |
| 1616 |
|
// // *calo1_clone = *calo1_obj; |
| 1617 |
|
// calo1_clone->Clear(); |
| 1618 |
|
// calo1_obj->Copy(*calo1_clone); |
| 1619 |
|
// } |
| 1620 |
|
// if(calo2_clone){ |
| 1621 |
|
// // *calo2_clone = *calo2_obj; |
| 1622 |
|
// calo2_clone->Clear(); |
| 1623 |
|
// calo2_obj->Copy(*calo2_clone); |
| 1624 |
|
// } |
| 1625 |
|
// if(tof_clone) *tof_clone = *tof_obj; |
| 1626 |
|
// if(trig_clone) *trig_clone = *trig_obj; |
| 1627 |
|
// if(s4_clone) *s4_clone = *s4_obj; |
| 1628 |
|
// if(nd_clone) *nd_clone = *nd_obj; |
| 1629 |
|
// if(ac_clone) *ac_clone = *ac_obj; |
| 1630 |
|
// if(orb_clone) *orb_clone = *orb_obj; |
| 1631 |
|
|
| 1632 |
|
// if(T_clone)T_clone->Fill(); |
| 1633 |
|
// if(C_clone)C_clone->Fill(); |
| 1634 |
|
// if(O_clone)O_clone->Fill(); |
| 1635 |
|
// if(R_clone)R_clone->Fill(); |
| 1636 |
|
// if(S_clone)S_clone->Fill(); |
| 1637 |
|
// if(N_clone)N_clone->Fill(); |
| 1638 |
|
// if(A_clone)A_clone->Fill(); |
| 1639 |
|
// if(O_clone)O_clone->Fill(); |
| 1640 |
|
|
| 1641 |
|
for(Int_t i=0; i<8; i++){ |
| 1642 |
|
if(tree_clone[i])tree_clone[i]->Fill(); |
| 1643 |
|
} |
| 1644 |
|
} |
| 1645 |
|
|
| 1646 |
|
|
| 1647 |
|
TTree* PamLevel2::GetCloneTree(TString name){ |
| 1648 |
|
|
| 1649 |
|
for(Int_t i=0; i<8; i++){ |
| 1650 |
|
if(tree_clone[i]){ |
| 1651 |
|
TString na = tree_clone[i]->GetName(); |
| 1652 |
|
if(!name.CompareTo(na))return tree_clone[i]; |
| 1653 |
|
}; |
| 1654 |
|
} |
| 1655 |
|
return NULL; |
| 1656 |
|
|
| 1657 |
|
} |
| 1658 |
|
void PamLevel2::WriteCloneTrees(){ |
| 1659 |
|
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
| 1660 |
|
cout << "Write clones of PAMELA trees "<<endl; |
| 1661 |
|
for(Int_t i=0; i<8; i++){ |
| 1662 |
|
if(tree_clone[i]){ |
| 1663 |
|
cout << tree_clone[i]->GetName()<<endl; |
| 1664 |
|
tree_clone[i]->Write(); |
| 1665 |
|
}; |
| 1666 |
|
} |
| 1667 |
|
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
| 1668 |
|
|
| 1669 |
|
} |
| 1670 |
|
|
| 1671 |
|
/** |
| 1672 |
|
* Create a new (empty) Pamela trees |
| 1673 |
|
*/ |
| 1674 |
|
// TTree* PamLevel2::GetNewPamTree(){ |
| 1675 |
|
|
| 1676 |
|
// if(tree_clone)return tree_clone; |
| 1677 |
|
|
| 1678 |
|
// TTree *Tout = 0; |
| 1679 |
|
|
| 1680 |
|
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
| 1681 |
|
// cout << "Create new PAMELA trees "<<endl; |
| 1682 |
|
|
| 1683 |
|
|
| 1684 |
|
// if(TRK1||TRK2||TRKh){ |
| 1685 |
|
// TTree *T = new TTree("Tracker_clone","PAMELA tracker level2 data "); |
| 1686 |
|
// if(TRK1) { |
| 1687 |
|
// trk1_clone = new TrkLevel1(); |
| 1688 |
|
// T->Branch("TrkLevel1","TrkLevel1", &trk1_clone); |
| 1689 |
|
// T->BranchRef(); |
| 1690 |
|
// cout << "Tracker : branch TrkLevel1"<<endl; |
| 1691 |
|
// }; |
| 1692 |
|
// if(TRK2) { |
| 1693 |
|
// trk2_clone = new TrkLevel2(); |
| 1694 |
|
// T->Branch("TrkLevel2", "TrkLevel2",&trk2_clone); |
| 1695 |
|
// cout << "Tracker : branch TrkLevel2"<<endl; |
| 1696 |
|
// }; |
| 1697 |
|
// if(TRKh) { |
| 1698 |
|
// trkh_clone = new TrkHough(); |
| 1699 |
|
// T->Branch("TrkHough","TrkHough", &trkh_clone); |
| 1700 |
|
// cout << "Tracker : branch TrkHough"<<endl; |
| 1701 |
|
// }; |
| 1702 |
|
// if(!Tout)Tout=T; |
| 1703 |
|
// else Tout->AddFriend("Tracker_clone"); |
| 1704 |
|
// } |
| 1705 |
|
|
| 1706 |
|
// // Calorimeter |
| 1707 |
|
// if(CAL1||CAL2){ |
| 1708 |
|
// TTree *C = new TTree("Calorimeter_clone","PAMELA calorimeter level2 data "); |
| 1709 |
|
// if(CAL1) { |
| 1710 |
|
// calo1_clone = new CaloLevel1(); |
| 1711 |
|
// C->Branch("CaloLevel1", "CaloLevel1", &calo1_clone); |
| 1712 |
|
// cout << "Calorimeter : branch CaloLevel1"<<endl; |
| 1713 |
|
// }; |
| 1714 |
|
// if(CAL2) { |
| 1715 |
|
// calo2_clone = new CaloLevel2(); |
| 1716 |
|
// C->Branch("CaloLevel2","CaloLevel2", &calo2_clone); |
| 1717 |
|
// cout << "Calorimeter : branch CaloLevel2"<<endl; |
| 1718 |
|
// }; |
| 1719 |
|
// if(!Tout)Tout=C; |
| 1720 |
|
// else Tout->AddFriend("Calorimeter_clone"); |
| 1721 |
|
// } |
| 1722 |
|
|
| 1723 |
|
// // ToF |
| 1724 |
|
// if(TOF) { |
| 1725 |
|
// TTree *O = new TTree("ToF_clone","PAMELA ToF level2 data "); |
| 1726 |
|
// tof_clone = new ToFLevel2(); |
| 1727 |
|
// O->Branch("ToFLevel2","ToFLevel2", &tof_clone); |
| 1728 |
|
// cout << "ToF : branch ToFLevel2"<<endl; |
| 1729 |
|
// if(!Tout)Tout=O; |
| 1730 |
|
// else Tout->AddFriend("ToF_clone"); |
| 1731 |
|
// }; |
| 1732 |
|
// // Trigger |
| 1733 |
|
// if(TRG) { |
| 1734 |
|
// TTree *R = new TTree("Trigger_clone","PAMELA trigger level2 data "); |
| 1735 |
|
// trig_clone = new TrigLevel2(); |
| 1736 |
|
// R->Branch("TrigLevel2","TrigLevel2", &trig_clone); |
| 1737 |
|
// cout << "Trigger : branch TrigLevel2"<<endl; |
| 1738 |
|
// if(!Tout)Tout=R; |
| 1739 |
|
// else Tout->AddFriend("Trigger_clone"); |
| 1740 |
|
// }; |
| 1741 |
|
// // S4 |
| 1742 |
|
// if(S4) { |
| 1743 |
|
// TTree *S = new TTree("S4_clone","PAMELA S4 level2 data "); |
| 1744 |
|
// s4_clone = new S4Level2(); |
| 1745 |
|
// S->Branch("S4Level2","S4Level2", &s4_clone); |
| 1746 |
|
// cout << "S4 : branch S4Level2"<<endl; |
| 1747 |
|
// if(!Tout)Tout=S; |
| 1748 |
|
// else Tout->AddFriend("S4_clone"); |
| 1749 |
|
// }; |
| 1750 |
|
// // Neutron Detector |
| 1751 |
|
// if(ND) { |
| 1752 |
|
// TTree *N = new TTree("NeutronD_clone","PAMELA neutron detector level2 data "); |
| 1753 |
|
// nd_clone = new NDLevel2(); |
| 1754 |
|
// N->Branch("NDLevel2","NDLevel2", &nd_clone); |
| 1755 |
|
// cout << "NeutronD : branch NDLevel2"<<endl; |
| 1756 |
|
// if(!Tout)Tout=N; |
| 1757 |
|
// else Tout->AddFriend("NeutronD_clone"); |
| 1758 |
|
// }; |
| 1759 |
|
// // Anticounters |
| 1760 |
|
// if(AC) { |
| 1761 |
|
// TTree *A = new TTree("Anticounter_clone","PAMELA anticounter detector level2 data "); |
| 1762 |
|
// ac_clone = new AcLevel2(); |
| 1763 |
|
// A->Branch("AcLevel2","AcLevel2", &ac_clone); |
| 1764 |
|
// cout << "Anticounter : branch AcLevel2"<<endl; |
| 1765 |
|
// if(!Tout)Tout=A; |
| 1766 |
|
// else Tout->AddFriend("Anticounter_clone"); |
| 1767 |
|
// }; |
| 1768 |
|
// // OrbitalInfo |
| 1769 |
|
// if(ORB) { |
| 1770 |
|
// TTree *B = new TTree("OrbitalInfo_clone","PAMELA oribital info "); |
| 1771 |
|
// orb_clone = new OrbitalInfo(); |
| 1772 |
|
// B->Branch("OrbitalInfo","OrbitalInfo", &orb_clone); |
| 1773 |
|
// cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
| 1774 |
|
// if(!Tout)Tout=B; |
| 1775 |
|
// else Tout->AddFriend("OrbitalInfo_clone"); |
| 1776 |
|
// }; |
| 1777 |
|
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
| 1778 |
|
|
| 1779 |
|
// tree_clone = Tout; |
| 1780 |
|
// tree_clone->SetDirectory(0); |
| 1781 |
|
|
| 1782 |
|
// return Tout; |
| 1783 |
|
// } |
| 1784 |
|
// /** |
| 1785 |
|
// * Fill a tree (created with GetNewPamTree) |
| 1786 |
|
// * |
| 1787 |
|
// */ |
| 1788 |
|
// //void PamLevel2::FillNewPamTree(TTree *T){ |
| 1789 |
|
// void PamLevel2::FillNewPamTree(){ |
| 1790 |
|
|
| 1791 |
|
|
| 1792 |
|
// if(trk1_clone) *trk1_clone = *trk1_obj; |
| 1793 |
|
// if(trk2_clone){ |
| 1794 |
|
// trk2_clone->Clear(); |
| 1795 |
|
// trk2_obj->Copy(*trk2_clone); |
| 1796 |
|
// // *trk2_clone = *trk2_obj; |
| 1797 |
|
// } |
| 1798 |
|
// if(trkh_clone) *trkh_clone = *trkh_obj; |
| 1799 |
|
// if(calo1_clone){ |
| 1800 |
|
// // *calo1_clone = *calo1_obj; |
| 1801 |
|
// calo1_clone->Clear(); |
| 1802 |
|
// calo1_obj->Copy(*calo1_clone); |
| 1803 |
|
// } |
| 1804 |
|
// if(calo2_clone){ |
| 1805 |
|
// // *calo2_clone = *calo2_obj; |
| 1806 |
|
// calo2_clone->Clear(); |
| 1807 |
|
// calo2_obj->Copy(*calo2_clone); |
| 1808 |
|
// } |
| 1809 |
|
// if(tof_clone) *tof_clone = *tof_obj; |
| 1810 |
|
// if(trig_clone) *trig_clone = *trig_obj; |
| 1811 |
|
// if(s4_clone) *s4_clone = *s4_obj; |
| 1812 |
|
// if(nd_clone) *nd_clone = *nd_obj; |
| 1813 |
|
// if(ac_clone) *ac_clone = *ac_obj; |
| 1814 |
|
// if(orb_clone) *orb_clone = *orb_obj; |
| 1815 |
|
|
| 1816 |
|
// TTree *T = tree_clone; |
| 1817 |
|
|
| 1818 |
|
// T->Fill(); //fill main tree |
| 1819 |
|
// // cout<<T->IsA()->GetName()<<" "<<T->GetName()<<endl; |
| 1820 |
|
// TList *li = T->GetListOfFriends(); |
| 1821 |
|
// TIter next(li); |
| 1822 |
|
// TFriendElement* T_friend=0; |
| 1823 |
|
// while( (T_friend = (TFriendElement*)next()) ){ |
| 1824 |
|
// // cout<<T_friend->IsA()->GetName()<<" "<<T_friend->GetName()<<hex << T_friend->GetTree() << dec<<endl; |
| 1825 |
|
// T_friend->GetTree()->Fill();//fill friends |
| 1826 |
|
// } |
| 1827 |
|
|
| 1828 |
|
// } |