]>
Commit | Line | Data |
---|---|---|
563113d0 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | // The class AliCFTrackIsPrimaryCut is designed to select reconstructed tracks | |
17 | // with a small impact parameter and tracks which are (not) daughters of kink | |
18 | // decays and to provide corresponding QA histograms. | |
19 | // This class inherits from the Analysis' Framework abstract base class | |
20 | // AliAnalysisCuts and is a part of the Correction Framework. | |
21 | // This class acts on single, reconstructed tracks, it is applicable on | |
22 | // ESD and AOD data. | |
23 | // It mainly consists of a IsSelected function that returns a boolean. | |
24 | // This function checks whether the considered track passes a set of cuts: | |
89d7d478 | 25 | // - min. and max. distance to main vertex in transverse plane (xy) |
26 | // - min. and max. longitudinal distance to main vertex (z) | |
27 | // - min. and max. distance to main vertex as ellpise in xy - z plane | |
28 | // - all above cuts on absolute values or in units of sigma (resolution) | |
29 | // - min. and max. distance to main vertex in units of sigma (resolution) | |
30 | // - max. transverse (xy) and longitudinal (z) impact parameter resolution | |
563113d0 | 31 | // - require that the dca calculation doesn't fail |
32 | // - accept or not accept daughter tracks of kink decays | |
33 | // | |
c66800ea | 34 | // By default, the distance to 'vertex calculated from tracks' is used. |
c2c45ca4 | 35 | // Optionally the SPD (tracklet based) or TPC (TPC only tracks based) vertex |
36 | // can be used. | |
37 | // Note: the distance to the TPC-vertex is already stored in the ESD, | |
38 | // the distance to the SPD-vertex has to be re-calculated by propagating each | |
39 | // track while executing this cut. | |
c66800ea | 40 | // |
563113d0 | 41 | // The cut values for these cuts are set with the corresponding set functions. |
42 | // All cut classes provided by the correction framework are supposed to be | |
43 | // added in the Analysis Framwork's class AliAnalysisFilter and applied by | |
44 | // the filter via a loop. | |
45 | // | |
46 | // author: I. Kraus (Ingrid.Kraus@cern.ch) | |
47 | // idea taken form | |
48 | // AliESDtrackCuts writte by Jan Fiete Grosse-Oetringhaus and | |
49 | // AliRsnDaughterCut class written by A. Pulvirenti. | |
50 | ||
51 | #include <TCanvas.h> | |
52 | #include <TDirectory.h> | |
563113d0 | 53 | #include <TH2.h> |
62037e79 | 54 | #include <TBits.h> |
55 | ||
563113d0 | 56 | #include <AliESDtrack.h> |
03f487b1 | 57 | #include <AliAODTrack.h> |
8f7575ff | 58 | #include <AliESDEvent.h> |
03f487b1 | 59 | #include <AliAODEvent.h> |
563113d0 | 60 | #include <AliLog.h> |
61 | #include "AliCFTrackIsPrimaryCuts.h" | |
62 | ||
63 | ClassImp(AliCFTrackIsPrimaryCuts) | |
64 | ||
65 | //__________________________________________________________________________________ | |
66 | AliCFTrackIsPrimaryCuts::AliCFTrackIsPrimaryCuts() : | |
67 | AliCFCutBase(), | |
03f487b1 | 68 | fEvt(0x0), |
c2c45ca4 | 69 | fUseSPDvertex(0), |
c66800ea | 70 | fUseTPCvertex(0), |
89d7d478 | 71 | fMinDCAToVertexXY(0), |
72 | fMinDCAToVertexZ(0), | |
73 | fMaxDCAToVertexXY(0), | |
74 | fMaxDCAToVertexZ(0), | |
75 | fDCAToVertex2D(0), | |
76 | fAbsDCAToVertex(0), | |
77 | fNSigmaToVertexMin(0), | |
563113d0 | 78 | fNSigmaToVertexMax(0), |
89d7d478 | 79 | fSigmaDCAxy(0), |
80 | fSigmaDCAz(0), | |
563113d0 | 81 | fRequireSigmaToVertex(0), |
8edd0c2c | 82 | fAODType(AliAODTrack::kUndef), |
563113d0 | 83 | fAcceptKinkDaughters(0), |
84 | fhCutStatistics(0), | |
85 | fhCutCorrelation(0), | |
86 | fBitmap(0x0), | |
87 | fhNBinsNSigma(0), | |
88 | fhNBinsRequireSigma(0), | |
89 | fhNBinsAcceptKink(0), | |
90 | fhNBinsDcaXY(0), | |
91 | fhNBinsDcaZ(0), | |
92 | fhNBinsDcaXYnorm(0), | |
93 | fhNBinsDcaZnorm(0), | |
89d7d478 | 94 | fhNBinsSigmaDcaXY(0), |
95 | fhNBinsSigmaDcaZ(0), | |
563113d0 | 96 | fhBinLimNSigma(0x0), |
97 | fhBinLimRequireSigma(0x0), | |
98 | fhBinLimAcceptKink(0x0), | |
99 | fhBinLimDcaXY(0x0), | |
100 | fhBinLimDcaZ(0x0), | |
101 | fhBinLimDcaXYnorm(0x0), | |
89d7d478 | 102 | fhBinLimDcaZnorm(0x0), |
103 | fhBinLimSigmaDcaXY(0x0), | |
104 | fhBinLimSigmaDcaZ(0x0) | |
563113d0 | 105 | { |
106 | // | |
107 | // Default constructor | |
108 | // | |
563113d0 | 109 | Initialise(); |
110 | } | |
111 | //__________________________________________________________________________________ | |
112 | AliCFTrackIsPrimaryCuts::AliCFTrackIsPrimaryCuts(Char_t* name, Char_t* title) : | |
113 | AliCFCutBase(name,title), | |
03f487b1 | 114 | fEvt(0x0), |
c2c45ca4 | 115 | fUseSPDvertex(0), |
c66800ea | 116 | fUseTPCvertex(0), |
89d7d478 | 117 | fMinDCAToVertexXY(0), |
118 | fMinDCAToVertexZ(0), | |
119 | fMaxDCAToVertexXY(0), | |
120 | fMaxDCAToVertexZ(0), | |
121 | fDCAToVertex2D(0), | |
122 | fAbsDCAToVertex(0), | |
123 | fNSigmaToVertexMin(0), | |
563113d0 | 124 | fNSigmaToVertexMax(0), |
89d7d478 | 125 | fSigmaDCAxy(0), |
126 | fSigmaDCAz(0), | |
563113d0 | 127 | fRequireSigmaToVertex(0), |
8edd0c2c | 128 | fAODType(AliAODTrack::kUndef), |
563113d0 | 129 | fAcceptKinkDaughters(0), |
130 | fhCutStatistics(0), | |
131 | fhCutCorrelation(0), | |
132 | fBitmap(0x0), | |
133 | fhNBinsNSigma(0), | |
134 | fhNBinsRequireSigma(0), | |
135 | fhNBinsAcceptKink(0), | |
136 | fhNBinsDcaXY(0), | |
137 | fhNBinsDcaZ(0), | |
138 | fhNBinsDcaXYnorm(0), | |
139 | fhNBinsDcaZnorm(0), | |
89d7d478 | 140 | fhNBinsSigmaDcaXY(0), |
141 | fhNBinsSigmaDcaZ(0), | |
563113d0 | 142 | fhBinLimNSigma(0x0), |
143 | fhBinLimRequireSigma(0x0), | |
144 | fhBinLimAcceptKink(0x0), | |
145 | fhBinLimDcaXY(0x0), | |
146 | fhBinLimDcaZ(0x0), | |
147 | fhBinLimDcaXYnorm(0x0), | |
89d7d478 | 148 | fhBinLimDcaZnorm(0x0), |
149 | fhBinLimSigmaDcaXY(0x0), | |
150 | fhBinLimSigmaDcaZ(0x0) | |
563113d0 | 151 | { |
152 | // | |
153 | // Constructor | |
154 | // | |
563113d0 | 155 | Initialise(); |
156 | } | |
157 | //__________________________________________________________________________________ | |
158 | AliCFTrackIsPrimaryCuts::AliCFTrackIsPrimaryCuts(const AliCFTrackIsPrimaryCuts& c) : | |
159 | AliCFCutBase(c), | |
03f487b1 | 160 | fEvt(c.fEvt), |
c2c45ca4 | 161 | fUseSPDvertex(c.fUseSPDvertex), |
c66800ea | 162 | fUseTPCvertex(c.fUseTPCvertex), |
89d7d478 | 163 | fMinDCAToVertexXY(c.fMinDCAToVertexXY), |
164 | fMinDCAToVertexZ(c.fMinDCAToVertexZ), | |
165 | fMaxDCAToVertexXY(c.fMaxDCAToVertexXY), | |
166 | fMaxDCAToVertexZ(c.fMaxDCAToVertexZ), | |
167 | fDCAToVertex2D(c.fDCAToVertex2D), | |
168 | fAbsDCAToVertex(c.fAbsDCAToVertex), | |
169 | fNSigmaToVertexMin(c.fNSigmaToVertexMin), | |
563113d0 | 170 | fNSigmaToVertexMax(c.fNSigmaToVertexMax), |
89d7d478 | 171 | fSigmaDCAxy(c.fSigmaDCAxy), |
172 | fSigmaDCAz(c.fSigmaDCAz), | |
563113d0 | 173 | fRequireSigmaToVertex(c.fRequireSigmaToVertex), |
8edd0c2c | 174 | fAODType(c.fAODType), |
563113d0 | 175 | fAcceptKinkDaughters(c.fAcceptKinkDaughters), |
176 | fhCutStatistics(c.fhCutStatistics), | |
177 | fhCutCorrelation(c.fhCutCorrelation), | |
178 | fBitmap(c.fBitmap), | |
179 | fhNBinsNSigma(c.fhNBinsNSigma), | |
180 | fhNBinsRequireSigma(c.fhNBinsRequireSigma), | |
181 | fhNBinsAcceptKink(c.fhNBinsAcceptKink), | |
182 | fhNBinsDcaXY(c.fhNBinsDcaXY), | |
183 | fhNBinsDcaZ(c.fhNBinsDcaZ), | |
184 | fhNBinsDcaXYnorm(c.fhNBinsDcaXYnorm), | |
185 | fhNBinsDcaZnorm(c.fhNBinsDcaZnorm), | |
89d7d478 | 186 | fhNBinsSigmaDcaXY(c.fhNBinsSigmaDcaXY), |
187 | fhNBinsSigmaDcaZ(c.fhNBinsSigmaDcaZ), | |
563113d0 | 188 | fhBinLimNSigma(c.fhBinLimNSigma), |
189 | fhBinLimRequireSigma(c.fhBinLimRequireSigma), | |
190 | fhBinLimAcceptKink(c.fhBinLimAcceptKink), | |
191 | fhBinLimDcaXY(c.fhBinLimDcaXY), | |
192 | fhBinLimDcaZ(c.fhBinLimDcaZ), | |
193 | fhBinLimDcaXYnorm(c.fhBinLimDcaXYnorm), | |
89d7d478 | 194 | fhBinLimDcaZnorm(c.fhBinLimDcaZnorm), |
195 | fhBinLimSigmaDcaXY(c.fhBinLimSigmaDcaXY), | |
196 | fhBinLimSigmaDcaZ(c.fhBinLimSigmaDcaZ) | |
563113d0 | 197 | { |
198 | // | |
199 | // copy constructor | |
200 | // | |
201 | ((AliCFTrackIsPrimaryCuts &) c).Copy(*this); | |
202 | } | |
203 | //__________________________________________________________________________________ | |
204 | AliCFTrackIsPrimaryCuts& AliCFTrackIsPrimaryCuts::operator=(const AliCFTrackIsPrimaryCuts& c) | |
205 | { | |
206 | // | |
207 | // Assignment operator | |
208 | // | |
209 | if (this != &c) { | |
210 | AliCFCutBase::operator=(c) ; | |
03f487b1 | 211 | fEvt = c.fEvt; |
c2c45ca4 | 212 | fUseSPDvertex = c.fUseSPDvertex; |
c66800ea | 213 | fUseTPCvertex = c.fUseTPCvertex; |
89d7d478 | 214 | fMinDCAToVertexXY = c.fMinDCAToVertexXY; |
215 | fMinDCAToVertexZ = c.fMinDCAToVertexZ; | |
216 | fMaxDCAToVertexXY = c.fMaxDCAToVertexXY; | |
217 | fMaxDCAToVertexZ = c.fMaxDCAToVertexZ; | |
218 | fDCAToVertex2D = c.fDCAToVertex2D; | |
219 | fAbsDCAToVertex = c.fAbsDCAToVertex; | |
220 | fNSigmaToVertexMin = c.fNSigmaToVertexMin ; | |
563113d0 | 221 | fNSigmaToVertexMax = c.fNSigmaToVertexMax ; |
89d7d478 | 222 | fSigmaDCAxy = c.fSigmaDCAxy ; |
223 | fSigmaDCAz = c.fSigmaDCAz ; | |
563113d0 | 224 | fRequireSigmaToVertex = c.fRequireSigmaToVertex ; |
8edd0c2c | 225 | fAODType = c.fAODType ; |
563113d0 | 226 | fAcceptKinkDaughters = c.fAcceptKinkDaughters ; |
227 | fhCutStatistics = c.fhCutStatistics ; | |
228 | fhCutCorrelation = c.fhCutCorrelation ; | |
229 | fBitmap = c.fBitmap; | |
230 | fhNBinsNSigma = c.fhNBinsNSigma; | |
231 | fhNBinsRequireSigma = c.fhNBinsRequireSigma; | |
232 | fhNBinsAcceptKink = c.fhNBinsAcceptKink; | |
233 | fhNBinsDcaXY = c.fhNBinsDcaXY; | |
234 | fhNBinsDcaZ = c.fhNBinsDcaZ; | |
235 | fhNBinsDcaXYnorm = c.fhNBinsDcaXYnorm; | |
236 | fhNBinsDcaZnorm = c.fhNBinsDcaZnorm; | |
89d7d478 | 237 | fhNBinsSigmaDcaXY = c.fhNBinsSigmaDcaXY; |
238 | fhNBinsSigmaDcaZ = c.fhNBinsSigmaDcaZ; | |
563113d0 | 239 | fhBinLimNSigma = c.fhBinLimNSigma; |
240 | fhBinLimRequireSigma = c.fhBinLimRequireSigma; | |
241 | fhBinLimAcceptKink = c.fhBinLimAcceptKink; | |
242 | fhBinLimDcaXY = c.fhBinLimDcaXY; | |
243 | fhBinLimDcaZ = c.fhBinLimDcaZ; | |
244 | fhBinLimDcaXYnorm = c.fhBinLimDcaXYnorm; | |
245 | fhBinLimDcaZnorm = c.fhBinLimDcaZnorm; | |
89d7d478 | 246 | fhBinLimSigmaDcaXY = c.fhBinLimSigmaDcaXY; |
247 | fhBinLimSigmaDcaZ = c.fhBinLimSigmaDcaZ; | |
62037e79 | 248 | |
c66800ea | 249 | for (Int_t j=0; j<6; j++) fDCA[j] = c.fDCA[j]; |
8edd0c2c | 250 | for (Int_t j=0; j<c.kNStepQA; j++){ |
251 | if(c.fhDcaXYvsDcaZ[j]) fhDcaXYvsDcaZ[j] = (TH2F*)c.fhDcaXYvsDcaZ[j]->Clone(); | |
8edd0c2c | 252 | for (Int_t i=0; i<c.kNHist; i++){ |
563113d0 | 253 | if(c.fhQA[i][j]) fhQA[i][j] = (TH1F*)c.fhQA[i][j]->Clone(); |
563113d0 | 254 | } |
255 | } | |
563113d0 | 256 | ((AliCFTrackIsPrimaryCuts &) c).Copy(*this); |
257 | } | |
258 | return *this; | |
259 | } | |
260 | //__________________________________________________________________________________ | |
261 | AliCFTrackIsPrimaryCuts::~AliCFTrackIsPrimaryCuts() | |
262 | { | |
263 | // | |
264 | // destructor | |
265 | // | |
266 | if (fhCutStatistics) delete fhCutStatistics; | |
267 | if (fhCutCorrelation) delete fhCutCorrelation; | |
268 | ||
269 | for (Int_t j=0; j<kNStepQA; j++){ | |
62037e79 | 270 | if(fhDcaXYvsDcaZ[j]) delete fhDcaXYvsDcaZ[j]; |
62037e79 | 271 | for (Int_t i=0; i<kNHist; i++) |
272 | if(fhQA[i][j]) delete fhQA[i][j]; | |
563113d0 | 273 | } |
03f487b1 | 274 | if(fEvt) delete fEvt; |
62037e79 | 275 | if(fBitmap) delete fBitmap; |
276 | if(fhBinLimNSigma) delete fhBinLimNSigma; | |
277 | if(fhBinLimRequireSigma) delete fhBinLimRequireSigma; | |
278 | if(fhBinLimAcceptKink) delete fhBinLimAcceptKink; | |
279 | if(fhBinLimDcaXY) delete fhBinLimDcaXY; | |
280 | if(fhBinLimDcaZ) delete fhBinLimDcaZ; | |
281 | if(fhBinLimDcaXYnorm) delete fhBinLimDcaXYnorm; | |
282 | if(fhBinLimDcaZnorm) delete fhBinLimDcaZnorm; | |
89d7d478 | 283 | if(fhBinLimSigmaDcaXY) delete fhBinLimSigmaDcaXY; |
284 | if(fhBinLimSigmaDcaZ) delete fhBinLimSigmaDcaZ; | |
563113d0 | 285 | } |
286 | //__________________________________________________________________________________ | |
287 | void AliCFTrackIsPrimaryCuts::Initialise() | |
288 | { | |
289 | // | |
290 | // sets everything to zero | |
291 | // | |
c2c45ca4 | 292 | fUseSPDvertex = 0; |
c66800ea | 293 | fUseTPCvertex = 0; |
89d7d478 | 294 | fMinDCAToVertexXY = 0; |
295 | fMinDCAToVertexZ = 0; | |
296 | fMaxDCAToVertexXY = 0; | |
297 | fMaxDCAToVertexZ = 0; | |
298 | fDCAToVertex2D = 0; | |
299 | fAbsDCAToVertex = 0; | |
300 | fNSigmaToVertexMin = 0; | |
563113d0 | 301 | fNSigmaToVertexMax = 0; |
89d7d478 | 302 | fSigmaDCAxy = 0; |
303 | fSigmaDCAz = 0; | |
563113d0 | 304 | fRequireSigmaToVertex = 0; |
305 | fAcceptKinkDaughters = 0; | |
8edd0c2c | 306 | fAODType = AliAODTrack::kUndef; |
563113d0 | 307 | |
89d7d478 | 308 | SetMinDCAToVertexXY(); |
309 | SetMinDCAToVertexZ(); | |
310 | SetMaxDCAToVertexXY(); | |
311 | SetMaxDCAToVertexZ(); | |
312 | SetDCAToVertex2D(); | |
313 | SetAbsDCAToVertex(); | |
314 | SetMinNSigmaToVertex(); | |
563113d0 | 315 | SetMaxNSigmaToVertex(); |
89d7d478 | 316 | SetMaxSigmaDCAxy(); |
317 | SetMaxSigmaDCAz(); | |
563113d0 | 318 | SetRequireSigmaToVertex(); |
cced7196 | 319 | SetAcceptKinkDaughters(); |
8edd0c2c | 320 | SetAODType(); |
563113d0 | 321 | |
c66800ea | 322 | for (Int_t j=0; j<6; j++) fDCA[j] = 0.; |
563113d0 | 323 | for (Int_t j=0; j<kNStepQA; j++) { |
563113d0 | 324 | fhDcaXYvsDcaZ[j] = 0x0; |
62037e79 | 325 | for (Int_t i=0; i<kNHist; i++) |
326 | fhQA[i][j] = 0x0; | |
563113d0 | 327 | } |
328 | fhCutStatistics = 0; | |
329 | fhCutCorrelation = 0; | |
62037e79 | 330 | fBitmap=new TBits(0); |
331 | ||
563113d0 | 332 | //set default bining for QA histograms |
c66800ea | 333 | SetHistogramBins(kCutNSigmaToVertex,100,0.,10.); |
62037e79 | 334 | SetHistogramBins(kCutRequireSigmaToVertex,5,-0.75,1.75); |
335 | SetHistogramBins(kCutAcceptKinkDaughters,5,-0.75,1.75); | |
336 | SetHistogramBins(kDcaXY,500,-10.,10.); | |
337 | SetHistogramBins(kDcaZ,500,-10.,10.); | |
338 | SetHistogramBins(kDcaXYnorm,500,-10.,10.); | |
339 | SetHistogramBins(kDcaZnorm,500,-10.,10.); | |
89d7d478 | 340 | SetHistogramBins(kSigmaDcaXY,500,-0.1,0.9); |
341 | SetHistogramBins(kSigmaDcaZ,500,-0.1,0.9); | |
563113d0 | 342 | } |
343 | //__________________________________________________________________________________ | |
344 | void AliCFTrackIsPrimaryCuts::Copy(TObject &c) const | |
345 | { | |
346 | // | |
347 | // Copy function | |
348 | // | |
349 | AliCFTrackIsPrimaryCuts& target = (AliCFTrackIsPrimaryCuts &) c; | |
350 | ||
351 | target.Initialise(); | |
352 | ||
353 | if (fhCutStatistics) target.fhCutStatistics = (TH1F*) fhCutStatistics->Clone(); | |
354 | if (fhCutCorrelation) target.fhCutCorrelation = (TH2F*) fhCutCorrelation->Clone(); | |
355 | ||
c66800ea | 356 | for (Int_t j=0; j<6; j++) target.fDCA[j] = fDCA[j]; |
563113d0 | 357 | for (Int_t j=0; j<kNStepQA; j++){ |
563113d0 | 358 | if(fhDcaXYvsDcaZ[j]) target.fhDcaXYvsDcaZ[j] = (TH2F*)fhDcaXYvsDcaZ[j]->Clone(); |
62037e79 | 359 | for (Int_t i=0; i<kNHist; i++) |
360 | if(fhQA[i][j]) target.fhQA[i][j] = (TH1F*)fhQA[i][j]->Clone(); | |
563113d0 | 361 | } |
563113d0 | 362 | TNamed::Copy(c); |
363 | } | |
563113d0 | 364 | //__________________________________________________________________________________ |
03f487b1 | 365 | void AliCFTrackIsPrimaryCuts::SetRecEventInfo(const TObject* evt) { |
c2c45ca4 | 366 | // |
03f487b1 | 367 | // Sets pointer to event information (AliESDEvent or AliAODEvent) |
c2c45ca4 | 368 | // |
03f487b1 | 369 | if (!evt) { |
370 | AliError("Pointer to AliVEvent !"); | |
c2c45ca4 | 371 | return; |
372 | } | |
03f487b1 | 373 | TString className(evt->ClassName()); |
374 | if (! (className.CompareTo("AliESDEvent")==0 || className.CompareTo("AliAODEvent")==0)) { | |
375 | AliError("argument must point to an AliESDEvent or AliAODEvent !"); | |
c2c45ca4 | 376 | return ; |
377 | } | |
03f487b1 | 378 | fEvt = (AliVEvent*) evt; |
c2c45ca4 | 379 | } |
380 | //__________________________________________________________________________________ | |
381 | void AliCFTrackIsPrimaryCuts::UseSPDvertex(Bool_t b) { | |
382 | fUseSPDvertex = b; | |
84a7f48a | 383 | if(fUseTPCvertex && fUseSPDvertex) { |
384 | fUseSPDvertex = kFALSE; | |
385 | AliError("SPD and TPC vertex chosen. TPC vertex is preferred."); | |
386 | } | |
c2c45ca4 | 387 | } |
388 | //__________________________________________________________________________________ | |
389 | void AliCFTrackIsPrimaryCuts::UseTPCvertex(Bool_t b) { | |
390 | fUseTPCvertex = b; | |
391 | if(fUseTPCvertex) fUseSPDvertex = kFALSE; | |
392 | } | |
393 | //__________________________________________________________________________________ | |
c66800ea | 394 | void AliCFTrackIsPrimaryCuts::GetDCA(AliESDtrack* esdTrack) |
395 | { | |
396 | if (!esdTrack) return; | |
397 | ||
398 | Float_t b[2] = {0.,0.}; | |
399 | Float_t bCov[3] = {0.,0.,0.}; | |
c2c45ca4 | 400 | if(!fUseSPDvertex && !fUseTPCvertex) esdTrack->GetImpactParameters(b,bCov); |
401 | if( fUseTPCvertex) esdTrack->GetImpactParametersTPC(b,bCov); | |
402 | ||
403 | if( fUseSPDvertex) { | |
03f487b1 | 404 | if (!fEvt) return; |
405 | AliESDEvent * evt = 0x0 ; | |
406 | evt = dynamic_cast<AliESDEvent*>(fEvt); | |
407 | const AliESDVertex *vtx = evt->GetVertex(); | |
408 | const Double_t Bz = evt->GetMagneticField(); | |
c2c45ca4 | 409 | AliExternalTrackParam *cParam = 0; |
410 | Bool_t success = esdTrack->RelateToVertex(vtx, Bz, kVeryBig, cParam); | |
411 | if (success) esdTrack->GetImpactParameters(b,bCov); | |
412 | } | |
c66800ea | 413 | |
414 | if (bCov[0]<=0 || bCov[2]<=0) { | |
415 | bCov[0]=0; bCov[2]=0; | |
416 | } | |
417 | fDCA[0] = b[0]; // impact parameter xy | |
418 | fDCA[1] = b[1]; // impact parameter z | |
419 | fDCA[2] = TMath::Sqrt(bCov[0]); // resolution xy | |
420 | fDCA[3] = TMath::Sqrt(bCov[2]); // resolution z | |
421 | ||
422 | if (!fAbsDCAToVertex) { | |
423 | if (fDCA[2] > 0) fDCA[0] = fDCA[0]/fDCA[2]; // normalised impact parameter xy | |
424 | if (fDCA[3] > 0) fDCA[1] = fDCA[1]/fDCA[3]; // normalised impact parameter z | |
425 | } | |
426 | ||
427 | // get n_sigma | |
c2c45ca4 | 428 | if(!fUseSPDvertex && !fUseTPCvertex) |
c66800ea | 429 | fDCA[5] = AliESDtrackCuts::GetSigmaToVertex(esdTrack); |
430 | ||
431 | if(fUseTPCvertex) { | |
432 | fDCA[5] = -1; | |
433 | if (fDCA[2]==0 || fDCA[3]==0) | |
434 | return; | |
435 | fDCA[5] = 1000.; | |
436 | Float_t d = TMath::Sqrt(TMath::Power(b[0]/fDCA[2],2) + TMath::Power(b[1]/fDCA[3],2)); | |
437 | if (TMath::Exp(-d * d / 2) < 1e-15) | |
438 | return; | |
439 | fDCA[5] = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2); | |
440 | } | |
441 | return; | |
442 | } | |
443 | //__________________________________________________________________________________ | |
03f487b1 | 444 | void AliCFTrackIsPrimaryCuts::GetDCA(AliAODTrack* aodTrack) |
445 | { | |
446 | if (!aodTrack) return; | |
447 | ||
448 | Double_t p[3] = {0.,0.,0.}; | |
449 | Double_t cov[21] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}; | |
450 | ||
451 | aodTrack->XYZAtDCA(p); // position at DCA | |
452 | aodTrack->GetCovarianceXYZPxPyPz(cov); | |
453 | ||
454 | ||
455 | fDCA[5] = -1; // n_sigma | |
456 | if (p[0]==-999. || p[1]==-999. || p[2]==-999.) { | |
457 | AliError("dca info not available !"); | |
458 | fDCA[0] = -999.; // impact parameter xy | |
459 | fDCA[1] = -999.; // impact parameter z | |
460 | return; | |
461 | } | |
462 | ||
463 | if (!fEvt) return; | |
464 | AliAODEvent * evt = 0x0; | |
465 | evt = dynamic_cast<AliAODEvent*>(fEvt); | |
466 | // primary vertex is the "best": tracks, SPD or TPC vertex | |
467 | AliAODVertex * primaryVertex = evt->GetVertex(0); | |
468 | // dca = track postion - primary vertex position | |
469 | p[0] = p[0] - primaryVertex->GetX(); | |
470 | p[1] = p[1] - primaryVertex->GetY(); | |
471 | p[2] = p[2] - primaryVertex->GetZ(); | |
472 | // calculate dca in transverse plane | |
473 | Float_t b[2] = {0.,0.}; | |
474 | b[0] = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]); | |
475 | b[1] = p[2]; | |
476 | // resolution | |
477 | Double_t bCov[3] = {0.,0.,0.}; | |
478 | // how to calculate the resoultion in the transverse plane ? | |
479 | bCov[0] = 0.; // to do: calculate cov in transverse plane | |
480 | bCov[2] = 0.; // from cov in x and y, need to know correlation | |
481 | ||
482 | if (bCov[0]<=0 || bCov[2]<=0) { | |
483 | bCov[0]=0; bCov[2]=0; | |
484 | } | |
485 | fDCA[0] = b[0]; // impact parameter xy | |
486 | fDCA[1] = b[1]; // impact parameter z | |
487 | fDCA[2] = TMath::Sqrt(bCov[0]); // resolution xy | |
488 | fDCA[3] = TMath::Sqrt(bCov[2]); // resolution z | |
489 | ||
490 | if (!fAbsDCAToVertex) { | |
491 | AliError("resolution of impact parameter not available, use absolute dca cut instead !"); | |
492 | if (fDCA[2] > 0) fDCA[0] = fDCA[0]/fDCA[2]; // normalised impact parameter xy | |
493 | if (fDCA[3] > 0) fDCA[1] = fDCA[1]/fDCA[3]; // normalised impact parameter z | |
494 | } | |
495 | ||
496 | // get n_sigma | |
497 | if (fDCA[2]==0 || fDCA[3]==0) | |
498 | return; | |
499 | fDCA[5] = 1000.; | |
500 | Float_t d = TMath::Sqrt(TMath::Power(b[0]/fDCA[2],2) + TMath::Power(b[1]/fDCA[3],2)); | |
501 | if (TMath::Exp(-d * d / 2) < 1e-15) | |
502 | return; | |
503 | fDCA[5] = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2); | |
504 | ||
505 | return; | |
506 | } | |
507 | //__________________________________________________________________________________ | |
107a3100 | 508 | void AliCFTrackIsPrimaryCuts::SelectionBitMap(TObject* obj) |
563113d0 | 509 | { |
510 | // | |
511 | // test if the track passes the single cuts | |
512 | // and store the information in a bitmap | |
513 | // | |
514 | ||
515 | // bitmap stores the decision of each single cut | |
516 | for(Int_t i=0; i<kNCuts; i++)fBitmap->SetBitNumber(i,kFALSE); | |
517 | ||
107a3100 | 518 | // check TObject and cast into ESDtrack |
519 | if (!obj) return; | |
8edd0c2c | 520 | if (!obj->InheritsFrom("AliVParticle")) { |
521 | AliError("object must derived from AliVParticle !"); | |
522 | return; | |
523 | } | |
524 | ||
525 | Bool_t isESDTrack = strcmp(obj->ClassName(),"AliESDtrack") == 0 ? kTRUE : kFALSE ; | |
526 | Bool_t isAODTrack = strcmp(obj->ClassName(),"AliAODTrack") == 0 ? kTRUE : kFALSE ; | |
527 | ||
528 | AliESDtrack * esdTrack = 0x0 ; | |
529 | AliAODTrack * aodTrack = 0x0 ; | |
530 | if (isESDTrack) esdTrack = dynamic_cast<AliESDtrack*>(obj); | |
531 | if (isAODTrack) aodTrack = dynamic_cast<AliAODTrack*>(obj); | |
563113d0 | 532 | |
8edd0c2c | 533 | // get the track to vertex parameter for ESD track |
c66800ea | 534 | if (isESDTrack) GetDCA(esdTrack); |
03f487b1 | 535 | if (isAODTrack) GetDCA(aodTrack); |
536 | ||
537 | // check whether dca info is filled | |
538 | Bool_t dcaInfo = 0; | |
539 | if (fDCA[0]>-990. && fDCA[1]>-990.) dcaInfo = 1; | |
89d7d478 | 540 | |
c66800ea | 541 | Float_t bxy = 0, bz = 0; |
03f487b1 | 542 | bxy = TMath::Abs(fDCA[0]); |
543 | bz = TMath::Abs(fDCA[1]); | |
544 | ||
89d7d478 | 545 | Float_t b2Dmin = 0, b2Dmax = 0; |
03f487b1 | 546 | if (fMinDCAToVertexXY>0 && fMinDCAToVertexZ>0) |
547 | b2Dmin = fDCA[0]*fDCA[0]/fMinDCAToVertexXY/fMinDCAToVertexXY + fDCA[1]*fDCA[1]/fMinDCAToVertexZ/fMinDCAToVertexZ; | |
548 | if (fMaxDCAToVertexXY>0 && fMaxDCAToVertexZ>0) | |
549 | b2Dmax = fDCA[0]*fDCA[0]/fMaxDCAToVertexXY/fMaxDCAToVertexXY + fDCA[1]*fDCA[1]/fMaxDCAToVertexZ/fMaxDCAToVertexZ; | |
550 | ||
563113d0 | 551 | |
552 | // fill the bitmap | |
553 | Int_t iCutBit = 0; | |
8edd0c2c | 554 | |
03f487b1 | 555 | if (!dcaInfo || fDCAToVertex2D || (!fDCAToVertex2D && bxy >= fMinDCAToVertexXY && bxy <= fMaxDCAToVertexXY)) |
556 | fBitmap->SetBitNumber(iCutBit,kTRUE); | |
89d7d478 | 557 | iCutBit++; |
558 | ||
03f487b1 | 559 | if (!dcaInfo || fDCAToVertex2D || (!fDCAToVertex2D && bz >= fMinDCAToVertexZ && bz <= fMaxDCAToVertexZ)) |
560 | fBitmap->SetBitNumber(iCutBit,kTRUE); | |
89d7d478 | 561 | iCutBit++; |
562 | ||
03f487b1 | 563 | if (!dcaInfo || !fDCAToVertex2D || (fDCAToVertex2D && TMath::Sqrt(b2Dmin) > 1 && TMath::Sqrt(b2Dmax) < 1)) |
8edd0c2c | 564 | fBitmap->SetBitNumber(iCutBit,kTRUE); |
563113d0 | 565 | iCutBit++; |
8edd0c2c | 566 | |
3d266236 | 567 | if (!dcaInfo || (fDCA[5] >= fNSigmaToVertexMin && fDCA[5] <= fNSigmaToVertexMax)) |
89d7d478 | 568 | fBitmap->SetBitNumber(iCutBit,kTRUE); |
89d7d478 | 569 | iCutBit++; |
570 | ||
03f487b1 | 571 | if (!dcaInfo || fDCA[2] < fSigmaDCAxy) |
89d7d478 | 572 | fBitmap->SetBitNumber(iCutBit,kTRUE); |
89d7d478 | 573 | iCutBit++; |
574 | ||
03f487b1 | 575 | if (!dcaInfo || fDCA[3] < fSigmaDCAz) |
89d7d478 | 576 | fBitmap->SetBitNumber(iCutBit,kTRUE); |
89d7d478 | 577 | iCutBit++; |
578 | ||
03f487b1 | 579 | if (!dcaInfo || !fRequireSigmaToVertex || (fDCA[5]>=0 && fRequireSigmaToVertex)) |
8edd0c2c | 580 | fBitmap->SetBitNumber(iCutBit,kTRUE); |
563113d0 | 581 | iCutBit++; |
563113d0 | 582 | |
03f487b1 | 583 | if (!dcaInfo || fAcceptKinkDaughters || (!fAcceptKinkDaughters && esdTrack->GetKinkIndex(0)<=0)) |
8edd0c2c | 584 | fBitmap->SetBitNumber(iCutBit,kTRUE); |
8edd0c2c | 585 | iCutBit++; |
03f487b1 | 586 | |
8edd0c2c | 587 | if (isAODTrack) { |
588 | if (fAODType==AliAODTrack::kUndef || fAODType == aodTrack->GetType()) { | |
589 | fBitmap->SetBitNumber(iCutBit,kTRUE); | |
590 | } | |
591 | } | |
592 | else fBitmap->SetBitNumber(iCutBit,kTRUE); | |
03f487b1 | 593 | |
107a3100 | 594 | return; |
563113d0 | 595 | } |
596 | //__________________________________________________________________________________ | |
597 | Bool_t AliCFTrackIsPrimaryCuts::IsSelected(TObject* obj) { | |
598 | // | |
599 | // loops over decisions of single cuts and returns if the track is accepted | |
600 | // | |
107a3100 | 601 | SelectionBitMap(obj); |
563113d0 | 602 | |
107a3100 | 603 | if (fIsQAOn) FillHistograms(obj,0); |
563113d0 | 604 | Bool_t isSelected = kTRUE; |
605 | ||
107a3100 | 606 | for (UInt_t icut=0; icut<fBitmap->GetNbits();icut++) { |
607 | if(!fBitmap->TestBitNumber(icut)) { | |
608 | isSelected = kFALSE; | |
609 | break; | |
610 | } | |
611 | } | |
03f487b1 | 612 | |
107a3100 | 613 | if (!isSelected) return kFALSE ; |
614 | if (fIsQAOn) FillHistograms(obj,1); | |
615 | return kTRUE; | |
563113d0 | 616 | } |
617 | //__________________________________________________________________________________ | |
618 | void AliCFTrackIsPrimaryCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins) | |
619 | { | |
620 | // | |
621 | // variable bin size | |
622 | // | |
623 | if(!fIsQAOn) return; | |
624 | ||
625 | switch(index){ | |
626 | case kCutNSigmaToVertex: | |
db6722a5 | 627 | fhNBinsNSigma=nbins+1; |
563113d0 | 628 | fhBinLimNSigma=new Double_t[nbins+1]; |
629 | for(Int_t i=0;i<nbins+1;i++)fhBinLimNSigma[i]=bins[i]; | |
630 | break; | |
631 | ||
632 | case kCutRequireSigmaToVertex: | |
db6722a5 | 633 | fhNBinsRequireSigma=nbins+1; |
563113d0 | 634 | fhBinLimRequireSigma=new Double_t[nbins+1]; |
635 | for(Int_t i=0;i<nbins+1;i++)fhBinLimRequireSigma[i]=bins[i]; | |
636 | break; | |
637 | ||
638 | case kCutAcceptKinkDaughters: | |
db6722a5 | 639 | fhNBinsAcceptKink=nbins+1; |
563113d0 | 640 | fhBinLimAcceptKink=new Double_t[nbins+1]; |
641 | for(Int_t i=0;i<nbins+1;i++)fhBinLimAcceptKink[i]=bins[i]; | |
642 | break; | |
643 | ||
644 | case kDcaXY: | |
db6722a5 | 645 | fhNBinsDcaXY=nbins+1; |
563113d0 | 646 | fhBinLimDcaXY=new Double_t[nbins+1]; |
647 | for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaXY[i]=bins[i]; | |
648 | break; | |
62037e79 | 649 | |
563113d0 | 650 | case kDcaZ: |
db6722a5 | 651 | fhNBinsDcaZ=nbins+1; |
563113d0 | 652 | fhBinLimDcaZ=new Double_t[nbins+1]; |
653 | for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaZ[i]=bins[i]; | |
654 | break; | |
62037e79 | 655 | |
563113d0 | 656 | case kDcaXYnorm: |
db6722a5 | 657 | fhNBinsDcaXYnorm=nbins+1; |
563113d0 | 658 | fhBinLimDcaXYnorm=new Double_t[nbins+1]; |
659 | for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaXYnorm[i]=bins[i]; | |
660 | break; | |
62037e79 | 661 | |
563113d0 | 662 | case kDcaZnorm: |
db6722a5 | 663 | fhNBinsDcaZnorm=nbins+1; |
563113d0 | 664 | fhBinLimDcaZnorm=new Double_t[nbins+1]; |
665 | for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaZnorm[i]=bins[i]; | |
666 | break; | |
89d7d478 | 667 | |
668 | case kSigmaDcaXY: | |
669 | fhNBinsSigmaDcaXY=nbins+1; | |
670 | fhBinLimSigmaDcaXY=new Double_t[nbins+1]; | |
671 | for(Int_t i=0;i<nbins+1;i++)fhBinLimSigmaDcaXY[i]=bins[i]; | |
672 | break; | |
673 | ||
674 | case kSigmaDcaZ: | |
675 | fhNBinsSigmaDcaZ=nbins+1; | |
676 | fhBinLimSigmaDcaZ=new Double_t[nbins+1]; | |
677 | for(Int_t i=0;i<nbins+1;i++)fhBinLimSigmaDcaZ[i]=bins[i]; | |
678 | break; | |
563113d0 | 679 | } |
680 | } | |
681 | //__________________________________________________________________________________ | |
682 | void AliCFTrackIsPrimaryCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t xmin, Double_t xmax) | |
683 | { | |
684 | // | |
685 | // fixed bin size | |
686 | // | |
563113d0 | 687 | switch(index){ |
688 | case kCutNSigmaToVertex: | |
db6722a5 | 689 | fhNBinsNSigma=nbins+1; |
563113d0 | 690 | fhBinLimNSigma=new Double_t[nbins+1]; |
691 | for(Int_t i=0;i<nbins+1;i++)fhBinLimNSigma[i]=xmin+i*(xmax-xmin)/Double_t(nbins); | |
692 | break; | |
693 | ||
694 | case kCutRequireSigmaToVertex: | |
db6722a5 | 695 | fhNBinsRequireSigma=nbins+1; |
563113d0 | 696 | fhBinLimRequireSigma=new Double_t[nbins+1]; |
697 | for(Int_t i=0;i<nbins+1;i++)fhBinLimRequireSigma[i]=xmin+i*(xmax-xmin)/Double_t(nbins); | |
698 | break; | |
699 | ||
700 | case kCutAcceptKinkDaughters: | |
db6722a5 | 701 | fhNBinsAcceptKink=nbins+1; |
563113d0 | 702 | fhBinLimAcceptKink=new Double_t[nbins+1]; |
703 | for(Int_t i=0;i<nbins+1;i++)fhBinLimAcceptKink[i]=xmin+i*(xmax-xmin)/Double_t(nbins); | |
704 | break; | |
705 | ||
706 | case kDcaXY: | |
db6722a5 | 707 | fhNBinsDcaXY=nbins+1; |
563113d0 | 708 | fhBinLimDcaXY=new Double_t[nbins+1]; |
709 | for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaXY[i]=xmin+i*(xmax-xmin)/Double_t(nbins); | |
710 | break; | |
62037e79 | 711 | |
563113d0 | 712 | case kDcaZ: |
db6722a5 | 713 | fhNBinsDcaZ=nbins+1; |
563113d0 | 714 | fhBinLimDcaZ=new Double_t[nbins+1]; |
715 | for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaZ[i]=xmin+i*(xmax-xmin)/Double_t(nbins); | |
716 | break; | |
62037e79 | 717 | |
563113d0 | 718 | case kDcaXYnorm: |
db6722a5 | 719 | fhNBinsDcaXYnorm=nbins+1; |
563113d0 | 720 | fhBinLimDcaXYnorm=new Double_t[nbins+1]; |
721 | for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaXYnorm[i]=xmin+i*(xmax-xmin)/Double_t(nbins); | |
722 | break; | |
62037e79 | 723 | |
563113d0 | 724 | case kDcaZnorm: |
db6722a5 | 725 | fhNBinsDcaZnorm=nbins+1; |
563113d0 | 726 | fhBinLimDcaZnorm=new Double_t[nbins+1]; |
727 | for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaZnorm[i]=xmin+i*(xmax-xmin)/Double_t(nbins); | |
728 | break; | |
89d7d478 | 729 | |
730 | case kSigmaDcaXY: | |
731 | fhNBinsSigmaDcaXY=nbins+1; | |
732 | fhBinLimSigmaDcaXY=new Double_t[nbins+1]; | |
733 | for(Int_t i=0;i<nbins+1;i++)fhBinLimSigmaDcaXY[i]=xmin+i*(xmax-xmin)/Double_t(nbins); | |
734 | break; | |
735 | ||
736 | case kSigmaDcaZ: | |
737 | fhNBinsSigmaDcaZ=nbins+1; | |
738 | fhBinLimSigmaDcaZ=new Double_t[nbins+1]; | |
739 | for(Int_t i=0;i<nbins+1;i++)fhBinLimSigmaDcaZ[i]=xmin+i*(xmax-xmin)/Double_t(nbins); | |
740 | break; | |
563113d0 | 741 | } |
742 | } | |
743 | //__________________________________________________________________________________ | |
744 | void AliCFTrackIsPrimaryCuts::DefineHistograms() { | |
745 | // | |
746 | // histograms for cut variables, cut statistics and cut correlations | |
747 | // | |
563113d0 | 748 | Int_t color = 2; |
749 | ||
750 | // book cut statistics and cut correlation histograms | |
751 | fhCutStatistics = new TH1F(Form("%s_cut_statistics",GetName()), Form("%s cut statistics",GetName()), kNCuts,0.5,kNCuts+0.5); | |
752 | fhCutStatistics->SetLineWidth(2); | |
89d7d478 | 753 | fhCutStatistics->GetXaxis()->SetBinLabel(1,"dca xy"); |
754 | fhCutStatistics->GetXaxis()->SetBinLabel(2,"dca z"); | |
755 | fhCutStatistics->GetXaxis()->SetBinLabel(3,"dca ellipse"); | |
756 | fhCutStatistics->GetXaxis()->SetBinLabel(4,"n dca"); | |
757 | fhCutStatistics->GetXaxis()->SetBinLabel(5,"sigma dca xy"); | |
758 | fhCutStatistics->GetXaxis()->SetBinLabel(6,"sigma dca z"); | |
759 | fhCutStatistics->GetXaxis()->SetBinLabel(7,"require dca"); | |
760 | fhCutStatistics->GetXaxis()->SetBinLabel(8,"kink daughter"); | |
761 | fhCutStatistics->GetXaxis()->SetBinLabel(9,"AOD type"); | |
563113d0 | 762 | |
763 | fhCutCorrelation = new TH2F(Form("%s_cut_correlation",GetName()), Form("%s cut correlation",GetName()), kNCuts,0.5,kNCuts+0.5,kNCuts,0.5,kNCuts+0.5); | |
764 | fhCutCorrelation->SetLineWidth(2); | |
89d7d478 | 765 | fhCutCorrelation->GetXaxis()->SetBinLabel(1,"dca xy"); |
766 | fhCutCorrelation->GetXaxis()->SetBinLabel(2,"dca z"); | |
767 | fhCutCorrelation->GetXaxis()->SetBinLabel(3,"dca ellipse"); | |
768 | fhCutCorrelation->GetXaxis()->SetBinLabel(4,"n dca"); | |
769 | fhCutCorrelation->GetXaxis()->SetBinLabel(5,"sigma dca xy"); | |
770 | fhCutCorrelation->GetXaxis()->SetBinLabel(6,"sigma dca z"); | |
771 | fhCutCorrelation->GetXaxis()->SetBinLabel(7,"require dca"); | |
772 | fhCutCorrelation->GetXaxis()->SetBinLabel(8,"kink daughter"); | |
773 | fhCutCorrelation->GetXaxis()->SetBinLabel(9,"AOD type"); | |
774 | ||
775 | fhCutCorrelation->GetYaxis()->SetBinLabel(1,"dca xy"); | |
776 | fhCutCorrelation->GetYaxis()->SetBinLabel(2,"dca z"); | |
777 | fhCutCorrelation->GetYaxis()->SetBinLabel(3,"dca ellipse"); | |
778 | fhCutCorrelation->GetYaxis()->SetBinLabel(4,"n dca"); | |
779 | fhCutCorrelation->GetYaxis()->SetBinLabel(5,"sigma dca xy"); | |
780 | fhCutCorrelation->GetYaxis()->SetBinLabel(6,"sigma dca z"); | |
781 | fhCutCorrelation->GetYaxis()->SetBinLabel(7,"require dca"); | |
782 | fhCutCorrelation->GetYaxis()->SetBinLabel(8,"kink daughter"); | |
783 | fhCutCorrelation->GetYaxis()->SetBinLabel(9,"AOD type"); | |
563113d0 | 784 | |
785 | // book QA histograms | |
786 | Char_t str[256]; | |
787 | for (Int_t i=0; i<kNStepQA; i++) { | |
788 | if (i==0) sprintf(str," "); | |
789 | else sprintf(str,"_cut"); | |
62037e79 | 790 | |
563113d0 | 791 | fhDcaXYvsDcaZ[i] = new TH2F(Form("%s_dcaXYvsDcaZ%s",GetName(),str),"",200,-10,10,200,-10,10); |
db6722a5 | 792 | fhQA[kCutNSigmaToVertex][i] = new TH1F(Form("%s_nSigmaToVertex%s",GetName(),str),"",fhNBinsNSigma-1,fhBinLimNSigma); |
793 | fhQA[kCutRequireSigmaToVertex][i] = new TH1F(Form("%s_requireSigmaToVertex%s",GetName(),str),"",fhNBinsRequireSigma-1,fhBinLimRequireSigma); | |
794 | fhQA[kCutAcceptKinkDaughters][i] = new TH1F(Form("%s_acceptKinkDaughters%s",GetName(),str),"",fhNBinsAcceptKink-1,fhBinLimAcceptKink); | |
795 | fhQA[kDcaXY][i] = new TH1F(Form("%s_dcaXY%s",GetName(),str),"",fhNBinsDcaXY-1,fhBinLimDcaXY); | |
796 | fhQA[kDcaZ][i] = new TH1F(Form("%s_dcaZ%s",GetName(),str),"",fhNBinsDcaZ-1,fhBinLimDcaZ); | |
797 | fhQA[kDcaXYnorm][i] = new TH1F(Form("%s_dcaXYnorm%s",GetName(),str),"",fhNBinsDcaXYnorm-1,fhBinLimDcaXYnorm); | |
798 | fhQA[kDcaZnorm][i] = new TH1F(Form("%s_dcaZnorm%s",GetName(),str),"",fhNBinsDcaZnorm-1,fhBinLimDcaZnorm); | |
89d7d478 | 799 | fhQA[kSigmaDcaXY][i] = new TH1F(Form("%s_sigmaDcaXY%s",GetName(),str),"",fhNBinsSigmaDcaXY-1,fhBinLimSigmaDcaXY); |
800 | fhQA[kSigmaDcaZ][i] = new TH1F(Form("%s_sigmaDcaZ%s",GetName(),str),"",fhNBinsSigmaDcaZ-1,fhBinLimSigmaDcaZ); | |
563113d0 | 801 | |
802 | fhDcaXYvsDcaZ[i]->SetXTitle("impact par. d_{z}"); | |
803 | fhDcaXYvsDcaZ[i]->SetYTitle("impact par. d_{xy}"); | |
563113d0 | 804 | |
805 | fhQA[kCutNSigmaToVertex][i]->SetXTitle("n #sigma to vertex"); | |
806 | fhQA[kCutRequireSigmaToVertex][i]->SetXTitle("require #sigma to vertex"); | |
807 | fhQA[kCutAcceptKinkDaughters][i]->SetXTitle("accept kink daughters"); | |
808 | fhQA[kDcaXY][i]->SetXTitle("impact par. d_{xy}"); | |
809 | fhQA[kDcaZ][i]->SetXTitle("impact par. d_{z}"); | |
810 | fhQA[kDcaXYnorm][i]->SetXTitle("norm. impact par. d_{xy} / #sigma_{xy}"); | |
811 | fhQA[kDcaZnorm][i]->SetXTitle("norm. impact par. d_{z} / #sigma_{z}"); | |
89d7d478 | 812 | fhQA[kSigmaDcaXY][i]->SetXTitle("impact par. resolution #sigma_{xy}"); |
813 | fhQA[kSigmaDcaZ][i]->SetXTitle("impact par. resolution #sigma_{z}"); | |
563113d0 | 814 | } |
563113d0 | 815 | for(Int_t i=0; i<kNHist; i++) fhQA[i][1]->SetLineColor(color); |
563113d0 | 816 | } |
817 | //__________________________________________________________________________________ | |
818 | void AliCFTrackIsPrimaryCuts::FillHistograms(TObject* obj, Bool_t f) | |
819 | { | |
820 | // | |
821 | // fill the QA histograms | |
822 | // | |
563113d0 | 823 | |
107a3100 | 824 | if (!obj) return; |
563113d0 | 825 | |
8edd0c2c | 826 | Bool_t isESDTrack = strcmp(obj->ClassName(),"AliESDtrack") == 0 ? kTRUE : kFALSE ; |
827 | Bool_t isAODTrack = strcmp(obj->ClassName(),"AliAODTrack") == 0 ? kTRUE : kFALSE ; | |
563113d0 | 828 | |
8edd0c2c | 829 | AliESDtrack * esdTrack = 0x0 ; |
830 | AliAODTrack * aodTrack = 0x0 ; | |
831 | if (isESDTrack) esdTrack = dynamic_cast<AliESDtrack*>(obj); | |
832 | if (isAODTrack) aodTrack = dynamic_cast<AliAODTrack*>(obj); | |
563113d0 | 833 | |
8edd0c2c | 834 | // f = 0: fill histograms before cuts |
835 | // f = 1: fill histograms after cuts | |
563113d0 | 836 | |
89d7d478 | 837 | // get the track to vertex parameter for ESD track |
8edd0c2c | 838 | if (esdTrack) { |
563113d0 | 839 | |
c66800ea | 840 | fhQA[kDcaZ][f]->Fill(fDCA[1]); |
841 | fhQA[kDcaXY][f]->Fill(fDCA[0]); | |
842 | fhDcaXYvsDcaZ[f]->Fill(fDCA[1],fDCA[0]); | |
843 | fhQA[kSigmaDcaXY][f]->Fill(fDCA[2]); | |
844 | fhQA[kSigmaDcaZ][f]->Fill(fDCA[3]); | |
845 | // // // // // // // delete histograms | |
846 | fhQA[kDcaZnorm][f]->Fill(fDCA[1]); | |
847 | fhQA[kDcaXYnorm][f]->Fill(fDCA[0]); | |
848 | ||
849 | fhQA[kCutNSigmaToVertex][f]->Fill(fDCA[5]); | |
850 | if (fDCA[5]<0 && fRequireSigmaToVertex) fhQA[kCutRequireSigmaToVertex][f]->Fill(0.); | |
851 | if (!(fDCA[5]<0 && fRequireSigmaToVertex)) fhQA[kCutRequireSigmaToVertex][f]->Fill(1.); | |
852 | ||
8edd0c2c | 853 | if (!fAcceptKinkDaughters && esdTrack->GetKinkIndex(0)>0) fhQA[kCutAcceptKinkDaughters][f]->Fill(0.); |
854 | if (!(!fAcceptKinkDaughters && esdTrack->GetKinkIndex(0)>0)) fhQA[kCutAcceptKinkDaughters][f]->Fill(0.); | |
855 | } | |
c66800ea | 856 | |
563113d0 | 857 | // fill cut statistics and cut correlation histograms with information from the bitmap |
858 | if (f) return; | |
859 | ||
860 | // Get the bitmap of the single cuts | |
861 | if ( !obj ) return; | |
107a3100 | 862 | SelectionBitMap(obj); |
563113d0 | 863 | |
864 | // Number of single cuts in this class | |
107a3100 | 865 | UInt_t ncuts = fBitmap->GetNbits(); |
563113d0 | 866 | for(UInt_t bit=0; bit<ncuts;bit++) { |
107a3100 | 867 | if (!fBitmap->TestBitNumber(bit)) { |
563113d0 | 868 | fhCutStatistics->Fill(bit+1); |
869 | for (UInt_t bit2=bit; bit2<ncuts;bit2++) { | |
107a3100 | 870 | if (!fBitmap->TestBitNumber(bit2)) |
563113d0 | 871 | fhCutCorrelation->Fill(bit+1,bit2+1); |
872 | } | |
873 | } | |
874 | } | |
875 | } | |
876 | //__________________________________________________________________________________ | |
877 | void AliCFTrackIsPrimaryCuts::SaveHistograms(const Char_t* dir) { | |
878 | // | |
879 | // saves the histograms in a directory (dir) | |
880 | // | |
881 | if(!fIsQAOn) return; | |
882 | ||
883 | if (!dir) | |
884 | dir = GetName(); | |
885 | ||
886 | gDirectory->mkdir(dir); | |
887 | gDirectory->cd(dir); | |
888 | ||
889 | gDirectory->mkdir("before_cuts"); | |
890 | gDirectory->mkdir("after_cuts"); | |
891 | ||
892 | fhCutStatistics->Write(); | |
893 | fhCutCorrelation->Write(); | |
894 | ||
895 | for (Int_t j=0; j<kNStepQA; j++) { | |
896 | if (j==0) | |
897 | gDirectory->cd("before_cuts"); | |
898 | else | |
899 | gDirectory->cd("after_cuts"); | |
900 | ||
901 | fhDcaXYvsDcaZ[j] ->Write(); | |
563113d0 | 902 | |
903 | for(Int_t i=0; i<kNHist; i++) fhQA[i][j]->Write(); | |
904 | ||
905 | gDirectory->cd("../"); | |
906 | } | |
907 | gDirectory->cd("../"); | |
908 | } | |
909 | //__________________________________________________________________________________ | |
910 | void AliCFTrackIsPrimaryCuts::DrawHistograms() | |
911 | { | |
912 | // | |
913 | // draws some histograms | |
914 | // | |
915 | if(!fIsQAOn) return; | |
916 | ||
917 | // pad margins | |
918 | Float_t right = 0.03; | |
919 | Float_t left = 0.175; | |
920 | Float_t top = 0.03; | |
921 | Float_t bottom = 0.175; | |
922 | ||
923 | TCanvas* canvas1 = new TCanvas("Track_QA_Primary_1", "Track QA Primary 1", 800, 500); | |
924 | canvas1->Divide(2, 1); | |
925 | ||
926 | canvas1->cd(1); | |
927 | fhCutStatistics->SetStats(kFALSE); | |
928 | fhCutStatistics->LabelsOption("v"); | |
929 | gPad->SetLeftMargin(left); | |
930 | gPad->SetBottomMargin(0.25); | |
931 | gPad->SetRightMargin(right); | |
932 | gPad->SetTopMargin(0.1); | |
933 | fhCutStatistics->Draw(); | |
934 | ||
935 | canvas1->cd(2); | |
936 | fhCutCorrelation->SetStats(kFALSE); | |
937 | fhCutCorrelation->LabelsOption("v"); | |
938 | gPad->SetLeftMargin(0.30); | |
939 | gPad->SetRightMargin(bottom); | |
940 | gPad->SetTopMargin(0.1); | |
941 | gPad->SetBottomMargin(0.25); | |
942 | fhCutCorrelation->Draw("COLZ"); | |
943 | ||
944 | canvas1->SaveAs(Form("%s.eps", canvas1->GetName())); | |
945 | canvas1->SaveAs(Form("%s.ps", canvas1->GetName())); | |
946 | ||
947 | // ----- | |
948 | ||
949 | TCanvas* canvas2 = new TCanvas("Track_QA_Primary_2", "Track QA Primary 2", 800, 800); | |
950 | canvas2->Divide(2, 2); | |
951 | ||
952 | canvas2->cd(1); | |
953 | gPad->SetRightMargin(right); | |
954 | gPad->SetLeftMargin(left); | |
955 | gPad->SetTopMargin(top); | |
956 | gPad->SetBottomMargin(bottom); | |
957 | fhQA[kDcaXY][0]->SetStats(kFALSE); | |
958 | fhQA[kDcaXY][0]->Draw(); | |
959 | fhQA[kDcaXY][1]->Draw("same"); | |
960 | ||
961 | canvas2->cd(2); | |
962 | gPad->SetRightMargin(right); | |
963 | gPad->SetLeftMargin(left); | |
964 | gPad->SetTopMargin(top); | |
965 | gPad->SetBottomMargin(bottom); | |
966 | fhQA[kDcaZ][0]->SetStats(kFALSE); | |
967 | fhQA[kDcaZ][0]->Draw(); | |
968 | fhQA[kDcaZ][1]->Draw("same"); | |
969 | ||
970 | canvas2->cd(3); | |
971 | // fhDXYvsDZ[0]->SetStats(kFALSE); | |
972 | gPad->SetLogz(); | |
973 | gPad->SetLeftMargin(bottom); | |
974 | gPad->SetTopMargin(0.1); | |
975 | gPad->SetBottomMargin(bottom); | |
976 | gPad->SetRightMargin(0.2); | |
977 | fhDcaXYvsDcaZ[0]->Draw("COLZ"); | |
978 | ||
979 | canvas2->cd(4); | |
980 | // fhDXYvsDZ[1]->SetStats(kFALSE); | |
981 | gPad->SetLogz(); | |
982 | gPad->SetLeftMargin(bottom); | |
983 | gPad->SetTopMargin(0.1); | |
984 | gPad->SetBottomMargin(bottom); | |
985 | gPad->SetRightMargin(0.2); | |
986 | fhDcaXYvsDcaZ[1]->Draw("COLZ"); | |
987 | ||
988 | canvas2->SaveAs(Form("%s.eps", canvas2->GetName())); | |
989 | canvas2->SaveAs(Form("%s.ps", canvas2->GetName())); | |
990 | ||
991 | // ----- | |
992 | ||
c66800ea | 993 | TCanvas* canvas3 = new TCanvas("Track_QA_Primary_3", "Track QA Primary 3", 800, 400); |
994 | canvas3->Divide(2, 1); | |
563113d0 | 995 | |
996 | canvas3->cd(1); | |
997 | gPad->SetRightMargin(right); | |
998 | gPad->SetLeftMargin(left); | |
999 | gPad->SetTopMargin(top); | |
1000 | gPad->SetBottomMargin(bottom); | |
1001 | fhQA[kDcaXYnorm][0]->SetStats(kFALSE); | |
1002 | fhQA[kDcaXYnorm][0]->Draw(); | |
1003 | fhQA[kDcaXYnorm][1]->Draw("same"); | |
1004 | ||
1005 | canvas3->cd(2); | |
1006 | gPad->SetRightMargin(right); | |
1007 | gPad->SetLeftMargin(left); | |
1008 | gPad->SetTopMargin(top); | |
1009 | gPad->SetBottomMargin(bottom); | |
1010 | fhQA[kDcaZnorm][0]->SetStats(kFALSE); | |
1011 | fhQA[kDcaZnorm][0]->Draw(); | |
1012 | fhQA[kDcaZnorm][1]->Draw("same"); | |
1013 | ||
563113d0 | 1014 | canvas3->SaveAs(Form("%s.eps", canvas3->GetName())); |
1015 | canvas3->SaveAs(Form("%s.ps", canvas3->GetName())); | |
1016 | ||
1017 | // ----- | |
1018 | ||
89d7d478 | 1019 | TCanvas* canvas4 = new TCanvas("Track_QA_Primary_4", "Track QA Primary 4", 1200, 800); |
1020 | canvas4->Divide(3, 2); | |
563113d0 | 1021 | |
1022 | canvas4->cd(1); | |
1023 | gPad->SetRightMargin(right); | |
1024 | gPad->SetLeftMargin(left); | |
1025 | gPad->SetTopMargin(top); | |
1026 | gPad->SetBottomMargin(bottom); | |
89d7d478 | 1027 | fhQA[kSigmaDcaXY][0]->SetStats(kFALSE); |
1028 | fhQA[kSigmaDcaXY][0]->Draw(); | |
1029 | fhQA[kSigmaDcaXY][1]->Draw("same"); | |
1030 | ||
1031 | canvas4->cd(2); | |
1032 | gPad->SetRightMargin(right); | |
1033 | gPad->SetLeftMargin(left); | |
1034 | gPad->SetTopMargin(top); | |
1035 | gPad->SetBottomMargin(bottom); | |
1036 | fhQA[kSigmaDcaZ][0]->SetStats(kFALSE); | |
1037 | fhQA[kSigmaDcaZ][0]->Draw(); | |
1038 | fhQA[kSigmaDcaZ][1]->Draw("same"); | |
1039 | ||
1040 | canvas4->cd(4); | |
1041 | gPad->SetRightMargin(right); | |
1042 | gPad->SetLeftMargin(left); | |
1043 | gPad->SetTopMargin(top); | |
1044 | gPad->SetBottomMargin(bottom); | |
563113d0 | 1045 | fhQA[kCutNSigmaToVertex][0]->SetStats(kFALSE); |
1046 | fhQA[kCutNSigmaToVertex][0]->Draw(); | |
1047 | fhQA[kCutNSigmaToVertex][1]->Draw("same"); | |
1048 | ||
89d7d478 | 1049 | canvas4->cd(5); |
563113d0 | 1050 | gPad->SetRightMargin(right); |
1051 | gPad->SetLeftMargin(left); | |
1052 | gPad->SetTopMargin(top); | |
1053 | gPad->SetBottomMargin(bottom); | |
1054 | fhQA[kCutRequireSigmaToVertex][0]->SetStats(kFALSE); | |
1055 | fhQA[kCutRequireSigmaToVertex][0]->Draw(); | |
1056 | fhQA[kCutRequireSigmaToVertex][1]->Draw("same"); | |
1057 | ||
89d7d478 | 1058 | canvas4->cd(6); |
563113d0 | 1059 | gPad->SetRightMargin(right); |
1060 | gPad->SetLeftMargin(left); | |
1061 | gPad->SetTopMargin(top); | |
1062 | gPad->SetBottomMargin(bottom); | |
1063 | fhQA[kCutAcceptKinkDaughters][0]->SetStats(kFALSE); | |
1064 | fhQA[kCutAcceptKinkDaughters][0]->Draw(); | |
1065 | fhQA[kCutAcceptKinkDaughters][1]->Draw("same"); | |
1066 | ||
1067 | canvas4->SaveAs(Form("%s.eps", canvas4->GetName())); | |
1068 | canvas4->SaveAs(Form("%s.ps", canvas4->GetName())); | |
1069 | } | |
1070 | //__________________________________________________________________________________ | |
107a3100 | 1071 | void AliCFTrackIsPrimaryCuts::AddQAHistograms(TList *qaList) { |
563113d0 | 1072 | // |
1073 | // saves the histograms in a TList | |
1074 | // | |
107a3100 | 1075 | DefineHistograms(); |
563113d0 | 1076 | |
1077 | qaList->Add(fhCutStatistics); | |
1078 | qaList->Add(fhCutCorrelation); | |
1079 | ||
1080 | for (Int_t j=0; j<kNStepQA; j++) { | |
1081 | qaList->Add(fhDcaXYvsDcaZ[j]); | |
563113d0 | 1082 | for(Int_t i=0; i<kNHist; i++) |
62037e79 | 1083 | qaList->Add(fhQA[i][j]); |
563113d0 | 1084 | } |
1085 | } |