| 7 |
* Default constructor |
* Default constructor |
| 8 |
*/ |
*/ |
| 9 |
PamTrack::PamTrack(){ |
PamTrack::PamTrack(){ |
| 10 |
trk_track = this->TrkTrack::GetTrkTrack(); |
trk_track = 0; |
| 11 |
calo_track = this->CaloTrkVar::GetCaloTrkVar(); |
calo_track = 0; |
| 12 |
tof_track = this->ToFTrkVar::GetToFTrkVar(); |
tof_track = 0; |
| 13 |
|
candeleteobj = 0; |
| 14 |
}; |
}; |
| 15 |
//-------------------------------------- |
//-------------------------------------- |
| 16 |
// |
// |
| 20 |
* Constructor |
* Constructor |
| 21 |
*/ |
*/ |
| 22 |
PamTrack::PamTrack(TrkTrack* t, CaloTrkVar* c, ToFTrkVar* o){ |
PamTrack::PamTrack(TrkTrack* t, CaloTrkVar* c, ToFTrkVar* o){ |
| 23 |
trk_track = this->TrkTrack::GetTrkTrack(); |
|
| 24 |
calo_track = this->CaloTrkVar::GetCaloTrkVar(); |
trk_track = 0; |
| 25 |
tof_track = this->ToFTrkVar::GetToFTrkVar(); |
calo_track = 0; |
| 26 |
if(t) *trk_track = *t; |
tof_track = 0; |
| 27 |
if(c) *calo_track = *c; |
// if(t)trk_track = new TrkTrack(*t); |
| 28 |
if(o) *tof_track = *o; |
// if(c)calo_track = new CaloTrkVar(*c); |
| 29 |
|
// if(o)tof_track = new ToFTrkVar(*o); |
| 30 |
|
if(t)trk_track = t; |
| 31 |
|
if(c)calo_track = c; |
| 32 |
|
if(o)tof_track = o; |
| 33 |
|
candeleteobj = 0; |
| 34 |
|
|
| 35 |
}; |
}; |
| 36 |
|
PamTrack::PamTrack(const PamTrack& track){ |
| 37 |
|
|
| 38 |
|
TrkTrack *t = track.trk_track; |
| 39 |
|
CaloTrkVar *c = track.calo_track; |
| 40 |
|
ToFTrkVar *o = track.tof_track; |
| 41 |
|
|
| 42 |
|
trk_track = 0; |
| 43 |
|
calo_track = 0; |
| 44 |
|
tof_track = 0; |
| 45 |
|
if(t)trk_track = new TrkTrack(*t); |
| 46 |
|
if(c)calo_track = new CaloTrkVar(*c); |
| 47 |
|
if(o)tof_track = new ToFTrkVar(*o); |
| 48 |
|
candeleteobj = 1; |
| 49 |
|
|
| 50 |
|
} |
| 51 |
|
void PamTrack::Clear(){ |
| 52 |
|
|
| 53 |
|
// cout << "PamTrack::Clear() "<<candeleteobj<<endl; |
| 54 |
|
if(candeleteobj){ |
| 55 |
|
if(trk_track) trk_track->TrkTrack::Clear(); |
| 56 |
|
if(calo_track) calo_track->CaloTrkVar::Clear();//??? |
| 57 |
|
if(tof_track) tof_track->ToFTrkVar::Clear();//??? |
| 58 |
|
}else{ |
| 59 |
|
trk_track = 0; |
| 60 |
|
calo_track = 0; |
| 61 |
|
tof_track = 0; |
| 62 |
|
} |
| 63 |
|
} |
| 64 |
|
void PamTrack::Delete(){ |
| 65 |
|
// cout << "PamTrack::Delete() "<<candeleteobj<<endl; |
| 66 |
|
if(candeleteobj){ |
| 67 |
|
if(trk_track) { |
| 68 |
|
trk_track->TrkTrack::Clear(); |
| 69 |
|
delete trk_track; |
| 70 |
|
} |
| 71 |
|
if(calo_track){ |
| 72 |
|
calo_track->CaloTrkVar::Clear();//??? |
| 73 |
|
delete calo_track; |
| 74 |
|
} |
| 75 |
|
if(tof_track){ |
| 76 |
|
tof_track->ToFTrkVar::Clear();//??? |
| 77 |
|
delete tof_track; |
| 78 |
|
} |
| 79 |
|
}else{ |
| 80 |
|
Clear(); |
| 81 |
|
} |
| 82 |
|
} |
| 83 |
//-------------------------------------- |
//-------------------------------------- |
| 84 |
// |
// |
| 85 |
// |
// |
| 89 |
*/ |
*/ |
| 90 |
PamLevel2::PamLevel2(){ |
PamLevel2::PamLevel2(){ |
| 91 |
|
|
| 92 |
trk2_obj = TrkLevel2::GetTrkLevel2(); |
// trk2_obj = TrkLevel2::GetTrkLevel2(); |
| 93 |
trk1_obj = TrkLevel1::GetTrkLevel1(); |
// trk1_obj = TrkLevel1::GetTrkLevel1(); |
| 94 |
trkh_obj = TrkHough::GetTrkHough(); |
// trkh_obj = TrkHough::GetTrkHough(); |
| 95 |
calo1_obj = CaloLevel1::GetCaloLevel1(); |
// calo1_obj = CaloLevel1::GetCaloLevel1(); |
| 96 |
calo2_obj = CaloLevel2::GetCaloLevel2(); |
// calo2_obj = CaloLevel2::GetCaloLevel2(); |
| 97 |
tof_obj = ToFLevel2::GetToFLevel2(); |
// tof_obj = ToFLevel2::GetToFLevel2(); |
| 98 |
trig_obj = TrigLevel2::GetTrigLevel2(); |
// trig_obj = TrigLevel2::GetTrigLevel2(); |
| 99 |
s4_obj = S4Level2::GetS4Level2(); |
// s4_obj = S4Level2::GetS4Level2(); |
| 100 |
nd_obj = NDLevel2::GetNDLevel2(); |
// nd_obj = NDLevel2::GetNDLevel2(); |
| 101 |
ac_obj = AcLevel2::GetAcLevel2(); |
// ac_obj = AcLevel2::GetAcLevel2(); |
| 102 |
orb_obj = OrbitalInfo::GetOrbitalInfo(); |
// orb_obj = OrbitalInfo::GetOrbitalInfo(); |
| 103 |
|
trk2_obj = 0; |
| 104 |
run_obj = new GL_RUN(); |
trk1_obj = 0; |
| 105 |
|
trkh_obj = 0; |
| 106 |
// trk1_clone = 0; |
calo1_obj = 0; |
| 107 |
// trk2_clone = 0; |
calo2_obj = 0; |
| 108 |
// trkh_clone = 0; |
tof_obj = 0; |
| 109 |
// calo1_clone = 0; |
trig_obj = 0; |
| 110 |
// calo2_clone = 0; |
s4_obj = 0; |
| 111 |
// tof_clone = 0; |
nd_obj = 0; |
| 112 |
// trig_clone = 0; |
ac_obj = 0; |
| 113 |
// s4_clone = 0; |
orb_obj = 0; |
| 114 |
// nd_clone = 0; |
|
| 115 |
// ac_clone = 0; |
run_obj = 0;//new GL_RUN(); |
| 116 |
// orb_clone = 0; |
soft_obj = 0;// Emiliano |
| 117 |
|
|
|
// T_clone = 0; |
|
|
// C_clone = 0; |
|
|
// O_clone = 0; |
|
|
// R_clone = 0; |
|
|
// S_clone = 0; |
|
|
// N_clone = 0; |
|
|
// A_clone = 0; |
|
|
// B_clone = 0; |
|
| 118 |
|
|
| 119 |
for(Int_t i=0; i<8; i++ )tree_clone[i]=NULL; |
for(Int_t i=0; i<8; i++ )tree_clone[i]=NULL; |
| 120 |
|
|
| 121 |
sorted_tracks = new TRefArray(); |
// sorted_tracks = 0;//new TRefArray(); |
| 122 |
|
|
| 123 |
CAL1 = true; |
CAL1 = true; |
| 124 |
CAL2 = true; |
CAL2 = true; |
| 134 |
|
|
| 135 |
RUN = true; |
RUN = true; |
| 136 |
|
|
| 137 |
|
tsorted=0; |
| 138 |
|
timage=0; |
| 139 |
|
|
| 140 |
}; |
}; |
| 141 |
/** |
/** |
| 142 |
* Destructor |
* Delete the event (act as Dtor) |
| 143 |
*/ |
*/ |
| 144 |
PamLevel2::~PamLevel2(){ |
void PamLevel2::Delete(){ |
| 145 |
delete run_obj; |
|
| 146 |
Clear(); |
if(run_obj)delete run_obj; |
| 147 |
|
if(soft_obj)delete soft_obj; //Emiliano |
| 148 |
|
|
| 149 |
|
// cout << "void PamLevel2::Clear()"<<endl; |
| 150 |
|
if(trk1_obj) delete trk1_obj; |
| 151 |
|
if(trk2_obj) delete trk2_obj; |
| 152 |
|
if(trkh_obj) delete trkh_obj; |
| 153 |
|
if(calo1_obj)delete calo1_obj; |
| 154 |
|
if(calo2_obj)delete calo2_obj; |
| 155 |
|
if(tof_obj) delete tof_obj; |
| 156 |
|
if(trig_obj) delete trig_obj; |
| 157 |
|
if(s4_obj) delete s4_obj; |
| 158 |
|
if(nd_obj) delete nd_obj; |
| 159 |
|
if(ac_obj) delete ac_obj; |
| 160 |
|
if(orb_obj) delete orb_obj; |
| 161 |
|
|
| 162 |
|
if(tsorted){ |
| 163 |
|
tsorted->Delete(); |
| 164 |
|
delete tsorted; |
| 165 |
|
} |
| 166 |
|
if(timage){ |
| 167 |
|
timage->Delete(); |
| 168 |
|
delete timage; |
| 169 |
|
} |
| 170 |
}; |
}; |
| 171 |
|
|
| 172 |
/** |
/** |
| 173 |
* Clear the event |
* Clear the event (NB! does not deallocate objects) |
| 174 |
*/ |
*/ |
| 175 |
void PamLevel2::Clear(){ |
void PamLevel2::Clear(){ |
| 176 |
|
|
| 177 |
TrkLevel1::Clear(); |
// cout << "void PamLevel2::Clear()"<<endl; |
| 178 |
|
|
| 179 |
TrkLevel2::Clear(); |
// |
| 180 |
CaloLevel2::Clear(); |
// if(run_obj)delete run_obj; |
| 181 |
ToFLevel2::Clear(); |
if(run_obj) run_obj->Clear(); // Emiliano: Do not deallocate run_obj here, it will give segmentation fault! call clear instead |
| 182 |
TrigLevel2::Clear(); |
if(soft_obj) soft_obj->Clear(); |
| 183 |
S4Level2::Clear(); |
|
| 184 |
NDLevel2::Clear(); |
if(trk1_obj) trk1_obj->Clear(); |
| 185 |
AcLevel2::Clear(); |
if(trk2_obj) trk2_obj->Clear(); |
| 186 |
OrbitalInfo::Clear(); |
if(trkh_obj) trkh_obj->Clear(); |
| 187 |
|
if(calo1_obj)calo1_obj->Clear(); |
| 188 |
// if(trk1_clone)trk1_clone->Clear(); |
if(calo2_obj)calo2_obj->Clear(); |
| 189 |
// if(trk2_clone)trk2_clone->Clear(); |
if(tof_obj) tof_obj->Clear(); |
| 190 |
// if(trkh_clone)trkh_clone->Clear(); |
if(trig_obj) trig_obj->Clear(); |
| 191 |
// if(calo1_clone)calo1_clone->Clear(); |
if(s4_obj) s4_obj->Clear(); |
| 192 |
// if(calo2_clone)calo2_clone->Clear(); |
if(nd_obj) nd_obj->Clear(); |
| 193 |
// if(tof_clone)tof_clone->Clear(); |
if(ac_obj) ac_obj->Clear(); |
| 194 |
// if(trig_clone)trig_clone->Clear(); |
if(orb_obj) orb_obj->Clear(); |
|
// if(s4_clone)s4_clone->Clear(); |
|
|
// if(nd_clone)nd_clone->Clear(); |
|
|
// if(ac_clone)ac_clone->Clear(); |
|
|
// if(orb_clone)orb_clone->Clear(); |
|
| 195 |
|
|
| 196 |
sorted_tracks->Delete(); // clean the reference array |
// if(sorted_tracks)sorted_tracks->Clear(); |
| 197 |
|
// sorted_tracks.Clear(); |
| 198 |
|
|
| 199 |
|
if(tsorted){ |
| 200 |
|
tsorted->Delete(); |
| 201 |
|
} |
| 202 |
|
if(timage){ |
| 203 |
|
timage->Delete(); |
| 204 |
|
} |
| 205 |
|
|
| 206 |
}; |
}; |
| 207 |
|
|
| 213 |
void *PamLevel2::GetPointerTo(const char* c ){ |
void *PamLevel2::GetPointerTo(const char* c ){ |
| 214 |
|
|
| 215 |
TString objname = c; |
TString objname = c; |
| 216 |
if(!objname.CompareTo("TrkLevel1"))return &trk1_obj; |
|
| 217 |
if(!objname.CompareTo("TrkLevel2"))return &trk2_obj; |
if(!objname.CompareTo("TrkLevel1")) { |
| 218 |
if(!objname.CompareTo("TrkHough"))return &trkh_obj; |
if(!trk1_obj){ |
| 219 |
if(!objname.CompareTo("CaloLevel1"))return &calo1_obj; |
trk1_obj = new TrkLevel1(); |
| 220 |
if(!objname.CompareTo("CaloLevel2"))return &calo2_obj; |
trk1_obj->Set(); |
| 221 |
if(!objname.CompareTo("ToFLevel2"))return &tof_obj; |
} |
| 222 |
if(!objname.CompareTo("TrigLevel2"))return &trig_obj; |
return &trk1_obj; |
| 223 |
if(!objname.CompareTo("S4Level2"))return &s4_obj; |
}; |
| 224 |
if(!objname.CompareTo("NDLevel2"))return &nd_obj; |
if(!objname.CompareTo("TrkLevel2")) { |
| 225 |
if(!objname.CompareTo("AcLevel2"))return &ac_obj; |
if(!trk2_obj){ |
| 226 |
if(!objname.CompareTo("OrbitalInfo"))return &orb_obj; |
trk2_obj = new TrkLevel2(); |
| 227 |
|
trk2_obj->Set(); |
| 228 |
|
} |
| 229 |
|
return &trk2_obj; |
| 230 |
|
}; |
| 231 |
|
if(!objname.CompareTo("TrkHough")) { |
| 232 |
|
if(!trkh_obj) trkh_obj = new TrkHough(); |
| 233 |
|
return &trkh_obj; |
| 234 |
|
}; |
| 235 |
|
if(!objname.CompareTo("CaloLevel1")) { |
| 236 |
|
if(!calo1_obj) calo1_obj = new CaloLevel1(); |
| 237 |
|
return &calo1_obj; |
| 238 |
|
}; |
| 239 |
|
if(!objname.CompareTo("CaloLevel2")) { |
| 240 |
|
if(!calo2_obj){ |
| 241 |
|
calo2_obj = new CaloLevel2(); |
| 242 |
|
calo2_obj->Set(); |
| 243 |
|
}; |
| 244 |
|
return &calo2_obj; |
| 245 |
|
}; |
| 246 |
|
if(!objname.CompareTo("ToFLevel2")) { |
| 247 |
|
if(!tof_obj){ |
| 248 |
|
tof_obj = new ToFLevel2(); |
| 249 |
|
tof_obj->Set(); |
| 250 |
|
} |
| 251 |
|
return &tof_obj; |
| 252 |
|
}; |
| 253 |
|
if(!objname.CompareTo("TrigLevel2")) { |
| 254 |
|
if(!trig_obj) trig_obj = new TrigLevel2(); |
| 255 |
|
return &trig_obj; |
| 256 |
|
}; |
| 257 |
|
if(!objname.CompareTo("S4Level2")) { |
| 258 |
|
if(!s4_obj) s4_obj = new S4Level2(); |
| 259 |
|
return &s4_obj; |
| 260 |
|
}; |
| 261 |
|
if(!objname.CompareTo("NDLevel2")) { |
| 262 |
|
if(!nd_obj) nd_obj = new NDLevel2(); |
| 263 |
|
return &nd_obj; |
| 264 |
|
}; |
| 265 |
|
if(!objname.CompareTo("AcLevel2")) { |
| 266 |
|
if(!ac_obj) ac_obj = new AcLevel2(); |
| 267 |
|
return &ac_obj; |
| 268 |
|
}; |
| 269 |
|
if(!objname.CompareTo("OrbitalInfo")){ |
| 270 |
|
if(!orb_obj) orb_obj = new OrbitalInfo(); |
| 271 |
|
return &orb_obj; |
| 272 |
|
}; |
| 273 |
|
|
| 274 |
if(!objname.CompareTo("RunInfo"))return &run_obj; |
if(!objname.CompareTo("RunInfo"))return &run_obj; |
| 275 |
|
|
| 276 |
|
if(!objname.CompareTo("SoftInfo"))return &soft_obj; // Emiliano |
| 277 |
|
|
| 278 |
return NULL; |
return NULL; |
| 279 |
}; |
}; |
| 280 |
//-------------------------------------- |
//-------------------------------------- |
| 286 |
* (If seqno = -1 retrieves the self-trigger calorimeter track) |
* (If seqno = -1 retrieves the self-trigger calorimeter track) |
| 287 |
*/ |
*/ |
| 288 |
CaloTrkVar *PamLevel2::GetCaloStoredTrack(int seqno){ |
CaloTrkVar *PamLevel2::GetCaloStoredTrack(int seqno){ |
| 289 |
|
|
| 290 |
if( CaloLevel2::ntrk()==0 ){ |
if( !calo2_obj )return 0; |
| 291 |
|
|
| 292 |
|
if( calo2_obj->CaloLevel2::ntrk()==0 ){ |
| 293 |
cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no Calorimeter tracks are stored"<<endl; |
cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no Calorimeter tracks are stored"<<endl; |
| 294 |
return NULL; |
return NULL; |
| 295 |
}; |
}; |
| 298 |
Int_t it_calo=0; |
Int_t it_calo=0; |
| 299 |
|
|
| 300 |
do{ |
do{ |
| 301 |
c = CaloLevel2::GetCaloTrkVar(it_calo); |
c = calo2_obj->CaloLevel2::GetCaloTrkVar(it_calo); |
| 302 |
it_calo++; |
it_calo++; |
| 303 |
} while( c && seqno != c->trkseqno && it_calo < CaloLevel2::ntrk()); |
} while( c && seqno != c->trkseqno && it_calo < calo2_obj->CaloLevel2::ntrk()); |
| 304 |
|
|
| 305 |
if(!c || seqno != c->trkseqno){ |
if(!c || seqno != c->trkseqno){ |
| 306 |
c = 0; |
c = 0; |
| 319 |
*/ |
*/ |
| 320 |
ToFTrkVar *PamLevel2::GetToFStoredTrack(int seqno){ |
ToFTrkVar *PamLevel2::GetToFStoredTrack(int seqno){ |
| 321 |
|
|
| 322 |
if( ToFLevel2::ntrk()==0 ){ |
if( !tof_obj )return 0; |
| 323 |
|
|
| 324 |
|
if( tof_obj->ToFLevel2::ntrk()==0 ){ |
| 325 |
cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no ToF tracks are stored"<<endl; |
cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no ToF tracks are stored"<<endl; |
| 326 |
return NULL; |
return NULL; |
| 327 |
}; |
}; |
| 330 |
Int_t it_tof=0; |
Int_t it_tof=0; |
| 331 |
|
|
| 332 |
do{ |
do{ |
| 333 |
c = ToFLevel2::GetToFTrkVar(it_tof); |
c = tof_obj->ToFLevel2::GetToFTrkVar(it_tof); |
| 334 |
it_tof++; |
it_tof++; |
| 335 |
} while( c && seqno != c->trkseqno && it_tof < ToFLevel2::ntrk()); |
} while( c && seqno != c->trkseqno && it_tof < tof_obj->ToFLevel2::ntrk()); |
| 336 |
|
|
| 337 |
if(!c || seqno != c->trkseqno){ |
if(!c || seqno != c->trkseqno){ |
| 338 |
c = 0; |
c = 0; |
| 350 |
* Give the pamela track associated to a tracker track, retrieving related calorimeter and tof track information. |
* Give the pamela track associated to a tracker track, retrieving related calorimeter and tof track information. |
| 351 |
*/ |
*/ |
| 352 |
PamTrack* PamLevel2::GetPamTrackAlong(TrkTrack* t){ |
PamTrack* PamLevel2::GetPamTrackAlong(TrkTrack* t){ |
| 353 |
|
|
| 354 |
|
cout <<"PamLevel2::GetPamTrackAlong(TrkTrack* t) **obsolete** "<<endl; |
| 355 |
|
cout <<"(if you use it, remember to delete the PamTrack object)"<<endl; |
| 356 |
|
|
| 357 |
CaloTrkVar *c = 0; |
CaloTrkVar *c = 0; |
| 358 |
ToFTrkVar *o = 0; |
ToFTrkVar *o = 0; |
| 359 |
|
|
| 378 |
|
|
| 379 |
PamTrack* PamLevel2::GetStoredTrack(Int_t itrk){ |
PamTrack* PamLevel2::GetStoredTrack(Int_t itrk){ |
| 380 |
|
|
| 381 |
|
cout <<"PamLevel2::GetStoredTrack(Int_t itrk) **to-be-updated** "<<endl; |
| 382 |
|
cout <<"for the moment, better use separately the methods: TrkLevel2::GetStoredTrack(seqno) CaloLevel2::GetCaloTrkVar(Int_t notrack) ToFLevel2::GetToFTrkVar(Int_t notrack)"<<endl; |
| 383 |
|
cout <<"(if you use it, remember to delete the PamTrack object)"<<endl; |
| 384 |
PamTrack *track = 0; |
PamTrack *track = 0; |
| 385 |
|
|
| 386 |
if( itrk >=0 && itrk < TrkLevel2::ntrk() ){ |
if( itrk >=0 && itrk < trk2_obj->TrkLevel2::ntrk() ){ |
| 387 |
|
|
| 388 |
TrkTrack *t = TrkLevel2::GetStoredTrack(itrk); |
TrkTrack *t = trk2_obj->TrkLevel2::GetStoredTrack(itrk); |
| 389 |
track = GetPamTrackAlong(t); |
track = GetPamTrackAlong(t); |
| 390 |
|
|
| 391 |
|
|
| 392 |
|
|
| 393 |
}else{ |
}else{ |
| 394 |
cout << "PamLevel2::GetStoredTrack(int) : tracker track SeqNo "<< itrk <<" does not exist (GetNTracks() = "<<TrkLevel2::GetNTracks()<<")"<<endl; |
cout << "PamLevel2::GetStoredTrack(int) : tracker track SeqNo "<< itrk <<" does not exist (GetNTracks() = "<<trk2_obj->TrkLevel2::GetNTracks()<<")"<<endl; |
| 395 |
}; |
}; |
| 396 |
|
|
| 397 |
return track; |
return track; |
| 414 |
*/ |
*/ |
| 415 |
void PamLevel2::SortTracks(TString how){ |
void PamLevel2::SortTracks(TString how){ |
| 416 |
|
|
| 417 |
|
// cout <<" PamLevel2::SortTracks(TString how) "<<endl; |
| 418 |
|
if( !trk2_obj ){ |
| 419 |
|
cout << "void PamLevel2::SortTracks(TString how): TrkLevel2 not loaded !!!"; |
| 420 |
|
return; |
| 421 |
|
}; |
| 422 |
// cout << "call SortTracs() "<<endl; |
// cout << "call SortTracs() "<<endl; |
| 423 |
//Save current Object count |
//Save current Object count |
| 424 |
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
| 425 |
|
|
| 426 |
// cout << "ObjectNumber "<<ObjectNumber <<endl; |
// cout << "ObjectNumber "<<ObjectNumber <<endl; |
| 427 |
|
|
| 428 |
sorted_tracks->Delete(); //temporaneo??? |
// if(!sorted_tracks)sorted_tracks = new TRefArray(); |
| 429 |
|
// sorted_tracks->Clear(); |
| 430 |
|
// sorted_tracks.Clear(); |
| 431 |
|
|
| 432 |
|
if(!tsorted)tsorted = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
| 433 |
|
tsorted->Delete(); |
| 434 |
|
TClonesArray &ttsorted = *tsorted; |
| 435 |
|
if(!timage)timage = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
| 436 |
|
timage->Delete(); |
| 437 |
|
TClonesArray &ttimage = *timage; |
| 438 |
|
|
| 439 |
|
|
| 440 |
// loop over the tracks sorted by the tracker |
// loop over the tracks sorted by the tracker |
| 441 |
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
| 442 |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
| 452 |
|
|
| 453 |
// cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl; |
// cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl; |
| 454 |
|
|
| 455 |
for(Int_t i=0; i < TrkLevel2::GetNTracks(); i++){ |
for(Int_t i=0; i < trk2_obj->TrkLevel2::GetNTracks(); i++){ |
| 456 |
|
|
| 457 |
TrkTrack *ts = 0; |
TrkTrack *ts = 0; |
| 458 |
|
CaloTrkVar *cs = 0; |
| 459 |
|
ToFTrkVar *os = 0; |
| 460 |
|
|
| 461 |
// get tracker tracks |
// get tracker tracks |
| 462 |
TrkTrack *tp = TrkLevel2::GetTrack(i); //tracker |
TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker |
| 463 |
CaloTrkVar *cp = 0; |
CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); |
| 464 |
ToFTrkVar *op = 0; |
ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); |
| 465 |
|
|
| 466 |
|
TrkTrack *ti = 0; //tracker (image) |
| 467 |
|
CaloTrkVar *ci = 0; |
| 468 |
|
ToFTrkVar *oi = 0; |
| 469 |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
| 470 |
// if track has an image, check image selection |
// if track has an image, check image selection |
| 471 |
if(tp->HasImage()){ |
if(tp->HasImage()){ |
| 472 |
|
|
| 473 |
TrkTrack *ti = TrkLevel2::GetTrackImage(i); //tracker (image) |
ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) |
| 474 |
CaloTrkVar *ci = 0; |
ci = GetCaloStoredTrack(ti->GetSeqNo()); |
| 475 |
ToFTrkVar *oi = 0; |
oi = GetToFStoredTrack(ti->GetSeqNo()); |
| 476 |
|
|
| 477 |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
| 478 |
|
|
| 485 |
// ------------------------ |
// ------------------------ |
| 486 |
// check the Y spatial residual on the first calorimeter plane |
// check the Y spatial residual on the first calorimeter plane |
| 487 |
// (cut on calorimeter variables from Emiliano) |
// (cut on calorimeter variables from Emiliano) |
| 488 |
|
if( use_CAL && !calo2_obj ){ |
| 489 |
|
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but CaloLevel2 not loaded !!!"; |
| 490 |
|
return; |
| 491 |
|
}; |
| 492 |
if( |
if( |
| 493 |
use_CAL && |
use_CAL && |
| 494 |
npcfit[1] > 15 && //no. of fit planes on Y view |
calo2_obj->npcfit[1] > 15 && //no. of fit planes on Y view |
| 495 |
varcfit[1] < 1000. && //fit variance on Y view |
calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
| 496 |
true){ |
true){ |
| 497 |
|
|
|
cp = GetCaloStoredTrack(tp->GetSeqNo()); |
|
|
ci = GetCaloStoredTrack(ti->GetSeqNo()); |
|
| 498 |
|
|
| 499 |
Float_t resy_p = cp->tbar[0][1] - cbar[0][1]; if(resy_p < 0)resy_p= - resy_p; |
Float_t resy_p = cp->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_p < 0)resy_p= - resy_p; |
| 500 |
Float_t resy_i = ci->tbar[0][1] - cbar[0][1]; if(resy_i < 0)resy_i= - resy_i; |
Float_t resy_i = ci->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_i < 0)resy_i= - resy_i; |
| 501 |
|
|
| 502 |
if(resy_p <= resy_i) tp_score++; |
if(resy_p <= resy_i) tp_score++; |
| 503 |
else ti_score++; |
else ti_score++; |
| 510 |
// ------------------------ |
// ------------------------ |
| 511 |
// check the number of hit pmts along the track |
// check the number of hit pmts along the track |
| 512 |
// on S12 S21 and S32, where paddles are parallel to Y axis |
// on S12 S21 and S32, where paddles are parallel to Y axis |
| 513 |
|
if( use_TOF && !tof_obj ){ |
| 514 |
|
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!"; |
| 515 |
|
return; |
| 516 |
|
}; |
| 517 |
if( use_TOF ){ |
if( use_TOF ){ |
| 518 |
|
|
| 519 |
Int_t nphit_p =0; |
Int_t nphit_p =0; |
| 520 |
Int_t nphit_i =0; |
Int_t nphit_i =0; |
| 521 |
|
|
|
op = GetToFStoredTrack(tp->GetSeqNo()); |
|
|
oi = GetToFStoredTrack(ti->GetSeqNo()); |
|
| 522 |
|
|
| 523 |
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
| 524 |
cout << "track: npmttdc "<< op->npmttdc << endl; |
cout << "track: npmttdc "<< op->npmttdc << endl; |
| 526 |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
| 527 |
|
|
| 528 |
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
| 529 |
Int_t pl = GetPlaneIndex( (op->pmtadc).At(ih) ); |
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
| 530 |
if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
| 531 |
}; |
}; |
| 532 |
|
|
| 533 |
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
| 534 |
Int_t pl = GetPlaneIndex( (oi->pmtadc).At(ih) ); |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
| 535 |
if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
| 536 |
}; |
}; |
| 537 |
|
|
| 561 |
// ------------------------ |
// ------------------------ |
| 562 |
// the winner is.... |
// the winner is.... |
| 563 |
// ------------------------ |
// ------------------------ |
| 564 |
if (tp_score > ti_score) ts = tp;//the track sorted by the tracker!! |
if (tp_score > ti_score) { |
| 565 |
else if (tp_score < ti_score) ts = ti;//its image!! |
// ts = tp;//the track sorted by the tracker!! |
| 566 |
else { |
// cs = cp; |
| 567 |
ts = tp; |
// os = op; |
| 568 |
|
}else if (tp_score < ti_score) { |
| 569 |
|
ts = ti;//its image!! |
| 570 |
|
cs = ci; |
| 571 |
|
os = oi; |
| 572 |
|
|
| 573 |
|
ti = tp;//its image!! |
| 574 |
|
ci = cp; |
| 575 |
|
oi = op; |
| 576 |
|
|
| 577 |
|
tp = ts;//its image!! |
| 578 |
|
cp = cs; |
| 579 |
|
op = os; |
| 580 |
|
|
| 581 |
|
|
| 582 |
|
}else { |
| 583 |
|
// ts = tp; |
| 584 |
|
// cs = cp; |
| 585 |
|
// os = op; |
| 586 |
// cout << "Warning - track image ambiguity not solved" << endl; |
// cout << "Warning - track image ambiguity not solved" << endl; |
| 587 |
// cout << ts->GetNtot() << " "<< ts->chi2 << " " << npcfit[1] << " "<< nphit_p << endl; |
// cout << ts->GetNtot() << " "<< ts->chi2 << " " << npcfit[1] << " "<< nphit_p << endl; |
| 588 |
}; |
}; |
| 589 |
|
|
| 590 |
}else{ |
}else{ |
| 591 |
ts = tp; |
// ts = tp; |
| 592 |
|
// cs = cp; |
| 593 |
|
// os = op; |
| 594 |
}; |
}; |
| 595 |
|
|
| 596 |
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
| 597 |
sorted_tracks->Add(ts);//save the track in the sorted array |
// sorted_tracks->Add(ts);//save the track in the sorted array |
| 598 |
|
// sorted_tracks.Add(ts);//save the track in the sorted array |
| 599 |
|
// sorted_tracks.Add(tp);//save the track in the sorted array |
| 600 |
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
| 601 |
|
// cout<<"o "<<tp<<endl; |
| 602 |
|
// cout<<"o "<<cp<<endl; |
| 603 |
|
// cout<<"o "<<op<<endl; |
| 604 |
|
new(ttsorted[i]) PamTrack(tp,cp,op); |
| 605 |
|
new(ttimage[i]) PamTrack(ti,ci,oi); |
| 606 |
}; |
}; |
| 607 |
|
|
| 608 |
|
if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){ |
| 609 |
|
cout << "void PamLevel2::SortTracks(TString how): tsorted->GetEntries() "<<tsorted->GetEntries()<<" != trk2_obj->GetNTracks() = "<<trk2_obj->GetNTracks() <<endl; |
| 610 |
|
tsorted->Delete(); tsorted=0; |
| 611 |
|
timage->Delete(); timage=0; |
| 612 |
|
} |
| 613 |
|
|
| 614 |
//Restore Object count |
//Restore Object count |
| 615 |
//To save space in the table keeping track of all referenced objects |
//To save space in the table keeping track of all referenced objects |
| 616 |
//we assume that our events do not address each other. We reset the |
//We reset the object count to what it was at the beginning of the event. |
|
//object count to what it was at the beginning of the event. |
|
| 617 |
TProcessID::SetObjectCount(ObjectNumber); |
TProcessID::SetObjectCount(ObjectNumber); |
| 618 |
|
|
| 619 |
}; |
}; |
| 625 |
* 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. |
| 626 |
* 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. |
| 627 |
*/ |
*/ |
| 628 |
TRefArray *PamLevel2::GetTracks(){ |
// TRefArray *PamLevel2::GetTracks(){ |
| 629 |
|
|
| 630 |
|
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
| 631 |
|
// SortTracks("+CAL+TOF"); |
| 632 |
|
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
| 633 |
|
|
| 634 |
|
// // return sorted_tracks; |
| 635 |
|
// return &sorted_tracks; |
| 636 |
|
|
| 637 |
|
// }; |
| 638 |
|
TClonesArray *PamLevel2::GetTracks(){ |
| 639 |
|
|
| 640 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 641 |
SortTracks("+CAL+TOF"); |
SortTracks("+CAL+TOF"); |
| 642 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 643 |
|
|
| 644 |
return sorted_tracks; |
return tsorted; |
| 645 |
|
|
| 646 |
}; |
}; |
| 647 |
//-------------------------------------- |
//-------------------------------------- |
| 648 |
// |
// |
| 654 |
* @param it Track number, ranging from 0 to GetNTracks(). |
* @param it Track number, ranging from 0 to GetNTracks(). |
| 655 |
*/ |
*/ |
| 656 |
PamTrack *PamLevel2::GetTrack(int it){ |
PamTrack *PamLevel2::GetTrack(int it){ |
| 657 |
|
|
| 658 |
|
// if(!trk2_obj) return 0; |
| 659 |
|
|
| 660 |
|
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
| 661 |
|
// SortTracks("+CAL+TOF"); |
| 662 |
|
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
| 663 |
|
// // if(!sorted_tracks)return 0; |
| 664 |
|
// if(sorted_tracks.IsEmpty())return 0; |
| 665 |
|
|
| 666 |
|
// PamTrack *track = 0; |
| 667 |
|
|
| 668 |
|
// if( it >=0 && it < trk2_obj->TrkLevel2::GetNTracks() && it<sorted_tracks.GetEntriesFast() ){ |
| 669 |
|
// TrkTrack *t = (TrkTrack*)sorted_tracks.At(it); |
| 670 |
|
// track = GetPamTrackAlong(t); |
| 671 |
|
// }else{ |
| 672 |
|
// cout << "PamLevel2::GetTrack(int) : tracker track SeqNo "<< it <<" does not exist (GetNTracks() = "<<trk2_obj->TrkLevel2::GetNTracks()<<")"<<endl; |
| 673 |
|
// }; |
| 674 |
|
|
| 675 |
|
// return track; |
| 676 |
|
|
| 677 |
|
// cout << "PamLevel2::GetTrack(int it) "<<endl; |
| 678 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 679 |
SortTracks("+CAL+TOF"); |
SortTracks("+CAL+TOF"); |
| 680 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 681 |
|
if(!tsorted)return 0; |
| 682 |
|
if(!tsorted->GetEntries())return 0; |
| 683 |
|
|
| 684 |
PamTrack *track = 0; |
PamTrack *track = 0; |
| 685 |
|
|
| 686 |
if( it >=0 && it < TrkLevel2::GetNTracks() && it<sorted_tracks->GetEntriesFast() ){ |
if( it >=0 && it < trk2_obj->TrkLevel2::GetNTracks()){ |
| 687 |
TrkTrack *t = (TrkTrack*)sorted_tracks->At(it); |
// TrkTrack *t = (TrkTrack*)sorted_tracks.At(it); |
| 688 |
track = GetPamTrackAlong(t); |
// track = GetPamTrackAlong(t); |
| 689 |
|
TClonesArray &t = *(tsorted); |
| 690 |
|
track = (PamTrack*)t[it]; |
| 691 |
|
|
| 692 |
}else{ |
}else{ |
| 693 |
cout << "PamLevel2::GetTrack(int) : tracker track SeqNo "<< it <<" does not exist (GetNTracks() = "<<TrkLevel2::GetNTracks()<<")"<<endl; |
cout << "PamLevel2::GetTrack(int) : tracker track SeqNo "<< it <<" does not exist (GetNTracks() = "<<trk2_obj->TrkLevel2::GetNTracks()<<")"<<endl; |
| 694 |
}; |
}; |
| 695 |
|
|
| 696 |
return track; |
return track; |
| 707 |
*/ |
*/ |
| 708 |
PamTrack *PamLevel2::GetTrackImage(int it){ |
PamTrack *PamLevel2::GetTrackImage(int it){ |
| 709 |
|
|
| 710 |
|
// if(!trk2_obj) return 0; |
| 711 |
|
|
| 712 |
|
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
| 713 |
|
// SortTracks("+CAL+TOF"); |
| 714 |
|
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
| 715 |
|
// // if(!sorted_tracks)return 0; |
| 716 |
|
// if(sorted_tracks.IsEmpty())return 0; |
| 717 |
|
|
| 718 |
|
// PamTrack *image = 0; |
| 719 |
|
|
| 720 |
|
// if( it >=0 && it < trk2_obj->TrkLevel2::GetNTracks() ){ |
| 721 |
|
// TrkTrack *temp = (TrkTrack*)sorted_tracks.At(it); |
| 722 |
|
// if( temp->HasImage() ){ |
| 723 |
|
// TrkTrack *t = trk2_obj->TrkLevel2::GetStoredTrack(temp->GetImageSeqNo()); |
| 724 |
|
// image = GetPamTrackAlong(t); |
| 725 |
|
// }else{ |
| 726 |
|
// cout <<"PamLevel2::GetTrackImage(int) : Track SeqNo "<<it<<" does not have image"<<endl; |
| 727 |
|
// }; |
| 728 |
|
// }else{ |
| 729 |
|
// cout << "PamLevel2::GetTrackImage(int) : Tracker track SeqNo "<< it <<" does not exist (GetNTracks() = "<<trk2_obj->TrkLevel2::GetNTracks()<<")"<<endl; |
| 730 |
|
// }; |
| 731 |
|
|
| 732 |
|
// return image; |
| 733 |
|
|
| 734 |
|
|
| 735 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 736 |
SortTracks("+CAL+TOF"); |
SortTracks("+CAL+TOF"); |
| 737 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 738 |
|
if(!timage)return 0; |
| 739 |
|
if(!timage->GetEntries())return 0; |
| 740 |
|
|
| 741 |
PamTrack *image = 0; |
PamTrack *image = 0; |
| 742 |
|
|
| 743 |
if( it >=0 && it < TrkLevel2::GetNTracks() ){ |
if( it >=0 && it < trk2_obj->TrkLevel2::GetNTracks() ){ |
| 744 |
TrkTrack *temp = (TrkTrack*)sorted_tracks->At(it); |
TClonesArray &t = *(tsorted); |
| 745 |
if( temp->HasImage() ){ |
PamTrack *temp = (PamTrack*)t[it]; |
| 746 |
TrkTrack *t = TrkLevel2::GetStoredTrack(temp->GetImageSeqNo()); |
if( temp->GetTrkTrack()->HasImage() ){ |
| 747 |
image = GetPamTrackAlong(t); |
TClonesArray &t = *(timage); |
| 748 |
|
image = (PamTrack*)t[it]; |
| 749 |
}else{ |
}else{ |
| 750 |
cout <<"PamLevel2::GetTrackImage(int) : Track SeqNo "<<it<<" does not have image"<<endl; |
// cout <<"PamLevel2::GetTrackImage(int) : Track SeqNo "<<it<<" does not have image"<<endl; |
| 751 |
}; |
}; |
| 752 |
}else{ |
}else{ |
| 753 |
cout << "PamLevel2::GetTrackImage(int) : Tracker track SeqNo "<< it <<" does not exist (GetNTracks() = "<<TrkLevel2::GetNTracks()<<")"<<endl; |
cout << "PamLevel2::GetTrackImage(int) : Tracker track SeqNo "<< it <<" does not exist (GetNTracks() = "<<trk2_obj->TrkLevel2::GetNTracks()<<")"<<endl; |
| 754 |
}; |
}; |
| 755 |
|
|
| 756 |
return image; |
return image; |
| 915 |
TList *contents = new TList; // create output list |
TList *contents = new TList; // create output list |
| 916 |
contents->SetOwner(); |
contents->SetOwner(); |
| 917 |
|
|
| 918 |
char *fullpath; |
// char *fullpath; |
| 919 |
|
const char *fullpath; |
| 920 |
|
|
| 921 |
// if no input file list is given: |
// if no input file list is given: |
| 922 |
if ( flisttxt != "" ){ |
if ( flisttxt != "" ){ |
| 923 |
|
|
| 924 |
if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){ |
// if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){ |
| 925 |
|
if( !(fullpath = gSystem->FindFile("./",flisttxt)) ){ |
| 926 |
cout <<"File "<<flisttxt<<" not found"<<endl; |
cout <<"File "<<flisttxt<<" not found"<<endl; |
| 927 |
return 0; |
return 0; |
| 928 |
} |
} |
| 929 |
// flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
// flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
| 930 |
flisttxt = fullpath; |
flisttxt = fullpath; |
| 931 |
|
|
| 932 |
if( !gSystem->ChangeDirectory(ddir) ){ |
if( !gSystem->ChangeDirectory(ddir) ){ |
| 933 |
cout << "Cannot change directory : "<<ddir<<endl; |
cout << "Cannot change directory : "<<ddir<<endl; |
| 934 |
return 0; |
return 0; |
| 950 |
} |
} |
| 951 |
if(file.Contains("#"))file = file(0,file.First("#")); |
if(file.Contains("#"))file = file(0,file.First("#")); |
| 952 |
// cout <<"(2) " << file << endl; |
// cout <<"(2) " << file << endl; |
| 953 |
if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
// if( gSystem->IsFileInIncludePath(file,&fullpath) ){ |
| 954 |
|
if( (fullpath = gSystem->FindFile(ddir,file)) ){ |
| 955 |
|
|
| 956 |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
| 957 |
|
|
| 979 |
while ( (questo = (TSystemFile*) next()) ) { |
while ( (questo = (TSystemFile*) next()) ) { |
| 980 |
TString name = questo-> GetName(); |
TString name = questo-> GetName(); |
| 981 |
if( name.EndsWith(".root") ){ |
if( name.EndsWith(".root") ){ |
| 982 |
char *fullpath; |
const char *fullpath = gSystem->FindFile(ddir,name); |
| 983 |
gSystem->IsFileInIncludePath(name,&fullpath); |
// char *fullpath; |
| 984 |
|
// gSystem->IsFileInIncludePath(name,&fullpath); |
| 985 |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath))); |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath))); |
| 986 |
}; |
}; |
| 987 |
} |
} |
| 1014 |
// if( !detlist.IsNull() )SetWhichTrees(detlist); |
// if( !detlist.IsNull() )SetWhichTrees(detlist); |
| 1015 |
SetWhichTrees(detlist); |
SetWhichTrees(detlist); |
| 1016 |
|
|
| 1017 |
cout<< "GetPamTree(TList*,TString): detector list --> "; |
cout<< "GetPamTree(TList*,TString): input detector list --> "; |
| 1018 |
if(TRK1)cout<<"TRK1 "; |
if(TRK1)cout<<"TRK1 "; |
| 1019 |
if(TRK2)cout<<"TRK2 "; |
if(TRK2)cout<<"TRK2 "; |
| 1020 |
if(TRKh)cout<<"TRKH "; |
if(TRKh)cout<<"TRKH "; |
| 1028 |
if(ORB)cout<<"ORB "; |
if(ORB)cout<<"ORB "; |
| 1029 |
cout << endl; |
cout << endl; |
| 1030 |
|
|
|
|
|
|
|
|
| 1031 |
TChain *T = 0; |
TChain *T = 0; |
| 1032 |
TChain *C = 0; |
TChain *C = 0; |
| 1033 |
TChain *O = 0; |
TChain *O = 0; |
| 1051 |
TSystemFile *questo = 0; |
TSystemFile *questo = 0; |
| 1052 |
while ( (questo = (TSystemFile*) next()) ) { |
while ( (questo = (TSystemFile*) next()) ) { |
| 1053 |
TString name = questo->GetName(); |
TString name = questo->GetName(); |
| 1054 |
// cout << "File: "<< name << endl; |
cout << "File: "<< name << endl; |
| 1055 |
if( CheckLevel2File(name) ){ |
if( CheckLevel2File(name) ){ |
| 1056 |
if(TRK2||TRK1||TRKh) T->Add(name); |
if(TRK2||TRK1||TRKh) T->Add(name); |
| 1057 |
if(CAL1||CAL2) C->Add(name); |
if(CAL1||CAL2) C->Add(name); |
| 1383 |
|
|
| 1384 |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
| 1385 |
cout << "Run : set branch address RunInfo"<<endl; |
cout << "Run : set branch address RunInfo"<<endl; |
| 1386 |
|
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
| 1387 |
|
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
| 1388 |
|
|
| 1389 |
return R; |
return R; |
| 1390 |
|
|
| 1405 |
|
|
| 1406 |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); |
| 1407 |
cout << "Run : set branch address RunInfo"<<endl; |
cout << "Run : set branch address RunInfo"<<endl; |
| 1408 |
|
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
| 1409 |
|
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
| 1410 |
|
|
| 1411 |
return R; |
return R; |
| 1412 |
|
|
| 1527 |
*/ |
*/ |
| 1528 |
void PamLevel2::GetWhichTrees(TFile* f){ |
void PamLevel2::GetWhichTrees(TFile* f){ |
| 1529 |
|
|
|
|
|
| 1530 |
// ----------- |
// ----------- |
| 1531 |
// reset flags |
// reset flags |
| 1532 |
// ----------- |
// ----------- |
| 1652 |
|
|
| 1653 |
}; |
}; |
| 1654 |
|
|
| 1655 |
lk->Delete(); |
delete lk; |
| 1656 |
|
|
| 1657 |
// cout<< "Get detector list from input file --> "; |
// cout<< "Get detector list from input file --> "; |
| 1658 |
// if(TRK1)cout<<"TRK1 "; |
// if(TRK1)cout<<"TRK1 "; |
| 1855 |
// cout << endl; |
// cout << endl; |
| 1856 |
|
|
| 1857 |
|
|
| 1858 |
|
if(TRK2 && TRK1__ok)TRK1=1; |
| 1859 |
|
// ---------------------------------------------------------------------------- |
| 1860 |
|
// NOTA |
| 1861 |
|
// se c'e` il level1, lo devo necessarimente leggere. |
| 1862 |
|
// infatti (non ho capito perche`) i cluster vengono letti e allocati in memoria |
| 1863 |
|
// comunque, ma non vengono disallocati da PamLevel2::Clear() |
| 1864 |
|
// ---------------------------------------------------------------------------- |
| 1865 |
|
|
| 1866 |
|
|
| 1867 |
if(!RUN__ok) { |
if(!RUN__ok) { |
| 1868 |
cout << "File: "<< f->GetName() <<" *WARNING* ---- Missing RunInfo tree"<< endl; |
cout << "File: "<< f->GetName() <<" *WARNING* ---- Missing RunInfo tree"<< endl; |
| 1869 |
// return false; |
// return false; |
| 1916 |
}; |
}; |
| 1917 |
|
|
| 1918 |
|
|
| 1919 |
lk->Delete(); |
// lk->Delete(); |
| 1920 |
|
// delete lk; |
| 1921 |
f->Close(); |
f->Close(); |
| 1922 |
|
|
| 1923 |
// cout<< "CheckLevel2File(TString): detector list --> "; |
// cout<< "CheckLevel2File(TString): detector list --> "; |
| 1970 |
cout << tree_clone[i]->GetName() << endl; |
cout << tree_clone[i]->GetName() << endl; |
| 1971 |
i++; |
i++; |
| 1972 |
} |
} |
| 1973 |
|
|
| 1974 |
|
delete li; |
| 1975 |
|
|
| 1976 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
| 1977 |
|
|
| 2067 |
|
|
| 2068 |
} |
} |
| 2069 |
|
|
|
// /** |
|
|
// * Create clone-trees |
|
|
// */ |
|
|
// void PamLevel2::CreateCloneTrees(){ |
|
|
|
|
|
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
|
|
// cout << "Create new PAMELA trees "<<endl; |
|
|
|
|
|
// if(TRK1||TRK2||TRKh){ |
|
|
// T_clone = new TTree("Tracker_clone","PAMELA tracker level2 data "); |
|
|
// if(TRK1) { |
|
|
// trk1_clone = new TrkLevel1(); |
|
|
// T_clone->Branch("TrkLevel1","TrkLevel1", &trk1_clone); |
|
|
// T_clone->BranchRef(); |
|
|
// cout << "Tracker : branch TrkLevel1"<<endl; |
|
|
// }; |
|
|
// if(TRK2) { |
|
|
// trk2_clone = new TrkLevel2(); |
|
|
// T_clone->Branch("TrkLevel2", "TrkLevel2",&trk2_clone); |
|
|
// cout << "Tracker : branch TrkLevel2"<<endl; |
|
|
// }; |
|
|
// if(TRKh) { |
|
|
// trkh_clone = new TrkHough(); |
|
|
// T_clone->Branch("TrkHough","TrkHough", &trkh_clone); |
|
|
// cout << "Tracker : branch TrkHough"<<endl; |
|
|
// }; |
|
|
// cout << hex << T_clone << dec << endl; |
|
|
// } |
|
|
|
|
|
// // Calorimeter |
|
|
// if(CAL1||CAL2){ |
|
|
// C_clone = new TTree("Calorimeter_clone","PAMELA calorimeter level2 data "); |
|
|
// if(CAL1) { |
|
|
// calo1_clone = new CaloLevel1(); |
|
|
// C_clone->Branch("CaloLevel1", "CaloLevel1", &calo1_clone); |
|
|
// cout << "Calorimeter : branch CaloLevel1"<<endl; |
|
|
// }; |
|
|
// if(CAL2) { |
|
|
// calo2_clone = new CaloLevel2(); |
|
|
// C_clone->Branch("CaloLevel2","CaloLevel2", &calo2_clone); |
|
|
// cout << "Calorimeter : branch CaloLevel2"<<endl; |
|
|
// }; |
|
|
// } |
|
|
|
|
|
// // ToF |
|
|
// if(TOF) { |
|
|
// O_clone = new TTree("ToF_clone","PAMELA ToF level2 data "); |
|
|
// tof_clone = new ToFLevel2(); |
|
|
// O_clone->Branch("ToFLevel2","ToFLevel2", &tof_clone); |
|
|
// cout << "ToF : branch ToFLevel2"<<endl; |
|
|
// }; |
|
|
// // Trigger |
|
|
// if(TRG) { |
|
|
// R_clone = new TTree("Trigger_clone","PAMELA trigger level2 data "); |
|
|
// trig_clone = new TrigLevel2(); |
|
|
// R_clone->Branch("TrigLevel2","TrigLevel2", &trig_clone); |
|
|
// cout << "Trigger : branch TrigLevel2"<<endl; |
|
|
// }; |
|
|
// // S4 |
|
|
// if(S4) { |
|
|
// S_clone = new TTree("S4_clone","PAMELA S4 level2 data "); |
|
|
// s4_clone = new S4Level2(); |
|
|
// S_clone->Branch("S4Level2","S4Level2", &s4_clone); |
|
|
// cout << "S4 : branch S4Level2"<<endl; |
|
|
// }; |
|
|
// // Neutron Detector |
|
|
// if(ND) { |
|
|
// N_clone = new TTree("NeutronD_clone","PAMELA neutron detector level2 data "); |
|
|
// nd_clone = new NDLevel2(); |
|
|
// N_clone->Branch("NDLevel2","NDLevel2", &nd_clone); |
|
|
// cout << "NeutronD : branch NDLevel2"<<endl; |
|
|
// }; |
|
|
// // Anticounters |
|
|
// if(AC) { |
|
|
// A_clone = new TTree("Anticounter_clone","PAMELA anticounter detector level2 data "); |
|
|
// ac_clone = new AcLevel2(); |
|
|
// A_clone->Branch("AcLevel2","AcLevel2", &ac_clone); |
|
|
// cout << "Anticounter : branch AcLevel2"<<endl; |
|
|
// }; |
|
|
// // OrbitalInfo |
|
|
// if(ORB) { |
|
|
// B_clone = new TTree("OrbitalInfo_clone","PAMELA oribital info "); |
|
|
// orb_clone = new OrbitalInfo(); |
|
|
// B_clone->Branch("OrbitalInfo","OrbitalInfo", &orb_clone); |
|
|
// cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
|
|
// }; |
|
|
// cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
|
|
|
|
|
// } |
|
| 2070 |
|
|
| 2071 |
/** |
/** |
| 2072 |
* Fill tree (created with CreateCloneTrees) |
* Fill tree (created with CreateCloneTrees) |
| 2075 |
//void PamLevel2::FillNewPamTree(TTree *T){ |
//void PamLevel2::FillNewPamTree(TTree *T){ |
| 2076 |
void PamLevel2::FillCloneTrees(){ |
void PamLevel2::FillCloneTrees(){ |
| 2077 |
|
|
|
// // -------------------------------------- |
|
|
// // copy the event |
|
|
// // -------------------------------------- |
|
|
// if(trk1_clone) *trk1_clone = *trk1_obj; |
|
|
// if(trk2_clone){ |
|
|
// trk2_clone->Clear(); |
|
|
// trk2_obj->Copy(*trk2_clone); |
|
|
// // *trk2_clone = *trk2_obj; |
|
|
// } |
|
|
// if(trkh_clone) *trkh_clone = *trkh_obj; |
|
|
// if(calo1_clone){ |
|
|
// // *calo1_clone = *calo1_obj; |
|
|
// calo1_clone->Clear(); |
|
|
// calo1_obj->Copy(*calo1_clone); |
|
|
// } |
|
|
// if(calo2_clone){ |
|
|
// // *calo2_clone = *calo2_obj; |
|
|
// calo2_clone->Clear(); |
|
|
// calo2_obj->Copy(*calo2_clone); |
|
|
// } |
|
|
// if(tof_clone) *tof_clone = *tof_obj; |
|
|
// if(trig_clone) *trig_clone = *trig_obj; |
|
|
// if(s4_clone) *s4_clone = *s4_obj; |
|
|
// if(nd_clone) *nd_clone = *nd_obj; |
|
|
// if(ac_clone) *ac_clone = *ac_obj; |
|
|
// if(orb_clone) *orb_clone = *orb_obj; |
|
|
|
|
|
// if(T_clone)T_clone->Fill(); |
|
|
// if(C_clone)C_clone->Fill(); |
|
|
// if(O_clone)O_clone->Fill(); |
|
|
// if(R_clone)R_clone->Fill(); |
|
|
// if(S_clone)S_clone->Fill(); |
|
|
// if(N_clone)N_clone->Fill(); |
|
|
// if(A_clone)A_clone->Fill(); |
|
|
// if(O_clone)O_clone->Fill(); |
|
|
|
|
| 2078 |
for(Int_t i=0; i<8; i++){ |
for(Int_t i=0; i<8; i++){ |
| 2079 |
if(tree_clone[i])tree_clone[i]->Fill(); |
if(tree_clone[i])tree_clone[i]->Fill(); |
| 2080 |
} |
} |