]>
Commit | Line | Data |
---|---|---|
7be13e68 | 1 | #include "AliHBTReaderESD.h" |
7e35966a | 2 | //____________________________________________________________________ |
3 | ////////////////////////////////////////////////////////////////////// | |
4 | // // | |
5 | // class AliHBTReaderESD // | |
6 | // // | |
7 | // reader for ALICE Event Summary Data (ESD). // | |
8 | // // | |
9 | // Piotr.Skowronski@cern.ch // | |
10 | // // | |
11 | ////////////////////////////////////////////////////////////////////// | |
7be13e68 | 12 | |
13 | #include <TPDGCode.h> | |
14 | #include <TString.h> | |
15 | #include <TObjString.h> | |
16 | #include <TTree.h> | |
17 | #include <TFile.h> | |
88378f71 | 18 | #include <TKey.h> |
7be13e68 | 19 | #include <TParticle.h> |
58734aa5 | 20 | #include <TH1.h> |
7be13e68 | 21 | |
88378f71 | 22 | #include <AliRun.h> |
bed069a4 | 23 | #include <AliRunLoader.h> |
24 | #include <AliStack.h> | |
7be13e68 | 25 | #include <AliESDtrack.h> |
26 | #include <AliESD.h> | |
27 | ||
28 | #include "AliHBTRun.h" | |
29 | #include "AliHBTEvent.h" | |
30 | #include "AliHBTParticle.h" | |
31 | #include "AliHBTParticleCut.h" | |
88378f71 | 32 | #include "AliHBTTrackPoints.h" |
33 | #include "AliHBTClusterMap.h" | |
7be13e68 | 34 | |
35 | ClassImp(AliHBTReaderESD) | |
36 | ||
bed069a4 | 37 | AliHBTReaderESD::AliHBTReaderESD(const Char_t* esdfilename, const Char_t* galfilename): |
7be13e68 | 38 | fESDFileName(esdfilename), |
bed069a4 | 39 | fGAlFileName(galfilename), |
40 | fFile(0x0), | |
41 | fRunLoader(0x0), | |
88378f71 | 42 | fKeyIterator(0x0), |
43 | fReadParticles(kFALSE), | |
eb9ddbc0 | 44 | fCheckParticlePID(kFALSE), |
88378f71 | 45 | fNTrackPoints(0), |
46 | fdR(0.0), | |
47 | fClusterMap(kFALSE), | |
48 | fNTPCClustMin(0), | |
49 | fNTPCClustMax(150), | |
50 | fTPCChi2PerClustMin(0.0), | |
51 | fTPCChi2PerClustMax(10e5), | |
2e184671 | 52 | fChi2Min(0.0), |
53 | fChi2Max(10e5), | |
88378f71 | 54 | fC00Min(0.0), |
55 | fC00Max(10e5), | |
56 | fC11Min(0.0), | |
57 | fC11Max(10e5), | |
58 | fC22Min(0.0), | |
59 | fC22Max(10e5), | |
60 | fC33Min(0.0), | |
61 | fC33Max(10e5), | |
62 | fC44Min(0.0), | |
63 | fC44Max(10e5), | |
64 | fTPCC00Min(0.0), | |
65 | fTPCC00Max(10e5), | |
66 | fTPCC11Min(0.0), | |
67 | fTPCC11Max(10e5), | |
68 | fTPCC22Min(0.0), | |
69 | fTPCC22Max(10e5), | |
70 | fTPCC33Min(0.0), | |
71 | fTPCC33Max(10e5), | |
72 | fTPCC44Min(0.0), | |
73 | fTPCC44Max(10e5) | |
74 | ||
7be13e68 | 75 | { |
76 | //cosntructor | |
77 | if ( ((Int_t)kNSpecies) != ((Int_t)AliESDtrack::kSPECIES)) | |
78 | Fatal("AliHBTReaderESD","ESD defintions probobly changed. Ask Youra."); | |
79 | } | |
80 | /********************************************************************/ | |
81 | ||
bed069a4 | 82 | AliHBTReaderESD::AliHBTReaderESD(TObjArray* dirs,const Char_t* esdfilename, const Char_t* galfilename): |
7be13e68 | 83 | AliHBTReader(dirs), |
7be13e68 | 84 | fESDFileName(esdfilename), |
bed069a4 | 85 | fGAlFileName(galfilename), |
86 | fFile(0x0), | |
87 | fRunLoader(0x0), | |
88378f71 | 88 | fKeyIterator(0x0), |
89 | fReadParticles(kFALSE), | |
eb9ddbc0 | 90 | fCheckParticlePID(kFALSE), |
88378f71 | 91 | fNTrackPoints(0), |
92 | fdR(0.0), | |
93 | fClusterMap(kFALSE), | |
94 | fNTPCClustMin(0), | |
95 | fNTPCClustMax(150), | |
96 | fTPCChi2PerClustMin(0.0), | |
97 | fTPCChi2PerClustMax(10e5), | |
2e184671 | 98 | fChi2Min(0.0), |
99 | fChi2Max(10e5), | |
88378f71 | 100 | fC00Min(0.0), |
101 | fC00Max(10e5), | |
102 | fC11Min(0.0), | |
103 | fC11Max(10e5), | |
104 | fC22Min(0.0), | |
105 | fC22Max(10e5), | |
106 | fC33Min(0.0), | |
107 | fC33Max(10e5), | |
108 | fC44Min(0.0), | |
109 | fC44Max(10e5), | |
110 | fTPCC00Min(0.0), | |
111 | fTPCC00Max(10e5), | |
112 | fTPCC11Min(0.0), | |
113 | fTPCC11Max(10e5), | |
114 | fTPCC22Min(0.0), | |
115 | fTPCC22Max(10e5), | |
116 | fTPCC33Min(0.0), | |
117 | fTPCC33Max(10e5), | |
118 | fTPCC44Min(0.0), | |
119 | fTPCC44Max(10e5) | |
7be13e68 | 120 | { |
121 | //cosntructor | |
122 | if ( ((Int_t)kNSpecies) != ((Int_t)AliESDtrack::kSPECIES)) | |
123 | Fatal("AliHBTReaderESD","ESD defintions probobly changed. Ask Youra."); | |
124 | } | |
125 | /********************************************************************/ | |
126 | ||
127 | AliHBTReaderESD::~AliHBTReaderESD() | |
128 | { | |
129 | //desctructor | |
bed069a4 | 130 | delete fRunLoader; |
88378f71 | 131 | delete fKeyIterator; |
7e35966a | 132 | delete fFile; |
7be13e68 | 133 | } |
bed069a4 | 134 | /**********************************************************/ |
135 | Int_t AliHBTReaderESD::ReadNext() | |
7be13e68 | 136 | { |
bed069a4 | 137 | //reads next event from fFile |
88378f71 | 138 | //fRunLoader is for reading Kine |
7be13e68 | 139 | |
83a9f895 | 140 | if (AliHBTParticle::GetDebug()) |
bed069a4 | 141 | Info("ReadNext","Entered"); |
142 | ||
bed069a4 | 143 | if (fParticlesEvent == 0x0) fParticlesEvent = new AliHBTEvent(); |
144 | if (fTracksEvent == 0x0) fTracksEvent = new AliHBTEvent(); | |
145 | ||
146 | fParticlesEvent->Reset(); | |
147 | fTracksEvent->Reset(); | |
148 | ||
7be13e68 | 149 | do //do{}while; is OK even if 0 dirs specified. In that case we try to read from "./" |
150 | { | |
bed069a4 | 151 | if (fFile == 0x0) |
7be13e68 | 152 | { |
bed069a4 | 153 | fFile = OpenFile(fCurrentDir);//rl is opened here |
154 | if (fFile == 0x0) | |
7be13e68 | 155 | { |
bed069a4 | 156 | Error("ReadNext","Cannot get fFile for dir no. %d",fCurrentDir); |
157 | fCurrentDir++; | |
158 | continue; | |
159 | } | |
160 | fCurrentEvent = 0; | |
88378f71 | 161 | fKeyIterator = new TIter(fFile->GetListOfKeys()); |
61f231ad | 162 | // fFile->Dump(); |
163 | // fFile->GetListOfKeys()->Print(); | |
bed069a4 | 164 | } |
88378f71 | 165 | TKey* key = (TKey*)fKeyIterator->Next(); |
166 | if (key == 0x0) | |
167 | { | |
168 | if (AliHBTParticle::GetDebug() > 2 ) | |
169 | { | |
170 | Info("ReadNext","No more keys."); | |
171 | } | |
172 | fCurrentDir++; | |
173 | delete fKeyIterator; | |
174 | fKeyIterator = 0x0; | |
175 | delete fFile;//we have to assume there is no more ESD objects in the fFile | |
176 | fFile = 0x0; | |
177 | delete fRunLoader; | |
178 | fRunLoader = 0x0; | |
179 | continue; | |
180 | } | |
bed069a4 | 181 | //try to read |
88378f71 | 182 | |
183 | ||
184 | // TObject* esdobj = key->ReadObj(); | |
185 | // if (esdobj == 0x0) | |
186 | // { | |
187 | // if (AliHBTParticle::GetDebug() > 2 ) | |
188 | // { | |
189 | // Info("ReadNext","Key read NULL. Key Name is %s",key->GetName()); | |
190 | // key->Dump(); | |
191 | // } | |
192 | // continue; | |
193 | // } | |
194 | // esdobj->Dump(); | |
195 | // AliESD* esd = dynamic_cast<AliESD*>(esdobj); | |
196 | ||
197 | TString esdname = "ESD"; | |
bed069a4 | 198 | esdname+=fCurrentEvent; |
199 | AliESD* esd = dynamic_cast<AliESD*>(fFile->Get(esdname)); | |
200 | if (esd == 0x0) | |
201 | { | |
88378f71 | 202 | // if (AliHBTParticle::GetDebug() > 2 ) |
203 | // { | |
204 | // Info("ReadNext","This key is not an AliESD object %s",key->GetName()); | |
205 | // } | |
83a9f895 | 206 | if (AliHBTParticle::GetDebug() > 2 ) |
bed069a4 | 207 | { |
88378f71 | 208 | Info("ReadNext","Can not find AliESD object named %s",esdname.Data()); |
bed069a4 | 209 | } |
210 | fCurrentDir++; | |
88378f71 | 211 | delete fKeyIterator; |
212 | fKeyIterator = 0x0; | |
bed069a4 | 213 | delete fFile;//we have to assume there is no more ESD objects in the fFile |
bed069a4 | 214 | fFile = 0x0; |
88378f71 | 215 | delete fRunLoader; |
7e35966a | 216 | fRunLoader = 0x0; |
bed069a4 | 217 | continue; |
218 | } | |
61f231ad | 219 | |
220 | ReadESD(esd); | |
221 | ||
222 | fCurrentEvent++; | |
223 | fNEventsRead++; | |
224 | delete esd; | |
225 | return 0;//success -> read one event | |
226 | }while(fCurrentDir < GetNumberOfDirs());//end of loop over directories specified in fDirs Obj Array | |
227 | ||
228 | return 1; //no more directories to read | |
229 | } | |
230 | /**********************************************************/ | |
88378f71 | 231 | |
61f231ad | 232 | Int_t AliHBTReaderESD::ReadESD(AliESD* esd) |
233 | { | |
234 | //****** Tentative particle type "concentrations" | |
235 | static const Double_t concentr[5]={0.05, 0., 0.85, 0.10, 0.05}; | |
236 | ||
237 | Double_t pidtable[kNSpecies];//array used for reading pid probabilities from ESD track | |
238 | Double_t w[kNSpecies]; | |
239 | Double_t mom[3];//momentum | |
240 | Double_t pos[3];//position | |
241 | Double_t vertexpos[3];//vertex position | |
242 | //Reads one ESD | |
243 | if (esd == 0x0) | |
244 | { | |
245 | Error("ReadESD","ESD is NULL"); | |
246 | return 1; | |
247 | } | |
88378f71 | 248 | |
61f231ad | 249 | TDatabasePDG* pdgdb = TDatabasePDG::Instance(); |
250 | if (pdgdb == 0x0) | |
251 | { | |
252 | Error("ReadESD","Can not get PDG Database Instance."); | |
253 | return 1; | |
254 | } | |
255 | ||
256 | Float_t mf = esd->GetMagneticField(); | |
257 | ||
258 | if ( (mf == 0.0) && (fNTrackPoints > 0) ) | |
259 | { | |
260 | Error("ReadESD","Magnetic Field is 0 and Track Points Demended. Skipping to next event."); | |
261 | return 1; | |
262 | } | |
263 | ||
264 | AliStack* stack = 0x0; | |
265 | if (fReadParticles && fRunLoader) | |
266 | { | |
267 | fRunLoader->GetEvent(fCurrentEvent); | |
268 | stack = fRunLoader->Stack(); | |
269 | } | |
270 | ||
271 | const AliESDVertex* vertex = esd->GetVertex(); | |
272 | if (vertex == 0x0) | |
273 | { | |
274 | Info("ReadESD","ESD returned NULL pointer to vertex - assuming (0.0,0.0,0.0)"); | |
275 | vertexpos[0] = 0.0; | |
276 | vertexpos[1] = 0.0; | |
277 | vertexpos[2] = 0.0; | |
278 | } | |
279 | else | |
280 | { | |
281 | vertex->GetXYZ(vertexpos); | |
282 | } | |
283 | ||
284 | if (AliHBTParticle::GetDebug() > 0) | |
285 | { | |
286 | Info("ReadESD","Primary Vertex is (%f,%f,%f)",vertexpos[0],vertexpos[1],vertexpos[2]); | |
287 | } | |
288 | ||
289 | Info("ReadESD","Reading Event %d",fCurrentEvent); | |
290 | ||
291 | Int_t ntr = esd->GetNumberOfTracks(); | |
292 | Info("ReadESD","Found %d tracks.",ntr); | |
293 | for (Int_t i = 0;i<ntr; i++) | |
294 | { | |
295 | AliESDtrack *esdtrack = esd->GetTrack(i); | |
296 | if (esdtrack == 0x0) | |
88378f71 | 297 | { |
61f231ad | 298 | Error("Next","Can not get track %d", i); |
299 | continue; | |
88378f71 | 300 | } |
61f231ad | 301 | |
302 | //if (esdtrack->HasVertexParameters() == kFALSE) | |
303 | if ((esdtrack->GetStatus() & AliESDtrack::kITSrefit) == kFALSE) | |
304 | { | |
305 | if (AliHBTParticle::GetDebug() > 2) | |
306 | Info("ReadNext","Particle skipped: Data at vertex not available."); | |
307 | continue; | |
308 | } | |
309 | ||
310 | if ((esdtrack->GetStatus() & AliESDtrack::kESDpid) == kFALSE) | |
bed069a4 | 311 | { |
61f231ad | 312 | if (AliHBTParticle::GetDebug() > 2) |
313 | Info("ReadNext","Particle skipped: PID BIT is not set."); | |
314 | continue; | |
bed069a4 | 315 | } |
61f231ad | 316 | |
317 | ||
318 | Double_t extx; | |
319 | Double_t extp[5]; | |
320 | esdtrack->GetConstrainedExternalParameters(extx,extp); | |
321 | if (extp[4] == 0.0) | |
322 | { | |
323 | if (AliHBTParticle::GetDebug() > 2) | |
324 | Info("ReadNext","Track has 0 contrianed curvature -> Probobly parameters never updated. Skipping."); | |
325 | continue; | |
326 | } | |
327 | esdtrack->GetESDpid(pidtable); | |
61f231ad | 328 | esdtrack->GetConstrainedPxPyPz(mom); |
61f231ad | 329 | esdtrack->GetConstrainedXYZ(pos); |
330 | pos[0] -= vertexpos[0];//we are interested only in relative position to Primary vertex at this point | |
331 | pos[1] -= vertexpos[1]; | |
332 | pos[2] -= vertexpos[2]; | |
333 | ||
d62f2982 | 334 | Int_t charge = (extp[4] > 0)?1:-1;//if curvature=charg/Pt is positive charge is positive |
61f231ad | 335 | |
336 | //Particle from kinematics | |
337 | AliHBTParticle* particle = 0; | |
338 | Bool_t keeppart = kFALSE; | |
339 | if ( fReadParticles && stack ) | |
bed069a4 | 340 | { |
61f231ad | 341 | if (esdtrack->GetLabel() < 0) continue;//this is fake - we are not able to match any track |
342 | TParticle *p = stack->Particle(esdtrack->GetLabel()); | |
343 | if (p==0x0) | |
bed069a4 | 344 | { |
61f231ad | 345 | Error("ReadNext","Can not find track with such label."); |
bed069a4 | 346 | continue; |
347 | } | |
f843f9c4 | 348 | if (fCheckParticlePID) |
eb9ddbc0 | 349 | { |
f843f9c4 | 350 | if(Pass(p->GetPdgCode())) |
351 | { | |
352 | if ( AliHBTParticle::GetDebug() > 5 ) | |
353 | Info("ReadNext","Simulated Particle PID (%d) did not pass the cut.",p->GetPdgCode()); | |
354 | continue; //check if we are intersted with particles of this type | |
355 | } | |
eb9ddbc0 | 356 | } |
61f231ad | 357 | // if(p->GetPdgCode()<0) charge = -1; |
358 | particle = new AliHBTParticle(*p,i); | |
359 | ||
360 | } | |
eb9ddbc0 | 361 | |
362 | if(CheckTrack(esdtrack)) continue; | |
363 | ||
61f231ad | 364 | //Here we apply Bayes' formula |
365 | Double_t rc=0.; | |
366 | for (Int_t s=0; s<AliESDtrack::kSPECIES; s++) rc+=concentr[s]*pidtable[s]; | |
367 | if (rc==0.0) | |
368 | { | |
369 | if (AliHBTParticle::GetDebug() > 2) | |
370 | Info("ReadNext","Particle rejected since total bayessian PID probab. is zero."); | |
371 | continue; | |
372 | } | |
373 | ||
374 | for (Int_t s=0; s<AliESDtrack::kSPECIES; s++) w[s]=concentr[s]*pidtable[s]/rc; | |
375 | ||
376 | if (AliHBTParticle::GetDebug() > 4) | |
377 | { | |
378 | Info("ReadNext","###########################################################################"); | |
379 | Info("ReadNext","Momentum: %f %f %f",mom[0],mom[1],mom[2]); | |
380 | Info("ReadNext","Position: %f %f %f",pos[0],pos[1],pos[2]); | |
381 | TString msg("Pid list got from track:"); | |
382 | for (Int_t s = 0;s<kNSpecies;s++) | |
7e35966a | 383 | { |
61f231ad | 384 | msg+="\n "; |
385 | msg+=s; | |
386 | msg+="("; | |
387 | msg+=charge*GetSpeciesPdgCode((ESpecies)s); | |
388 | msg+="): "; | |
389 | msg+=w[s]; | |
390 | msg+=" ("; | |
391 | msg+=pidtable[s]; | |
392 | msg+=")"; | |
7e35966a | 393 | } |
61f231ad | 394 | Info("ReadNext","%s",msg.Data()); |
395 | }//if (AliHBTParticle::GetDebug()>4) | |
396 | ||
397 | AliHBTTrackPoints* tpts = 0x0; | |
398 | if (fNTrackPoints > 0) | |
399 | { | |
400 | tpts = new AliHBTTrackPoints(fNTrackPoints,esdtrack,mf,fdR); | |
401 | } | |
402 | ||
403 | AliHBTClusterMap* cmap = 0x0; | |
404 | if ( fClusterMap ) | |
405 | { | |
406 | cmap = new AliHBTClusterMap(esdtrack); | |
407 | } | |
408 | ||
409 | for (Int_t s = 0; s<kNSpecies; s++) | |
410 | { | |
411 | Int_t pdgcode = charge*GetSpeciesPdgCode((ESpecies)s); | |
412 | Float_t pp = w[s]; | |
413 | if (pp == 0.0) | |
bed069a4 | 414 | { |
61f231ad | 415 | if ( AliHBTParticle::GetDebug() > 5 ) |
416 | Info("ReadNext","Probability of being PID %d is zero. Continuing.",pdgcode); | |
bed069a4 | 417 | continue; |
418 | } | |
61f231ad | 419 | |
420 | if(Pass(pdgcode)) | |
bed069a4 | 421 | { |
61f231ad | 422 | if ( AliHBTParticle::GetDebug() > 5 ) |
423 | Info("ReadNext","PID (%d) did not pass the cut.",pdgcode); | |
424 | continue; //check if we are intersted with particles of this type | |
bed069a4 | 425 | } |
61f231ad | 426 | |
427 | Double_t mass = pdgdb->GetParticle(pdgcode)->Mass(); | |
428 | Double_t tEtot = TMath::Sqrt( mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2] + mass*mass);//total energy of the track | |
429 | ||
430 | AliHBTParticle* track = new AliHBTParticle(pdgcode, w[s],i, | |
431 | mom[0], mom[1], mom[2], tEtot, | |
432 | pos[0], pos[1], pos[2], 0.); | |
433 | //copy probabilitis of other species (if not zero) | |
434 | for (Int_t k = 0; k<kNSpecies; k++) | |
bed069a4 | 435 | { |
61f231ad | 436 | if (k == s) continue; |
437 | if (w[k] == 0.0) continue; | |
438 | track->SetPIDprobability(charge*GetSpeciesPdgCode( (ESpecies)k ),w[k]); | |
439 | } | |
440 | ||
441 | if(Pass(track))//check if meets all criteria of any of our cuts | |
442 | //if it does not delete it and take next good track | |
443 | { | |
444 | if ( AliHBTParticle::GetDebug() > 4 ) | |
445 | Info("ReadNext","Track did not pass the cut"); | |
446 | delete track; | |
bed069a4 | 447 | continue; |
448 | } | |
7be13e68 | 449 | |
61f231ad | 450 | //Single Particle cuts on cluster map and track points rather do not have sense |
451 | if (tpts) | |
452 | { | |
453 | track->SetTrackPoints(tpts); | |
454 | } | |
7be13e68 | 455 | |
61f231ad | 456 | if (cmap) |
bed069a4 | 457 | { |
61f231ad | 458 | track->SetClusterMap(cmap); |
459 | } | |
88378f71 | 460 | |
61f231ad | 461 | fTracksEvent->AddParticle(track); |
462 | if (particle) fParticlesEvent->AddParticle(particle); | |
463 | keeppart = kTRUE; | |
7be13e68 | 464 | |
61f231ad | 465 | if (AliHBTParticle::GetDebug() > 4 ) |
bed069a4 | 466 | { |
61f231ad | 467 | Info("ReadNext","\n\nAdding Particle with incarnation %d",pdgcode); |
468 | track->Print(); | |
d62f2982 | 469 | if (particle) particle->Print(); |
470 | Info("ReadNext","\n----------------------------------------------\n"); | |
88378f71 | 471 | } |
61f231ad | 472 | }//for (Int_t s = 0; s<kNSpecies; s++) |
473 | ||
474 | if (keeppart == kFALSE) | |
475 | { | |
476 | delete particle;//particle was not stored in event | |
477 | delete tpts; | |
478 | delete cmap; | |
479 | } | |
480 | ||
481 | }//for (Int_t i = 0;i<ntr; i++) -- loop over tracks | |
482 | ||
483 | Info("ReadNext","Read %d tracks and %d particles from event %d (event %d in dir %d).", | |
484 | fTracksEvent->GetNumberOfParticles(), fParticlesEvent->GetNumberOfParticles(), | |
485 | fNEventsRead,fCurrentEvent,fCurrentDir); | |
58734aa5 | 486 | fTrackCounter->Fill(fTracksEvent->GetNumberOfParticles()); |
61f231ad | 487 | return 0; |
bed069a4 | 488 | } |
61f231ad | 489 | |
bed069a4 | 490 | /**********************************************************/ |
61f231ad | 491 | |
bed069a4 | 492 | void AliHBTReaderESD::Rewind() |
493 | { | |
7e35966a | 494 | //rewinds reading |
88378f71 | 495 | delete fKeyIterator; |
bed069a4 | 496 | delete fFile; |
88378f71 | 497 | fFile = 0x0; |
498 | fKeyIterator = 0x0; | |
bed069a4 | 499 | delete fRunLoader; |
88378f71 | 500 | fRunLoader = 0x0; |
bed069a4 | 501 | fCurrentDir = 0; |
502 | fNEventsRead = 0; | |
58734aa5 | 503 | if (fTrackCounter) fTrackCounter->Reset(); |
bed069a4 | 504 | } |
7be13e68 | 505 | /**********************************************************/ |
bed069a4 | 506 | |
7be13e68 | 507 | TFile* AliHBTReaderESD::OpenFile(Int_t n) |
508 | { | |
bed069a4 | 509 | //opens fFile with kine tree |
7be13e68 | 510 | |
511 | const TString& dirname = GetDirName(n); | |
512 | if (dirname == "") | |
513 | { | |
514 | Error("OpenFiles","Can not get directory name"); | |
515 | return 0x0; | |
516 | } | |
517 | TString filename = dirname +"/"+ fESDFileName; | |
518 | TFile *ret = TFile::Open(filename.Data()); | |
519 | ||
520 | if ( ret == 0x0) | |
521 | { | |
bed069a4 | 522 | Error("OpenFiles","Can't open fFile %s",filename.Data()); |
7be13e68 | 523 | return 0x0; |
524 | } | |
525 | if (!ret->IsOpen()) | |
526 | { | |
bed069a4 | 527 | Error("OpenFiles","Can't open fFile %s",filename.Data()); |
7be13e68 | 528 | return 0x0; |
529 | } | |
530 | ||
88378f71 | 531 | if (fReadParticles ) |
bed069a4 | 532 | { |
533 | fRunLoader = AliRunLoader::Open(dirname +"/"+ fGAlFileName); | |
534 | if (fRunLoader == 0x0) | |
535 | { | |
536 | Error("OpenFiles","Can't get RunLoader for directory %s",dirname.Data()); | |
537 | delete ret; | |
538 | return 0x0; | |
539 | } | |
88378f71 | 540 | |
bed069a4 | 541 | fRunLoader->LoadHeader(); |
542 | if (fRunLoader->LoadKinematics()) | |
543 | { | |
544 | Error("Next","Error occured while loading kinematics."); | |
545 | delete fRunLoader; | |
546 | delete ret; | |
547 | return 0x0; | |
548 | } | |
549 | } | |
88378f71 | 550 | |
7be13e68 | 551 | return ret; |
552 | } | |
553 | /**********************************************************/ | |
554 | ||
555 | Int_t AliHBTReaderESD::GetSpeciesPdgCode(ESpecies spec)//skowron | |
556 | { | |
557 | //returns pdg code from the PID index | |
558 | //ask jura about charge | |
559 | switch (spec) | |
560 | { | |
561 | case kESDElectron: | |
562 | return kPositron; | |
563 | break; | |
564 | case kESDMuon: | |
565 | return kMuonPlus; | |
566 | break; | |
567 | case kESDPion: | |
568 | return kPiPlus; | |
569 | break; | |
570 | case kESDKaon: | |
571 | return kKPlus; | |
572 | break; | |
573 | case kESDProton: | |
574 | return kProton; | |
575 | break; | |
576 | default: | |
577 | ::Warning("GetSpeciesPdgCode","Specie with number %d is not defined.",(Int_t)spec); | |
578 | break; | |
579 | } | |
580 | return 0; | |
581 | } | |
88378f71 | 582 | /********************************************************************/ |
eb9ddbc0 | 583 | Bool_t AliHBTReaderESD::CheckTrack(AliESDtrack* t) const |
584 | { | |
585 | //Performs check of the track | |
586 | ||
2e184671 | 587 | if ( (t->GetConstrainedChi2() < fChi2Min) || (t->GetConstrainedChi2() > fChi2Max) ) return kTRUE; |
eb9ddbc0 | 588 | |
589 | if ( (t->GetTPCclusters(0x0) < fNTPCClustMin) || (t->GetTPCclusters(0x0) > fNTPCClustMax) ) return kTRUE; | |
590 | ||
2e184671 | 591 | if (t->GetTPCclusters(0x0) > 0) |
592 | { | |
593 | Float_t chisqpercl = t->GetTPCchi2()/((Double_t)t->GetTPCclusters(0x0)); | |
594 | if ( (chisqpercl < fTPCChi2PerClustMin) || (chisqpercl > fTPCChi2PerClustMax) ) return kTRUE; | |
595 | } | |
eb9ddbc0 | 596 | |
597 | Double_t cc[15]; | |
598 | t->GetConstrainedExternalCovariance(cc); | |
599 | ||
600 | if ( (cc[0] < fC00Min) || (cc[0] > fC00Max) ) return kTRUE; | |
601 | if ( (cc[2] < fC11Min) || (cc[2] > fC11Max) ) return kTRUE; | |
602 | if ( (cc[5] < fC22Min) || (cc[5] > fC22Max) ) return kTRUE; | |
603 | if ( (cc[9] < fC33Min) || (cc[9] > fC33Max) ) return kTRUE; | |
604 | if ( (cc[14] < fC44Min) || (cc[14] > fC44Max) ) return kTRUE; | |
605 | ||
606 | ||
607 | t->GetInnerExternalCovariance(cc); | |
608 | ||
609 | if ( (cc[0] < fTPCC00Min) || (cc[0] > fTPCC00Max) ) return kTRUE; | |
610 | if ( (cc[2] < fTPCC11Min) || (cc[2] > fTPCC11Max) ) return kTRUE; | |
611 | if ( (cc[5] < fTPCC22Min) || (cc[5] > fTPCC22Max) ) return kTRUE; | |
612 | if ( (cc[9] < fTPCC33Min) || (cc[9] > fTPCC33Max) ) return kTRUE; | |
613 | if ( (cc[14] < fTPCC44Min) || (cc[14] > fTPCC44Max) ) return kTRUE; | |
614 | ||
615 | return kFALSE; | |
616 | ||
617 | } | |
618 | /********************************************************************/ | |
619 | ||
98383320 | 620 | void AliHBTReaderESD::SetChi2Range(Float_t min, Float_t max) |
eb9ddbc0 | 621 | { |
622 | //sets range of Chi2 per Cluster | |
623 | fChi2Min = min; | |
624 | fChi2Max = max; | |
625 | } | |
626 | /********************************************************************/ | |
88378f71 | 627 | |
628 | void AliHBTReaderESD::SetTPCNClustersRange(Int_t min,Int_t max) | |
629 | { | |
630 | //sets range of Number Of Clusters that tracks have to have | |
631 | fNTPCClustMin = min; | |
632 | fNTPCClustMax = max; | |
633 | } | |
634 | /********************************************************************/ | |
635 | ||
636 | void AliHBTReaderESD::SetTPCChi2PerCluserRange(Float_t min, Float_t max) | |
637 | { | |
638 | //sets range of Chi2 per Cluster | |
639 | fTPCChi2PerClustMin = min; | |
640 | fTPCChi2PerClustMax = max; | |
641 | } | |
642 | /********************************************************************/ | |
643 | ||
644 | void AliHBTReaderESD::SetC00Range(Float_t min, Float_t max) | |
645 | { | |
646 | //Sets range of C00 parameter of covariance matrix of the track | |
647 | //it defines uncertainty of the momentum | |
648 | fC00Min = min; | |
649 | fC00Max = max; | |
650 | } | |
651 | /********************************************************************/ | |
652 | ||
653 | void AliHBTReaderESD::SetC11Range(Float_t min, Float_t max) | |
654 | { | |
655 | //Sets range of C11 parameter of covariance matrix of the track | |
656 | //it defines uncertainty of the momentum | |
657 | fC11Min = min; | |
658 | fC11Max = max; | |
659 | } | |
660 | /********************************************************************/ | |
661 | ||
662 | void AliHBTReaderESD::SetC22Range(Float_t min, Float_t max) | |
663 | { | |
664 | //Sets range of C22 parameter of covariance matrix of the track | |
665 | //it defines uncertainty of the momentum | |
666 | fC22Min = min; | |
667 | fC22Max = max; | |
668 | } | |
669 | /********************************************************************/ | |
670 | ||
671 | void AliHBTReaderESD::SetC33Range(Float_t min, Float_t max) | |
672 | { | |
673 | //Sets range of C33 parameter of covariance matrix of the track | |
674 | //it defines uncertainty of the momentum | |
675 | fC33Min = min; | |
676 | fC33Max = max; | |
677 | } | |
678 | /********************************************************************/ | |
679 | ||
680 | void AliHBTReaderESD::SetC44Range(Float_t min, Float_t max) | |
681 | { | |
682 | //Sets range of C44 parameter of covariance matrix of the track | |
683 | //it defines uncertainty of the momentum | |
684 | fC44Min = min; | |
685 | fC44Max = max; | |
686 | } |