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