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