]>
Commit | Line | Data |
---|---|---|
ce85db45 | 1 | //==================================================================== |
2 | #include "AliBasedNdetaTask.h" | |
3 | #include <TMath.h> | |
4 | #include <TH2D.h> | |
5 | #include <TH1D.h> | |
6 | #include <THStack.h> | |
7 | #include <TList.h> | |
e58000b7 | 8 | #include <TParameter.h> |
ce85db45 | 9 | #include <AliAnalysisManager.h> |
10 | #include <AliAODEvent.h> | |
11 | #include <AliAODHandler.h> | |
12 | #include <AliAODInputHandler.h> | |
13 | #include "AliForwardUtil.h" | |
14 | #include "AliAODForwardMult.h" | |
3846ec25 | 15 | #include <TFile.h> |
5bb5d1f6 | 16 | #include <TStyle.h> |
ce85db45 | 17 | |
18 | //____________________________________________________________________ | |
19 | AliBasedNdetaTask::AliBasedNdetaTask() | |
20 | : AliAnalysisTaskSE(), | |
ce85db45 | 21 | fSums(0), // Container of sums |
e1f47419 | 22 | fOutput(0), // Container of output |
ce85db45 | 23 | fVtxMin(0), // Minimum v_z |
24 | fVtxMax(0), // Maximum v_z | |
25 | fTriggerMask(0), // Trigger mask | |
26 | fRebin(0), // Rebinning factor | |
27 | fCutEdges(false), | |
28 | fSymmetrice(true), | |
e58000b7 | 29 | fCorrEmpty(true), |
c25b5e1b | 30 | fUseROOTProj(false), |
e58000b7 | 31 | fTriggerEff(1), |
3846ec25 | 32 | fShapeCorr(0), |
e1f47419 | 33 | fListOfCentralities(0), |
e1f47419 | 34 | fSNNString(0), |
35 | fSysString(0), | |
e308a636 | 36 | fCent(0), |
ffca499d | 37 | fCentAxis(0), |
0be6c8cd | 38 | fNormalizationScheme(kFull), |
39 | fSchemeString(0), | |
c89b9ac1 | 40 | fTriggerString(0), |
290052e7 | 41 | fFinalMCCorrFile("") |
fb3430ac | 42 | { |
43 | // | |
44 | // Constructor | |
45 | // | |
f53fb4f6 | 46 | DGUARD(0,0,"Default construction of AliBasedNdetaTask"); |
fb3430ac | 47 | } |
ce85db45 | 48 | |
49 | //____________________________________________________________________ | |
50 | AliBasedNdetaTask::AliBasedNdetaTask(const char* name) | |
51 | : AliAnalysisTaskSE(name), | |
ce85db45 | 52 | fSums(0), // Container of sums |
e1f47419 | 53 | fOutput(0), // Container of output |
ce85db45 | 54 | fVtxMin(-10), // Minimum v_z |
55 | fVtxMax(10), // Maximum v_z | |
56 | fTriggerMask(AliAODForwardMult::kInel), | |
57 | fRebin(5), // Rebinning factor | |
58 | fCutEdges(false), | |
59 | fSymmetrice(true), | |
e58000b7 | 60 | fCorrEmpty(true), |
c25b5e1b | 61 | fUseROOTProj(false), |
e58000b7 | 62 | fTriggerEff(1), |
3846ec25 | 63 | fShapeCorr(0), |
e1f47419 | 64 | fListOfCentralities(0), |
e1f47419 | 65 | fSNNString(0), |
66 | fSysString(0), | |
e308a636 | 67 | fCent(0), |
ffca499d | 68 | fCentAxis(0), |
0be6c8cd | 69 | fNormalizationScheme(kFull), |
70 | fSchemeString(0), | |
c89b9ac1 | 71 | fTriggerString(0), |
290052e7 | 72 | fFinalMCCorrFile("") |
ce85db45 | 73 | { |
fb3430ac | 74 | // |
75 | // Constructor | |
76 | // | |
f53fb4f6 | 77 | DGUARD(0,0,"Named construction of AliBasedNdetaTask: %s", name); |
e308a636 | 78 | fListOfCentralities = new TObjArray(1); |
0be6c8cd | 79 | |
80 | // Set the normalisation scheme | |
81 | SetNormalizationScheme(kFull); | |
82 | ||
83 | // Set the trigger mask | |
84 | SetTriggerMask(AliAODForwardMult::kInel); | |
fb3430ac | 85 | |
ce85db45 | 86 | // Output slot #1 writes into a TH1 container |
87 | DefineOutput(1, TList::Class()); | |
88 | DefineOutput(2, TList::Class()); | |
89 | } | |
90 | ||
91 | //____________________________________________________________________ | |
92 | AliBasedNdetaTask::AliBasedNdetaTask(const AliBasedNdetaTask& o) | |
93 | : AliAnalysisTaskSE(o), | |
ce85db45 | 94 | fSums(o.fSums), // TList* - Container of sums |
e1f47419 | 95 | fOutput(o.fOutput), // Container of output |
ce85db45 | 96 | fVtxMin(o.fVtxMin), // Double_t - Minimum v_z |
97 | fVtxMax(o.fVtxMax), // Double_t - Maximum v_z | |
98 | fTriggerMask(o.fTriggerMask),// Int_t - Trigger mask | |
99 | fRebin(o.fRebin), // Int_t - Rebinning factor | |
100 | fCutEdges(o.fCutEdges), // Bool_t - Whether to cut edges when rebinning | |
c25b5e1b | 101 | fSymmetrice(o.fSymmetrice), |
102 | fCorrEmpty(o.fCorrEmpty), | |
103 | fUseROOTProj(o.fUseROOTProj), | |
e58000b7 | 104 | fTriggerEff(o.fTriggerEff), |
3846ec25 | 105 | fShapeCorr(o.fShapeCorr), |
e1f47419 | 106 | fListOfCentralities(o.fListOfCentralities), |
e1f47419 | 107 | fSNNString(o.fSNNString), |
108 | fSysString(o.fSysString), | |
e308a636 | 109 | fCent(o.fCent), |
ffca499d | 110 | fCentAxis(o.fCentAxis), |
0be6c8cd | 111 | fNormalizationScheme(o.fNormalizationScheme), |
112 | fSchemeString(o.fSchemeString), | |
c89b9ac1 | 113 | fTriggerString(o.fTriggerString), |
290052e7 | 114 | fFinalMCCorrFile(o.fFinalMCCorrFile) |
f53fb4f6 | 115 | { |
116 | DGUARD(0,0,"Copy construction of AliBasedNdetaTask"); | |
117 | } | |
ce85db45 | 118 | |
119 | //____________________________________________________________________ | |
120 | AliBasedNdetaTask::~AliBasedNdetaTask() | |
121 | { | |
fb3430ac | 122 | // |
123 | // Destructor | |
124 | // | |
f53fb4f6 | 125 | DGUARD(fDebug,3,"Destruction of AliBasedNdetaTask"); |
ce85db45 | 126 | if (fSums) { |
127 | fSums->Delete(); | |
128 | delete fSums; | |
129 | fSums = 0; | |
130 | } | |
e1f47419 | 131 | if (fOutput) { |
132 | fOutput->Delete(); | |
133 | delete fOutput; | |
134 | fOutput = 0; | |
ce85db45 | 135 | } |
136 | } | |
137 | ||
f53fb4f6 | 138 | //________________________________________________________________________ |
139 | void | |
140 | AliBasedNdetaTask::SetDebugLevel(Int_t lvl) | |
141 | { | |
142 | AliAnalysisTaskSE::SetDebugLevel(lvl); | |
143 | for (Int_t i = 0; i < fListOfCentralities->GetEntries(); i++) { | |
144 | CentralityBin* bin = | |
145 | static_cast<CentralityBin*>(fListOfCentralities->At(i)); | |
146 | bin->SetDebugLevel(lvl); | |
147 | } | |
148 | } | |
149 | ||
e1f47419 | 150 | //________________________________________________________________________ |
151 | void | |
e308a636 | 152 | AliBasedNdetaTask::SetCentralityAxis(UShort_t n, Short_t* bins) |
153 | { | |
f53fb4f6 | 154 | DGUARD(fDebug,3,"Set centrality axis, %d bins", n); |
e308a636 | 155 | if (!fCentAxis) { |
156 | fCentAxis = new TAxis(); | |
157 | fCentAxis->SetName("centAxis"); | |
158 | fCentAxis->SetTitle("Centrality [%]"); | |
159 | } | |
160 | TArrayD dbins(n+1); | |
161 | for (UShort_t i = 0; i <= n; i++) | |
162 | dbins[i] = (bins[i] == 100 ? 100.1 : bins[i]); | |
163 | fCentAxis->Set(n, dbins.GetArray()); | |
164 | } | |
165 | ||
166 | //________________________________________________________________________ | |
167 | void | |
168 | AliBasedNdetaTask::AddCentralityBin(UShort_t at, Short_t low, Short_t high) | |
e1f47419 | 169 | { |
170 | // | |
171 | // Add a centrality bin | |
172 | // | |
173 | // Parameters: | |
174 | // low Low cut | |
175 | // high High cut | |
176 | // | |
f53fb4f6 | 177 | DGUARD(fDebug,3,"Add a centrality bin [%f,%f] @ %d", low, high, at); |
e308a636 | 178 | CentralityBin* bin = MakeCentralityBin(GetName(), low, high); |
f53fb4f6 | 179 | bin->SetDebugLevel(fDebug); |
e308a636 | 180 | fListOfCentralities->AddAtAndExpand(bin, at); |
e1f47419 | 181 | } |
182 | ||
183 | //________________________________________________________________________ | |
184 | AliBasedNdetaTask::CentralityBin* | |
185 | AliBasedNdetaTask::MakeCentralityBin(const char* name, | |
186 | Short_t low, Short_t high) const | |
187 | { | |
188 | // | |
189 | // Make a centrality bin | |
190 | // | |
191 | // Parameters: | |
192 | // name Name used for histograms | |
193 | // low Low cut in percent | |
194 | // high High cut in percent | |
195 | // | |
196 | // Return: | |
197 | // A newly created centrality bin | |
198 | // | |
f53fb4f6 | 199 | DGUARD(fDebug,3,"Make a centrality bin [%f,%f]: %s", low, high, name); |
e1f47419 | 200 | return new CentralityBin(name, low, high); |
201 | } | |
a76fb27d | 202 | |
203 | #define TESTAPPEND(SCHEME,BIT,STRING) \ | |
204 | do { if (!(SCHEME & BIT)) break; \ | |
205 | if (!s.IsNull()) s.Append(","); s.Append(STRING); } while(false) | |
206 | ||
ffca499d | 207 | //________________________________________________________________________ |
a76fb27d | 208 | const Char_t* |
209 | AliBasedNdetaTask::NormalizationSchemeString(UShort_t scheme) | |
210 | { | |
211 | // Create a string from normalization scheme bits | |
212 | static TString s; | |
213 | s = ""; | |
214 | ||
215 | if (scheme == kNone) | |
216 | return s.Data(); | |
217 | if (scheme == kFull) { | |
218 | s = "FULL"; | |
219 | return s.Data(); | |
220 | } | |
221 | TESTAPPEND(scheme, kEventLevel, "EVENT"); | |
222 | TESTAPPEND(scheme, kShape, "SHAPE"); | |
223 | TESTAPPEND(scheme, kBackground, "BACKGROUND"); | |
224 | TESTAPPEND(scheme, kTriggerEfficiency, "TRIGGER"); | |
225 | TESTAPPEND(scheme, kZeroBin, "ZEROBIN"); | |
226 | ||
227 | return s.Data(); | |
228 | } | |
229 | //________________________________________________________________________ | |
230 | UShort_t | |
231 | AliBasedNdetaTask::ParseNormalizationScheme(const char* what) | |
ffca499d | 232 | { |
ffca499d | 233 | UShort_t scheme = 0; |
234 | TString twhat(what); | |
235 | twhat.ToUpper(); | |
236 | TObjString* opt; | |
237 | TIter next(twhat.Tokenize(" ,|")); | |
238 | while ((opt = static_cast<TObjString*>(next()))) { | |
239 | TString s(opt->GetString()); | |
240 | if (s.IsNull()) continue; | |
0be6c8cd | 241 | Bool_t add = true; |
242 | switch (s[0]) { | |
243 | case '-': add = false; // Fall through | |
244 | case '+': s.Remove(0,1); // Remove character | |
245 | } | |
246 | UShort_t bit = 0; | |
247 | if (s.CompareTo("EVENT") == 0) bit = kEventLevel; | |
248 | else if (s.CompareTo("SHAPE") == 0) bit = kShape; | |
249 | else if (s.CompareTo("BACKGROUND")== 0) bit = kBackground; | |
250 | else if (s.CompareTo("TRIGGER") == 0) bit = kTriggerEfficiency; | |
251 | else if (s.CompareTo("FULL") == 0) bit = kFull; | |
252 | else if (s.CompareTo("NONE") == 0) bit = kNone; | |
4fa8d795 | 253 | else if (s.CompareTo("ZEROBIN") == 0) bit = kZeroBin; |
ffca499d | 254 | else |
a76fb27d | 255 | ::Warning("SetNormalizationScheme", "Unknown option %s", s.Data()); |
0be6c8cd | 256 | if (add) scheme |= bit; |
257 | else scheme ^= bit; | |
ffca499d | 258 | } |
a76fb27d | 259 | return scheme; |
260 | } | |
261 | //________________________________________________________________________ | |
262 | void | |
263 | AliBasedNdetaTask::SetNormalizationScheme(const char* what) | |
264 | { | |
265 | // | |
266 | // Set normalisation scheme | |
267 | // | |
268 | DGUARD(fDebug,3,"Set the normalization scheme: %s", what); | |
269 | SetNormalizationScheme(ParseNormalizationScheme(what)); | |
ffca499d | 270 | } |
0be6c8cd | 271 | //________________________________________________________________________ |
272 | void | |
273 | AliBasedNdetaTask::SetNormalizationScheme(UShort_t scheme) | |
274 | { | |
f53fb4f6 | 275 | DGUARD(fDebug,3,"Set the normalization scheme: 0x%x", scheme); |
0be6c8cd | 276 | fNormalizationScheme = scheme; |
a76fb27d | 277 | #if 0 |
278 | const Char_t* tit = NormalizationSchemeString(scheme); | |
0be6c8cd | 279 | if (!fSchemeString) fSchemeString = new TNamed("scheme", ""); |
280 | fSchemeString->SetTitle(tit); | |
281 | fSchemeString->SetUniqueID(fNormalizationScheme); | |
a76fb27d | 282 | #else |
283 | if (!fSchemeString) | |
284 | fSchemeString = new TParameter<int>("scheme", scheme); | |
285 | fSchemeString->SetUniqueID(fNormalizationScheme); | |
286 | #endif | |
0be6c8cd | 287 | } |
ce85db45 | 288 | //________________________________________________________________________ |
289 | void | |
290 | AliBasedNdetaTask::SetTriggerMask(const char* mask) | |
291 | { | |
fb3430ac | 292 | // |
293 | // Set the trigger maskl | |
294 | // | |
295 | // Parameters: | |
296 | // mask Trigger mask | |
297 | // | |
f53fb4f6 | 298 | DGUARD(fDebug,3,"Set the trigger mask: %s", mask); |
9453b19e | 299 | SetTriggerMask(AliAODForwardMult::MakeTriggerMask(mask)); |
ce85db45 | 300 | } |
0be6c8cd | 301 | //________________________________________________________________________ |
302 | void | |
303 | AliBasedNdetaTask::SetTriggerMask(UShort_t mask) | |
304 | { | |
f53fb4f6 | 305 | DGUARD(fDebug,3,"Set the trigger mask: 0x%0x", mask); |
0be6c8cd | 306 | fTriggerMask = mask; |
a76fb27d | 307 | #if 0 |
0be6c8cd | 308 | TString tit(AliAODForwardMult::GetTriggerString(mask)); |
309 | tit = tit.Strip(TString::kBoth); | |
310 | if (!fTriggerString) fTriggerString = new TNamed("trigger", ""); | |
311 | fTriggerString->SetTitle(tit); | |
312 | fTriggerString->SetUniqueID(fTriggerMask); | |
a76fb27d | 313 | #else |
314 | if (!fTriggerString) | |
315 | fTriggerString = new TParameter<int>("trigger", fTriggerMask); | |
316 | fTriggerString->SetUniqueID(fTriggerMask); | |
317 | #endif | |
0be6c8cd | 318 | } |
ce85db45 | 319 | |
e58000b7 | 320 | //________________________________________________________________________ |
321 | void | |
f67d699c | 322 | AliBasedNdetaTask::SetShapeCorrection(const TH2F* c) |
e58000b7 | 323 | { |
fb3430ac | 324 | // |
325 | // Set the shape correction (a.k.a., track correction) for selected | |
326 | // trigger(s) | |
327 | // | |
328 | // Parameters: | |
329 | // h Correction | |
330 | // | |
f53fb4f6 | 331 | DGUARD(fDebug,3,"Set the shape correction: %p", c); |
e58000b7 | 332 | if (!c) return; |
f67d699c | 333 | fShapeCorr = static_cast<TH2F*>(c->Clone()); |
e58000b7 | 334 | fShapeCorr->SetDirectory(0); |
335 | } | |
336 | ||
f67d699c | 337 | //________________________________________________________________________ |
338 | void | |
339 | AliBasedNdetaTask::InitializeCentBins() | |
340 | { | |
341 | if (fListOfCentralities->GetEntries() > 0) return; | |
342 | ||
343 | // Automatically add 'all' centrality bin if nothing has been defined. | |
344 | AddCentralityBin(0, 0, 0); | |
345 | if (fCentAxis && fCentAxis->GetNbins() > 0 && fCentAxis->GetXbins()) { | |
346 | const TArrayD* bins = fCentAxis->GetXbins(); | |
347 | Int_t nbin = fCentAxis->GetNbins(); | |
348 | for (Int_t i = 0; i < nbin; i++) | |
349 | AddCentralityBin(i+1, Short_t((*bins)[i]), Short_t((*bins)[i+1])); | |
350 | } | |
351 | } | |
352 | ||
ce85db45 | 353 | //________________________________________________________________________ |
354 | void | |
355 | AliBasedNdetaTask::UserCreateOutputObjects() | |
356 | { | |
fb3430ac | 357 | // |
358 | // Create output objects. | |
359 | // | |
360 | // This is called once per slave process | |
361 | // | |
f53fb4f6 | 362 | DGUARD(fDebug,1,"Create user ouput object"); |
ce85db45 | 363 | fSums = new TList; |
364 | fSums->SetName(Form("%s_sums", GetName())); | |
365 | fSums->SetOwner(); | |
366 | ||
f67d699c | 367 | InitializeCentBins(); |
9ecab72f | 368 | if (fCentAxis) fSums->Add(fCentAxis); |
e308a636 | 369 | |
ce85db45 | 370 | |
e1f47419 | 371 | // Centrality histogram |
372 | fCent = new TH1D("cent", "Centrality", 100, 0, 100); | |
373 | fCent->SetDirectory(0); | |
374 | fCent->SetXTitle(0); | |
375 | fSums->Add(fCent); | |
376 | ||
377 | // Loop over centrality bins | |
378 | TIter next(fListOfCentralities); | |
379 | CentralityBin* bin = 0; | |
380 | while ((bin = static_cast<CentralityBin*>(next()))) | |
381 | bin->CreateOutputObjects(fSums); | |
f67d699c | 382 | |
f67d699c | 383 | |
290052e7 | 384 | // Post data for ALL output slots >0 here, to get at least an empty |
385 | // histogram | |
ce85db45 | 386 | PostData(1, fSums); |
387 | } | |
4bcdcbc1 | 388 | |
ce85db45 | 389 | //____________________________________________________________________ |
390 | void | |
391 | AliBasedNdetaTask::UserExec(Option_t *) | |
392 | { | |
fb3430ac | 393 | // |
394 | // Process a single event | |
395 | // | |
396 | // Parameters: | |
397 | // option Not used | |
398 | // | |
ce85db45 | 399 | // Main loop |
f53fb4f6 | 400 | DGUARD(fDebug,1,"Analyse the AOD event"); |
290052e7 | 401 | AliAODEvent* aod = AliForwardUtil::GetAODEvent(this); |
4bcdcbc1 | 402 | if (!aod) return; |
403 | ||
e58000b7 | 404 | |
e1f47419 | 405 | TObject* obj = aod->FindListObject("Forward"); |
406 | if (!obj) { | |
407 | AliWarning("No forward object found"); | |
408 | return; | |
678a4979 | 409 | } |
e1f47419 | 410 | AliAODForwardMult* forward = static_cast<AliAODForwardMult*>(obj); |
e308a636 | 411 | |
e1f47419 | 412 | // Fill centrality histogram |
e308a636 | 413 | Float_t cent = forward->GetCentrality(); |
414 | fCent->Fill(cent); | |
e1f47419 | 415 | |
ce85db45 | 416 | // Get the histogram(s) |
e58000b7 | 417 | TH2D* data = GetHistogram(aod, false); |
ce85db45 | 418 | TH2D* dataMC = GetHistogram(aod, true); |
419 | ||
4fa8d795 | 420 | Bool_t isZero = ((fNormalizationScheme & kZeroBin) && |
421 | !forward->IsTriggerBits(AliAODForwardMult::kNClusterGt0)); | |
422 | ||
423 | ||
e1f47419 | 424 | // Loop over centrality bins |
ffca499d | 425 | CentralityBin* allBin = |
426 | static_cast<CentralityBin*>(fListOfCentralities->At(0)); | |
4fa8d795 | 427 | allBin->ProcessEvent(forward, fTriggerMask, isZero, |
428 | fVtxMin, fVtxMax, data, dataMC); | |
e308a636 | 429 | |
430 | // Find this centrality bin | |
431 | if (fCentAxis && fCentAxis->GetNbins() > 0) { | |
432 | Int_t icent = fCentAxis->FindBin(cent); | |
433 | CentralityBin* thisBin = 0; | |
434 | if (icent >= 1 && icent <= fCentAxis->GetNbins()) | |
435 | thisBin = static_cast<CentralityBin*>(fListOfCentralities->At(icent)); | |
436 | if (thisBin) | |
4fa8d795 | 437 | thisBin->ProcessEvent(forward, fTriggerMask, isZero, fVtxMin, fVtxMax, |
ffca499d | 438 | data, dataMC); |
e308a636 | 439 | } |
ce85db45 | 440 | |
e1f47419 | 441 | // Here, we get the update |
a76fb27d | 442 | #if 0 |
e1f47419 | 443 | if (!fSNNString) { |
444 | UShort_t sNN = forward->GetSNN(); | |
445 | fSNNString = new TNamed("sNN", ""); | |
446 | fSNNString->SetTitle(AliForwardUtil::CenterOfMassEnergyString(sNN)); | |
447 | fSNNString->SetUniqueID(sNN); | |
448 | fSums->Add(fSNNString); | |
e58000b7 | 449 | |
e1f47419 | 450 | UShort_t sys = forward->GetSystem(); |
451 | fSysString = new TNamed("sys", ""); | |
452 | fSysString->SetTitle(AliForwardUtil::CollisionSystemString(sys)); | |
453 | fSysString->SetUniqueID(sys); | |
454 | fSums->Add(fSysString); | |
0be6c8cd | 455 | |
456 | fSums->Add(fSchemeString); | |
457 | fSums->Add(fTriggerString); | |
458 | ||
459 | // Print(); | |
3846ec25 | 460 | } |
a76fb27d | 461 | #else |
462 | if (!fSNNString) { | |
463 | UShort_t sNN = forward->GetSNN(); | |
464 | fSNNString = new TParameter<int>("sNN", sNN); | |
465 | fSNNString->SetUniqueID(sNN); | |
466 | fSums->Add(fSNNString); | |
e58000b7 | 467 | |
a76fb27d | 468 | UShort_t sys = forward->GetSystem(); |
469 | fSysString = new TParameter<int>("sys", sys); | |
470 | fSysString->SetUniqueID(sys); | |
471 | fSums->Add(fSysString); | |
472 | ||
473 | fSums->Add(fSchemeString); | |
474 | fSums->Add(fTriggerString); | |
475 | ||
476 | // Print(); | |
477 | } | |
478 | ||
479 | #endif | |
ce85db45 | 480 | PostData(1, fSums); |
481 | } | |
482 | ||
483 | //________________________________________________________________________ | |
484 | void | |
485 | AliBasedNdetaTask::SetHistogramAttributes(TH1D* h, Int_t colour, Int_t marker, | |
486 | const char* title, const char* ytitle) | |
487 | { | |
fb3430ac | 488 | // |
489 | // Set histogram graphical options, etc. | |
490 | // | |
491 | // Parameters: | |
492 | // h Histogram to modify | |
493 | // colour Marker color | |
494 | // marker Marker style | |
495 | // title Title of histogram | |
496 | // ytitle Title on y-axis. | |
497 | // | |
ce85db45 | 498 | h->SetTitle(title); |
499 | h->SetMarkerColor(colour); | |
500 | h->SetMarkerStyle(marker); | |
9ecab72f | 501 | h->SetMarkerSize(marker == 29 || marker == 30 ? 1.2 : 1); |
ce85db45 | 502 | h->SetFillStyle(0); |
503 | h->SetYTitle(ytitle); | |
504 | h->GetXaxis()->SetTitleFont(132); | |
505 | h->GetXaxis()->SetLabelFont(132); | |
506 | h->GetXaxis()->SetNdivisions(10); | |
507 | h->GetYaxis()->SetTitleFont(132); | |
508 | h->GetYaxis()->SetLabelFont(132); | |
509 | h->GetYaxis()->SetNdivisions(10); | |
510 | h->GetYaxis()->SetDecimals(); | |
511 | h->SetStats(0); | |
512 | } | |
513 | ||
4fa8d795 | 514 | //________________________________________________________________________ |
515 | void | |
516 | AliBasedNdetaTask::ScaleToCoverage(TH2D* copy, const TH1D* norm) | |
517 | { | |
518 | // Normalize to the acceptance - | |
519 | // dndeta->Divide(accNorm); | |
520 | for (Int_t i = 1; i <= copy->GetNbinsX(); i++) { | |
521 | Double_t a = norm->GetBinContent(i); | |
522 | for (Int_t j = 1; j <= copy->GetNbinsY(); j++) { | |
523 | if (a <= 0) { | |
524 | copy->SetBinContent(i,j,0); | |
525 | copy->SetBinError(i,j,0); | |
526 | continue; | |
527 | } | |
528 | Double_t c = copy->GetBinContent(i, j); | |
529 | Double_t e = copy->GetBinError(i, j); | |
530 | copy->SetBinContent(i, j, c / a); | |
531 | copy->SetBinError(i, j, e / a); | |
532 | } | |
533 | } | |
534 | } | |
535 | ||
ce85db45 | 536 | //________________________________________________________________________ |
537 | TH1D* | |
538 | AliBasedNdetaTask::ProjectX(const TH2D* h, | |
539 | const char* name, | |
540 | Int_t firstbin, | |
541 | Int_t lastbin, | |
c25b5e1b | 542 | bool useRoot, |
ce85db45 | 543 | bool corr, |
e1f47419 | 544 | bool error) |
ce85db45 | 545 | { |
fb3430ac | 546 | // |
547 | // Project onto the X axis | |
548 | // | |
549 | // Parameters: | |
550 | // h 2D histogram | |
551 | // name New name | |
552 | // firstbin First bin to use | |
553 | // lastbin Last bin to use | |
554 | // error Whether to calculate errors | |
555 | // | |
556 | // Return: | |
557 | // Newly created histogram or null | |
558 | // | |
ce85db45 | 559 | if (!h) return 0; |
c25b5e1b | 560 | if (useRoot) |
561 | return h->ProjectionX(name, firstbin, lastbin, (error ? "e" : "")); | |
ce85db45 | 562 | |
563 | TAxis* xaxis = h->GetXaxis(); | |
564 | TAxis* yaxis = h->GetYaxis(); | |
565 | TH1D* ret = new TH1D(name, h->GetTitle(), xaxis->GetNbins(), | |
566 | xaxis->GetXmin(), xaxis->GetXmax()); | |
567 | static_cast<const TAttLine*>(h)->Copy(*ret); | |
568 | static_cast<const TAttFill*>(h)->Copy(*ret); | |
569 | static_cast<const TAttMarker*>(h)->Copy(*ret); | |
570 | ret->GetXaxis()->ImportAttributes(xaxis); | |
571 | ||
572 | Int_t first = firstbin; | |
573 | Int_t last = lastbin; | |
574 | if (first < 0) first = 0; | |
575 | else if (first >= yaxis->GetNbins()+1) first = yaxis->GetNbins(); | |
576 | if (last < 0) last = yaxis->GetNbins(); | |
577 | else if (last > yaxis->GetNbins()+1) last = yaxis->GetNbins(); | |
578 | if (last-first < 0) { | |
e1f47419 | 579 | AliWarningGeneral("AliBasedNdetaTask", |
580 | Form("Nothing to project [%d,%d]", first, last)); | |
ce85db45 | 581 | return 0; |
582 | ||
583 | } | |
584 | ||
585 | // Loop over X bins | |
586 | // AliInfo(Form("Projecting bins [%d,%d] of %s", first, last, h->GetName())); | |
587 | Int_t ybins = (last-first+1); | |
588 | for (Int_t xbin = 0; xbin <= xaxis->GetNbins()+1; xbin++) { | |
589 | Double_t content = 0; | |
590 | Double_t error2 = 0; | |
591 | Int_t nbins = 0; | |
592 | ||
593 | ||
594 | for (Int_t ybin = first; ybin <= last; ybin++) { | |
595 | Double_t c1 = h->GetCellContent(xbin, ybin); | |
596 | Double_t e1 = h->GetCellError(xbin, ybin); | |
597 | ||
598 | // Ignore empty bins | |
599 | if (c1 < 1e-12) continue; | |
600 | if (e1 < 1e-12) { | |
601 | if (error) continue; | |
602 | e1 = 1; | |
603 | } | |
604 | ||
605 | content += c1; | |
606 | error2 += e1*e1; | |
607 | nbins++; | |
608 | } // for (ybin) | |
609 | if(content > 0 && nbins > 0) { | |
610 | Double_t factor = (corr ? Double_t(ybins) / nbins : 1); | |
c25b5e1b | 611 | #if 0 |
612 | AliWarningGeneral(ret->GetName(), | |
613 | Form("factor @ %d is %d/%d -> %f", | |
614 | xbin, ybins, nbins, factor)); | |
615 | #endif | |
ce85db45 | 616 | if (error) { |
617 | // Calculate weighted average | |
618 | ret->SetBinContent(xbin, content * factor); | |
619 | ret->SetBinError(xbin, factor * TMath::Sqrt(error2)); | |
620 | } | |
621 | else | |
622 | ret->SetBinContent(xbin, factor * content); | |
623 | } | |
624 | } // for (xbin) | |
625 | ||
626 | return ret; | |
627 | } | |
628 | ||
629 | //________________________________________________________________________ | |
630 | void | |
631 | AliBasedNdetaTask::Terminate(Option_t *) | |
632 | { | |
fb3430ac | 633 | // |
634 | // Called at end of event processing.. | |
635 | // | |
636 | // This is called once in the master | |
637 | // | |
638 | // Parameters: | |
639 | // option Not used | |
640 | // | |
ce85db45 | 641 | // Draw result to screen, or perform fitting, normalizations Called |
642 | // once at the end of the query | |
f53fb4f6 | 643 | DGUARD(fDebug,1,"Process final merged results"); |
0be6c8cd | 644 | |
ce85db45 | 645 | fSums = dynamic_cast<TList*> (GetOutputData(1)); |
646 | if(!fSums) { | |
647 | AliError("Could not retrieve TList fSums"); | |
648 | return; | |
649 | } | |
650 | ||
e1f47419 | 651 | fOutput = new TList; |
652 | fOutput->SetName(Form("%s_result", GetName())); | |
653 | fOutput->SetOwner(); | |
c89b9ac1 | 654 | |
a76fb27d | 655 | fSNNString = static_cast<TParameter<int>*>(fSums->FindObject("sNN")); |
656 | fSysString = static_cast<TParameter<int>*>(fSums->FindObject("sys")); | |
0be6c8cd | 657 | fCentAxis = static_cast<TAxis*>(fSums->FindObject("centAxis")); |
a76fb27d | 658 | fSchemeString = static_cast<TParameter<int>*>(fSums->FindObject("scheme")); |
659 | fTriggerString = static_cast<TParameter<int>*>(fSums->FindObject("trigger")); | |
ce85db45 | 660 | |
e1f47419 | 661 | if(fSysString && fSNNString && |
662 | fSysString->GetUniqueID() == AliForwardUtil::kPP) | |
663 | LoadNormalizationData(fSysString->GetUniqueID(), | |
664 | fSNNString->GetUniqueID()); | |
f67d699c | 665 | |
666 | InitializeCentBins(); | |
667 | ||
0be6c8cd | 668 | // Print before we loop |
669 | Print(); | |
ce85db45 | 670 | |
e1f47419 | 671 | // Loop over centrality bins |
672 | TIter next(fListOfCentralities); | |
673 | CentralityBin* bin = 0; | |
5bb5d1f6 | 674 | gStyle->SetPalette(1); |
675 | THStack* dndetaStack = new THStack("dndeta", "dN/d#eta"); | |
676 | THStack* dndetaStackRebin = new THStack(Form("dndeta_rebin%02d", fRebin), | |
677 | "dN_{ch}/d#eta"); | |
678 | THStack* dndetaMCStack = new THStack("dndetaMC", "dN_{ch}/d#eta"); | |
679 | THStack* dndetaMCStackRebin = new THStack(Form("dndetaMC_rebin%02d", fRebin), | |
680 | "dN_{ch}/d#eta"); | |
681 | ||
c89b9ac1 | 682 | TList* mclist = 0; |
683 | TList* truthlist = 0; | |
684 | ||
797161e8 | 685 | if (fFinalMCCorrFile.Contains(".root")) { |
c89b9ac1 | 686 | TFile* ftest = TFile::Open(fFinalMCCorrFile.Data()); |
687 | if(ftest) { | |
797161e8 | 688 | mclist = dynamic_cast<TList*>(ftest->Get(Form("%sResults",GetName()))); |
689 | truthlist = dynamic_cast<TList*>(ftest->Get("MCTruthResults")); | |
c89b9ac1 | 690 | } |
797161e8 | 691 | else |
692 | AliWarning("MC analysis file invalid - no final MC correction possible"); | |
c89b9ac1 | 693 | } |
9ecab72f | 694 | Int_t style = GetMarker(); |
695 | Int_t color = GetColor(); | |
c89b9ac1 | 696 | |
9ecab72f | 697 | AliInfo(Form("Marker style=%d, color=%d", style, color)); |
5bb5d1f6 | 698 | while ((bin = static_cast<CentralityBin*>(next()))) { |
c89b9ac1 | 699 | |
ffca499d | 700 | bin->End(fSums, fOutput, fNormalizationScheme, fShapeCorr, fTriggerEff, |
c25b5e1b | 701 | fSymmetrice, fRebin, fUseROOTProj, fCorrEmpty, fCutEdges, |
c89b9ac1 | 702 | fTriggerMask, style, color, mclist, truthlist); |
5bb5d1f6 | 703 | if (fCentAxis && bin->IsAllBin()) continue; |
704 | TH1* dndeta = bin->GetResult(0, false, ""); | |
705 | TH1* dndetaSym = bin->GetResult(0, true, ""); | |
706 | TH1* dndetaMC = bin->GetResult(0, false, "MC"); | |
707 | TH1* dndetaMCSym = bin->GetResult(0, true, "MC"); | |
708 | if (dndeta) dndetaStack->Add(dndeta); | |
709 | if (dndetaSym) dndetaStack->Add(dndetaSym); | |
710 | if (dndetaMC) dndetaMCStack->Add(dndetaMC); | |
711 | if (dndetaMCSym) dndetaMCStack->Add(dndetaMCSym); | |
712 | if (fRebin > 1) { | |
713 | dndeta = bin->GetResult(fRebin, false, ""); | |
714 | dndetaSym = bin->GetResult(fRebin, true, ""); | |
715 | dndetaMC = bin->GetResult(fRebin, false, "MC"); | |
716 | dndetaMCSym = bin->GetResult(fRebin, true, "MC"); | |
717 | if (dndeta) dndetaStackRebin->Add(dndeta); | |
718 | if (dndetaSym) dndetaStackRebin->Add(dndetaSym); | |
719 | if (dndetaMC) dndetaMCStackRebin->Add(dndetaMC); | |
720 | if (dndetaMCSym) dndetaMCStackRebin->Add(dndetaMCSym); | |
721 | } | |
722 | } | |
723 | // Output the stack | |
724 | fOutput->Add(dndetaStack); | |
725 | ||
726 | // If available output rebinned stack | |
727 | if (!dndetaStackRebin->GetHists() || | |
728 | dndetaStackRebin->GetHists()->GetEntries() <= 0) { | |
729 | AliWarning("No rebinned histograms found"); | |
730 | delete dndetaStackRebin; | |
731 | dndetaStackRebin = 0; | |
732 | } | |
733 | if (dndetaStackRebin) fOutput->Add(dndetaStackRebin); | |
734 | ||
735 | // If available, output track-ref stack | |
736 | if (!dndetaMCStack->GetHists() || | |
737 | dndetaMCStack->GetHists()->GetEntries() <= 0) { | |
738 | AliWarning("No MC histograms found"); | |
739 | delete dndetaMCStack; | |
740 | dndetaMCStack = 0; | |
741 | } | |
742 | if (dndetaMCStack) fOutput->Add(dndetaMCStack); | |
743 | ||
744 | // If available, output rebinned track-ref stack | |
745 | if (!dndetaMCStackRebin->GetHists() || | |
746 | dndetaMCStackRebin->GetHists()->GetEntries() <= 0) { | |
747 | AliWarning("No rebinned MC histograms found"); | |
748 | delete dndetaMCStackRebin; | |
749 | dndetaMCStackRebin = 0; | |
750 | } | |
751 | if (dndetaMCStackRebin) fOutput->Add(dndetaMCStackRebin); | |
ce85db45 | 752 | |
e1f47419 | 753 | // Output collision energy string |
a76fb27d | 754 | if (fSNNString) { |
755 | UShort_t sNN = fSNNString->GetUniqueID(); | |
756 | TNamed* sNNObj = new TNamed(fSNNString->GetName(), | |
757 | AliForwardUtil::CenterOfMassEnergyString(sNN)); | |
758 | sNNObj->SetUniqueID(sNN); | |
759 | fOutput->Add(sNNObj); // fSNNString->Clone()); | |
760 | } | |
ce85db45 | 761 | |
e1f47419 | 762 | // Output collision system string |
a76fb27d | 763 | if (fSysString) { |
764 | UShort_t sys = fSysString->GetUniqueID(); | |
765 | TNamed* sysObj = new TNamed(fSysString->GetName(), | |
766 | AliForwardUtil::CollisionSystemString(sys)); | |
767 | sysObj->SetUniqueID(sys); | |
768 | fOutput->Add(sysObj); // fSysString->Clone()); | |
769 | } | |
ce85db45 | 770 | |
e308a636 | 771 | // Output centrality axis |
772 | if (fCentAxis) fOutput->Add(fCentAxis); | |
773 | ||
e1f47419 | 774 | // Output trigger string |
a76fb27d | 775 | if (fTriggerString) { |
776 | UShort_t mask = fTriggerString->GetUniqueID(); | |
777 | TNamed* maskObj = new TNamed(fTriggerString->GetName(), | |
778 | AliAODForwardMult::GetTriggerString(mask)); | |
779 | maskObj->SetUniqueID(mask); | |
780 | fOutput->Add(maskObj); // fTriggerString->Clone()); | |
781 | } | |
0be6c8cd | 782 | |
783 | // Normalization string | |
a76fb27d | 784 | if (fSchemeString) { |
785 | UShort_t scheme = fSchemeString->GetUniqueID(); | |
786 | TNamed* schemeObj = new TNamed(fSchemeString->GetName(), | |
787 | NormalizationSchemeString(scheme)); | |
788 | schemeObj->SetUniqueID(scheme); | |
789 | fOutput->Add(schemeObj); // fSchemeString->Clone()); | |
790 | } | |
ce85db45 | 791 | |
e1f47419 | 792 | // Output vertex axis |
ce85db45 | 793 | TAxis* vtxAxis = new TAxis(1,fVtxMin,fVtxMax); |
794 | vtxAxis->SetName("vtxAxis"); | |
795 | vtxAxis->SetTitle(Form("v_{z}#in[%+5.1f,%+5.1f]cm", fVtxMin,fVtxMax)); | |
796 | fOutput->Add(vtxAxis); | |
e1f47419 | 797 | |
798 | // Output trigger efficiency and shape correction | |
e58000b7 | 799 | fOutput->Add(new TParameter<Double_t>("triggerEff", fTriggerEff)); |
800 | if (fShapeCorr) fOutput->Add(fShapeCorr); | |
ffca499d | 801 | |
c25b5e1b | 802 | TNamed* options = new TNamed("options",""); |
803 | TString str; | |
804 | str.Append(Form("Edges %scut, ", fCutEdges ? "" : "not ")); | |
805 | str.Append(Form("Empty bins %scorrected for, ", fCorrEmpty ? "" : "not ")); | |
806 | str.Append(Form("TH2::ProjectionX %sused", fUseROOTProj ? "" : "not ")); | |
807 | options->SetTitle(str); | |
808 | fOutput->Add(options); | |
809 | ||
ce85db45 | 810 | PostData(2, fOutput); |
811 | } | |
3846ec25 | 812 | //________________________________________________________________________ |
813 | void | |
814 | AliBasedNdetaTask::LoadNormalizationData(UShort_t sys, UShort_t energy) | |
815 | { | |
e1f47419 | 816 | // Load the normalisation data for dN/deta for pp INEL, INEL>0, and NSD |
f53fb4f6 | 817 | DGUARD(fDebug,1,"Load the normalization data for sys=%d, energy=%d", |
818 | sys, energy); | |
3846ec25 | 819 | TString type("pp"); |
3846ec25 | 820 | TString snn("900"); |
821 | if(energy == 7000) snn.Form("7000"); | |
822 | if(energy == 2750) snn.Form("2750"); | |
823 | ||
4fa8d795 | 824 | if(fShapeCorr && (fTriggerEff != 1)) { |
e1f47419 | 825 | AliInfo("Objects already set for normalization - no action taken"); |
826 | return; | |
827 | } | |
3846ec25 | 828 | |
bd6f5206 | 829 | TFile* fin = TFile::Open(Form("$ALICE_ROOT/PWGLF/FORWARD/corrections/" |
e1f47419 | 830 | "Normalization/normalizationHists_%s_%s.root", |
831 | type.Data(),snn.Data())); | |
832 | if(!fin) { | |
833 | AliWarning(Form("no file for normalization of %d/%d", sys, energy)); | |
834 | return; | |
835 | } | |
3846ec25 | 836 | |
4fa8d795 | 837 | // Shape correction |
838 | if ((fNormalizationScheme & kShape) && !fShapeCorr) { | |
839 | TString trigName("All"); | |
840 | if (fTriggerMask == AliAODForwardMult::kInel || | |
841 | fTriggerMask == AliAODForwardMult::kNClusterGt0) | |
842 | trigName = "Inel"; | |
843 | else if (fTriggerMask == AliAODForwardMult::kNSD) | |
844 | trigName = "NSD"; | |
845 | else if (fTriggerMask == AliAODForwardMult::kInelGt0) | |
846 | trigName = "InelGt0"; | |
847 | else { | |
848 | AliWarning(Form("Normalization for trigger %s not known, using all", | |
849 | AliAODForwardMult::GetTriggerString(fTriggerMask))); | |
850 | } | |
851 | ||
852 | TString shapeCorName(Form("h%sNormalization", trigName.Data())); | |
853 | TH2F* shapeCor = dynamic_cast<TH2F*>(fin->Get(shapeCorName)); | |
854 | if (shapeCor) SetShapeCorrection(shapeCor); | |
855 | else { | |
856 | AliWarning(Form("No shape correction found for %s", trigName.Data())); | |
857 | } | |
858 | } | |
ce85db45 | 859 | |
e1f47419 | 860 | // Trigger efficiency |
861 | TString effName(Form("%sTriggerEff", | |
862 | fTriggerMask == AliAODForwardMult::kInel ? "inel" : | |
863 | fTriggerMask == AliAODForwardMult::kNSD ? "nsd" : | |
864 | fTriggerMask == AliAODForwardMult::kInelGt0 ? | |
865 | "inelgt0" : "all")); | |
4fa8d795 | 866 | TParameter<float>* eff = 0; |
867 | if (fNormalizationScheme & kTriggerEfficiency) | |
868 | eff = static_cast<TParameter<float>*>(fin->Get(effName)); | |
869 | Double_t trigEff = eff ? eff->GetVal() : 1; | |
870 | if (fTriggerEff != 1) SetTriggerEff(trigEff); | |
871 | if (fTriggerEff < 0) fTriggerEff = 1; | |
3846ec25 | 872 | |
b30dee70 | 873 | // TEMPORARY FIX |
874 | // Rescale the shape correction by the trigger efficiency | |
4fa8d795 | 875 | if (fShapeCorr) { |
876 | AliWarning(Form("Rescaling shape correction by trigger efficiency: " | |
877 | "1/E_X=1/%f", trigEff)); | |
878 | fShapeCorr->Scale(1. / trigEff); | |
879 | } | |
b30dee70 | 880 | |
e1f47419 | 881 | // Print - out |
4fa8d795 | 882 | if (fShapeCorr && fTriggerEff) AliInfo("Loaded objects for normalization."); |
3846ec25 | 883 | } |
0be6c8cd | 884 | |
885 | ||
886 | //________________________________________________________________________ | |
887 | void | |
888 | AliBasedNdetaTask::Print(Option_t*) const | |
889 | { | |
890 | // | |
891 | // Print information | |
892 | // | |
893 | std::cout << this->ClassName() << ": " << this->GetName() << "\n" | |
894 | << std::boolalpha | |
895 | << " Trigger: " << (fTriggerString ? | |
896 | fTriggerString->GetTitle() : | |
897 | "none") << "\n" | |
898 | << " Vertex range: [" << fVtxMin << ":" << fVtxMax << "]\n" | |
899 | << " Rebin factor: " << fRebin << "\n" | |
900 | << " Cut edges: " << fCutEdges << "\n" | |
901 | << " Symmertrice: " << fSymmetrice << "\n" | |
c25b5e1b | 902 | << " Use TH2::ProjectionX: " << fUseROOTProj << "\n" |
0be6c8cd | 903 | << " Correct for empty: " << fCorrEmpty << "\n" |
904 | << " Normalization scheme: " << (fSchemeString ? | |
905 | fSchemeString->GetTitle() : | |
906 | "none") <<"\n" | |
907 | << " Trigger efficiency: " << fTriggerEff << "\n" | |
908 | << " Shape correction: " << (fShapeCorr ? | |
909 | fShapeCorr->GetName() : | |
910 | "none") << "\n" | |
911 | << " sqrt(s_NN): " << (fSNNString ? | |
912 | fSNNString->GetTitle() : | |
913 | "unknown") << "\n" | |
914 | << " Collision system: " << (fSysString ? | |
915 | fSysString->GetTitle() : | |
916 | "unknown") << "\n" | |
917 | << " Centrality bins: " << (fCentAxis ? "" : "none"); | |
918 | if (fCentAxis) { | |
919 | Int_t nBins = fCentAxis->GetNbins(); | |
920 | const Double_t* bins = fCentAxis->GetXbins()->GetArray(); | |
921 | for (Int_t i = 0; i <= nBins; i++) | |
922 | std::cout << (i==0 ? "" : "-") << bins[i]; | |
923 | } | |
924 | std::cout << std::noboolalpha << std::endl; | |
925 | ||
926 | } | |
927 | ||
ce85db45 | 928 | //________________________________________________________________________ |
929 | TH1D* | |
e1f47419 | 930 | AliBasedNdetaTask::Rebin(const TH1D* h, Int_t rebin, Bool_t cutEdges) |
ce85db45 | 931 | { |
fb3430ac | 932 | // |
933 | // Make a copy of the input histogram and rebin that histogram | |
934 | // | |
935 | // Parameters: | |
936 | // h Histogram to rebin | |
937 | // | |
938 | // Return: | |
939 | // New (rebinned) histogram | |
940 | // | |
e1f47419 | 941 | if (rebin <= 1) return 0; |
ce85db45 | 942 | |
943 | Int_t nBins = h->GetNbinsX(); | |
e1f47419 | 944 | if(nBins % rebin != 0) { |
945 | AliWarningGeneral("AliBasedNdetaTask", | |
946 | Form("Rebin factor %d is not a devisor of current number " | |
947 | "of bins %d in the histogram %s", | |
948 | rebin, nBins, h->GetName())); | |
ce85db45 | 949 | return 0; |
950 | } | |
951 | ||
952 | // Make a copy | |
953 | TH1D* tmp = static_cast<TH1D*>(h->Clone(Form("%s_rebin%02d", | |
e1f47419 | 954 | h->GetName(), rebin))); |
955 | tmp->Rebin(rebin); | |
ce85db45 | 956 | tmp->SetDirectory(0); |
957 | ||
958 | // The new number of bins | |
e1f47419 | 959 | Int_t nBinsNew = nBins / rebin; |
ce85db45 | 960 | for(Int_t i = 1;i<= nBinsNew; i++) { |
961 | Double_t content = 0; | |
962 | Double_t sumw = 0; | |
963 | Double_t wsum = 0; | |
964 | Int_t nbins = 0; | |
e1f47419 | 965 | for(Int_t j = 1; j<=rebin;j++) { |
966 | Int_t bin = (i-1)*rebin + j; | |
ce85db45 | 967 | Double_t c = h->GetBinContent(bin); |
ce85db45 | 968 | if (c <= 0) continue; |
678a4979 | 969 | |
e1f47419 | 970 | if (cutEdges) { |
ce85db45 | 971 | if (h->GetBinContent(bin+1)<=0 || |
3846ec25 | 972 | h->GetBinContent(bin-1)<=0) { |
e1f47419 | 973 | #if 0 |
974 | AliWarningGeneral("AliBasedNdetaTask", | |
975 | Form("removing bin %d=%f of %s (%d=%f,%d=%f)", | |
976 | bin, c, h->GetName(), | |
977 | bin+1, h->GetBinContent(bin+1), | |
978 | bin-1, h->GetBinContent(bin-1))); | |
979 | #endif | |
ce85db45 | 980 | continue; |
981 | } | |
982 | } | |
983 | Double_t e = h->GetBinError(bin); | |
984 | Double_t w = 1 / (e*e); // 1/c/c | |
985 | content += c; | |
986 | sumw += w; | |
987 | wsum += w * c; | |
988 | nbins++; | |
989 | } | |
990 | ||
991 | if(content > 0 && nbins > 0) { | |
992 | tmp->SetBinContent(i, wsum / sumw); | |
993 | tmp->SetBinError(i,1./TMath::Sqrt(sumw)); | |
994 | } | |
995 | } | |
996 | ||
997 | return tmp; | |
998 | } | |
999 | ||
1000 | //__________________________________________________________________ | |
ce85db45 | 1001 | TH1* |
e1f47419 | 1002 | AliBasedNdetaTask::Symmetrice(const TH1* h) |
ce85db45 | 1003 | { |
fb3430ac | 1004 | // |
1005 | // Make an extension of @a h to make it symmetric about 0 | |
1006 | // | |
1007 | // Parameters: | |
1008 | // h Histogram to symmertrice | |
1009 | // | |
1010 | // Return: | |
1011 | // Symmetric extension of @a h | |
1012 | // | |
ce85db45 | 1013 | Int_t nBins = h->GetNbinsX(); |
1014 | TH1* s = static_cast<TH1*>(h->Clone(Form("%s_mirror", h->GetName()))); | |
1015 | s->SetTitle(Form("%s (mirrored)", h->GetTitle())); | |
1016 | s->Reset(); | |
1017 | s->SetBins(nBins, -h->GetXaxis()->GetXmax(), -h->GetXaxis()->GetXmin()); | |
1018 | s->SetMarkerColor(h->GetMarkerColor()); | |
1019 | s->SetMarkerSize(h->GetMarkerSize()); | |
9ecab72f | 1020 | s->SetMarkerStyle(FlipHollowStyle(h->GetMarkerStyle())); |
ce85db45 | 1021 | s->SetFillColor(h->GetFillColor()); |
1022 | s->SetFillStyle(h->GetFillStyle()); | |
1023 | s->SetDirectory(0); | |
1024 | ||
1025 | // Find the first and last bin with data | |
1026 | Int_t first = nBins+1; | |
1027 | Int_t last = 0; | |
1028 | for (Int_t i = 1; i <= nBins; i++) { | |
1029 | if (h->GetBinContent(i) <= 0) continue; | |
1030 | first = TMath::Min(first, i); | |
1031 | last = TMath::Max(last, i); | |
1032 | } | |
1033 | ||
1034 | Double_t xfirst = h->GetBinCenter(first-1); | |
1035 | Int_t f1 = h->GetXaxis()->FindBin(-xfirst); | |
1036 | Int_t l2 = s->GetXaxis()->FindBin(xfirst); | |
1037 | for (Int_t i = f1, j=l2; i <= last; i++,j--) { | |
1038 | s->SetBinContent(j, h->GetBinContent(i)); | |
1039 | s->SetBinError(j, h->GetBinError(i)); | |
1040 | } | |
1041 | // Fill in overlap bin | |
1042 | s->SetBinContent(l2+1, h->GetBinContent(first)); | |
1043 | s->SetBinError(l2+1, h->GetBinError(first)); | |
1044 | return s; | |
1045 | } | |
e1f47419 | 1046 | |
9ecab72f | 1047 | //__________________________________________________________________ |
1048 | Int_t | |
1049 | AliBasedNdetaTask::GetMarkerStyle(UShort_t bits) | |
1050 | { | |
1051 | Int_t base = bits & (0xFE); | |
1052 | Bool_t hollow = bits & kHollow; | |
1053 | switch (base) { | |
1054 | case kCircle: return (hollow ? 24 : 20); | |
1055 | case kSquare: return (hollow ? 25 : 21); | |
1056 | case kUpTriangle: return (hollow ? 26 : 22); | |
1057 | case kDownTriangle: return (hollow ? 32 : 23); | |
1058 | case kDiamond: return (hollow ? 27 : 33); | |
1059 | case kCross: return (hollow ? 28 : 34); | |
1060 | case kStar: return (hollow ? 30 : 29); | |
1061 | } | |
1062 | return 1; | |
1063 | } | |
1064 | //__________________________________________________________________ | |
1065 | UShort_t | |
1066 | AliBasedNdetaTask::GetMarkerBits(Int_t style) | |
1067 | { | |
1068 | UShort_t bits = 0; | |
1069 | switch (style) { | |
1070 | case 24: case 25: case 26: case 27: case 28: case 30: case 32: | |
1071 | bits |= kHollow; break; | |
1072 | } | |
1073 | switch (style) { | |
1074 | case 20: case 24: bits |= kCircle; break; | |
1075 | case 21: case 25: bits |= kSquare; break; | |
1076 | case 22: case 26: bits |= kUpTriangle; break; | |
1077 | case 23: case 32: bits |= kDownTriangle; break; | |
1078 | case 27: case 33: bits |= kDiamond; break; | |
1079 | case 28: case 34: bits |= kCross; break; | |
1080 | case 29: case 30: bits |= kStar; break; | |
1081 | } | |
1082 | return bits; | |
1083 | } | |
1084 | //__________________________________________________________________ | |
1085 | Int_t | |
1086 | AliBasedNdetaTask::FlipHollowStyle(Int_t style) | |
1087 | { | |
1088 | UShort_t bits = GetMarkerBits(style); | |
1089 | Int_t ret = GetMarkerStyle(bits ^ kHollow); | |
1090 | return ret; | |
1091 | } | |
1092 | ||
4fa8d795 | 1093 | //==================================================================== |
1094 | void | |
1095 | AliBasedNdetaTask::Sum::Init(TList* list, const TH2D* data, Int_t col) | |
1096 | { | |
f53fb4f6 | 1097 | DGUARD(fDebug,1,"Initializing sums with %s", data->GetName()); |
4fa8d795 | 1098 | TString n(GetHistName(0)); |
1099 | TString n0(GetHistName(1)); | |
1100 | const char* postfix = GetTitle(); | |
1101 | ||
1102 | fSum = static_cast<TH2D*>(data->Clone(n)); | |
1103 | if (postfix) fSum->SetTitle(Form("%s (%s)", data->GetTitle(), postfix)); | |
1104 | fSum->SetDirectory(0); | |
1105 | fSum->SetMarkerColor(col); | |
9ecab72f | 1106 | fSum->SetMarkerStyle(GetMarkerStyle(kCircle|kSolid)); |
4fa8d795 | 1107 | fSum->Reset(); |
1108 | list->Add(fSum); | |
1109 | ||
1110 | fSum0 = static_cast<TH2D*>(data->Clone(n0)); | |
1111 | if (postfix) | |
1112 | fSum0->SetTitle(Form("%s 0-bin (%s)", data->GetTitle(), postfix)); | |
1113 | else | |
1114 | fSum0->SetTitle(Form("%s 0-bin", data->GetTitle())); | |
1115 | fSum0->SetDirectory(0); | |
1116 | fSum0->SetMarkerColor(col); | |
9ecab72f | 1117 | fSum0->SetMarkerStyle(GetMarkerStyle(kCross|kHollow)); |
4fa8d795 | 1118 | fSum0->Reset(); |
1119 | list->Add(fSum0); | |
1120 | ||
1121 | fEvents = new TH1I(GetHistName(2), "Event types", 2, -.5, 1.5); | |
1122 | fEvents->SetDirectory(0); | |
1123 | fEvents->GetXaxis()->SetBinLabel(1, "Non-zero"); | |
1124 | fEvents->GetXaxis()->SetBinLabel(2, "Zero"); | |
1125 | list->Add(fEvents); | |
1126 | } | |
1127 | ||
1128 | //____________________________________________________________________ | |
1129 | TString | |
f67d699c | 1130 | AliBasedNdetaTask::Sum::GetHistName(const char* name, Int_t what, const char* post) |
4fa8d795 | 1131 | { |
f67d699c | 1132 | TString n(name); |
4fa8d795 | 1133 | if (what == 1) n.Append("0"); |
1134 | else if (what == 2) n.Append("Events"); | |
f67d699c | 1135 | if (post && post[0] != '\0') n.Append(post); |
4fa8d795 | 1136 | return n; |
1137 | } | |
1138 | ||
f67d699c | 1139 | //____________________________________________________________________ |
1140 | TString | |
1141 | AliBasedNdetaTask::Sum::GetHistName(Int_t what) const | |
1142 | { | |
1143 | return GetHistName(GetName(), what, GetTitle()); | |
1144 | } | |
1145 | ||
4fa8d795 | 1146 | //____________________________________________________________________ |
1147 | void | |
1148 | AliBasedNdetaTask::Sum::Add(const TH2D* data, Bool_t isZero) | |
1149 | { | |
f53fb4f6 | 1150 | DGUARD(fDebug,2,"Adding %s to sums", data->GetName()); |
4fa8d795 | 1151 | if (isZero) fSum0->Add(data); |
1152 | else fSum->Add(data); | |
1153 | fEvents->Fill(isZero ? 1 : 0); | |
1154 | } | |
1155 | ||
1156 | //____________________________________________________________________ | |
1157 | TH2D* | |
f67d699c | 1158 | AliBasedNdetaTask::Sum::CalcSum(TList* output, |
1159 | Double_t& ntotal, | |
1160 | Double_t epsilon0, | |
1161 | Double_t epsilon, | |
1162 | Int_t marker, | |
1163 | Bool_t rootProj, | |
1164 | Bool_t corrEmpty) const | |
4fa8d795 | 1165 | { |
f67d699c | 1166 | DGUARD(fDebug,2,"Calculating final summed histogram %s", fSum->GetName()); |
9ecab72f | 1167 | |
f67d699c | 1168 | TH2D* ret = static_cast<TH2D*>(fSum->Clone(fSum->GetName())); |
4fa8d795 | 1169 | ret->SetDirectory(0); |
1170 | ret->Reset(); | |
f67d699c | 1171 | Int_t n = Int_t(fEvents->GetBinContent(1)); |
1172 | Int_t n0 = Int_t(fEvents->GetBinContent(2)); | |
4fa8d795 | 1173 | |
f67d699c | 1174 | AliInfoF("Adding histograms %s and %s with weights %f and %f resp.", |
1175 | fSum0->GetName(), fSum->GetName(), 1./epsilon, 1./epsilon0); | |
1176 | DMSG(fDebug,2, "Adding histograms %s and %s with weights %f and %f resp.", | |
1177 | fSum0->GetName(), fSum->GetName(), 1./epsilon, 1./epsilon0); | |
4fa8d795 | 1178 | // Generate merged histogram |
f67d699c | 1179 | ret->Add(fSum0, fSum, 1. / epsilon0, 1. / epsilon); |
4fa8d795 | 1180 | ntotal = n / epsilon + n0 / epsilon0; |
1181 | ||
1182 | TList* out = new TList; | |
1183 | out->SetOwner(); | |
1184 | const char* postfix = GetTitle(); | |
1185 | if (!postfix) postfix = ""; | |
1186 | out->SetName(Form("partial%s", postfix)); | |
1187 | output->Add(out); | |
1188 | ||
1189 | // Now make copies, normalize them, and store in output list | |
f67d699c | 1190 | TH2D* sumCopy = static_cast<TH2D*>(fSum->Clone("sum")); |
1191 | TH2D* sum0Copy = static_cast<TH2D*>(fSum0->Clone("sum0")); | |
4fa8d795 | 1192 | TH2D* retCopy = static_cast<TH2D*>(ret->Clone("sumAll")); |
9ecab72f | 1193 | sumCopy->SetMarkerStyle(FlipHollowStyle(marker)); |
4fa8d795 | 1194 | sumCopy->SetDirectory(0); |
9ecab72f | 1195 | sum0Copy->SetMarkerStyle(GetMarkerStyle(GetMarkerBits(marker)+4)); |
4fa8d795 | 1196 | sum0Copy->SetDirectory(0); |
1197 | retCopy->SetMarkerStyle(marker); | |
1198 | retCopy->SetDirectory(0); | |
1199 | ||
f67d699c | 1200 | TH1D* norm = ProjectX(fSum, "norm", 0, 0, rootProj, corrEmpty, false); |
1201 | TH1D* norm0 = ProjectX(fSum0, "norm0", 0, 0, rootProj, corrEmpty, false); | |
1202 | TH1D* normAll = ProjectX(ret, "normAll", 0, 0, rootProj, corrEmpty, false); | |
4fa8d795 | 1203 | norm->SetDirectory(0); |
1204 | norm0->SetDirectory(0); | |
1205 | normAll->SetDirectory(0); | |
1206 | ||
1207 | ScaleToCoverage(sumCopy, norm); | |
1208 | ScaleToCoverage(sum0Copy, norm0); | |
1209 | ScaleToCoverage(retCopy, normAll); | |
1210 | ||
f67d699c | 1211 | Int_t nY = fSum->GetNbinsY(); |
4fa8d795 | 1212 | TH1D* sumCopyPx = ProjectX(sumCopy, "average", 1, nY,rootProj,corrEmpty); |
1213 | TH1D* sum0CopyPx = ProjectX(sum0Copy, "average0", 1, nY,rootProj,corrEmpty); | |
1214 | TH1D* retCopyPx = ProjectX(retCopy, "averageAll", 1, nY,rootProj,corrEmpty); | |
1215 | sumCopyPx->SetDirectory(0); | |
1216 | sum0CopyPx->SetDirectory(0); | |
1217 | retCopyPx->SetDirectory(0); | |
1218 | ||
1219 | // Scale our 1D histograms | |
1220 | sumCopyPx->Scale(1., "width"); | |
1221 | sum0CopyPx->Scale(1., "width"); | |
1222 | retCopyPx->Scale(1., "width"); | |
1223 | ||
1224 | AliInfo(Form("Maximum %f,%f changed to %f", sumCopyPx->GetMaximum(), | |
1225 | sum0CopyPx->GetMaximum(), retCopyPx->GetMaximum())); | |
1226 | ||
1227 | // Scale the normalization - they should be 1 at the maximum | |
1228 | norm->Scale(n > 0 ? 1. / n : 1); | |
1229 | norm0->Scale(n0 > 0 ? 1. / n0 : 1); | |
1230 | normAll->Scale(ntotal > 0 ? 1. / ntotal : 1); | |
1231 | ||
1232 | out->Add(sumCopy); | |
1233 | out->Add(sum0Copy); | |
1234 | out->Add(retCopy); | |
1235 | out->Add(sumCopyPx); | |
1236 | out->Add(sum0CopyPx); | |
1237 | out->Add(retCopyPx); | |
1238 | out->Add(norm); | |
1239 | out->Add(norm0); | |
1240 | out->Add(normAll); | |
1241 | ||
f67d699c | 1242 | AliInfoF("Returning (1/%f * %s + 1/%f * %s), " |
1243 | "1/%f * %d + 1/%f * %d = %d", | |
1244 | epsilon0, fSum0->GetName(), epsilon, fSum->GetName(), | |
1245 | epsilon0, n0, epsilon, n, int(ntotal)); | |
4fa8d795 | 1246 | #if 0 |
1247 | for (Int_t i = 1; i <= ret->GetNbinsX(); i++) { | |
1248 | Double_t nc = sum->GetBinContent(i, 0); | |
1249 | Double_t nc0 = sum0->GetBinContent(i, 0); | |
1250 | ret->SetBinContent(i, 0, nc + nc0); // Just count events | |
1251 | } | |
1252 | #endif | |
1253 | ||
1254 | return ret; | |
1255 | } | |
1256 | ||
e1f47419 | 1257 | //==================================================================== |
1258 | AliBasedNdetaTask::CentralityBin::CentralityBin() | |
1259 | : TNamed("", ""), | |
1260 | fSums(0), | |
1261 | fOutput(0), | |
1262 | fSum(0), | |
1263 | fSumMC(0), | |
1264 | fTriggers(0), | |
1265 | fLow(0), | |
c89b9ac1 | 1266 | fHigh(0), |
f53fb4f6 | 1267 | fDoFinalMCCorrection(false), |
1268 | fDebug(0) | |
e1f47419 | 1269 | { |
1270 | // | |
1271 | // Constructor | |
1272 | // | |
f53fb4f6 | 1273 | DGUARD(0,0,"Centrality bin default construction"); |
e1f47419 | 1274 | } |
1275 | //____________________________________________________________________ | |
1276 | AliBasedNdetaTask::CentralityBin::CentralityBin(const char* name, | |
1277 | Short_t low, Short_t high) | |
1278 | : TNamed(name, ""), | |
1279 | fSums(0), | |
1280 | fOutput(0), | |
1281 | fSum(0), | |
1282 | fSumMC(0), | |
1283 | fTriggers(0), | |
1284 | fLow(low), | |
c89b9ac1 | 1285 | fHigh(high), |
f53fb4f6 | 1286 | fDoFinalMCCorrection(false), |
1287 | fDebug(0) | |
e1f47419 | 1288 | { |
1289 | // | |
1290 | // Constructor | |
1291 | // | |
1292 | // Parameters: | |
1293 | // name Name used for histograms (e.g., Forward) | |
1294 | // low Lower centrality cut in percent | |
1295 | // high Upper centrality cut in percent | |
1296 | // | |
f53fb4f6 | 1297 | DGUARD(0,0,"Named Centrality bin construction: %s [%d,%d]", name); |
e1f47419 | 1298 | if (low <= 0 && high <= 0) { |
1299 | fLow = 0; | |
1300 | fHigh = 0; | |
1301 | SetTitle("All centralities"); | |
1302 | } | |
1303 | else { | |
1304 | fLow = low; | |
1305 | fHigh = high; | |
1306 | SetTitle(Form("Centrality bin from %3d%% to %3d%%", low, high)); | |
1307 | } | |
1308 | } | |
1309 | //____________________________________________________________________ | |
1310 | AliBasedNdetaTask::CentralityBin::CentralityBin(const CentralityBin& o) | |
1311 | : TNamed(o), | |
1312 | fSums(o.fSums), | |
1313 | fOutput(o.fOutput), | |
1314 | fSum(o.fSum), | |
1315 | fSumMC(o.fSumMC), | |
1316 | fTriggers(o.fTriggers), | |
1317 | fLow(o.fLow), | |
c89b9ac1 | 1318 | fHigh(o.fHigh), |
f53fb4f6 | 1319 | fDoFinalMCCorrection(o.fDoFinalMCCorrection), |
1320 | fDebug(o.fDebug) | |
e1f47419 | 1321 | { |
1322 | // | |
1323 | // Copy constructor | |
1324 | // | |
1325 | // Parameters: | |
1326 | // other Object to copy from | |
1327 | // | |
f53fb4f6 | 1328 | DGUARD(0,0,"Copy Centrality bin construction"); |
e1f47419 | 1329 | } |
1330 | //____________________________________________________________________ | |
1331 | AliBasedNdetaTask::CentralityBin::~CentralityBin() | |
1332 | { | |
1333 | // | |
1334 | // Destructor | |
1335 | // | |
f53fb4f6 | 1336 | DGUARD(fDebug,3,"Centrality bin desctruction"); |
e1f47419 | 1337 | if (fSums) fSums->Delete(); |
1338 | if (fOutput) fOutput->Delete(); | |
1339 | } | |
1340 | ||
1341 | //____________________________________________________________________ | |
1342 | AliBasedNdetaTask::CentralityBin& | |
1343 | AliBasedNdetaTask::CentralityBin::operator=(const CentralityBin& o) | |
1344 | { | |
1345 | // | |
1346 | // Assignment operator | |
1347 | // | |
1348 | // Parameters: | |
1349 | // other Object to assign from | |
1350 | // | |
1351 | // Return: | |
1352 | // Reference to this | |
1353 | // | |
f53fb4f6 | 1354 | DGUARD(fDebug,3,"Centrality bin assignment"); |
d015ecfe | 1355 | if (&o == this) return *this; |
e1f47419 | 1356 | SetName(o.GetName()); |
1357 | SetTitle(o.GetTitle()); | |
1358 | fSums = o.fSums; | |
1359 | fOutput = o.fOutput; | |
1360 | fSum = o.fSum; | |
1361 | fSumMC = o.fSumMC; | |
1362 | fTriggers = o.fTriggers; | |
1363 | fLow = o.fLow; | |
1364 | fHigh = o.fHigh; | |
c89b9ac1 | 1365 | fDoFinalMCCorrection = o.fDoFinalMCCorrection; |
e1f47419 | 1366 | |
1367 | return *this; | |
1368 | } | |
1369 | //____________________________________________________________________ | |
5bb5d1f6 | 1370 | Int_t |
9ecab72f | 1371 | AliBasedNdetaTask::CentralityBin::GetColor(Int_t fallback) const |
5bb5d1f6 | 1372 | { |
9ecab72f | 1373 | if (IsAllBin()) return fallback; |
5bb5d1f6 | 1374 | Float_t fc = (fLow+double(fHigh-fLow)/2) / 100; |
1375 | Int_t nCol = gStyle->GetNumberOfColors(); | |
1376 | Int_t icol = TMath::Min(nCol-1,int(fc * nCol + .5)); | |
1377 | Int_t col = gStyle->GetColorPalette(icol); | |
1378 | return col; | |
1379 | } | |
1380 | //____________________________________________________________________ | |
e1f47419 | 1381 | const char* |
1382 | AliBasedNdetaTask::CentralityBin::GetListName() const | |
1383 | { | |
1384 | // | |
1385 | // Get the list name | |
1386 | // | |
1387 | // Return: | |
1388 | // List Name | |
1389 | // | |
1390 | if (IsAllBin()) return "all"; | |
1391 | return Form("cent%03d_%03d", fLow, fHigh); | |
1392 | } | |
1393 | //____________________________________________________________________ | |
1394 | void | |
1395 | AliBasedNdetaTask::CentralityBin::CreateOutputObjects(TList* dir) | |
1396 | { | |
1397 | // | |
1398 | // Create output objects | |
1399 | // | |
1400 | // Parameters: | |
1401 | // dir Parent list | |
1402 | // | |
f53fb4f6 | 1403 | DGUARD(fDebug,1,"Create centrality bin output objects"); |
e1f47419 | 1404 | fSums = new TList; |
1405 | fSums->SetName(GetListName()); | |
1406 | fSums->SetOwner(); | |
1407 | dir->Add(fSums); | |
1408 | ||
ffca499d | 1409 | fTriggers = AliAODForwardMult::MakeTriggerHistogram("triggers"); |
1410 | fTriggers->SetDirectory(0); | |
e1f47419 | 1411 | fSums->Add(fTriggers); |
1412 | } | |
f53fb4f6 | 1413 | //____________________________________________________________________ |
1414 | void | |
1415 | AliBasedNdetaTask::CentralityBin::SetDebugLevel(Int_t lvl) | |
1416 | { | |
1417 | fDebug = lvl; | |
1418 | if (fSum) fSum->fDebug = lvl; | |
1419 | if (fSumMC) fSumMC->fDebug = lvl; | |
1420 | } | |
1421 | ||
f67d699c | 1422 | //____________________________________________________________________ |
1423 | Bool_t | |
1424 | AliBasedNdetaTask::CentralityBin::ReadSum(TList* list, bool mc) | |
1425 | { | |
1426 | const char* post = (mc ? "MC" : ""); | |
1427 | TString sn = Sum::GetHistName(GetName(),0,post); | |
1428 | TString sn0 = Sum::GetHistName(GetName(),1,post); | |
1429 | TString ev = Sum::GetHistName(GetName(),2,post); | |
1430 | TH2D* sum = static_cast<TH2D*>(list->FindObject(sn)); | |
1431 | TH2D* sum0 = static_cast<TH2D*>(list->FindObject(sn0)); | |
1432 | TH1I* events = static_cast<TH1I*>(list->FindObject(ev)); | |
1433 | if (!sum || !sum0 || !events) { | |
1434 | AliWarningF("Failed to find one or more histograms: " | |
1435 | "%s (%p) %s (%p) %s (%p)", | |
1436 | sn.Data(), sum, | |
1437 | sn0.Data(), sum0, | |
1438 | ev.Data(), events); | |
1439 | return false; | |
1440 | } | |
1441 | Sum* ret = new Sum(GetName(), post); | |
1442 | ret->fSum = sum; | |
1443 | ret->fSum0 = sum0; | |
1444 | ret->fEvents = events; | |
1445 | ret->fDebug = fDebug; | |
1446 | if (mc) fSumMC = ret; | |
1447 | else fSum = ret; | |
1448 | ||
1449 | return true; | |
1450 | } | |
1451 | ||
e1f47419 | 1452 | //____________________________________________________________________ |
1453 | void | |
1454 | AliBasedNdetaTask::CentralityBin::CreateSums(const TH2D* data, const TH2D* mc) | |
1455 | { | |
1456 | // | |
1457 | // Create sum histogram | |
1458 | // | |
1459 | // Parameters: | |
1460 | // data Data histogram to clone | |
1461 | // mc (optional) MC histogram to clone | |
1462 | // | |
f67d699c | 1463 | DGUARD(fDebug,1,"Create centrality bin sums from %s", |
1464 | data ? data->GetName() : "(null)"); | |
9ecab72f | 1465 | if (data) { |
1466 | fSum = new Sum(GetName(),""); | |
1467 | fSum->Init(fSums, data, GetColor()); | |
f53fb4f6 | 1468 | fSum->fDebug = fDebug; |
9ecab72f | 1469 | } |
1470 | ||
e1f47419 | 1471 | // If no MC data is given, then do not create MC sum histogram |
1472 | if (!mc) return; | |
1473 | ||
4fa8d795 | 1474 | fSumMC = new Sum(GetName(), "MC"); |
1475 | fSumMC->Init(fSums, mc, GetColor()); | |
f53fb4f6 | 1476 | fSumMC->fDebug = fDebug; |
e1f47419 | 1477 | } |
1478 | ||
1479 | //____________________________________________________________________ | |
1480 | Bool_t | |
1481 | AliBasedNdetaTask::CentralityBin::CheckEvent(const AliAODForwardMult* forward, | |
1482 | Int_t triggerMask, | |
1483 | Double_t vzMin, Double_t vzMax) | |
1484 | { | |
1485 | // | |
1486 | // Check the trigger, vertex, and centrality | |
1487 | // | |
1488 | // Parameters: | |
1489 | // aod Event input | |
1490 | // | |
1491 | // Return: | |
1492 | // true if the event is to be used | |
1493 | // | |
1494 | if (!forward) return false; | |
e1f47419 | 1495 | |
f53fb4f6 | 1496 | DGUARD(fDebug,2,"Check the event"); |
ffca499d | 1497 | // We do not check for centrality here - it's already done |
1498 | return forward->CheckEvent(triggerMask, vzMin, vzMax, 0, 0, fTriggers); | |
e1f47419 | 1499 | } |
1500 | ||
1501 | ||
1502 | //____________________________________________________________________ | |
1503 | void | |
1504 | AliBasedNdetaTask::CentralityBin::ProcessEvent(const AliAODForwardMult* forward, | |
4fa8d795 | 1505 | Int_t triggerMask, Bool_t isZero, |
e1f47419 | 1506 | Double_t vzMin, Double_t vzMax, |
1507 | const TH2D* data, const TH2D* mc) | |
1508 | { | |
1509 | // | |
1510 | // Process an event | |
1511 | // | |
1512 | // Parameters: | |
1513 | // forward Forward data (for trigger, vertex, & centrality) | |
1514 | // triggerMask Trigger mask | |
1515 | // vzMin Minimum IP z coordinate | |
1516 | // vzMax Maximum IP z coordinate | |
1517 | // data Data histogram | |
1518 | // mc MC histogram | |
1519 | // | |
f53fb4f6 | 1520 | DGUARD(fDebug,1,"Process one event for %s a given centrality bin", |
f67d699c | 1521 | data ? data->GetName() : "(null)"); |
e1f47419 | 1522 | if (!CheckEvent(forward, triggerMask, vzMin, vzMax)) return; |
1523 | if (!data) return; | |
1524 | if (!fSum) CreateSums(data, mc); | |
4fa8d795 | 1525 | |
1526 | fSum->Add(data, isZero); | |
1527 | if (mc) fSumMC->Add(mc, isZero); | |
e1f47419 | 1528 | } |
1529 | ||
1530 | //________________________________________________________________________ | |
b30dee70 | 1531 | Double_t |
1532 | AliBasedNdetaTask::CentralityBin::Normalization(const TH1I& t, | |
1533 | UShort_t scheme, | |
1534 | Double_t trigEff, | |
1535 | Double_t& ntotal) const | |
e1f47419 | 1536 | { |
1537 | // | |
b30dee70 | 1538 | // Calculate normalization |
e1f47419 | 1539 | // |
b30dee70 | 1540 | // Parameters: |
1541 | // t Trigger histogram | |
1542 | // scheme Normaliztion scheme | |
1543 | // trigEff From MC | |
1544 | // ntotal On return, contains the number of events. | |
e1f47419 | 1545 | // |
f53fb4f6 | 1546 | DGUARD(fDebug,1,"Normalize centrality bin with %s", t.GetName()); |
0be6c8cd | 1547 | Double_t nAll = t.GetBinContent(AliAODForwardMult::kBinAll); |
1548 | Double_t nB = t.GetBinContent(AliAODForwardMult::kBinB); | |
1549 | Double_t nA = t.GetBinContent(AliAODForwardMult::kBinA); | |
1550 | Double_t nC = t.GetBinContent(AliAODForwardMult::kBinC); | |
1551 | Double_t nE = t.GetBinContent(AliAODForwardMult::kBinE); | |
1552 | Double_t nOffline = t.GetBinContent(AliAODForwardMult::kBinOffline); | |
1553 | Double_t nTriggered = t.GetBinContent(AliAODForwardMult::kWithTrigger); | |
1554 | Double_t nWithVertex = t.GetBinContent(AliAODForwardMult::kWithVertex); | |
4fa8d795 | 1555 | Double_t nAccepted = ntotal; // t.GetBinContent(AliAODForwardMult::kAccepted); |
1556 | ntotal = 0; | |
e1f47419 | 1557 | |
e308a636 | 1558 | if (nTriggered <= 0.1) { |
e1f47419 | 1559 | AliError("Number of triggered events <= 0"); |
b30dee70 | 1560 | return -1; |
e1f47419 | 1561 | } |
e308a636 | 1562 | if (nWithVertex <= 0.1) { |
1563 | AliError("Number of events with vertex <= 0"); | |
b30dee70 | 1564 | return -1; |
e1f47419 | 1565 | } |
b30dee70 | 1566 | ntotal = nAccepted; |
1567 | Double_t vtxEff = nWithVertex / nTriggered; | |
0be6c8cd | 1568 | Double_t scaler = 1; |
0be6c8cd | 1569 | Double_t beta = nA + nC - 2*nE; |
b30dee70 | 1570 | |
4fa8d795 | 1571 | if (scheme & kEventLevel && !(scheme & kZeroBin)) { |
0be6c8cd | 1572 | ntotal = nAccepted / vtxEff; |
1573 | scaler = vtxEff; | |
1574 | AliInfo(Form("Calculating event normalisation as\n" | |
b30dee70 | 1575 | " N = N_A * N_T / N_V = %d * %d / %d = %f (%f)", |
0be6c8cd | 1576 | Int_t(nAccepted), Int_t(nTriggered), Int_t(nWithVertex), |
b30dee70 | 1577 | ntotal, scaler)); |
0be6c8cd | 1578 | |
1579 | if (scheme & kBackground) { | |
c25b5e1b | 1580 | // 1 E_V E_V |
1581 | // s = --------- = ------------- = ------------ | |
1582 | // 1 - beta 1 - beta E_V 1 - beta N_V | |
1583 | // --- ---- -------- ---- --- | |
1584 | // E_V N_V N_V N_V N_T | |
1585 | // | |
1586 | // E_V | |
1587 | // = ------------ | |
1588 | // 1 - beta | |
1589 | // ---- | |
1590 | // N_T | |
1591 | // | |
0be6c8cd | 1592 | ntotal -= nAccepted * beta / nWithVertex; |
c25b5e1b | 1593 | // This one is direct and correct. |
1594 | // scaler = 1. / (1. / vtxEff - beta / nWithVertex); | |
1595 | // A simpler expresion | |
1596 | scaler /= (1 - beta / nTriggered); // 0.831631 -> 0.780689 | |
0be6c8cd | 1597 | AliInfo(Form("Calculating event normalisation as\n" |
c25b5e1b | 1598 | " beta = N_a + N_c + 2 N_e = %d + %d - 2 * %d = %d\n" |
b30dee70 | 1599 | " N = N - N_A * beta / N_V = %f - %d * %d / %d = %f (%f)", |
c25b5e1b | 1600 | Int_t(nA), Int_t(nC), Int_t(nE), Int_t(beta), |
0be6c8cd | 1601 | nAccepted / vtxEff, Int_t(nAccepted), Int_t(beta), |
b30dee70 | 1602 | Int_t(nWithVertex), ntotal, scaler)); |
0be6c8cd | 1603 | } |
ffca499d | 1604 | } |
4fa8d795 | 1605 | if (scheme & kZeroBin) { |
1606 | // Calculate as | |
1607 | // | |
1608 | // N = N_A + 1/E_X * N_A / N_V (N_T - N_V - beta) | |
1609 | // = N_A (1 + 1/E_X (N_T/N_V - 1 - beta / N_V)) | |
1610 | // | |
1611 | // s = N_A/N = 1 / (1 + 1/E_X (N_T/N_V - 1 - beta / N_V)) | |
1612 | // = N_V / (N_V + 1/E_X (N_T - N_V - beta)) | |
1613 | // | |
1614 | if (!(scheme & kBackground)) beta = 0; | |
1615 | ntotal = nAccepted * (1 + 1/trigEff * (nTriggered / nWithVertex - 1 | |
1616 | - beta / nWithVertex)); | |
1617 | scaler = nWithVertex / (nWithVertex + | |
1618 | 1/trigEff * (nTriggered-nWithVertex-beta)); | |
1619 | AliInfo(Form("Calculating event normalisation as\n" | |
1620 | " beta = N_a + N_c + 2 N_e = %d + %d - 2 * %d = %d\n" | |
1621 | " N = N_A (1 + 1/E_X (N_T/N_V - 1 - beta / N_V)) = " | |
1622 | "%d (1 + 1 / %f (%d / %d - 1 - %d / %d)) = %f (%f)", | |
1623 | Int_t(nA), Int_t(nC), Int_t(nE), Int_t(beta), | |
1624 | Int_t(nAccepted), trigEff, Int_t(nTriggered), | |
1625 | Int_t(nWithVertex), Int_t(beta), Int_t(nWithVertex), | |
1626 | ntotal, scaler)); | |
1627 | } | |
1628 | if (scheme & kTriggerEfficiency && !(scheme & kZeroBin)) { | |
b30dee70 | 1629 | ntotal /= trigEff; |
1630 | scaler *= trigEff; | |
1631 | AliInfo(Form("Correcting for trigger efficiency:\n" | |
1632 | " N = 1 / E_X * N = 1 / %f * %d = %f (%f)", | |
1633 | trigEff, Int_t(ntotal), ntotal / trigEff, scaler)); | |
ffca499d | 1634 | } |
e308a636 | 1635 | |
0be6c8cd | 1636 | AliInfo(Form("\n" |
1637 | " Total of %9d events for %s\n" | |
1638 | " of these %9d have an offline trigger\n" | |
b30dee70 | 1639 | " of these N_T = %9d has the selected trigger\n" |
0be6c8cd | 1640 | " of these N_V = %9d has a vertex\n" |
b30dee70 | 1641 | " of these N_A = %9d were in the selected range\n" |
0be6c8cd | 1642 | " Triggers by hardware type:\n" |
1643 | " N_b = %9d\n" | |
1644 | " N_ac = %9d (%d+%d)\n" | |
1645 | " N_e = %9d\n" | |
0be6c8cd | 1646 | " Vertex efficiency: %f\n" |
1647 | " Trigger efficiency: %f\n" | |
1648 | " Total number of events: N = %f\n" | |
1649 | " Scaler (N_A/N): %f", | |
1650 | Int_t(nAll), GetTitle(), Int_t(nOffline), | |
b30dee70 | 1651 | Int_t(nTriggered), Int_t(nWithVertex), Int_t(nAccepted), |
0be6c8cd | 1652 | Int_t(nB), Int_t(nA+nC), Int_t(nA), Int_t(nC), Int_t(nE), |
b30dee70 | 1653 | vtxEff, trigEff, ntotal, scaler)); |
1654 | return scaler; | |
1655 | } | |
1656 | ||
5bb5d1f6 | 1657 | //________________________________________________________________________ |
1658 | const char* | |
1659 | AliBasedNdetaTask::CentralityBin::GetResultName(Int_t rebin, | |
1660 | Bool_t sym, | |
1661 | const char* postfix) const | |
1662 | { | |
1663 | static TString n; | |
1664 | n = Form("dndeta%s%s",GetName(), postfix); | |
1665 | if (rebin > 1) n.Append(Form("_rebin%02d", rebin)); | |
1666 | if (sym) n.Append("_mirror"); | |
1667 | return n.Data(); | |
1668 | } | |
1669 | //________________________________________________________________________ | |
1670 | TH1* | |
1671 | AliBasedNdetaTask::CentralityBin::GetResult(Int_t rebin, | |
1672 | Bool_t sym, | |
1673 | const char* postfix) const | |
1674 | { | |
1675 | if (!fOutput) { | |
1676 | AliWarning(Form("No output list defined in %s [%3d,%3d]", GetName(), | |
1677 | fLow, fHigh)); | |
1678 | return 0; | |
1679 | } | |
1680 | TString n = GetResultName(rebin, sym, postfix); | |
1681 | TObject* o = fOutput->FindObject(n.Data()); | |
1682 | if (!o) { | |
1683 | // AliWarning(Form("Object %s not found in output list", n.Data())); | |
1684 | return 0; | |
1685 | } | |
1686 | return static_cast<TH1*>(o); | |
1687 | } | |
1688 | ||
c25b5e1b | 1689 | //________________________________________________________________________ |
1690 | void | |
1691 | AliBasedNdetaTask::CentralityBin::MakeResult(const TH2D* sum, | |
1692 | const char* postfix, | |
1693 | bool rootProj, | |
1694 | bool corrEmpty, | |
f67d699c | 1695 | const TH2F* shapeCorr, |
c25b5e1b | 1696 | Double_t scaler, |
1697 | bool symmetrice, | |
1698 | Int_t rebin, | |
1699 | bool cutEdges, | |
9ecab72f | 1700 | Int_t marker, |
c89b9ac1 | 1701 | Int_t color, |
1702 | TList* mclist, | |
1703 | TList* truthlist) | |
c25b5e1b | 1704 | { |
1705 | // | |
1706 | // Generate the dN/deta result from input | |
1707 | // | |
1708 | // Parameters: | |
1709 | // sum Sum of 2D hists | |
1710 | // postfix Post fix on names | |
1711 | // rootProj Whether to use ROOT TH2::ProjectionX | |
1712 | // corrEmpty Correct for empty bins | |
1713 | // shapeCorr Shape correction to use | |
1714 | // scaler Event-level normalization scaler | |
1715 | // symmetrice Whether to make symmetric extensions | |
1716 | // rebin Whether to rebin | |
1717 | // cutEdges Whether to cut edges when rebinning | |
1718 | // | |
f53fb4f6 | 1719 | DGUARD(fDebug,1,"Make centrality bin result from %s", sum->GetName()); |
c25b5e1b | 1720 | TH2D* copy = static_cast<TH2D*>(sum->Clone(Form("d2Ndetadphi%s%s", |
1721 | GetName(), postfix))); | |
1722 | TH1D* accNorm = ProjectX(sum, Form("norm%s%s",GetName(), postfix), 0, 0, | |
1723 | rootProj, corrEmpty, false); | |
1724 | accNorm->SetDirectory(0); | |
1725 | ||
1726 | // ---- Scale by shape correction ---------------------------------- | |
1727 | if (shapeCorr) copy->Divide(shapeCorr); | |
1728 | else AliInfo("No shape correction specified, or disabled"); | |
1729 | ||
4fa8d795 | 1730 | // --- Normalize to the coverage ----------------------------------- |
1731 | ScaleToCoverage(copy, accNorm); | |
1732 | ||
c25b5e1b | 1733 | // --- Event-level normalization ----------------------------------- |
1734 | copy->Scale(scaler); | |
1735 | ||
1736 | // --- Project on X axis ------------------------------------------- | |
1737 | TH1D* dndeta = ProjectX(copy, Form("dndeta%s%s",GetName(), postfix), | |
1738 | 1, sum->GetNbinsY(), rootProj, corrEmpty); | |
1739 | dndeta->SetDirectory(0); | |
1740 | // Event-level normalization | |
1741 | dndeta->Scale(1., "width"); | |
1742 | copy->Scale(1., "width"); | |
c89b9ac1 | 1743 | |
1744 | TH1D* dndetaMCCorrection = 0; | |
1745 | TList* centlist = 0; | |
1746 | TH1D* dndetaMCtruth = 0; | |
1747 | TList* truthcentlist = 0; | |
1748 | ||
1749 | // Possible final correction to <MC analysis> / <MC truth> | |
1750 | if(mclist) | |
1751 | centlist = static_cast<TList*> (mclist->FindObject(GetListName())); | |
1752 | if(centlist) | |
797161e8 | 1753 | dndetaMCCorrection = static_cast<TH1D*>(centlist->FindObject(Form("dndeta%s%s",GetName(), postfix))); |
c89b9ac1 | 1754 | if(truthlist) |
1755 | truthcentlist = static_cast<TList*> (truthlist->FindObject(GetListName())); | |
1756 | if(truthcentlist) | |
1757 | dndetaMCtruth = static_cast<TH1D*> (truthcentlist->FindObject("dndetaTruth")); | |
1758 | //std::cout<<dndetaMCCorrection<<" "<<dndetaMCtruth<<std::endl; | |
1759 | if(dndetaMCCorrection && dndetaMCtruth) { | |
1760 | AliInfo("Correcting with final MC correction"); | |
1761 | dndetaMCCorrection->Divide(dndetaMCtruth); | |
1762 | dndeta->Divide(dndetaMCCorrection); | |
1763 | ||
1764 | //std::cout<<"histo "<<Form("dndeta%s%s",GetName(), postfix)<<" "<<GetListName()<<" "<<dndetaMCCorrection<<std::endl; | |
1765 | //std::cout<<"truth "<<GetListName()<<" "<<dndetaMCtruth<<std::endl; | |
1766 | ||
1767 | } | |
1768 | else AliInfo("No final MC correction applied"); | |
1769 | ||
c25b5e1b | 1770 | // --- Set some histogram attributes ------------------------------- |
5bb5d1f6 | 1771 | TString post; |
9ecab72f | 1772 | Int_t rColor = GetColor(color); |
5bb5d1f6 | 1773 | if (postfix && postfix[0] != '\0') post = Form(" (%s)", postfix); |
9ecab72f | 1774 | SetHistogramAttributes(dndeta, rColor, marker, |
5bb5d1f6 | 1775 | Form("ALICE %s%s", GetName(), post.Data())); |
9ecab72f | 1776 | SetHistogramAttributes(accNorm, rColor, marker, |
5bb5d1f6 | 1777 | Form("ALICE %s normalisation%s", |
1778 | GetName(), post.Data())); | |
c25b5e1b | 1779 | |
1780 | // --- Make symmetric extensions and rebinnings -------------------- | |
1781 | if (symmetrice) fOutput->Add(Symmetrice(dndeta)); | |
1782 | fOutput->Add(dndeta); | |
1783 | fOutput->Add(accNorm); | |
1784 | fOutput->Add(copy); | |
1785 | fOutput->Add(Rebin(dndeta, rebin, cutEdges)); | |
1786 | if (symmetrice) fOutput->Add(Symmetrice(Rebin(dndeta, rebin, cutEdges))); | |
1787 | } | |
1788 | ||
b30dee70 | 1789 | //________________________________________________________________________ |
1790 | void | |
1791 | AliBasedNdetaTask::CentralityBin::End(TList* sums, | |
1792 | TList* results, | |
1793 | UShort_t scheme, | |
f67d699c | 1794 | const TH2F* shapeCorr, |
b30dee70 | 1795 | Double_t trigEff, |
1796 | Bool_t symmetrice, | |
1797 | Int_t rebin, | |
c25b5e1b | 1798 | Bool_t rootProj, |
b30dee70 | 1799 | Bool_t corrEmpty, |
1800 | Bool_t cutEdges, | |
1801 | Int_t triggerMask, | |
9ecab72f | 1802 | Int_t marker, |
c89b9ac1 | 1803 | Int_t color, |
1804 | TList* mclist, | |
1805 | TList* truthlist) | |
b30dee70 | 1806 | { |
1807 | // | |
1808 | // End of processing | |
1809 | // | |
1810 | // Parameters: | |
1811 | // sums List of sums | |
1812 | // results Output list of results | |
1813 | // shapeCorr Shape correction or nil | |
1814 | // trigEff Trigger efficiency | |
1815 | // symmetrice Whether to symmetrice the results | |
1816 | // rebin Whether to rebin the results | |
1817 | // corrEmpty Whether to correct for empty bins | |
1818 | // cutEdges Whether to cut edges when rebinning | |
1819 | // triggerMask Trigger mask | |
1820 | // | |
f53fb4f6 | 1821 | DGUARD(fDebug,1,"End centrality bin procesing"); |
b30dee70 | 1822 | |
1823 | fSums = dynamic_cast<TList*>(sums->FindObject(GetListName())); | |
1824 | if(!fSums) { | |
1825 | AliError("Could not retrieve TList fSums"); | |
1826 | return; | |
1827 | } | |
e1f47419 | 1828 | |
b30dee70 | 1829 | fOutput = new TList; |
1830 | fOutput->SetName(GetListName()); | |
1831 | fOutput->SetOwner(); | |
1832 | results->Add(fOutput); | |
1833 | ||
9ecab72f | 1834 | if (!fSum) { |
f67d699c | 1835 | if (!ReadSum(fSums, false)) { |
1836 | AliInfo("This task did not produce any output"); | |
1837 | return; | |
1838 | } | |
9ecab72f | 1839 | } |
f67d699c | 1840 | if (!fSumMC) ReadSum(fSums, true); |
9ecab72f | 1841 | |
b30dee70 | 1842 | fTriggers = static_cast<TH1I*>(fSums->FindObject("triggers")); |
1843 | ||
1844 | if (!fTriggers) { | |
1845 | AliError("Couldn't find histogram 'triggers' in list"); | |
1846 | return; | |
1847 | } | |
b30dee70 | 1848 | |
b30dee70 | 1849 | // --- Get normalization scaler ------------------------------------ |
4fa8d795 | 1850 | Double_t epsilonT = trigEff; |
1851 | Double_t epsilonT0 = trigEff; | |
b30dee70 | 1852 | // TEMPORARY FIX |
1853 | if (triggerMask == AliAODForwardMult::kNSD) { | |
1854 | // This is a local change | |
c89b9ac1 | 1855 | epsilonT = 0.96; |
b30dee70 | 1856 | AliWarning(Form("Using hard-coded NSD trigger efficiency of %f",epsilonT)); |
1857 | } | |
4fa8d795 | 1858 | else if (triggerMask == AliAODForwardMult::kInel) { |
1859 | // This is a local change | |
c89b9ac1 | 1860 | epsilonT = 0.934; |
4fa8d795 | 1861 | AliWarning(Form("Using hard-coded Inel trigger efficiency of %f",epsilonT)); |
1862 | } | |
1863 | if (scheme & kZeroBin) { | |
1864 | if (triggerMask==AliAODForwardMult::kInel) | |
1865 | epsilonT0 = 0.785021; // 0.100240; | |
1866 | else if (triggerMask==AliAODForwardMult::kInelGt0) | |
1867 | epsilonT0 = 0; | |
1868 | else if (triggerMask==AliAODForwardMult::kNSD) | |
1869 | epsilonT0 = .706587; | |
1870 | epsilonT = 1; | |
1871 | AliWarning(Form("Using hard-coded NCluster>0 trigger efficiency of %f", | |
1872 | epsilonT0)); | |
1873 | } | |
1874 | ||
1875 | // Get our histograms | |
1876 | Double_t nSum = 0; | |
f67d699c | 1877 | TH2D* sum = fSum->CalcSum(fOutput, nSum, epsilonT0, 1, |
4fa8d795 | 1878 | marker, rootProj, corrEmpty); |
1879 | Double_t nSumMC = 0; | |
1880 | TH2D* sumMC = 0; | |
f67d699c | 1881 | if (fSumMC) sumMC = fSumMC->CalcSum(fOutput, nSumMC, |
1882 | epsilonT0, 1, marker, | |
1883 | rootProj, corrEmpty); | |
4fa8d795 | 1884 | if (!sum) { |
1885 | AliError("Failed to get sum from summer - bailing out"); | |
1886 | return; | |
1887 | } | |
1888 | ||
1889 | Double_t ntotal = nSum; | |
b30dee70 | 1890 | Double_t scaler = Normalization(*fTriggers, scheme, epsilonT, ntotal); |
1891 | if (scaler < 0) { | |
1892 | AliError("Failed to calculate normalization - bailing out"); | |
1893 | return; | |
1894 | } | |
e1f47419 | 1895 | fOutput->Add(fTriggers->Clone()); |
c25b5e1b | 1896 | |
1897 | // --- Make result and store --------------------------------------- | |
4fa8d795 | 1898 | MakeResult(sum, "", rootProj, corrEmpty, (scheme & kShape) ? shapeCorr : 0, |
797161e8 | 1899 | scaler, symmetrice, rebin, cutEdges, marker, color, |
1900 | mclist, truthlist); | |
e1f47419 | 1901 | |
b30dee70 | 1902 | // --- Process result from TrackRefs ------------------------------- |
4fa8d795 | 1903 | if (sumMC) |
1904 | MakeResult(sumMC, "MC", rootProj, corrEmpty, | |
c25b5e1b | 1905 | (scheme & kShape) ? shapeCorr : 0, |
4fa8d795 | 1906 | scaler, symmetrice, rebin, cutEdges, |
797161e8 | 1907 | GetMarkerStyle(GetMarkerBits(marker)+4), color, |
1908 | mclist, truthlist); | |
4fa8d795 | 1909 | |
e308a636 | 1910 | // Temporary stuff |
5bb5d1f6 | 1911 | // if (!IsAllBin()) return; |
e308a636 | 1912 | |
e1f47419 | 1913 | } |
1914 | ||
fb3430ac | 1915 | // |
1916 | // EOF | |
1917 | // |