3 #include <TMultiGraph.h>
20 const char*
ColName(
const char* prefix,
bool results=
false)
22 return Form(
"%sdNdeta%s", prefix, results ?
"Results" :
"Sums");
29 TFile*
file = TFile::Open(filename.Data(),
"READ");
31 Error(
"Run",
"Failed to open \"%s\"", filename.Data());
57 Info(
"Run",
"Found MC truth output");
63 pdfName.ReplaceAll(
".root",
".pdf");
71 if (forward && sums)
DrawSums(file,
"Forward", onlyMB);
72 if (forward && results) rF =
DrawRes(file,
"Forward", onlyMB);
75 if (central && sums)
DrawSums(file,
"Central", onlyMB);
76 if (central && results) rC =
DrawRes(file,
"Central", onlyMB);
79 if (mc && sums)
DrawSums(file,
"MCTruth", onlyMB);
80 if (mc && results) rM =
DrawRes(file,
"MCTruth", onlyMB);
82 if (rC && rF && results)
DrawBoth(rC, rF, rM, file, onlyMB);
95 if (cO->IsA()->InheritsFrom(TAxis::Class()))
96 cA = static_cast<TAxis*>(cO);
97 else if (cO->IsA()->InheritsFrom(TH1::Class())) {
102 if (!cA || !cA->GetXbins() || !cA->GetXbins()->GetArray() ||
103 cA->GetXmin() > cA->GetXmax())
return 0;
114 title = TString::Format(
"%s %s: ", base.Data(), title.Data());
115 if (cLow < 0 || cHigh < 0 || cLow >= cHigh) {
117 title.Append(
"All selected events");
120 folder.Form(
"cent%03dd%02d_%03dd%02d",
123 title.Append(Form(
"%6.2f%% - %6.2f%%", cLow, cHigh));
137 TLatex* ltx =
new TLatex(.5, y,
138 "#frac{1}{#it{N}}#kern[.1]"
139 "{#frac{d#it{N_{ch}}}{d#it{#eta}}}");
140 ltx->SetTextSize(0.07);
141 ltx->SetTextFont(42);
142 ltx->SetTextAlign(22);
148 ltx =
new TLatex(.5, y,
"Simulation input");
150 ltx->SetTextAlign(23);
151 ltx->SetTextFont(42);
152 ltx->SetTextSize(.03);
157 ltx =
new TLatex(.5, y,
"No centrality");
159 ltx->SetTextAlign(23);
160 ltx->SetTextFont(42);
161 ltx->SetTextSize(.03);
171 void DrawBoth(THStack* rC, THStack* rF, THStack* rM,
179 TPad* p1 =
new TPad(
"p1",
"p1", 0, y1, x2, 1, 0, 0);
180 TPad* p2 =
new TPad(
"p2",
"p2", x1, 0, 1, y2, 0, 0);
188 TIter nextM(rM->GetHists());
189 while ((h = static_cast<TH1*>(nextM()))) rC->Add(h);
192 TIter next(rF->GetHists());
193 while ((h = static_cast<TH1*>(next()))) rC->Add(h);
205 UShort_t cLow = centAxis && !onlyMB ? centAxis->GetXmin() : 0;
206 UShort_t cHigh = centAxis && !onlyMB ? centAxis->GetXmax() : 100;
211 TMultiGraph* other = 0;
214 Int_t oT = (trigger == 0x2000) ? 0x4 : trigger;
215 TString oC = Form(
"RefData::GetData(%hu,%hu,%hu,%hu,%hu,0xF)",
216 sys, sNN, oT, cLow, cHigh);
217 other =
reinterpret_cast<TMultiGraph*
>(gROOT->ProcessLine(oC));
220 other =
new TMultiGraph(
"other",
"");
221 Int_t nCent = centAxis->GetNbins();
222 for (
Int_t i = 1; i <= nCent; i++) {
223 TString oC = Form(
"RefData::GetData(%hu,%hu,%hu,%hu,%hu,0xF)",
224 sys, sNN, 0,
UShort_t(centAxis->GetBinLowEdge(i)),
225 UShort_t(centAxis->GetBinUpEdge(i)));
227 reinterpret_cast<TMultiGraph*
>(gROOT->ProcessLine(oC));
228 if (oM) other->Add(oM);
240 TIter nextG(other->GetListOfGraphs());
241 while ((g = nextG())) {
243 g->DrawClone(
"same p");
252 TLegend* l =
new TLegend(0.01, 0.1, 0.99, 0.99,
253 onlyMB || !centAxis ?
"" :
"Centralities");
260 TIter nextG(other->GetListOfGraphs());
262 while ((g = nextG())) {
263 if (seen.Index(g->GetTitle()) != kNPOS)
continue;
264 seen.Append(Form(
"|%s", g->GetTitle()));
265 TLegendEntry* e = l->AddEntry(
"dummy", g->GetTitle(),
"p");
267 e->SetMarkerStyle(gg->GetMarkerStyle());
268 e->SetMarkerSize(gg->GetMarkerSize());
269 e->SetMarkerColor(kBlack);
283 if (centAxis && centAxis->GetNbins() < 1) centAxis = 0;
291 if (!onlyMB && centAxis) {
297 for (
Int_t i = 1; i <= centAxis->GetNbins(); i++) {
299 Form(
"%3d%% - %3d%%",
300 Int_t(centAxis->GetBinLowEdge(i)),
301 Int_t(centAxis->GetBinUpEdge(i))), size);
305 cent->GetXaxis()->SetRangeUser(0,100);
306 cent->SetFillColor(kRed+1);
307 cent->SetFillStyle(3002);
308 cent->SetXTitle(
"Centrality [%]");
309 cent->SetYTitle(
"Events");
310 cent->SetMaximum(1.3*cent->GetMaximum());
312 centAcc->SetFillStyle(3002);
314 TLatex* overUnder =
new TLatex(0.15, .88,
315 Form(
"#splitline{<0: %d}{>100: %d}",
316 int(cent->GetBinContent(1)),
317 int(cent->GetBinContent(102))));
318 overUnder->SetTextColor(kRed+1);
320 overUnder->SetTextAlign(13);
321 overUnder->SetTextFont(42);
322 TLatex* overUnderAcc =
new TLatex(0.3, .88,
323 Form(
"#splitline{<0: %d}{>100: %d}",
324 int(centAcc->GetBinContent(1)),
325 int(centAcc->GetBinContent(102))));
326 overUnderAcc->SetTextColor(kGreen+1);
327 overUnderAcc->SetNDC();
328 overUnderAcc->SetTextAlign(13);
329 overUnderAcc->SetTextFont(42);
347 if (scheme == 0) schemeString =
"1/N_{accepted}";
348 if (scheme & 0x1) schemeString.Append(
"1/#epsilon_{V}1/#epsilon_{T}");
349 if (scheme & 0x2) schemeString.Append(
"Shape ");
350 if (scheme & 0x4) schemeString.Append(
"A+C-E ");
351 if (scheme & 0x8) schemeString.Append(
"#epsilon_{T,MC} ");
352 if (scheme & 0x10) schemeString.Append(
"0-bin");
367 Int_t cLow = centAxis ? centAxis->GetXmin() : 0;
368 Int_t cHigh = centAxis ? -centAxis->GetXmax() : -100;
370 if (onlyMB || !centAxis)
return;
372 for (
Int_t i = 1; i <= centAxis->GetNbins(); i++)
374 centAxis->GetBinUpEdge(i));
391 if (!bin0 || !bin || !trig || !type)
return;
393 type->SetFillStyle(3001);
394 type->SetFillColor(kGreen+1);
402 if (bin0->GetEntries() <= 0) {
423 if (!onlyMB && centAxis) {
425 for (
Int_t i = 1; i <= centAxis->GetNbins(); i++) {
427 Form(
"%6.2f%% - %6.2f%%",
428 centAxis->GetBinLowEdge(i),
429 centAxis->GetBinUpEdge(i)), size);
437 DrawParameter(y,
"Trigger",(oTrg ? oTrg->GetTitle() :
"?"), size);
439 TString scheme = oscheme ? oscheme->GetTitle() :
"";
440 if (scheme.IsNull()) scheme =
"1/N_{accepted}";
447 DrawParameter(y,
"#epsilon_{T,zero bin}", Form(
"%5.3f", epsT0), size);
450 DrawParameter(y,
"IP #delta_{xy}", Form(
"%5.3fmm", deltaIP), size);
453 TString opts(options->GetTitle());
455 TObjString* opt = 0;;
458 while ((opt = static_cast<TObjString*>(oNext()))) {
482 TF1* dc =
static_cast<TF1*
>(
GetObject(c,
"deltaCorr"));
483 TF1* vw =
static_cast<TF1*
>(
GetObject(s,
"ipZw"));
484 if (vw) vw->SetRange(-4,6);
485 if (emp || dc || vw) {
492 DrawParameter(y,
"#mu_{Z}", Form(
"%5.3f", vw->GetParameter(0)));
493 DrawParameter(y,
"#sigma_{Z}", Form(
"%5.3f", vw->GetParameter(1)));
494 DrawParameter(y,
"#mu_{Z,ref}", Form(
"%5.3f", vw->GetParameter(2)));
495 DrawParameter(y,
"#sigma_{Z,ref}", Form(
"%5.3f", vw->GetParameter(3)));
502 if (centAxis && centAxis->GetNbins() < 1) centAxis = 0;
504 THStack* dndeta_ =
GetStack(c,
"dndeta");
505 if (!dndeta_ || !dndeta_->GetHists() ||
506 dndeta_->GetHists()->GetEntries() < 0)
return 0;
508 TLegend* l =
new TLegend(0.1, 0.1, 0.9, 0.9,
509 onlyMB || !centAxis?
"" :
"Centralities");
513 THStack* dndeta =
CleanStack(dndeta_, l, centAxis);
515 THStack* dndetaEmp =
GetStack(c,
"dndetaEmp");
516 if (!dndetaEmp || !dndetaEmp->GetHists() ||
517 dndetaEmp->GetHists()->GetEntries() < 0) dndetaEmp = 0;
519 THStack* leftRight =
GetStack(c,
"leftRight");
520 if (!leftRight || !leftRight->GetHists() ||
521 leftRight->GetHists()->GetEntries() < 0) leftRight = 0;
528 TPad* p1 =
new TPad(
"p1",
"p1", 0, y1, x2, 1, 0, 0);
529 TPad* p2 =
new TPad(
"p2",
"p2", x1, 0, 1, y2, 0, 0);
542 "\\hbox{d}N_{\\hbox{ch}}/\\hbox{d}\\eta|_{\\hbox{incl}}");
544 "\\hbox{d}N_{\\hbox{ch}}/\\hbox{d}\\eta|_{\\hbox{prim}}");
545 DrawInPad(p1, 3, leftRight,
"nostack", 0,
"Left/Right");
546 p1->GetPad(1)->SetGridx();
547 p1->GetPad(2)->SetGridx();
548 p1->GetPad(3)->SetGridx();
550 PrintCanvas(Form(
"%s results - stacks", base.Data()));
553 Int_t cLow = centAxis ? centAxis->GetXmin() : 0;
554 Int_t cHigh = centAxis ? -centAxis->GetXmax() : -100;
556 if (onlyMB || !centAxis) {
562 for (
Int_t i = 1; i <= centAxis->GetNbins(); i++)
564 centAxis->GetBinUpEdge(i));
575 TH1* dndeta =
GetH1(c, Form(
"dndeta%s",base.Data()));
576 if (!dndeta)
return 0;
578 THStack* ret =
new THStack(
"dndetaMB", title);
581 if (base.EqualTo(
"MCTruth")) {
582 dndeta =
GetH1(c,
"dndetaTruth");
583 if (dndeta) ret->Add(dndeta);
600 TH1* norm =
GetH1(c, Form(
"norm%s",base.Data()));
601 TH1* dndeta =
GetH1(c, Form(
"dndeta%s",base.Data()));
602 TH1* dndetaEmp =
GetH1(c, Form(
"dndeta%sEmp",base.Data()));
603 TH2* d2ndetadphi =
GetH2(c, Form(
"d2Ndetadphi%s", base.Data()));
604 if (!trig || !norm || !dndeta || !d2ndetadphi)
return;
605 if (norm->GetEntries() <= 0)
return;
607 norm->SetFillColor(kGreen+1);
608 norm->SetFillStyle(3001);
611 fBody->Divide(2, (dndetaEmp ? 4 : 3), 0.05, 0);
614 TVirtualPad* p =
fBody->GetPad(trP);
615 p->SetBottomMargin(0.15);
616 p->SetLeftMargin(0.15);
617 if (trP > 2) p->SetTopMargin(0.05);
621 "d^{2}#it{N}/d#it{#eta}d#it{phi}|_{incl}");
624 "d#it{N}_{ch}/d#it{#eta}|_{incl}");
626 fBody->GetPad(2)->SetGridx();
627 fBody->GetPad(4)->SetGridx();
628 fBody->GetPad(6)->SetGridx();
629 fBody->GetPad(2)->SetLeftMargin(0.15);
630 fBody->GetPad(4)->SetLeftMargin(0.15);
631 fBody->GetPad(6)->SetLeftMargin(0.15);
632 fBody->GetPad(4)->SetRightMargin(0.15);
633 fBody->GetPad(6)->SetRightMargin(0.15);
636 "d#it{N}_{ch}/d#it{#eta}|_{prim}");
637 fBody->GetPad(8)->SetGridx();
638 fBody->GetPad(8)->SetLeftMargin(0.15);
639 fBody->GetPad(8)->SetRightMargin(0.15);
643 TString calc = normCalc ? normCalc->GetTitle() :
"?";
646 calc.ReplaceAll(
"beta",
"#beta");
647 calc.ReplaceAll(
"eps",
"#varepsilon");
648 const char* sufs[] = {
"all",
"acc",
"trg",
"vtx",
"B",
"A",
"C",
"E",
650 const char** suf = sufs;
652 calc.ReplaceAll(Form(
"_%s", *suf), Form(
"_{%s}", *suf));
657 p->SetPad(p->GetXlowNDC(), 0,
658 p->GetXlowNDC()+p->GetWNDC(), p->GetYlowNDC()+p->GetHNDC());
659 fBody->GetPad(5)->Delete();
660 if (dndetaEmp)
fBody->GetPad(7)->Delete();
664 TObjString* sline = 0;
671 while ((sline = static_cast<TObjString*>(next()))) {
673 TString& line = sline->String();
674 Ssiz_t eq = line.Last(
'=');
680 TString val = line(eq+1,line.Length()-eq-1);
701 TString title = TString::Format(
"%s - details: ", base.Data());
705 Warning(
"",
"Collection partical not found in %s", sums->GetName());
710 fBody->Divide(3, 1, 0.05, 0);
712 const char* typs[] = {
"",
"0",
"All" };
713 const char* tits[] = {
"Non-zero events",
"Zero events",
"Weighted sum" };
714 for (
Int_t i = 1; i <= 3; i++) {
715 const char* suf = typs[i-1];
716 TVirtualPad* p =
fBody->cd(i);
717 p->SetTopMargin(0.10);
719 TLatex* ltx =
new TLatex(0.5, .99, tits[i-1]);
721 ltx->SetTextAlign(23);
722 ltx->SetTextSize(0.05);
725 TH1* sum =
GetH2(c, Form(
"sum%s", suf));
726 TH1* norm =
GetH1(c, Form(
"norm%s", suf));
727 TH1* phi =
GetH1(c, Form(
"phi%s", suf));
729 norm->SetFillColor(kGreen+1);
730 norm->SetFillStyle(3002);
731 phi->SetFillColor(kBlue+1);
732 phi->SetFillStyle(3001);
734 p->Divide(1, 3, 0, 0);
735 DrawInPad(p, 1, sum, sum->Integral()>0 ?
"col" :
"", 0,
736 "d^{2}#it{N}_{ch}/d#it{#varphi}d#it{#eta}");
738 "d#it{N}_{ch}/d#it{#eta}");
739 DrawInPad(p, 3, norm,
"", 0,
"#eta-coverage/#varphi-acceptance");
748 if (!stack)
return 0;
749 THStack* ret =
new THStack(stack->GetName(), stack->GetTitle());
750 TList* hists = stack->GetHists();
755 while ((h = static_cast<TH1*>(next()))) {
758 if (nme.Contains(
"_mirror", TString::kIgnoreCase)) {
764 Int_t bin = axis ? TMath::Min(j, axis->GetNbins()) : 1;
766 name.Form(
"%3d%% - %3d%%",
767 Int_t(axis->GetBinLowEdge(bin)),
768 Int_t(axis->GetBinUpEdge(bin)));
770 name.ReplaceAll(
"ALICE",
"");
771 name.ReplaceAll(
"dNdeta",
" - work in progress");
773 ok = axis && axis->GetBinUpEdge(bin) > 100;
775 TLegendEntry* e = l->AddEntry(
"dummy", name,
"f");
776 e->SetFillStyle(1001);
777 e->SetFillColor(h->GetMarkerColor());
THStack * DrawRes(TDirectory *top, const TString &base, Bool_t onlyMB)
Base class for classes to draw summaries.
static TH1 * GetH1(const TObject *parent, const TString &name, Bool_t verb=true)
TAxis * GetCentAxis(const TCollection *parent, Bool_t verbose=false)
static TH2 * GetH2(const TObject *parent, const TString &name, Bool_t verb=true)
static void TriggerString(ULong_t trigger, TString &str)
TCollection * GetCentCollection(const TCollection *sums, const TString &base, Float_t cLow, Float_t cHigh, TString &title)
void DrawCentResDetails(const TCollection *sums, const TString &base)
void DrawBoth(THStack *rC, THStack *rF, THStack *rM, TFile *file, Bool_t onlyMB)
void Run(const char *fname="forward_dndeta.root", UShort_t flags=kNormal)
static void SysString(UShort_t sys, TString &str)
void DrawSums(TDirectory *top, const TString &base, bool onlyMB)
const char * ColName(const char *prefix, bool results=false)
static Bool_t GetParameter(const TObject *c, const TString &name, Short_t &value, Bool_t verb=true)
static TObject * GetObject(const TObject *parent, const TString &name, Bool_t verb=true)
void CreateCanvas(const TString &pname, Bool_t landscape=false, Bool_t pdf=true, Bool_t useTop=true)
void DrawParameter(Double_t &y, const TString &name, const TString &value, Double_t size=0)
void DrawResTitle(TCollection *c, Double_t &y, Bool_t onlyMB)
void PrintCanvas(const TString &title, Float_t size=.7)
static void SNNString(UShort_t sNN, TString &str)
THStack * MakeMBStack(const TCollection *sums, const TString &base)
void DrawTitlePage(TFile *file, Bool_t mc, Bool_t onlyMB)
TObject * DrawInPad(TVirtualPad *c, Int_t padNo, TObject *h, Option_t *opts="", UInt_t flags=0x0, const char *title="")
static TCollection * GetCollection(const TObject *parent, const TString &name, Bool_t verb=true)
THStack * CleanStack(const THStack *stack, TLegend *l, const TAxis *axis)
void DrawCentRes(const TCollection *sums, const TString &base, Float_t cLow, Float_t cHigh)
static THStack * GetStack(const TObject *parent, const TString &name, const char *sub=0, Bool_t verb=true)
void DrawCentSum(const TCollection *sums, const TString &base, Float_t cLow, Float_t cHigh)