5 #include <AliAODEvent.h> 11 #include <TParameter.h> 27 kDownTriangle = 0x008,
41 Int_t base = bits & (0xFE);
42 Bool_t hollow = bits & kHollow;
44 case kCircle:
return (hollow ? 24 : 20);
45 case kSquare:
return (hollow ? 25 : 21);
46 case kUpTriangle:
return (hollow ? 26 : 22);
47 case kDownTriangle:
return (hollow ? 32 : 23);
48 case kDiamond:
return (hollow ? 27 : 33);
49 case kCross:
return (hollow ? 28 : 34);
50 case kStar:
return (hollow ? 30 : 29);
66 case 24:
case 25:
case 26:
case 27:
case 28:
case 30:
case 32:
67 bits |= kHollow;
break;
70 case 20:
case 24: bits |= kCircle;
break;
71 case 21:
case 25: bits |= kSquare;
break;
72 case 22:
case 26: bits |= kUpTriangle;
break;
73 case 23:
case 32: bits |= kDownTriangle;
break;
74 case 27:
case 33: bits |= kDiamond;
break;
75 case 28:
case 34: bits |= kCross;
break;
76 case 29:
case 30: bits |= kStar;
break;
94 return markers[idx % nMarkers];
106 UShort_t bits = GetMarkerBits(style);
107 Int_t ret = GetMarkerStyle(bits ^ kHollow);
117 : fEtaMin(etaMin), fEtaMax(etaMax), fLow(nchLow), fN(0), fD(0), fAxis(1,0,1)
135 if (
fN.GetSize() <= 0)
return fAxis;
136 if (
fN.GetSize() == 1) {
146 for (
Int_t j = 0; j < l; j++) {
147 for (
Int_t k = 0; k <
fN[j]; k++) {
148 b[i+1] = b[i] +
fD[j];
153 ::Warning(
"Axis",
"Assigned bins, and number of bins not equal");
154 n = TMath::Min(i, n);
156 fAxis.Set(n, b.GetArray());
226 const TAxis* xaxis = hist.GetXaxis();
227 if (!xaxis->GetXbins() || xaxis->GetXbins()->GetSize() <= 0) {
229 xaxis->GetNbins(), xaxis->GetXmin(),
232 xaxis->GetNbins(), xaxis->GetXmin(),
236 xaxis->GetNbins(), xaxis->GetXmin(),
241 xaxis->GetNbins(),xaxis->GetXbins()->GetArray());
243 xaxis->GetNbins(),xaxis->GetXbins()->GetArray());
246 xaxis->GetNbins(),xaxis->GetXbins()->GetArray());
250 fForwardCache->GetYaxis()->SetTitle(
"#sum#frac{d^{2}N}{d#etadphi}");
254 fCentralCache->GetYaxis()->SetTitle(
"#sum#frac{d^{2}N}{d#etadphi}");
259 fMCCache->GetXaxis()->SetTitle(
"#eta");
260 fMCCache->GetYaxis()->SetTitle(
"#sum#frac{d^{2}N}{d#etadphi}");
264 fMCVertex->SetTitle(
"Vertex distribution from MC");
272 fDiag =
new TH2I(
"diagnostics",
"Event selection",
275 fDiag->SetDirectory(0);
276 fDiag->GetXaxis()->SetTitle(
"Selection");
278 fDiag->GetXaxis()->SetBinLabel(
kVertex -xBase,
"Vertex");
280 fDiag->GetYaxis()->SetTitle(
"Type/MC selection");
282 fDiag->GetYaxis()->SetBinLabel(
kMC -yBase,
"MC");
283 fDiag->GetYaxis()->SetBinLabel(
kTrigger -yBase,
"MC Trigger");
284 fDiag->GetYaxis()->SetBinLabel(
kVertex -yBase,
"MC Vertex");
286 fDiag->SetMarkerSize(3);
287 fDiag->SetMarkerColor(kWhite);
292 while ((bin = static_cast<EtaBin*>(next()))) {
307 if (!forward)
return false;
310 if (!central)
return false;
333 Double_t mcVz = primary->GetBinContent(0,0);
379 while ((bin = static_cast<EtaBin*>(next()))) {
381 forwardData, centralData,
409 THStack* sym =
new THStack(
"all",
"All distributions");
410 THStack* pos =
new THStack(
"all",
"All distributions");
411 THStack* neg =
new THStack(
"all",
"All distributions");
412 THStack* oth =
new THStack(
"all",
"All distributions");
416 while ((bin = static_cast<EtaBin*>(next()))) {
427 Int_t idx = sta->GetHists() ? sta->GetHists()->GetEntries() : 0;
428 if (bin->
fTruth) idx /= 2;
430 Int_t mkrBits = GetIndexMarker(idx);
433 TH1* h =
static_cast<TH1*
>((*ph)->Clone());
436 h->SetTitle(Form(
"%s (#times%d)", h->GetTitle(),
Int_t(factor)));
437 h->SetMarkerStyle(GetMarkerStyle(mkrBits));
449 if (lsym) lsym->Add(sym);
450 if (lneg) lneg->Add(neg);
451 if (lpos) lpos->Add(pos);
452 if (loth) loth->Add(oth);
474 Int_t nPhi = input.GetNbinsY();
475 Int_t nEta = input.GetNbinsX();
477 for (
Int_t iEta = 1; iEta <= nEta; iEta++) {
478 Double_t phiAcc = input.GetBinContent(iEta, nPhi+1);
479 Double_t etaCov = input.GetBinContent(iEta, 0);
480 Double_t factor = usePhiAcc ? phiAcc : etaCov;
482 if (factor < 1e-3)
continue;
485 for (
Int_t iPhi = 1; iPhi <= nPhi; iPhi++) {
486 Double_t c = input.GetBinContent(iEta, iPhi);
487 Double_t e = input.GetBinError(iEta, iPhi);
492 cache.SetBinContent(iEta, factor * sum);
493 cache.SetBinError(iEta, factor * TMath::Sqrt(e2sum));
507 if (!input || !cache)
return;
510 Int_t nPhi = input->GetNbinsY();
511 Int_t nEta = input->GetNbinsX();
513 for (
Int_t iEta = 1; iEta <= nEta; iEta++) {
516 for (
Int_t iPhi = 1; iPhi <= nPhi; iPhi++) {
517 Double_t c = input->GetBinContent(iEta, iPhi);
518 Double_t e = input->GetBinError(iEta, iPhi);
523 cache->SetBinContent(iEta, sum);
524 cache->SetBinError(iEta, TMath::Sqrt(e2sum));
547 etaLow = -TMath::Abs(etaLow);
548 etaMax = +TMath::Abs(etaLow);
567 etaLow = -TMath::Abs(etaLow);
568 etaMax = +TMath::Abs(etaLow);
570 TAxis mAxis((nMax+1)/nDiv, -.5, nMax+.5);
575 #define PFV(N,VALUE) \ 577 AliForwardUtil::PrintName(N); \ 578 std::cout << (VALUE) << std::endl; } while(false) 579 #define PFB(N,FLAG) \ 581 AliForwardUtil::PrintName(N); \ 582 std::cout << std::boolalpha << (FLAG) << std::noboolalpha << std::endl; \ 595 gROOT->IncreaseDirLevel();
602 while ((bin = static_cast<EtaBin*>(next()))) {
606 gROOT->DecreaseDirLevel();
654 fName.ReplaceAll(
"-",
"m");
655 fName.ReplaceAll(
"+",
"p");
656 fName.ReplaceAll(
".",
"d");
661 if (mAxis.GetXbins() && mAxis.GetXbins()->GetArray()) {
662 const TArrayD& mA = *(mAxis.GetXbins());
667 for (
Int_t i = 1; i < mA.GetSize(); i++) {
672 tA[j+1] = tA[j] +
Int_t(d);
676 fTAxis.Set(j, tA.GetArray());
682 fTAxis.Set((max-min)+1, min-.5, max+.5);
706 if (&o ==
this)
return *
this;
756 TObject* op = l->FindObject(parent);
758 if (op)
return static_cast<TList*
>(op);
759 if (!create)
return 0;
769 lowEdges->SetName(
"lowEdges");
770 lowEdges->SetOwner();
774 highEdges->SetName(
"highEdges");
775 highEdges->SetOwner();
789 if (xAxis.GetXbins() && xAxis.GetXbins()->GetArray())
790 ret =
new TH1D(name,title,xAxis.GetNbins(), xAxis.GetXbins()->GetArray());
792 ret =
new TH1D(name,title,xAxis.GetNbins(),xAxis.GetXmin(),xAxis.GetXmax());
804 if (xAxis.GetXbins() && xAxis.GetXbins()->GetArray()) {
805 if (yAxis.GetXbins() && yAxis.GetXbins()->GetArray())
807 ret =
new TH2D(name,title,
808 xAxis.GetNbins(), xAxis.GetXbins()->GetArray(),
809 yAxis.GetNbins(), yAxis.GetXbins()->GetArray());
812 ret =
new TH2D(name,title,
813 xAxis.GetNbins(), xAxis.GetXbins()->GetArray(),
814 yAxis.GetNbins(),yAxis.GetXmin(),yAxis.GetXmax());
817 if (yAxis.GetXbins() && yAxis.GetXbins()->GetArray())
819 ret =
new TH2D(name,title,
820 xAxis.GetNbins(), xAxis.GetXmin(), xAxis.GetXmax(),
821 yAxis.GetNbins(), yAxis.GetXbins()->GetArray());
824 ret =
new TH2D(name,title,
825 xAxis.GetNbins(), xAxis.GetXmin(), xAxis.GetXmax(),
826 yAxis.GetNbins(), yAxis.GetXmin(), yAxis.GetXmax());
849 TList* le =
static_cast<TList*
>(p->FindObject(
"lowEdges"));
850 TList* he =
static_cast<TList*
>(p->FindObject(
"highEdges"));
852 AliError(
"Failed to get bin edge lists from parent");
856 Int_t n = le->GetEntries();
861 lp->SetMergeMode(
'f');
862 hp->SetMergeMode(
'f');
867 const TAxis * xax = hist.GetXaxis();
873 fSum->SetDirectory(0);
874 fSum->GetXaxis()->SetTitle(
"#it{N}_{ch}");
875 fSum->GetYaxis()->SetTitle(
"Raw P(#it{N}_{ch})");
876 fSum->SetFillColor(kRed+1);
877 fSum->SetFillStyle(0);
879 fSum->SetMarkerStyle(20);
880 fSum->SetMarkerColor(kRed+1);
881 fSum->SetLineColor(kBlack);
886 fCorr->SetDirectory(0);
887 fCorr->GetXaxis()->SetTitle(
"Forward");
888 fCorr->GetYaxis()->SetTitle(
"Central");
889 fCorr->SetOption(
"colz");
892 fCoverage =
new TH1D(
"coverage",
"Fraction of bins with coverage",
895 fCoverage->SetXTitle(
"Fraction of bins [%]");
910 fTruth->SetXTitle(
fSum->GetXaxis()->GetTitle());
911 fTruth->SetYTitle(
fSum->GetYaxis()->GetTitle());
912 fTruth->SetLineColor(kBlack);
913 fTruth->SetFillColor(kBlue+1);
917 fTruth->SetMarkerColor(kBlue+1);
918 fTruth->SetMarkerStyle(24);
923 fTruthAccepted->SetTitle(Form(
"True (accepted) P(#it{N}_{ch}) in %s",
935 const TH1& sumCentral,
949 if (!mc && !accepted)
964 Double_t cM = mc->GetBinContent(iEta);
965 Double_t eM = mc->GetBinError(iEta);
974 Double_t cF = sumForward.GetBinContent(iEta);
975 Double_t eF = sumForward.GetBinError(iEta);
976 Bool_t bF = forward.GetBinContent(iEta, 0) > 0;
977 Double_t cC = sumCentral.GetBinContent(iEta);
978 Double_t eC = sumCentral.GetBinError(iEta);
979 Bool_t bC = central.GetBinContent(iEta, 0) > 0;
987 e = TMath::Sqrt(eF*eF + eC*eC);
1005 if (fsum < 0) fsum = 0;
1009 if (csum < 0) csum = 0;
1022 fCorr->Fill((fsum<0?0:fsum), (csum<0?0:csum));
1025 fCoverage->Fill(100*
float(covered) / nTotal);
1056 AliErrorF(
"Parent folder %s not found in input",
ParentName());
1062 AliErrorF(
"List %s not found in input",
GetName());
1071 fSum =
static_cast<TH1*
>(o->FindObject(
"rawDist"));
1072 fTruth =
static_cast<TH1*
>(o->FindObject(
"truth"));
1076 TH1** phist = hists;
1080 Int_t maxN = h->GetNbinsX();
1081 Double_t intg = h->Integral(1, maxN);
1082 h->Scale(1. / intg,
"width");
1090 tit.ReplaceAll(
"True P(#it{N}_{ch})",
"C_{trigger,vertex}");
1091 trgVtx->SetTitle(tit);
1092 trgVtx->SetYTitle(
"P_{MC}(#it{N}_{ch})/P_{MC,accepted}(#it{N}_{ch})");
1094 trgVtx->SetDirectory(0);
static TH2 * CreateH2(const char *name, const char *title, const TAxis &xAxis, const TAxis &yAxis)
virtual Bool_t CheckEvent(const AliAODForwardMult &forward)
const char * ParentName() const
void AddBin(const BinSpec &spec)
static AliAODEvent * GetAODEvent(AliAnalysisTaskSE *task)
void SetupForData(TList *list, const TH2 &hist, Bool_t useMC)
TList * FindParent(TList *l, Bool_t create=true) const
Bool_t IsSymmetric() const
static void ProjectX(const TH2 &input, TH1 &cache, Bool_t usePhiAcc=true)
static TH1 * CreateH1(const char *name, const char *title, const TAxis &xAxis)
static Bool_t IsTriggerBits(UInt_t bits, UInt_t trg)
Various utilities used in PWGLF/FORWARD.
void Push(UShort_t n, Double_t d)
Bool_t IsNegative() const
BinSpec(Double_t etaMin, Double_t etaMax, Double_t nchLow)
void Terminate(TList *in, TList *out)
void Print(Option_t *option="") const
void Print(Option_t *option="") const
Bool_t IsPositive() const
EtaBin & operator=(const EtaBin &o)
static TObject * MakeParameter(const char *name, UShort_t value)
const TH2D & GetHistogram() const
Class to make raw distributions.
const char * GetName() const
AliAODForwardMult * GetForward(const AliAODEvent &aod, Bool_t mc=false, Bool_t verb=true)
const TAxis & Axis() const
TH2D * GetPrimary(const AliAODEvent &aod)
AliAODCentralMult * GetCentral(const AliAODEvent &aod, Bool_t mc=false, Bool_t verb=true)
Bool_t CheckEvent(const AliAODForwardMult &fwd)
Bool_t Event(AliAODEvent &aod)
const TH2D & GetHistogram() const
void Process(const TH1 &sumForward, const TH1 &sumCentral, const TH2 &forward, const TH2 ¢ral, Bool_t accepted, const TH1 *mc)