]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG0/AliPWG0Helper.cxx
Added two missing includes to allow macro compilation (thanks to Laurent for remarkin...
[u/mrichter/AliRoot.git] / PWG0 / AliPWG0Helper.cxx
CommitLineData
04a7657f 1/* $Id$ */
2
3#include <AliPWG0Helper.h>
4
5#include <TParticle.h>
6#include <TParticlePDG.h>
847489f7 7#include <TH1.h>
dd367a14 8#include <TH2.h>
25db2d85 9#include <TH3.h>
116083b1 10#include <TList.h>
9cd015f7 11#include <TTree.h>
12#include <TBranch.h>
13#include <TLeaf.h>
116083b1 14
15#include <AliHeader.h>
16#include <AliStack.h>
17#include <AliLog.h>
04a7657f 18
19#include <AliLog.h>
20#include <AliESD.h>
770a1f1d 21#include <AliESDEvent.h>
04a7657f 22#include <AliESDVertex.h>
85737496 23#include <AliVertexerTracks.h>
69b09e3b 24#include <AliMultiplicity.h>
04a7657f 25
116083b1 26#include <AliGenEventHeader.h>
27#include <AliGenPythiaEventHeader.h>
28#include <AliGenCocktailEventHeader.h>
6b62a9c7 29#include <AliGenDPMjetEventHeader.h>
69b09e3b 30#include <AliESDVZERO.h>
116083b1 31
04a7657f 32//____________________________________________________________________
33ClassImp(AliPWG0Helper)
34
a67484a6 35Int_t AliPWG0Helper::fgLastProcessType = -1;
36
04a7657f 37//____________________________________________________________________
69b09e3b 38Bool_t AliPWG0Helper::IsEventTriggered(const AliESDEvent* aEsd, Trigger trigger)
116083b1 39{
69b09e3b 40 // checks if an event has been triggered
41 // this function implements the "offline" methods that use the ESD, other trigger requests are passed to the function prototype with ULong_t
116083b1 42
69b09e3b 43 Int_t firedChips = 0;
44 Bool_t v0A = kFALSE;
45 Bool_t v0C = kFALSE;
46
47 // offline triggers have to be dealt with here, because we need the esd pointer
48 if (trigger == kOfflineFASTOR || trigger == kOfflineMB1 || trigger == kOfflineMB2 || trigger == kOfflineMB3)
49 {
50 const AliMultiplicity* mult = aEsd->GetMultiplicity();
51 if (!mult)
52 {
53 Printf("AliPWG0Helper::IsEventTriggered: ERROR: AliMultiplicity not available");
54 return kFALSE;
55 }
56 firedChips = mult->GetNumberOfFiredChips(0) + mult->GetNumberOfFiredChips(1);
57 }
58 if (trigger == kOfflineMB1 || trigger == kOfflineMB2 || trigger == kOfflineMB3)
59 {
60 AliESDVZERO* v0Data = aEsd->GetVZEROData();
61 if (!v0Data)
62 {
63 Printf("AliPWG0Helper::IsEventTriggered: ERROR: AliESDVZERO not available");
64 return kFALSE;
65 }
66 for (Int_t i=0; i<32; i++)
67 {
68 if (v0Data->BBTriggerV0A(i))
69 v0A = kTRUE;
70 if (v0Data->BBTriggerV0C(i))
71 v0C = kTRUE;
72 }
73 }
74
75 switch (trigger)
76 {
77 case kOfflineFASTOR:
78 {
79 if (firedChips > 0)
80 return kTRUE;
81 break;
82 }
83 case kOfflineMB1:
84 {
85 if ((firedChips > 0) || v0A || v0C)
86 return kTRUE;
87 break;
88 }
89 case kOfflineMB2:
90 {
91 if ((firedChips > 0) && (v0A || v0C))
92 return kTRUE;
93 break;
94 }
95 case kOfflineMB3:
96 {
97 if ((firedChips > 0) && v0A && v0C)
98 return kTRUE;
99 break;
100 }
101 default:
102 {
103 return IsEventTriggered(aEsd->GetTriggerMask(), trigger);
104 break;
105 }
106 }
107
108 return kFALSE;
116083b1 109}
110
111//____________________________________________________________________
112Bool_t AliPWG0Helper::IsEventTriggered(ULong64_t triggerMask, Trigger trigger)
04a7657f 113{
114 // check if the event was triggered
115 //
5c495d37 116 // this function needs the branch fTriggerMask
dd367a14 117
dd367a14 118 // definitions from p-p.cfg
119 ULong64_t spdFO = (1 << 14);
69b09e3b 120 ULong64_t v0left = (1 << 10);
121 ULong64_t v0right = (1 << 11);
04a7657f 122
e9c3977b 123 switch (trigger)
124 {
125 case kMB1:
126 {
dd367a14 127 if (triggerMask & spdFO || ((triggerMask & v0left) || (triggerMask & v0right)))
e9c3977b 128 return kTRUE;
129 break;
130 }
131 case kMB2:
132 {
dd367a14 133 if (triggerMask & spdFO && ((triggerMask & v0left) || (triggerMask & v0right)))
e9c3977b 134 return kTRUE;
135 break;
136 }
69b09e3b 137 case kMB3:
138 {
139 if (triggerMask & spdFO && (triggerMask & v0left) && (triggerMask & v0right))
140 return kTRUE;
141 break;
142 }
1c15d51a 143 case kSPDFASTOR:
144 {
145 if (triggerMask & spdFO)
146 return kTRUE;
147 break;
148 }
69b09e3b 149 default:
150 Printf("IsEventTriggered: ERROR: Trigger type %d not implemented in this method", (Int_t) trigger);
151 break;
e9c3977b 152 }
04a7657f 153
154 return kFALSE;
155}
156
51f6de65 157//____________________________________________________________________
a6e0ebfe 158Bool_t AliPWG0Helper::TestVertex(const AliESDVertex* vertex, AnalysisMode analysisMode, Bool_t debug)
51f6de65 159{
160 // Checks if a vertex meets the needed quality criteria
161
162 Float_t requiredZResolution = -1;
163 if (analysisMode == kSPD || analysisMode == kTPCITS)
164 {
165 requiredZResolution = 0.1;
166 }
167 else if (analysisMode == kTPC)
168 requiredZResolution = 10.;
169
170 // check resolution
171 Double_t zRes = vertex->GetZRes();
172
173 if (zRes > requiredZResolution) {
174 if (debug)
175 Printf("AliPWG0Helper::TestVertex: Resolution too poor %f (required: %f", zRes, requiredZResolution);
176 return kFALSE;
177 }
178
179 return kTRUE;
180}
181
770a1f1d 182//____________________________________________________________________
69b09e3b 183const AliESDVertex* AliPWG0Helper::GetVertex(AliESDEvent* aEsd, AnalysisMode analysisMode, Bool_t debug, Bool_t bRedoTPC)
770a1f1d 184{
185 // Get the vertex from the ESD and returns it if the vertex is valid
186 //
187 // Second argument decides which vertex is used (this selects
188 // also the quality criteria that are applied)
189
190 const AliESDVertex* vertex = 0;
770a1f1d 191 if (analysisMode == kSPD || analysisMode == kTPCITS)
192 {
d1f50534 193 vertex = aEsd->GetPrimaryVertexSPD();
ebf31fda 194 if (debug)
195 Printf("AliPWG0Helper::GetVertex: Returning SPD vertex");
770a1f1d 196 }
51f6de65 197 else if (analysisMode == kTPC)
770a1f1d 198 {
85737496 199 if(bRedoTPC){
69b09e3b 200 if (debug)
201 Printf("AliPWG0Helper::GetVertex: Redoing vertex");
51f6de65 202 Double_t kBz = aEsd->GetMagneticField();
85737496 203 AliVertexerTracks vertexer(kBz);
51f6de65 204 vertexer.SetTPCMode();
85737496 205 AliESDVertex *vTPC = vertexer.FindPrimaryVertex(aEsd);
206 aEsd->SetPrimaryVertexTPC(vTPC);
207 for (Int_t i=0; i<aEsd->GetNumberOfTracks(); i++) {
208 AliESDtrack *t = aEsd->GetTrack(i);
209 t->RelateToVertexTPC(vTPC, kBz, kVeryBig);
51f6de65 210 }
85737496 211 delete vTPC;
212 }
213
d1f50534 214 vertex = aEsd->GetPrimaryVertexTPC();
ebf31fda 215 if (debug)
216 Printf("AliPWG0Helper::GetVertex: Returning vertex from tracks");
770a1f1d 217 }
218 else
219 Printf("AliPWG0Helper::GetVertex: ERROR: Invalid second argument %d", analysisMode);
220
ebf31fda 221 if (!vertex) {
222 if (debug)
223 Printf("AliPWG0Helper::GetVertex: No vertex found in ESD");
770a1f1d 224 return 0;
ebf31fda 225 }
770a1f1d 226
227 // check Ncontributors
ebf31fda 228 if (vertex->GetNContributors() <= 0) {
85737496 229 if (debug){
230 Printf("AliPWG0Helper::GetVertex: NContributors() <= 0: %d",vertex->GetNContributors());
231 Printf("AliPWG0Helper::GetVertex: NIndices(): %d",vertex->GetNIndices());
51f6de65 232 vertex->Print();
85737496 233 }
770a1f1d 234 return 0;
ebf31fda 235 }
770a1f1d 236
237 // check resolution
238 Double_t zRes = vertex->GetZRes();
51f6de65 239 if (zRes == 0) {
240 Printf("AliPWG0Helper::GetVertex: UNEXPECTED: resolution is 0.");
770a1f1d 241 return 0;
ebf31fda 242 }
243
244 if (debug)
85737496 245 {
246 Printf("AliPWG0Helper::GetVertex: Returning valid vertex: %s", vertex->GetTitle());
247 vertex->Print();
248 }
770a1f1d 249
250 return vertex;
251}
252
04a7657f 253//____________________________________________________________________
7584d357 254Bool_t AliPWG0Helper::IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimaries, Bool_t adebug)
04a7657f 255{
256 //
25db2d85 257 // this function checks if a particle from the event generator (i.e. among the nPrim particles in the stack)
258 // shall be counted as a primary particle
259 //
04a7657f 260 // This function or a equivalent should be available in some common place of AliRoot
261 //
dd367a14 262 // WARNING: Call this function only for particles that are among the particles from the event generator!
263 // --> stack->Particle(id) with id < stack->GetNprimary()
04a7657f 264
265 // if the particle has a daughter primary, we do not want to count it
266 if (aParticle->GetFirstDaughter() != -1 && aParticle->GetFirstDaughter() < aTotalPrimaries)
267 {
7584d357 268 if (adebug)
25db2d85 269 printf("Dropping particle because it has a daughter among the primaries.\n");
04a7657f 270 return kFALSE;
271 }
272
273 Int_t pdgCode = TMath::Abs(aParticle->GetPdgCode());
85737496 274
04a7657f 275
276 // skip quarks and gluon
277 if (pdgCode <= 10 || pdgCode == 21)
278 {
7584d357 279 if (adebug)
25db2d85 280 printf("Dropping particle because it is a quark or gluon.\n");
04a7657f 281 return kFALSE;
282 }
283
85737496 284 Int_t status = aParticle->GetStatusCode();
285 // skip non final state particles..
286 if(status!=1){
287 if (adebug)
288 printf("Dropping particle because it is not a final state particle.\n");
289 return kFALSE;
290 }
291
04a7657f 292 if (strcmp(aParticle->GetName(),"XXX") == 0)
293 {
1c15d51a 294 Printf("WARNING: There is a particle named XXX (pdg code %d).", pdgCode);
04a7657f 295 return kFALSE;
296 }
297
298 TParticlePDG* pdgPart = aParticle->GetPDG();
299
300 if (strcmp(pdgPart->ParticleClass(),"Unknown") == 0)
301 {
1c15d51a 302 Printf("WARNING: There is a particle with an unknown particle class (pdg code %d).", pdgCode);
04a7657f 303 return kFALSE;
304 }
305
306 if (pdgPart->Charge() == 0)
307 {
7584d357 308 if (adebug)
25db2d85 309 printf("Dropping particle because it is not charged.\n");
04a7657f 310 return kFALSE;
311 }
312
313 return kTRUE;
314}
847489f7 315
316//____________________________________________________________________
29771dc8 317void AliPWG0Helper::CreateProjections(TH3* hist, Bool_t save)
847489f7 318{
319 // create projections of 3d hists to all 2d combinations
320 // the histograms are not returned, just use them from memory or use this to create them in a file
321
322 TH1* proj = hist->Project3D("yx");
323 proj->SetXTitle(hist->GetXaxis()->GetTitle());
324 proj->SetYTitle(hist->GetYaxis()->GetTitle());
29771dc8 325 if (save)
326 proj->Write();
847489f7 327
328 proj = hist->Project3D("zx");
329 proj->SetXTitle(hist->GetXaxis()->GetTitle());
330 proj->SetYTitle(hist->GetZaxis()->GetTitle());
29771dc8 331 if (save)
332 proj->Write();
847489f7 333
334 proj = hist->Project3D("zy");
335 proj->SetXTitle(hist->GetYaxis()->GetTitle());
336 proj->SetYTitle(hist->GetZaxis()->GetTitle());
29771dc8 337 if (save)
338 proj->Write();
847489f7 339}
1afae8ff 340
341//____________________________________________________________________
29771dc8 342void AliPWG0Helper::CreateDividedProjections(TH3* hist, TH3* hist2, const char* axis, Bool_t putErrors, Bool_t save)
1afae8ff 343{
344 // create projections of the 3d hists divides them
345 // axis decides to which plane, if axis is 0 to all planes
346 // the histograms are not returned, just use them from memory or use this to create them in a file
347
348 if (axis == 0)
349 {
29771dc8 350 CreateDividedProjections(hist, hist2, "yx", putErrors, save);
351 CreateDividedProjections(hist, hist2, "zx", putErrors, save);
352 CreateDividedProjections(hist, hist2, "zy", putErrors, save);
1afae8ff 353
354 return;
355 }
356
357 TH1* proj = hist->Project3D(axis);
0ab29cfa 358
359 if (strlen(axis) == 2)
360 {
361 proj->SetYTitle(GetAxisTitle(hist, axis[0]));
362 proj->SetXTitle(GetAxisTitle(hist, axis[1]));
363 }
364 else if (strlen(axis) == 1)
365 proj->SetXTitle(GetAxisTitle(hist, axis[0]));
1afae8ff 366
367 TH1* proj2 = hist2->Project3D(axis);
0ab29cfa 368 if (strlen(axis) == 2)
369 {
370 proj2->SetYTitle(GetAxisTitle(hist2, axis[0]));
371 proj2->SetXTitle(GetAxisTitle(hist2, axis[1]));
372 }
373 else if (strlen(axis) == 1)
374 proj2->SetXTitle(GetAxisTitle(hist2, axis[0]));
1afae8ff 375
376 TH1* division = dynamic_cast<TH1*> (proj->Clone(Form("%s_div_%s", proj->GetName(), proj2->GetName())));
29771dc8 377 //printf("doing axis: %s, x axis has %d %d bins, min %f %f max %f %f\n", axis, division->GetNbinsX(), proj2->GetNbinsX(), division->GetXaxis()->GetBinLowEdge(1), proj2->GetXaxis()->GetBinLowEdge(1), division->GetXaxis()->GetBinUpEdge(division->GetNbinsX()), proj2->GetXaxis()->GetBinUpEdge(proj2->GetNbinsX()));
378 //printf("doing axis: %s, y axis has %d %d bins, min %f %f max %f %f\n", axis, division->GetNbinsY(), proj2->GetNbinsY(), division->GetYaxis()->GetBinLowEdge(1), proj2->GetYaxis()->GetBinLowEdge(1), division->GetYaxis()->GetBinUpEdge(division->GetNbinsY()), proj2->GetYaxis()->GetBinUpEdge(proj2->GetNbinsY()));
9e952c39 379 division->Divide(proj, proj2, 1, 1, "B");
29771dc8 380 division->SetTitle(Form("%s divided %s", proj->GetTitle(), proj2->GetTitle()));
0ab29cfa 381
382 if (putErrors)
383 {
384 division->Sumw2();
385 if (division->GetDimension() == 1)
386 {
387 Int_t nBins = division->GetNbinsX();
29771dc8 388 for (Int_t i = 1; i <= nBins; ++i)
0ab29cfa 389 if (proj2->GetBinContent(i) != 0)
390 division->SetBinError(i, TMath::Sqrt(proj->GetBinContent(i)) / proj2->GetBinContent(i));
391 }
392 else if (division->GetDimension() == 2)
393 {
394 Int_t nBinsX = division->GetNbinsX();
395 Int_t nBinsY = division->GetNbinsY();
29771dc8 396 for (Int_t i = 1; i <= nBinsX; ++i)
397 for (Int_t j = 1; j <= nBinsY; ++j)
0ab29cfa 398 if (proj2->GetBinContent(i, j) != 0)
399 division->SetBinError(i, j, TMath::Sqrt(proj->GetBinContent(i, j)) / proj2->GetBinContent(i, j));
400 }
401 }
29771dc8 402
403 if (save)
404 {
405 proj->Write();
406 proj2->Write();
407 division->Write();
408 }
1afae8ff 409}
410
92d2d8ad 411//____________________________________________________________________
25db2d85 412const char* AliPWG0Helper::GetAxisTitle(TH3* hist, const char axis)
92d2d8ad 413{
414 // returns the title of the axis given in axis (x, y, z)
415
416 if (axis == 'x')
417 return hist->GetXaxis()->GetTitle();
418 else if (axis == 'y')
419 return hist->GetYaxis()->GetTitle();
420 else if (axis == 'z')
421 return hist->GetZaxis()->GetTitle();
422
423 return 0;
424}
116083b1 425
6b62a9c7 426
1c15d51a 427AliPWG0Helper::MCProcessType AliPWG0Helper::GetPythiaEventProcessType(AliGenEventHeader* aHeader, Bool_t adebug) {
6b62a9c7 428
429 AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(aHeader);
430
431 if (!pythiaGenHeader) {
432 printf("AliPWG0Helper::GetProcessType : Unknown gen Header type). \n");
433 return kInvalidProcess;
434 }
435
436
437 Int_t pythiaType = pythiaGenHeader->ProcessType();
a67484a6 438 fgLastProcessType = pythiaType;
6b62a9c7 439 MCProcessType globalType = kInvalidProcess;
440
441
442 if (adebug) {
443 printf("AliPWG0Helper::GetProcessType : Pythia process type found: %d \n",pythiaType);
444 }
445
446
447 if(pythiaType==92||pythiaType==93){
448 globalType = kSD;
449 }
450 else if(pythiaType==94){
451 globalType = kDD;
452 }
453 //else if(pythiaType != 91){ // also exclude elastic to be sure... CKB??
454 else {
455 globalType = kND;
456 }
457 return globalType;
458}
459
460
1c15d51a 461AliPWG0Helper::MCProcessType AliPWG0Helper::GetDPMjetEventProcessType(AliGenEventHeader* aHeader, Bool_t adebug) {
116083b1 462 //
463 // get the process type of the event.
464 //
465
466 // can only read pythia headers, either directly or from cocktalil header
6b62a9c7 467 AliGenDPMjetEventHeader* dpmJetGenHeader = dynamic_cast<AliGenDPMjetEventHeader*>(aHeader);
468
469 if (!dpmJetGenHeader) {
470 printf("AliPWG0Helper::GetDPMjetProcessType : Unknown header type (not DPMjet or). \n");
471 return kInvalidProcess;
472 }
473
474 Int_t dpmJetType = dpmJetGenHeader->ProcessType();
a67484a6 475 fgLastProcessType = dpmJetType;
6b62a9c7 476 MCProcessType globalType = kInvalidProcess;
477
478
479 if (adebug) {
480 printf("AliPWG0Helper::GetDPMJetProcessType : DPMJet process type found: %d \n",dpmJetType);
481 }
482
483
484 if(dpmJetType == 1){ // this is explicitly inelastic
485 globalType = kND;
486 }
487 else if(dpmJetType==5||dpmJetType==6){
488 globalType = kSD;
489 }
490 else if(dpmJetType==7||dpmJetType==4){// DD and double pomeron
491 globalType = kDD;
492 }
493 return globalType;
494}
495
496
1c15d51a 497AliPWG0Helper::MCProcessType AliPWG0Helper::GetEventProcessType(AliHeader* aHeader, Bool_t adebug) {
6b62a9c7 498 //
499 // get the process type of the event.
500 //
501
502
503 // Check for simple headers first
504
116083b1 505 AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(aHeader->GenEventHeader());
6b62a9c7 506 if (pythiaGenHeader) {
507 return GetPythiaEventProcessType(pythiaGenHeader,adebug);
508 }
116083b1 509
6b62a9c7 510 AliGenDPMjetEventHeader* dpmJetGenHeader = dynamic_cast<AliGenDPMjetEventHeader*>(aHeader->GenEventHeader());
511 if (dpmJetGenHeader) {
512 return GetDPMjetEventProcessType(dpmJetGenHeader,adebug);
513 }
514
116083b1 515
6b62a9c7 516 // check for cocktail
116083b1 517
6b62a9c7 518 AliGenCocktailEventHeader* genCocktailHeader = dynamic_cast<AliGenCocktailEventHeader*>(aHeader->GenEventHeader());
519 if (!genCocktailHeader) {
520 printf("AliPWG0Helper::GetProcessType : Unknown header type (not Pythia or Cocktail). \n");
521 return kInvalidProcess;
522 }
116083b1 523
6b62a9c7 524 TList* headerList = genCocktailHeader->GetHeaders();
525 if (!headerList) {
526 return kInvalidProcess;
527 }
528
529 for (Int_t i=0; i<headerList->GetEntries(); i++) {
530
531 pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(headerList->At(i));
532 if (pythiaGenHeader) {
533 return GetPythiaEventProcessType(pythiaGenHeader,adebug);
116083b1 534 }
535
6b62a9c7 536 dpmJetGenHeader = dynamic_cast<AliGenDPMjetEventHeader*>(headerList->At(i));
537 if (dpmJetGenHeader) {
538 return GetDPMjetEventProcessType(dpmJetGenHeader,adebug);
116083b1 539 }
540 }
6b62a9c7 541 return kInvalidProcess;
542}
116083b1 543
116083b1 544
116083b1 545
546//____________________________________________________________________
547TParticle* AliPWG0Helper::FindPrimaryMother(AliStack* stack, Int_t label)
548{
549 //
550 // Finds the first mother among the primary particles of the particle identified by <label>,
551 // i.e. the primary that "caused" this particle
552 //
553
554 Int_t motherLabel = FindPrimaryMotherLabel(stack, label);
555 if (motherLabel < 0)
556 return 0;
557
558 return stack->Particle(motherLabel);
559}
560
561//____________________________________________________________________
562Int_t AliPWG0Helper::FindPrimaryMotherLabel(AliStack* stack, Int_t label)
563{
564 //
565 // Finds the first mother among the primary particles of the particle identified by <label>,
566 // i.e. the primary that "caused" this particle
567 //
568 // returns its label
569 //
570
571 Int_t nPrim = stack->GetNprimary();
572
573 while (label >= nPrim)
574 {
575 //printf("Particle %d (pdg %d) is not a primary. Let's check its mother %d\n", label, mother->GetPdgCode(), mother->GetMother(0));
576
577 TParticle* particle = stack->Particle(label);
578 if (!particle)
579 {
580 AliDebugGeneral("FindPrimaryMother", AliLog::kError, Form("UNEXPECTED: particle with label %d not found in stack.", label));
581 return -1;
582 }
583
584 // find mother
585 if (particle->GetMother(0) < 0)
586 {
587 AliDebugGeneral("FindPrimaryMother", AliLog::kError, Form("UNEXPECTED: Could not find mother of secondary particle %d.", label));
588 return -1;
589 }
590
591 label = particle->GetMother(0);
592 }
593
594 return label;
595}
9cd015f7 596
dd367a14 597//____________________________________________________________________
598void AliPWG0Helper::NormalizeToBinWidth(TH1* hist)
599{
600 //
601 // normalizes a 1-d histogram to its bin width
602 //
603
604 for (Int_t i=1; i<=hist->GetNbinsX(); ++i)
605 {
606 hist->SetBinContent(i, hist->GetBinContent(i) / hist->GetBinWidth(i));
607 hist->SetBinError(i, hist->GetBinError(i) / hist->GetBinWidth(i));
608 }
609}
610
611//____________________________________________________________________
612void AliPWG0Helper::NormalizeToBinWidth(TH2* hist)
613{
614 //
615 // normalizes a 2-d histogram to its bin width (x width * y width)
616 //
617
618 for (Int_t i=1; i<=hist->GetNbinsX(); ++i)
619 for (Int_t j=1; j<=hist->GetNbinsY(); ++j)
620 {
621 Double_t factor = hist->GetXaxis()->GetBinWidth(i) * hist->GetYaxis()->GetBinWidth(j);
622 hist->SetBinContent(i, j, hist->GetBinContent(i, j) / factor);
623 hist->SetBinError(i, j, hist->GetBinError(i, j) / factor);
624 }
625}
d1f50534 626
627//____________________________________________________________________
628void AliPWG0Helper::PrintConf(AnalysisMode analysisMode, Trigger trigger)
629{
630 //
631 // Prints the given configuration
632 //
633
634 TString str(">>>> Running with ");
635
636 switch (analysisMode)
637 {
773f84dc 638 case kInvalid: str += "invalid setting"; break;
d1f50534 639 case kSPD : str += "SPD-only"; break;
640 case kTPC : str += "TPC-only"; break;
641 case kTPCITS : str += "Global tracking"; break;
642 }
643
644 str += " and trigger ";
645
646 switch (trigger)
647 {
648 case kMB1 : str += "MB1"; break;
649 case kMB2 : str += "MB2"; break;
69b09e3b 650 case kMB3 : str += "MB3"; break;
1c15d51a 651 case kSPDFASTOR : str += "SPD FASTOR"; break;
69b09e3b 652 case kOfflineMB1 : str += "Offline MB1"; break;
653 case kOfflineMB2 : str += "Offline MB2"; break;
654 case kOfflineMB3 : str += "Offline MB3"; break;
655 case kOfflineFASTOR : str += "Offline SPD FASTOR"; break;
d1f50534 656 }
657
658 str += " <<<<";
659
660 Printf("%s", str.Data());
661}
662