Class version increased.
[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
61 static AliESDtrackCuts* GetStandardTPCOnlyTrackCuts();
f4e7aa32 62 static AliESDtrackCuts* GetStandardITSTPCTrackCuts2009(Bool_t selPrimaries=kTRUE);
0274b76f 63 static AliESDtrackCuts* GetStandardITSSATrackCuts2009(Bool_t selPrimaries=kTRUE, Bool_t useForPid=kTRUE);
64 static AliESDtrackCuts* GetStandardITSPureSATrackCuts2009(Bool_t selPrimaries=kTRUE, Bool_t useForPid=kTRUE);
524916f0 65
73318471 66 virtual Long64_t Merge(TCollection* list);
67 virtual void Copy(TObject &c) const;
68 AliESDtrackCuts(const AliESDtrackCuts& pd); // Copy Constructor
69 AliESDtrackCuts &operator=(const AliESDtrackCuts &c);
70
71 //######################################################
72 // track quality cut setters
73 void SetMinNClustersTPC(Int_t min=-1) {fCutMinNClusterTPC=min;}
74 void SetMinNClustersITS(Int_t min=-1) {fCutMinNClusterITS=min;}
94c06b89 75 void SetClusterRequirementITS(Detector det, ITSClusterRequirement req = kOff) { fCutClusterRequirementITS[det] = req; }
73318471 76 void SetMaxChi2PerClusterTPC(Float_t max=1e10) {fCutMaxChi2PerClusterTPC=max;}
77 void SetMaxChi2PerClusterITS(Float_t max=1e10) {fCutMaxChi2PerClusterITS=max;}
78 void SetRequireTPCRefit(Bool_t b=kFALSE) {fCutRequireTPCRefit=b;}
a86cf7f4 79 void SetRequireTPCStandAlone(Bool_t b=kFALSE) {fCutRequireTPCStandAlone=b;}
73318471 80 void SetRequireITSRefit(Bool_t b=kFALSE) {fCutRequireITSRefit=b;}
0274b76f 81 void SetRequireITSPid(Bool_t b=kFALSE) {fCutRequireITSPid=b;}
82 void SetRequireITSStandAlone(Bool_t b=kFALSE) {fCutRequireITSStandAlone = b;}
83 void SetRequireITSPureStandAlone(Bool_t b=kFALSE){fCutRequireITSpureSA = b;}
84
85
3128582b 86 void SetAcceptKinkDaughters(Bool_t b=kTRUE) {fCutAcceptKinkDaughters=b;}
87 void SetAcceptSharedTPCClusters(Bool_t b=kTRUE){fCutAcceptSharedTPCClusters=b;}
88 void SetMaxFractionSharedTPCClusters(Float_t max=1e10) {fCutMaxFractionSharedTPCClusters=max;}
73318471 89 void SetMaxCovDiagonalElements(Float_t c1=1e10, Float_t c2=1e10, Float_t c3=1e10, Float_t c4=1e10, Float_t c5=1e10)
90 {fCutMaxC11=c1; fCutMaxC22=c2; fCutMaxC33=c3; fCutMaxC44=c4; fCutMaxC55=c5;}
025fb458 91 void SetMaxRel1PtUncertainty(Float_t max=1e10) {fCutMaxRel1PtUncertainty=max;}
73318471 92
93 // track to vertex cut setters
610e91ac 94 void SetMaxNsigmaToVertex(Float_t sigma=1e10) {fCutNsigmaToVertex = sigma; SetRequireSigmaToVertex(kTRUE);}
29387958 95 void SetRequireSigmaToVertex(Bool_t b=kTRUE) {fCutSigmaToVertexRequired = b;}
133a5e00 96 void SetMaxDCAToVertexXY(Float_t dist=1e10) {fCutMaxDCAToVertexXY = dist;}
97 void SetMaxDCAToVertexZ(Float_t dist=1e10) {fCutMaxDCAToVertexZ = dist;}
98 void SetMinDCAToVertexXY(Float_t dist=0.) {fCutMinDCAToVertexXY = dist;}
99 void SetMinDCAToVertexZ(Float_t dist=0.) {fCutMinDCAToVertexZ = dist;}
f328399b 100 void SetMaxDCAToVertexXYPtDep(const char *dist="");
101 void SetMaxDCAToVertexZPtDep(const char *dist="");
102 void SetMinDCAToVertexXYPtDep(const char *dist="");
103 void SetMinDCAToVertexZPtDep(const char *dist="");
86f0e195 104 void SetDCAToVertex2D(Bool_t b=kFALSE) {fCutDCAToVertex2D = b;}
73318471 105
f4e7aa32 106
73318471 107 // getters
73318471 108
5ce43eaf 109 Int_t GetMinNClusterTPC() const { return fCutMinNClusterTPC;}
110 Int_t GetMinNClustersITS() const { return fCutMinNClusterITS;}
94c06b89 111 ITSClusterRequirement GetClusterRequirementITS(Detector det) const { return fCutClusterRequirementITS[det]; }
5ce43eaf 112 Float_t GetMaxChi2PerClusterTPC() const { return fCutMaxChi2PerClusterTPC;}
113 Float_t GetMaxChi2PerClusterITS() const { return fCutMaxChi2PerClusterITS;}
114 Bool_t GetRequireTPCRefit() const { return fCutRequireTPCRefit;}
a86cf7f4 115 Bool_t GetRequireTPCStandAlone() const { return fCutRequireTPCStandAlone;}
5ce43eaf 116 Bool_t GetRequireITSRefit() const { return fCutRequireITSRefit;}
d95684c0 117 Bool_t GetRequireITSStandAlone() const { return fCutRequireITSStandAlone; }
58c4f3fb 118 Bool_t GetAcceptKinkDaughters() const { return fCutAcceptKinkDaughters;}
3128582b 119 Bool_t GetAcceptSharedTPCClusters() const {return fCutAcceptSharedTPCClusters;}
120 Float_t GetMaxFractionSharedTPCClusters() const {return fCutMaxFractionSharedTPCClusters;}
5ce43eaf 121 void GetMaxCovDiagonalElements(Float_t& c1, Float_t& c2, Float_t& c3, Float_t& c4, Float_t& c5)
122 {c1 = fCutMaxC11; c2 = fCutMaxC22; c3 = fCutMaxC33; c4 = fCutMaxC44; c5 = fCutMaxC55;}
025fb458 123 Float_t GetMaxRel1PtUncertainty() const { return fCutMaxRel1PtUncertainty;}
94c06b89 124 Float_t GetMaxNsigmaToVertex() const { return fCutNsigmaToVertex;}
133a5e00 125 Float_t GetMaxDCAToVertexXY() const { return fCutMaxDCAToVertexXY;}
126 Float_t GetMaxDCAToVertexZ() const { return fCutMaxDCAToVertexZ;}
127 Float_t GetMinDCAToVertexXY() const { return fCutMinDCAToVertexXY;}
128 Float_t GetMinDCAToVertexZ() const { return fCutMinDCAToVertexZ;}
f4e7aa32 129 const char* GetMaxDCAToVertexXYPtDep() const { return fCutMaxDCAToVertexXYPtDep;}
130 const char* GetMaxDCAToVertexZPtDep() const { return fCutMaxDCAToVertexZPtDep;}
131 const char* GetMinDCAToVertexXYPtDep() const { return fCutMinDCAToVertexXYPtDep;}
132 const char* GetMinDCAToVertexZPtDep() const { return fCutMinDCAToVertexZPtDep;}
86f0e195 133 Bool_t GetDCAToVertex2D() const { return fCutDCAToVertex2D;}
5ce43eaf 134 Bool_t GetRequireSigmaToVertex( ) const { return fCutSigmaToVertexRequired;}
5ac99092 135
1bf80d20 136 void GetPRange(Float_t& r1, Float_t& r2) const {r1=fPMin; r2=fPMax;}
137 void GetPtRange(Float_t& r1, Float_t& r2) const {r1=fPtMin; r2=fPtMax;}
138 void GetPxRange(Float_t& r1, Float_t& r2) const {r1=fPxMin; r2=fPxMax;}
139 void GetPyRange(Float_t& r1, Float_t& r2) const {r1=fPyMin; r2=fPyMax;}
140 void GetPzRange(Float_t& r1, Float_t& r2) const {r1=fPzMin; r2=fPzMax;}
141 void GetEtaRange(Float_t& r1, Float_t& r2) const {r1=fEtaMin; r2=fEtaMax;}
142 void GetRapRange(Float_t& r1, Float_t& r2) const {r1=fRapMin; r2=fRapMax;}
74687314 143
73318471 144 // track kinmatic cut setters
145 void SetPRange(Float_t r1=0, Float_t r2=1e10) {fPMin=r1; fPMax=r2;}
146 void SetPtRange(Float_t r1=0, Float_t r2=1e10) {fPtMin=r1; fPtMax=r2;}
147 void SetPxRange(Float_t r1=-1e10, Float_t r2=1e10) {fPxMin=r1; fPxMax=r2;}
148 void SetPyRange(Float_t r1=-1e10, Float_t r2=1e10) {fPyMin=r1; fPyMax=r2;}
149 void SetPzRange(Float_t r1=-1e10, Float_t r2=1e10) {fPzMin=r1; fPzMax=r2;}
150 void SetEtaRange(Float_t r1=-1e10, Float_t r2=1e10) {fEtaMin=r1; fEtaMax=r2;}
151 void SetRapRange(Float_t r1=-1e10, Float_t r2=1e10) {fRapMin=r1; fRapMax=r2;}
152
153 //######################################################
154 void SetHistogramsOn(Bool_t b=kFALSE) {fHistogramsOn = b;}
155 void DefineHistograms(Int_t color=1);
156 virtual Bool_t LoadHistograms(const Char_t* dir = 0);
157 void SaveHistograms(const Char_t* dir = 0);
158 void DrawHistograms();
159
57fddfbc 160 static Float_t GetSigmaToVertex(AliESDtrack* esdTrack);
73318471 161
162 static void EnableNeededBranches(TTree* tree);
163
164 // void SaveQualityCuts(Char_t* file)
165 // void LoadQualityCuts(Char_t* file)
166
d95684c0 167 TH1F* GetDZNormalized(Int_t i) const { return fhDZNormalized[i]; }
73318471 168
169protected:
170 void Init(); // sets everything to 0
94c06b89 171 Bool_t CheckITSClusterRequirement(ITSClusterRequirement req, Bool_t clusterL1, Bool_t clusterL2);
f4e7aa32 172 Bool_t CheckPtDepDCA(TString dist,Bool_t print=kFALSE) const;
173 void SetPtDepDCACuts(Double_t pt);
174
0274b76f 175 enum { kNCuts = 36 };
73318471 176
177 //######################################################
178 // esd track quality cuts
179 static const Char_t* fgkCutNames[kNCuts]; //! names of cuts (for internal use)
180
181 Int_t fCutMinNClusterTPC; // min number of tpc clusters
182 Int_t fCutMinNClusterITS; // min number of its clusters
94c06b89 183
184 ITSClusterRequirement fCutClusterRequirementITS[3]; // detailed ITS cluster requirements for (SPD, SDD, SSD)
73318471 185
186 Float_t fCutMaxChi2PerClusterTPC; // max tpc fit chi2 per tpc cluster
187 Float_t fCutMaxChi2PerClusterITS; // max its fit chi2 per its cluster
188
189 Float_t fCutMaxC11; // max cov. matrix diag. elements (res. y^2)
190 Float_t fCutMaxC22; // max cov. matrix diag. elements (res. z^2)
191 Float_t fCutMaxC33; // max cov. matrix diag. elements (res. sin(phi)^2)
192 Float_t fCutMaxC44; // max cov. matrix diag. elements (res. tan(theta_dip)^2)
193 Float_t fCutMaxC55; // max cov. matrix diag. elements (res. 1/pt^2)
194
025fb458 195 Float_t fCutMaxRel1PtUncertainty; // max relative uncertainty of 1/pt
196
73318471 197 Bool_t fCutAcceptKinkDaughters; // accepting kink daughters?
3128582b 198 Bool_t fCutAcceptSharedTPCClusters;// accepting shared clusters in TPC?
199 Float_t fCutMaxFractionSharedTPCClusters; //Maximum fraction of shared clusters in TPC
73318471 200 Bool_t fCutRequireTPCRefit; // require TPC refit
a86cf7f4 201 Bool_t fCutRequireTPCStandAlone; // require TPC standalone tracks
73318471 202 Bool_t fCutRequireITSRefit; // require ITS refit
0274b76f 203 Bool_t fCutRequireITSPid; // require ITS refit
204 Bool_t fCutRequireITSStandAlone; // require ITS standalone tracks (remove pure SA)
205 Bool_t fCutRequireITSpureSA; // require ITS pure standalone tracks (found using all ITS clusters)
73318471 206
207 // track to vertex cut
208 Float_t fCutNsigmaToVertex; // max number of estimated sigma from track-to-vertex
209 Bool_t fCutSigmaToVertexRequired; // cut track if sigma from track-to-vertex could not be calculated
133a5e00 210 Float_t fCutMaxDCAToVertexXY; // track-to-vertex cut in max absolute distance in xy-plane
211 Float_t fCutMaxDCAToVertexZ; // track-to-vertex cut in max absolute distance in z-plane
212 Float_t fCutMinDCAToVertexXY; // track-to-vertex cut on min absolute distance in xy-plane
213 Float_t fCutMinDCAToVertexZ; // track-to-vertex cut on min absolute distance in z-plane
f328399b 214 //
f4e7aa32 215 TString fCutMaxDCAToVertexXYPtDep; // pt-dep track-to-vertex cut in max absolute distance in xy-plane
216 TString fCutMaxDCAToVertexZPtDep; // pt-dep track-to-vertex cut in max absolute distance in z-plane
217 TString fCutMinDCAToVertexXYPtDep; // pt-dep track-to-vertex cut on min absolute distance in xy-plane
218 TString fCutMinDCAToVertexZPtDep; // pt-dep track-to-vertex cut on min absolute distance in z-plane
f328399b 219
220 // only internal use, set via strings above
221 TFormula *f1CutMaxDCAToVertexXYPtDep; // pt-dep track-to-vertex cut in max absolute distance in xy-plane
222 TFormula *f1CutMaxDCAToVertexZPtDep; // pt-dep track-to-vertex cut in max absolute distance in z-plane
223 TFormula *f1CutMinDCAToVertexXYPtDep; // pt-dep track-to-vertex cut on min absolute distance in xy-plane
224 TFormula *f1CutMinDCAToVertexZPtDep; // pt-dep track-to-vertex cut on min absolute distance in z-plane
225
133a5e00 226 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 227
228 // esd kinematics cuts
229 Float_t fPMin, fPMax; // definition of the range of the P
230 Float_t fPtMin, fPtMax; // definition of the range of the Pt
231 Float_t fPxMin, fPxMax; // definition of the range of the Px
232 Float_t fPyMin, fPyMax; // definition of the range of the Py
233 Float_t fPzMin, fPzMax; // definition of the range of the Pz
234 Float_t fEtaMin, fEtaMax; // definition of the range of the eta
235 Float_t fRapMin, fRapMax; // definition of the range of the y
236
237 //######################################################
238 // diagnostics histograms
239 Bool_t fHistogramsOn; // histograms on/off
240
241 TH1F* fhNClustersITS[2]; //->
242 TH1F* fhNClustersTPC[2]; //->
243
244 TH1F* fhChi2PerClusterITS[2]; //->
245 TH1F* fhChi2PerClusterTPC[2]; //->
246
247 TH1F* fhC11[2]; //->
248 TH1F* fhC22[2]; //->
249 TH1F* fhC33[2]; //->
250 TH1F* fhC44[2]; //->
251 TH1F* fhC55[2]; //->
252
025fb458 253 TH1F* fhRel1PtUncertainty[2]; //-> rel. uncertainty of 1/pt
254
73318471 255 TH1F* fhDXY[2]; //->
256 TH1F* fhDZ[2]; //->
86f0e195 257 TH1F* fhDXYDZ[2]; //-> absolute distance sqrt(dxy**2 + dz**2) to vertex; if 2D cut is set, normalized to given values
73318471 258 TH2F* fhDXYvsDZ[2]; //->
259
260 TH1F* fhDXYNormalized[2]; //->
261 TH1F* fhDZNormalized[2]; //->
262 TH2F* fhDXYvsDZNormalized[2]; //->
263 TH1F* fhNSigmaToVertex[2]; //->
524916f0 264
73318471 265 TH1F* fhPt[2]; //-> pt of esd tracks
266 TH1F* fhEta[2]; //-> eta of esd tracks
267
268 TF1* ffDTheoretical; //-> theoretical distance to vertex normalized (2d gauss)
269
270 TH1F* fhCutStatistics; //-> statistics of what cuts the tracks did not survive
271 TH2F* fhCutCorrelation; //-> 2d statistics plot
272
41543ff9 273 ClassDef(AliESDtrackCuts, 12)
73318471 274};
275
276
277#endif