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