]>
Commit | Line | Data |
---|---|---|
73318471 | 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 * | |
74687314 | 8 | * documentation strictly for non-commercial purposes is hereby granted * |
73318471 | 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 | /* $Id: AliESDtrackCuts.cxx 24534 2008-03-16 22:22:11Z fca $ */ | |
17 | ||
18 | #include "AliESDtrackCuts.h" | |
19 | ||
20 | #include <AliESDtrack.h> | |
91c88f16 | 21 | #include <AliESDVertex.h> |
73318471 | 22 | #include <AliESDEvent.h> |
23 | #include <AliLog.h> | |
24 | ||
25 | #include <TTree.h> | |
26 | #include <TCanvas.h> | |
27 | #include <TDirectory.h> | |
28 | ||
29 | //____________________________________________________________________ | |
30 | ClassImp(AliESDtrackCuts) | |
31 | ||
32 | // Cut names | |
33 | const Char_t* AliESDtrackCuts::fgkCutNames[kNCuts] = { | |
34 | "require TPC refit", | |
35 | "require ITS refit", | |
36 | "n clusters TPC", | |
37 | "n clusters ITS", | |
86f0e195 | 38 | "#Chi^{2}/cluster TPC", |
39 | "#Chi^{2}/cluster ITS", | |
73318471 | 40 | "cov 11", |
41 | "cov 22", | |
42 | "cov 33", | |
43 | "cov 44", | |
44 | "cov 55", | |
45 | "trk-to-vtx", | |
46 | "trk-to-vtx failed", | |
47 | "kink daughters", | |
48 | "p", | |
49 | "p_{T}", | |
50 | "p_{x}", | |
51 | "p_{y}", | |
52 | "p_{z}", | |
524916f0 | 53 | "eta", |
86f0e195 | 54 | "y", |
55 | "trk-to-vtx dca 2D absolute", | |
74687314 | 56 | "trk-to-vtx dca xy absolute", |
94c06b89 | 57 | "trk-to-vtx dca z absolute", |
58 | "SPD cluster requirement", | |
59 | "SDD cluster requirement", | |
60 | "SSD cluster requirement" | |
73318471 | 61 | }; |
62 | ||
63 | //____________________________________________________________________ | |
64 | AliESDtrackCuts::AliESDtrackCuts(const Char_t* name, const Char_t* title) : AliAnalysisCuts(name,title), | |
65 | fCutMinNClusterTPC(0), | |
66 | fCutMinNClusterITS(0), | |
67 | fCutMaxChi2PerClusterTPC(0), | |
68 | fCutMaxChi2PerClusterITS(0), | |
69 | fCutMaxC11(0), | |
70 | fCutMaxC22(0), | |
71 | fCutMaxC33(0), | |
72 | fCutMaxC44(0), | |
73 | fCutMaxC55(0), | |
74 | fCutAcceptKinkDaughters(0), | |
75 | fCutRequireTPCRefit(0), | |
76 | fCutRequireITSRefit(0), | |
77 | fCutNsigmaToVertex(0), | |
78 | fCutSigmaToVertexRequired(0), | |
e4617f4e | 79 | fCutDCAToVertexXY(0), |
74687314 | 80 | fCutDCAToVertexZ(0), |
86f0e195 | 81 | fCutDCAToVertex2D(0), |
73318471 | 82 | fPMin(0), |
83 | fPMax(0), | |
84 | fPtMin(0), | |
85 | fPtMax(0), | |
86 | fPxMin(0), | |
87 | fPxMax(0), | |
88 | fPyMin(0), | |
89 | fPyMax(0), | |
90 | fPzMin(0), | |
91 | fPzMax(0), | |
92 | fEtaMin(0), | |
93 | fEtaMax(0), | |
94 | fRapMin(0), | |
95 | fRapMax(0), | |
96 | fHistogramsOn(0), | |
97 | ffDTheoretical(0), | |
98 | fhCutStatistics(0), | |
99 | fhCutCorrelation(0) | |
100 | { | |
101 | // | |
102 | // constructor | |
103 | // | |
104 | ||
105 | Init(); | |
106 | ||
107 | //############################################################################## | |
108 | // setting default cuts | |
109 | SetMinNClustersTPC(); | |
110 | SetMinNClustersITS(); | |
111 | SetMaxChi2PerClusterTPC(); | |
112 | SetMaxChi2PerClusterITS(); | |
113 | SetMaxCovDiagonalElements(); | |
114 | SetRequireTPCRefit(); | |
115 | SetRequireITSRefit(); | |
116 | SetAcceptKingDaughters(); | |
94c06b89 | 117 | SetMaxNsigmaToVertex(); |
94c06b89 | 118 | SetMaxDCAToVertexXY(); |
119 | SetMaxDCAToVertexZ(); | |
86f0e195 | 120 | SetDCAToVertex2D(); |
73318471 | 121 | SetPRange(); |
122 | SetPtRange(); | |
123 | SetPxRange(); | |
124 | SetPyRange(); | |
125 | SetPzRange(); | |
126 | SetEtaRange(); | |
127 | SetRapRange(); | |
94c06b89 | 128 | SetClusterRequirementITS(kSPD); |
129 | SetClusterRequirementITS(kSDD); | |
130 | SetClusterRequirementITS(kSSD); | |
73318471 | 131 | |
132 | SetHistogramsOn(); | |
133 | } | |
134 | ||
135 | //_____________________________________________________________________________ | |
136 | AliESDtrackCuts::AliESDtrackCuts(const AliESDtrackCuts &c) : AliAnalysisCuts(c), | |
137 | fCutMinNClusterTPC(0), | |
138 | fCutMinNClusterITS(0), | |
139 | fCutMaxChi2PerClusterTPC(0), | |
140 | fCutMaxChi2PerClusterITS(0), | |
141 | fCutMaxC11(0), | |
142 | fCutMaxC22(0), | |
143 | fCutMaxC33(0), | |
144 | fCutMaxC44(0), | |
145 | fCutMaxC55(0), | |
146 | fCutAcceptKinkDaughters(0), | |
147 | fCutRequireTPCRefit(0), | |
148 | fCutRequireITSRefit(0), | |
149 | fCutNsigmaToVertex(0), | |
150 | fCutSigmaToVertexRequired(0), | |
e4617f4e | 151 | fCutDCAToVertexXY(0), |
74687314 | 152 | fCutDCAToVertexZ(0), |
86f0e195 | 153 | fCutDCAToVertex2D(0), |
73318471 | 154 | fPMin(0), |
155 | fPMax(0), | |
156 | fPtMin(0), | |
157 | fPtMax(0), | |
158 | fPxMin(0), | |
159 | fPxMax(0), | |
160 | fPyMin(0), | |
161 | fPyMax(0), | |
162 | fPzMin(0), | |
163 | fPzMax(0), | |
164 | fEtaMin(0), | |
165 | fEtaMax(0), | |
166 | fRapMin(0), | |
167 | fRapMax(0), | |
168 | fHistogramsOn(0), | |
169 | ffDTheoretical(0), | |
170 | fhCutStatistics(0), | |
171 | fhCutCorrelation(0) | |
172 | { | |
173 | // | |
174 | // copy constructor | |
175 | // | |
176 | ||
177 | ((AliESDtrackCuts &) c).Copy(*this); | |
178 | } | |
179 | ||
180 | AliESDtrackCuts::~AliESDtrackCuts() | |
181 | { | |
182 | // | |
183 | // destructor | |
184 | // | |
185 | ||
186 | for (Int_t i=0; i<2; i++) { | |
187 | ||
188 | if (fhNClustersITS[i]) | |
189 | delete fhNClustersITS[i]; | |
190 | if (fhNClustersTPC[i]) | |
191 | delete fhNClustersTPC[i]; | |
192 | if (fhChi2PerClusterITS[i]) | |
193 | delete fhChi2PerClusterITS[i]; | |
194 | if (fhChi2PerClusterTPC[i]) | |
195 | delete fhChi2PerClusterTPC[i]; | |
196 | if (fhC11[i]) | |
197 | delete fhC11[i]; | |
198 | if (fhC22[i]) | |
199 | delete fhC22[i]; | |
200 | if (fhC33[i]) | |
201 | delete fhC33[i]; | |
202 | if (fhC44[i]) | |
203 | delete fhC44[i]; | |
204 | if (fhC55[i]) | |
205 | delete fhC55[i]; | |
206 | ||
207 | if (fhDXY[i]) | |
208 | delete fhDXY[i]; | |
209 | if (fhDZ[i]) | |
524916f0 | 210 | delete fhDZ[i]; |
211 | if (fhDXYDZ[i]) | |
212 | delete fhDXYDZ[i]; | |
73318471 | 213 | if (fhDXYvsDZ[i]) |
524916f0 | 214 | delete fhDXYvsDZ[i]; |
215 | ||
73318471 | 216 | if (fhDXYNormalized[i]) |
217 | delete fhDXYNormalized[i]; | |
218 | if (fhDZNormalized[i]) | |
219 | delete fhDZNormalized[i]; | |
220 | if (fhDXYvsDZNormalized[i]) | |
524916f0 | 221 | delete fhDXYvsDZNormalized[i]; |
73318471 | 222 | if (fhNSigmaToVertex[i]) |
223 | delete fhNSigmaToVertex[i]; | |
224 | if (fhPt[i]) | |
225 | delete fhPt[i]; | |
226 | if (fhEta[i]) | |
227 | delete fhEta[i]; | |
228 | } | |
229 | ||
230 | if (ffDTheoretical) | |
231 | delete ffDTheoretical; | |
232 | ||
233 | if (fhCutStatistics) | |
234 | delete fhCutStatistics; | |
235 | if (fhCutCorrelation) | |
236 | delete fhCutCorrelation; | |
237 | } | |
238 | ||
239 | void AliESDtrackCuts::Init() | |
240 | { | |
241 | // | |
242 | // sets everything to zero | |
243 | // | |
244 | ||
245 | fCutMinNClusterTPC = 0; | |
246 | fCutMinNClusterITS = 0; | |
247 | ||
248 | fCutMaxChi2PerClusterTPC = 0; | |
249 | fCutMaxChi2PerClusterITS = 0; | |
94c06b89 | 250 | |
251 | for (Int_t i = 0; i < 3; i++) | |
252 | fCutClusterRequirementITS[i] = kOff; | |
73318471 | 253 | |
254 | fCutMaxC11 = 0; | |
255 | fCutMaxC22 = 0; | |
256 | fCutMaxC33 = 0; | |
257 | fCutMaxC44 = 0; | |
258 | fCutMaxC55 = 0; | |
259 | ||
260 | fCutAcceptKinkDaughters = 0; | |
261 | fCutRequireTPCRefit = 0; | |
262 | fCutRequireITSRefit = 0; | |
263 | ||
264 | fCutNsigmaToVertex = 0; | |
265 | fCutSigmaToVertexRequired = 0; | |
e4617f4e | 266 | fCutDCAToVertexXY = 0; |
74687314 | 267 | fCutDCAToVertexZ = 0; |
86f0e195 | 268 | fCutDCAToVertex2D = 0; |
269 | ||
73318471 | 270 | fPMin = 0; |
271 | fPMax = 0; | |
272 | fPtMin = 0; | |
273 | fPtMax = 0; | |
274 | fPxMin = 0; | |
275 | fPxMax = 0; | |
276 | fPyMin = 0; | |
277 | fPyMax = 0; | |
278 | fPzMin = 0; | |
279 | fPzMax = 0; | |
280 | fEtaMin = 0; | |
281 | fEtaMax = 0; | |
282 | fRapMin = 0; | |
283 | fRapMax = 0; | |
284 | ||
285 | fHistogramsOn = kFALSE; | |
286 | ||
287 | for (Int_t i=0; i<2; ++i) | |
288 | { | |
289 | fhNClustersITS[i] = 0; | |
290 | fhNClustersTPC[i] = 0; | |
291 | ||
292 | fhChi2PerClusterITS[i] = 0; | |
293 | fhChi2PerClusterTPC[i] = 0; | |
294 | ||
295 | fhC11[i] = 0; | |
296 | fhC22[i] = 0; | |
297 | fhC33[i] = 0; | |
298 | fhC44[i] = 0; | |
299 | fhC55[i] = 0; | |
300 | ||
301 | fhDXY[i] = 0; | |
302 | fhDZ[i] = 0; | |
524916f0 | 303 | fhDXYDZ[i] = 0; |
73318471 | 304 | fhDXYvsDZ[i] = 0; |
305 | ||
306 | fhDXYNormalized[i] = 0; | |
307 | fhDZNormalized[i] = 0; | |
308 | fhDXYvsDZNormalized[i] = 0; | |
309 | fhNSigmaToVertex[i] = 0; | |
310 | ||
311 | fhPt[i] = 0; | |
312 | fhEta[i] = 0; | |
313 | } | |
314 | ffDTheoretical = 0; | |
315 | ||
316 | fhCutStatistics = 0; | |
317 | fhCutCorrelation = 0; | |
318 | } | |
319 | ||
320 | //_____________________________________________________________________________ | |
321 | AliESDtrackCuts &AliESDtrackCuts::operator=(const AliESDtrackCuts &c) | |
322 | { | |
323 | // | |
324 | // Assignment operator | |
325 | // | |
326 | ||
327 | if (this != &c) ((AliESDtrackCuts &) c).Copy(*this); | |
328 | return *this; | |
329 | } | |
330 | ||
331 | //_____________________________________________________________________________ | |
332 | void AliESDtrackCuts::Copy(TObject &c) const | |
333 | { | |
334 | // | |
335 | // Copy function | |
336 | // | |
337 | ||
338 | AliESDtrackCuts& target = (AliESDtrackCuts &) c; | |
339 | ||
340 | target.Init(); | |
341 | ||
342 | target.fCutMinNClusterTPC = fCutMinNClusterTPC; | |
343 | target.fCutMinNClusterITS = fCutMinNClusterITS; | |
344 | ||
345 | target.fCutMaxChi2PerClusterTPC = fCutMaxChi2PerClusterTPC; | |
346 | target.fCutMaxChi2PerClusterITS = fCutMaxChi2PerClusterITS; | |
347 | ||
94c06b89 | 348 | for (Int_t i = 0; i < 3; i++) |
349 | target.fCutClusterRequirementITS[i] = fCutClusterRequirementITS[i]; | |
350 | ||
73318471 | 351 | target.fCutMaxC11 = fCutMaxC11; |
352 | target.fCutMaxC22 = fCutMaxC22; | |
353 | target.fCutMaxC33 = fCutMaxC33; | |
354 | target.fCutMaxC44 = fCutMaxC44; | |
355 | target.fCutMaxC55 = fCutMaxC55; | |
356 | ||
357 | target.fCutAcceptKinkDaughters = fCutAcceptKinkDaughters; | |
358 | target.fCutRequireTPCRefit = fCutRequireTPCRefit; | |
359 | target.fCutRequireITSRefit = fCutRequireITSRefit; | |
360 | ||
361 | target.fCutNsigmaToVertex = fCutNsigmaToVertex; | |
362 | target.fCutSigmaToVertexRequired = fCutSigmaToVertexRequired; | |
e4617f4e | 363 | target.fCutDCAToVertexXY = fCutDCAToVertexXY; |
74687314 | 364 | target.fCutDCAToVertexZ = fCutDCAToVertexZ; |
86f0e195 | 365 | target.fCutDCAToVertex2D = fCutDCAToVertex2D; |
73318471 | 366 | |
367 | target.fPMin = fPMin; | |
368 | target.fPMax = fPMax; | |
369 | target.fPtMin = fPtMin; | |
370 | target.fPtMax = fPtMax; | |
371 | target.fPxMin = fPxMin; | |
372 | target.fPxMax = fPxMax; | |
373 | target.fPyMin = fPyMin; | |
374 | target.fPyMax = fPyMax; | |
375 | target.fPzMin = fPzMin; | |
376 | target.fPzMax = fPzMax; | |
377 | target.fEtaMin = fEtaMin; | |
378 | target.fEtaMax = fEtaMax; | |
379 | target.fRapMin = fRapMin; | |
380 | target.fRapMax = fRapMax; | |
381 | ||
382 | target.fHistogramsOn = fHistogramsOn; | |
383 | ||
384 | for (Int_t i=0; i<2; ++i) | |
385 | { | |
386 | if (fhNClustersITS[i]) target.fhNClustersITS[i] = (TH1F*) fhNClustersITS[i]->Clone(); | |
387 | if (fhNClustersTPC[i]) target.fhNClustersTPC[i] = (TH1F*) fhNClustersTPC[i]->Clone(); | |
388 | ||
389 | if (fhChi2PerClusterITS[i]) target.fhChi2PerClusterITS[i] = (TH1F*) fhChi2PerClusterITS[i]->Clone(); | |
390 | if (fhChi2PerClusterTPC[i]) target.fhChi2PerClusterTPC[i] = (TH1F*) fhChi2PerClusterTPC[i]->Clone(); | |
391 | ||
392 | if (fhC11[i]) target.fhC11[i] = (TH1F*) fhC11[i]->Clone(); | |
393 | if (fhC22[i]) target.fhC22[i] = (TH1F*) fhC22[i]->Clone(); | |
394 | if (fhC33[i]) target.fhC33[i] = (TH1F*) fhC33[i]->Clone(); | |
395 | if (fhC44[i]) target.fhC44[i] = (TH1F*) fhC44[i]->Clone(); | |
396 | if (fhC55[i]) target.fhC55[i] = (TH1F*) fhC55[i]->Clone(); | |
397 | ||
398 | if (fhDXY[i]) target.fhDXY[i] = (TH1F*) fhDXY[i]->Clone(); | |
399 | if (fhDZ[i]) target.fhDZ[i] = (TH1F*) fhDZ[i]->Clone(); | |
524916f0 | 400 | if (fhDXYDZ[i]) target.fhDXYDZ[i] = (TH1F*) fhDXYDZ[i]->Clone(); |
73318471 | 401 | if (fhDXYvsDZ[i]) target.fhDXYvsDZ[i] = (TH2F*) fhDXYvsDZ[i]->Clone(); |
402 | ||
403 | if (fhDXYNormalized[i]) target.fhDXYNormalized[i] = (TH1F*) fhDXYNormalized[i]->Clone(); | |
404 | if (fhDZNormalized[i]) target.fhDZNormalized[i] = (TH1F*) fhDZNormalized[i]->Clone(); | |
405 | if (fhDXYvsDZNormalized[i]) target.fhDXYvsDZNormalized[i] = (TH2F*) fhDXYvsDZNormalized[i]->Clone(); | |
406 | if (fhNSigmaToVertex[i]) target.fhNSigmaToVertex[i] = (TH1F*) fhNSigmaToVertex[i]->Clone(); | |
407 | ||
408 | if (fhPt[i]) target.fhPt[i] = (TH1F*) fhPt[i]->Clone(); | |
409 | if (fhEta[i]) target.fhEta[i] = (TH1F*) fhEta[i]->Clone(); | |
410 | } | |
411 | if (ffDTheoretical) target.ffDTheoretical = (TF1*) ffDTheoretical->Clone(); | |
412 | ||
413 | if (fhCutStatistics) target.fhCutStatistics = (TH1F*) fhCutStatistics->Clone(); | |
414 | if (fhCutCorrelation) target.fhCutCorrelation = (TH2F*) fhCutCorrelation->Clone(); | |
415 | ||
416 | TNamed::Copy(c); | |
417 | } | |
418 | ||
419 | //_____________________________________________________________________________ | |
420 | Long64_t AliESDtrackCuts::Merge(TCollection* list) { | |
421 | // Merge a list of AliESDtrackCuts objects with this (needed for PROOF) | |
422 | // Returns the number of merged objects (including this) | |
73318471 | 423 | if (!list) |
424 | return 0; | |
73318471 | 425 | if (list->IsEmpty()) |
426 | return 1; | |
73318471 | 427 | if (!fHistogramsOn) |
428 | return 0; | |
73318471 | 429 | TIterator* iter = list->MakeIterator(); |
430 | TObject* obj; | |
431 | ||
73318471 | 432 | // collection of measured and generated histograms |
433 | Int_t count = 0; | |
434 | while ((obj = iter->Next())) { | |
435 | ||
436 | AliESDtrackCuts* entry = dynamic_cast<AliESDtrackCuts*>(obj); | |
437 | if (entry == 0) | |
438 | continue; | |
439 | ||
440 | if (!entry->fHistogramsOn) | |
441 | continue; | |
524916f0 | 442 | |
73318471 | 443 | for (Int_t i=0; i<2; i++) { |
444 | ||
445 | fhNClustersITS[i] ->Add(entry->fhNClustersITS[i] ); | |
446 | fhNClustersTPC[i] ->Add(entry->fhNClustersTPC[i] ); | |
447 | ||
448 | fhChi2PerClusterITS[i] ->Add(entry->fhChi2PerClusterITS[i]); | |
449 | fhChi2PerClusterTPC[i] ->Add(entry->fhChi2PerClusterTPC[i]); | |
450 | ||
451 | fhC11[i] ->Add(entry->fhC11[i] ); | |
452 | fhC22[i] ->Add(entry->fhC22[i] ); | |
453 | fhC33[i] ->Add(entry->fhC33[i] ); | |
454 | fhC44[i] ->Add(entry->fhC44[i] ); | |
455 | fhC55[i] ->Add(entry->fhC55[i] ); | |
456 | ||
457 | fhDXY[i] ->Add(entry->fhDXY[i] ); | |
458 | fhDZ[i] ->Add(entry->fhDZ[i] ); | |
524916f0 | 459 | fhDXYDZ[i] ->Add(entry->fhDXYDZ[i] ); |
460 | fhDXYvsDZ[i] ->Add(entry->fhDXYvsDZ[i] ); | |
461 | ||
462 | fhDXYNormalized[i] ->Add(entry->fhDXYNormalized[i] ); | |
73318471 | 463 | fhDZNormalized[i] ->Add(entry->fhDZNormalized[i] ); |
524916f0 | 464 | fhDXYvsDZNormalized[i] ->Add(entry->fhDXYvsDZNormalized[i]); |
73318471 | 465 | fhNSigmaToVertex[i] ->Add(entry->fhNSigmaToVertex[i]); |
466 | ||
467 | fhPt[i] ->Add(entry->fhPt[i]); | |
468 | fhEta[i] ->Add(entry->fhEta[i]); | |
469 | } | |
470 | ||
471 | fhCutStatistics ->Add(entry->fhCutStatistics); | |
472 | fhCutCorrelation ->Add(entry->fhCutCorrelation); | |
473 | ||
474 | count++; | |
475 | } | |
73318471 | 476 | return count+1; |
477 | } | |
478 | ||
479 | ||
480 | //____________________________________________________________________ | |
481 | Float_t AliESDtrackCuts::GetSigmaToVertex(AliESDtrack* esdTrack) | |
482 | { | |
483 | // Calculates the number of sigma to the vertex. | |
484 | ||
485 | Float_t b[2]; | |
486 | Float_t bRes[2]; | |
487 | Float_t bCov[3]; | |
488 | esdTrack->GetImpactParameters(b,bCov); | |
36853ddd | 489 | |
73318471 | 490 | if (bCov[0]<=0 || bCov[2]<=0) { |
57fddfbc | 491 | AliDebugClass(1, "Estimated b resolution lower or equal zero!"); |
73318471 | 492 | bCov[0]=0; bCov[2]=0; |
493 | } | |
494 | bRes[0] = TMath::Sqrt(bCov[0]); | |
495 | bRes[1] = TMath::Sqrt(bCov[2]); | |
496 | ||
497 | // ----------------------------------- | |
498 | // How to get to a n-sigma cut? | |
499 | // | |
500 | // The accumulated statistics from 0 to d is | |
501 | // | |
502 | // -> Erf(d/Sqrt(2)) for a 1-dim gauss (d = n_sigma) | |
503 | // -> 1 - Exp(-d**2) for a 2-dim gauss (d*d = dx*dx + dy*dy != n_sigma) | |
504 | // | |
505 | // It means that for a 2-dim gauss: n_sigma(d) = Sqrt(2)*ErfInv(1 - Exp((-x**2)/2) | |
506 | // Can this be expressed in a different way? | |
507 | ||
508 | if (bRes[0] == 0 || bRes[1] ==0) | |
509 | return -1; | |
510 | ||
511 | Float_t d = TMath::Sqrt(TMath::Power(b[0]/bRes[0],2) + TMath::Power(b[1]/bRes[1],2)); | |
512 | ||
0f712a2e | 513 | // work around precision problem |
73318471 | 514 | // if d is too big, TMath::Exp(...) gets 0, and TMath::ErfInverse(1) that should be infinite, gets 0 :( |
0f712a2e | 515 | // 1e-15 corresponds to nsigma ~ 7.7 |
516 | if (TMath::Exp(-d * d / 2) < 1e-15) | |
73318471 | 517 | return 1000; |
518 | ||
0f712a2e | 519 | Float_t nSigma = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2); |
520 | return nSigma; | |
73318471 | 521 | } |
522 | ||
523 | void AliESDtrackCuts::EnableNeededBranches(TTree* tree) | |
524 | { | |
525 | // enables the branches needed by AcceptTrack, for a list see comment of AcceptTrack | |
526 | ||
527 | tree->SetBranchStatus("fTracks.fFlags", 1); | |
528 | tree->SetBranchStatus("fTracks.fITSncls", 1); | |
529 | tree->SetBranchStatus("fTracks.fTPCncls", 1); | |
530 | tree->SetBranchStatus("fTracks.fITSchi2", 1); | |
531 | tree->SetBranchStatus("fTracks.fTPCchi2", 1); | |
532 | tree->SetBranchStatus("fTracks.fC*", 1); | |
533 | tree->SetBranchStatus("fTracks.fD", 1); | |
534 | tree->SetBranchStatus("fTracks.fZ", 1); | |
535 | tree->SetBranchStatus("fTracks.fCdd", 1); | |
536 | tree->SetBranchStatus("fTracks.fCdz", 1); | |
537 | tree->SetBranchStatus("fTracks.fCzz", 1); | |
538 | tree->SetBranchStatus("fTracks.fP*", 1); | |
539 | tree->SetBranchStatus("fTracks.fR*", 1); | |
540 | tree->SetBranchStatus("fTracks.fKinkIndexes*", 1); | |
541 | } | |
542 | ||
543 | //____________________________________________________________________ | |
544 | Bool_t | |
545 | AliESDtrackCuts::AcceptTrack(AliESDtrack* esdTrack) { | |
546 | // | |
547 | // figure out if the tracks survives all the track cuts defined | |
548 | // | |
549 | // the different quality parameter and kinematic values are first | |
550 | // retrieved from the track. then it is found out what cuts the | |
551 | // track did not survive and finally the cuts are imposed. | |
552 | ||
553 | // this function needs the following branches: | |
554 | // fTracks.fFlags | |
555 | // fTracks.fITSncls | |
556 | // fTracks.fTPCncls | |
557 | // fTracks.fITSchi2 | |
558 | // fTracks.fTPCchi2 | |
559 | // fTracks.fC //GetExternalCovariance | |
560 | // fTracks.fD //GetImpactParameters | |
561 | // fTracks.fZ //GetImpactParameters | |
562 | // fTracks.fCdd //GetImpactParameters | |
563 | // fTracks.fCdz //GetImpactParameters | |
564 | // fTracks.fCzz //GetImpactParameters | |
565 | // fTracks.fP //GetPxPyPz | |
566 | // fTracks.fR //GetMass | |
567 | // fTracks.fP //GetMass | |
568 | // fTracks.fKinkIndexes | |
569 | ||
36853ddd | 570 | |
73318471 | 571 | UInt_t status = esdTrack->GetStatus(); |
572 | ||
73318471 | 573 | // getting quality parameters from the ESD track |
524916f0 | 574 | Int_t nClustersITS = esdTrack->GetITSclusters(0); |
575 | Int_t nClustersTPC = esdTrack->GetTPCclusters(0); | |
576 | ||
73318471 | 577 | Float_t chi2PerClusterITS = -1; |
578 | Float_t chi2PerClusterTPC = -1; | |
579 | if (nClustersITS!=0) | |
580 | chi2PerClusterITS = esdTrack->GetITSchi2()/Float_t(nClustersITS); | |
581 | if (nClustersTPC!=0) | |
582 | chi2PerClusterTPC = esdTrack->GetTPCchi2()/Float_t(nClustersTPC); | |
73318471 | 583 | Double_t extCov[15]; |
584 | esdTrack->GetExternalCovariance(extCov); | |
585 | ||
586 | // getting the track to vertex parameters | |
587 | Float_t nSigmaToVertex = GetSigmaToVertex(esdTrack); | |
524916f0 | 588 | |
589 | Float_t b[2]; | |
590 | Float_t bCov[3]; | |
591 | esdTrack->GetImpactParameters(b,bCov); | |
592 | if (bCov[0]<=0 || bCov[2]<=0) { | |
593 | AliDebug(1, "Estimated b resolution lower or equal zero!"); | |
594 | bCov[0]=0; bCov[2]=0; | |
595 | } | |
74687314 | 596 | |
e4617f4e | 597 | Float_t dcaToVertexXY = b[0]; |
74687314 | 598 | Float_t dcaToVertexZ = b[1]; |
599 | ||
86f0e195 | 600 | Float_t dcaToVertex = -1; |
601 | ||
602 | if (fCutDCAToVertex2D) | |
603 | { | |
604 | dcaToVertex = TMath::Sqrt(dcaToVertexXY*dcaToVertexXY/fCutDCAToVertexXY/fCutDCAToVertexXY + dcaToVertexZ*dcaToVertexZ/fCutDCAToVertexZ/fCutDCAToVertexZ); | |
605 | } | |
606 | else | |
607 | dcaToVertex = TMath::Sqrt(dcaToVertexXY*dcaToVertexXY + dcaToVertexZ*dcaToVertexZ); | |
608 | ||
74687314 | 609 | |
73318471 | 610 | // getting the kinematic variables of the track |
611 | // (assuming the mass is known) | |
612 | Double_t p[3]; | |
613 | esdTrack->GetPxPyPz(p); | |
36853ddd | 614 | |
73318471 | 615 | Float_t momentum = TMath::Sqrt(TMath::Power(p[0],2) + TMath::Power(p[1],2) + TMath::Power(p[2],2)); |
616 | Float_t pt = TMath::Sqrt(TMath::Power(p[0],2) + TMath::Power(p[1],2)); | |
617 | Float_t energy = TMath::Sqrt(TMath::Power(esdTrack->GetMass(),2) + TMath::Power(momentum,2)); | |
618 | ||
619 | ||
620 | //y-eta related calculations | |
621 | Float_t eta = -100.; | |
622 | Float_t y = -100.; | |
623 | if((momentum != TMath::Abs(p[2]))&&(momentum != 0)) | |
624 | eta = 0.5*TMath::Log((momentum + p[2])/(momentum - p[2])); | |
625 | if((energy != TMath::Abs(p[2]))&&(momentum != 0)) | |
626 | y = 0.5*TMath::Log((energy + p[2])/(energy - p[2])); | |
627 | ||
628 | ||
629 | //######################################################################## | |
630 | // cut the track? | |
631 | ||
632 | Bool_t cuts[kNCuts]; | |
633 | for (Int_t i=0; i<kNCuts; i++) cuts[i]=kFALSE; | |
634 | ||
635 | // track quality cuts | |
636 | if (fCutRequireTPCRefit && (status&AliESDtrack::kTPCrefit)==0) | |
637 | cuts[0]=kTRUE; | |
638 | if (fCutRequireITSRefit && (status&AliESDtrack::kITSrefit)==0) | |
639 | cuts[1]=kTRUE; | |
640 | if (nClustersTPC<fCutMinNClusterTPC) | |
641 | cuts[2]=kTRUE; | |
642 | if (nClustersITS<fCutMinNClusterITS) | |
643 | cuts[3]=kTRUE; | |
644 | if (chi2PerClusterTPC>fCutMaxChi2PerClusterTPC) | |
645 | cuts[4]=kTRUE; | |
646 | if (chi2PerClusterITS>fCutMaxChi2PerClusterITS) | |
647 | cuts[5]=kTRUE; | |
648 | if (extCov[0] > fCutMaxC11) | |
649 | cuts[6]=kTRUE; | |
650 | if (extCov[2] > fCutMaxC22) | |
651 | cuts[7]=kTRUE; | |
652 | if (extCov[5] > fCutMaxC33) | |
653 | cuts[8]=kTRUE; | |
654 | if (extCov[9] > fCutMaxC44) | |
655 | cuts[9]=kTRUE; | |
656 | if (extCov[14] > fCutMaxC55) | |
657 | cuts[10]=kTRUE; | |
658 | if (nSigmaToVertex > fCutNsigmaToVertex && fCutSigmaToVertexRequired) | |
659 | cuts[11] = kTRUE; | |
660 | // if n sigma could not be calculated | |
661 | if (nSigmaToVertex<0 && fCutSigmaToVertexRequired) | |
662 | cuts[12]=kTRUE; | |
663 | if (!fCutAcceptKinkDaughters && esdTrack->GetKinkIndex(0)>0) | |
664 | cuts[13]=kTRUE; | |
665 | // track kinematics cut | |
666 | if((momentum < fPMin) || (momentum > fPMax)) | |
667 | cuts[14]=kTRUE; | |
668 | if((pt < fPtMin) || (pt > fPtMax)) | |
669 | cuts[15] = kTRUE; | |
670 | if((p[0] < fPxMin) || (p[0] > fPxMax)) | |
671 | cuts[16] = kTRUE; | |
672 | if((p[1] < fPyMin) || (p[1] > fPyMax)) | |
673 | cuts[17] = kTRUE; | |
674 | if((p[2] < fPzMin) || (p[2] > fPzMax)) | |
675 | cuts[18] = kTRUE; | |
0f712a2e | 676 | if((eta < fEtaMin) || (eta > fEtaMax)) |
73318471 | 677 | cuts[19] = kTRUE; |
678 | if((y < fRapMin) || (y > fRapMax)) | |
679 | cuts[20] = kTRUE; | |
86f0e195 | 680 | if (fCutDCAToVertex2D && dcaToVertex > 1) |
524916f0 | 681 | cuts[21] = kTRUE; |
86f0e195 | 682 | if (!fCutDCAToVertex2D && TMath::Abs(dcaToVertexXY) > fCutDCAToVertexXY) |
e4617f4e | 683 | cuts[22] = kTRUE; |
86f0e195 | 684 | if (!fCutDCAToVertex2D && TMath::Abs(dcaToVertexZ) > fCutDCAToVertexZ) |
74687314 | 685 | cuts[23] = kTRUE; |
94c06b89 | 686 | |
687 | for (Int_t i = 0; i < 3; i++) | |
688 | cuts[24+i] = !CheckITSClusterRequirement(fCutClusterRequirementITS[i], esdTrack->HasPointOnITSLayer(i*2), esdTrack->HasPointOnITSLayer(i*2+1)); | |
73318471 | 689 | |
690 | Bool_t cut=kFALSE; | |
691 | for (Int_t i=0; i<kNCuts; i++) | |
692 | if (cuts[i]) cut = kTRUE; | |
524916f0 | 693 | |
694 | ||
695 | ||
73318471 | 696 | //######################################################################## |
697 | // filling histograms | |
698 | if (fHistogramsOn) { | |
699 | fhCutStatistics->Fill(fhCutStatistics->GetBinCenter(fhCutStatistics->GetXaxis()->FindBin("n tracks"))); | |
73318471 | 700 | if (cut) |
701 | fhCutStatistics->Fill(fhCutStatistics->GetBinCenter(fhCutStatistics->GetXaxis()->FindBin("n cut tracks"))); | |
702 | ||
703 | for (Int_t i=0; i<kNCuts; i++) { | |
704 | if (cuts[i]) | |
524916f0 | 705 | fhCutStatistics->Fill(fhCutStatistics->GetBinCenter(fhCutStatistics->GetXaxis()->FindBin(fgkCutNames[i]))); |
706 | ||
73318471 | 707 | for (Int_t j=i; j<kNCuts; j++) { |
524916f0 | 708 | if (cuts[i] && cuts[j]) { |
709 | Float_t xC = fhCutCorrelation->GetXaxis()->GetBinCenter(fhCutCorrelation->GetXaxis()->FindBin(fgkCutNames[i])); | |
710 | Float_t yC = fhCutCorrelation->GetYaxis()->GetBinCenter(fhCutCorrelation->GetYaxis()->FindBin(fgkCutNames[j])); | |
711 | fhCutCorrelation->Fill(xC, yC); | |
712 | } | |
73318471 | 713 | } |
714 | } | |
73318471 | 715 | } |
716 | ||
524916f0 | 717 | // now we loop over the filling of the histograms twice: once "before" the cut, once "after" |
718 | // the code is not in a function due to too many local variables that would need to be passed | |
73318471 | 719 | |
524916f0 | 720 | for (Int_t id = 0; id < 2; id++) |
721 | { | |
722 | // id = 0 --> before cut | |
723 | // id = 1 --> after cut | |
73318471 | 724 | |
524916f0 | 725 | if (fHistogramsOn) |
73318471 | 726 | { |
524916f0 | 727 | fhNClustersITS[id]->Fill(nClustersITS); |
728 | fhNClustersTPC[id]->Fill(nClustersTPC); | |
729 | fhChi2PerClusterITS[id]->Fill(chi2PerClusterITS); | |
730 | fhChi2PerClusterTPC[id]->Fill(chi2PerClusterTPC); | |
731 | ||
732 | fhC11[id]->Fill(extCov[0]); | |
733 | fhC22[id]->Fill(extCov[2]); | |
734 | fhC33[id]->Fill(extCov[5]); | |
735 | fhC44[id]->Fill(extCov[9]); | |
736 | fhC55[id]->Fill(extCov[14]); | |
737 | ||
738 | fhPt[id]->Fill(pt); | |
739 | fhEta[id]->Fill(eta); | |
740 | ||
741 | Float_t bRes[2]; | |
742 | bRes[0] = TMath::Sqrt(bCov[0]); | |
743 | bRes[1] = TMath::Sqrt(bCov[2]); | |
744 | ||
745 | fhDZ[id]->Fill(b[1]); | |
746 | fhDXY[id]->Fill(b[0]); | |
747 | fhDXYDZ[id]->Fill(dcaToVertex); | |
748 | fhDXYvsDZ[id]->Fill(b[1],b[0]); | |
749 | ||
750 | if (bRes[0]!=0 && bRes[1]!=0) { | |
751 | fhDZNormalized[id]->Fill(b[1]/bRes[1]); | |
752 | fhDXYNormalized[id]->Fill(b[0]/bRes[0]); | |
753 | fhDXYvsDZNormalized[id]->Fill(b[1]/bRes[1], b[0]/bRes[0]); | |
754 | fhNSigmaToVertex[id]->Fill(nSigmaToVertex); | |
755 | } | |
73318471 | 756 | } |
524916f0 | 757 | |
758 | // cut the track | |
759 | if (cut) | |
760 | return kFALSE; | |
73318471 | 761 | } |
762 | ||
763 | return kTRUE; | |
764 | } | |
765 | ||
94c06b89 | 766 | //____________________________________________________________________ |
767 | Bool_t AliESDtrackCuts::CheckITSClusterRequirement(ITSClusterRequirement req, Bool_t clusterL1, Bool_t clusterL2) | |
768 | { | |
769 | // checks if the cluster requirement is fullfilled (in this case: return kTRUE) | |
770 | ||
771 | switch (req) | |
772 | { | |
773 | case kOff: return kTRUE; | |
774 | case kNone: return !clusterL1 && !clusterL2; | |
775 | case kAny: return clusterL1 || clusterL2; | |
776 | case kFirst: return clusterL1; | |
777 | case kOnlyFirst: return clusterL1 && !clusterL2; | |
778 | case kSecond: return clusterL2; | |
779 | case kOnlySecond: return clusterL2 && !clusterL1; | |
780 | case kBoth: return clusterL1 && clusterL2; | |
781 | } | |
782 | ||
783 | return kFALSE; | |
784 | } | |
785 | ||
73318471 | 786 | //____________________________________________________________________ |
524916f0 | 787 | AliESDtrack* AliESDtrackCuts::GetTPCOnlyTrack(AliESDEvent* esd, Int_t iTrack) |
73318471 | 788 | { |
524916f0 | 789 | // creates a TPC only track from the given esd track |
790 | // the track has to be deleted by the user | |
73318471 | 791 | // |
524916f0 | 792 | // NB. most of the functionality to get a TPC only track from an ESD track is in AliESDtrack, where it should be |
793 | // there are only missing propagations here that are needed for old data | |
794 | // this function will therefore become obsolete | |
73318471 | 795 | // |
524916f0 | 796 | // adapted from code provided by CKB |
73318471 | 797 | |
524916f0 | 798 | if (!esd->GetPrimaryVertexTPC()) |
799 | return 0; // No TPC vertex no TPC tracks | |
73318471 | 800 | |
91c88f16 | 801 | if(!esd->GetPrimaryVertexTPC()->GetStatus()) |
802 | return 0; // TPC Vertex is created by default in AliESDEvent, do not use in this case | |
91c88f16 | 803 | |
524916f0 | 804 | AliESDtrack* track = esd->GetTrack(iTrack); |
805 | if (!track) | |
806 | return 0; | |
36853ddd | 807 | |
524916f0 | 808 | AliESDtrack *tpcTrack = new AliESDtrack(); |
73318471 | 809 | |
524916f0 | 810 | // This should have been done during the reconstruction |
811 | // fixed by Juri in r26675 | |
812 | // but recalculate for older data CKB | |
813 | Float_t p[2],cov[3]; | |
814 | track->GetImpactParametersTPC(p,cov); | |
815 | if(p[0]==0&&p[1]==0) | |
816 | track->RelateToVertexTPC(esd->GetPrimaryVertexTPC(),esd->GetMagneticField(),kVeryBig); | |
817 | // BKC | |
73318471 | 818 | |
524916f0 | 819 | // only true if we have a tpc track |
820 | if (!track->FillTPCOnlyTrack(*tpcTrack)) | |
821 | { | |
822 | delete tpcTrack; | |
823 | return 0; | |
73318471 | 824 | } |
825 | ||
524916f0 | 826 | // propagate to Vertex |
827 | // not needed for normal reconstructed ESDs... | |
828 | // Double_t pTPC[2],covTPC[3]; | |
829 | // tpcTrack->PropagateToDCA(esd->GetPrimaryVertexTPC(), esd->GetMagneticField(), 10000, pTPC, covTPC); | |
830 | ||
831 | return tpcTrack; | |
73318471 | 832 | } |
833 | ||
834 | //____________________________________________________________________ | |
36853ddd | 835 | TObjArray* AliESDtrackCuts::GetAcceptedTracks(AliESDEvent* esd,Bool_t bTPC) |
73318471 | 836 | { |
837 | // | |
838 | // returns an array of all tracks that pass the cuts | |
36853ddd | 839 | // or an array of TPC only tracks (propagated to the TPC vertex during reco) |
840 | // tracks that pass the cut | |
73318471 | 841 | |
842 | TObjArray* acceptedTracks = new TObjArray(); | |
843 | ||
844 | // loop over esd tracks | |
845 | for (Int_t iTrack = 0; iTrack < esd->GetNumberOfTracks(); iTrack++) { | |
36853ddd | 846 | if(bTPC){ |
847 | if(!esd->GetPrimaryVertexTPC())return acceptedTracks; // No TPC vertex no TPC tracks | |
91c88f16 | 848 | if(!esd->GetPrimaryVertexTPC()->GetStatus())return acceptedTracks; // No proper TPC vertex, only the default |
36853ddd | 849 | |
524916f0 | 850 | AliESDtrack *tpcTrack = GetTPCOnlyTrack(esd, iTrack); |
851 | if (!tpcTrack) | |
852 | continue; | |
853 | ||
854 | if (AcceptTrack(tpcTrack)) { | |
855 | acceptedTracks->Add(tpcTrack); | |
36853ddd | 856 | } |
524916f0 | 857 | else |
858 | delete tpcTrack; | |
859 | } | |
860 | else | |
861 | { | |
862 | AliESDtrack* track = esd->GetTrack(iTrack); | |
863 | if(AcceptTrack(track)) | |
864 | acceptedTracks->Add(track); | |
36853ddd | 865 | } |
36853ddd | 866 | } |
867 | if(bTPC)acceptedTracks->SetOwner(kTRUE); | |
73318471 | 868 | return acceptedTracks; |
869 | } | |
870 | ||
871 | //____________________________________________________________________ | |
872 | Int_t AliESDtrackCuts::CountAcceptedTracks(AliESDEvent* esd) | |
873 | { | |
874 | // | |
875 | // returns an the number of tracks that pass the cuts | |
876 | // | |
877 | ||
878 | Int_t count = 0; | |
879 | ||
880 | // loop over esd tracks | |
881 | for (Int_t iTrack = 0; iTrack < esd->GetNumberOfTracks(); iTrack++) { | |
882 | AliESDtrack* track = esd->GetTrack(iTrack); | |
73318471 | 883 | if (AcceptTrack(track)) |
884 | count++; | |
885 | } | |
886 | ||
887 | return count; | |
888 | } | |
889 | ||
890 | //____________________________________________________________________ | |
891 | void AliESDtrackCuts::DefineHistograms(Int_t color) { | |
892 | // | |
893 | // diagnostics histograms are defined | |
894 | // | |
895 | ||
896 | fHistogramsOn=kTRUE; | |
897 | ||
898 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
899 | TH1::AddDirectory(kFALSE); | |
900 | ||
901 | //################################################################################### | |
902 | // defining histograms | |
903 | ||
904 | fhCutStatistics = new TH1F("cut_statistics","cut statistics",kNCuts+4,-0.5,kNCuts+3.5); | |
905 | ||
906 | fhCutStatistics->GetXaxis()->SetBinLabel(1,"n tracks"); | |
907 | fhCutStatistics->GetXaxis()->SetBinLabel(2,"n cut tracks"); | |
908 | ||
909 | fhCutCorrelation = new TH2F("cut_correlation","cut correlation",kNCuts,-0.5,kNCuts-0.5,kNCuts,-0.5,kNCuts-0.5);; | |
910 | ||
911 | for (Int_t i=0; i<kNCuts; i++) { | |
912 | fhCutStatistics->GetXaxis()->SetBinLabel(i+4,fgkCutNames[i]); | |
913 | fhCutCorrelation->GetXaxis()->SetBinLabel(i+1,fgkCutNames[i]); | |
914 | fhCutCorrelation->GetYaxis()->SetBinLabel(i+1,fgkCutNames[i]); | |
0f712a2e | 915 | } |
73318471 | 916 | |
917 | fhCutStatistics ->SetLineColor(color); | |
918 | fhCutCorrelation ->SetLineColor(color); | |
919 | fhCutStatistics ->SetLineWidth(2); | |
920 | fhCutCorrelation ->SetLineWidth(2); | |
921 | ||
73318471 | 922 | for (Int_t i=0; i<2; i++) { |
524916f0 | 923 | fhNClustersITS[i] = new TH1F("nClustersITS" ,"",8,-0.5,7.5); |
924 | fhNClustersTPC[i] = new TH1F("nClustersTPC" ,"",165,-0.5,164.5); | |
925 | fhChi2PerClusterITS[i] = new TH1F("chi2PerClusterITS","",500,0,10); | |
926 | fhChi2PerClusterTPC[i] = new TH1F("chi2PerClusterTPC","",500,0,10); | |
927 | ||
928 | fhC11[i] = new TH1F("covMatrixDiagonal11","",2000,0,20); | |
929 | fhC22[i] = new TH1F("covMatrixDiagonal22","",2000,0,20); | |
0f712a2e | 930 | fhC33[i] = new TH1F("covMatrixDiagonal33","",1000,0,0.1); |
931 | fhC44[i] = new TH1F("covMatrixDiagonal44","",1000,0,0.1); | |
524916f0 | 932 | fhC55[i] = new TH1F("covMatrixDiagonal55","",1000,0,5); |
933 | ||
934 | fhDXY[i] = new TH1F("dXY" ,"",500,-10,10); | |
935 | fhDZ[i] = new TH1F("dZ" ,"",500,-10,10); | |
936 | fhDXYDZ[i] = new TH1F("dXYDZ" ,"",500,0,10); | |
937 | fhDXYvsDZ[i] = new TH2F("dXYvsDZ","",200,-10,10,200,-10,10); | |
938 | ||
939 | fhDXYNormalized[i] = new TH1F("dXYNormalized" ,"",500,-10,10); | |
940 | fhDZNormalized[i] = new TH1F("dZNormalized" ,"",500,-10,10); | |
941 | fhDXYvsDZNormalized[i] = new TH2F("dXYvsDZNormalized","",200,-10,10,200,-10,10); | |
942 | ||
943 | fhNSigmaToVertex[i] = new TH1F("nSigmaToVertex","",500,0,10); | |
944 | ||
86f0e195 | 945 | fhPt[i] = new TH1F("pt" ,"p_{T} distribution;p_{T} (GeV/c)", 800, 0.0, 10.0); |
524916f0 | 946 | fhEta[i] = new TH1F("eta" ,"#eta distribution;#eta",40,-2.0,2.0); |
73318471 | 947 | |
948 | fhNClustersITS[i]->SetTitle("n ITS clusters"); | |
949 | fhNClustersTPC[i]->SetTitle("n TPC clusters"); | |
950 | fhChi2PerClusterITS[i]->SetTitle("#Chi^{2} per ITS cluster"); | |
951 | fhChi2PerClusterTPC[i]->SetTitle("#Chi^{2} per TPC cluster"); | |
952 | ||
953 | fhC11[i]->SetTitle("cov 11 : #sigma_{y}^{2} [cm^{2}]"); | |
954 | fhC22[i]->SetTitle("cov 22 : #sigma_{z}^{2} [cm^{2}]"); | |
955 | fhC33[i]->SetTitle("cov 33 : #sigma_{sin(#phi)}^{2}"); | |
956 | fhC44[i]->SetTitle("cov 44 : #sigma_{tan(#theta_{dip})}^{2}"); | |
957 | fhC55[i]->SetTitle("cov 55 : #sigma_{1/p_{T}}^{2} [(c/GeV)^2]"); | |
958 | ||
86f0e195 | 959 | fhDXY[i]->SetXTitle("transverse impact parameter (cm)"); |
960 | fhDZ[i]->SetXTitle("longitudinal impact parameter (cm)"); | |
961 | fhDXYDZ[i]->SetTitle("absolute impact parameter;sqrt(dXY**2 + dZ**2) (cm)"); | |
962 | fhDXYvsDZ[i]->SetXTitle("longitudinal impact parameter (cm)"); | |
963 | fhDXYvsDZ[i]->SetYTitle("transverse impact parameter (cm)"); | |
73318471 | 964 | |
86f0e195 | 965 | fhDXYNormalized[i]->SetTitle("normalized trans impact par (n#sigma)"); |
966 | fhDZNormalized[i]->SetTitle("normalized long impact par (n#sigma)"); | |
967 | fhDXYvsDZNormalized[i]->SetTitle("normalized long impact par (n#sigma)"); | |
968 | fhDXYvsDZNormalized[i]->SetYTitle("normalized trans impact par (n#sigma)"); | |
73318471 | 969 | fhNSigmaToVertex[i]->SetTitle("n #sigma to vertex"); |
970 | ||
971 | fhNClustersITS[i]->SetLineColor(color); fhNClustersITS[i]->SetLineWidth(2); | |
972 | fhNClustersTPC[i]->SetLineColor(color); fhNClustersTPC[i]->SetLineWidth(2); | |
973 | fhChi2PerClusterITS[i]->SetLineColor(color); fhChi2PerClusterITS[i]->SetLineWidth(2); | |
974 | fhChi2PerClusterTPC[i]->SetLineColor(color); fhChi2PerClusterTPC[i]->SetLineWidth(2); | |
975 | ||
976 | fhC11[i]->SetLineColor(color); fhC11[i]->SetLineWidth(2); | |
977 | fhC22[i]->SetLineColor(color); fhC22[i]->SetLineWidth(2); | |
978 | fhC33[i]->SetLineColor(color); fhC33[i]->SetLineWidth(2); | |
979 | fhC44[i]->SetLineColor(color); fhC44[i]->SetLineWidth(2); | |
980 | fhC55[i]->SetLineColor(color); fhC55[i]->SetLineWidth(2); | |
981 | ||
982 | fhDXY[i]->SetLineColor(color); fhDXY[i]->SetLineWidth(2); | |
524916f0 | 983 | fhDZ[i]->SetLineColor(color); fhDZ[i]->SetLineWidth(2); |
984 | fhDXYDZ[i]->SetLineColor(color); fhDXYDZ[i]->SetLineWidth(2); | |
73318471 | 985 | |
986 | fhDXYNormalized[i]->SetLineColor(color); fhDXYNormalized[i]->SetLineWidth(2); | |
987 | fhDZNormalized[i]->SetLineColor(color); fhDZNormalized[i]->SetLineWidth(2); | |
988 | fhNSigmaToVertex[i]->SetLineColor(color); fhNSigmaToVertex[i]->SetLineWidth(2); | |
989 | } | |
990 | ||
991 | // The number of sigmas to the vertex is per definition gaussian | |
992 | ffDTheoretical = new TF1("nSigmaToVertexTheoretical","([0]/2.506628274)*exp(-(x**2)/2)",0,50); | |
993 | ffDTheoretical->SetParameter(0,1); | |
524916f0 | 994 | |
73318471 | 995 | TH1::AddDirectory(oldStatus); |
996 | } | |
997 | ||
998 | //____________________________________________________________________ | |
999 | Bool_t AliESDtrackCuts::LoadHistograms(const Char_t* dir) | |
1000 | { | |
1001 | // | |
1002 | // loads the histograms from a file | |
1003 | // if dir is empty a directory with the name of this object is taken (like in SaveHistogram) | |
1004 | // | |
1005 | ||
1006 | if (!dir) | |
1007 | dir = GetName(); | |
1008 | ||
1009 | if (!gDirectory->cd(dir)) | |
1010 | return kFALSE; | |
1011 | ||
1012 | ffDTheoretical = dynamic_cast<TF1*> (gDirectory->Get("nSigmaToVertexTheory")); | |
1013 | ||
1014 | fhCutStatistics = dynamic_cast<TH1F*> (gDirectory->Get("cut_statistics")); | |
1015 | fhCutCorrelation = dynamic_cast<TH2F*> (gDirectory->Get("cut_correlation")); | |
1016 | ||
73318471 | 1017 | for (Int_t i=0; i<2; i++) { |
1018 | if (i==0) | |
1019 | { | |
1020 | gDirectory->cd("before_cuts"); | |
73318471 | 1021 | } |
1022 | else | |
73318471 | 1023 | gDirectory->cd("after_cuts"); |
73318471 | 1024 | |
524916f0 | 1025 | fhNClustersITS[i] = dynamic_cast<TH1F*> (gDirectory->Get("nClustersITS" )); |
1026 | fhNClustersTPC[i] = dynamic_cast<TH1F*> (gDirectory->Get("nClustersTPC" )); | |
1027 | fhChi2PerClusterITS[i] = dynamic_cast<TH1F*> (gDirectory->Get("chi2PerClusterITS")); | |
1028 | fhChi2PerClusterTPC[i] = dynamic_cast<TH1F*> (gDirectory->Get("chi2PerClusterTPC")); | |
73318471 | 1029 | |
524916f0 | 1030 | fhC11[i] = dynamic_cast<TH1F*> (gDirectory->Get("covMatrixDiagonal11")); |
1031 | fhC22[i] = dynamic_cast<TH1F*> (gDirectory->Get("covMatrixDiagonal22")); | |
1032 | fhC33[i] = dynamic_cast<TH1F*> (gDirectory->Get("covMatrixDiagonal33")); | |
1033 | fhC44[i] = dynamic_cast<TH1F*> (gDirectory->Get("covMatrixDiagonal44")); | |
1034 | fhC55[i] = dynamic_cast<TH1F*> (gDirectory->Get("covMatrixDiagonal55")); | |
73318471 | 1035 | |
524916f0 | 1036 | fhDXY[i] = dynamic_cast<TH1F*> (gDirectory->Get("dXY" )); |
1037 | fhDZ[i] = dynamic_cast<TH1F*> (gDirectory->Get("dZ" )); | |
1038 | fhDXYDZ[i] = dynamic_cast<TH1F*> (gDirectory->Get("dXYDZ")); | |
1039 | fhDXYvsDZ[i] = dynamic_cast<TH2F*> (gDirectory->Get("dXYvsDZ")); | |
73318471 | 1040 | |
524916f0 | 1041 | fhDXYNormalized[i] = dynamic_cast<TH1F*> (gDirectory->Get("dXYNormalized" )); |
1042 | fhDZNormalized[i] = dynamic_cast<TH1F*> (gDirectory->Get("dZNormalized" )); | |
1043 | fhDXYvsDZNormalized[i] = dynamic_cast<TH2F*> (gDirectory->Get("dXYvsDZNormalized")); | |
1044 | fhNSigmaToVertex[i] = dynamic_cast<TH1F*> (gDirectory->Get("nSigmaToVertex")); | |
73318471 | 1045 | |
524916f0 | 1046 | fhPt[i] = dynamic_cast<TH1F*> (gDirectory->Get("pt")); |
1047 | fhEta[i] = dynamic_cast<TH1F*> (gDirectory->Get("eta")); | |
73318471 | 1048 | |
1049 | gDirectory->cd("../"); | |
1050 | } | |
1051 | ||
1052 | gDirectory->cd(".."); | |
1053 | ||
1054 | return kTRUE; | |
1055 | } | |
1056 | ||
1057 | //____________________________________________________________________ | |
1058 | void AliESDtrackCuts::SaveHistograms(const Char_t* dir) { | |
1059 | // | |
1060 | // saves the histograms in a directory (dir) | |
1061 | // | |
1062 | ||
1063 | if (!fHistogramsOn) { | |
1064 | AliDebug(0, "Histograms not on - cannot save histograms!!!"); | |
1065 | return; | |
1066 | } | |
1067 | ||
1068 | if (!dir) | |
1069 | dir = GetName(); | |
1070 | ||
1071 | gDirectory->mkdir(dir); | |
1072 | gDirectory->cd(dir); | |
1073 | ||
1074 | gDirectory->mkdir("before_cuts"); | |
1075 | gDirectory->mkdir("after_cuts"); | |
1076 | ||
1077 | // a factor of 2 is needed since n sigma is positive | |
1078 | ffDTheoretical->SetParameter(0,2*fhNSigmaToVertex[0]->Integral("width")); | |
1079 | ffDTheoretical->Write("nSigmaToVertexTheory"); | |
1080 | ||
1081 | fhCutStatistics->Write(); | |
1082 | fhCutCorrelation->Write(); | |
1083 | ||
1084 | for (Int_t i=0; i<2; i++) { | |
1085 | if (i==0) | |
1086 | gDirectory->cd("before_cuts"); | |
1087 | else | |
1088 | gDirectory->cd("after_cuts"); | |
1089 | ||
1090 | fhNClustersITS[i] ->Write(); | |
1091 | fhNClustersTPC[i] ->Write(); | |
1092 | fhChi2PerClusterITS[i] ->Write(); | |
1093 | fhChi2PerClusterTPC[i] ->Write(); | |
1094 | ||
1095 | fhC11[i] ->Write(); | |
1096 | fhC22[i] ->Write(); | |
1097 | fhC33[i] ->Write(); | |
1098 | fhC44[i] ->Write(); | |
1099 | fhC55[i] ->Write(); | |
1100 | ||
1101 | fhDXY[i] ->Write(); | |
1102 | fhDZ[i] ->Write(); | |
524916f0 | 1103 | fhDXYDZ[i] ->Write(); |
73318471 | 1104 | fhDXYvsDZ[i] ->Write(); |
1105 | ||
1106 | fhDXYNormalized[i] ->Write(); | |
1107 | fhDZNormalized[i] ->Write(); | |
1108 | fhDXYvsDZNormalized[i] ->Write(); | |
1109 | fhNSigmaToVertex[i] ->Write(); | |
1110 | ||
1111 | fhPt[i] ->Write(); | |
1112 | fhEta[i] ->Write(); | |
1113 | ||
1114 | gDirectory->cd("../"); | |
1115 | } | |
1116 | ||
1117 | gDirectory->cd("../"); | |
1118 | } | |
1119 | ||
1120 | //____________________________________________________________________ | |
1121 | void AliESDtrackCuts::DrawHistograms() | |
1122 | { | |
1123 | // draws some histograms | |
1124 | ||
1125 | TCanvas* canvas1 = new TCanvas(Form("%s_1", GetName()), "Track Quality Results1", 800, 800); | |
1126 | canvas1->Divide(2, 2); | |
1127 | ||
1128 | canvas1->cd(1); | |
1129 | fhNClustersTPC[0]->SetStats(kFALSE); | |
1130 | fhNClustersTPC[0]->Draw(); | |
1131 | ||
1132 | canvas1->cd(2); | |
1133 | fhChi2PerClusterTPC[0]->SetStats(kFALSE); | |
1134 | fhChi2PerClusterTPC[0]->Draw(); | |
1135 | ||
1136 | canvas1->cd(3); | |
1137 | fhNSigmaToVertex[0]->SetStats(kFALSE); | |
1138 | fhNSigmaToVertex[0]->GetXaxis()->SetRangeUser(0, 10); | |
1139 | fhNSigmaToVertex[0]->Draw(); | |
1140 | ||
1141 | canvas1->SaveAs(Form("%s_%s.gif", GetName(), canvas1->GetName())); | |
1142 | ||
1143 | TCanvas* canvas2 = new TCanvas(Form("%s_2", GetName()), "Track Quality Results2", 1200, 800); | |
1144 | canvas2->Divide(3, 2); | |
1145 | ||
1146 | canvas2->cd(1); | |
1147 | fhC11[0]->SetStats(kFALSE); | |
1148 | gPad->SetLogy(); | |
1149 | fhC11[0]->Draw(); | |
1150 | ||
1151 | canvas2->cd(2); | |
1152 | fhC22[0]->SetStats(kFALSE); | |
1153 | gPad->SetLogy(); | |
1154 | fhC22[0]->Draw(); | |
1155 | ||
1156 | canvas2->cd(3); | |
1157 | fhC33[0]->SetStats(kFALSE); | |
1158 | gPad->SetLogy(); | |
1159 | fhC33[0]->Draw(); | |
1160 | ||
1161 | canvas2->cd(4); | |
1162 | fhC44[0]->SetStats(kFALSE); | |
1163 | gPad->SetLogy(); | |
1164 | fhC44[0]->Draw(); | |
1165 | ||
1166 | canvas2->cd(5); | |
1167 | fhC55[0]->SetStats(kFALSE); | |
1168 | gPad->SetLogy(); | |
1169 | fhC55[0]->Draw(); | |
1170 | ||
1171 | canvas2->SaveAs(Form("%s_%s.gif", GetName(), canvas2->GetName())); | |
1172 | ||
1173 | TCanvas* canvas3 = new TCanvas(Form("%s_3", GetName()), "Track Quality Results3", 1200, 800); | |
1174 | canvas3->Divide(3, 2); | |
1175 | ||
1176 | canvas3->cd(1); | |
1177 | fhDXY[0]->SetStats(kFALSE); | |
1178 | gPad->SetLogy(); | |
1179 | fhDXY[0]->Draw(); | |
1180 | ||
1181 | canvas3->cd(2); | |
1182 | fhDZ[0]->SetStats(kFALSE); | |
1183 | gPad->SetLogy(); | |
1184 | fhDZ[0]->Draw(); | |
1185 | ||
1186 | canvas3->cd(3); | |
1187 | fhDXYvsDZ[0]->SetStats(kFALSE); | |
1188 | gPad->SetLogz(); | |
1189 | gPad->SetRightMargin(0.15); | |
1190 | fhDXYvsDZ[0]->Draw("COLZ"); | |
1191 | ||
1192 | canvas3->cd(4); | |
1193 | fhDXYNormalized[0]->SetStats(kFALSE); | |
1194 | gPad->SetLogy(); | |
1195 | fhDXYNormalized[0]->Draw(); | |
1196 | ||
1197 | canvas3->cd(5); | |
1198 | fhDZNormalized[0]->SetStats(kFALSE); | |
1199 | gPad->SetLogy(); | |
1200 | fhDZNormalized[0]->Draw(); | |
1201 | ||
1202 | canvas3->cd(6); | |
1203 | fhDXYvsDZNormalized[0]->SetStats(kFALSE); | |
1204 | gPad->SetLogz(); | |
1205 | gPad->SetRightMargin(0.15); | |
1206 | fhDXYvsDZNormalized[0]->Draw("COLZ"); | |
1207 | ||
1208 | canvas3->SaveAs(Form("%s_%s.gif", GetName(), canvas3->GetName())); | |
1209 | ||
1210 | TCanvas* canvas4 = new TCanvas(Form("%s_4", GetName()), "Track Quality Results4", 800, 500); | |
1211 | canvas4->Divide(2, 1); | |
1212 | ||
1213 | canvas4->cd(1); | |
1214 | fhCutStatistics->SetStats(kFALSE); | |
1215 | fhCutStatistics->LabelsOption("v"); | |
1216 | gPad->SetBottomMargin(0.3); | |
1217 | fhCutStatistics->Draw(); | |
1218 | ||
1219 | canvas4->cd(2); | |
1220 | fhCutCorrelation->SetStats(kFALSE); | |
1221 | fhCutCorrelation->LabelsOption("v"); | |
1222 | gPad->SetBottomMargin(0.3); | |
1223 | gPad->SetLeftMargin(0.3); | |
1224 | fhCutCorrelation->Draw("COLZ"); | |
1225 | ||
1226 | canvas4->SaveAs(Form("%s_%s.gif", GetName(), canvas4->GetName())); | |
1227 | ||
1228 | /*canvas->cd(1); | |
1229 | fhDXYvsDZNormalized[0]->SetStats(kFALSE); | |
1230 | fhDXYvsDZNormalized[0]->DrawCopy("COLZ"); | |
1231 | ||
1232 | canvas->cd(2); | |
1233 | fhNClustersTPC[0]->SetStats(kFALSE); | |
1234 | fhNClustersTPC[0]->DrawCopy(); | |
1235 | ||
1236 | canvas->cd(3); | |
1237 | fhChi2PerClusterITS[0]->SetStats(kFALSE); | |
1238 | fhChi2PerClusterITS[0]->DrawCopy(); | |
1239 | fhChi2PerClusterITS[1]->SetLineColor(2); | |
1240 | fhChi2PerClusterITS[1]->DrawCopy("SAME"); | |
1241 | ||
1242 | canvas->cd(4); | |
1243 | fhChi2PerClusterTPC[0]->SetStats(kFALSE); | |
1244 | fhChi2PerClusterTPC[0]->DrawCopy(); | |
1245 | fhChi2PerClusterTPC[1]->SetLineColor(2); | |
1246 | fhChi2PerClusterTPC[1]->DrawCopy("SAME");*/ | |
1247 | } | |
1248 | ||
94c06b89 | 1249 | Float_t AliESDtrackCuts::GetMinNsigmaToVertex() const |
1250 | { | |
1251 | // deprecated, please use GetMaxNsigmaToVertex | |
1252 | ||
1253 | Printf("WARNING: AliESDtrackCuts::GetMinNsigmaToVertex is DEPRECATED and will be removed in the next release. Please use GetMaxNsigmaToVertex instead. Renaming was done to improve code readability."); | |
1254 | ||
1255 | return GetMaxNsigmaToVertex(); | |
1256 | } | |
1257 | ||
1258 | void AliESDtrackCuts::SetMinNsigmaToVertex(Float_t sigma) | |
1259 | { | |
1260 | // deprecated, will be removed in next release | |
1261 | ||
1262 | Printf("WARNING: AliESDtrackCuts::SetMinNsigmaToVertex is DEPRECATED and will be removed in the next release. Please use SetMaxNsigmaToVertex instead. Renaming was done to improve code readability."); | |
1263 | ||
1264 | SetMaxNsigmaToVertex(sigma); | |
1265 | } | |
1266 | ||
1267 | void AliESDtrackCuts::SetDCAToVertex(Float_t dist) | |
1268 | { | |
1269 | // deprecated, will be removed in next release | |
1270 | ||
94c06b89 | 1271 | SetMaxDCAToVertex(dist); |
1272 | } | |
1273 | ||
86f0e195 | 1274 | void AliESDtrackCuts::SetMaxDCAToVertex(Float_t dist) |
1275 | { | |
1276 | // deprecated, will be removed in next release | |
1277 | ||
1278 | Printf("WARNING: AliESDtrackCuts::SetMaxDCAToVertex is DEPRECATED and will be removed in the next release. Please use SetDCAToVertexXY(dist) and SetDCAToVertexZ(dist) and SetDCAToVertex2D(kTRUE)"); | |
1279 | ||
1280 | SetDCAToVertexXY(dist); | |
1281 | SetDCAToVertexZ(dist); | |
1282 | SetDCAToVertex2D(kTRUE); | |
1283 | } | |
1284 | ||
94c06b89 | 1285 | void AliESDtrackCuts::SetDCAToVertexXY(Float_t dist) |
1286 | { | |
1287 | // deprecated, will be removed in next release | |
1288 | ||
1289 | Printf("WARNING: AliESDtrackCuts::SetDCAToVertexXY is DEPRECATED and will be removed in the next release. Please use SetMaxDCAToVertexXY instead. Renaming was done to improve code readability."); | |
1290 | ||
1291 | SetMaxDCAToVertexXY(dist); | |
1292 | } | |
1293 | ||
1294 | void AliESDtrackCuts::SetDCAToVertexZ(Float_t dist) | |
1295 | { | |
1296 | // deprecated, will be removed in next release | |
1297 | ||
1298 | Printf("WARNING: AliESDtrackCuts::SetDCAToVertexZ is DEPRECATED and will be removed in the next release. Please use SetMaxDCAToVertexZ instead. Renaming was done to improve code readability."); | |
1299 | ||
1300 | SetMaxDCAToVertexZ(dist); | |
1301 | } |