2 // Class for handling of ESD track cuts.
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.
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
21 #ifndef ALIESDTRACKCUTS_H
22 #define ALIESDTRACKCUTS_H
26 #include "AliAnalysisCuts.h"
33 class AliESDtrackCuts : public AliAnalysisCuts
36 enum ITSClusterRequirement { kOff = 0, kNone, kAny, kFirst, kOnlyFirst, kSecond, kOnlySecond, kBoth };
37 enum Detector { kSPD = 0, kSDD, kSSD };
39 AliESDtrackCuts(const Char_t* name = "AliESDtrackCuts", const Char_t* title = "");
40 virtual ~AliESDtrackCuts();
42 Bool_t IsSelected(TObject* obj)
43 {return AcceptTrack((AliESDtrack*)obj);}
44 Bool_t IsSelected(TList* /*list*/) {return kTRUE;}
46 Bool_t AcceptTrack(AliESDtrack* esdTrack);
47 TObjArray* GetAcceptedTracks(AliESDEvent* esd, Bool_t bTPC = kFALSE);
48 Int_t CountAcceptedTracks(AliESDEvent* esd);
50 static AliESDtrack* GetTPCOnlyTrack(AliESDEvent* esd, Int_t iTrack);
52 virtual Long64_t Merge(TCollection* list);
53 virtual void Copy(TObject &c) const;
54 AliESDtrackCuts(const AliESDtrackCuts& pd); // Copy Constructor
55 AliESDtrackCuts &operator=(const AliESDtrackCuts &c);
57 //######################################################
58 // track quality cut setters
59 void SetMinNClustersTPC(Int_t min=-1) {fCutMinNClusterTPC=min;}
60 void SetMinNClustersITS(Int_t min=-1) {fCutMinNClusterITS=min;}
61 void SetClusterRequirementITS(Detector det, ITSClusterRequirement req = kOff) { fCutClusterRequirementITS[det] = req; }
62 void SetMaxChi2PerClusterTPC(Float_t max=1e10) {fCutMaxChi2PerClusterTPC=max;}
63 void SetMaxChi2PerClusterITS(Float_t max=1e10) {fCutMaxChi2PerClusterITS=max;}
64 void SetRequireTPCRefit(Bool_t b=kFALSE) {fCutRequireTPCRefit=b;}
65 void SetRequireITSRefit(Bool_t b=kFALSE) {fCutRequireITSRefit=b;}
66 void SetAcceptKingDaughters(Bool_t b=kFALSE) {fCutAcceptKinkDaughters=b;}
67 void SetMaxCovDiagonalElements(Float_t c1=1e10, Float_t c2=1e10, Float_t c3=1e10, Float_t c4=1e10, Float_t c5=1e10)
68 {fCutMaxC11=c1; fCutMaxC22=c2; fCutMaxC33=c3; fCutMaxC44=c4; fCutMaxC55=c5;}
70 // track to vertex cut setters
71 void SetMaxNsigmaToVertex(Float_t sigma=1e10) {fCutNsigmaToVertex = sigma; SetRequireSigmaToVertex(kTRUE);}
72 void SetRequireSigmaToVertex(Bool_t b=kTRUE ) {fCutSigmaToVertexRequired = b;}
73 void SetMaxDCAToVertexXY(Float_t dist=1e10) {fCutMaxDCAToVertexXY = dist;}
74 void SetMaxDCAToVertexZ(Float_t dist=1e10) {fCutMaxDCAToVertexZ = dist;}
75 void SetMinDCAToVertexXY(Float_t dist=0.) {fCutMinDCAToVertexXY = dist;}
76 void SetMinDCAToVertexZ(Float_t dist=0.) {fCutMinDCAToVertexZ = dist;}
77 void SetDCAToVertex2D(Bool_t b=kFALSE) {fCutDCAToVertex2D = b;}
79 // deprecated, will be removed in next release
80 void SetMaxDCAToVertex(Float_t dist=1e10);
81 void SetMinNsigmaToVertex(Float_t sigma=1e10);
82 void SetDCAToVertex(Float_t dist=1e10);
83 void SetDCAToVertexXY(Float_t dist=1e10);
84 void SetDCAToVertexZ(Float_t dist=1e10);
85 Float_t GetMinNsigmaToVertex() const;
89 Int_t GetMinNClusterTPC() const { return fCutMinNClusterTPC;}
90 Int_t GetMinNClustersITS() const { return fCutMinNClusterITS;}
91 ITSClusterRequirement GetClusterRequirementITS(Detector det) const { return fCutClusterRequirementITS[det]; }
92 Float_t GetMaxChi2PerClusterTPC() const { return fCutMaxChi2PerClusterTPC;}
93 Float_t GetMaxChi2PerClusterITS() const { return fCutMaxChi2PerClusterITS;}
94 Bool_t GetRequireTPCRefit() const { return fCutRequireTPCRefit;}
95 Bool_t GetRequireITSRefit() const { return fCutRequireITSRefit;}
96 Bool_t GetAcceptKingDaughters() const { return fCutAcceptKinkDaughters;}
97 void GetMaxCovDiagonalElements(Float_t& c1, Float_t& c2, Float_t& c3, Float_t& c4, Float_t& c5)
98 {c1 = fCutMaxC11; c2 = fCutMaxC22; c3 = fCutMaxC33; c4 = fCutMaxC44; c5 = fCutMaxC55;}
99 Float_t GetMaxNsigmaToVertex() const { return fCutNsigmaToVertex;}
100 Float_t GetMaxDCAToVertexXY() const { return fCutMaxDCAToVertexXY;}
101 Float_t GetMaxDCAToVertexZ() const { return fCutMaxDCAToVertexZ;}
102 Float_t GetMinDCAToVertexXY() const { return fCutMinDCAToVertexXY;}
103 Float_t GetMinDCAToVertexZ() const { return fCutMinDCAToVertexZ;}
104 Bool_t GetDCAToVertex2D() const { return fCutDCAToVertex2D;}
105 Bool_t GetRequireSigmaToVertex( ) const { return fCutSigmaToVertexRequired;}
107 void GetPRange(Float_t& r1, Float_t& r2) {r1=fPMin; r2=fPMax;}
108 void GetPtRange(Float_t& r1, Float_t& r2) {r1=fPtMin; r2=fPtMax;}
109 void GetPxRange(Float_t& r1, Float_t& r2) {r1=fPxMin; r2=fPxMax;}
110 void GetPyRange(Float_t& r1, Float_t& r2) {r1=fPyMin; r2=fPyMax;}
111 void GetPzRange(Float_t& r1, Float_t& r2) {r1=fPzMin; r2=fPzMax;}
112 void GetEtaRange(Float_t& r1, Float_t& r2) {r1=fEtaMin; r2=fEtaMax;}
113 void GetRapRange(Float_t& r1, Float_t& r2) {r1=fRapMin; r2=fRapMax;}
115 // track kinmatic cut setters
116 void SetPRange(Float_t r1=0, Float_t r2=1e10) {fPMin=r1; fPMax=r2;}
117 void SetPtRange(Float_t r1=0, Float_t r2=1e10) {fPtMin=r1; fPtMax=r2;}
118 void SetPxRange(Float_t r1=-1e10, Float_t r2=1e10) {fPxMin=r1; fPxMax=r2;}
119 void SetPyRange(Float_t r1=-1e10, Float_t r2=1e10) {fPyMin=r1; fPyMax=r2;}
120 void SetPzRange(Float_t r1=-1e10, Float_t r2=1e10) {fPzMin=r1; fPzMax=r2;}
121 void SetEtaRange(Float_t r1=-1e10, Float_t r2=1e10) {fEtaMin=r1; fEtaMax=r2;}
122 void SetRapRange(Float_t r1=-1e10, Float_t r2=1e10) {fRapMin=r1; fRapMax=r2;}
124 //######################################################
125 void SetHistogramsOn(Bool_t b=kFALSE) {fHistogramsOn = b;}
126 void DefineHistograms(Int_t color=1);
127 virtual Bool_t LoadHistograms(const Char_t* dir = 0);
128 void SaveHistograms(const Char_t* dir = 0);
129 void DrawHistograms();
131 static Float_t GetSigmaToVertex(AliESDtrack* esdTrack);
133 static void EnableNeededBranches(TTree* tree);
135 // void SaveQualityCuts(Char_t* file)
136 // void LoadQualityCuts(Char_t* file)
138 TH1* GetDZNormalized(Int_t i) const { return fhDZNormalized[i]; }
141 void Init(); // sets everything to 0
142 Bool_t CheckITSClusterRequirement(ITSClusterRequirement req, Bool_t clusterL1, Bool_t clusterL2);
144 enum { kNCuts = 30 };
146 //######################################################
147 // esd track quality cuts
148 static const Char_t* fgkCutNames[kNCuts]; //! names of cuts (for internal use)
150 Int_t fCutMinNClusterTPC; // min number of tpc clusters
151 Int_t fCutMinNClusterITS; // min number of its clusters
153 ITSClusterRequirement fCutClusterRequirementITS[3]; // detailed ITS cluster requirements for (SPD, SDD, SSD)
155 Float_t fCutMaxChi2PerClusterTPC; // max tpc fit chi2 per tpc cluster
156 Float_t fCutMaxChi2PerClusterITS; // max its fit chi2 per its cluster
158 Float_t fCutMaxC11; // max cov. matrix diag. elements (res. y^2)
159 Float_t fCutMaxC22; // max cov. matrix diag. elements (res. z^2)
160 Float_t fCutMaxC33; // max cov. matrix diag. elements (res. sin(phi)^2)
161 Float_t fCutMaxC44; // max cov. matrix diag. elements (res. tan(theta_dip)^2)
162 Float_t fCutMaxC55; // max cov. matrix diag. elements (res. 1/pt^2)
164 Bool_t fCutAcceptKinkDaughters; // accepting kink daughters?
165 Bool_t fCutRequireTPCRefit; // require TPC refit
166 Bool_t fCutRequireITSRefit; // require ITS refit
168 // track to vertex cut
169 Float_t fCutNsigmaToVertex; // max number of estimated sigma from track-to-vertex
170 Bool_t fCutSigmaToVertexRequired; // cut track if sigma from track-to-vertex could not be calculated
171 Float_t fCutMaxDCAToVertexXY; // track-to-vertex cut in max absolute distance in xy-plane
172 Float_t fCutMaxDCAToVertexZ; // track-to-vertex cut in max absolute distance in z-plane
173 Float_t fCutMinDCAToVertexXY; // track-to-vertex cut on min absolute distance in xy-plane
174 Float_t fCutMinDCAToVertexZ; // track-to-vertex cut on min absolute distance in z-plane
175 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
177 // esd kinematics cuts
178 Float_t fPMin, fPMax; // definition of the range of the P
179 Float_t fPtMin, fPtMax; // definition of the range of the Pt
180 Float_t fPxMin, fPxMax; // definition of the range of the Px
181 Float_t fPyMin, fPyMax; // definition of the range of the Py
182 Float_t fPzMin, fPzMax; // definition of the range of the Pz
183 Float_t fEtaMin, fEtaMax; // definition of the range of the eta
184 Float_t fRapMin, fRapMax; // definition of the range of the y
186 //######################################################
187 // diagnostics histograms
188 Bool_t fHistogramsOn; // histograms on/off
190 TH1F* fhNClustersITS[2]; //->
191 TH1F* fhNClustersTPC[2]; //->
193 TH1F* fhChi2PerClusterITS[2]; //->
194 TH1F* fhChi2PerClusterTPC[2]; //->
204 TH1F* fhDXYDZ[2]; //-> absolute distance sqrt(dxy**2 + dz**2) to vertex; if 2D cut is set, normalized to given values
205 TH2F* fhDXYvsDZ[2]; //->
207 TH1F* fhDXYNormalized[2]; //->
208 TH1F* fhDZNormalized[2]; //->
209 TH2F* fhDXYvsDZNormalized[2]; //->
210 TH1F* fhNSigmaToVertex[2]; //->
212 TH1F* fhPt[2]; //-> pt of esd tracks
213 TH1F* fhEta[2]; //-> eta of esd tracks
215 TF1* ffDTheoretical; //-> theoretical distance to vertex normalized (2d gauss)
217 TH1F* fhCutStatistics; //-> statistics of what cuts the tracks did not survive
218 TH2F* fhCutCorrelation; //-> 2d statistics plot
220 ClassDef(AliESDtrackCuts, 5)