]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ANALYSIS/AliESDtrackCuts.h
o add pass4 awareness
[u/mrichter/AliRoot.git] / ANALYSIS / AliESDtrackCuts.h
... / ...
CommitLineData
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
8// returns kTRUE/kFALSE or GetAcceptedTracks which takes an AliESDEvent
9// object and returns an TObjArray (of AliESDtracks) with the tracks
10// in the ESD that survived the cuts.
11//
12//
13// TODO:
14// - add functionality to save and load cuts
15// - add histograms for kinematic cut variables?
16// - upper and lower cuts for all (non-boolean) cuts
17// - update print method
18// - put comments to each variable
19//
20
21#ifndef ALIESDTRACKCUTS_H
22#define ALIESDTRACKCUTS_H
23
24#include <TString.h>
25
26#include "AliAnalysisCuts.h"
27
28class AliESDEvent;
29class AliESDtrack;
30class AliLog;
31class TTree;
32class TH1;
33class TH1F;
34class TH2F;
35class TF1;
36class TCollection;
37class TFormula;
38
39class AliESDtrackCuts : public AliAnalysisCuts
40{
41public:
42 enum ITSClusterRequirement { kOff = 0, kNone, kAny, kFirst, kOnlyFirst, kSecond, kOnlySecond, kBoth };
43 enum Detector { kSPD = 0, kSDD, kSSD };
44 enum MultEstTrackCuts { kMultEstTrackCutGlobal = 0, kMultEstTrackCutITSSA, kMultEstTrackCutDCAwSPD, kMultEstTrackCutDCAwoSPD, kNMultEstTrackCuts /* this must always be the last */};
45 enum MultEstTrackType { kTrackletsITSTPC = 0, kTrackletsITSSA, kTracklets };
46 enum VertexType { kVertexTracks = 0x1, kVertexSPD = 0x2, kVertexTPC = 0x4 };
47
48 AliESDtrackCuts(const Char_t* name = "AliESDtrackCuts", const Char_t* title = "");
49 virtual ~AliESDtrackCuts();
50
51 virtual Bool_t IsSelected(TObject* obj)
52 {return AcceptTrack((AliESDtrack*)obj);}
53 virtual Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
54
55 Bool_t AcceptTrack(const AliESDtrack* esdTrack);
56 TObjArray* GetAcceptedTracks(const AliESDEvent* esd, Bool_t bTPC = kFALSE);
57 Int_t CountAcceptedTracks(const AliESDEvent* const esd);
58
59 static Int_t GetReferenceMultiplicity(const AliESDEvent* esd, Bool_t tpcOnly);
60 static Int_t GetReferenceMultiplicity(const AliESDEvent* esd, MultEstTrackType trackType = kTrackletsITSTPC, Float_t etaRange = 0.5);
61 static AliESDtrackCuts* GetMultEstTrackCuts(MultEstTrackCuts cut);
62
63 static AliESDtrack* GetTPCOnlyTrack(const AliESDEvent* esd, Int_t iTrack);
64
65 // Standard cut definitions
66 static AliESDtrackCuts* GetStandardTPCOnlyTrackCuts();
67 static AliESDtrackCuts* GetStandardITSTPCTrackCuts2009(Bool_t selPrimaries=kTRUE);
68 static AliESDtrackCuts* GetStandardITSTPCTrackCuts2010(Bool_t selPrimaries=kTRUE, Int_t clusterCut=0);
69 static AliESDtrackCuts* GetStandardITSTPCTrackCuts2011(Bool_t selPrimaries=kTRUE, Int_t clusterCut=1);
70 static AliESDtrackCuts* GetStandardITSSATrackCuts2009(Bool_t selPrimaries=kTRUE, Bool_t useForPid=kTRUE);
71 static AliESDtrackCuts* GetStandardITSSATrackCuts2010(Bool_t selPrimaries=kTRUE, Bool_t useForPid=kTRUE);
72 static AliESDtrackCuts* GetStandardITSSATrackCutsPbPb2010(Bool_t selPrimaries=kTRUE, Bool_t useForPid=kTRUE);
73 static AliESDtrackCuts* GetStandardITSPureSATrackCuts2009(Bool_t selPrimaries=kTRUE, Bool_t useForPid=kTRUE);
74 static AliESDtrackCuts* GetStandardITSPureSATrackCuts2010(Bool_t selPrimaries=kTRUE, Bool_t useForPid=kTRUE);
75 // Standard cuts for daughter tracks
76 static AliESDtrackCuts* GetStandardV0DaughterCuts();
77
78 virtual Long64_t Merge(TCollection* list);
79 virtual void Copy(TObject &c) const;
80 AliESDtrackCuts(const AliESDtrackCuts& pd); // Copy Constructor
81 AliESDtrackCuts &operator=(const AliESDtrackCuts &c);
82
83 //######################################################
84 // track quality cut setters
85 void SetMinNClustersTPC(Int_t min=-1) {fCutMinNClusterTPC=min;}
86 void SetMinNClustersTPCPtDep(TFormula *f1=0x0, Float_t ptmax=0.);
87 void SetMinNClustersITS(Int_t min=-1) {fCutMinNClusterITS=min;}
88 void SetMinNCrossedRowsTPC(Float_t min=-1) { fCutMinNCrossedRowsTPC=min;}
89 void SetMinRatioCrossedRowsOverFindableClustersTPC(Float_t min = -1) { fCutMinRatioCrossedRowsOverFindableClustersTPC=min;}
90 void SetClusterRequirementITS(Detector det, ITSClusterRequirement req = kOff) { fCutClusterRequirementITS[det] = req; }
91 void SetMaxChi2PerClusterTPC(Float_t max=1e10) {fCutMaxChi2PerClusterTPC=max;}
92 void SetMaxChi2PerClusterITS(Float_t max=1e10) {fCutMaxChi2PerClusterITS=max;}
93 void SetMaxChi2TPCConstrainedGlobal(Float_t max=1e10) {fCutMaxChi2TPCConstrainedVsGlobal = max; }
94 void SetMaxChi2TPCConstrainedGlobalVertexType(Int_t vertexType = kVertexTracks | kVertexSPD) { fCutMaxChi2TPCConstrainedVsGlobalVertexType = vertexType; }
95 void SetMaxNOfMissingITSPoints(Int_t max=6) {fCutMaxMissingITSPoints=max;}
96 void SetRequireTPCRefit(Bool_t b=kFALSE) {fCutRequireTPCRefit=b;}
97 void SetRequireTPCStandAlone(Bool_t b=kFALSE) {fCutRequireTPCStandAlone=b;}
98 void SetRequireITSRefit(Bool_t b=kFALSE) {fCutRequireITSRefit=b;}
99 void SetRequireITSPid(Bool_t b=kFALSE) {fCutRequireITSPid=b;}
100 void SetRequireITSStandAlone(Bool_t b=kFALSE) {fCutRequireITSStandAlone = b;}
101 void SetRequireITSPureStandAlone(Bool_t b=kFALSE){fCutRequireITSpureSA = b;}
102
103
104 void SetAcceptKinkDaughters(Bool_t b=kTRUE) {fCutAcceptKinkDaughters=b;}
105 void SetAcceptSharedTPCClusters(Bool_t b=kTRUE){fCutAcceptSharedTPCClusters=b;}
106 void SetMaxFractionSharedTPCClusters(Float_t max=1e10) {fCutMaxFractionSharedTPCClusters=max;}
107 void SetMaxCovDiagonalElements(Float_t c1=1e10, Float_t c2=1e10, Float_t c3=1e10, Float_t c4=1e10, Float_t c5=1e10)
108 {fCutMaxC11=c1; fCutMaxC22=c2; fCutMaxC33=c3; fCutMaxC44=c4; fCutMaxC55=c5;}
109 void SetMaxRel1PtUncertainty(Float_t max=1e10) {fCutMaxRel1PtUncertainty=max;}
110
111
112 // track to vertex cut setters
113 void SetMaxNsigmaToVertex(Float_t sigma=1e10) {fCutNsigmaToVertex = sigma; SetRequireSigmaToVertex(kTRUE);}
114 void SetRequireSigmaToVertex(Bool_t b=kTRUE) {fCutSigmaToVertexRequired = b;}
115 void SetMaxDCAToVertexXY(Float_t dist=1e10) {fCutMaxDCAToVertexXY = dist;}
116 void SetMaxDCAToVertexZ(Float_t dist=1e10) {fCutMaxDCAToVertexZ = dist;}
117 void SetMinDCAToVertexXY(Float_t dist=0.) {fCutMinDCAToVertexXY = dist;}
118 void SetMinDCAToVertexZ(Float_t dist=0.) {fCutMinDCAToVertexZ = dist;}
119 void SetMaxDCAToVertexXYPtDep(const char *dist="");
120 void SetMaxDCAToVertexZPtDep(const char *dist="");
121 void SetMinDCAToVertexXYPtDep(const char *dist="");
122 void SetMinDCAToVertexZPtDep(const char *dist="");
123 void SetDCAToVertex2D(Bool_t b=kFALSE) {fCutDCAToVertex2D = b;}
124
125
126 // getters
127
128 Int_t GetMinNClusterTPC() const { return fCutMinNClusterTPC;}
129 Int_t GetMinNClustersITS() const { return fCutMinNClusterITS;}
130 TFormula *GetMinNClustersTPCPtDep() const { return f1CutMinNClustersTPCPtDep;}
131 ITSClusterRequirement GetClusterRequirementITS(Detector det) const { return fCutClusterRequirementITS[det]; }
132 Float_t GetMaxChi2PerClusterTPC() const { return fCutMaxChi2PerClusterTPC;}
133 Float_t GetMaxChi2PerClusterITS() const { return fCutMaxChi2PerClusterITS;}
134 Float_t GetMaxChi2TPCConstrainedGlobal() const { return fCutMaxChi2TPCConstrainedVsGlobal; }
135 Int_t GetMaxChi2TPCConstrainedGlobalVertexType() const { return fCutMaxChi2TPCConstrainedVsGlobalVertexType; }
136 Int_t GetMaxNOfMissingITSPoints() const { return fCutMaxMissingITSPoints;}
137 Bool_t GetRequireTPCRefit() const { return fCutRequireTPCRefit;}
138 Bool_t GetRequireTPCStandAlone() const { return fCutRequireTPCStandAlone;}
139 Bool_t GetRequireITSRefit() const { return fCutRequireITSRefit;}
140 Bool_t GetRequireITSStandAlone() const { return fCutRequireITSStandAlone; }
141 Bool_t GetAcceptKinkDaughters() const { return fCutAcceptKinkDaughters;}
142 Bool_t GetAcceptSharedTPCClusters() const {return fCutAcceptSharedTPCClusters;}
143 Float_t GetMaxFractionSharedTPCClusters() const {return fCutMaxFractionSharedTPCClusters;}
144 void GetMaxCovDiagonalElements(Float_t& c1, Float_t& c2, Float_t& c3, Float_t& c4, Float_t& c5) const
145 {c1 = fCutMaxC11; c2 = fCutMaxC22; c3 = fCutMaxC33; c4 = fCutMaxC44; c5 = fCutMaxC55;}
146 Float_t GetMaxRel1PtUncertainty() const { return fCutMaxRel1PtUncertainty;}
147 Float_t GetMaxNsigmaToVertex() const { return fCutNsigmaToVertex;}
148 Float_t GetMaxDCAToVertexXY() const { return fCutMaxDCAToVertexXY;}
149 Float_t GetMaxDCAToVertexZ() const { return fCutMaxDCAToVertexZ;}
150 Float_t GetMinDCAToVertexXY() const { return fCutMinDCAToVertexXY;}
151 Float_t GetMinDCAToVertexZ() const { return fCutMinDCAToVertexZ;}
152 const char* GetMaxDCAToVertexXYPtDep() const { return fCutMaxDCAToVertexXYPtDep;}
153 const char* GetMaxDCAToVertexZPtDep() const { return fCutMaxDCAToVertexZPtDep;}
154 const char* GetMinDCAToVertexXYPtDep() const { return fCutMinDCAToVertexXYPtDep;}
155 const char* GetMinDCAToVertexZPtDep() const { return fCutMinDCAToVertexZPtDep;}
156 Bool_t GetDCAToVertex2D() const { return fCutDCAToVertex2D;}
157 Bool_t GetRequireSigmaToVertex( ) const { return fCutSigmaToVertexRequired;}
158
159 void GetPRange(Float_t& r1, Float_t& r2) const {r1=fPMin; r2=fPMax;}
160 void GetPtRange(Float_t& r1, Float_t& r2) const {r1=fPtMin; r2=fPtMax;}
161 void GetPxRange(Float_t& r1, Float_t& r2) const {r1=fPxMin; r2=fPxMax;}
162 void GetPyRange(Float_t& r1, Float_t& r2) const {r1=fPyMin; r2=fPyMax;}
163 void GetPzRange(Float_t& r1, Float_t& r2) const {r1=fPzMin; r2=fPzMax;}
164 void GetEtaRange(Float_t& r1, Float_t& r2) const {r1=fEtaMin; r2=fEtaMax;}
165 void GetRapRange(Float_t& r1, Float_t& r2) const {r1=fRapMin; r2=fRapMax;}
166
167 // track kinmatic cut setters
168 void SetPRange(Float_t r1=0, Float_t r2=1e10) {fPMin=r1; fPMax=r2;}
169 void SetPtRange(Float_t r1=0, Float_t r2=1e10) {fPtMin=r1; fPtMax=r2;}
170 void SetPxRange(Float_t r1=-1e10, Float_t r2=1e10) {fPxMin=r1; fPxMax=r2;}
171 void SetPyRange(Float_t r1=-1e10, Float_t r2=1e10) {fPyMin=r1; fPyMax=r2;}
172 void SetPzRange(Float_t r1=-1e10, Float_t r2=1e10) {fPzMin=r1; fPzMax=r2;}
173 void SetEtaRange(Float_t r1=-1e10, Float_t r2=1e10) {fEtaMin=r1; fEtaMax=r2;}
174 void SetRapRange(Float_t r1=-1e10, Float_t r2=1e10) {fRapMin=r1; fRapMax=r2;}
175
176 //######################################################
177 void SetHistogramsOn(Bool_t b=kFALSE) {fHistogramsOn = b;}
178 void DefineHistograms(Int_t color=1);
179 virtual Bool_t LoadHistograms(const Char_t* dir = 0);
180 void SaveHistograms(const Char_t* dir = 0);
181 void DrawHistograms();
182
183 static Float_t GetSigmaToVertex(const AliESDtrack* const esdTrack);
184
185 static void EnableNeededBranches(TTree* tree);
186
187 // void SaveQualityCuts(Char_t* file)
188 // void LoadQualityCuts(Char_t* file)
189
190 TH1F* GetDZNormalized(Int_t i) const { return fhDZNormalized[i]; }
191 TH1F* GetNClustersTPC(Int_t i) const { return fhNClustersTPC[i]; }
192 TH1F* GetPtHist(Int_t i) const { return fhPt[i]; }
193
194 // TOF cuts
195 void SetFlagCutTOFdistance(Bool_t flagTOFcut) { fFlagCutTOFdistance = flagTOFcut;}
196 Bool_t GetFlagCutTOFdistance() const { return fFlagCutTOFdistance;}
197 void SetCutTOFdistance(Float_t cut) { fCutTOFdistance = cut;}
198 Float_t GetCutTOFdistance() const { return fCutTOFdistance;}
199 void SetRequireTOFout(Bool_t b = kFALSE) {fCutRequireTOFout = b;}
200 void SetRequireStandardTOFmatchCuts();
201
202protected:
203 void Init(); // sets everything to 0
204 Bool_t CheckITSClusterRequirement(ITSClusterRequirement req, Bool_t clusterL1, Bool_t clusterL2);
205 Bool_t CheckPtDepDCA(TString dist,Bool_t print=kFALSE) const;
206 void SetPtDepDCACuts(Double_t pt);
207
208 enum { kNCuts = 42 };
209
210 //######################################################
211 // esd track quality cuts
212 static const Char_t* fgkCutNames[kNCuts]; //! names of cuts (for internal use)
213 static AliESDtrackCuts* fgMultEstTrackCuts[kNMultEstTrackCuts]; //! track cuts used for the multiplicity estimate
214
215 Int_t fCutMinNClusterTPC; // min number of tpc clusters
216 Int_t fCutMinNClusterITS; // min number of its clusters
217 Float_t fCutMinNCrossedRowsTPC; // min number of tpc crossed rows
218 Float_t fCutMinRatioCrossedRowsOverFindableClustersTPC; // min ratio crossed rows / findable clusters
219 TFormula *f1CutMinNClustersTPCPtDep; // pt dependent tpc clusters cut
220 Float_t fCutMaxPtDepNClustersTPC; // maximum pt for pt dependend TPC cluster cut. For pt=>ptmax NClusterMin = f1CutMinNClustersTPCPtDep->Eval(fCutMaxPtDepNClustersTPC).
221
222 ITSClusterRequirement fCutClusterRequirementITS[3]; // detailed ITS cluster requirements for (SPD, SDD, SSD)
223
224 Float_t fCutMaxChi2PerClusterTPC; // max tpc fit chi2 per tpc cluster
225 Float_t fCutMaxChi2PerClusterITS; // max its fit chi2 per its cluster
226 Float_t fCutMaxChi2TPCConstrainedVsGlobal; // max chi2 TPC track constrained with vtx vs. global track
227 Int_t fCutMaxChi2TPCConstrainedVsGlobalVertexType; // vertex type for max chi2 TPC track constrained with vtx vs. global track (can be configured to accept several vertex types)
228 Int_t fCutMaxMissingITSPoints; // max n. of missing ITS points
229
230 Float_t fCutMaxC11; // max cov. matrix diag. elements (res. y^2)
231 Float_t fCutMaxC22; // max cov. matrix diag. elements (res. z^2)
232 Float_t fCutMaxC33; // max cov. matrix diag. elements (res. sin(phi)^2)
233 Float_t fCutMaxC44; // max cov. matrix diag. elements (res. tan(theta_dip)^2)
234 Float_t fCutMaxC55; // max cov. matrix diag. elements (res. 1/pt^2)
235
236 Float_t fCutMaxRel1PtUncertainty; // max relative uncertainty of 1/pt
237
238 Bool_t fCutAcceptKinkDaughters; // accepting kink daughters?
239 Bool_t fCutAcceptSharedTPCClusters;// accepting shared clusters in TPC?
240 Float_t fCutMaxFractionSharedTPCClusters; //Maximum fraction of shared clusters in TPC
241 Bool_t fCutRequireTPCRefit; // require TPC refit
242 Bool_t fCutRequireTPCStandAlone; // require TPC standalone tracks
243 Bool_t fCutRequireITSRefit; // require ITS refit
244 Bool_t fCutRequireITSPid; // require ITS pid
245 Bool_t fCutRequireITSStandAlone; // require ITS standalone tracks (remove pure SA)
246 Bool_t fCutRequireITSpureSA; // require ITS pure standalone tracks (found using all ITS clusters)
247
248
249 // track to vertex cut
250 Float_t fCutNsigmaToVertex; // max number of estimated sigma from track-to-vertex
251 Bool_t fCutSigmaToVertexRequired; // cut track if sigma from track-to-vertex could not be calculated
252 Float_t fCutMaxDCAToVertexXY; // track-to-vertex cut in max absolute distance in xy-plane
253 Float_t fCutMaxDCAToVertexZ; // track-to-vertex cut in max absolute distance in z-plane
254 Float_t fCutMinDCAToVertexXY; // track-to-vertex cut on min absolute distance in xy-plane
255 Float_t fCutMinDCAToVertexZ; // track-to-vertex cut on min absolute distance in z-plane
256 //
257 TString fCutMaxDCAToVertexXYPtDep; // pt-dep track-to-vertex cut in max absolute distance in xy-plane
258 TString fCutMaxDCAToVertexZPtDep; // pt-dep track-to-vertex cut in max absolute distance in z-plane
259 TString fCutMinDCAToVertexXYPtDep; // pt-dep track-to-vertex cut on min absolute distance in xy-plane
260 TString fCutMinDCAToVertexZPtDep; // pt-dep track-to-vertex cut on min absolute distance in z-plane
261
262 // only internal use, set via strings above
263 TFormula *f1CutMaxDCAToVertexXYPtDep; // pt-dep track-to-vertex cut in max absolute distance in xy-plane
264 TFormula *f1CutMaxDCAToVertexZPtDep; // pt-dep track-to-vertex cut in max absolute distance in z-plane
265 TFormula *f1CutMinDCAToVertexXYPtDep; // pt-dep track-to-vertex cut on min absolute distance in xy-plane
266 TFormula *f1CutMinDCAToVertexZPtDep; // pt-dep track-to-vertex cut on min absolute distance in z-plane
267
268 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
269
270 // esd kinematics cuts
271 Float_t fPMin, fPMax; // definition of the range of the P
272 Float_t fPtMin, fPtMax; // definition of the range of the Pt
273 Float_t fPxMin, fPxMax; // definition of the range of the Px
274 Float_t fPyMin, fPyMax; // definition of the range of the Py
275 Float_t fPzMin, fPzMax; // definition of the range of the Pz
276 Float_t fEtaMin, fEtaMax; // definition of the range of the eta
277 Float_t fRapMin, fRapMax; // definition of the range of the y
278
279 Bool_t fCutRequireTOFout; // require TOF out
280 Bool_t fFlagCutTOFdistance; // cut on TOFdistance? --> yes by default!
281 Float_t fCutTOFdistance; // value of the cut on TOFdistance
282 static Char_t fgBeamTypeFlag; // -1 --> no check done on the beam type yet
283 // 0 --> beam type != "A-A"
284 // 1 --> beam type == "A-A"
285
286 //######################################################
287 // diagnostics histograms
288 Bool_t fHistogramsOn; // histograms on/off
289
290 TH1F* fhNClustersITS[2]; //->
291 TH1F* fhNClustersTPC[2]; //->
292 TH1F* fhNSharedClustersTPC[2]; //->
293 TH1F* fhNCrossedRowsTPC[2]; //->
294 TH1F* fhRatioCrossedRowsOverFindableClustersTPC[2]; // ->
295
296 TH1F* fhChi2PerClusterITS[2]; //->
297 TH1F* fhChi2PerClusterTPC[2]; //->
298 TH1F* fhChi2TPCConstrainedVsGlobal[2]; //->
299 TH1F* fhNClustersForITSPID[2]; //-> number of points in SDD+SSD (ITS PID selection)
300 TH1F* fhNMissingITSPoints[2]; //-> number of missing ITS points
301
302 TH1F* fhC11[2]; //->
303 TH1F* fhC22[2]; //->
304 TH1F* fhC33[2]; //->
305 TH1F* fhC44[2]; //->
306 TH1F* fhC55[2]; //->
307
308 TH1F* fhRel1PtUncertainty[2]; //-> rel. uncertainty of 1/pt
309
310 TH1F* fhDXY[2]; //->
311 TH1F* fhDZ[2]; //->
312 TH1F* fhDXYDZ[2]; //-> absolute distance sqrt(dxy**2 + dz**2) to vertex; if 2D cut is set, normalized to given values
313 TH2F* fhDXYvsDZ[2]; //->
314
315 TH1F* fhDXYNormalized[2]; //->
316 TH1F* fhDZNormalized[2]; //->
317 TH2F* fhDXYvsDZNormalized[2]; //->
318 TH1F* fhNSigmaToVertex[2]; //->
319
320 TH1F* fhPt[2]; //-> pt of esd tracks
321 TH1F* fhEta[2]; //-> eta of esd tracks
322
323 TF1* ffDTheoretical; //-> theoretical distance to vertex normalized (2d gauss)
324
325 TH1F* fhCutStatistics; //-> statistics of what cuts the tracks did not survive
326 TH2F* fhCutCorrelation; //-> 2d statistics plot
327
328 TH2F* fhTOFdistance[2]; //-> TOF signal distance dx vs dz
329
330 ClassDef(AliESDtrackCuts, 20)
331};
332
333
334#endif