]>
Commit | Line | Data |
---|---|---|
600b313f | 1 | // |
2 | // Calculate the corrections in the central regions | |
3 | // | |
4 | // Inputs: | |
5 | // - AliESDEvent | |
6 | // | |
7 | // Outputs: | |
8 | // - AliAODCentralMult | |
9 | // | |
10 | // Histograms | |
11 | // | |
12 | // Corrections used | |
13 | // | |
14 | #include "AliCentralMCCorrectionsTask.h" | |
15 | #include "AliTriggerAnalysis.h" | |
16 | #include "AliPhysicsSelection.h" | |
17 | #include "AliLog.h" | |
18 | #include "AliHeader.h" | |
19 | #include "AliGenEventHeader.h" | |
20 | #include "AliESDEvent.h" | |
21 | #include "AliAODHandler.h" | |
22 | #include "AliMultiplicity.h" | |
23 | #include "AliInputEventHandler.h" | |
24 | #include "AliStack.h" | |
25 | #include "AliMCEvent.h" | |
26 | #include "AliAODForwardMult.h" | |
27 | #include "AliCentralCorrSecondaryMap.h" | |
f53fb4f6 | 28 | #include "AliForwardUtil.h" |
600b313f | 29 | #include <TH1.h> |
30 | #include <TH2D.h> | |
31 | #include <TDirectory.h> | |
32 | #include <TList.h> | |
33 | #include <TROOT.h> | |
34 | #include <iostream> | |
35 | ||
36 | //==================================================================== | |
37 | namespace { | |
38 | const char* GetEventName(Bool_t tr, Bool_t vtx) | |
39 | { | |
40 | return Form("nEvents%s%s", (tr ? "Tr" : ""), (vtx ? "Vtx" : "")); | |
41 | } | |
2f498ec2 | 42 | /*const char* GetHitsName(UShort_t d, Char_t r) |
600b313f | 43 | { |
44 | return Form("hitsSPD%d%c", d, r); | |
45 | } | |
46 | const char* GetStripsName(UShort_t d, Char_t r) | |
47 | { | |
48 | return Form("stripsSPD%d%c", d, r); | |
49 | } | |
50 | const char* GetPrimaryName(Char_t r, Bool_t trVtx) | |
51 | { | |
52 | return Form("primaries%s%s", | |
53 | ((r == 'I' || r == 'i') ? "Inner" : "Outer"), | |
54 | (trVtx ? "TrVtx" : "All")); | |
2f498ec2 | 55 | } |
56 | */ | |
600b313f | 57 | } |
58 | ||
59 | //==================================================================== | |
60 | AliCentralMCCorrectionsTask::AliCentralMCCorrectionsTask() | |
61 | : AliAnalysisTaskSE(), | |
62 | fInspector(), | |
63 | fTrackDensity(), | |
64 | fVtxBins(0), | |
65 | fFirstEvent(true), | |
66 | fHEvents(0), | |
67 | fHEventsTr(0), | |
68 | fHEventsTrVtx(0), | |
69 | fVtxAxis(), | |
70 | fEtaAxis(), | |
71 | fList(), | |
4a9f6ae6 | 72 | fNPhiBins(20) |
600b313f | 73 | { |
74 | // | |
75 | // Constructor | |
76 | // | |
77 | // Parameters: | |
78 | // name Name of task | |
79 | // | |
f53fb4f6 | 80 | DGUARD(fDebug,0,"Default construction of AliCentralMCCorrectionsTask"); |
600b313f | 81 | } |
82 | ||
83 | //____________________________________________________________________ | |
84 | AliCentralMCCorrectionsTask::AliCentralMCCorrectionsTask(const char* name) | |
85 | : AliAnalysisTaskSE(name), | |
86 | fInspector("eventInspector"), | |
87 | fTrackDensity("trackDensity"), | |
88 | fVtxBins(0), | |
89 | fFirstEvent(true), | |
90 | fHEvents(0), | |
91 | fHEventsTr(0), | |
92 | fHEventsTrVtx(0), | |
93 | fVtxAxis(10,-10,10), | |
94 | fEtaAxis(200,-4,6), | |
95 | fList(), | |
4a9f6ae6 | 96 | fNPhiBins(20) |
600b313f | 97 | { |
98 | // | |
99 | // Constructor | |
100 | // | |
101 | // Parameters: | |
102 | // name Name of task | |
103 | // | |
f53fb4f6 | 104 | DGUARD(fDebug,0,"Named construction of AliCentralMCCorrectionsTask: %s",name); |
600b313f | 105 | DefineOutput(1, TList::Class()); |
106 | DefineOutput(2, TList::Class()); | |
107 | } | |
108 | ||
109 | //____________________________________________________________________ | |
110 | AliCentralMCCorrectionsTask::AliCentralMCCorrectionsTask(const AliCentralMCCorrectionsTask& o) | |
111 | : AliAnalysisTaskSE(o), | |
112 | fInspector(o.fInspector), | |
113 | fTrackDensity(), | |
114 | fVtxBins(0), | |
115 | fFirstEvent(o.fFirstEvent), | |
116 | fHEvents(o.fHEvents), | |
117 | fHEventsTr(o.fHEventsTr), | |
118 | fHEventsTrVtx(o.fHEventsTrVtx), | |
119 | fVtxAxis(10,-10,10), | |
120 | fEtaAxis(200,-4,6), | |
121 | fList(o.fList), | |
122 | fNPhiBins(o.fNPhiBins) | |
123 | { | |
124 | // | |
125 | // Copy constructor | |
126 | // | |
127 | // Parameters: | |
128 | // o Object to copy from | |
129 | // | |
f53fb4f6 | 130 | DGUARD(fDebug,0,"Copy construction of AliCentralMCCorrectionsTask"); |
600b313f | 131 | } |
132 | ||
133 | //____________________________________________________________________ | |
134 | AliCentralMCCorrectionsTask& | |
135 | AliCentralMCCorrectionsTask::operator=(const AliCentralMCCorrectionsTask& o) | |
136 | { | |
137 | // | |
138 | // Assignment operator | |
139 | // | |
140 | // Parameters: | |
141 | // o Object to assign from | |
142 | // | |
143 | // Return: | |
144 | // Reference to this object | |
145 | // | |
f53fb4f6 | 146 | DGUARD(fDebug,3,"Assignment of AliCentralMCCorrectionsTask"); |
d015ecfe | 147 | if (&o == this) return *this; |
600b313f | 148 | fInspector = o.fInspector; |
149 | fTrackDensity = o.fTrackDensity; | |
150 | fVtxBins = o.fVtxBins; | |
151 | fFirstEvent = o.fFirstEvent; | |
152 | fHEvents = o.fHEvents; | |
153 | fHEventsTr = o.fHEventsTr; | |
154 | fHEventsTrVtx = o.fHEventsTrVtx; | |
155 | SetVertexAxis(o.fVtxAxis); | |
156 | SetEtaAxis(o.fEtaAxis); | |
157 | fNPhiBins = o.fNPhiBins; | |
158 | ||
159 | return *this; | |
160 | } | |
161 | ||
162 | //____________________________________________________________________ | |
163 | void | |
164 | AliCentralMCCorrectionsTask::Init() | |
165 | { | |
166 | // | |
167 | // Initialize the task | |
168 | // | |
169 | // | |
f53fb4f6 | 170 | DGUARD(fDebug,1,"Initialize AliCentralMCCorrectionsTask"); |
600b313f | 171 | } |
172 | ||
173 | //____________________________________________________________________ | |
174 | void | |
175 | AliCentralMCCorrectionsTask::SetVertexAxis(Int_t nBin, Double_t min, | |
176 | Double_t max) | |
177 | { | |
178 | // | |
179 | // Set the vertex axis to use | |
180 | // | |
181 | // Parameters: | |
182 | // nBins Number of bins | |
183 | // vzMin Least @f$z@f$ coordinate of interation point | |
184 | // vzMax Largest @f$z@f$ coordinate of interation point | |
185 | // | |
f53fb4f6 | 186 | DGUARD(fDebug,3,"Set vertex axis AliCentralMCCorrectionsTask [%d,%f,%f]", |
187 | nBin, min, max); | |
bcd522ff | 188 | if (max < min) { |
600b313f | 189 | Double_t tmp = min; |
190 | min = max; | |
191 | max = tmp; | |
192 | } | |
193 | if (min < -10) | |
194 | AliWarning(Form("Minimum vertex %f < -10, make sure you want this",min)); | |
195 | if (max > +10) | |
196 | AliWarning(Form("Minimum vertex %f > +10, make sure you want this",max)); | |
197 | fVtxAxis.Set(nBin, min, max); | |
198 | } | |
199 | //____________________________________________________________________ | |
200 | void | |
201 | AliCentralMCCorrectionsTask::SetVertexAxis(const TAxis& axis) | |
202 | { | |
203 | // | |
204 | // Set the vertex axis to use | |
205 | // | |
206 | // Parameters: | |
207 | // axis Axis | |
208 | // | |
209 | SetVertexAxis(axis.GetNbins(),axis.GetXmin(),axis.GetXmax()); | |
210 | } | |
211 | ||
212 | //____________________________________________________________________ | |
213 | void | |
214 | AliCentralMCCorrectionsTask::SetEtaAxis(Int_t nBin, Double_t min, Double_t max) | |
215 | { | |
216 | // | |
217 | // Set the eta axis to use | |
218 | // | |
219 | // Parameters: | |
220 | // nBins Number of bins | |
221 | // vzMin Least @f$\eta@f$ | |
222 | // vzMax Largest @f$\eta@f$ | |
223 | // | |
f53fb4f6 | 224 | DGUARD(fDebug,3,"Set eta axis AliCentralMCCorrectionsTask [%d,%f,%f]", |
225 | nBin, min, max); | |
bcd522ff | 226 | if (max < min) { |
600b313f | 227 | Double_t tmp = min; |
228 | min = max; | |
229 | max = tmp; | |
230 | } | |
231 | if (min < -4) | |
232 | AliWarning(Form("Minimum eta %f < -4, make sure you want this",min)); | |
233 | if (max > +6) | |
234 | AliWarning(Form("Minimum eta %f > +6, make sure you want this",max)); | |
bcd522ff | 235 | fEtaAxis.Set(nBin, min, max); |
600b313f | 236 | } |
237 | //____________________________________________________________________ | |
238 | void | |
239 | AliCentralMCCorrectionsTask::SetEtaAxis(const TAxis& axis) | |
240 | { | |
241 | // | |
242 | // Set the eta axis to use | |
243 | // | |
244 | // Parameters: | |
245 | // axis Axis | |
246 | // | |
247 | SetEtaAxis(axis.GetNbins(),axis.GetXmin(),axis.GetXmax()); | |
248 | } | |
249 | ||
250 | //____________________________________________________________________ | |
251 | void | |
252 | AliCentralMCCorrectionsTask::DefineBins(TList* l) | |
253 | { | |
f53fb4f6 | 254 | DGUARD(fDebug,1,"Define bins in AliCentralMCCorrectionsTask"); |
600b313f | 255 | if (!fVtxBins) fVtxBins = new TObjArray(fVtxAxis.GetNbins(), 1); |
256 | if (fVtxBins->GetEntries() > 0) return; | |
257 | ||
258 | fVtxBins->SetOwner(); | |
259 | for (Int_t i = 1; i <= fVtxAxis.GetNbins(); i++) { | |
260 | Double_t low = fVtxAxis.GetBinLowEdge(i); | |
261 | Double_t high = fVtxAxis.GetBinUpEdge(i); | |
262 | VtxBin* bin = new VtxBin(low, high, fEtaAxis, fNPhiBins); | |
263 | fVtxBins->AddAt(bin, i); | |
264 | bin->DefineOutput(l); | |
265 | } | |
266 | } | |
267 | ||
268 | //____________________________________________________________________ | |
269 | void | |
270 | AliCentralMCCorrectionsTask::UserCreateOutputObjects() | |
271 | { | |
272 | // | |
273 | // Create output objects | |
274 | // | |
275 | // | |
f53fb4f6 | 276 | DGUARD(fDebug,1,"Create user output for AliCentralMCCorrectionsTask"); |
600b313f | 277 | fList = new TList; |
278 | fList->SetOwner(); | |
279 | fList->SetName(Form("%sSums", GetName())); | |
280 | ||
281 | DefineBins(fList); | |
282 | ||
283 | fHEvents = new TH1I(GetEventName(false,false), | |
284 | "Number of all events", | |
285 | fVtxAxis.GetNbins(), | |
286 | fVtxAxis.GetXmin(), | |
287 | fVtxAxis.GetXmax()); | |
288 | fHEvents->SetXTitle("v_{z} [cm]"); | |
289 | fHEvents->SetYTitle("# of events"); | |
290 | fHEvents->SetFillColor(kBlue+1); | |
291 | fHEvents->SetFillStyle(3001); | |
292 | fHEvents->SetDirectory(0); | |
293 | fList->Add(fHEvents); | |
294 | ||
295 | fHEventsTr = new TH1I(GetEventName(true, false), | |
296 | "Number of triggered events", | |
297 | fVtxAxis.GetNbins(), | |
298 | fVtxAxis.GetXmin(), | |
299 | fVtxAxis.GetXmax()); | |
300 | fHEventsTr->SetXTitle("v_{z} [cm]"); | |
301 | fHEventsTr->SetYTitle("# of events"); | |
302 | fHEventsTr->SetFillColor(kRed+1); | |
303 | fHEventsTr->SetFillStyle(3001); | |
304 | fHEventsTr->SetDirectory(0); | |
305 | fList->Add(fHEventsTr); | |
306 | ||
307 | fHEventsTrVtx = new TH1I(GetEventName(true,true), | |
308 | "Number of events w/trigger and vertex", | |
309 | fVtxAxis.GetNbins(), | |
310 | fVtxAxis.GetXmin(), | |
311 | fVtxAxis.GetXmax()); | |
312 | fHEventsTrVtx->SetXTitle("v_{z} [cm]"); | |
313 | fHEventsTrVtx->SetYTitle("# of events"); | |
314 | fHEventsTrVtx->SetFillColor(kBlue+1); | |
315 | fHEventsTrVtx->SetFillStyle(3001); | |
316 | fHEventsTrVtx->SetDirectory(0); | |
317 | fList->Add(fHEventsTrVtx); | |
318 | ||
319 | // Copy axis objects to output | |
320 | TH1* vtxAxis = new TH1D("vtxAxis", "Vertex axis", | |
321 | fVtxAxis.GetNbins(), | |
322 | fVtxAxis.GetXmin(), | |
323 | fVtxAxis.GetXmax()); | |
324 | TH1* etaAxis = new TH1D("etaAxis", "Eta axis", | |
325 | fEtaAxis.GetNbins(), | |
326 | fEtaAxis.GetXmin(), | |
327 | fEtaAxis.GetXmax()); | |
328 | fList->Add(vtxAxis); | |
329 | fList->Add(etaAxis); | |
330 | ||
331 | AliInfo(Form("Initialising sub-routines: %p, %p", | |
332 | &fInspector, &fTrackDensity)); | |
333 | fInspector.DefineOutput(fList); | |
334 | fInspector.Init(fVtxAxis); | |
335 | fTrackDensity.DefineOutput(fList); | |
336 | ||
337 | PostData(1, fList); | |
338 | } | |
339 | //____________________________________________________________________ | |
340 | void | |
341 | AliCentralMCCorrectionsTask::UserExec(Option_t*) | |
342 | { | |
343 | // | |
344 | // Process each event | |
345 | // | |
346 | // Parameters: | |
347 | // option Not used | |
348 | // | |
349 | ||
f53fb4f6 | 350 | DGUARD(fDebug,1,"AliCentralMCCorrectionsTask process an event"); |
600b313f | 351 | // Get the input data - MC event |
352 | AliMCEvent* mcEvent = MCEvent(); | |
353 | if (!mcEvent) { | |
354 | AliWarning("No MC event found"); | |
355 | return; | |
356 | } | |
357 | ||
358 | // Get the input data - ESD event | |
359 | AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent()); | |
360 | if (!esd) { | |
361 | AliWarning("No ESD event found for input event"); | |
362 | return; | |
363 | } | |
364 | ||
365 | //--- Read run information ----------------------------------------- | |
366 | if (fFirstEvent && esd->GetESDRun()) { | |
367 | fInspector.ReadRunDetails(esd); | |
368 | ||
369 | AliInfo(Form("Initializing with parameters from the ESD:\n" | |
370 | " AliESDEvent::GetBeamEnergy() ->%f\n" | |
371 | " AliESDEvent::GetBeamType() ->%s\n" | |
372 | " AliESDEvent::GetCurrentL3() ->%f\n" | |
373 | " AliESDEvent::GetMagneticField()->%f\n" | |
374 | " AliESDEvent::GetRunNumber() ->%d\n", | |
375 | esd->GetBeamEnergy(), | |
376 | esd->GetBeamType(), | |
377 | esd->GetCurrentL3(), | |
378 | esd->GetMagneticField(), | |
379 | esd->GetRunNumber())); | |
380 | ||
381 | Print(); | |
382 | fFirstEvent = false; | |
383 | } | |
384 | ||
385 | // Some variables | |
386 | UInt_t triggers; // Trigger bits | |
387 | Bool_t lowFlux; // Low flux flag | |
388 | UShort_t iVz; // Vertex bin from ESD | |
389 | Double_t vZ; // Z coordinate from ESD | |
390 | Double_t cent; // Centrality | |
391 | UShort_t iVzMc; // Vertex bin from MC | |
392 | Double_t vZMc; // Z coordinate of IP vertex from MC | |
393 | Double_t b; // Impact parameter | |
394 | Int_t nPart; // Number of participants | |
395 | Int_t nBin; // Number of binary collisions | |
396 | Double_t phiR; // Reaction plane from MC | |
397 | UShort_t nClusters;// Number of SPD clusters | |
398 | // Process the data | |
399 | UInt_t retESD = fInspector.Process(esd, triggers, lowFlux, iVz, vZ, | |
400 | cent, nClusters); | |
401 | fInspector.ProcessMC(mcEvent, triggers, iVzMc, vZMc, | |
402 | b, nPart, nBin, phiR); | |
403 | ||
404 | Bool_t isInel = triggers & AliAODForwardMult::kInel; | |
405 | Bool_t hasVtx = retESD == AliFMDMCEventInspector::kOk; | |
406 | ||
407 | // Fill the event count histograms | |
408 | if (isInel) fHEventsTr->Fill(vZMc); | |
409 | if (isInel && hasVtx) fHEventsTrVtx->Fill(vZMc); | |
410 | fHEvents->Fill(vZMc); | |
411 | ||
412 | // Now find our vertex bin object | |
413 | VtxBin* bin = 0; | |
414 | if (iVzMc > 0 && iVzMc <= fVtxAxis.GetNbins()) | |
415 | bin = static_cast<VtxBin*>(fVtxBins->At(iVzMc)); | |
416 | if (!bin) { | |
417 | // AliError(Form("No vertex bin object @ %d (%f)", iVzMc, vZMc)); | |
418 | return; | |
419 | } | |
420 | ||
421 | // Now process our input data and store in own ESD object | |
422 | fTrackDensity.Calculate(*mcEvent, vZMc, *bin->fHits, bin->fPrimary); | |
423 | bin->fCounts->Fill(0.5); | |
bcd522ff | 424 | |
425 | PostData(1, fList); | |
600b313f | 426 | } |
427 | ||
428 | //____________________________________________________________________ | |
429 | void | |
430 | AliCentralMCCorrectionsTask::Terminate(Option_t*) | |
431 | { | |
432 | // | |
433 | // End of job | |
434 | // | |
435 | // Parameters: | |
436 | // option Not used | |
437 | // | |
f53fb4f6 | 438 | DGUARD(fDebug,1,"AliCentralMCCorrectionsTask analyse merged output"); |
600b313f | 439 | |
440 | fList = dynamic_cast<TList*>(GetOutputData(1)); | |
441 | if (!fList) { | |
442 | AliError("No output list defined"); | |
443 | return; | |
444 | } | |
445 | ||
bcd522ff | 446 | DefineBins(fList); |
447 | ||
600b313f | 448 | // Output list |
449 | TList* output = new TList; | |
450 | output->SetOwner(); | |
451 | output->SetName(Form("%sResults", GetName())); | |
452 | ||
453 | // --- Fill correction object -------------------------------------- | |
454 | AliCentralCorrSecondaryMap* corr = new AliCentralCorrSecondaryMap; | |
455 | corr->SetVertexAxis(fVtxAxis); | |
456 | // corr->SetEtaAxis(fEtaAxis); | |
457 | ||
458 | TIter next(fVtxBins); | |
459 | VtxBin* bin = 0; | |
460 | UShort_t iVz = 1; | |
461 | while ((bin = static_cast<VtxBin*>(next()))) | |
462 | bin->Finish(fList, output, iVz++, corr); | |
463 | ||
464 | output->Add(corr); | |
465 | ||
466 | PostData(2, output); | |
467 | } | |
468 | ||
469 | //____________________________________________________________________ | |
470 | void | |
471 | AliCentralMCCorrectionsTask::Print(Option_t* option) const | |
472 | { | |
473 | std::cout << ClassName() << "\n" | |
474 | << " Vertex bins: " << fVtxAxis.GetNbins() << '\n' | |
475 | << " Vertex range: [" << fVtxAxis.GetXmin() | |
476 | << "," << fVtxAxis.GetXmax() << "]\n" | |
477 | << " Eta bins: " << fEtaAxis.GetNbins() << '\n' | |
478 | << " Eta range: [" << fEtaAxis.GetXmin() | |
479 | << "," << fEtaAxis.GetXmax() << "]\n" | |
480 | << " # of phi bins: " << fNPhiBins | |
481 | << std::endl; | |
482 | gROOT->IncreaseDirLevel(); | |
483 | fInspector.Print(option); | |
484 | fTrackDensity.Print(option); | |
485 | gROOT->DecreaseDirLevel(); | |
486 | } | |
487 | ||
488 | //==================================================================== | |
489 | const char* | |
490 | AliCentralMCCorrectionsTask::VtxBin::BinName(Double_t low, | |
491 | Double_t high) | |
492 | { | |
493 | static TString buf; | |
494 | buf = Form("vtx%+05.1f_%+05.1f", low, high); | |
495 | buf.ReplaceAll("+", "p"); | |
496 | buf.ReplaceAll("-", "m"); | |
497 | buf.ReplaceAll(".", "d"); | |
498 | return buf.Data(); | |
499 | } | |
500 | ||
501 | ||
502 | //____________________________________________________________________ | |
503 | AliCentralMCCorrectionsTask::VtxBin::VtxBin() | |
504 | : fHits(0), | |
505 | fPrimary(0), | |
506 | fCounts(0) | |
507 | { | |
508 | } | |
509 | //____________________________________________________________________ | |
510 | AliCentralMCCorrectionsTask::VtxBin::VtxBin(Double_t low, | |
511 | Double_t high, | |
512 | const TAxis& axis, | |
513 | UShort_t nPhi) | |
514 | : TNamed(BinName(low, high), | |
515 | Form("%+5.1fcm<v_{z}<%+5.1fcm", low, high)), | |
516 | fHits(0), | |
517 | fPrimary(0), | |
518 | fCounts(0) | |
519 | { | |
520 | fPrimary = new TH2D("primary", "Primaries", | |
521 | axis.GetNbins(), axis.GetXmin(), axis.GetXmax(), | |
522 | nPhi, 0, 2*TMath::Pi()); | |
523 | fPrimary->SetXTitle("#eta"); | |
524 | fPrimary->SetYTitle("#varphi [radians]"); | |
525 | fPrimary->Sumw2(); | |
526 | fPrimary->SetDirectory(0); | |
527 | ||
528 | fHits = static_cast<TH2D*>(fPrimary->Clone("hits")); | |
529 | fHits->SetTitle("Hits"); | |
530 | fHits->SetDirectory(0); | |
531 | ||
532 | fCounts = new TH1D("counts", "Counts", 1, 0, 1); | |
533 | fCounts->SetXTitle("Events"); | |
534 | fCounts->SetYTitle("# of Events"); | |
535 | fCounts->SetDirectory(0); | |
536 | } | |
537 | ||
538 | //____________________________________________________________________ | |
539 | AliCentralMCCorrectionsTask::VtxBin::VtxBin(const VtxBin& o) | |
540 | : TNamed(o), | |
541 | fHits(0), | |
542 | fPrimary(0), | |
543 | fCounts(0) | |
544 | { | |
545 | if (o.fHits) { | |
546 | fHits = static_cast<TH2D*>(o.fHits->Clone()); | |
547 | fHits->SetDirectory(0); | |
548 | } | |
549 | if (o.fPrimary) { | |
550 | fPrimary = static_cast<TH2D*>(o.fPrimary->Clone()); | |
551 | fPrimary->SetDirectory(0); | |
552 | } | |
553 | if (o.fCounts) { | |
554 | fCounts = static_cast<TH1D*>(o.fCounts->Clone()); | |
555 | fCounts->SetDirectory(0); | |
556 | } | |
557 | } | |
558 | ||
559 | //____________________________________________________________________ | |
560 | AliCentralMCCorrectionsTask::VtxBin& | |
561 | AliCentralMCCorrectionsTask::VtxBin::operator=(const VtxBin& o) | |
562 | { | |
d015ecfe | 563 | if (&o == this) return *this; |
600b313f | 564 | TNamed::operator=(o); |
565 | fHits = 0; | |
566 | fPrimary = 0; | |
567 | fCounts = 0; | |
568 | if (o.fHits) { | |
569 | fHits = static_cast<TH2D*>(o.fHits->Clone()); | |
570 | fHits->SetDirectory(0); | |
571 | } | |
572 | if (o.fPrimary) { | |
573 | fPrimary = static_cast<TH2D*>(o.fPrimary->Clone()); | |
574 | fPrimary->SetDirectory(0); | |
575 | } | |
576 | if (o.fCounts) { | |
577 | fCounts = static_cast<TH1D*>(o.fCounts->Clone()); | |
578 | fCounts->SetDirectory(0); | |
579 | } | |
580 | return *this; | |
581 | } | |
582 | ||
583 | //____________________________________________________________________ | |
584 | void | |
585 | AliCentralMCCorrectionsTask::VtxBin::DefineOutput(TList* l) | |
586 | { | |
587 | TList* d = new TList; | |
588 | d->SetName(GetName()); | |
589 | d->SetOwner(); | |
590 | l->Add(d); | |
591 | ||
592 | d->Add(fHits); | |
593 | d->Add(fPrimary); | |
594 | d->Add(fCounts); | |
595 | } | |
596 | //____________________________________________________________________ | |
597 | void | |
598 | AliCentralMCCorrectionsTask::VtxBin::Finish(const TList* input, | |
599 | TList* output, | |
600 | UShort_t iVz, | |
601 | AliCentralCorrSecondaryMap* map) | |
602 | { | |
603 | TList* out = new TList; | |
604 | out->SetName(GetName()); | |
605 | out->SetOwner(); | |
606 | output->Add(out); | |
607 | ||
608 | TList* l = static_cast<TList*>(input->FindObject(GetName())); | |
609 | if (!l) { | |
610 | AliError(Form("List %s not found in %s", GetName(), input->GetName())); | |
611 | return; | |
612 | } | |
613 | ||
614 | ||
615 | TH2D* hits = static_cast<TH2D*>(l->FindObject("hits")); | |
616 | TH2D* prim = static_cast<TH2D*>(l->FindObject("primary")); | |
617 | if (!hits || !prim) { | |
618 | AliError(Form("Missing histograms: %p, %p", hits, prim)); | |
619 | return; | |
620 | } | |
621 | ||
622 | TH2D* h = static_cast<TH2D*>(hits->Clone("bgCorr")); | |
623 | h->SetDirectory(0); | |
984a7263 | 624 | h->Divide(prim); |
600b313f | 625 | |
626 | map->SetCorrection(iVz, h); | |
627 | ||
628 | out->Add(h); | |
629 | } | |
630 | ||
631 | // | |
632 | // EOF | |
633 | // |