1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
19 // ESD track cuts for flow framework
21 // origin: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch)
23 // This class gurantees consistency of cut methods, trackparameter
24 // selection (global tracks, TPC only, etc..) and parameter mixing
25 // in the flow framework. Transparently handles different input types:
27 // This class works in 2 steps: first the requested track parameters are
28 // constructed (to be set by SetParamType() ), then cuts are applied.
29 // the constructed track can be requested AFTER checking the cuts by
30 // calling GetTrack(), in this case the cut object stays in control,
31 // caller does not have to delete the track.
32 // Additionally caller can request an AliFlowTrack object to be constructed
33 // according the parameter mixing scenario requested by SetParamMix().
34 // AliFlowTrack is made using MakeFlowTrack() method, its an 'object factory'
35 // so caller needs to take care of the freshly created object.
40 #include "TParticle.h"
41 #include "TObjArray.h"
43 #include "AliMCEvent.h"
44 #include "AliESDEvent.h"
45 #include "AliVParticle.h"
46 #include "AliMCParticle.h"
47 #include "AliESDtrack.h"
48 #include "AliMultiplicity.h"
49 #include "AliAODTrack.h"
50 #include "AliFlowTrack.h"
51 #include "AliFlowTrackCuts.h"
53 #include "AliESDpid.h"
54 #include "AliESDPmdTrack.h"
56 ClassImp(AliFlowTrackCuts)
58 //-----------------------------------------------------------------------
59 AliFlowTrackCuts::AliFlowTrackCuts():
60 AliFlowTrackSimpleCuts(),
61 fAliESDtrackCuts(NULL),
64 fCutMCprocessType(kFALSE),
65 fMCprocessType(kPNoProcess),
68 fIgnoreSignInPID(kFALSE),
69 fCutMCisPrimary(kFALSE),
70 fRequireTransportBitForPrimaries(kTRUE),
72 fRequireCharge(kFALSE),
74 fCutSPDtrackletDeltaPhi(kFALSE),
75 fSPDtrackletDeltaPhiMax(FLT_MAX),
76 fSPDtrackletDeltaPhiMin(-FLT_MAX),
77 fIgnoreTPCzRange(kFALSE),
78 fIgnoreTPCzRangeMax(FLT_MAX),
79 fIgnoreTPCzRangeMin(-FLT_MAX),
80 fCutChi2PerClusterTPC(kFALSE),
81 fMaxChi2PerClusterTPC(FLT_MAX),
82 fMinChi2PerClusterTPC(-FLT_MAX),
83 fCutNClustersTPC(kFALSE),
84 fNClustersTPCMax(INT_MAX),
85 fNClustersTPCMin(INT_MIN),
86 fCutNClustersITS(kFALSE),
87 fNClustersITSMax(INT_MAX),
88 fNClustersITSMin(INT_MIN),
89 fUseAODFilterBit(kFALSE),
91 fCutDCAToVertexXY(kFALSE),
92 fCutDCAToVertexZ(kFALSE),
93 fCutMinimalTPCdedx(kFALSE),
101 fTrackLabel(INT_MIN),
110 fParticleID(AliPID::kPion),
111 fParticleProbability(.9)
114 for ( Int_t i=0; i<5; i++ ) { fProbBayes[i]=0.0; }
115 SetPriors(); //init arrays
118 //-----------------------------------------------------------------------
119 AliFlowTrackCuts::AliFlowTrackCuts(const char* name):
120 AliFlowTrackSimpleCuts(),
121 fAliESDtrackCuts(new AliESDtrackCuts()),
124 fCutMCprocessType(kFALSE),
125 fMCprocessType(kPNoProcess),
128 fIgnoreSignInPID(kFALSE),
129 fCutMCisPrimary(kFALSE),
130 fRequireTransportBitForPrimaries(kTRUE),
131 fMCisPrimary(kFALSE),
132 fRequireCharge(kFALSE),
134 fCutSPDtrackletDeltaPhi(kFALSE),
135 fSPDtrackletDeltaPhiMax(FLT_MAX),
136 fSPDtrackletDeltaPhiMin(-FLT_MAX),
137 fIgnoreTPCzRange(kFALSE),
138 fIgnoreTPCzRangeMax(FLT_MAX),
139 fIgnoreTPCzRangeMin(-FLT_MAX),
140 fCutChi2PerClusterTPC(kFALSE),
141 fMaxChi2PerClusterTPC(FLT_MAX),
142 fMinChi2PerClusterTPC(-FLT_MAX),
143 fCutNClustersTPC(kFALSE),
144 fNClustersTPCMax(INT_MAX),
145 fNClustersTPCMin(INT_MIN),
146 fCutNClustersITS(kFALSE),
147 fNClustersITSMax(INT_MAX),
148 fNClustersITSMin(INT_MIN),
149 fUseAODFilterBit(kFALSE),
151 fCutDCAToVertexXY(kFALSE),
152 fCutDCAToVertexZ(kFALSE),
153 fCutMinimalTPCdedx(kFALSE),
161 fTrackLabel(INT_MIN),
170 fParticleID(AliPID::kPion),
171 fParticleProbability(.9)
175 SetTitle("AliFlowTrackCuts");
176 fESDpid.GetTPCResponse().SetBetheBlochParameters( 0.0283086,
181 for ( Int_t i=0; i<5; i++ ) { fProbBayes[i]=0.0; }
182 SetPriors(); //init arrays
185 //-----------------------------------------------------------------------
186 AliFlowTrackCuts::AliFlowTrackCuts(const AliFlowTrackCuts& that):
187 AliFlowTrackSimpleCuts(that),
188 fAliESDtrackCuts(NULL),
191 fCutMCprocessType(that.fCutMCprocessType),
192 fMCprocessType(that.fMCprocessType),
193 fCutMCPID(that.fCutMCPID),
195 fIgnoreSignInPID(that.fIgnoreSignInPID),
196 fCutMCisPrimary(that.fCutMCisPrimary),
197 fRequireTransportBitForPrimaries(that.fRequireTransportBitForPrimaries),
198 fMCisPrimary(that.fMCisPrimary),
199 fRequireCharge(that.fRequireCharge),
200 fFakesAreOK(that.fFakesAreOK),
201 fCutSPDtrackletDeltaPhi(that.fCutSPDtrackletDeltaPhi),
202 fSPDtrackletDeltaPhiMax(that.fSPDtrackletDeltaPhiMax),
203 fSPDtrackletDeltaPhiMin(that.fSPDtrackletDeltaPhiMin),
204 fIgnoreTPCzRange(that.fIgnoreTPCzRange),
205 fIgnoreTPCzRangeMax(that.fIgnoreTPCzRangeMax),
206 fIgnoreTPCzRangeMin(that.fIgnoreTPCzRangeMin),
207 fCutChi2PerClusterTPC(that.fCutChi2PerClusterTPC),
208 fMaxChi2PerClusterTPC(that.fMaxChi2PerClusterTPC),
209 fMinChi2PerClusterTPC(that.fMinChi2PerClusterTPC),
210 fCutNClustersTPC(that.fCutNClustersTPC),
211 fNClustersTPCMax(that.fNClustersTPCMax),
212 fNClustersTPCMin(that.fNClustersTPCMin),
213 fCutNClustersITS(that.fCutNClustersITS),
214 fNClustersITSMax(that.fNClustersITSMax),
215 fNClustersITSMin(that.fNClustersITSMin),
216 fUseAODFilterBit(that.fUseAODFilterBit),
217 fAODFilterBit(that.fAODFilterBit),
218 fCutDCAToVertexXY(that.fCutDCAToVertexXY),
219 fCutDCAToVertexZ(that.fCutDCAToVertexZ),
220 fCutMinimalTPCdedx(that.fCutMinimalTPCdedx),
221 fMinimalTPCdedx(that.fMinimalTPCdedx),
222 fParamType(that.fParamType),
223 fParamMix(that.fParamMix),
228 fTrackLabel(INT_MIN),
233 fESDpid(that.fESDpid),
234 fPIDsource(that.fPIDsource),
237 fParticleID(that.fParticleID),
238 fParticleProbability(that.fParticleProbability)
241 if (that.fTPCpidCuts) fTPCpidCuts = new TMatrixF(*(that.fTPCpidCuts));
242 if (that.fTOFpidCuts) fTOFpidCuts = new TMatrixF(*(that.fTOFpidCuts));
243 if (that.fAliESDtrackCuts) fAliESDtrackCuts = new AliESDtrackCuts(*(that.fAliESDtrackCuts));
244 memcpy(fProbBayes,that.fProbBayes,sizeof(fProbBayes));
245 SetPriors(); //init arrays
248 //-----------------------------------------------------------------------
249 AliFlowTrackCuts& AliFlowTrackCuts::operator=(const AliFlowTrackCuts& that)
252 if (this==&that) return *this;
254 AliFlowTrackSimpleCuts::operator=(that);
255 if (that.fAliESDtrackCuts) *fAliESDtrackCuts=*(that.fAliESDtrackCuts);
258 fCutMCprocessType=that.fCutMCprocessType;
259 fMCprocessType=that.fMCprocessType;
260 fCutMCPID=that.fCutMCPID;
262 fIgnoreSignInPID=that.fIgnoreSignInPID,
263 fCutMCisPrimary=that.fCutMCisPrimary;
264 fRequireTransportBitForPrimaries=that.fRequireTransportBitForPrimaries;
265 fMCisPrimary=that.fMCisPrimary;
266 fRequireCharge=that.fRequireCharge;
267 fFakesAreOK=that.fFakesAreOK;
268 fCutSPDtrackletDeltaPhi=that.fCutSPDtrackletDeltaPhi;
269 fSPDtrackletDeltaPhiMax=that.fSPDtrackletDeltaPhiMax;
270 fSPDtrackletDeltaPhiMin=that.fSPDtrackletDeltaPhiMin;
271 fIgnoreTPCzRange=that.fIgnoreTPCzRange;
272 fIgnoreTPCzRangeMax=that.fIgnoreTPCzRangeMax;
273 fIgnoreTPCzRangeMin=that.fIgnoreTPCzRangeMin;
274 fCutChi2PerClusterTPC=that.fCutChi2PerClusterTPC;
275 fMaxChi2PerClusterTPC=that.fMaxChi2PerClusterTPC;
276 fMinChi2PerClusterTPC=that.fMinChi2PerClusterTPC;
277 fCutNClustersTPC=that.fCutNClustersTPC;
278 fNClustersTPCMax=that.fNClustersTPCMax;
279 fNClustersTPCMin=that.fNClustersTPCMin;
280 fCutNClustersITS=that.fCutNClustersITS;
281 fNClustersITSMax=that.fNClustersITSMax;
282 fNClustersITSMin=that.fNClustersITSMin;
283 fUseAODFilterBit=that.fUseAODFilterBit;
284 fAODFilterBit=that.fAODFilterBit;
285 fCutDCAToVertexXY=that.fCutDCAToVertexXY;
286 fCutDCAToVertexZ=that.fCutDCAToVertexZ;
287 fCutMinimalTPCdedx=that.fCutMinimalTPCdedx;
288 fMinimalTPCdedx=that.fMinimalTPCdedx;
289 fParamType=that.fParamType;
290 fParamMix=that.fParamMix;
301 fESDpid = that.fESDpid;
302 fPIDsource = that.fPIDsource;
306 if (that.fTPCpidCuts) fTPCpidCuts = new TMatrixF(*(that.fTPCpidCuts));
307 if (that.fTOFpidCuts) fTOFpidCuts = new TMatrixF(*(that.fTOFpidCuts));
309 fParticleID=that.fParticleID;
310 fParticleProbability=that.fParticleProbability;
311 memcpy(fProbBayes,that.fProbBayes,sizeof(fProbBayes));
316 //-----------------------------------------------------------------------
317 AliFlowTrackCuts::~AliFlowTrackCuts()
320 delete fAliESDtrackCuts;
325 //-----------------------------------------------------------------------
326 void AliFlowTrackCuts::SetEvent(AliVEvent* event, AliMCEvent* mcEvent)
333 //do the magic for ESD
334 AliESDEvent* myESD = dynamic_cast<AliESDEvent*>(event);
335 if (fCutPID && myESD)
337 //TODO: maybe call it only for the TOF options?
338 // Added by F. Noferini for TOF PID
339 fESDpid.SetTOFResponse(myESD,AliESDpid::kTOF_T0);
340 fESDpid.MakePID(myESD,kFALSE);
341 // End F. Noferini added part
347 //-----------------------------------------------------------------------
348 void AliFlowTrackCuts::SetCutMC( Bool_t b )
350 //will we be cutting on MC information?
353 //if we cut on MC info then also the Bethe Bloch should be the one tuned for MC
356 fESDpid.GetTPCResponse().SetBetheBlochParameters( 2.15898e+00/50.,
364 //-----------------------------------------------------------------------
365 Bool_t AliFlowTrackCuts::IsSelected(TObject* obj, Int_t id)
368 AliVParticle* vparticle = dynamic_cast<AliVParticle*>(obj);
369 if (vparticle) return PassesCuts(vparticle);
370 AliFlowTrackSimple* flowtrack = dynamic_cast<AliFlowTrackSimple*>(obj);
371 if (flowtrack) return PassesCuts(flowtrack);
372 AliMultiplicity* tracklets = dynamic_cast<AliMultiplicity*>(obj);
373 if (tracklets) return PassesCuts(tracklets,id);
374 AliESDPmdTrack* pmdtrack = dynamic_cast<AliESDPmdTrack*>(obj);
375 if (pmdtrack) return PassesPMDcuts(pmdtrack);
376 return kFALSE; //default when passed wrong type of object
379 //-----------------------------------------------------------------------
380 Bool_t AliFlowTrackCuts::IsSelectedMCtruth(TObject* obj, Int_t id)
383 AliVParticle* vparticle = dynamic_cast<AliVParticle*>(obj);
386 return PassesMCcuts(fMCevent,vparticle->GetLabel());
388 AliMultiplicity* tracklets = dynamic_cast<AliMultiplicity*>(obj);
391 Int_t label0 = tracklets->GetLabel(id,0);
392 Int_t label1 = tracklets->GetLabel(id,1);
393 Int_t label = (label0==label1)?tracklets->GetLabel(id,1):-666;
394 return PassesMCcuts(fMCevent,label);
396 return kFALSE; //default when passed wrong type of object
399 //-----------------------------------------------------------------------
400 Bool_t AliFlowTrackCuts::PassesCuts(AliFlowTrackSimple* track)
402 //check cuts on a flowtracksimple
404 //clean up from last iteration
406 return AliFlowTrackSimpleCuts::PassesCuts(track);
409 //-----------------------------------------------------------------------
410 Bool_t AliFlowTrackCuts::PassesCuts(AliMultiplicity* tracklet, Int_t id)
412 //check cuts on a tracklets
414 //clean up from last iteration, and init label
419 fTrackPhi = tracklet->GetPhi(id);
420 fTrackEta = tracklet->GetEta(id);
422 if (fCutEta) {if ( fTrackEta < fEtaMin || fTrackEta >= fEtaMax ) return kFALSE;}
423 if (fCutPhi) {if ( fTrackPhi < fPhiMin || fTrackPhi >= fPhiMax ) return kFALSE;}
425 //check MC info if available
426 //if the 2 clusters have different label track cannot be good
427 //and should therefore not pass the mc cuts
428 Int_t label0 = tracklet->GetLabel(id,0);
429 Int_t label1 = tracklet->GetLabel(id,1);
430 //if possible get label and mcparticle
431 fTrackLabel = (label0==label1)?tracklet->GetLabel(id,1):-1;
432 if (!fFakesAreOK && fTrackLabel<0) return kFALSE;
433 if (fTrackLabel>=0 && fMCevent) fMCparticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(fTrackLabel));
435 if (fCutMC && !PassesMCcuts()) return kFALSE;
439 //-----------------------------------------------------------------------
440 Bool_t AliFlowTrackCuts::PassesMCcuts(AliMCEvent* mcEvent, Int_t label)
443 if (!mcEvent) return kFALSE;
444 if (label<0) return kFALSE;//otherwise AliCMevent prints a warning before returning NULL
445 AliMCParticle* mcparticle = static_cast<AliMCParticle*>(mcEvent->GetTrack(label));
446 if (!mcparticle) {AliError("no MC track"); return kFALSE;}
450 if (IsPhysicalPrimary(mcEvent,label,fRequireTransportBitForPrimaries) != fMCisPrimary) return kFALSE;
454 Int_t pdgCode = mcparticle->PdgCode();
455 if (fIgnoreSignInPID)
457 if (TMath::Abs(fMCPID) != TMath::Abs(pdgCode)) return kFALSE;
461 if (fMCPID != pdgCode) return kFALSE;
464 if ( fCutMCprocessType )
466 TParticle* particle = mcparticle->Particle();
467 Int_t processID = particle->GetUniqueID();
468 if (processID != fMCprocessType ) return kFALSE;
472 //-----------------------------------------------------------------------
473 Bool_t AliFlowTrackCuts::PassesMCcuts()
475 if (!fMCevent) return kFALSE;
476 if (fTrackLabel<0) return kFALSE;//otherwise AliCMevent prints a warning before returning NULL
477 fMCparticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(fTrackLabel));
478 return PassesMCcuts(fMCevent,fTrackLabel);
481 //-----------------------------------------------------------------------
482 Bool_t AliFlowTrackCuts::PassesCuts(AliVParticle* vparticle)
484 //check cuts for an ESD vparticle
486 ////////////////////////////////////////////////////////////////
487 // start by preparing the track parameters to cut on //////////
488 ////////////////////////////////////////////////////////////////
489 //clean up from last iteration
492 //get the label and the mc particle
493 fTrackLabel = (fFakesAreOK)?TMath::Abs(vparticle->GetLabel()):vparticle->GetLabel();
494 if (fMCevent) fMCparticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(fTrackLabel));
495 else fMCparticle=NULL;
497 Bool_t isMCparticle = kFALSE; //some things are different for MC particles, check!
498 AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*>(vparticle);
499 AliAODTrack* aodTrack = NULL;
501 //for an ESD track we do some magic sometimes like constructing TPC only parameters
502 //or doing some hybrid, handle that here
503 HandleESDtrack(esdTrack);
506 HandleVParticle(vparticle);
507 //now check if produced particle is MC
508 isMCparticle = (dynamic_cast<AliMCParticle*>(fTrack))!=NULL;
509 aodTrack = dynamic_cast<AliAODTrack*>(vparticle); //keep the additional dynamic cast out of the way for ESDs
511 ////////////////////////////////////////////////////////////////
512 ////////////////////////////////////////////////////////////////
514 if (!fTrack) return kFALSE;
515 //because it may be different from global, not needed for aodTrack because we dont do anything funky there
516 if (esdTrack) esdTrack = static_cast<AliESDtrack*>(fTrack);
519 //check the common cuts for the current particle fTrack (MC,AOD,ESD)
520 Double_t pt = fTrack->Pt();
521 if (!fFakesAreOK) {if (fTrackLabel<0) pass=kFALSE;}
522 if (fCutPt) {if (pt < fPtMin || pt >= fPtMax ) pass=kFALSE;}
523 if (fCutEta) {if (fTrack->Eta() < fEtaMin || fTrack->Eta() >= fEtaMax ) pass=kFALSE;}
524 if (fCutPhi) {if (fTrack->Phi() < fPhiMin || fTrack->Phi() >= fPhiMax ) pass=kFALSE;}
525 if (fRequireCharge) {if (fTrack->Charge() == 0) pass=kFALSE;}
526 if (fCutCharge && !isMCparticle) {if (fTrack->Charge() != fCharge) pass=kFALSE;}
527 if (fCutCharge && isMCparticle)
529 //in case of an MC particle the charge is stored in units of 1/3|e|
530 Int_t charge = TMath::Nint(fTrack->Charge()/3.0); //mc particles have charge in units of 1/3e
531 if (charge!=fCharge) pass=kFALSE;
533 //if(fCutPID) {if (fTrack->PID() != fPID) pass=kFALSE;}
535 //when additionally MC info is required
536 if (fCutMC && !PassesMCcuts()) pass=kFALSE;
538 //the case of ESD or AOD
539 if (esdTrack) { if (!PassesESDcuts(esdTrack)) { pass=kFALSE; } }
540 if (aodTrack) { if (!PassesAODcuts(aodTrack)) { pass=kFALSE; } }
542 //true by default, if we didn't set any cuts
546 //_______________________________________________________________________
547 Bool_t AliFlowTrackCuts::PassesAODcuts(AliAODTrack* track)
551 if (fCutNClustersTPC)
553 Int_t ntpccls = track->GetTPCNcls();
554 if (ntpccls < fNClustersTPCMin || ntpccls > fNClustersTPCMax) pass=kFALSE;
557 if (fCutNClustersITS)
559 Int_t nitscls = track->GetITSNcls();
560 if (nitscls < fNClustersITSMin || nitscls > fNClustersITSMax) pass=kFALSE;
563 if (fCutChi2PerClusterTPC)
565 Double_t chi2tpc = track->Chi2perNDF();
566 if (chi2tpc < fMinChi2PerClusterTPC || chi2tpc > fMaxChi2PerClusterTPC) pass=kFALSE;
569 if (GetRequireTPCRefit() && !(track->GetStatus() & AliESDtrack::kTPCrefit) ) pass=kFALSE;
570 if (GetRequireITSRefit() && !(track->GetStatus() & AliESDtrack::kITSrefit) ) pass=kFALSE;
572 if (fUseAODFilterBit && !track->TestFilterBit(fAODFilterBit)) pass=kFALSE;
574 if (fCutDCAToVertexXY && track->DCA()>GetMaxDCAToVertexXY()) pass=kFALSE;
580 //_______________________________________________________________________
581 Bool_t AliFlowTrackCuts::PassesESDcuts(AliESDtrack* track)
584 if (fIgnoreTPCzRange)
586 const AliExternalTrackParam* pin = track->GetOuterParam();
587 const AliExternalTrackParam* pout = track->GetInnerParam();
590 Double_t zin = pin->GetZ();
591 Double_t zout = pout->GetZ();
592 if (zin*zout<0) pass=kFALSE; //reject if cross the membrane
593 if (zin < fIgnoreTPCzRangeMin || zin > fIgnoreTPCzRangeMax) pass=kFALSE;
594 if (zout < fIgnoreTPCzRangeMin || zout > fIgnoreTPCzRangeMax) pass=kFALSE;
598 Int_t ntpccls = ( fParamType==kESD_TPConly )?
599 track->GetTPCNclsIter1():track->GetTPCNcls();
600 if (fCutChi2PerClusterTPC)
602 Float_t tpcchi2 = (fParamType==kESD_TPConly)?
603 track->GetTPCchi2Iter1():track->GetTPCchi2();
604 tpcchi2 = (ntpccls>0)?tpcchi2/ntpccls:-FLT_MAX;
605 if (tpcchi2<fMinChi2PerClusterTPC || tpcchi2 >=fMaxChi2PerClusterTPC)
609 if (fCutMinimalTPCdedx)
611 if (track->GetTPCsignal() < fMinimalTPCdedx) pass=kFALSE;
614 if (fCutNClustersTPC)
616 if (ntpccls < fNClustersTPCMin || ntpccls > fNClustersTPCMax) pass=kFALSE;
619 Int_t nitscls = track->GetNcls(0);
620 if (fCutNClustersITS)
622 if (nitscls < fNClustersITSMin || nitscls > fNClustersITSMax) pass=kFALSE;
630 if (!PassesTPCpidCut(track)) pass=kFALSE;
633 if (!PassesTPCdedxCut(track)) pass=kFALSE;
636 if (!PassesTOFpidCut(track)) pass=kFALSE;
639 if (!PassesTOFbetaCut(track)) pass=kFALSE;
641 // part added by F. Noferini
643 if (!PassesTOFbayesianCut(track)) pass=kFALSE;
645 // end part added by F. Noferini
647 printf("AliFlowTrackCuts::PassesCuts() this should never be called!\n");
653 //some stuff is still handled by AliESDtrackCuts class - delegate
654 if (fAliESDtrackCuts)
656 if (!fAliESDtrackCuts->IsSelected(track)) pass=kFALSE;
662 //-----------------------------------------------------------------------
663 void AliFlowTrackCuts::HandleVParticle(AliVParticle* track)
665 //handle the general case
674 //-----------------------------------------------------------------------
675 void AliFlowTrackCuts::HandleESDtrack(AliESDtrack* track)
684 if (!track->FillTPCOnlyTrack(fTPCtrack))
692 //recalculate the label and mc particle, they may differ as TPClabel != global label
693 fTrackLabel = (fFakesAreOK)?TMath::Abs(fTrack->GetLabel()):fTrack->GetLabel();
694 if (fMCevent) fMCparticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(fTrackLabel));
695 else fMCparticle=NULL;
703 //-----------------------------------------------------------------------
704 Int_t AliFlowTrackCuts::Count(AliVEvent* event)
706 //calculate the number of track in given event.
707 //if argument is NULL(default) take the event attached
709 Int_t multiplicity = 0;
712 for (Int_t i=0; i<GetNumberOfInputObjects(); i++)
714 if (IsSelected(GetInputObject(i))) multiplicity++;
719 for (Int_t i=0; i<event->GetNumberOfTracks(); i++)
721 if (IsSelected(event->GetTrack(i))) multiplicity++;
727 //-----------------------------------------------------------------------
728 AliFlowTrackCuts* AliFlowTrackCuts::GetStandardGlobalTrackCuts2010()
731 AliFlowTrackCuts* cuts = new AliFlowTrackCuts("standard Global flow cuts");
732 cuts->SetParamType(kGlobal);
733 cuts->SetPtRange(0.2,5.);
734 cuts->SetEtaRange(-0.8,0.8);
735 cuts->SetMinNClustersTPC(70);
736 cuts->SetMinChi2PerClusterTPC(0.1);
737 cuts->SetMaxChi2PerClusterTPC(4.0);
738 cuts->SetMinNClustersITS(2);
739 cuts->SetRequireITSRefit(kTRUE);
740 cuts->SetRequireTPCRefit(kTRUE);
741 cuts->SetMaxDCAToVertexXY(0.3);
742 cuts->SetMaxDCAToVertexZ(0.3);
743 cuts->SetAcceptKinkDaughters(kFALSE);
744 cuts->SetMinimalTPCdedx(10.);
749 //-----------------------------------------------------------------------
750 AliFlowTrackCuts* AliFlowTrackCuts::GetStandardTPCOnlyTrackCuts2010()
753 AliFlowTrackCuts* cuts = new AliFlowTrackCuts("standard TPConly flow cuts");
754 cuts->SetParamType(kESD_TPConly);
755 cuts->SetPtRange(0.2,5.);
756 cuts->SetEtaRange(-0.8,0.8);
757 cuts->SetMinNClustersTPC(70);
758 cuts->SetMinChi2PerClusterTPC(0.2);
759 cuts->SetMaxChi2PerClusterTPC(4.0);
760 cuts->SetMaxDCAToVertexXY(3.0);
761 cuts->SetMaxDCAToVertexZ(3.0);
762 cuts->SetDCAToVertex2D(kTRUE);
763 cuts->SetAcceptKinkDaughters(kFALSE);
764 cuts->SetMinimalTPCdedx(10.);
769 //-----------------------------------------------------------------------
770 AliFlowTrackCuts* AliFlowTrackCuts::GetStandardTPCOnlyTrackCuts()
773 AliFlowTrackCuts* cuts = new AliFlowTrackCuts("standard TPConly flow cuts");
774 cuts->SetParamType(kESD_TPConly);
775 cuts->SetPtRange(0.2,5.);
776 cuts->SetEtaRange(-0.8,0.8);
777 cuts->SetMinNClustersTPC(70);
778 cuts->SetMinChi2PerClusterTPC(0.2);
779 cuts->SetMaxChi2PerClusterTPC(4.0);
780 cuts->SetMaxDCAToVertexXY(3.0);
781 cuts->SetMaxDCAToVertexZ(3.0);
782 cuts->SetDCAToVertex2D(kTRUE);
783 cuts->SetAcceptKinkDaughters(kFALSE);
784 cuts->SetMinimalTPCdedx(10.);
789 //-----------------------------------------------------------------------
790 AliFlowTrackCuts* AliFlowTrackCuts::GetStandardITSTPCTrackCuts2009(Bool_t selPrimaries)
793 AliFlowTrackCuts* cuts = new AliFlowTrackCuts("standard global track cuts 2009");
794 delete cuts->fAliESDtrackCuts;
795 cuts->fAliESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(selPrimaries);
796 cuts->SetParamType(kGlobal);
800 //-----------------------------------------------------------------------
801 AliFlowTrack* AliFlowTrackCuts::MakeFlowTrackSPDtracklet() const
803 //make a flow track from tracklet
804 AliFlowTrack* flowtrack=NULL;
805 TParticle *tmpTParticle=NULL;
806 AliMCParticle* tmpAliMCParticle=NULL;
810 flowtrack = new AliFlowTrack();
811 flowtrack->SetPhi(fTrackPhi);
812 flowtrack->SetEta(fTrackEta);
814 case kTrackWithMCkine:
815 if (!fMCparticle) return NULL;
816 flowtrack = new AliFlowTrack();
817 flowtrack->SetPhi( fMCparticle->Phi() );
818 flowtrack->SetEta( fMCparticle->Eta() );
819 flowtrack->SetPt( fMCparticle->Pt() );
822 if (!fMCparticle) return NULL;
823 flowtrack = new AliFlowTrack();
824 flowtrack->SetPhi(fTrackPhi);
825 flowtrack->SetEta(fTrackEta);
826 flowtrack->SetPt(fMCparticle->Pt());
828 case kTrackWithPtFromFirstMother:
829 if (!fMCparticle) return NULL;
830 flowtrack = new AliFlowTrack();
831 flowtrack->SetPhi(fTrackPhi);
832 flowtrack->SetEta(fTrackEta);
833 tmpTParticle = fMCparticle->Particle();
834 tmpAliMCParticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(tmpTParticle->GetFirstMother()));
835 flowtrack->SetPt(tmpAliMCParticle->Pt());
838 flowtrack = new AliFlowTrack();
839 flowtrack->SetPhi(fTrackPhi);
840 flowtrack->SetEta(fTrackEta);
843 flowtrack->SetSource(AliFlowTrack::kFromTracklet);
847 //-----------------------------------------------------------------------
848 AliFlowTrack* AliFlowTrackCuts::MakeFlowTrackVParticle() const
850 //make flow track from AliVParticle (ESD,AOD,MC)
851 if (!fTrack) return NULL;
852 AliFlowTrack* flowtrack=NULL;
853 TParticle *tmpTParticle=NULL;
854 AliMCParticle* tmpAliMCParticle=NULL;
858 flowtrack = new AliFlowTrack(fTrack);
860 case kTrackWithMCkine:
861 flowtrack = new AliFlowTrack(fMCparticle);
863 case kTrackWithMCPID:
864 flowtrack = new AliFlowTrack(fTrack);
865 //flowtrack->setPID(...) from mc, when implemented
868 if (!fMCparticle) return NULL;
869 flowtrack = new AliFlowTrack(fTrack);
870 flowtrack->SetPt(fMCparticle->Pt());
872 case kTrackWithPtFromFirstMother:
873 if (!fMCparticle) return NULL;
874 flowtrack = new AliFlowTrack(fTrack);
875 tmpTParticle = fMCparticle->Particle();
876 tmpAliMCParticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(tmpTParticle->GetFirstMother()));
877 flowtrack->SetPt(tmpAliMCParticle->Pt());
880 flowtrack = new AliFlowTrack(fTrack);
883 if (fParamType==kMC) flowtrack->SetSource(AliFlowTrack::kFromMC);
884 else if (dynamic_cast<AliESDtrack*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromESD);
885 else if (dynamic_cast<AliAODTrack*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromAOD);
886 else if (dynamic_cast<AliMCParticle*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromMC);
890 //-----------------------------------------------------------------------
891 AliFlowTrack* AliFlowTrackCuts::MakeFlowTrackPMDtrack() const
893 //make a flow track from PMD track
894 AliFlowTrack* flowtrack=NULL;
895 TParticle *tmpTParticle=NULL;
896 AliMCParticle* tmpAliMCParticle=NULL;
900 flowtrack = new AliFlowTrack();
901 flowtrack->SetPhi(fTrackPhi);
902 flowtrack->SetEta(fTrackEta);
903 flowtrack->SetWeight(fTrackWeight);
905 case kTrackWithMCkine:
906 if (!fMCparticle) return NULL;
907 flowtrack = new AliFlowTrack();
908 flowtrack->SetPhi( fMCparticle->Phi() );
909 flowtrack->SetEta( fMCparticle->Eta() );
910 flowtrack->SetWeight(fTrackWeight);
911 flowtrack->SetPt( fMCparticle->Pt() );
914 if (!fMCparticle) return NULL;
915 flowtrack = new AliFlowTrack();
916 flowtrack->SetPhi(fTrackPhi);
917 flowtrack->SetEta(fTrackEta);
918 flowtrack->SetWeight(fTrackWeight);
919 flowtrack->SetPt(fMCparticle->Pt());
921 case kTrackWithPtFromFirstMother:
922 if (!fMCparticle) return NULL;
923 flowtrack = new AliFlowTrack();
924 flowtrack->SetPhi(fTrackPhi);
925 flowtrack->SetEta(fTrackEta);
926 flowtrack->SetWeight(fTrackWeight);
927 tmpTParticle = fMCparticle->Particle();
928 tmpAliMCParticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(tmpTParticle->GetFirstMother()));
929 flowtrack->SetPt(tmpAliMCParticle->Pt());
932 flowtrack = new AliFlowTrack();
933 flowtrack->SetPhi(fTrackPhi);
934 flowtrack->SetEta(fTrackEta);
935 flowtrack->SetWeight(fTrackWeight);
939 flowtrack->SetSource(AliFlowTrack::kFromPMD);
943 //-----------------------------------------------------------------------
944 AliFlowTrack* AliFlowTrackCuts::MakeFlowTrack() const
946 //get a flow track constructed from whatever we applied cuts on
947 //caller is resposible for deletion
948 //if construction fails return NULL
951 case kESD_SPDtracklet:
952 return MakeFlowTrackSPDtracklet();
954 return MakeFlowTrackPMDtrack();
956 return MakeFlowTrackVParticle();
960 //-----------------------------------------------------------------------
961 Bool_t AliFlowTrackCuts::IsPhysicalPrimary() const
963 //check if current particle is a physical primary
964 if (!fMCevent) return kFALSE;
965 if (fTrackLabel<0) return kFALSE;
966 return IsPhysicalPrimary(fMCevent, fTrackLabel, fRequireTransportBitForPrimaries);
969 //-----------------------------------------------------------------------
970 Bool_t AliFlowTrackCuts::IsPhysicalPrimary(AliMCEvent* mcEvent, Int_t label, Bool_t requiretransported)
972 //check if current particle is a physical primary
973 Bool_t physprim=mcEvent->IsPhysicalPrimary(label);
974 AliMCParticle* track = static_cast<AliMCParticle*>(mcEvent->GetTrack(label));
975 if (!track) return kFALSE;
976 TParticle* particle = track->Particle();
977 Bool_t transported = particle->TestBit(kTransportBit);
978 //printf("label: %i prim: %s, transp: %s, pass: %s\n",label, (physprim)?"YES":"NO ",(transported)?"YES":"NO ",
979 //(physprim && (transported || !requiretransported))?"YES":"NO" );
980 return (physprim && (transported || !requiretransported));
983 //-----------------------------------------------------------------------
984 void AliFlowTrackCuts::DefineHistograms()
986 //define qa histograms
989 //-----------------------------------------------------------------------
990 Int_t AliFlowTrackCuts::GetNumberOfInputObjects() const
992 //get the number of tracks in the input event according source
993 //selection (ESD tracks, tracklets, MC particles etc.)
994 AliESDEvent* esd=NULL;
997 case kESD_SPDtracklet:
998 esd = dynamic_cast<AliESDEvent*>(fEvent);
1000 return esd->GetMultiplicity()->GetNumberOfTracklets();
1002 if (!fMCevent) return 0;
1003 return fMCevent->GetNumberOfTracks();
1005 esd = dynamic_cast<AliESDEvent*>(fEvent);
1007 return esd->GetNumberOfPmdTracks();
1009 if (!fEvent) return 0;
1010 return fEvent->GetNumberOfTracks();
1015 //-----------------------------------------------------------------------
1016 TObject* AliFlowTrackCuts::GetInputObject(Int_t i)
1018 //get the input object according the data source selection:
1019 //(esd tracks, traclets, mc particles,etc...)
1020 AliESDEvent* esd=NULL;
1023 case kESD_SPDtracklet:
1024 esd = dynamic_cast<AliESDEvent*>(fEvent);
1025 if (!esd) return NULL;
1026 return const_cast<AliMultiplicity*>(esd->GetMultiplicity());
1028 if (!fMCevent) return NULL;
1029 return fMCevent->GetTrack(i);
1031 esd = dynamic_cast<AliESDEvent*>(fEvent);
1032 if (!esd) return NULL;
1033 return esd->GetPmdTrack(i);
1035 if (!fEvent) return NULL;
1036 return fEvent->GetTrack(i);
1040 //-----------------------------------------------------------------------
1041 void AliFlowTrackCuts::Clear(Option_t*)
1053 //-----------------------------------------------------------------------
1054 Bool_t AliFlowTrackCuts::PassesTOFbetaCut(AliESDtrack* track )
1056 //check if passes PID cut using timing in TOF
1057 Bool_t goodtrack = (track) &&
1058 (track->GetStatus() & AliESDtrack::kTOFpid) &&
1059 (track->GetTOFsignal() > 12000) &&
1060 (track->GetTOFsignal() < 100000) &&
1061 (track->GetIntegratedLength() > 365) &&
1062 !(track->GetStatus() & AliESDtrack::kTOFmismatch);
1064 if (!goodtrack) return kFALSE;
1066 const Float_t c = 2.99792457999999984e-02;
1067 Float_t p = track->GetP();
1068 Float_t L = track->GetIntegratedLength();
1069 Float_t trackT0 = fESDpid.GetTOFResponse().GetStartTime(p);
1070 Float_t timeTOF = track->GetTOFsignal()- trackT0;
1071 Float_t beta = L/timeTOF/c;
1072 Double_t integratedTimes[5] = {-1.0,-1.0,-1.0,-1.0,-1.0};
1073 track->GetIntegratedTimes(integratedTimes);
1075 //construct the pid index because it's not AliPID::EParticleType
1077 switch (fParticleID)
1085 case AliPID::kProton:
1093 Float_t s = beta-L/integratedTimes[pid]/c;
1095 Float_t* arr = fTOFpidCuts->GetMatrixArray();
1096 Int_t col = TMath::BinarySearch(fTOFpidCuts->GetNcols(),arr,static_cast<Float_t>(p));
1097 if (col<0) return kFALSE;
1098 Float_t min = (*fTOFpidCuts)(1,col);
1099 Float_t max = (*fTOFpidCuts)(2,col);
1101 //printf("--------------TOF beta cut %s\n",(s>min && s<max)?"PASS":"FAIL");
1102 return (s>min && s<max);
1105 //-----------------------------------------------------------------------
1106 Bool_t AliFlowTrackCuts::PassesTOFpidCut(AliESDtrack* track)
1108 //check if passes PID cut using default TOF pid
1109 Double_t pidTOF[AliPID::kSPECIES];
1110 track->GetTOFpid(pidTOF);
1111 if (pidTOF[fParticleID]>=fParticleProbability) return kTRUE;
1115 //-----------------------------------------------------------------------
1116 Bool_t AliFlowTrackCuts::PassesTPCpidCut(AliESDtrack* track)
1118 //check if passes PID cut using default TPC pid
1119 Double_t pidTPC[AliPID::kSPECIES];
1120 track->GetTPCpid(pidTPC);
1121 Double_t probablity = 0.;
1122 switch (fParticleID)
1125 probablity = pidTPC[AliPID::kPion] + pidTPC[AliPID::kMuon];
1128 probablity = pidTPC[fParticleID];
1130 if (probablity >= fParticleProbability) return kTRUE;
1134 //-----------------------------------------------------------------------
1135 Bool_t AliFlowTrackCuts::PassesTPCdedxCut(AliESDtrack* track)
1137 //check if passes PID cut using dedx signal in the TPC
1140 printf("no TPCpidCuts\n");
1144 const AliExternalTrackParam* tpcparam = track->GetInnerParam(); //tpc only params at the inner wall
1145 if (!tpcparam) return kFALSE;
1146 Float_t sigExp = fESDpid.GetTPCResponse().GetExpectedSignal(tpcparam->GetP(), fParticleID);
1147 Float_t sigTPC = track->GetTPCsignal();
1148 Float_t s = (sigTPC-sigExp)/sigExp;
1149 Double_t pt = track->Pt();
1151 Float_t* arr = fTPCpidCuts->GetMatrixArray();
1152 Int_t col = TMath::BinarySearch(fTPCpidCuts->GetNcols(),arr,static_cast<Float_t>(pt));
1153 if (col<0) return kFALSE;
1154 Float_t min = (*fTPCpidCuts)(1,col);
1155 Float_t max = (*fTPCpidCuts)(2,col);
1157 //printf("------------TPC pid cut %s\n",(s>min && s<max)?"PASS":"FAIL");
1158 return (s>min && s<max);
1161 //-----------------------------------------------------------------------
1162 void AliFlowTrackCuts::InitPIDcuts()
1164 //init matrices with PID cuts
1168 if (fParticleID==AliPID::kPion)
1170 t = new TMatrixF(3,10);
1171 (*t)(0,0) = 0.20; (*t)(1,0) = -0.4; (*t)(2,0) = 0.2;
1172 (*t)(0,1) = 0.25; (*t)(1,1) = -0.4; (*t)(2,1) = 0.2;
1173 (*t)(0,2) = 0.30; (*t)(1,2) = -0.4; (*t)(2,2) = 0.25;
1174 (*t)(0,3) = 0.35; (*t)(1,3) = -0.4; (*t)(2,3) = 0.25;
1175 (*t)(0,4) = 0.40; (*t)(1,4) = -0.4; (*t)(2,4) = 0.3;
1176 (*t)(0,5) = 0.45; (*t)(1,5) = -0.4; (*t)(2,5) = 0.3;
1177 (*t)(0,6) = 0.50; (*t)(1,6) = -0.4; (*t)(2,6) = 0.25;
1178 (*t)(0,7) = 0.55; (*t)(1,7) = -0.4; (*t)(2,7) = 0.15;
1179 (*t)(0,8) = 0.60; (*t)(1,8) = -0.4; (*t)(2,8) = 0.1;
1180 (*t)(0,9) = 0.65; (*t)(1,9) = 0; (*t)(2,9) = 0;
1183 if (fParticleID==AliPID::kKaon)
1185 t = new TMatrixF(3,7);
1186 (*t)(0,0) = 0.20; (*t)(1,0) = -0.2; (*t)(2,0) = 0.4;
1187 (*t)(0,1) = 0.25; (*t)(1,1) =-0.15; (*t)(2,1) = 0.4;
1188 (*t)(0,2) = 0.30; (*t)(1,2) = -0.1; (*t)(2,2) = 0.4;
1189 (*t)(0,3) = 0.35; (*t)(1,3) = -0.1; (*t)(2,3) = 0.4;
1190 (*t)(0,4) = 0.40; (*t)(1,4) = -0.1; (*t)(2,4) = 0.6;
1191 (*t)(0,5) = 0.45; (*t)(1,5) = -0.1; (*t)(2,5) = 0.6;
1192 (*t)(0,6) = 0.50; (*t)(1,6) = 0; (*t)(2,6) = 0;
1195 if (fParticleID==AliPID::kProton)
1197 t = new TMatrixF(3,16);
1198 (*t)(0,0) = 0.20; (*t)(1,0) = 0; (*t)(2,0) = 0;
1199 (*t)(0,1) = 0.25; (*t)(1,1) = -0.2; (*t)(2,1) = 0.3;
1200 (*t)(0,2) = 0.30; (*t)(1,2) = -0.2; (*t)(2,2) = 0.6;
1201 (*t)(0,3) = 0.35; (*t)(1,3) = -0.2; (*t)(2,3) = 0.6;
1202 (*t)(0,4) = 0.40; (*t)(1,4) = -0.2; (*t)(2,4) = 0.6;
1203 (*t)(0,5) = 0.45; (*t)(1,5) = -0.15; (*t)(2,5) = 0.6;
1204 (*t)(0,6) = 0.50; (*t)(1,6) = -0.1; (*t)(2,6) = 0.6;
1205 (*t)(0,7) = 0.55; (*t)(1,7) = -0.05; (*t)(2,7) = 0.6;
1206 (*t)(0,8) = 0.60; (*t)(1,8) = -0.05; (*t)(2,8) = 0.45;
1207 (*t)(0,9) = 0.65; (*t)(1,9) = -0.05; (*t)(2,9) = 0.45;
1208 (*t)(0,10) = 0.70; (*t)(1,10) = -0.05; (*t)(2,10) = 0.45;
1209 (*t)(0,11) = 0.75; (*t)(1,11) = -0.05; (*t)(2,11) = 0.45;
1210 (*t)(0,12) = 0.80; (*t)(1,12) = 0; (*t)(2,12) = 0.45;
1211 (*t)(0,13) = 0.85; (*t)(1,13) = 0; (*t)(2,13) = 0.45;
1212 (*t)(0,14) = 0.90; (*t)(1,14) = 0; (*t)(2,14) = 0.45;
1213 (*t)(0,15) = 0.95; (*t)(1,15) = 0; (*t)(2,15) = 0;
1220 if (fParticleID==AliPID::kPion)
1222 //TOF pions, 0.9 purity
1223 t = new TMatrixF(3,61);
1224 (*t)(0,0) = 0.000; (*t)(2,0) = 0.000; (*t)(2,0) = 0.000;
1225 (*t)(0,1) = 0.050; (*t)(2,1) = 0.000; (*t)(2,1) = 0.000;
1226 (*t)(0,2) = 0.100; (*t)(2,2) = 0.000; (*t)(2,2) = 0.000;
1227 (*t)(0,3) = 0.150; (*t)(2,3) = 0.000; (*t)(2,3) = 0.000;
1228 (*t)(0,4) = 0.200; (*t)(2,4) = 0.000; (*t)(2,4) = 0.000;
1229 (*t)(0,5) = 0.250; (*t)(2,5) = -0.046; (*t)(2,5) = 0.046;
1230 (*t)(0,6) = 0.300; (*t)(2,6) = -0.038; (*t)(2,6) = 0.038;
1231 (*t)(0,7) = 0.350; (*t)(2,7) = -0.034; (*t)(2,7) = 0.034;
1232 (*t)(0,8) = 0.400; (*t)(2,8) = -0.032; (*t)(2,8) = 0.032;
1233 (*t)(0,9) = 0.450; (*t)(2,9) = -0.030; (*t)(2,9) = 0.030;
1234 (*t)(0,10) = 0.500; (*t)(2,10) = -0.030; (*t)(2,10) = 0.030;
1235 (*t)(0,11) = 0.550; (*t)(2,11) = -0.030; (*t)(2,11) = 0.030;
1236 (*t)(0,12) = 0.600; (*t)(2,12) = -0.030; (*t)(2,12) = 0.030;
1237 (*t)(0,13) = 0.650; (*t)(2,13) = -0.030; (*t)(2,13) = 0.030;
1238 (*t)(0,14) = 0.700; (*t)(2,14) = -0.030; (*t)(2,14) = 0.030;
1239 (*t)(0,15) = 0.750; (*t)(2,15) = -0.030; (*t)(2,15) = 0.030;
1240 (*t)(0,16) = 0.800; (*t)(2,16) = -0.030; (*t)(2,16) = 0.030;
1241 (*t)(0,17) = 0.850; (*t)(2,17) = -0.030; (*t)(2,17) = 0.030;
1242 (*t)(0,18) = 0.900; (*t)(2,18) = -0.030; (*t)(2,18) = 0.030;
1243 (*t)(0,19) = 0.950; (*t)(2,19) = -0.028; (*t)(2,19) = 0.028;
1244 (*t)(0,20) = 1.000; (*t)(2,20) = -0.028; (*t)(2,20) = 0.028;
1245 (*t)(0,21) = 1.100; (*t)(2,21) = -0.028; (*t)(2,21) = 0.028;
1246 (*t)(0,22) = 1.200; (*t)(2,22) = -0.026; (*t)(2,22) = 0.028;
1247 (*t)(0,23) = 1.300; (*t)(2,23) = -0.024; (*t)(2,23) = 0.028;
1248 (*t)(0,24) = 1.400; (*t)(2,24) = -0.020; (*t)(2,24) = 0.028;
1249 (*t)(0,25) = 1.500; (*t)(2,25) = -0.018; (*t)(2,25) = 0.028;
1250 (*t)(0,26) = 1.600; (*t)(2,26) = -0.016; (*t)(2,26) = 0.028;
1251 (*t)(0,27) = 1.700; (*t)(2,27) = -0.014; (*t)(2,27) = 0.028;
1252 (*t)(0,28) = 1.800; (*t)(2,28) = -0.012; (*t)(2,28) = 0.026;
1253 (*t)(0,29) = 1.900; (*t)(2,29) = -0.010; (*t)(2,29) = 0.026;
1254 (*t)(0,30) = 2.000; (*t)(2,30) = -0.008; (*t)(2,30) = 0.026;
1255 (*t)(0,31) = 2.100; (*t)(2,31) = -0.008; (*t)(2,31) = 0.024;
1256 (*t)(0,32) = 2.200; (*t)(2,32) = -0.006; (*t)(2,32) = 0.024;
1257 (*t)(0,33) = 2.300; (*t)(2,33) = -0.004; (*t)(2,33) = 0.024;
1258 (*t)(0,34) = 2.400; (*t)(2,34) = -0.004; (*t)(2,34) = 0.024;
1259 (*t)(0,35) = 2.500; (*t)(2,35) = -0.002; (*t)(2,35) = 0.024;
1260 (*t)(0,36) = 2.600; (*t)(2,36) = -0.002; (*t)(2,36) = 0.024;
1261 (*t)(0,37) = 2.700; (*t)(2,37) = 0.000; (*t)(2,37) = 0.024;
1262 (*t)(0,38) = 2.800; (*t)(2,38) = 0.000; (*t)(2,38) = 0.026;
1263 (*t)(0,39) = 2.900; (*t)(2,39) = 0.000; (*t)(2,39) = 0.024;
1264 (*t)(0,40) = 3.000; (*t)(2,40) = 0.002; (*t)(2,40) = 0.026;
1265 (*t)(0,41) = 3.100; (*t)(2,41) = 0.002; (*t)(2,41) = 0.026;
1266 (*t)(0,42) = 3.200; (*t)(2,42) = 0.002; (*t)(2,42) = 0.026;
1267 (*t)(0,43) = 3.300; (*t)(2,43) = 0.002; (*t)(2,43) = 0.026;
1268 (*t)(0,44) = 3.400; (*t)(2,44) = 0.002; (*t)(2,44) = 0.026;
1269 (*t)(0,45) = 3.500; (*t)(2,45) = 0.002; (*t)(2,45) = 0.026;
1270 (*t)(0,46) = 3.600; (*t)(2,46) = 0.002; (*t)(2,46) = 0.026;
1271 (*t)(0,47) = 3.700; (*t)(2,47) = 0.002; (*t)(2,47) = 0.026;
1272 (*t)(0,48) = 3.800; (*t)(2,48) = 0.002; (*t)(2,48) = 0.026;
1273 (*t)(0,49) = 3.900; (*t)(2,49) = 0.004; (*t)(2,49) = 0.024;
1274 (*t)(0,50) = 4.000; (*t)(2,50) = 0.004; (*t)(2,50) = 0.026;
1275 (*t)(0,51) = 4.100; (*t)(2,51) = 0.004; (*t)(2,51) = 0.026;
1276 (*t)(0,52) = 4.200; (*t)(2,52) = 0.004; (*t)(2,52) = 0.024;
1277 (*t)(0,53) = 4.300; (*t)(2,53) = 0.006; (*t)(2,53) = 0.024;
1278 (*t)(0,54) = 4.400; (*t)(2,54) = 0.000; (*t)(2,54) = 0.000;
1279 (*t)(0,55) = 4.500; (*t)(2,55) = 0.000; (*t)(2,55) = 0.000;
1280 (*t)(0,56) = 4.600; (*t)(2,56) = 0.000; (*t)(2,56) = 0.000;
1281 (*t)(0,57) = 4.700; (*t)(2,57) = 0.000; (*t)(2,57) = 0.000;
1282 (*t)(0,58) = 4.800; (*t)(2,58) = 0.000; (*t)(2,58) = 0.000;
1283 (*t)(0,59) = 4.900; (*t)(2,59) = 0.000; (*t)(2,59) = 0.000;
1284 (*t)(0,60) = 5.900; (*t)(2,60) = 0.000; (*t)(2,60) = 0.000;
1287 if (fParticleID==AliPID::kProton)
1289 //TOF protons, 0.9 purity
1290 t = new TMatrixF(3,61);
1291 (*t)(0,0) = 0.000; (*t)(2,0) = 0.000; (*t)(2,0) = 0.000;
1292 (*t)(0,1) = 0.050; (*t)(2,1) = 0.000; (*t)(2,1) = 0.000;
1293 (*t)(0,2) = 0.100; (*t)(2,2) = 0.000; (*t)(2,2) = 0.000;
1294 (*t)(0,3) = 0.150; (*t)(2,3) = 0.000; (*t)(2,3) = 0.000;
1295 (*t)(0,4) = 0.200; (*t)(2,4) = 0.000; (*t)(2,4) = 0.000;
1296 (*t)(0,5) = 0.250; (*t)(2,5) = 0.000; (*t)(2,5) = 0.000;
1297 (*t)(0,6) = 0.300; (*t)(2,6) = 0.000; (*t)(2,6) = 0.000;
1298 (*t)(0,7) = 0.350; (*t)(2,7) = 0.000; (*t)(2,7) = 0.000;
1299 (*t)(0,8) = 0.400; (*t)(2,8) = 0.000; (*t)(2,8) = 0.000;
1300 (*t)(0,9) = 0.450; (*t)(2,9) = 0.000; (*t)(2,9) = 0.000;
1301 (*t)(0,10) = 0.500; (*t)(2,10) = 0.000; (*t)(2,10) = 0.000;
1302 (*t)(0,11) = 0.550; (*t)(2,11) = 0.000; (*t)(2,11) = 0.000;
1303 (*t)(0,12) = 0.600; (*t)(2,12) = 0.000; (*t)(2,12) = 0.000;
1304 (*t)(0,13) = 0.650; (*t)(2,13) = 0.000; (*t)(2,13) = 0.000;
1305 (*t)(0,14) = 0.700; (*t)(2,14) = 0.000; (*t)(2,14) = 0.000;
1306 (*t)(0,15) = 0.750; (*t)(2,15) = 0.000; (*t)(2,15) = 0.000;
1307 (*t)(0,16) = 0.800; (*t)(2,16) = 0.000; (*t)(2,16) = 0.000;
1308 (*t)(0,17) = 0.850; (*t)(2,17) = -0.070; (*t)(2,17) = 0.070;
1309 (*t)(0,18) = 0.900; (*t)(2,18) = -0.072; (*t)(2,18) = 0.072;
1310 (*t)(0,19) = 0.950; (*t)(2,19) = -0.072; (*t)(2,19) = 0.072;
1311 (*t)(0,20) = 1.000; (*t)(2,20) = -0.074; (*t)(2,20) = 0.074;
1312 (*t)(0,21) = 1.100; (*t)(2,21) = -0.032; (*t)(2,21) = 0.032;
1313 (*t)(0,22) = 1.200; (*t)(2,22) = -0.026; (*t)(2,22) = 0.026;
1314 (*t)(0,23) = 1.300; (*t)(2,23) = -0.026; (*t)(2,23) = 0.026;
1315 (*t)(0,24) = 1.400; (*t)(2,24) = -0.024; (*t)(2,24) = 0.024;
1316 (*t)(0,25) = 1.500; (*t)(2,25) = -0.024; (*t)(2,25) = 0.024;
1317 (*t)(0,26) = 1.600; (*t)(2,26) = -0.026; (*t)(2,26) = 0.026;
1318 (*t)(0,27) = 1.700; (*t)(2,27) = -0.026; (*t)(2,27) = 0.026;
1319 (*t)(0,28) = 1.800; (*t)(2,28) = -0.026; (*t)(2,28) = 0.026;
1320 (*t)(0,29) = 1.900; (*t)(2,29) = -0.026; (*t)(2,29) = 0.026;
1321 (*t)(0,30) = 2.000; (*t)(2,30) = -0.026; (*t)(2,30) = 0.026;
1322 (*t)(0,31) = 2.100; (*t)(2,31) = -0.026; (*t)(2,31) = 0.026;
1323 (*t)(0,32) = 2.200; (*t)(2,32) = -0.026; (*t)(2,32) = 0.024;
1324 (*t)(0,33) = 2.300; (*t)(2,33) = -0.028; (*t)(2,33) = 0.022;
1325 (*t)(0,34) = 2.400; (*t)(2,34) = -0.028; (*t)(2,34) = 0.020;
1326 (*t)(0,35) = 2.500; (*t)(2,35) = -0.028; (*t)(2,35) = 0.018;
1327 (*t)(0,36) = 2.600; (*t)(2,36) = -0.028; (*t)(2,36) = 0.016;
1328 (*t)(0,37) = 2.700; (*t)(2,37) = -0.028; (*t)(2,37) = 0.016;
1329 (*t)(0,38) = 2.800; (*t)(2,38) = -0.030; (*t)(2,38) = 0.014;
1330 (*t)(0,39) = 2.900; (*t)(2,39) = -0.030; (*t)(2,39) = 0.012;
1331 (*t)(0,40) = 3.000; (*t)(2,40) = -0.030; (*t)(2,40) = 0.012;
1332 (*t)(0,41) = 3.100; (*t)(2,41) = -0.030; (*t)(2,41) = 0.010;
1333 (*t)(0,42) = 3.200; (*t)(2,42) = -0.030; (*t)(2,42) = 0.010;
1334 (*t)(0,43) = 3.300; (*t)(2,43) = -0.030; (*t)(2,43) = 0.010;
1335 (*t)(0,44) = 3.400; (*t)(2,44) = -0.030; (*t)(2,44) = 0.008;
1336 (*t)(0,45) = 3.500; (*t)(2,45) = -0.030; (*t)(2,45) = 0.008;
1337 (*t)(0,46) = 3.600; (*t)(2,46) = -0.030; (*t)(2,46) = 0.008;
1338 (*t)(0,47) = 3.700; (*t)(2,47) = -0.030; (*t)(2,47) = 0.006;
1339 (*t)(0,48) = 3.800; (*t)(2,48) = -0.030; (*t)(2,48) = 0.006;
1340 (*t)(0,49) = 3.900; (*t)(2,49) = -0.030; (*t)(2,49) = 0.006;
1341 (*t)(0,50) = 4.000; (*t)(2,50) = -0.028; (*t)(2,50) = 0.004;
1342 (*t)(0,51) = 4.100; (*t)(2,51) = -0.030; (*t)(2,51) = 0.004;
1343 (*t)(0,52) = 4.200; (*t)(2,52) = -0.030; (*t)(2,52) = 0.004;
1344 (*t)(0,53) = 4.300; (*t)(2,53) = -0.028; (*t)(2,53) = 0.002;
1345 (*t)(0,54) = 4.400; (*t)(2,54) = -0.030; (*t)(2,54) = 0.002;
1346 (*t)(0,55) = 4.500; (*t)(2,55) = -0.028; (*t)(2,55) = 0.002;
1347 (*t)(0,56) = 4.600; (*t)(2,56) = -0.028; (*t)(2,56) = 0.002;
1348 (*t)(0,57) = 4.700; (*t)(2,57) = -0.028; (*t)(2,57) = 0.000;
1349 (*t)(0,58) = 4.800; (*t)(2,58) = -0.028; (*t)(2,58) = 0.002;
1350 (*t)(0,59) = 4.900; (*t)(2,59) = 0.000; (*t)(2,59) = 0.000;
1351 (*t)(0,60) = 5.900; (*t)(2,60) = 0.000; (*t)(2,60) = 0.000;
1354 if (fParticleID==AliPID::kKaon)
1356 //TOF kaons, 0.9 purity
1357 t = new TMatrixF(3,61);
1358 (*t)(0,0) = 0.000; (*t)(2,0) = 0.000; (*t)(2,0) = 0.000;
1359 (*t)(0,1) = 0.050; (*t)(2,1) = 0.000; (*t)(2,1) = 0.000;
1360 (*t)(0,2) = 0.100; (*t)(2,2) = 0.000; (*t)(2,2) = 0.000;
1361 (*t)(0,3) = 0.150; (*t)(2,3) = 0.000; (*t)(2,3) = 0.000;
1362 (*t)(0,4) = 0.200; (*t)(2,4) = 0.000; (*t)(2,4) = 0.000;
1363 (*t)(0,5) = 0.250; (*t)(2,5) = 0.000; (*t)(2,5) = 0.000;
1364 (*t)(0,6) = 0.300; (*t)(2,6) = 0.000; (*t)(2,6) = 0.000;
1365 (*t)(0,7) = 0.350; (*t)(2,7) = 0.000; (*t)(2,7) = 0.000;
1366 (*t)(0,8) = 0.400; (*t)(2,8) = 0.000; (*t)(2,8) = 0.000;
1367 (*t)(0,9) = 0.450; (*t)(2,9) = 0.000; (*t)(2,9) = 0.000;
1368 (*t)(0,10) = 0.500; (*t)(2,10) = 0.000; (*t)(2,10) = 0.000;
1369 (*t)(0,11) = 0.550; (*t)(2,11) = -0.026; (*t)(2,11) = 0.026;
1370 (*t)(0,12) = 0.600; (*t)(2,12) = -0.026; (*t)(2,12) = 0.026;
1371 (*t)(0,13) = 0.650; (*t)(2,13) = -0.026; (*t)(2,13) = 0.026;
1372 (*t)(0,14) = 0.700; (*t)(2,14) = -0.026; (*t)(2,14) = 0.026;
1373 (*t)(0,15) = 0.750; (*t)(2,15) = -0.026; (*t)(2,15) = 0.026;
1374 (*t)(0,16) = 0.800; (*t)(2,16) = -0.026; (*t)(2,16) = 0.026;
1375 (*t)(0,17) = 0.850; (*t)(2,17) = -0.024; (*t)(2,17) = 0.024;
1376 (*t)(0,18) = 0.900; (*t)(2,18) = -0.024; (*t)(2,18) = 0.024;
1377 (*t)(0,19) = 0.950; (*t)(2,19) = -0.024; (*t)(2,19) = 0.024;
1378 (*t)(0,20) = 1.000; (*t)(2,20) = -0.024; (*t)(2,20) = 0.024;
1379 (*t)(0,21) = 1.100; (*t)(2,21) = -0.024; (*t)(2,21) = 0.024;
1380 (*t)(0,22) = 1.200; (*t)(2,22) = -0.024; (*t)(2,22) = 0.022;
1381 (*t)(0,23) = 1.300; (*t)(2,23) = -0.024; (*t)(2,23) = 0.020;
1382 (*t)(0,24) = 1.400; (*t)(2,24) = -0.026; (*t)(2,24) = 0.016;
1383 (*t)(0,25) = 1.500; (*t)(2,25) = -0.028; (*t)(2,25) = 0.014;
1384 (*t)(0,26) = 1.600; (*t)(2,26) = -0.028; (*t)(2,26) = 0.012;
1385 (*t)(0,27) = 1.700; (*t)(2,27) = -0.028; (*t)(2,27) = 0.010;
1386 (*t)(0,28) = 1.800; (*t)(2,28) = -0.028; (*t)(2,28) = 0.010;
1387 (*t)(0,29) = 1.900; (*t)(2,29) = -0.028; (*t)(2,29) = 0.008;
1388 (*t)(0,30) = 2.000; (*t)(2,30) = -0.028; (*t)(2,30) = 0.006;
1389 (*t)(0,31) = 2.100; (*t)(2,31) = -0.026; (*t)(2,31) = 0.006;
1390 (*t)(0,32) = 2.200; (*t)(2,32) = -0.024; (*t)(2,32) = 0.004;
1391 (*t)(0,33) = 2.300; (*t)(2,33) = -0.020; (*t)(2,33) = 0.002;
1392 (*t)(0,34) = 2.400; (*t)(2,34) = -0.020; (*t)(2,34) = 0.002;
1393 (*t)(0,35) = 2.500; (*t)(2,35) = -0.018; (*t)(2,35) = 0.000;
1394 (*t)(0,36) = 2.600; (*t)(2,36) = -0.016; (*t)(2,36) = 0.000;
1395 (*t)(0,37) = 2.700; (*t)(2,37) = -0.014; (*t)(2,37) = -0.002;
1396 (*t)(0,38) = 2.800; (*t)(2,38) = -0.014; (*t)(2,38) = -0.004;
1397 (*t)(0,39) = 2.900; (*t)(2,39) = -0.012; (*t)(2,39) = -0.004;
1398 (*t)(0,40) = 3.000; (*t)(2,40) = -0.010; (*t)(2,40) = -0.006;
1399 (*t)(0,41) = 3.100; (*t)(2,41) = 0.000; (*t)(2,41) = 0.000;
1400 (*t)(0,42) = 3.200; (*t)(2,42) = 0.000; (*t)(2,42) = 0.000;
1401 (*t)(0,43) = 3.300; (*t)(2,43) = 0.000; (*t)(2,43) = 0.000;
1402 (*t)(0,44) = 3.400; (*t)(2,44) = 0.000; (*t)(2,44) = 0.000;
1403 (*t)(0,45) = 3.500; (*t)(2,45) = 0.000; (*t)(2,45) = 0.000;
1404 (*t)(0,46) = 3.600; (*t)(2,46) = 0.000; (*t)(2,46) = 0.000;
1405 (*t)(0,47) = 3.700; (*t)(2,47) = 0.000; (*t)(2,47) = 0.000;
1406 (*t)(0,48) = 3.800; (*t)(2,48) = 0.000; (*t)(2,48) = 0.000;
1407 (*t)(0,49) = 3.900; (*t)(2,49) = 0.000; (*t)(2,49) = 0.000;
1408 (*t)(0,50) = 4.000; (*t)(2,50) = 0.000; (*t)(2,50) = 0.000;
1409 (*t)(0,51) = 4.100; (*t)(2,51) = 0.000; (*t)(2,51) = 0.000;
1410 (*t)(0,52) = 4.200; (*t)(2,52) = 0.000; (*t)(2,52) = 0.000;
1411 (*t)(0,53) = 4.300; (*t)(2,53) = 0.000; (*t)(2,53) = 0.000;
1412 (*t)(0,54) = 4.400; (*t)(2,54) = 0.000; (*t)(2,54) = 0.000;
1413 (*t)(0,55) = 4.500; (*t)(2,55) = 0.000; (*t)(2,55) = 0.000;
1414 (*t)(0,56) = 4.600; (*t)(2,56) = 0.000; (*t)(2,56) = 0.000;
1415 (*t)(0,57) = 4.700; (*t)(2,57) = 0.000; (*t)(2,57) = 0.000;
1416 (*t)(0,58) = 4.800; (*t)(2,58) = 0.000; (*t)(2,58) = 0.000;
1417 (*t)(0,59) = 4.900; (*t)(2,59) = 0.000; (*t)(2,59) = 0.000;
1418 (*t)(0,60) = 5.900; (*t)(2,60) = 0.000; (*t)(2,60) = 0.000;
1424 //-----------------------------------------------------------------------
1425 // part added by F. Noferini (some methods)
1426 Bool_t AliFlowTrackCuts::PassesTOFbayesianCut(AliESDtrack* track){
1428 Bool_t goodtrack = track && (track->GetStatus() & AliESDtrack::kTOFpid) && (track->GetTOFsignal() > 12000) && (track->GetTOFsignal() < 100000) && (track->GetIntegratedLength() > 365) && !(track->GetStatus() & AliESDtrack::kTOFmismatch);
1433 Int_t pdg = GetESDPdg(track,"bayesianALL");
1434 // printf("pdg set to %i\n",pdg);
1438 switch (fParticleID)
1442 prob = fProbBayes[2];
1446 prob = fProbBayes[3];
1448 case AliPID::kProton:
1450 prob = fProbBayes[4];
1452 case AliPID::kElectron:
1454 prob = fProbBayes[0];
1460 // printf("pt = %f -- all prob = [%4.2f,%4.2f,%4.2f,%4.2f,%4.2f] -- prob = %f\n",track->Pt(),fProbBayes[0],fProbBayes[1],fProbBayes[2],fProbBayes[3],fProbBayes[4],prob);
1461 if(TMath::Abs(pdg) == TMath::Abs(pid) && prob > 0.8){
1464 else if (fCutCharge && fCharge * track->GetSign() > 0)
1469 //-----------------------------------------------------------------------
1470 Int_t AliFlowTrackCuts::GetESDPdg(AliESDtrack *track,Option_t *option,Int_t ipart,Float_t cPi,Float_t cKa,Float_t cPr){
1472 Int_t pdgvalues[5] = {-11,-13,211,321,2212};
1473 Float_t mass[5] = {5.10998909999999971e-04,1.05658000000000002e-01,1.39570000000000000e-01,4.93676999999999977e-01,9.38271999999999995e-01};
1475 if(strstr(option,"bayesianTOF")){ // Bayesian TOF PID
1476 Double_t c[5]={0.01, 0.01, 0.85, 0.1, 0.05};
1479 Float_t pt = track->Pt();
1482 while(pt > fBinLimitPID[iptesd] && iptesd < fnPIDptBin-1) iptesd++;
1485 c[0] = fC[iptesd][0];
1486 c[1] = fC[iptesd][1];
1487 c[2] = fC[iptesd][2];
1488 c[3] = fC[iptesd][3];
1489 c[4] = fC[iptesd][4];
1499 Double_t r1[10]; track->GetTOFpid(r1);
1502 for (i=0; i<5; i++) rcc+=(c[i]*r1[i]);
1505 for (i=0; i<5; i++){
1506 w[i]=c[i]*r1[i]/rcc;
1507 fProbBayes[i] = w[i];
1509 if (w[2]>=w[3] && w[2]>=w[4] && w[2]>=w[1] && w[2]>=w[0]) {//pion
1510 pdg = 211*Int_t(track->GetSign());
1512 else if (w[4]>=w[3] && w[4]>=w[1] && w[4]>=w[0]) {//proton
1513 pdg = 2212*Int_t(track->GetSign());
1515 else if (w[3]>=w[1] && w[3]>=w[0]){//kaon
1516 pdg = 321*Int_t(track->GetSign());
1518 else if (w[0]>=w[1]) { //electrons
1519 pdg = -11*Int_t(track->GetSign());
1522 pdg = -13*Int_t(track->GetSign());
1526 else if(strstr(option,"bayesianTPC")){ // Bayesian TPC PID
1527 Double_t c[5]={0.01, 0.01, 0.85, 0.1, 0.05};
1530 Float_t pt = track->Pt();
1533 while(pt > fBinLimitPID[iptesd] && iptesd < fnPIDptBin-1) iptesd++;
1536 c[0] = fC[iptesd][0];
1537 c[1] = fC[iptesd][1];
1538 c[2] = fC[iptesd][2];
1539 c[3] = fC[iptesd][3];
1540 c[4] = fC[iptesd][4];
1550 Double_t r1[10]; track->GetTPCpid(r1);
1553 for (i=0; i<5; i++) rcc+=(c[i]*r1[i]);
1556 for (i=0; i<5; i++){
1557 w[i]=c[i]*r1[i]/rcc;
1558 fProbBayes[i] = w[i];
1560 if (w[2]>=w[3] && w[2]>=w[4] && w[2]>=w[1] && w[2]>=w[0]) {//pion
1561 pdg = 211*Int_t(track->GetSign());
1563 else if (w[4]>=w[3] && w[4]>=w[1] && w[4]>=w[0]) {//proton
1564 pdg = 2212*Int_t(track->GetSign());
1566 else if (w[3]>=w[1] && w[3]>=w[0]){//kaon
1567 pdg = 321*Int_t(track->GetSign());
1569 else if (w[0]>=w[1]) { //electrons
1570 pdg = -11*Int_t(track->GetSign());
1573 pdg = -13*Int_t(track->GetSign());
1577 else if(strstr(option,"bayesianALL")){
1578 Double_t c[5]={0.01, 0.01, 0.85, 0.1, 0.05};
1581 Float_t pt = track->Pt();
1584 while(pt > fBinLimitPID[iptesd] && iptesd < fnPIDptBin-1) iptesd++;
1587 c[0] = fC[iptesd][0];
1588 c[1] = fC[iptesd][1];
1589 c[2] = fC[iptesd][2];
1590 c[3] = fC[iptesd][3];
1591 c[4] = fC[iptesd][4];
1601 Double_t r1[10]; track->GetTOFpid(r1);
1602 Double_t r2[10]; track->GetTPCpid(r2);
1605 for (i=0; i<5; i++) rcc+=(c[i]*r1[i]*r2[i]);
1609 for (i=0; i<5; i++){
1610 w[i]=c[i]*r1[i]*r2[i]/rcc;
1611 fProbBayes[i] = w[i];
1614 if (w[2]>=w[3] && w[2]>=w[4] && w[2]>=w[1] && w[2]>=w[0]) {//pion
1615 pdg = 211*Int_t(track->GetSign());
1617 else if (w[4]>=w[3] && w[4]>=w[1] && w[4]>=w[0]) {//proton
1618 pdg = 2212*Int_t(track->GetSign());
1620 else if (w[3]>=w[1] && w[3]>=w[0]){//kaon
1621 pdg = 321*Int_t(track->GetSign());
1623 else if (w[0]>=w[1]) { //electrons
1624 pdg = -11*Int_t(track->GetSign());
1627 pdg = -13*Int_t(track->GetSign());
1631 else if(strstr(option,"sigmacutTOF")){
1632 printf("PID not implemented yet: %s\nNO PID!!!!\n",option);
1633 Float_t p = track->P();
1635 // Take expected times
1636 Double_t exptimes[5];
1637 track->GetIntegratedTimes(exptimes);
1639 // Take resolution for TOF response
1640 // like fESDpid.GetTOFResponse().GetExpectedSigma(p, exptimes[ipart], mass[ipart]);
1641 Float_t resolution = fESDpid.GetTOFResponse().GetExpectedSigma(p, exptimes[ipart], mass[ipart]);
1643 if(TMath::Abs(exptimes[ipart] - track->GetTOFsignal()) < 3 * resolution){
1644 pdg = pdgvalues[ipart] * Int_t(track->GetSign());
1649 printf("Invalid PID option: %s\nNO PID!!!!\n",option);
1654 //-----------------------------------------------------------------------
1655 void AliFlowTrackCuts::SetPriors(){
1657 fBinLimitPID[0] = 0.30;
1662 fC[0][4] = 0.000015;
1663 fBinLimitPID[1] = 0.35;
1669 fBinLimitPID[2] = 0.40;
1675 fBinLimitPID[3] = 0.45;
1681 fBinLimitPID[4] = 0.50;
1684 fC[4][2] = 1.000000;
1687 fBinLimitPID[5] = 0.60;
1693 fBinLimitPID[6] = 0.70;
1699 fBinLimitPID[7] = 0.80;
1705 fBinLimitPID[8] = 0.90;
1711 fBinLimitPID[9] = 1;
1717 fBinLimitPID[10] = 1.20;
1723 fBinLimitPID[11] = 1.40;
1729 fBinLimitPID[12] = 1.60;
1735 fBinLimitPID[13] = 1.80;
1741 fBinLimitPID[14] = 2.00;
1747 fBinLimitPID[15] = 2.20;
1753 fBinLimitPID[16] = 2.40;
1760 for(Int_t i=17;i<fnPIDptBin;i++){
1761 fBinLimitPID[i] = 2.0 + 0.2 * (i-14);
1762 fC[i][0] = fC[13][0];
1763 fC[i][1] = fC[13][1];
1764 fC[i][2] = fC[13][2];
1765 fC[i][3] = fC[13][3];
1766 fC[i][4] = fC[13][4];
1769 // end part added by F. Noferini
1770 //-----------------------------------------------------------------------
1773 //-----------------------------------------------------------------------
1774 const char* AliFlowTrackCuts::PIDsourceName(PIDsource s)
1776 //get the name of the particle id source
1788 return "TOFbayesianPID";
1794 //-----------------------------------------------------------------------
1795 const char* AliFlowTrackCuts::GetParamTypeName(trackParameterType type)
1797 //return the name of the selected parameter type
1803 return "ESD global";
1806 case kESD_SPDtracklet:
1807 return "SPD tracklet";
1815 //-----------------------------------------------------------------------
1816 Bool_t AliFlowTrackCuts::PassesPMDcuts(AliESDPmdTrack* /*track*/ )
1818 //check PMD specific cuts
1819 //clean up from last iteration, and init label
1830 if (fCutEta) {if ( fTrackEta < fEtaMin || fTrackEta >= fEtaMax ) pass = kFALSE;}
1831 if (fCutPhi) {if ( fTrackPhi < fPhiMin || fTrackPhi >= fPhiMax ) pass = kFALSE;}