]>
Commit | Line | Data |
---|---|---|
eec7bbb0 | 1 | // Track QA task (efficiency and pt resolution) |
2 | // | |
3 | // Author: S.Aiola | |
4 | ||
5 | #include <TH3F.h> | |
6 | #include <THnSparse.h> | |
7 | #include <TMath.h> | |
8 | #include <TString.h> | |
9 | #include <Riostream.h> | |
10 | ||
11 | #include "AliPicoTrack.h" | |
1876c758 | 12 | #include "AliESDtrack.h" |
eec7bbb0 | 13 | #include "AliAODMCParticle.h" |
14 | #include "AliParticleContainer.h" | |
15 | #include "AliLog.h" | |
16 | ||
17 | #include "AliEmcalTrackingQATask.h" | |
18 | ||
19 | ClassImp(AliEmcalTrackingQATask) | |
20 | ||
21 | //________________________________________________________________________ | |
22 | AliEmcalTrackingQATask::AliEmcalTrackingQATask() : | |
23 | AliAnalysisTaskEmcal("AliEmcalTrackingQA", kTRUE), | |
d7ab1a93 | 24 | fSelectHIJING(kTRUE), |
8c96eb55 | 25 | fDoSigma1OverPt(kFALSE), |
e00c3b87 | 26 | fDoSigmaPtOverPtGen(kFALSE), |
eec7bbb0 | 27 | fGeneratorLevel(0), |
28 | fDetectorLevel(0), | |
427d6cf5 | 29 | fNPtHistBins(0), |
30 | fPtHistBins(0), | |
31 | fNEtaHistBins(0), | |
32 | fEtaHistBins(0), | |
33 | fNPhiHistBins(0), | |
34 | fPhiHistBins(0), | |
35 | fNCentHistBins(0), | |
36 | fCentHistBins(0), | |
8c96eb55 | 37 | fNPtRelDiffHistBins(0), |
38 | fPtRelDiffHistBins(0), | |
427d6cf5 | 39 | fNPtResHistBins(0), |
40 | fPtResHistBins(0), | |
1876c758 | 41 | f1OverPtResHistBins(0), |
42 | fN1OverPtResHistBins(0), | |
427d6cf5 | 43 | fNIntegerHistBins(0), |
44 | fIntegerHistBins(0), | |
1876c758 | 45 | fTracks(0), |
46 | fParticlesPhysPrim(0), | |
eec7bbb0 | 47 | fParticlesMatched(0) |
48 | { | |
49 | // Default constructor. | |
50 | ||
51 | SetMakeGeneralHistograms(kTRUE); | |
427d6cf5 | 52 | |
53 | GenerateHistoBins(); | |
eec7bbb0 | 54 | } |
55 | ||
56 | //________________________________________________________________________ | |
57 | AliEmcalTrackingQATask::AliEmcalTrackingQATask(const char *name) : | |
58 | AliAnalysisTaskEmcal(name, kTRUE), | |
d7ab1a93 | 59 | fSelectHIJING(kTRUE), |
8c96eb55 | 60 | fDoSigma1OverPt(kFALSE), |
e00c3b87 | 61 | fDoSigmaPtOverPtGen(kFALSE), |
eec7bbb0 | 62 | fGeneratorLevel(0), |
63 | fDetectorLevel(0), | |
427d6cf5 | 64 | fNPtHistBins(0), |
65 | fPtHistBins(0), | |
66 | fNEtaHistBins(0), | |
67 | fEtaHistBins(0), | |
68 | fNPhiHistBins(0), | |
69 | fPhiHistBins(0), | |
70 | fNCentHistBins(0), | |
71 | fCentHistBins(0), | |
8c96eb55 | 72 | fNPtRelDiffHistBins(0), |
73 | fPtRelDiffHistBins(0), | |
427d6cf5 | 74 | fNPtResHistBins(0), |
75 | fPtResHistBins(0), | |
1876c758 | 76 | f1OverPtResHistBins(0), |
77 | fN1OverPtResHistBins(0), | |
427d6cf5 | 78 | fNIntegerHistBins(0), |
79 | fIntegerHistBins(0), | |
1876c758 | 80 | fTracks(0), |
81 | fParticlesPhysPrim(0), | |
eec7bbb0 | 82 | fParticlesMatched(0) |
83 | { | |
84 | // Standard constructor. | |
85 | ||
86 | SetMakeGeneralHistograms(kTRUE); | |
427d6cf5 | 87 | |
88 | GenerateHistoBins(); | |
eec7bbb0 | 89 | } |
90 | ||
91 | //________________________________________________________________________ | |
92 | AliEmcalTrackingQATask::~AliEmcalTrackingQATask() | |
93 | { | |
94 | // Destructor. | |
95 | } | |
96 | ||
427d6cf5 | 97 | //________________________________________________________________________ |
98 | void AliEmcalTrackingQATask::GenerateHistoBins() | |
99 | { | |
7892ca4d | 100 | fNPtHistBins = 82; |
427d6cf5 | 101 | fPtHistBins = new Double_t[fNPtHistBins+1]; |
7892ca4d | 102 | GenerateFixedBinArray(6, 0, 0.3, fPtHistBins); |
103 | GenerateFixedBinArray(7, 0.3, 1, fPtHistBins+6); | |
104 | GenerateFixedBinArray(10, 1, 3, fPtHistBins+13); | |
105 | GenerateFixedBinArray(14, 3, 10, fPtHistBins+23); | |
106 | GenerateFixedBinArray(10, 10, 20, fPtHistBins+37); | |
107 | GenerateFixedBinArray(15, 20, 50, fPtHistBins+47); | |
108 | GenerateFixedBinArray(20, 50, 150, fPtHistBins+62); | |
427d6cf5 | 109 | |
110 | fNEtaHistBins = 100; | |
111 | fEtaHistBins = new Double_t[fNEtaHistBins+1]; | |
112 | GenerateFixedBinArray(fNEtaHistBins, -1, 1, fEtaHistBins); | |
113 | ||
114 | fNPhiHistBins = 101; | |
115 | fPhiHistBins = new Double_t[fNPhiHistBins+1]; | |
116 | GenerateFixedBinArray(fNPhiHistBins, 0, TMath::Pi() * 2.02, fPhiHistBins); | |
117 | ||
118 | fNCentHistBins = 4; | |
119 | fCentHistBins = new Double_t[fNCentHistBins+1]; | |
120 | fCentHistBins[0] = 0; | |
121 | fCentHistBins[1] = 10; | |
122 | fCentHistBins[2] = 30; | |
123 | fCentHistBins[3] = 50; | |
124 | fCentHistBins[4] = 90; | |
125 | ||
8c96eb55 | 126 | fNPtResHistBins = 175; |
427d6cf5 | 127 | fPtResHistBins = new Double_t[fNPtResHistBins+1]; |
8c96eb55 | 128 | GenerateFixedBinArray(50, 0, 0.05, fPtResHistBins); |
129 | GenerateFixedBinArray(25, 0.05, 0.10, fPtResHistBins+50); | |
130 | GenerateFixedBinArray(25, 0.10, 0.20, fPtResHistBins+75); | |
131 | GenerateFixedBinArray(30, 0.20, 0.50, fPtResHistBins+100); | |
132 | GenerateFixedBinArray(25, 0.50, 1.00, fPtResHistBins+130); | |
133 | GenerateFixedBinArray(20, 1.00, 2.00, fPtResHistBins+155); | |
134 | ||
135 | fNPtRelDiffHistBins = 200; | |
136 | fPtRelDiffHistBins = new Double_t[fNPtRelDiffHistBins+1]; | |
137 | GenerateFixedBinArray(fNPtRelDiffHistBins, -2, 2, fPtRelDiffHistBins); | |
427d6cf5 | 138 | |
bb6d64e9 | 139 | fN1OverPtResHistBins = 385; |
1876c758 | 140 | f1OverPtResHistBins = new Double_t[fN1OverPtResHistBins+1]; |
bb6d64e9 | 141 | GenerateFixedBinArray(100, 0, 0.02, f1OverPtResHistBins); |
142 | GenerateFixedBinArray(60, 0.02, 0.05, f1OverPtResHistBins+100); | |
143 | GenerateFixedBinArray(50, 0.05, 0.1, f1OverPtResHistBins+160); | |
144 | GenerateFixedBinArray(50, 0.1, 0.2, f1OverPtResHistBins+210); | |
145 | GenerateFixedBinArray(75, 0.2, 0.5, f1OverPtResHistBins+260); | |
146 | GenerateFixedBinArray(50, 0.5, 1.5, f1OverPtResHistBins+335); | |
1876c758 | 147 | |
427d6cf5 | 148 | fNIntegerHistBins = 10; |
149 | fIntegerHistBins = new Double_t[fNIntegerHistBins+1]; | |
150 | GenerateFixedBinArray(fNIntegerHistBins, -0.5, 9.5, fIntegerHistBins); | |
151 | } | |
152 | ||
eec7bbb0 | 153 | //________________________________________________________________________ |
154 | void AliEmcalTrackingQATask::UserCreateOutputObjects() | |
155 | { | |
156 | // Create my user objects. | |
157 | ||
158 | AliAnalysisTaskEmcal::UserCreateOutputObjects(); | |
159 | ||
1876c758 | 160 | if (fParticleCollArray.GetEntriesFast() < 1) { |
161 | AliFatal("This task needs at least one particle container!"); | |
162 | } | |
eec7bbb0 | 163 | |
1876c758 | 164 | if (!fDetectorLevel) { |
165 | fDetectorLevel = static_cast<AliParticleContainer*>(fParticleCollArray.At(0)); | |
166 | fDetectorLevel->SetClassName("AliPicoTrack"); | |
167 | } | |
168 | ||
169 | if (!fGeneratorLevel && fParticleCollArray.GetEntriesFast() > 1) { | |
170 | fGeneratorLevel = static_cast<AliParticleContainer*>(fParticleCollArray.At(1)); | |
171 | fGeneratorLevel->SetClassName("AliAODMCParticle"); | |
eec7bbb0 | 172 | } |
173 | ||
1876c758 | 174 | AllocateDetectorLevelTHnSparse(); |
eec7bbb0 | 175 | |
1876c758 | 176 | if (fGeneratorLevel) { |
177 | AllocateGeneratorLevelTHnSparse(); | |
178 | AllocateMatchedParticlesTHnSparse(); | |
179 | } | |
eec7bbb0 | 180 | } |
181 | ||
182 | //________________________________________________________________________ | |
1876c758 | 183 | void AliEmcalTrackingQATask::AllocateDetectorLevelTHnSparse() |
eec7bbb0 | 184 | { |
185 | Int_t dim = 0; | |
186 | TString title[20]; | |
187 | Int_t nbins[20] = {0}; | |
427d6cf5 | 188 | Double_t *binEdges[20] = {0}; |
eec7bbb0 | 189 | |
190 | if (fForceBeamType != AliAnalysisTaskEmcal::kpp) { | |
191 | title[dim] = "Centrality %"; | |
427d6cf5 | 192 | nbins[dim] = fNCentHistBins; |
193 | binEdges[dim] = fCentHistBins; | |
eec7bbb0 | 194 | dim++; |
195 | } | |
196 | ||
197 | title[dim] = "#it{p}_{T} (GeV/#it{c})"; | |
427d6cf5 | 198 | nbins[dim] = fNPtHistBins; |
199 | binEdges[dim] = fPtHistBins; | |
eec7bbb0 | 200 | dim++; |
201 | ||
202 | title[dim] = "#eta"; | |
427d6cf5 | 203 | nbins[dim] = fNEtaHistBins; |
204 | binEdges[dim] = fEtaHistBins; | |
eec7bbb0 | 205 | dim++; |
206 | ||
207 | title[dim] = "#phi"; | |
427d6cf5 | 208 | nbins[dim] = fNPhiHistBins; |
209 | binEdges[dim] = fPhiHistBins; | |
eec7bbb0 | 210 | dim++; |
1876c758 | 211 | |
212 | if (fSelectHIJING) { | |
213 | title[dim] = "MC Generator"; | |
214 | nbins[dim] = 2; | |
215 | binEdges[dim] = fIntegerHistBins; | |
216 | dim++; | |
217 | } | |
218 | ||
219 | title[dim] = "track type"; | |
220 | nbins[dim] = 3; | |
221 | binEdges[dim] = fIntegerHistBins; | |
222 | dim++; | |
223 | ||
224 | if (fIsEsd) { | |
8c96eb55 | 225 | if (fDoSigma1OverPt) { |
226 | title[dim] = "#sigma(1/#it{p}_{T}) (GeV/#it{c})^{-1}"; | |
227 | nbins[dim] = fN1OverPtResHistBins; | |
228 | binEdges[dim] = f1OverPtResHistBins; | |
229 | dim++; | |
230 | } | |
231 | else { | |
232 | title[dim] = "#sigma(#it{p}_{T}) / #it{p}_{T}"; | |
233 | nbins[dim] = fNPtResHistBins; | |
234 | binEdges[dim] = fPtResHistBins; | |
235 | dim++; | |
236 | } | |
1876c758 | 237 | } |
eec7bbb0 | 238 | |
1876c758 | 239 | fTracks = new THnSparseF("fTracks","fTracks",dim,nbins); |
427d6cf5 | 240 | for (Int_t i = 0; i < dim; i++) { |
1876c758 | 241 | fTracks->GetAxis(i)->SetTitle(title[i]); |
242 | fTracks->SetBinEdges(i, binEdges[i]); | |
427d6cf5 | 243 | } |
244 | ||
1876c758 | 245 | fOutput->Add(fTracks); |
246 | } | |
247 | ||
248 | //________________________________________________________________________ | |
249 | void AliEmcalTrackingQATask::AllocateGeneratorLevelTHnSparse() | |
250 | { | |
251 | Int_t dim = 0; | |
252 | TString title[20]; | |
253 | Int_t nbins[20] = {0}; | |
254 | Double_t *binEdges[20] = {0}; | |
255 | ||
256 | if (fForceBeamType != AliAnalysisTaskEmcal::kpp) { | |
257 | title[dim] = "Centrality %"; | |
258 | nbins[dim] = fNCentHistBins; | |
259 | binEdges[dim] = fCentHistBins; | |
260 | dim++; | |
261 | } | |
262 | ||
263 | title[dim] = "#it{p}_{T} (GeV/#it{c})"; | |
264 | nbins[dim] = fNPtHistBins; | |
265 | binEdges[dim] = fPtHistBins; | |
266 | dim++; | |
267 | ||
268 | title[dim] = "#eta"; | |
269 | nbins[dim] = fNEtaHistBins; | |
270 | binEdges[dim] = fEtaHistBins; | |
271 | dim++; | |
272 | ||
273 | title[dim] = "#phi"; | |
274 | nbins[dim] = fNPhiHistBins; | |
275 | binEdges[dim] = fPhiHistBins; | |
276 | dim++; | |
277 | ||
278 | if (fSelectHIJING) { | |
279 | title[dim] = "MC Generator"; | |
280 | nbins[dim] = 2; | |
281 | binEdges[dim] = fIntegerHistBins; | |
282 | dim++; | |
283 | } | |
284 | ||
285 | title[dim] = "Findable"; | |
286 | nbins[dim] = 2; | |
287 | binEdges[dim] = fIntegerHistBins; | |
288 | dim++; | |
289 | ||
290 | fParticlesPhysPrim = new THnSparseF("fParticlesPhysPrim","fParticlesPhysPrim",dim,nbins); | |
291 | for (Int_t i = 0; i < dim; i++) { | |
292 | fParticlesPhysPrim->GetAxis(i)->SetTitle(title[i]); | |
293 | fParticlesPhysPrim->SetBinEdges(i, binEdges[i]); | |
294 | } | |
295 | ||
296 | fOutput->Add(fParticlesPhysPrim); | |
eec7bbb0 | 297 | } |
298 | ||
299 | //________________________________________________________________________ | |
300 | void AliEmcalTrackingQATask::AllocateMatchedParticlesTHnSparse() | |
301 | { | |
302 | Int_t dim = 0; | |
303 | TString title[20]; | |
304 | Int_t nbins[20] = {0}; | |
427d6cf5 | 305 | Double_t *binEdges[20] = {0}; |
eec7bbb0 | 306 | |
307 | if (fForceBeamType != AliAnalysisTaskEmcal::kpp) { | |
308 | title[dim] = "Centrality %"; | |
427d6cf5 | 309 | nbins[dim] = fNCentHistBins; |
310 | binEdges[dim] = fCentHistBins; | |
eec7bbb0 | 311 | dim++; |
312 | } | |
313 | ||
314 | title[dim] = "#it{p}_{T}^{gen} (GeV/#it{c})"; | |
427d6cf5 | 315 | nbins[dim] = fNPtHistBins; |
316 | binEdges[dim] = fPtHistBins; | |
eec7bbb0 | 317 | dim++; |
318 | ||
319 | title[dim] = "#eta^{gen}"; | |
427d6cf5 | 320 | nbins[dim] = fNEtaHistBins; |
321 | binEdges[dim] = fEtaHistBins; | |
eec7bbb0 | 322 | dim++; |
323 | ||
324 | title[dim] = "#phi^{gen}"; | |
427d6cf5 | 325 | nbins[dim] = fNPhiHistBins; |
326 | binEdges[dim] = fPhiHistBins; | |
eec7bbb0 | 327 | dim++; |
328 | ||
329 | title[dim] = "#it{p}_{T}^{det} (GeV/#it{c})"; | |
427d6cf5 | 330 | nbins[dim] = fNPtHistBins; |
331 | binEdges[dim] = fPtHistBins; | |
eec7bbb0 | 332 | dim++; |
333 | ||
334 | title[dim] = "#eta^{det}"; | |
427d6cf5 | 335 | nbins[dim] = fNEtaHistBins; |
336 | binEdges[dim] = fEtaHistBins; | |
eec7bbb0 | 337 | dim++; |
338 | ||
339 | title[dim] = "#phi^{det}"; | |
427d6cf5 | 340 | nbins[dim] = fNPhiHistBins; |
341 | binEdges[dim] = fPhiHistBins; | |
eec7bbb0 | 342 | dim++; |
343 | ||
e00c3b87 | 344 | if (fDoSigmaPtOverPtGen) { |
345 | title[dim] = "(#it{p}_{T}^{gen} - #it{p}_{T}^{det}) / #it{p}_{T}^{gen}"; | |
346 | nbins[dim] = fNPtRelDiffHistBins; | |
347 | binEdges[dim] = fPtRelDiffHistBins; | |
348 | dim++; | |
349 | } | |
350 | else { | |
351 | title[dim] = "(#it{p}_{T}^{gen} - #it{p}_{T}^{det}) / #it{p}_{T}^{det}"; | |
352 | nbins[dim] = fNPtRelDiffHistBins; | |
353 | binEdges[dim] = fPtRelDiffHistBins; | |
354 | dim++; | |
355 | } | |
eec7bbb0 | 356 | |
357 | title[dim] = "track type"; | |
358 | nbins[dim] = 3; | |
427d6cf5 | 359 | binEdges[dim] = fIntegerHistBins; |
eec7bbb0 | 360 | dim++; |
361 | ||
427d6cf5 | 362 | fParticlesMatched = new THnSparseF("fParticlesMatched","fParticlesMatched",dim,nbins); |
363 | for (Int_t i = 0; i < dim; i++) { | |
eec7bbb0 | 364 | fParticlesMatched->GetAxis(i)->SetTitle(title[i]); |
427d6cf5 | 365 | fParticlesMatched->SetBinEdges(i, binEdges[i]); |
366 | } | |
367 | ||
eec7bbb0 | 368 | fOutput->Add(fParticlesMatched); |
369 | } | |
370 | ||
371 | //________________________________________________________________________ | |
372 | void AliEmcalTrackingQATask::SetGeneratorLevelName(const char* name) | |
373 | { | |
1876c758 | 374 | if (!fDetectorLevel) { |
375 | AliError("Please, first set the detector level array!"); | |
376 | return; | |
377 | } | |
eec7bbb0 | 378 | if (!fGeneratorLevel) { // first check if the generator level array is set |
1876c758 | 379 | fGeneratorLevel = static_cast<AliParticleContainer*>(fParticleCollArray.At(1)); |
eec7bbb0 | 380 | if (fGeneratorLevel) { // now check if the first collection array has been added already |
381 | fGeneratorLevel->SetArrayName(name); | |
382 | } | |
383 | else { | |
384 | fGeneratorLevel = AddParticleContainer(name); | |
385 | } | |
386 | fGeneratorLevel->SetClassName("AliAODMCParticle"); | |
387 | fGeneratorLevel->SelectPhysicalPrimaries(kTRUE); | |
7892ca4d | 388 | fGeneratorLevel->SetParticlePtCut(0); |
eec7bbb0 | 389 | } |
390 | fGeneratorLevel->SetArrayName(name); | |
391 | } | |
392 | ||
393 | //________________________________________________________________________ | |
394 | void AliEmcalTrackingQATask::SetDetectorLevelName(const char* name) | |
395 | { | |
eec7bbb0 | 396 | if (!fDetectorLevel) { // first check if the detector level array is set |
1876c758 | 397 | fDetectorLevel = static_cast<AliParticleContainer*>(fParticleCollArray.At(0)); |
eec7bbb0 | 398 | if (fDetectorLevel) { // now check if the second collection array has been added already |
399 | fDetectorLevel->SetArrayName(name); | |
400 | } | |
401 | else { | |
402 | fDetectorLevel = AddParticleContainer(name); | |
403 | } | |
404 | fDetectorLevel->SetClassName("AliPicoTrack"); | |
eec7bbb0 | 405 | } |
406 | fDetectorLevel->SetArrayName(name); | |
407 | } | |
408 | ||
409 | //________________________________________________________________________ | |
410 | void AliEmcalTrackingQATask::ExecOnce() | |
411 | { | |
412 | // Init the analysis. | |
413 | ||
1876c758 | 414 | AliAnalysisTaskEmcal::ExecOnce(); |
415 | } | |
eec7bbb0 | 416 | |
1876c758 | 417 | //________________________________________________________________________ |
418 | void AliEmcalTrackingQATask::FillDetectorLevelTHnSparse(Double_t cent, Double_t trackEta, Double_t trackPhi, Double_t trackPt, | |
419 | Double_t sigma1OverPt, Int_t mcGen, Byte_t trackType) | |
420 | { | |
421 | Double_t contents[20]={0}; | |
eec7bbb0 | 422 | |
1876c758 | 423 | for (Int_t i = 0; i < fTracks->GetNdimensions(); i++) { |
424 | TString title(fTracks->GetAxis(i)->GetTitle()); | |
425 | if (title=="Centrality %") | |
426 | contents[i] = cent; | |
427 | else if (title=="#it{p}_{T} (GeV/#it{c})") | |
428 | contents[i] = trackPt; | |
429 | else if (title=="#eta") | |
430 | contents[i] = trackEta; | |
431 | else if (title=="#phi") | |
432 | contents[i] = trackPhi; | |
433 | else if (title=="#sigma(1/#it{p}_{T}) (GeV/#it{c})^{-1}") | |
434 | contents[i] = sigma1OverPt; | |
8c96eb55 | 435 | else if (title=="#sigma(#it{p}_{T}) / #it{p}_{T}") |
436 | contents[i] = sigma1OverPt*trackPt; | |
1876c758 | 437 | else if (title=="MC Generator") |
438 | contents[i] = mcGen; | |
439 | else if (title=="track type") | |
440 | contents[i] = trackType; | |
441 | else | |
442 | AliWarning(Form("Unable to fill dimension %s of histogram %s!", title.Data(), fTracks->GetName())); | |
eec7bbb0 | 443 | } |
444 | ||
1876c758 | 445 | fTracks->Fill(contents); |
eec7bbb0 | 446 | } |
447 | ||
448 | //________________________________________________________________________ | |
1876c758 | 449 | void AliEmcalTrackingQATask::FillGeneratorLevelTHnSparse(Double_t cent, Double_t partEta, Double_t partPhi, Double_t partPt, Int_t mcGen, Byte_t findable) |
eec7bbb0 | 450 | { |
451 | Double_t contents[20]={0}; | |
452 | ||
1876c758 | 453 | for (Int_t i = 0; i < fParticlesPhysPrim->GetNdimensions(); i++) { |
454 | TString title(fParticlesPhysPrim->GetAxis(i)->GetTitle()); | |
eec7bbb0 | 455 | if (title=="Centrality %") |
456 | contents[i] = cent; | |
457 | else if (title=="#it{p}_{T} (GeV/#it{c})") | |
458 | contents[i] = partPt; | |
459 | else if (title=="#eta") | |
460 | contents[i] = partEta; | |
461 | else if (title=="#phi") | |
462 | contents[i] = partPhi; | |
1876c758 | 463 | else if (title=="MC Generator") |
464 | contents[i] = mcGen; | |
465 | else if (title=="Findable") | |
466 | contents[i] = findable; | |
eec7bbb0 | 467 | else |
1876c758 | 468 | AliWarning(Form("Unable to fill dimension %s of histogram %s!", title.Data(), fParticlesPhysPrim->GetName())); |
eec7bbb0 | 469 | } |
470 | ||
1876c758 | 471 | fParticlesPhysPrim->Fill(contents); |
eec7bbb0 | 472 | } |
473 | ||
474 | //________________________________________________________________________ | |
475 | void AliEmcalTrackingQATask::FillMatchedParticlesTHnSparse(Double_t cent, Double_t partEta, Double_t partPhi, Double_t partPt, | |
476 | Double_t trackEta, Double_t trackPhi, Double_t trackPt, Byte_t trackType) | |
477 | { | |
478 | Double_t contents[20]={0}; | |
479 | ||
480 | for (Int_t i = 0; i < fParticlesMatched->GetNdimensions(); i++) { | |
481 | TString title(fParticlesMatched->GetAxis(i)->GetTitle()); | |
482 | if (title=="Centrality %") | |
483 | contents[i] = cent; | |
484 | else if (title=="#it{p}_{T}^{gen} (GeV/#it{c})") | |
485 | contents[i] = partPt; | |
486 | else if (title=="#eta^{gen}") | |
487 | contents[i] = partEta; | |
488 | else if (title=="#phi^{gen}") | |
489 | contents[i] = partPhi; | |
490 | else if (title=="#it{p}_{T}^{det} (GeV/#it{c})") | |
491 | contents[i] = trackPt; | |
492 | else if (title=="#eta^{det}") | |
493 | contents[i] = trackEta; | |
494 | else if (title=="#phi^{det}") | |
495 | contents[i] = trackPhi; | |
496 | else if (title=="(#it{p}_{T}^{gen} - #it{p}_{T}^{det}) / #it{p}_{T}^{gen}") | |
497 | contents[i] = (partPt - trackPt) / partPt; | |
e00c3b87 | 498 | else if (title=="(#it{p}_{T}^{gen} - #it{p}_{T}^{det}) / #it{p}_{T}^{det}") |
499 | contents[i] = (partPt - trackPt) / trackPt; | |
eec7bbb0 | 500 | else if (title=="track type") |
b63add30 | 501 | contents[i] = (Double_t)trackType; |
eec7bbb0 | 502 | else |
503 | AliWarning(Form("Unable to fill dimension %s of histogram %s!", title.Data(), fParticlesMatched->GetName())); | |
504 | } | |
505 | ||
506 | fParticlesMatched->Fill(contents); | |
507 | } | |
508 | ||
509 | //________________________________________________________________________ | |
510 | Bool_t AliEmcalTrackingQATask::FillHistograms() | |
511 | { | |
512 | // Fill the histograms. | |
513 | ||
514 | AliPicoTrack *track = static_cast<AliPicoTrack*>(fDetectorLevel->GetNextAcceptParticle(0)); | |
515 | while (track != 0) { | |
516 | Byte_t type = track->GetTrackType(); | |
dc7f220e | 517 | if (type <= 2) { |
1876c758 | 518 | Double_t sigma = 0; |
519 | if (fIsEsd) { | |
520 | AliESDtrack *esdTrack = dynamic_cast<AliESDtrack*>(track->GetTrack()); | |
521 | if (esdTrack) sigma = TMath::Sqrt(esdTrack->GetSigma1Pt2()); | |
522 | } | |
eec7bbb0 | 523 | |
524 | Int_t label = TMath::Abs(track->GetLabel()); | |
1876c758 | 525 | Int_t mcGen = 1; |
526 | // reject particles generated from other generators in the cocktail but keep fake tracks (label == 0) | |
527 | if (fSelectHIJING && (label==0 || track->GetGeneratorIndex() == 0)) mcGen = 0; | |
eec7bbb0 | 528 | |
1876c758 | 529 | FillDetectorLevelTHnSparse(fCent, track->Eta(), track->Phi(), track->Pt(), sigma, mcGen, type); |
eec7bbb0 | 530 | |
1876c758 | 531 | if (fGeneratorLevel && label > 0) { |
eec7bbb0 | 532 | AliAODMCParticle *part = static_cast<AliAODMCParticle*>(fGeneratorLevel->GetAcceptParticleWithLabel(label)); |
533 | if (part) { | |
d7ab1a93 | 534 | if (!fSelectHIJING || part->GetGeneratorIndex() == 0) { |
eec7bbb0 | 535 | Int_t pdg = TMath::Abs(part->PdgCode()); |
536 | // select charged pions, protons, kaons , electrons, muons | |
537 | if (pdg == 211 || pdg == 2212 || pdg == 321 || pdg == 11 || pdg == 13) { | |
538 | FillMatchedParticlesTHnSparse(fCent, part->Eta(), part->Phi(), part->Pt(), track->Eta(), track->Phi(), track->Pt(), type); | |
539 | } | |
540 | } | |
541 | } | |
542 | } | |
543 | } | |
544 | else { | |
545 | AliError(Form("Track %d has type %d not recognized!", fDetectorLevel->GetCurrentID(), type)); | |
546 | } | |
547 | ||
548 | track = static_cast<AliPicoTrack*>(fDetectorLevel->GetNextAcceptParticle()); | |
549 | } | |
550 | ||
1876c758 | 551 | if (fGeneratorLevel) { |
552 | AliAODMCParticle *part = static_cast<AliAODMCParticle*>(fGeneratorLevel->GetNextAcceptParticle(0)); | |
553 | while (part != 0) { | |
554 | Int_t mcGen = 1; | |
555 | Byte_t findable = 0; | |
556 | ||
557 | if (fSelectHIJING && part->GetGeneratorIndex() == 0) mcGen = 0; | |
eec7bbb0 | 558 | |
559 | Int_t pdg = TMath::Abs(part->PdgCode()); | |
560 | // select charged pions, protons, kaons , electrons, muons | |
1876c758 | 561 | if (pdg == 211 || pdg == 2212 || pdg == 321 || pdg == 11 || pdg == 13) findable = 1; |
562 | ||
563 | FillGeneratorLevelTHnSparse(fCent, part->Eta(), part->Phi(), part->Pt(), mcGen, findable); | |
564 | part = static_cast<AliAODMCParticle*>(fGeneratorLevel->GetNextAcceptParticle()); | |
eec7bbb0 | 565 | } |
eec7bbb0 | 566 | } |
567 | ||
568 | return kTRUE; | |
569 | } |