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