We noticed that we did not provide in AliESDtrackCuts the methods with the "standard...
[u/mrichter/AliRoot.git] / ANALYSIS / AliESDtrackCuts.h
CommitLineData
73318471 1//
2// Class for handling of ESD track cuts.
3//
4// The class manages a number of track quality cuts, a
5// track-to-vertex cut and a number of kinematic cuts. Two methods
6// can be used to figure out if an ESD track survives the cuts:
7// AcceptTrack which takes a single AliESDtrack as argument and
524916f0 8// returns kTRUE/kFALSE or GetAcceptedTracks which takes an AliESDEvent
73318471 9// object and returns an TObjArray (of AliESDtracks) with the tracks
10// in the ESD that survived the cuts.
11//
12//
524916f0 13// TODO:
73318471 14// - add functionality to save and load cuts
73318471 15// - add histograms for kinematic cut variables?
16// - upper and lower cuts for all (non-boolean) cuts
17// - update print method
73318471 18// - put comments to each variable
19//
20
21#ifndef ALIESDTRACKCUTS_H
22#define ALIESDTRACKCUTS_H
23
f4e7aa32 24#include <TString.h>
25
73318471 26#include "AliAnalysisCuts.h"
27
73318471 28class AliESDEvent;
29class AliESDtrack;
30class AliLog;
31class TTree;
d95684c0 32class TH1;
33class TH1F;
34class TH2F;
35class TF1;
36class TCollection;
f328399b 37class TFormula;
73318471 38
39class AliESDtrackCuts : public AliAnalysisCuts
40{
41public:
94c06b89 42 enum ITSClusterRequirement { kOff = 0, kNone, kAny, kFirst, kOnlyFirst, kSecond, kOnlySecond, kBoth };
43 enum Detector { kSPD = 0, kSDD, kSSD };
44
73318471 45 AliESDtrackCuts(const Char_t* name = "AliESDtrackCuts", const Char_t* title = "");
46 virtual ~AliESDtrackCuts();
36853ddd 47
0c6c629b 48 virtual Bool_t IsSelected(TObject* obj)
9eeae5d5 49 {return AcceptTrack((AliESDtrack*)obj);}
0c6c629b 50 virtual Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
36853ddd 51
73318471 52 Bool_t AcceptTrack(AliESDtrack* esdTrack);
74687314 53 TObjArray* GetAcceptedTracks(AliESDEvent* esd, Bool_t bTPC = kFALSE);
73318471 54 Int_t CountAcceptedTracks(AliESDEvent* esd);
1bf80d20 55
56 static Int_t GetReferenceMultiplicity(AliESDEvent* esd, Bool_t tpcOnly);
73318471 57
524916f0 58 static AliESDtrack* GetTPCOnlyTrack(AliESDEvent* esd, Int_t iTrack);
1bf80d20 59
60 // Standard cut definitions
97b2cf9e 61 static AliESDtrackCuts* GetStandardTPCOnlyTrackCuts();
62 static AliESDtrackCuts* GetStandardITSTPCTrackCuts2009(Bool_t selPrimaries=kTRUE);
63 static AliESDtrackCuts* GetStandardITSTPCTrackCuts2010(Bool_t selPrimaries=kTRUE);
64 static AliESDtrackCuts* GetStandardITSSATrackCuts2009(Bool_t selPrimaries=kTRUE, Bool_t useForPid=kTRUE);
65 static AliESDtrackCuts* GetStandardITSSATrackCuts2010(Bool_t selPrimaries=kTRUE, Bool_t useForPid=kTRUE);
66 static AliESDtrackCuts* GetStandardITSPureSATrackCuts2009(Bool_t selPrimaries=kTRUE, Bool_t useForPid=kTRUE);
67 static AliESDtrackCuts* GetStandardITSPureSATrackCuts2010(Bool_t selPrimaries=kTRUE, Bool_t useForPid=kTRUE);
68
524916f0 69
73318471 70 virtual Long64_t Merge(TCollection* list);
71 virtual void Copy(TObject &c) const;
72 AliESDtrackCuts(const AliESDtrackCuts& pd); // Copy Constructor
73 AliESDtrackCuts &operator=(const AliESDtrackCuts &c);
74
75 //######################################################
76 // track quality cut setters
77 void SetMinNClustersTPC(Int_t min=-1) {fCutMinNClusterTPC=min;}
78 void SetMinNClustersITS(Int_t min=-1) {fCutMinNClusterITS=min;}
94c06b89 79 void SetClusterRequirementITS(Detector det, ITSClusterRequirement req = kOff) { fCutClusterRequirementITS[det] = req; }
73318471 80 void SetMaxChi2PerClusterTPC(Float_t max=1e10) {fCutMaxChi2PerClusterTPC=max;}
81 void SetMaxChi2PerClusterITS(Float_t max=1e10) {fCutMaxChi2PerClusterITS=max;}
82 void SetRequireTPCRefit(Bool_t b=kFALSE) {fCutRequireTPCRefit=b;}
a86cf7f4 83 void SetRequireTPCStandAlone(Bool_t b=kFALSE) {fCutRequireTPCStandAlone=b;}
73318471 84 void SetRequireITSRefit(Bool_t b=kFALSE) {fCutRequireITSRefit=b;}
0274b76f 85 void SetRequireITSPid(Bool_t b=kFALSE) {fCutRequireITSPid=b;}
86 void SetRequireITSStandAlone(Bool_t b=kFALSE) {fCutRequireITSStandAlone = b;}
87 void SetRequireITSPureStandAlone(Bool_t b=kFALSE){fCutRequireITSpureSA = b;}
88
89
3128582b 90 void SetAcceptKinkDaughters(Bool_t b=kTRUE) {fCutAcceptKinkDaughters=b;}
91 void SetAcceptSharedTPCClusters(Bool_t b=kTRUE){fCutAcceptSharedTPCClusters=b;}
92 void SetMaxFractionSharedTPCClusters(Float_t max=1e10) {fCutMaxFractionSharedTPCClusters=max;}
73318471 93 void SetMaxCovDiagonalElements(Float_t c1=1e10, Float_t c2=1e10, Float_t c3=1e10, Float_t c4=1e10, Float_t c5=1e10)
94 {fCutMaxC11=c1; fCutMaxC22=c2; fCutMaxC33=c3; fCutMaxC44=c4; fCutMaxC55=c5;}
025fb458 95 void SetMaxRel1PtUncertainty(Float_t max=1e10) {fCutMaxRel1PtUncertainty=max;}
73318471 96
97 // track to vertex cut setters
610e91ac 98 void SetMaxNsigmaToVertex(Float_t sigma=1e10) {fCutNsigmaToVertex = sigma; SetRequireSigmaToVertex(kTRUE);}
29387958 99 void SetRequireSigmaToVertex(Bool_t b=kTRUE) {fCutSigmaToVertexRequired = b;}
133a5e00 100 void SetMaxDCAToVertexXY(Float_t dist=1e10) {fCutMaxDCAToVertexXY = dist;}
101 void SetMaxDCAToVertexZ(Float_t dist=1e10) {fCutMaxDCAToVertexZ = dist;}
102 void SetMinDCAToVertexXY(Float_t dist=0.) {fCutMinDCAToVertexXY = dist;}
103 void SetMinDCAToVertexZ(Float_t dist=0.) {fCutMinDCAToVertexZ = dist;}
f328399b 104 void SetMaxDCAToVertexXYPtDep(const char *dist="");
105 void SetMaxDCAToVertexZPtDep(const char *dist="");
106 void SetMinDCAToVertexXYPtDep(const char *dist="");
107 void SetMinDCAToVertexZPtDep(const char *dist="");
86f0e195 108 void SetDCAToVertex2D(Bool_t b=kFALSE) {fCutDCAToVertex2D = b;}
73318471 109
f4e7aa32 110
73318471 111 // getters
73318471 112
5ce43eaf 113 Int_t GetMinNClusterTPC() const { return fCutMinNClusterTPC;}
114 Int_t GetMinNClustersITS() const { return fCutMinNClusterITS;}
94c06b89 115 ITSClusterRequirement GetClusterRequirementITS(Detector det) const { return fCutClusterRequirementITS[det]; }
5ce43eaf 116 Float_t GetMaxChi2PerClusterTPC() const { return fCutMaxChi2PerClusterTPC;}
117 Float_t GetMaxChi2PerClusterITS() const { return fCutMaxChi2PerClusterITS;}
118 Bool_t GetRequireTPCRefit() const { return fCutRequireTPCRefit;}
a86cf7f4 119 Bool_t GetRequireTPCStandAlone() const { return fCutRequireTPCStandAlone;}
5ce43eaf 120 Bool_t GetRequireITSRefit() const { return fCutRequireITSRefit;}
d95684c0 121 Bool_t GetRequireITSStandAlone() const { return fCutRequireITSStandAlone; }
58c4f3fb 122 Bool_t GetAcceptKinkDaughters() const { return fCutAcceptKinkDaughters;}
3128582b 123 Bool_t GetAcceptSharedTPCClusters() const {return fCutAcceptSharedTPCClusters;}
124 Float_t GetMaxFractionSharedTPCClusters() const {return fCutMaxFractionSharedTPCClusters;}
5ce43eaf 125 void GetMaxCovDiagonalElements(Float_t& c1, Float_t& c2, Float_t& c3, Float_t& c4, Float_t& c5)
126 {c1 = fCutMaxC11; c2 = fCutMaxC22; c3 = fCutMaxC33; c4 = fCutMaxC44; c5 = fCutMaxC55;}
025fb458 127 Float_t GetMaxRel1PtUncertainty() const { return fCutMaxRel1PtUncertainty;}
94c06b89 128 Float_t GetMaxNsigmaToVertex() const { return fCutNsigmaToVertex;}
133a5e00 129 Float_t GetMaxDCAToVertexXY() const { return fCutMaxDCAToVertexXY;}
130 Float_t GetMaxDCAToVertexZ() const { return fCutMaxDCAToVertexZ;}
131 Float_t GetMinDCAToVertexXY() const { return fCutMinDCAToVertexXY;}
132 Float_t GetMinDCAToVertexZ() const { return fCutMinDCAToVertexZ;}
f4e7aa32 133 const char* GetMaxDCAToVertexXYPtDep() const { return fCutMaxDCAToVertexXYPtDep;}
134 const char* GetMaxDCAToVertexZPtDep() const { return fCutMaxDCAToVertexZPtDep;}
135 const char* GetMinDCAToVertexXYPtDep() const { return fCutMinDCAToVertexXYPtDep;}
136 const char* GetMinDCAToVertexZPtDep() const { return fCutMinDCAToVertexZPtDep;}
86f0e195 137 Bool_t GetDCAToVertex2D() const { return fCutDCAToVertex2D;}
5ce43eaf 138 Bool_t GetRequireSigmaToVertex( ) const { return fCutSigmaToVertexRequired;}
5ac99092 139
1bf80d20 140 void GetPRange(Float_t& r1, Float_t& r2) const {r1=fPMin; r2=fPMax;}
141 void GetPtRange(Float_t& r1, Float_t& r2) const {r1=fPtMin; r2=fPtMax;}
142 void GetPxRange(Float_t& r1, Float_t& r2) const {r1=fPxMin; r2=fPxMax;}
143 void GetPyRange(Float_t& r1, Float_t& r2) const {r1=fPyMin; r2=fPyMax;}
144 void GetPzRange(Float_t& r1, Float_t& r2) const {r1=fPzMin; r2=fPzMax;}
145 void GetEtaRange(Float_t& r1, Float_t& r2) const {r1=fEtaMin; r2=fEtaMax;}
146 void GetRapRange(Float_t& r1, Float_t& r2) const {r1=fRapMin; r2=fRapMax;}
74687314 147
73318471 148 // track kinmatic cut setters
149 void SetPRange(Float_t r1=0, Float_t r2=1e10) {fPMin=r1; fPMax=r2;}
150 void SetPtRange(Float_t r1=0, Float_t r2=1e10) {fPtMin=r1; fPtMax=r2;}
151 void SetPxRange(Float_t r1=-1e10, Float_t r2=1e10) {fPxMin=r1; fPxMax=r2;}
152 void SetPyRange(Float_t r1=-1e10, Float_t r2=1e10) {fPyMin=r1; fPyMax=r2;}
153 void SetPzRange(Float_t r1=-1e10, Float_t r2=1e10) {fPzMin=r1; fPzMax=r2;}
154 void SetEtaRange(Float_t r1=-1e10, Float_t r2=1e10) {fEtaMin=r1; fEtaMax=r2;}
155 void SetRapRange(Float_t r1=-1e10, Float_t r2=1e10) {fRapMin=r1; fRapMax=r2;}
156
157 //######################################################
158 void SetHistogramsOn(Bool_t b=kFALSE) {fHistogramsOn = b;}
159 void DefineHistograms(Int_t color=1);
160 virtual Bool_t LoadHistograms(const Char_t* dir = 0);
161 void SaveHistograms(const Char_t* dir = 0);
162 void DrawHistograms();
163
57fddfbc 164 static Float_t GetSigmaToVertex(AliESDtrack* esdTrack);
73318471 165
166 static void EnableNeededBranches(TTree* tree);
167
168 // void SaveQualityCuts(Char_t* file)
169 // void LoadQualityCuts(Char_t* file)
170
d95684c0 171 TH1F* GetDZNormalized(Int_t i) const { return fhDZNormalized[i]; }
73318471 172
173protected:
174 void Init(); // sets everything to 0
94c06b89 175 Bool_t CheckITSClusterRequirement(ITSClusterRequirement req, Bool_t clusterL1, Bool_t clusterL2);
f4e7aa32 176 Bool_t CheckPtDepDCA(TString dist,Bool_t print=kFALSE) const;
177 void SetPtDepDCACuts(Double_t pt);
178
0274b76f 179 enum { kNCuts = 36 };
73318471 180
181 //######################################################
182 // esd track quality cuts
183 static const Char_t* fgkCutNames[kNCuts]; //! names of cuts (for internal use)
184
185 Int_t fCutMinNClusterTPC; // min number of tpc clusters
186 Int_t fCutMinNClusterITS; // min number of its clusters
94c06b89 187
188 ITSClusterRequirement fCutClusterRequirementITS[3]; // detailed ITS cluster requirements for (SPD, SDD, SSD)
73318471 189
190 Float_t fCutMaxChi2PerClusterTPC; // max tpc fit chi2 per tpc cluster
191 Float_t fCutMaxChi2PerClusterITS; // max its fit chi2 per its cluster
192
193 Float_t fCutMaxC11; // max cov. matrix diag. elements (res. y^2)
194 Float_t fCutMaxC22; // max cov. matrix diag. elements (res. z^2)
195 Float_t fCutMaxC33; // max cov. matrix diag. elements (res. sin(phi)^2)
196 Float_t fCutMaxC44; // max cov. matrix diag. elements (res. tan(theta_dip)^2)
197 Float_t fCutMaxC55; // max cov. matrix diag. elements (res. 1/pt^2)
198
025fb458 199 Float_t fCutMaxRel1PtUncertainty; // max relative uncertainty of 1/pt
200
73318471 201 Bool_t fCutAcceptKinkDaughters; // accepting kink daughters?
3128582b 202 Bool_t fCutAcceptSharedTPCClusters;// accepting shared clusters in TPC?
203 Float_t fCutMaxFractionSharedTPCClusters; //Maximum fraction of shared clusters in TPC
73318471 204 Bool_t fCutRequireTPCRefit; // require TPC refit
a86cf7f4 205 Bool_t fCutRequireTPCStandAlone; // require TPC standalone tracks
73318471 206 Bool_t fCutRequireITSRefit; // require ITS refit
0274b76f 207 Bool_t fCutRequireITSPid; // require ITS refit
208 Bool_t fCutRequireITSStandAlone; // require ITS standalone tracks (remove pure SA)
209 Bool_t fCutRequireITSpureSA; // require ITS pure standalone tracks (found using all ITS clusters)
73318471 210
211 // track to vertex cut
212 Float_t fCutNsigmaToVertex; // max number of estimated sigma from track-to-vertex
213 Bool_t fCutSigmaToVertexRequired; // cut track if sigma from track-to-vertex could not be calculated
133a5e00 214 Float_t fCutMaxDCAToVertexXY; // track-to-vertex cut in max absolute distance in xy-plane
215 Float_t fCutMaxDCAToVertexZ; // track-to-vertex cut in max absolute distance in z-plane
216 Float_t fCutMinDCAToVertexXY; // track-to-vertex cut on min absolute distance in xy-plane
217 Float_t fCutMinDCAToVertexZ; // track-to-vertex cut on min absolute distance in z-plane
f328399b 218 //
f4e7aa32 219 TString fCutMaxDCAToVertexXYPtDep; // pt-dep track-to-vertex cut in max absolute distance in xy-plane
220 TString fCutMaxDCAToVertexZPtDep; // pt-dep track-to-vertex cut in max absolute distance in z-plane
221 TString fCutMinDCAToVertexXYPtDep; // pt-dep track-to-vertex cut on min absolute distance in xy-plane
222 TString fCutMinDCAToVertexZPtDep; // pt-dep track-to-vertex cut on min absolute distance in z-plane
f328399b 223
224 // only internal use, set via strings above
225 TFormula *f1CutMaxDCAToVertexXYPtDep; // pt-dep track-to-vertex cut in max absolute distance in xy-plane
226 TFormula *f1CutMaxDCAToVertexZPtDep; // pt-dep track-to-vertex cut in max absolute distance in z-plane
227 TFormula *f1CutMinDCAToVertexXYPtDep; // pt-dep track-to-vertex cut on min absolute distance in xy-plane
228 TFormula *f1CutMinDCAToVertexZPtDep; // pt-dep track-to-vertex cut on min absolute distance in z-plane
229
133a5e00 230 Bool_t fCutDCAToVertex2D; // if true a 2D DCA cut is made. Tracks are accepted if sqrt((DCAXY / fCutMaxDCAToVertexXY)^2 + (DCAZ / fCutMaxDCAToVertexZ)^2) < 1 AND sqrt((DCAXY / fCutMinDCAToVertexXY)^2 + (DCAZ / fCutMinDCAToVertexZ)^2) > 1
73318471 231
232 // esd kinematics cuts
233 Float_t fPMin, fPMax; // definition of the range of the P
234 Float_t fPtMin, fPtMax; // definition of the range of the Pt
235 Float_t fPxMin, fPxMax; // definition of the range of the Px
236 Float_t fPyMin, fPyMax; // definition of the range of the Py
237 Float_t fPzMin, fPzMax; // definition of the range of the Pz
238 Float_t fEtaMin, fEtaMax; // definition of the range of the eta
239 Float_t fRapMin, fRapMax; // definition of the range of the y
240
241 //######################################################
242 // diagnostics histograms
243 Bool_t fHistogramsOn; // histograms on/off
244
245 TH1F* fhNClustersITS[2]; //->
246 TH1F* fhNClustersTPC[2]; //->
247
248 TH1F* fhChi2PerClusterITS[2]; //->
249 TH1F* fhChi2PerClusterTPC[2]; //->
250
251 TH1F* fhC11[2]; //->
252 TH1F* fhC22[2]; //->
253 TH1F* fhC33[2]; //->
254 TH1F* fhC44[2]; //->
255 TH1F* fhC55[2]; //->
256
025fb458 257 TH1F* fhRel1PtUncertainty[2]; //-> rel. uncertainty of 1/pt
258
73318471 259 TH1F* fhDXY[2]; //->
260 TH1F* fhDZ[2]; //->
86f0e195 261 TH1F* fhDXYDZ[2]; //-> absolute distance sqrt(dxy**2 + dz**2) to vertex; if 2D cut is set, normalized to given values
73318471 262 TH2F* fhDXYvsDZ[2]; //->
263
264 TH1F* fhDXYNormalized[2]; //->
265 TH1F* fhDZNormalized[2]; //->
266 TH2F* fhDXYvsDZNormalized[2]; //->
267 TH1F* fhNSigmaToVertex[2]; //->
524916f0 268
73318471 269 TH1F* fhPt[2]; //-> pt of esd tracks
270 TH1F* fhEta[2]; //-> eta of esd tracks
271
272 TF1* ffDTheoretical; //-> theoretical distance to vertex normalized (2d gauss)
273
274 TH1F* fhCutStatistics; //-> statistics of what cuts the tracks did not survive
275 TH2F* fhCutCorrelation; //-> 2d statistics plot
276
41543ff9 277 ClassDef(AliESDtrackCuts, 12)
73318471 278};
279
280
281#endif