1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. */
2 /* See cxx source for full Copyright notice */
5 // AliFlowTrackESDCuts:
6 // A cut class for ESD, AOD and MC particles for the flow framework
7 // author: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch)
9 #ifndef ALIFLOWTRACKCUTS_H
10 #define ALIFLOWTRACKCUTS_H
14 #include "AliFlowTrackSimpleCuts.h"
15 #include "AliESDtrackCuts.h"
16 #include "TMCProcess.h"
17 #include "AliESDtrack.h"
19 #include "AliESDpid.h"
27 class AliMultiplicity;
33 class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
37 AliFlowTrackCuts(const char* name);
38 AliFlowTrackCuts(const AliFlowTrackCuts& someCuts);
39 AliFlowTrackCuts& operator=(const AliFlowTrackCuts& someCuts);
40 virtual ~AliFlowTrackCuts();
42 static AliFlowTrackCuts* GetStandardTPCStandaloneTrackCuts();
43 static AliFlowTrackCuts* GetStandardTPCStandaloneTrackCuts2010();
44 static AliFlowTrackCuts* GetStandardGlobalTrackCuts2010();
45 static AliFlowTrackCuts* GetStandardITSTPCTrackCuts2009(Bool_t selPrimaries=kTRUE);
46 static AliFlowTrackCuts* GetStandardVZEROOnlyTrackCuts();
48 Int_t Count(AliVEvent* event=NULL);
50 enum trackParameterType { kMC,
57 enum trackParameterMix { kPure,
61 kTrackWithPtFromFirstMother,
62 kTrackWithTPCInnerParams
65 kTPCpid, // default TPC pid (via GetTPCpid)
66 kTOFpid, // default TOF pid (via GetTOFpid)
67 kTOFbayesian, // TOF bayesian pid (F.Noferini)
68 kTOFbeta, // asymmetric cuts of TOF beta signal
69 kTPCdedx, // asymmetric cuts of TPC dedx signal
70 kTOFbetaSimple, //simple TOF only cut
73 //setters (interface to AliESDtrackCuts)
74 void SetMinNClustersTPC( Int_t a ) {fCutNClustersTPC=kTRUE; fNClustersTPCMin=a;}
75 void SetMinNClustersITS( Int_t a ) {fCutNClustersITS=kTRUE; fNClustersITSMin=a;}
76 void SetClusterRequirementITS( AliESDtrackCuts::Detector det,
77 AliESDtrackCuts::ITSClusterRequirement req = AliESDtrackCuts::kOff )
78 { InitESDcuts(); fAliESDtrackCuts->SetClusterRequirementITS(det,req); }
79 void SetMaxChi2PerClusterTPC( Float_t a ) {fMaxChi2PerClusterTPC=a;fCutChi2PerClusterTPC=kTRUE;}
80 void SetMinChi2PerClusterTPC( Float_t a ) {fMinChi2PerClusterTPC=a;fCutChi2PerClusterTPC=kTRUE;}
81 void SetMaxChi2PerClusterITS( Float_t a ) {InitESDcuts(); fAliESDtrackCuts->SetMaxChi2PerClusterITS(a);}
82 void SetRequireTPCRefit( Bool_t a ) {InitESDcuts(); fAliESDtrackCuts->SetRequireTPCRefit(a);}
83 void SetRequireTPCStandAlone( Bool_t a) {InitESDcuts(); fAliESDtrackCuts->SetRequireTPCStandAlone(a);}
84 void SetRequireITSRefit( Bool_t a ) {InitESDcuts(); fAliESDtrackCuts->SetRequireITSRefit(a);}
85 void SetRequireITSStandAlone( Bool_t a) {InitESDcuts(); fAliESDtrackCuts->SetRequireITSStandAlone(a);}
86 void SetAcceptKinkDaughters( Bool_t a ) {InitESDcuts(); fAliESDtrackCuts->SetAcceptKinkDaughters(a);}
87 void SetMaxDCAToVertexZ( Float_t a ) {InitESDcuts(); fAliESDtrackCuts->SetMaxDCAToVertexZ(a);fCutDCAToVertexZ=kTRUE;}
88 void SetMaxDCAToVertexXY( Float_t a ) {InitESDcuts(); fAliESDtrackCuts->SetMaxDCAToVertexXY(a);fCutDCAToVertexXY=kTRUE;}
89 void SetMaxDCAToVertexXYPtDep( const char* a ) {InitESDcuts(); fAliESDtrackCuts->SetMaxDCAToVertexXYPtDep(a);}
90 void SetRequireSigmaToVertex(Bool_t a) {InitESDcuts(); fAliESDtrackCuts->SetRequireSigmaToVertex(a);}
91 void SetMaxNsigmaToVertex(Float_t sigma=1e10) {InitESDcuts(); fAliESDtrackCuts->SetMaxNsigmaToVertex(sigma); }
92 void SetDCAToVertex2D( Bool_t a ) {InitESDcuts(); fAliESDtrackCuts->SetDCAToVertex2D(a);}
93 void SetEtaRange( Float_t r1, Float_t r2 ) { SetEtaMin(r1); SetEtaMax(r2); }
94 void SetPtRange( Float_t r1, Float_t r2 ) { SetPtMin(r1); SetPtMax(r2); }
95 void SetRequireCharge( Bool_t r ) {fRequireCharge=r;}
96 void SetFakesAreOK( Bool_t b ) {fFakesAreOK=b;}
97 void SetSPDtrackletDeltaPhiMax( Double_t m ) {fSPDtrackletDeltaPhiMax=m; fCutSPDtrackletDeltaPhi=kTRUE;}
98 void SetSPDtrackletDeltaPhiMin( Double_t m ) {fSPDtrackletDeltaPhiMin=m; fCutSPDtrackletDeltaPhi=kTRUE;}
99 void SetIgnoreTPCzRange( Double_t min, Double_t max )
100 { fIgnoreTPCzRange=kTRUE; fIgnoreTPCzRangeMin=min; fIgnoreTPCzRangeMax=max; }
101 void SetAODfilterBit( UInt_t a ) {fAODFilterBit = a; fUseAODFilterBit = kTRUE;}
102 void SetMinimalTPCdedx(Double_t d=10.) {fMinimalTPCdedx=d; fCutMinimalTPCdedx=kTRUE;}
103 void SetPmdDetPlane(Int_t pmdDet){fCutPmdDet=kTRUE; fPmdDet = pmdDet; }
104 void SetPmdAdc(Float_t pmdAdc){fCutPmdAdc=kTRUE; fPmdAdc = pmdAdc; }
105 void SetPmdNcell(Float_t pmdNcell) {fCutPmdNcell=kTRUE; fPmdNcell = pmdNcell; }
106 void SetPriors(Float_t centr = 0); // set my favourite priors for Bayesian PID
108 Int_t GetMinNClustersTPC() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMinNClusterTPC();}
109 Int_t GetMinNClustersITS() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMinNClustersITS();}
110 AliESDtrackCuts::ITSClusterRequirement GetClusterRequirementITS( AliESDtrackCuts::Detector det ) const
111 {if (!fAliESDtrackCuts) return AliESDtrackCuts::kOff; return fAliESDtrackCuts->GetClusterRequirementITS(det); }
112 Float_t GetMaxChi2PerClusterTPC() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMaxChi2PerClusterTPC();}
113 Float_t GetMaxChi2PerClusterITS() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMaxChi2PerClusterITS();}
114 Bool_t GetRequireTPCRefit() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetRequireTPCRefit();}
115 Bool_t GetRequireTPCStandAlone() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetRequireTPCStandAlone();}
116 Bool_t GetRequireITSRefit() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetRequireITSRefit();}
117 Bool_t GetRequireITSStandAlone() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetRequireITSStandAlone();}
118 Bool_t GetAcceptKinkDaughters() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetAcceptKinkDaughters();}
119 Float_t GetMaxDCAToVertexZ() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMaxDCAToVertexZ();}
120 Float_t GetMaxDCAToVertexXY() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMaxDCAToVertexXY();}
121 const char* GetMaxDCAToVertexXYPtDep() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMaxDCAToVertexXYPtDep();}
122 Bool_t GetRequireSigmaToVertex() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetRequireSigmaToVertex();}
123 Float_t GetMaxNsigmaToVertex() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMaxNsigmaToVertex(); }
124 Bool_t GetDCAToVertex2D() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetDCAToVertex2D();}
125 void GetEtaRange( Float_t& r1, Float_t& r2 ) const { r1=GetEtaMin(); r2=GetEtaMax(); }
126 void GetPtRange( Float_t& r1, Float_t& r2 ) const { r1=GetPtMin(); r2=GetPtMax(); }
127 Bool_t GetRequireCharge() const {return fRequireCharge;}
128 Bool_t GetFakesAreOK() const {return fFakesAreOK;}
129 Double_t GetSPDtrackletDeltaPhiMax() const {return fSPDtrackletDeltaPhiMax;}
130 Double_t GetSPDtrackletDeltaPhiMin() const {return fSPDtrackletDeltaPhiMin;}
131 UInt_t GetAODFilterBit() const {if (!fUseAODFilterBit) return 0; return fAODFilterBit;}
132 Double_t GetMinimalTPCdedx() const {return fMinimalTPCdedx;}
133 Int_t GetPmdDetPlane()const {return fPmdDet; }
134 Float_t GetPmdAdc()const {return fPmdAdc;}
135 Float_t GetPmdNcell() const {return fPmdNcell; }
136 Float_t GetBeta(const AliESDtrack* t);
137 Float_t Getdedx(const AliESDtrack* t);
139 void SetQA(Bool_t b=kTRUE) {if (b) DefineHistograms();}
140 TList* GetQA() const {return fQA;}
141 TH1* QAbefore(Int_t i) {return static_cast<TH1*>(static_cast<TList*>(fQA->At(0))->At(i));}
142 TH1* QAafter(Int_t i) {return static_cast<TH1*>(static_cast<TList*>(fQA->At(1))->At(i));}
145 void SetIgnoreSignInMCPID( Bool_t b ) {fIgnoreSignInMCPID=b;}
146 void SetCutMC( Bool_t b=kTRUE );
147 void SetCutMChasTrackReferences(Bool_t b=kTRUE) {fCutMChasTrackReferences=b;}
148 void SetMCprocessType( TMCProcess t ) { fMCprocessType = t; fCutMCprocessType=kTRUE; SetCutMC();}
149 void SetMCisPrimary( Bool_t b ) { fMCisPrimary=b; fCutMCisPrimary=kTRUE; SetCutMC();}
150 void SetMCPID( Int_t pid ) { fMCPID=pid; fCutMCPID=kTRUE; SetCutMC(); }
151 TMCProcess GetMCprocessType() const { return fMCprocessType; }
152 Bool_t GetMCisPrimary() const {return fMCisPrimary;}
153 Int_t GetMCPID() const {return fMCPID;}
154 void SetRequireTransportBitForPrimaries(Bool_t b) {fRequireTransportBitForPrimaries=b; SetCutMC();}
156 void SetParamType(trackParameterType paramType) {fParamType=paramType;}
157 trackParameterType GetParamType() const {return fParamType;}
158 static const char* GetParamTypeName(trackParameterType type);
159 void SetParamMix(trackParameterMix paramMix) {fParamMix=paramMix;}
160 trackParameterMix GetParamMix() const {return fParamMix;}
162 virtual Bool_t IsSelected(TObject* obj, Int_t id=-666);
163 virtual Bool_t IsSelectedMCtruth(TObject* obj, Int_t id=-666);
164 AliVParticle* GetTrack() const {return fTrack;}
165 AliMCParticle* GetMCparticle() const {return fMCparticle;}
166 AliFlowTrack* MakeFlowTrack() const;
167 Bool_t FillFlowTrack(AliFlowTrack* track) const;
168 Bool_t IsPhysicalPrimary() const;
169 static Bool_t IsPhysicalPrimary(AliMCEvent* p, Int_t label, Bool_t requiretransported=kTRUE);
171 void SetMCevent(AliMCEvent* mcEvent) {fMCevent=mcEvent;}
172 AliMCEvent* GetMCevent() const {return fMCevent;}
173 void SetEvent(AliVEvent* event, AliMCEvent* mcEvent=NULL);
174 AliVEvent* GetEvent() const {return fEvent;}
175 Int_t GetNumberOfInputObjects() const;
176 TObject* GetInputObject(Int_t i);
177 void Clear(Option_t* option="");
179 Double_t GetPmdEta(Float_t xPos, Float_t yPos, Float_t zPos);
180 Double_t GetPmdPhi(Float_t xPos, Float_t yPos);
183 void SetPID(AliPID::EParticleType pid, PIDsource s=kTOFpid, Double_t prob=0.9)
184 {fParticleID=pid; fPIDsource=s; fParticleProbability=prob; fCutPID=kTRUE; InitPIDcuts();}
185 void SetTPCpidCuts(TMatrixF* mat) {fTPCpidCuts=new TMatrixF(*mat);}
186 void SetTOFpidCuts(TMatrixF* mat) {fTOFpidCuts=new TMatrixF(*mat);}
187 static const char* PIDsourceName(PIDsource s);
188 AliESDpid& GetESDpid() {return fESDpid;}
189 void SetAllowTOFmismatchFlag(Bool_t b=kTRUE) {fAllowTOFmismatchFlag=b;}
190 Bool_t GetAllowTOFmismatchFlag() const {return fAllowTOFmismatchFlag;}
191 void SetRequireStrictTOFTPCagreement(Bool_t b=kTRUE) {fRequireStrictTOFTPCagreement=b;}
192 Bool_t GetRequireStrictTOFTPCagreement() const {return fRequireStrictTOFTPCagreement;}
193 void SetRejectElectronsWithTPCpid(Bool_t b=kTRUE) {fCutRejectElectronsWithTPCpid=b;}
195 //these should maybe be protected
196 Bool_t PassesCuts(AliVParticle* track);
197 Bool_t PassesESDcuts(AliESDtrack* track);
198 Bool_t PassesAODcuts(const AliAODTrack* track);
199 Bool_t PassesPMDcuts(AliESDPmdTrack* track);
200 Bool_t PassesV0cuts(AliESDVZERO* track, Int_t id);
201 Bool_t PassesCuts(const AliFlowTrackSimple* track);
202 Bool_t PassesCuts(const AliMultiplicity* track, Int_t id);
203 Bool_t PassesMCcuts();
204 Bool_t PassesMCcuts(AliMCEvent* mcevent, Int_t label);
205 Bool_t PassesTPCdedxCut(const AliESDtrack* track);
206 Bool_t PassesTPCpidCut(const AliESDtrack* track) const;
207 Bool_t PassesTOFbetaCut(const AliESDtrack* track);
208 Bool_t PassesTOFbetaSimpleCut(const AliESDtrack* track);
209 Bool_t PassesTOFpidCut(const AliESDtrack* track) const;
211 void Browse(TBrowser* b);
212 Long64_t Merge(TCollection* list);
215 AliFlowTrack* MakeFlowTrackSPDtracklet() const;
216 AliFlowTrack* MakeFlowTrackPMDtrack() const;
217 AliFlowTrack* MakeFlowTrackV0() const;
218 AliFlowTrack* MakeFlowTrackVParticle() const;
219 Bool_t FillFlowTrackVParticle(AliFlowTrack* t) const;
220 Bool_t FillFlowTrackGeneric(AliFlowTrack* t) const;
221 void HandleESDtrack(AliESDtrack* track);
222 void HandleVParticle(AliVParticle* track);
223 void DefineHistograms();
225 void InitESDcuts() {if (!fAliESDtrackCuts) {fAliESDtrackCuts=new AliESDtrackCuts();}}
226 // part added by F. Noferini
227 Bool_t PassesTOFbayesianCut(AliESDtrack* track);
228 Int_t GetESDPdg(AliESDtrack *track,Option_t *option="bayesianTOF",Int_t ipart=2,Float_t cPi=-1.0,Float_t cKa=0.0,Float_t cPr=0.0); // 3sigma cut ipart=0(el),1(mu),2(pi),3(K),4(p)
229 Bool_t TPCTOFagree(const AliESDtrack *track);
230 // end part added by F. Noferini
233 AliESDtrackCuts* fAliESDtrackCuts; //alianalysis cuts
234 TList* fQA; //qa histograms go here
235 Bool_t fCutMC; //do we cut on MC?
236 Bool_t fCutMChasTrackReferences; //did we leave a trace in the detector?
237 Bool_t fCutMCprocessType; //do we cut on mc process type?
238 TMCProcess fMCprocessType; //mc process type
239 Bool_t fCutMCPID; //cut on MC pid?
240 Int_t fMCPID; //MC PID
241 Bool_t fIgnoreSignInMCPID; //when MC PID cut is set, pass also the antiparticle
242 Bool_t fCutMCisPrimary; //do we cut on primaryness?
243 Bool_t fRequireTransportBitForPrimaries; //require the transport bit to be set for primaries
244 Bool_t fMCisPrimary; //is MC primary
245 Bool_t fRequireCharge; //is charged?
246 Bool_t fFakesAreOK; //are fakes (negative labels) ok?
247 Bool_t fCutSPDtrackletDeltaPhi; //are we cutting on the trcklet deltaphi?
248 Double_t fSPDtrackletDeltaPhiMax; //maximal deltaphi for tracklets
249 Double_t fSPDtrackletDeltaPhiMin; //minimal deltaphi for tracklets
250 Bool_t fIgnoreTPCzRange; //ignore tracks going close to central membrane
251 Double_t fIgnoreTPCzRangeMax; //max z to ignore
252 Double_t fIgnoreTPCzRangeMin; //min z to ignore
253 Bool_t fCutChi2PerClusterTPC; //cut on tpc chi2
254 Float_t fMaxChi2PerClusterTPC; //max chi2 tpc/cluster
255 Float_t fMinChi2PerClusterTPC; //min chi2 tpc/cluster
256 Bool_t fCutNClustersTPC; //cut on clusters?
257 Int_t fNClustersTPCMax; //max tpc ncls
258 Int_t fNClustersTPCMin; //min tpc clusters
259 Bool_t fCutNClustersITS; //cut on clusters?
260 Int_t fNClustersITSMax; //max tpc ncls
261 Int_t fNClustersITSMin; //min tpc clusters
262 Bool_t fUseAODFilterBit; //use AOD filter bit selection?
263 UInt_t fAODFilterBit; //AOD filter bit to select
264 Bool_t fCutDCAToVertexXY; //dca xy cut
265 Bool_t fCutDCAToVertexZ; //dca z cut
266 Bool_t fCutMinimalTPCdedx; //cut on minimal dedx in TPC to reject noise tracks
267 Double_t fMinimalTPCdedx; //value for minimal TPC dedx
269 Bool_t fCutPmdDet; //cut on PMD detector plane
270 Int_t fPmdDet; // value of PMD detector plane
271 Bool_t fCutPmdAdc; //cut on cluster ADC
272 Float_t fPmdAdc; //value of cluster ADC
273 Bool_t fCutPmdNcell; //cut on cluster ncell
274 Float_t fPmdNcell; //value of cluster ncell
276 trackParameterType fParamType; //parameter type tu cut on
277 trackParameterMix fParamMix; //parameter mixing
278 AliVParticle* fTrack; //!the track to apply cuts on
279 Double_t fTrackPhi; //!track phi
280 Double_t fTrackEta; //!track eta
281 Double_t fTrackWeight; //!track weight
282 Int_t fTrackLabel; //!track label, or its absolute value if FakesAreOK
283 AliMCEvent* fMCevent; //!mc event
284 AliMCParticle* fMCparticle; //!mc particle
285 AliVEvent* fEvent; //!placeholder for current event
286 AliESDtrack fTPCtrack; //!placeholder for TPC only track to avoid new/delete on every track
289 AliESDpid fESDpid; //pid obj
290 PIDsource fPIDsource; //pid source
291 TMatrixF* fTPCpidCuts; //tpc pid cuts
292 TMatrixF* fTOFpidCuts; //tof pid cuts
293 AliPID::EParticleType fParticleID; //alipid
294 Double_t fParticleProbability; //desired prob for a particle type
295 Bool_t fAllowTOFmismatchFlag; //allow TOFmismatch flag=1 in ESD
296 Bool_t fRequireStrictTOFTPCagreement; //require stricter than TOFmismatch flag TOF-TPC agreement
297 Bool_t fCutRejectElectronsWithTPCpid; //reject electrons with TPC pid
299 // part added by F. Noferini
300 static const Int_t fgkPIDptBin = 20; // pT bins for priors
301 Float_t fC[fgkPIDptBin][5],fBinLimitPID[fgkPIDptBin]; // pt bin limit and priors
302 Float_t fProbBayes[5]; // bayesian probability
303 // end part added by F. Noferini
305 static const Int_t fgkNumberOfV0tracks=64; //number of V0 channels
307 ClassDef(AliFlowTrackCuts,8)