hooks for PMD flow analysis
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowTasks / AliFlowTrackCuts.h
CommitLineData
daf66719 1/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. */
2/* See cxx source for full Copyright notice */
3/* $Id$ */
4
5// AliFlowTrackESDCuts:
6// A cut class for ESD, AOD and MC particles for the flow framework
7// author: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch)
8
9#ifndef ALIFLOWTRACKCUTS_H
10#define ALIFLOWTRACKCUTS_H
11
32b846cd 12#include <TMatrix.h>
daf66719 13#include "AliFlowTrackSimpleCuts.h"
14#include "AliESDtrackCuts.h"
15#include "TMCProcess.h"
1ff4bda1 16#include "AliESDtrack.h"
32b846cd 17#include "AliPID.h"
aab6527a 18#include "AliESDpid.h"
daf66719 19
2948ac5a 20class TObjArray;
daf66719 21class AliVParticle;
22class AliMCParticle;
23class AliFlowTrack;
24class AliMCEvent;
25class AliVEvent;
12b2b8bc 26class AliMultiplicity;
42655d16 27class AliAODTrack;
28class AliESDtrack;
d148af7e 29class AliESDPmdTrack;
daf66719 30
31class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
32
33 public:
34 AliFlowTrackCuts();
441ea1cf 35 AliFlowTrackCuts(const char* name);
daf66719 36 AliFlowTrackCuts(const AliFlowTrackCuts& someCuts);
37 AliFlowTrackCuts& operator=(const AliFlowTrackCuts& someCuts);
38 virtual ~AliFlowTrackCuts();
39
40 static AliFlowTrackCuts* GetStandardTPCOnlyTrackCuts();
a0241c3a 41 static AliFlowTrackCuts* GetStandardTPCOnlyTrackCuts2010();
42 static AliFlowTrackCuts* GetStandardGlobalTrackCuts2010();
daf66719 43 static AliFlowTrackCuts* GetStandardITSTPCTrackCuts2009(Bool_t selPrimaries=kTRUE);
44
a0241c3a 45 Int_t Count(AliVEvent* event=NULL);
46
2b1eaa10 47 enum trackParameterType { kMC,
48 kGlobal,
49 kESD_TPConly,
d148af7e 50 kESD_SPDtracklet,
51 kPMD
2b1eaa10 52 };
53 enum trackParameterMix { kPure,
54 kTrackWithMCkine,
55 kTrackWithMCPID,
56 kTrackWithMCpt,
57 kTrackWithPtFromFirstMother
58 };
59 enum PIDsource {
60 kTPCpid, // default TPC pid (via GetTPCpid)
61 kTOFpid, // default TOF pid (via GetTOFpid)
62 kTOFbayesian, // TOF bayesian pid (F.Noferini)
63 kTOFbeta, // asymmetric cuts of TOF beta signal
64 kTPCdedx // asymmetric cuts of TPC dedx signal
65 };
daf66719 66
67 //setters (interface to AliESDtrackCuts)
42655d16 68 void SetMinNClustersTPC( Int_t a ) {fCutNClustersTPC=kTRUE; fNClustersTPCMin=a;}
69 void SetMinNClustersITS( Int_t a ) {fCutNClustersITS=kTRUE; fNClustersITSMin=a;}
daf66719 70 void SetClusterRequirementITS( AliESDtrackCuts::Detector det,
71 AliESDtrackCuts::ITSClusterRequirement req = AliESDtrackCuts::kOff )
441ea1cf 72 { InitESDcuts(); fAliESDtrackCuts->SetClusterRequirementITS(det,req); }
2948ac5a 73 void SetMaxChi2PerClusterTPC( Float_t a ) {fMaxChi2PerClusterTPC=a;fCutChi2PerClusterTPC=kTRUE;}
74 void SetMinChi2PerClusterTPC( Float_t a ) {fMinChi2PerClusterTPC=a;fCutChi2PerClusterTPC=kTRUE;}
441ea1cf 75 void SetMaxChi2PerClusterITS( Float_t a ) {InitESDcuts(); fAliESDtrackCuts->SetMaxChi2PerClusterITS(a);}
76 void SetRequireTPCRefit( Bool_t a ) {InitESDcuts(); fAliESDtrackCuts->SetRequireTPCRefit(a);}
77 void SetRequireTPCStandAlone( Bool_t a) {InitESDcuts(); fAliESDtrackCuts->SetRequireTPCStandAlone(a);}
78 void SetRequireITSRefit( Bool_t a ) {InitESDcuts(); fAliESDtrackCuts->SetRequireITSRefit(a);}
79 void SetRequireITSStandAlone( Bool_t a) {InitESDcuts(); fAliESDtrackCuts->SetRequireITSStandAlone(a);}
80 void SetAcceptKinkDaughters( Bool_t a ) {InitESDcuts(); fAliESDtrackCuts->SetAcceptKinkDaughters(a);}
a63303bd 81 void SetMaxDCAToVertexZ( Float_t a ) {InitESDcuts(); fAliESDtrackCuts->SetMaxDCAToVertexZ(a);fCutDCAToVertexZ=kTRUE;}
82 void SetMaxDCAToVertexXY( Float_t a ) {InitESDcuts(); fAliESDtrackCuts->SetMaxDCAToVertexXY(a);fCutDCAToVertexXY=kTRUE;}
441ea1cf 83 void SetMaxDCAToVertexXYPtDep( const char* a ) {InitESDcuts(); fAliESDtrackCuts->SetMaxDCAToVertexXYPtDep(a);}
84 void SetRequireSigmaToVertex(Bool_t a) {InitESDcuts(); fAliESDtrackCuts->SetRequireSigmaToVertex(a);}
85 void SetMaxNsigmaToVertex(Float_t sigma=1e10) {InitESDcuts(); fAliESDtrackCuts->SetMaxNsigmaToVertex(sigma); }
86 void SetDCAToVertex2D( Bool_t a ) {InitESDcuts(); fAliESDtrackCuts->SetDCAToVertex2D(a);}
daf66719 87 void SetEtaRange( Float_t r1, Float_t r2 ) { SetEtaMin(r1); SetEtaMax(r2); }
88 void SetPtRange( Float_t r1, Float_t r2 ) { SetPtMin(r1); SetPtMax(r2); }
127a5825 89 void SetRequireCharge( Bool_t r ) {fRequireCharge=r;}
90 void SetFakesAreOK( Bool_t b ) {fFakesAreOK=b;}
9a0783cc 91 void SetSPDtrackletDeltaPhiMax( Double_t m ) {fSPDtrackletDeltaPhiMax=m; fCutSPDtrackletDeltaPhi=kTRUE;}
92 void SetSPDtrackletDeltaPhiMin( Double_t m ) {fSPDtrackletDeltaPhiMin=m; fCutSPDtrackletDeltaPhi=kTRUE;}
1ff4bda1 93 void SetIgnoreSignInPID( Bool_t b ) {fIgnoreSignInPID=b;}
94 void SetIgnoreTPCzRange( Double_t min, Double_t max )
5ba02b32 95 { fIgnoreTPCzRange=kTRUE; fIgnoreTPCzRangeMin=min; fIgnoreTPCzRangeMax=max; }
96 void SetAODfilterBit( UInt_t a ) {fAODFilterBit = a; fUseAODFilterBit = kTRUE;}
2b1eaa10 97 void SetMinimalTPCdedx(Double_t d=10.) {fMinimalTPCdedx=d; fCutMinimalTPCdedx=kTRUE;}
5ba02b32 98
daf66719 99
441ea1cf 100 Int_t GetMinNClustersTPC() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMinNClusterTPC();}
101 Int_t GetMinNClustersITS() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMinNClustersITS();}
daf66719 102 AliESDtrackCuts::ITSClusterRequirement GetClusterRequirementITS( AliESDtrackCuts::Detector det ) const
441ea1cf 103 {if (!fAliESDtrackCuts) return AliESDtrackCuts::kOff; return fAliESDtrackCuts->GetClusterRequirementITS(det); }
104 Float_t GetMaxChi2PerClusterTPC() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMaxChi2PerClusterTPC();}
105 Float_t GetMaxChi2PerClusterITS() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMaxChi2PerClusterITS();}
106 Bool_t GetRequireTPCRefit() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetRequireTPCRefit();}
107 Bool_t GetRequireTPCStandAlone() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetRequireTPCStandAlone();}
108 Bool_t GetRequireITSRefit() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetRequireITSRefit();}
109 Bool_t GetRequireITSStandAlone() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetRequireITSStandAlone();}
110 Bool_t GetAcceptKinkDaughters() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetAcceptKinkDaughters();}
111 Float_t GetMaxDCAToVertexZ() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMaxDCAToVertexZ();}
112 Float_t GetMaxDCAToVertexXY() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMaxDCAToVertexXY();}
113 const char* GetMaxDCAToVertexXYPtDep() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMaxDCAToVertexXYPtDep();}
114 Bool_t GetRequireSigmaToVertex() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetRequireSigmaToVertex();}
115 Float_t GetMaxNsigmaToVertex() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetMaxNsigmaToVertex(); }
116 Bool_t GetDCAToVertex2D() const {if (!fAliESDtrackCuts) return 0; return fAliESDtrackCuts->GetDCAToVertex2D();}
daf66719 117 void GetEtaRange( Float_t& r1, Float_t& r2 ) const { r1=GetEtaMin(); r2=GetEtaMax(); }
118 void GetPtRange( Float_t& r1, Float_t& r2 ) const { r1=GetPtMin(); r2=GetPtMax(); }
957517fa 119 Bool_t GetRequireCharge() const {return fRequireCharge;}
9a0783cc 120 Bool_t GetFakesAreOK() const {return fFakesAreOK;}
121 Double_t GetSPDtrackletDeltaPhiMax() const {return fSPDtrackletDeltaPhiMax;}
122 Double_t GetSPDtrackletDeltaPhiMin() const {return fSPDtrackletDeltaPhiMin;}
5ba02b32 123 UInt_t GetAODFilterBit() const {if (!fUseAODFilterBit) return 0; return fAODFilterBit;}
2b1eaa10 124 Double_t GetMinimalTPCdedx() const {return fMinimalTPCdedx;}
5ba02b32 125
924b02b0 126 void SetQA(const char* dirname);
2948ac5a 127 TObjArray* GetQA() const {return fQA;}
924b02b0 128
daf66719 129 //MC stuff
aab6527a 130 void SetCutMC( Bool_t b=kTRUE );
131 void SetMCprocessType( TMCProcess t ) { fMCprocessType = t; fCutMCprocessType=kTRUE; SetCutMC();}
132 void SetMCisPrimary( Bool_t b ) { fMCisPrimary=b; fCutMCisPrimary=kTRUE; SetCutMC();}
133 void SetMCPID( Int_t pid ) { fMCPID=pid; fCutMCPID=kTRUE; SetCutMC(); }
daf66719 134 TMCProcess GetMCprocessType() const { return fMCprocessType; }
daf66719 135 Bool_t GetMCisPrimary() const {return fMCisPrimary;}
1ff4bda1 136 Int_t GetMCPID() const {return fMCPID;}
daf66719 137
138 void SetParamType(trackParameterType paramType) {fParamType=paramType;}
139 trackParameterType GetParamType() const {return fParamType;}
12b2b8bc 140 static const char* GetParamTypeName(trackParameterType type);
daf66719 141 void SetParamMix(trackParameterMix paramMix) {fParamMix=paramMix;}
142 trackParameterMix GetParamMix() const {return fParamMix;}
143
9a0783cc 144 virtual Bool_t IsSelected(TObject* obj, Int_t id=-666);
1ff4bda1 145 virtual Bool_t IsSelectedMCtruth(TObject* obj, Int_t id=-666);
127a5825 146 AliVParticle* GetTrack() const {return fTrack;}
147 AliMCParticle* GetMCparticle() const {return fMCparticle;}
41dc4195 148 AliFlowTrack* MakeFlowTrack() const;
127a5825 149 Bool_t IsPhysicalPrimary() const;
441ea1cf 150 static Bool_t IsPhysicalPrimary(AliMCEvent* p, Int_t label, Bool_t requiretransported=kTRUE);
daf66719 151
152 void SetMCevent(AliMCEvent* mcEvent) {fMCevent=mcEvent;}
153 AliMCEvent* GetMCevent() const {return fMCevent;}
aab6527a 154 void SetEvent(AliVEvent* event, AliMCEvent* mcEvent=NULL);
9a0783cc 155 AliVEvent* GetEvent() const {return fEvent;}
156 Int_t GetNumberOfInputObjects() const;
157 TObject* GetInputObject(Int_t i);
a1c43d26 158 void Clear(Option_t* option="");
daf66719 159
32b846cd 160 //PID
2b1eaa10 161 void SetPID(AliPID::EParticleType pid, PIDsource s=kTOFpid, Double_t prob=0.9)
162 {fParticleID=pid; fPIDsource=s; fParticleProbability=prob; fCutPID=kTRUE; InitPIDcuts();}
32b846cd 163 void SetTPCpidCuts(TMatrixF* mat) {fTPCpidCuts=new TMatrixF(*mat);}
164 void SetTOFpidCuts(TMatrixF* mat) {fTOFpidCuts=new TMatrixF(*mat);}
2b1eaa10 165 static const char* PIDsourceName(PIDsource s);
aab6527a 166 AliESDpid& GetESDpid() {return fESDpid;}
32b846cd 167
daf66719 168 protected:
169 Bool_t PassesCuts(AliVParticle* track);
42655d16 170 Bool_t PassesESDcuts(AliESDtrack* track);
171 Bool_t PassesAODcuts(AliAODTrack* track);
d148af7e 172 Bool_t PassesPMDcuts(AliESDPmdTrack* track);
daf66719 173 Bool_t PassesCuts(AliFlowTrackSimple* track);
12b2b8bc 174 Bool_t PassesCuts(AliMultiplicity* track, Int_t id);
175 Bool_t PassesMCcuts();
1ff4bda1 176 Bool_t PassesMCcuts(AliMCEvent* mcevent, Int_t label);
2b1eaa10 177 Bool_t PassesTPCdedxCut(AliESDtrack* track);
32b846cd 178 Bool_t PassesTPCpidCut(AliESDtrack* track);
2b1eaa10 179 Bool_t PassesTOFbetaCut(AliESDtrack* track);
32b846cd 180 Bool_t PassesTOFpidCut(AliESDtrack* track);
d148af7e 181 AliFlowTrack* MakeFlowTrackSPDtracklet() const;
182 AliFlowTrack* MakeFlowTrackPMDtrack() const;
183 AliFlowTrack* MakeFlowTrackVParticle() const;
daf66719 184 void HandleESDtrack(AliESDtrack* track);
185 void HandleVParticle(AliVParticle* track);
924b02b0 186 void DefineHistograms();
32b846cd 187 void InitPIDcuts();
441ea1cf 188 void InitESDcuts() {if (!fAliESDtrackCuts) fAliESDtrackCuts=new AliESDtrackCuts();}
3abf7ecc 189 // part added by F. Noferini
190 Bool_t PassesTOFbayesianCut(AliESDtrack* track);
191 void SetPriors(); // set my favourite priors
192 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)
193 // end part added by F. Noferini
daf66719 194
9a0783cc 195 //the cuts
daf66719 196 AliESDtrackCuts* fAliESDtrackCuts; //alianalysis cuts
2948ac5a 197 TObjArray* fQA; //qa histograms go here
1ff4bda1 198 Bool_t fCutMC; //do we cut on MC?
daf66719 199 Bool_t fCutMCprocessType; //do we cut on mc process type?
200 TMCProcess fMCprocessType; //mc process type
201 Bool_t fCutMCPID; //cut on MC pid?
202 Int_t fMCPID; //MC PID
4cbcbead 203 Bool_t fIgnoreSignInPID; //when PID cut is set, pass also the antiparticle
daf66719 204 Bool_t fCutMCisPrimary; //do we cut on primaryness?
441ea1cf 205 Bool_t fRequireTransportBitForPrimaries; //require the transport bit to be set for primaries
daf66719 206 Bool_t fMCisPrimary; //is MC primary
127a5825 207 Bool_t fRequireCharge; //is charged?
208 Bool_t fFakesAreOK; //are fakes (negative labels) ok?
9a0783cc 209 Bool_t fCutSPDtrackletDeltaPhi; //are we cutting on the trcklet deltaphi?
210 Double_t fSPDtrackletDeltaPhiMax; //maximal deltaphi for tracklets
211 Double_t fSPDtrackletDeltaPhiMin; //minimal deltaphi for tracklets
1ff4bda1 212 Bool_t fIgnoreTPCzRange; //ignore tracks going close to central membrane
213 Double_t fIgnoreTPCzRangeMax; //max z to ignore
214 Double_t fIgnoreTPCzRangeMin; //min z to ignore
2948ac5a 215 Bool_t fCutChi2PerClusterTPC; //cut on tpc chi2
216 Float_t fMaxChi2PerClusterTPC; //max chi2 tpc/cluster
217 Float_t fMinChi2PerClusterTPC; //min chi2 tpc/cluster
32b846cd 218 Bool_t fCutNClustersTPC; //cut on clusters?
219 Int_t fNClustersTPCMax; //max tpc ncls
220 Int_t fNClustersTPCMin; //min tpc clusters
42655d16 221 Bool_t fCutNClustersITS; //cut on clusters?
222 Int_t fNClustersITSMax; //max tpc ncls
223 Int_t fNClustersITSMin; //min tpc clusters
5ba02b32 224 Bool_t fUseAODFilterBit; //use AOD filter bit selection?
225 UInt_t fAODFilterBit; //AOD filter bit to select
a63303bd 226 Bool_t fCutDCAToVertexXY; //dca xy cut
227 Bool_t fCutDCAToVertexZ; //dca z cut
2b1eaa10 228 Bool_t fCutMinimalTPCdedx; //cut on minimal dedx in TPC to reject noise tracks
229 Double_t fMinimalTPCdedx; //value for minimal TPC dedx
daf66719 230
231 trackParameterType fParamType; //parameter type tu cut on
232 trackParameterMix fParamMix; //parameter mixing
daf66719 233 AliVParticle* fTrack; //!the track to apply cuts on
12b2b8bc 234 Double_t fTrackPhi; //!track phi
235 Double_t fTrackEta; //!track eta
236 Double_t fTrackWeight; //!track weight
127a5825 237 Int_t fTrackLabel; //!track label, or its absolute value if FakesAreOK
957517fa 238 AliMCEvent* fMCevent; //!mc event
daf66719 239 AliMCParticle* fMCparticle; //!mc particle
9a0783cc 240 AliVEvent* fEvent; //!placeholder for current event
1ff4bda1 241 AliESDtrack fTPCtrack; //!placeholder for TPC only track to avoid new/delete on every track
daf66719 242
32b846cd 243 //PID
aab6527a 244 AliESDpid fESDpid; //pid obj
32b846cd 245 PIDsource fPIDsource; //pid source
246 TMatrixF* fTPCpidCuts; //tpc pid cuts
247 TMatrixF* fTOFpidCuts; //tof pid cuts
2b1eaa10 248 AliPID::EParticleType fParticleID; //alipid
249 Double_t fParticleProbability; //desired prob for a particle type
32b846cd 250
3abf7ecc 251 // part added by F. Noferini
252 static const Int_t fnPIDptBin = 20; // pT bins for priors
253 Float_t fC[fnPIDptBin][5],fBinLimitPID[fnPIDptBin]; // pt bin limit and priors
254 Float_t fProbBayes[5]; // bayesian probability
255 // end part added by F. Noferini
256
2b1eaa10 257 ClassDef(AliFlowTrackCuts,6)
daf66719 258};
259
260#endif
261