]>
Commit | Line | Data |
---|---|---|
a75aacd6 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id: AliUEHist.cxx 20164 2007-08-14 15:31:50Z morsch $ */ | |
17 | ||
18 | // | |
19 | // | |
20 | // encapsulate histogram and corrections for one underlying event histogram | |
21 | // | |
22 | // | |
23 | // Author: Jan Fiete Grosse-Oetringhaus, Sara Vallero | |
24 | ||
25 | #include "AliUEHist.h" | |
26 | #include "AliCFContainer.h" | |
27 | #include "THnSparse.h" | |
28 | #include "TMath.h" | |
29 | #include "TList.h" | |
30 | #include "TCollection.h" | |
31 | #include "TH1D.h" | |
32 | #include "TH2D.h" | |
33 | #include "TH3D.h" | |
34 | #include "AliLog.h" | |
35 | #include "TCanvas.h" | |
144bd037 | 36 | #include "TF1.h" |
a75aacd6 | 37 | |
38 | ClassImp(AliUEHist) | |
39 | ||
40 | const Int_t AliUEHist::fgkCFSteps = 10; | |
41 | ||
42 | AliUEHist::AliUEHist(const char* reqHist) : | |
d1c75d06 | 43 | TObject(), |
a75aacd6 | 44 | fkRegions(4), |
45 | fEventHist(0), | |
b1831bcb | 46 | fTrackHistEfficiency(0), |
a75aacd6 | 47 | fEtaMin(0), |
48 | fEtaMax(0), | |
49 | fPtMin(0), | |
50 | fPtMax(0), | |
144bd037 | 51 | fContaminationEnhancement(0), |
a75aacd6 | 52 | fCombineMinMax(0), |
53 | fCache(0) | |
54 | { | |
55 | // Constructor | |
56 | ||
57 | for (Int_t i=0; i<fkRegions; i++) | |
58 | fTrackHist[i] = 0; | |
59 | ||
60 | if (strlen(reqHist) == 0) | |
61 | return; | |
62 | ||
63 | const char* title = ""; | |
64 | ||
65 | // track level | |
66 | Int_t nTrackVars = 4; // eta vs pT vs pT,lead (vs delta phi) vs multiplicity | |
67 | Int_t iTrackBin[5]; | |
68 | Double_t* trackBins[5]; | |
69 | const char* trackAxisTitle[5]; | |
70 | ||
71 | // eta | |
72 | iTrackBin[0] = 20; | |
73 | Double_t etaBins[20+1]; | |
74 | for (Int_t i=0; i<=iTrackBin[0]; i++) | |
75 | etaBins[i] = -1.0 + 0.1 * i; | |
76 | trackBins[0] = etaBins; | |
77 | trackAxisTitle[0] = "#eta"; | |
78 | ||
79 | // pT | |
80 | iTrackBin[1] = 39; | |
81 | Double_t pTBins[] = {0.0, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0, 50.0, 100.0}; | |
82 | trackBins[1] = pTBins; | |
83 | trackAxisTitle[1] = "p_{T} (GeV/c)"; | |
84 | ||
85 | // pT,lead binning 1 | |
86 | const Int_t kNLeadingpTBins = 100; | |
87 | Double_t leadingpTBins[kNLeadingpTBins+1]; | |
88 | for (Int_t i=0; i<=kNLeadingpTBins; i++) | |
89 | leadingpTBins[i] = 0.5 * i; | |
90 | ||
91 | // pT,lead binning 2 | |
92 | const Int_t kNLeadingpTBins2 = 10; | |
93 | Double_t leadingpTBins2[kNLeadingpTBins2+1]; | |
94 | for (Int_t i=0; i<=kNLeadingpTBins2; i++) | |
95 | leadingpTBins2[i] = 5.0 * i; | |
96 | ||
97 | // phi,lead | |
98 | const Int_t kNLeadingPhiBins = 40; | |
99 | Double_t leadingPhiBins[kNLeadingPhiBins+1]; | |
100 | for (Int_t i=0; i<=kNLeadingPhiBins; i++) | |
101 | leadingPhiBins[i] = -1.5 * TMath::Pi() + 1.0 / 40 * i * TMath::TwoPi(); | |
102 | ||
103 | // multiplicity | |
104 | const Int_t kNMultiplicityBins = 15; | |
105 | Double_t multiplicityBins[kNMultiplicityBins+1]; | |
106 | for (Int_t i=0; i<=kNMultiplicityBins; i++) | |
107 | multiplicityBins[i] = -0.5 + i; | |
108 | multiplicityBins[kNMultiplicityBins] = 200; | |
b1831bcb | 109 | |
110 | // particle species | |
111 | const Int_t kNSpeciesBins = 4; // pi, K, p, rest | |
112 | Double_t speciesBins[] = { -0.5, 0.5, 1.5, 2.5, 3.5 }; | |
a75aacd6 | 113 | |
114 | trackBins[3] = multiplicityBins; | |
115 | iTrackBin[3] = kNMultiplicityBins; | |
116 | trackAxisTitle[3] = "multiplicity"; | |
117 | ||
118 | // selection depending on requested histogram | |
119 | Int_t axis = -1; // 0 = pT,lead, 1 = phi,lead | |
120 | if (strcmp(reqHist, "NumberDensitypT") == 0) | |
121 | { | |
122 | axis = 0; | |
123 | title = "d^{2}N_{ch}/d#phid#eta"; | |
124 | } | |
125 | else if (strcmp(reqHist, "NumberDensityPhi") == 0) | |
126 | { | |
127 | axis = 1; | |
128 | title = "d^{2}N_{ch}/d#phid#eta"; | |
129 | } | |
130 | else if (strcmp(reqHist, "SumpT") == 0) | |
131 | { | |
132 | axis = 0; | |
133 | title = "d^{2}#Sigma p_{T}/d#phid#eta"; | |
134 | } | |
135 | else | |
136 | AliFatal(Form("Invalid histogram requested: %s", reqHist)); | |
137 | ||
138 | Int_t initRegions = fkRegions; | |
139 | ||
140 | if (axis == 0) | |
141 | { | |
142 | trackBins[2] = leadingpTBins; | |
143 | iTrackBin[2] = kNLeadingpTBins; | |
144 | trackAxisTitle[2] = "leading p_{T} (GeV/c)"; | |
145 | ||
146 | } | |
147 | else if (axis == 1) | |
148 | { | |
149 | nTrackVars = 5; | |
150 | initRegions = 1; | |
151 | ||
152 | iTrackBin[2] = kNLeadingpTBins2; | |
153 | trackBins[2] = leadingpTBins2; | |
154 | trackAxisTitle[2] = "leading p_{T} (GeV/c)"; | |
155 | ||
156 | iTrackBin[4] = kNLeadingPhiBins; | |
157 | trackBins[4] = leadingPhiBins; | |
158 | trackAxisTitle[4] = "#phi w.r.t leading track"; | |
159 | } | |
160 | ||
161 | for (Int_t i=0; i<initRegions; i++) | |
162 | { | |
163 | fTrackHist[i] = new AliCFContainer(Form("fTrackHist_%d", i), title, fgkCFSteps, nTrackVars, iTrackBin); | |
164 | ||
165 | for (Int_t j=0; j<nTrackVars; j++) | |
166 | { | |
167 | fTrackHist[i]->SetBinLimits(j, trackBins[j]); | |
168 | fTrackHist[i]->SetVarTitle(j, trackAxisTitle[j]); | |
169 | } | |
170 | ||
171 | SetStepNames(fTrackHist[i]); | |
172 | } | |
173 | ||
174 | // track 3rd and 4th axis --> event 1st and 2nd axis | |
175 | fEventHist = new AliCFContainer("fEventHist", title, fgkCFSteps, 2, iTrackBin+2); | |
176 | ||
177 | fEventHist->SetBinLimits(0, trackBins[2]); | |
178 | fEventHist->SetVarTitle(0, trackAxisTitle[2]); | |
179 | ||
180 | fEventHist->SetBinLimits(1, trackBins[3]); | |
181 | fEventHist->SetVarTitle(1, trackAxisTitle[3]); | |
182 | ||
183 | SetStepNames(fEventHist); | |
b1831bcb | 184 | |
185 | iTrackBin[2] = kNSpeciesBins; | |
186 | ||
187 | fTrackHistEfficiency = new AliCFContainer("fTrackHistEfficiency", "Tracking efficiency", 3, 3, iTrackBin); | |
188 | fTrackHistEfficiency->SetBinLimits(0, trackBins[0]); | |
189 | fTrackHistEfficiency->SetVarTitle(0, trackAxisTitle[0]); | |
190 | fTrackHistEfficiency->SetBinLimits(1, trackBins[1]); | |
191 | fTrackHistEfficiency->SetVarTitle(1, trackAxisTitle[1]); | |
192 | fTrackHistEfficiency->SetBinLimits(2, speciesBins); | |
193 | fTrackHistEfficiency->SetVarTitle(2, "particle species"); | |
a75aacd6 | 194 | } |
195 | ||
d1c75d06 | 196 | //_____________________________________________________________________________ |
197 | AliUEHist::AliUEHist(const AliUEHist &c) : | |
198 | TObject(), | |
199 | fkRegions(4), | |
200 | fEventHist(0), | |
b1831bcb | 201 | fTrackHistEfficiency(0), |
d1c75d06 | 202 | fEtaMin(0), |
203 | fEtaMax(0), | |
204 | fPtMin(0), | |
205 | fPtMax(0), | |
144bd037 | 206 | fContaminationEnhancement(0), |
d1c75d06 | 207 | fCombineMinMax(0), |
208 | fCache(0) | |
209 | { | |
210 | // | |
211 | // AliUEHist copy constructor | |
212 | // | |
213 | ||
214 | ((AliUEHist &) c).Copy(*this); | |
215 | } | |
216 | ||
a75aacd6 | 217 | //____________________________________________________________________ |
218 | void AliUEHist::SetStepNames(AliCFContainer* container) | |
219 | { | |
220 | // sets the names of the correction steps | |
221 | ||
222 | for (Int_t i=0; i<fgkCFSteps; i++) | |
223 | container->SetStepTitle(i, GetStepTitle((CFStep) i)); | |
224 | } | |
225 | ||
226 | //____________________________________________________________________ | |
227 | AliUEHist::~AliUEHist() | |
228 | { | |
229 | // Destructor | |
230 | ||
231 | for (Int_t i=0; i<fkRegions; i++) | |
232 | { | |
233 | if (fTrackHist[i]) | |
234 | { | |
235 | delete fTrackHist[i]; | |
236 | fTrackHist[i] = 0; | |
237 | } | |
238 | } | |
239 | ||
240 | if (fEventHist) | |
241 | { | |
242 | delete fEventHist; | |
243 | fEventHist = 0; | |
244 | } | |
245 | ||
b1831bcb | 246 | if (fTrackHistEfficiency) |
247 | { | |
248 | delete fTrackHistEfficiency; | |
249 | fTrackHistEfficiency = 0; | |
250 | } | |
251 | ||
a75aacd6 | 252 | if (fCache) |
253 | { | |
254 | delete fCache; | |
255 | fCache = 0; | |
256 | } | |
257 | } | |
258 | ||
259 | //____________________________________________________________________ | |
260 | AliUEHist &AliUEHist::operator=(const AliUEHist &c) | |
261 | { | |
262 | // assigment operator | |
263 | ||
264 | if (this != &c) | |
265 | ((AliUEHist &) c).Copy(*this); | |
266 | ||
267 | return *this; | |
268 | } | |
269 | ||
270 | //____________________________________________________________________ | |
271 | void AliUEHist::Copy(TObject& c) const | |
272 | { | |
273 | // copy function | |
274 | ||
275 | AliUEHist& target = (AliUEHist &) c; | |
276 | ||
277 | for (Int_t i=0; i<fkRegions; i++) | |
278 | if (fTrackHist[i]) | |
279 | target.fTrackHist[i] = dynamic_cast<AliCFContainer*> (fTrackHist[i]->Clone()); | |
280 | ||
281 | if (fEventHist) | |
282 | target.fEventHist = dynamic_cast<AliCFContainer*> (fEventHist->Clone()); | |
b1831bcb | 283 | |
284 | if (fTrackHistEfficiency) | |
285 | target.fTrackHistEfficiency = dynamic_cast<AliCFContainer*> (fTrackHistEfficiency->Clone()); | |
a75aacd6 | 286 | } |
287 | ||
288 | //____________________________________________________________________ | |
289 | Long64_t AliUEHist::Merge(TCollection* list) | |
290 | { | |
291 | // Merge a list of AliUEHist objects with this (needed for | |
292 | // PROOF). | |
293 | // Returns the number of merged objects (including this). | |
294 | ||
295 | if (!list) | |
296 | return 0; | |
297 | ||
298 | if (list->IsEmpty()) | |
299 | return 1; | |
300 | ||
301 | TIterator* iter = list->MakeIterator(); | |
302 | TObject* obj; | |
303 | ||
304 | // collections of objects | |
b1831bcb | 305 | const Int_t kMaxLists = fkRegions+2; |
a75aacd6 | 306 | TList** lists = new TList*[kMaxLists]; |
307 | ||
308 | for (Int_t i=0; i<kMaxLists; i++) | |
309 | lists[i] = new TList; | |
310 | ||
311 | Int_t count = 0; | |
312 | while ((obj = iter->Next())) { | |
313 | ||
314 | AliUEHist* entry = dynamic_cast<AliUEHist*> (obj); | |
315 | if (entry == 0) | |
316 | continue; | |
317 | ||
318 | for (Int_t i=0; i<fkRegions; i++) | |
319 | if (entry->fTrackHist[i]) | |
320 | lists[i]->Add(entry->fTrackHist[i]); | |
321 | ||
322 | lists[fkRegions]->Add(entry->fEventHist); | |
b1831bcb | 323 | lists[fkRegions+1]->Add(entry->fTrackHistEfficiency); |
a75aacd6 | 324 | |
325 | count++; | |
326 | } | |
327 | for (Int_t i=0; i<fkRegions; i++) | |
328 | if (fTrackHist[i]) | |
329 | fTrackHist[i]->Merge(lists[i]); | |
330 | ||
331 | fEventHist->Merge(lists[fkRegions]); | |
b1831bcb | 332 | fTrackHistEfficiency->Merge(lists[fkRegions+1]); |
a75aacd6 | 333 | |
334 | for (Int_t i=0; i<kMaxLists; i++) | |
335 | delete lists[i]; | |
336 | ||
337 | delete[] lists; | |
338 | ||
339 | return count+1; | |
340 | } | |
341 | ||
342 | //____________________________________________________________________ | |
343 | void AliUEHist::SetBinLimits(AliCFGridSparse* grid) | |
344 | { | |
345 | // sets the bin limits in eta and pT defined by fEtaMin/Max, fPtMin/Max | |
346 | ||
347 | if (fEtaMax > fEtaMin) | |
348 | grid->SetRangeUser(0, fEtaMin, fEtaMax); | |
349 | if (fPtMax > fPtMin) | |
350 | grid->SetRangeUser(1, fPtMin, fPtMax); | |
351 | } | |
352 | ||
353 | //____________________________________________________________________ | |
354 | void AliUEHist::ResetBinLimits(AliCFGridSparse* grid) | |
355 | { | |
356 | // resets all bin limits | |
357 | ||
358 | for (Int_t i=0; i<grid->GetNVar(); i++) | |
144bd037 | 359 | if (grid->GetGrid()->GetAxis(i)->TestBit(TAxis::kAxisRange)) |
a75aacd6 | 360 | grid->SetRangeUser(i, 0, -1); |
361 | } | |
362 | ||
144bd037 | 363 | //____________________________________________________________________ |
364 | void AliUEHist::CountEmptyBins(AliUEHist::CFStep step, Float_t ptLeadMin, Float_t ptLeadMax) | |
365 | { | |
366 | // prints the number of empty bins in the track end event histograms in the given step | |
367 | ||
368 | Int_t binBegin[4]; | |
369 | Int_t binEnd[4]; | |
370 | ||
371 | for (Int_t i=0; i<4; i++) | |
372 | { | |
373 | binBegin[i] = 1; | |
374 | binEnd[i] = fTrackHist[0]->GetNBins(i); | |
375 | } | |
376 | ||
377 | if (fEtaMax > fEtaMin) | |
378 | { | |
379 | binBegin[0] = fTrackHist[0]->GetGrid(step)->GetGrid()->GetAxis(0)->FindBin(fEtaMin); | |
380 | binEnd[0] = fTrackHist[0]->GetGrid(step)->GetGrid()->GetAxis(0)->FindBin(fEtaMax); | |
381 | } | |
382 | ||
383 | if (fPtMax > fPtMin) | |
384 | { | |
385 | binBegin[1] = fTrackHist[0]->GetGrid(step)->GetGrid()->GetAxis(1)->FindBin(fPtMin); | |
386 | binEnd[1] = fTrackHist[0]->GetGrid(step)->GetGrid()->GetAxis(1)->FindBin(fPtMax); | |
387 | } | |
388 | ||
389 | if (ptLeadMax > ptLeadMin) | |
390 | { | |
391 | binBegin[2] = fTrackHist[0]->GetGrid(step)->GetGrid()->GetAxis(2)->FindBin(ptLeadMin); | |
392 | binEnd[2] = fTrackHist[0]->GetGrid(step)->GetGrid()->GetAxis(2)->FindBin(ptLeadMax); | |
393 | } | |
394 | ||
395 | // start from multiplicity 1 | |
396 | binBegin[3] = fTrackHist[0]->GetGrid(step)->GetGrid()->GetAxis(3)->FindBin(1); | |
397 | ||
398 | for (Int_t region=0; region<fkRegions; region++) | |
399 | { | |
400 | Int_t total = 0; | |
401 | Int_t count = 0; | |
402 | Int_t vars[4]; | |
403 | ||
404 | for (Int_t i=0; i<4; i++) | |
405 | vars[i] = binBegin[i]; | |
406 | ||
407 | AliCFGridSparse* grid = fTrackHist[region]->GetGrid(step); | |
408 | while (1) | |
409 | { | |
410 | if (grid->GetElement(vars) == 0) | |
411 | { | |
412 | Printf("Empty bin at eta=%.2f pt=%.2f pt_lead=%.2f mult=%.1f", | |
413 | grid->GetBinCenter(0, vars[0]), | |
414 | grid->GetBinCenter(1, vars[1]), | |
415 | grid->GetBinCenter(2, vars[2]), | |
416 | grid->GetBinCenter(3, vars[3]) | |
417 | ); | |
418 | count++; | |
419 | } | |
420 | ||
421 | vars[3]++; | |
422 | for (Int_t i=3; i>0; i--) | |
423 | { | |
424 | if (vars[i] == binEnd[i]+1) | |
425 | { | |
426 | vars[i] = binBegin[i]; | |
427 | vars[i-1]++; | |
428 | } | |
429 | } | |
430 | ||
431 | if (vars[0] == binEnd[0]+1) | |
432 | break; | |
433 | total++; | |
434 | } | |
435 | ||
436 | Printf("Region %s has %d empty bins (out of %d bins)", GetRegionTitle((Region) region), count, total); | |
437 | } | |
438 | } | |
439 | ||
a75aacd6 | 440 | //____________________________________________________________________ |
441 | TH1D* AliUEHist::GetUEHist(AliUEHist::CFStep step, AliUEHist::Region region, Float_t ptLeadMin, Float_t ptLeadMax) | |
442 | { | |
443 | // Extracts the UE histogram at the given step and in the given region by projection and dividing tracks by events | |
444 | // | |
445 | // ptLeadMin, ptLeadMax: Only meaningful for vs. delta phi plot (third axis is ptLead) | |
446 | // Histogram has to be deleted by the caller of the function | |
447 | ||
448 | // unzoom all axes | |
449 | ResetBinLimits(fTrackHist[region]->GetGrid(step)); | |
450 | ResetBinLimits(fEventHist->GetGrid(step)); | |
451 | ||
452 | SetBinLimits(fTrackHist[region]->GetGrid(step)); | |
453 | ||
454 | TH1D* tracks = 0; | |
455 | ||
456 | if (ptLeadMin < 0) | |
457 | { | |
458 | tracks = fTrackHist[region]->ShowProjection(2, step); | |
459 | tracks->GetYaxis()->SetTitle(fTrackHist[region]->GetTitle()); | |
460 | if (fCombineMinMax && region == kMin) | |
461 | { | |
462 | ResetBinLimits(fTrackHist[kMax]->GetGrid(step)); | |
463 | SetBinLimits(fTrackHist[kMax]->GetGrid(step)); | |
464 | ||
465 | TH1D* tracks2 = fTrackHist[kMax]->ShowProjection(2, step); | |
466 | tracks->Add(tracks2); | |
467 | ||
468 | ResetBinLimits(fTrackHist[kMax]->GetGrid(step)); | |
469 | } | |
470 | ||
471 | // normalize to get a density (deta dphi) | |
472 | TAxis* axis = fTrackHist[region]->GetGrid(step)->GetAxis(0); | |
473 | Float_t phiRegion = TMath::TwoPi() / 3; | |
474 | if (!fCombineMinMax && region == kMin) | |
475 | phiRegion /= 2; | |
476 | Float_t normalization = phiRegion * (axis->GetBinUpEdge(axis->GetLast()) - axis->GetBinLowEdge(axis->GetFirst())); | |
477 | //Printf("Normalization: %f", normalization); | |
478 | tracks->Scale(1.0 / normalization); | |
479 | ||
480 | TH1D* events = fEventHist->ShowProjection(0, step); | |
481 | tracks->Divide(events); | |
482 | } | |
483 | else | |
484 | { | |
485 | fTrackHist[region]->GetGrid(step)->SetRangeUser(2, ptLeadMin, ptLeadMax); | |
486 | tracks = fTrackHist[region]->GetGrid(step)->Project(4); | |
487 | fTrackHist[region]->GetGrid(step)->SetRangeUser(2, 0, -1); | |
488 | ||
489 | // normalize to get a density (deta dphi) | |
490 | TAxis* axis = fTrackHist[region]->GetGrid(step)->GetAxis(0); | |
491 | Float_t normalization = fTrackHist[region]->GetGrid(step)->GetAxis(4)->GetBinWidth(1) * (axis->GetBinUpEdge(axis->GetLast()) - axis->GetBinLowEdge(axis->GetFirst())); | |
492 | //Printf("Normalization: %f", normalization); | |
493 | tracks->Scale(1.0 / normalization); | |
494 | ||
495 | TH1D* events = fEventHist->ShowProjection(0, step); | |
210f8ded | 496 | Int_t nEvents = (Int_t) events->Integral(events->FindBin(ptLeadMin), events->FindBin(ptLeadMax)); |
a75aacd6 | 497 | if (nEvents > 0) |
498 | tracks->Scale(1.0 / nEvents); | |
499 | } | |
500 | ||
501 | ResetBinLimits(fTrackHist[region]->GetGrid(step)); | |
502 | ||
503 | return tracks; | |
504 | } | |
505 | ||
506 | //____________________________________________________________________ | |
507 | void AliUEHist::CorrectTracks(CFStep step1, CFStep step2, TH1* trackCorrection, Int_t var1, Int_t var2) | |
508 | { | |
509 | // corrects from step1 to step2 by multiplying the tracks with trackCorrection | |
510 | // trackCorrection can be a function of eta (var1 == 0), pT (var1 == 1), leading pT (var1 == 2), multiplicity (var1 == 3), delta phi (var1 == 4) | |
511 | // if var2 >= 0 a two dimension correction is assumed in trackCorrection | |
512 | // | |
513 | // if trackCorrection is 0, just copies content from step1 to step2 | |
514 | ||
515 | for (Int_t region=0; region<fkRegions; region++) | |
144bd037 | 516 | CorrectTracks(step1, step2, region, trackCorrection, var1, var2); |
517 | } | |
518 | ||
519 | //____________________________________________________________________ | |
520 | void AliUEHist::CorrectTracks(CFStep step1, CFStep step2, Int_t region, TH1* trackCorrection, Int_t var1, Int_t var2) | |
521 | { | |
522 | // | |
523 | // see documentation of CorrectTracks above | |
524 | // | |
525 | ||
526 | if (!fTrackHist[region]) | |
527 | return; | |
528 | ||
529 | THnSparse* grid = fTrackHist[region]->GetGrid(step1)->GetGrid(); | |
530 | THnSparse* target = fTrackHist[region]->GetGrid(step2)->GetGrid(); | |
531 | ||
532 | // clear target histogram | |
533 | target->Reset(); | |
534 | ||
535 | if (trackCorrection != 0) | |
a75aacd6 | 536 | { |
144bd037 | 537 | if (grid->GetAxis(var1)->GetNbins() != trackCorrection->GetNbinsX()) |
538 | AliFatal(Form("Invalid binning (var1): %d %d", grid->GetAxis(var1)->GetNbins(), trackCorrection->GetNbinsX())); | |
a75aacd6 | 539 | |
144bd037 | 540 | if (var2 >= 0 && grid->GetAxis(var2)->GetNbins() != trackCorrection->GetNbinsY()) |
541 | AliFatal(Form("Invalid binning (var2): %d %d", grid->GetAxis(var2)->GetNbins(), trackCorrection->GetNbinsY())); | |
542 | } | |
543 | ||
544 | // optimized implementation | |
545 | for (Int_t binIdx = 0; binIdx < grid->GetNbins(); binIdx++) | |
546 | { | |
547 | Int_t bins[5]; | |
548 | Double_t value = grid->GetBinContent(binIdx, bins); | |
549 | Double_t error = grid->GetBinError(binIdx); | |
a75aacd6 | 550 | |
551 | if (trackCorrection != 0) | |
552 | { | |
144bd037 | 553 | if (var2 < 0) |
a75aacd6 | 554 | { |
144bd037 | 555 | value *= trackCorrection->GetBinContent(bins[var1]); |
556 | error *= trackCorrection->GetBinContent(bins[var1]); | |
557 | } | |
558 | else | |
559 | { | |
560 | value *= trackCorrection->GetBinContent(bins[var1], bins[var2]); | |
561 | error *= trackCorrection->GetBinContent(bins[var1], bins[var2]); | |
a75aacd6 | 562 | } |
a75aacd6 | 563 | } |
144bd037 | 564 | |
565 | target->SetBinContent(bins, value); | |
566 | target->SetBinError(bins, error); | |
a75aacd6 | 567 | } |
568 | } | |
569 | ||
570 | //____________________________________________________________________ | |
571 | void AliUEHist::CorrectEvents(CFStep step1, CFStep step2, TH1D* eventCorrection, Int_t var) | |
572 | { | |
573 | // corrects from step1 to step2 by multiplying the events with eventCorrection | |
574 | // eventCorrection is as function of leading pT (var == 0) or multiplicity (var == 1) | |
575 | // | |
576 | // if eventCorrection is 0, just copies content from step1 to step2 | |
577 | ||
578 | AliCFGridSparse* grid = fEventHist->GetGrid(step1); | |
579 | AliCFGridSparse* target = fEventHist->GetGrid(step2); | |
580 | ||
144bd037 | 581 | // clear target histogram |
582 | target->GetGrid()->Reset(); | |
583 | ||
a75aacd6 | 584 | if (eventCorrection != 0 && grid->GetNBins(var) != eventCorrection->GetNbinsX()) |
585 | AliFatal(Form("Invalid binning: %d %d", grid->GetNBins(var), eventCorrection->GetNbinsX())); | |
586 | ||
587 | Int_t bins[2]; | |
588 | for (Int_t x = 1; x <= grid->GetNBins(0); x++) | |
589 | { | |
590 | bins[0] = x; | |
591 | for (Int_t y = 1; y <= grid->GetNBins(1); y++) | |
592 | { | |
593 | bins[1] = y; | |
594 | ||
595 | Double_t value = grid->GetElement(bins); | |
596 | if (value != 0) | |
597 | { | |
598 | Double_t error = grid->GetElementError(bins); | |
599 | ||
600 | if (eventCorrection != 0) | |
601 | { | |
602 | value *= eventCorrection->GetBinContent(bins[var]); | |
603 | error *= eventCorrection->GetBinContent(bins[var]); | |
604 | } | |
605 | ||
606 | target->SetElement(bins, value); | |
607 | target->SetElementError(bins, error); | |
608 | } | |
609 | } | |
610 | } | |
611 | } | |
612 | ||
613 | //____________________________________________________________________ | |
614 | void AliUEHist::Correct(AliUEHist* corrections) | |
615 | { | |
616 | // applies the given corrections to extract from the step kCFStepReconstructed all previous steps | |
617 | // | |
618 | // in this object the data is expected in the step kCFStepReconstructed | |
619 | ||
620 | // ---- track level | |
621 | ||
622 | // bias due to migration in leading pT (because the leading particle is not reconstructed, and the subleading is used) | |
623 | // extracted as function of leading pT | |
144bd037 | 624 | for (Int_t region = 0; region < fkRegions; region++) |
625 | { | |
626 | if (!fTrackHist[region]) | |
627 | continue; | |
628 | ||
629 | //TH1D* leadingBias = (TH1D*) corrections->GetBias(kCFStepReconstructed, kCFStepTracked, region, "z"); // from MC | |
630 | TH1D* leadingBias = (TH1D*) GetBias(kCFStepBiasStudy, kCFStepReconstructed, region, "z"); // from data | |
631 | CorrectTracks(kCFStepReconstructed, kCFStepTracked, region, leadingBias, 2); | |
632 | if (region == kMin && fCombineMinMax) | |
633 | { | |
634 | CorrectTracks(kCFStepReconstructed, kCFStepTracked, kMax, leadingBias, 2); | |
635 | delete leadingBias; | |
636 | break; | |
637 | } | |
638 | delete leadingBias; | |
639 | } | |
a75aacd6 | 640 | CorrectEvents(kCFStepReconstructed, kCFStepTracked, 0, 0); |
a75aacd6 | 641 | |
642 | // correct with kCFStepTracked --> kCFStepTrackedOnlyPrim | |
643 | TH2D* contamination = corrections->GetTrackingContamination(); | |
144bd037 | 644 | if (corrections->fContaminationEnhancement) |
645 | { | |
646 | Printf("Applying contamination enhancement"); | |
647 | ||
648 | for (Int_t x=1; x<=contamination->GetNbinsX(); x++) | |
649 | for (Int_t y=1; y<=contamination->GetNbinsX(); y++) | |
650 | contamination->SetBinContent(x, y, contamination->GetBinContent(x, y) * corrections->fContaminationEnhancement->GetBinContent(corrections->fContaminationEnhancement->GetXaxis()->FindBin(contamination->GetYaxis()->GetBinCenter(y)))); | |
651 | } | |
a75aacd6 | 652 | CorrectTracks(kCFStepTracked, kCFStepTrackedOnlyPrim, contamination, 0, 1); |
653 | CorrectEvents(kCFStepTracked, kCFStepTrackedOnlyPrim, 0, 0); | |
654 | delete contamination; | |
655 | ||
144bd037 | 656 | // correct with kCFStepTrackedOnlyPrim --> kCFStepAnaTopology |
657 | TH2D* efficiencyCorrection = corrections->GetTrackingEfficiencyCorrection(); | |
658 | CorrectTracks(kCFStepTrackedOnlyPrim, kCFStepAnaTopology, efficiencyCorrection, 0, 1); | |
659 | CorrectEvents(kCFStepTrackedOnlyPrim, kCFStepAnaTopology, 0, 0); | |
660 | delete efficiencyCorrection; | |
a75aacd6 | 661 | |
662 | // copy | |
663 | CorrectTracks(kCFStepAnaTopology, kCFStepVertex, 0, -1); | |
664 | CorrectEvents(kCFStepAnaTopology, kCFStepVertex, 0, 0); | |
665 | ||
666 | // vertex correction on the level of events as function of multiplicity, weighting tracks and events with the same factor | |
667 | // practically independent of low pT cut | |
668 | TH1D* vertexCorrection = (TH1D*) corrections->GetEventEfficiency(kCFStepVertex, kCFStepTriggered, 1); | |
669 | ||
670 | // convert stage from true multiplicity to observed multiplicity by simple conversion factor | |
671 | TH1D* vertexCorrectionObs = (TH1D*) vertexCorrection->Clone("vertexCorrection2"); | |
672 | vertexCorrectionObs->Reset(); | |
673 | ||
144bd037 | 674 | TF1* func = new TF1("func", "[1]+[0]/(x-[2])"); |
675 | vertexCorrection->Fit(func, "0", "", 0.8, 4); | |
676 | ||
a75aacd6 | 677 | for (Int_t i=1; i<=vertexCorrectionObs->GetNbinsX(); i++) |
144bd037 | 678 | { |
679 | Float_t xPos = 1.0 / 0.77 * vertexCorrectionObs->GetXaxis()->GetBinCenter(i); | |
680 | if (xPos < 4) | |
681 | vertexCorrectionObs->SetBinContent(i, func->Eval(xPos)); | |
682 | else | |
683 | vertexCorrectionObs->SetBinContent(i, vertexCorrection->Interpolate(xPos)); | |
684 | } | |
a75aacd6 | 685 | |
b1831bcb | 686 | #if 0 |
144bd037 | 687 | new TCanvas; |
a75aacd6 | 688 | vertexCorrection->DrawCopy(); |
689 | vertexCorrectionObs->SetLineColor(2); | |
144bd037 | 690 | vertexCorrectionObs->DrawCopy("same"); |
b1831bcb | 691 | #endif |
a75aacd6 | 692 | |
693 | CorrectTracks(kCFStepVertex, kCFStepTriggered, vertexCorrectionObs, 3); | |
694 | CorrectEvents(kCFStepVertex, kCFStepTriggered, vertexCorrectionObs, 1); | |
695 | delete vertexCorrectionObs; | |
696 | delete vertexCorrection; | |
697 | ||
698 | // copy | |
699 | CorrectTracks(kCFStepTriggered, kCFStepAll, 0, -1); | |
700 | CorrectEvents(kCFStepTriggered, kCFStepAll, 0, 0); | |
701 | } | |
702 | ||
703 | //____________________________________________________________________ | |
b1831bcb | 704 | TH1* AliUEHist::GetTrackEfficiency(CFStep step1, CFStep step2, Int_t axis1, Int_t axis2, Int_t source) |
a75aacd6 | 705 | { |
706 | // creates a track-level efficiency by dividing step2 by step1 | |
707 | // projected to axis1 and axis2 (optional if >= 0) | |
b1831bcb | 708 | // |
709 | // source: 0 = fTrackHist; 1 = fTrackHistEfficiency | |
a75aacd6 | 710 | |
711 | // integrate over regions | |
712 | // cache it for efficiency (usually more than one efficiency is requested) | |
b1831bcb | 713 | |
714 | AliCFContainer* sourceContainer = 0; | |
715 | ||
716 | if (source == 0) | |
a75aacd6 | 717 | { |
b1831bcb | 718 | if (!fCache) |
719 | { | |
720 | fCache = (AliCFContainer*) fTrackHist[0]->Clone(); | |
721 | for (Int_t i = 1; i < fkRegions; i++) | |
722 | if (fTrackHist[i]) | |
723 | fCache->Add(fTrackHist[i]); | |
724 | } | |
725 | sourceContainer = fCache; | |
a75aacd6 | 726 | } |
b1831bcb | 727 | else if (source == 1) |
728 | { | |
729 | sourceContainer = fTrackHistEfficiency; | |
730 | // step offset because we start with kCFStepAnaTopology | |
731 | step1 = (CFStep) ((Int_t) step1 - (Int_t) kCFStepAnaTopology); | |
732 | step2 = (CFStep) ((Int_t) step2 - (Int_t) kCFStepAnaTopology); | |
733 | } | |
734 | else | |
735 | return 0; | |
736 | ||
a75aacd6 | 737 | // reset all limits and set the right ones except those in axis1 and axis2 |
b1831bcb | 738 | ResetBinLimits(sourceContainer->GetGrid(step1)); |
739 | ResetBinLimits(sourceContainer->GetGrid(step2)); | |
a75aacd6 | 740 | if (fEtaMax > fEtaMin && axis1 != 0 && axis2 != 0) |
741 | { | |
b1831bcb | 742 | sourceContainer->GetGrid(step1)->SetRangeUser(0, fEtaMin, fEtaMax); |
743 | sourceContainer->GetGrid(step2)->SetRangeUser(0, fEtaMin, fEtaMax); | |
a75aacd6 | 744 | } |
745 | if (fPtMax > fPtMin && axis1 != 1 && axis2 != 1) | |
746 | { | |
b1831bcb | 747 | sourceContainer->GetGrid(step1)->SetRangeUser(1, fPtMin, fPtMax); |
748 | sourceContainer->GetGrid(step2)->SetRangeUser(1, fPtMin, fPtMax); | |
a75aacd6 | 749 | } |
750 | ||
751 | TH1* measured = 0; | |
752 | TH1* generated = 0; | |
753 | ||
144bd037 | 754 | if (axis2 >= 0) |
a75aacd6 | 755 | { |
b1831bcb | 756 | generated = sourceContainer->Project(axis1, axis2, step1); |
757 | measured = sourceContainer->Project(axis1, axis2, step2); | |
a75aacd6 | 758 | } |
759 | else | |
760 | { | |
b1831bcb | 761 | generated = sourceContainer->Project(axis1, step1); |
762 | measured = sourceContainer->Project(axis1, step2); | |
a75aacd6 | 763 | } |
764 | ||
144bd037 | 765 | // check for bins with less than 100 entries, print warning |
766 | Int_t binBegin[2]; | |
767 | Int_t binEnd[2]; | |
768 | ||
769 | binBegin[0] = 1; | |
770 | binBegin[1] = 1; | |
771 | ||
772 | binEnd[0] = generated->GetNbinsX(); | |
773 | binEnd[1] = generated->GetNbinsY(); | |
774 | ||
775 | if (fEtaMax > fEtaMin) | |
776 | { | |
777 | if (axis1 == 0) | |
778 | { | |
779 | binBegin[0] = generated->GetXaxis()->FindBin(fEtaMin); | |
780 | binEnd[0] = generated->GetXaxis()->FindBin(fEtaMax); | |
781 | } | |
782 | if (axis2 == 0) | |
783 | { | |
784 | binBegin[1] = generated->GetYaxis()->FindBin(fEtaMin); | |
785 | binEnd[1] = generated->GetYaxis()->FindBin(fEtaMax); | |
786 | } | |
787 | } | |
788 | ||
789 | if (fPtMax > fPtMin) | |
790 | { | |
791 | // TODO this is just checking up to 15 for now | |
792 | Float_t ptMax = TMath::Min((Float_t) 15., fPtMax); | |
793 | if (axis1 == 1) | |
794 | { | |
795 | binBegin[0] = generated->GetXaxis()->FindBin(fPtMin); | |
796 | binEnd[0] = generated->GetXaxis()->FindBin(ptMax); | |
797 | } | |
798 | if (axis2 == 1) | |
799 | { | |
800 | binBegin[1] = generated->GetYaxis()->FindBin(fPtMin); | |
801 | binEnd[1] = generated->GetYaxis()->FindBin(ptMax); | |
802 | } | |
803 | } | |
804 | ||
805 | Int_t total = 0; | |
806 | Int_t count = 0; | |
807 | Int_t vars[2]; | |
808 | ||
809 | for (Int_t i=0; i<2; i++) | |
810 | vars[i] = binBegin[i]; | |
811 | ||
812 | const Int_t limit = 50; | |
813 | while (1) | |
814 | { | |
815 | if (generated->GetDimension() == 1 && generated->GetBinContent(vars[0]) < limit) | |
816 | { | |
817 | Printf("Empty bin at %s=%.2f (%.2f entries)", generated->GetXaxis()->GetTitle(), generated->GetXaxis()->GetBinCenter(vars[0]), generated->GetBinContent(vars[0])); | |
818 | count++; | |
819 | } | |
820 | else if (generated->GetDimension() == 2 && generated->GetBinContent(vars[0], vars[1]) < limit) | |
821 | { | |
822 | Printf("Empty bin at %s=%.2f %s=%.2f (%.2f entries)", | |
823 | generated->GetXaxis()->GetTitle(), generated->GetXaxis()->GetBinCenter(vars[0]), | |
824 | generated->GetYaxis()->GetTitle(), generated->GetYaxis()->GetBinCenter(vars[1]), | |
825 | generated->GetBinContent(vars[0], vars[1])); | |
826 | count++; | |
827 | } | |
828 | ||
829 | vars[1]++; | |
830 | if (vars[1] == binEnd[1]+1) | |
831 | { | |
832 | vars[1] = binBegin[1]; | |
833 | vars[0]++; | |
834 | } | |
835 | ||
836 | if (vars[0] == binEnd[0]+1) | |
837 | break; | |
838 | total++; | |
839 | } | |
840 | ||
841 | Printf("Correction has %d empty bins (out of %d bins)", count, total); | |
842 | ||
843 | measured->Divide(measured, generated, 1, 1, "B"); | |
a75aacd6 | 844 | |
845 | delete generated; | |
846 | ||
b1831bcb | 847 | ResetBinLimits(sourceContainer->GetGrid(step1)); |
848 | ResetBinLimits(sourceContainer->GetGrid(step2)); | |
849 | ||
a75aacd6 | 850 | return measured; |
851 | } | |
852 | ||
853 | //____________________________________________________________________ | |
854 | TH1* AliUEHist::GetEventEfficiency(CFStep step1, CFStep step2, Int_t axis1, Int_t axis2, Float_t ptLeadMin, Float_t ptLeadMax) | |
855 | { | |
856 | // creates a event-level efficiency by dividing step2 by step1 | |
857 | // projected to axis1 and axis2 (optional if >= 0) | |
858 | ||
859 | if (ptLeadMax > ptLeadMin) | |
860 | { | |
861 | fEventHist->GetGrid(step1)->SetRangeUser(0, ptLeadMin, ptLeadMax); | |
862 | fEventHist->GetGrid(step2)->SetRangeUser(0, ptLeadMin, ptLeadMax); | |
863 | } | |
864 | ||
865 | TH1* measured = 0; | |
866 | TH1* generated = 0; | |
867 | ||
144bd037 | 868 | if (axis2 >= 0) |
a75aacd6 | 869 | { |
870 | generated = fEventHist->Project(axis1, axis2, step1); | |
871 | measured = fEventHist->Project(axis1, axis2, step2); | |
872 | } | |
873 | else | |
874 | { | |
875 | generated = fEventHist->Project(axis1, step1); | |
876 | measured = fEventHist->Project(axis1, step2); | |
877 | } | |
878 | ||
144bd037 | 879 | measured->Divide(measured, generated, 1, 1, "B"); |
a75aacd6 | 880 | |
881 | delete generated; | |
882 | ||
883 | if (ptLeadMax > ptLeadMin) | |
884 | { | |
885 | fEventHist->GetGrid(step1)->SetRangeUser(0, 0, -1); | |
886 | fEventHist->GetGrid(step2)->SetRangeUser(0, 0, -1); | |
887 | } | |
888 | ||
889 | return measured; | |
890 | } | |
891 | ||
892 | //____________________________________________________________________ | |
893 | void AliUEHist::WeightHistogram(TH3* hist1, TH1* hist2) | |
894 | { | |
895 | // weights each entry of the 3d histogram hist1 with the 1d histogram hist2 | |
896 | // where the matching is done of the z axis of hist1 with the x axis of hist2 | |
897 | ||
898 | if (hist1->GetNbinsZ() != hist2->GetNbinsX()) | |
899 | AliFatal(Form("Inconsistent binning %d %d", hist1->GetNbinsZ(), hist2->GetNbinsX())); | |
900 | ||
901 | for (Int_t x=1; x<=hist1->GetNbinsX(); x++) | |
902 | { | |
903 | for (Int_t y=1; y<=hist1->GetNbinsY(); y++) | |
904 | { | |
905 | for (Int_t z=1; z<=hist1->GetNbinsZ(); z++) | |
906 | { | |
907 | if (hist2->GetBinContent(z) > 0) | |
908 | { | |
909 | hist1->SetBinContent(x, y, z, hist1->GetBinContent(x, y, z) / hist2->GetBinContent(z)); | |
910 | hist1->SetBinError(x, y, z, hist1->GetBinError(x, y, z) / hist2->GetBinContent(z)); | |
911 | } | |
912 | else | |
913 | { | |
914 | hist1->SetBinContent(x, y, z, 0); | |
915 | hist1->SetBinError(x, y, z, 0); | |
916 | } | |
917 | } | |
918 | } | |
919 | } | |
920 | } | |
921 | ||
922 | //____________________________________________________________________ | |
144bd037 | 923 | TH1* AliUEHist::GetBias(CFStep step1, CFStep step2, Int_t region, const char* axis, Float_t leadPtMin, Float_t leadPtMax) |
a75aacd6 | 924 | { |
925 | // extracts the track-level bias (integrating out the multiplicity) between two steps (dividing step2 by step1) | |
144bd037 | 926 | // in the given region (sum over all regions is calculated if region == -1) |
a75aacd6 | 927 | // done by weighting the track-level distribution with the number of events as function of leading pT |
928 | // and then calculating the ratio between the distributions | |
929 | // projected to axis which is a TH3::Project3D string, e.g. "x", or "yx" | |
930 | // no projection is done if axis == 0 | |
931 | ||
144bd037 | 932 | AliCFContainer* tmp = 0; |
933 | ||
934 | if (region == -1) | |
935 | { | |
936 | tmp = (AliCFContainer*) fTrackHist[0]->Clone(); | |
937 | for (Int_t i = 1; i < fkRegions; i++) | |
938 | if (fTrackHist[i]) | |
939 | tmp->Add(fTrackHist[i]); | |
940 | } | |
941 | else if (region == kMin && fCombineMinMax) | |
942 | { | |
943 | tmp = (AliCFContainer*) fTrackHist[kMin]->Clone(); | |
944 | tmp->Add(fTrackHist[kMax]); | |
945 | } | |
946 | else | |
947 | tmp = fTrackHist[region]; | |
948 | ||
949 | ResetBinLimits(tmp->GetGrid(step1)); | |
950 | ResetBinLimits(fEventHist->GetGrid(step1)); | |
951 | SetBinLimits(tmp->GetGrid(step1)); | |
952 | ||
953 | ResetBinLimits(tmp->GetGrid(step2)); | |
954 | ResetBinLimits(fEventHist->GetGrid(step2)); | |
955 | SetBinLimits(tmp->GetGrid(step2)); | |
a75aacd6 | 956 | |
957 | TH1D* events1 = fEventHist->Project(0, step1); | |
958 | TH3D* hist1 = tmp->Project(0, 1, 2, step1); | |
959 | WeightHistogram(hist1, events1); | |
960 | ||
961 | TH1D* events2 = fEventHist->Project(0, step2); | |
962 | TH3D* hist2 = tmp->Project(0, 1, 2, step2); | |
963 | WeightHistogram(hist2, events2); | |
964 | ||
965 | TH1* generated = hist1; | |
966 | TH1* measured = hist2; | |
967 | ||
968 | if (axis) | |
969 | { | |
970 | if (leadPtMax > leadPtMin) | |
971 | { | |
972 | hist1->GetZaxis()->SetRangeUser(leadPtMin, leadPtMax); | |
973 | hist2->GetZaxis()->SetRangeUser(leadPtMin, leadPtMax); | |
974 | } | |
975 | ||
976 | if (fEtaMax > fEtaMin && !TString(axis).Contains("x")) | |
977 | { | |
978 | hist1->GetXaxis()->SetRangeUser(fEtaMin, fEtaMax); | |
979 | hist2->GetXaxis()->SetRangeUser(fEtaMin, fEtaMax); | |
980 | } | |
981 | if (fPtMax > fPtMin && !TString(axis).Contains("y")) | |
982 | { | |
983 | hist1->GetYaxis()->SetRangeUser(fPtMin, fPtMax); | |
984 | hist2->GetYaxis()->SetRangeUser(fPtMin, fPtMax); | |
985 | } | |
986 | ||
987 | generated = hist1->Project3D(axis); | |
988 | measured = hist2->Project3D(axis); | |
989 | ||
990 | // delete hists here if projection has been done | |
991 | delete hist1; | |
992 | delete hist2; | |
993 | } | |
994 | ||
995 | measured->Divide(generated); | |
996 | ||
997 | delete events1; | |
998 | delete events2; | |
999 | delete generated; | |
144bd037 | 1000 | |
1001 | ResetBinLimits(tmp->GetGrid(step1)); | |
1002 | ResetBinLimits(tmp->GetGrid(step2)); | |
1003 | ||
29e8465c | 1004 | if ((region == -1) || (region == kMin && fCombineMinMax)) |
144bd037 | 1005 | delete tmp; |
a75aacd6 | 1006 | |
1007 | return measured; | |
1008 | } | |
1009 | ||
1010 | //____________________________________________________________________ | |
1011 | TH2D* AliUEHist::GetTrackingEfficiency() | |
1012 | { | |
1013 | // extracts the tracking efficiency by calculating the efficiency from step kCFStepAnaTopology to kCFStepTrackedOnlyPrim | |
1014 | // integrates over the regions and all other variables than pT and eta to increase the statistics | |
1015 | // | |
1016 | // returned histogram has to be deleted by the user | |
1017 | ||
1018 | return dynamic_cast<TH2D*> (GetTrackEfficiency(kCFStepAnaTopology, kCFStepTrackedOnlyPrim, 0, 1)); | |
1019 | } | |
1020 | ||
1021 | //____________________________________________________________________ | |
1022 | TH1D* AliUEHist::GetTrackingEfficiency(Int_t axis) | |
1023 | { | |
1024 | // extracts the tracking efficiency by calculating the efficiency from step kCFStepAnaTopology to kCFStepTrackedOnlyPrim | |
1025 | // integrates over the regions and all other variables than pT (axis == 0) and eta (axis == 1) to increase the statistics | |
1026 | ||
1027 | return dynamic_cast<TH1D*> (GetTrackEfficiency(kCFStepAnaTopology, kCFStepTrackedOnlyPrim, axis)); | |
1028 | } | |
1029 | ||
1030 | //____________________________________________________________________ | |
1031 | TH2D* AliUEHist::GetTrackingCorrection() | |
1032 | { | |
1033 | // extracts the tracking correction by calculating the efficiency from step kCFStepAnaTopology to kCFStepTracked | |
1034 | // integrates over the regions and all other variables than pT and eta to increase the statistics | |
1035 | // | |
1036 | // returned histogram has to be deleted by the user | |
1037 | ||
1038 | return dynamic_cast<TH2D*> (GetTrackEfficiency(kCFStepTracked, kCFStepAnaTopology, 0, 1)); | |
1039 | } | |
1040 | ||
1041 | //____________________________________________________________________ | |
1042 | TH1D* AliUEHist::GetTrackingCorrection(Int_t axis) | |
1043 | { | |
1044 | // extracts the tracking correction by calculating the efficiency from step kCFStepAnaTopology to kCFStepTracked | |
1045 | // integrates over the regions and all other variables than pT (axis == 0) and eta (axis == 1) to increase the statistics | |
1046 | ||
1047 | return dynamic_cast<TH1D*> (GetTrackEfficiency(kCFStepTracked, kCFStepAnaTopology, axis)); | |
1048 | } | |
1049 | ||
144bd037 | 1050 | //____________________________________________________________________ |
1051 | TH2D* AliUEHist::GetTrackingEfficiencyCorrection() | |
1052 | { | |
1053 | // extracts the tracking correction by calculating the efficiency from step kCFStepAnaTopology to kCFStepTracked | |
1054 | // integrates over the regions and all other variables than pT and eta to increase the statistics | |
1055 | // | |
1056 | // returned histogram has to be deleted by the user | |
1057 | ||
1058 | return dynamic_cast<TH2D*> (GetTrackEfficiency(kCFStepTrackedOnlyPrim, kCFStepAnaTopology, 0, 1)); | |
1059 | } | |
1060 | ||
1061 | //____________________________________________________________________ | |
1062 | TH1D* AliUEHist::GetTrackingEfficiencyCorrection(Int_t axis) | |
1063 | { | |
1064 | // extracts the tracking correction by calculating the efficiency from step kCFStepAnaTopology to kCFStepTracked | |
1065 | // integrates over the regions and all other variables than pT (axis == 0) and eta (axis == 1) to increase the statistics | |
1066 | ||
1067 | return dynamic_cast<TH1D*> (GetTrackEfficiency(kCFStepTrackedOnlyPrim, kCFStepAnaTopology, axis)); | |
1068 | } | |
1069 | ||
a75aacd6 | 1070 | //____________________________________________________________________ |
1071 | TH2D* AliUEHist::GetTrackingContamination() | |
1072 | { | |
1073 | // extracts the tracking contamination by secondaries by calculating the efficiency from step kCFStepTrackedOnlyPrim to kCFStepTracked | |
1074 | // integrates over the regions and all other variables than pT and eta to increase the statistics | |
1075 | // | |
1076 | // returned histogram has to be deleted by the user | |
1077 | ||
1078 | return dynamic_cast<TH2D*> (GetTrackEfficiency(kCFStepTracked, kCFStepTrackedOnlyPrim, 0, 1)); | |
1079 | } | |
1080 | ||
1081 | //____________________________________________________________________ | |
1082 | TH1D* AliUEHist::GetTrackingContamination(Int_t axis) | |
1083 | { | |
1084 | // extracts the tracking contamination by secondaries by calculating the efficiency from step kCFStepTrackedOnlyPrim to kCFStepTracked | |
1085 | // integrates over the regions and all other variables than pT (axis == 0) and eta (axis == 1) to increase the statistics | |
1086 | ||
1087 | return dynamic_cast<TH1D*> (GetTrackEfficiency(kCFStepTracked, kCFStepTrackedOnlyPrim, axis)); | |
1088 | } | |
1089 | ||
1090 | //____________________________________________________________________ | |
1091 | const char* AliUEHist::GetRegionTitle(Region region) | |
1092 | { | |
1093 | // returns the name of the given region | |
1094 | ||
1095 | switch (region) | |
1096 | { | |
1097 | case kToward: | |
1098 | return "Towards"; | |
1099 | case kAway: | |
1100 | return "Away"; | |
1101 | case kMin: | |
1102 | return (fCombineMinMax) ? "Transverse" : "Min"; | |
1103 | case kMax: | |
1104 | return "Max"; | |
1105 | } | |
1106 | ||
1107 | return 0; | |
1108 | } | |
1109 | ||
1110 | //____________________________________________________________________ | |
1111 | const char* AliUEHist::GetStepTitle(CFStep step) | |
1112 | { | |
1113 | // returns the name of the given step | |
1114 | ||
1115 | switch (step) | |
1116 | { | |
1117 | case kCFStepAll: | |
1118 | return "All events"; | |
1119 | case kCFStepTriggered: | |
1120 | return "Triggered"; | |
1121 | case kCFStepVertex: | |
1122 | return "Primary Vertex"; | |
1123 | case kCFStepAnaTopology: | |
1124 | return "Required analysis topology"; | |
1125 | case kCFStepTrackedOnlyPrim: | |
1126 | return "Tracked (matched MC, only primaries)"; | |
1127 | case kCFStepTracked: | |
1128 | return "Tracked (matched MC, all)"; | |
1129 | case kCFStepReconstructed: | |
1130 | return "Reconstructed"; | |
1131 | case kCFStepRealLeading: | |
1132 | return "Correct leading particle identified"; | |
1133 | case kCFStepBiasStudy: | |
1134 | return "Bias study applying tracking efficiency"; | |
1135 | case kCFStepBiasStudy2: | |
1136 | return "Bias study applying tracking efficiency in two steps"; | |
1137 | } | |
1138 | ||
1139 | return 0; | |
1140 | } | |
b1831bcb | 1141 | |
1142 | //____________________________________________________________________ | |
1143 | void AliUEHist::CopyReconstructedData(AliUEHist* from) | |
1144 | { | |
1145 | // copies those histograms extracted from ESD to this object | |
1146 | ||
1147 | // TODO at present only the pointers are copied | |
1148 | ||
1149 | for (Int_t region=0; region<4; region++) | |
1150 | { | |
1151 | if (!fTrackHist[region]) | |
1152 | continue; | |
1153 | ||
1154 | fTrackHist[region]->SetGrid(AliUEHist::kCFStepReconstructed, from->fTrackHist[region]->GetGrid(AliUEHist::kCFStepReconstructed)); | |
1155 | fTrackHist[region]->SetGrid(AliUEHist::kCFStepBiasStudy, from->fTrackHist[region]->GetGrid(AliUEHist::kCFStepBiasStudy)); | |
1156 | } | |
1157 | ||
1158 | fEventHist->SetGrid(AliUEHist::kCFStepReconstructed, from->fEventHist->GetGrid(AliUEHist::kCFStepReconstructed)); | |
1159 | fEventHist->SetGrid(AliUEHist::kCFStepBiasStudy, from->fEventHist->GetGrid(AliUEHist::kCFStepBiasStudy)); | |
1160 | } |