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);
151 TLatex* ltN =
new TLatex(.5, y, Form(
"(%s)", tN->GetTitle()));
152 ltN->SetTextSize(0.05);
153 ltN->SetTextFont(82);
154 ltN->SetTextAlign(22);
160 ltx =
new TLatex(.5, y,
"Simulation input");
162 ltx->SetTextAlign(23);
163 ltx->SetTextFont(42);
164 ltx->SetTextSize(.03);
169 ltx =
new TLatex(.5, y,
"No centrality");
171 ltx->SetTextAlign(23);
172 ltx->SetTextFont(42);
173 ltx->SetTextSize(.03);
183 void DrawBoth(THStack* rC, THStack* rF, THStack* rM,
191 TPad* p1 =
new TPad(
"p1",
"p1", 0, y1, x2, 1, 0, 0);
192 TPad* p2 =
new TPad(
"p2",
"p2", x1, 0, 1, y2, 0, 0);
200 TIter nextM(rM->GetHists());
201 while ((h = static_cast<TH1*>(nextM()))) rC->Add(h);
204 TIter next(rF->GetHists());
205 while ((h = static_cast<TH1*>(next()))) rC->Add(h);
217 UShort_t cLow = centAxis && !onlyMB ? centAxis->GetXmin() : 0;
218 UShort_t cHigh = centAxis && !onlyMB ? centAxis->GetXmax() : 100;
223 TMultiGraph* other = 0;
226 Int_t oT = (trigger == 0x2000) ? 0x4 : trigger;
227 TString oC = Form(
"RefData::GetData(%hu,%hu,%hu,%hu,%hu,0xF)",
228 sys, sNN, oT, cLow, cHigh);
229 other =
reinterpret_cast<TMultiGraph*
>(gROOT->ProcessLine(oC));
232 other =
new TMultiGraph(
"other",
"");
233 Int_t nCent = centAxis->GetNbins();
234 for (
Int_t i = 1; i <= nCent; i++) {
235 TString oC = Form(
"RefData::GetData(%hu,%hu,%hu,%hu,%hu,0xF)",
236 sys, sNN, 0,
UShort_t(centAxis->GetBinLowEdge(i)),
237 UShort_t(centAxis->GetBinUpEdge(i)));
239 reinterpret_cast<TMultiGraph*
>(gROOT->ProcessLine(oC));
240 if (oM) other->Add(oM);
252 TIter nextG(other->GetListOfGraphs());
253 while ((g = nextG())) {
255 g->DrawClone(
"same p");
264 TLegend* l =
new TLegend(0.01, 0.1, 0.99, 0.99,
265 onlyMB || !centAxis ?
"" :
"Centralities");
272 TIter nextG(other->GetListOfGraphs());
274 while ((g = nextG())) {
275 if (seen.Index(g->GetTitle()) != kNPOS)
continue;
276 seen.Append(Form(
"|%s", g->GetTitle()));
277 TLegendEntry* e = l->AddEntry(
"dummy", g->GetTitle(),
"p");
279 e->SetMarkerStyle(gg->GetMarkerStyle());
280 e->SetMarkerSize(gg->GetMarkerSize());
281 e->SetMarkerColor(kBlack);
295 if (centAxis && centAxis->GetNbins() < 1) centAxis = 0;
303 if (!onlyMB && centAxis) {
309 for (
Int_t i = 1; i <= centAxis->GetNbins(); i++) {
311 Form(
"%3d%% - %3d%%",
312 Int_t(centAxis->GetBinLowEdge(i)),
313 Int_t(centAxis->GetBinUpEdge(i))), size);
317 cent->GetXaxis()->SetRangeUser(0,100);
318 cent->SetFillColor(kRed+1);
319 cent->SetFillStyle(3002);
320 cent->SetXTitle(
"Centrality [%]");
321 cent->SetYTitle(
"Events");
322 cent->SetMaximum(1.3*cent->GetMaximum());
324 centAcc->SetFillStyle(3002);
326 TLatex* overUnder =
new TLatex(0.15, .88,
327 Form(
"#splitline{<0: %d}{>100: %d}",
328 int(cent->GetBinContent(1)),
329 int(cent->GetBinContent(102))));
330 overUnder->SetTextColor(kRed+1);
332 overUnder->SetTextAlign(13);
333 overUnder->SetTextFont(42);
334 TLatex* overUnderAcc =
new TLatex(0.3, .88,
335 Form(
"#splitline{<0: %d}{>100: %d}",
336 int(centAcc->GetBinContent(1)),
337 int(centAcc->GetBinContent(102))));
338 overUnderAcc->SetTextColor(kGreen+1);
339 overUnderAcc->SetNDC();
340 overUnderAcc->SetTextAlign(13);
341 overUnderAcc->SetTextFont(42);
359 if (scheme == 0) schemeString =
"1/N_{accepted}";
360 if (scheme & 0x1) schemeString.Append(
"1/#epsilon_{V}1/#epsilon_{T}");
361 if (scheme & 0x2) schemeString.Append(
"Shape ");
362 if (scheme & 0x4) schemeString.Append(
"A+C-E ");
363 if (scheme & 0x8) schemeString.Append(
"#epsilon_{T,MC} ");
364 if (scheme & 0x10) schemeString.Append(
"0-bin");
379 Int_t cLow = centAxis ? centAxis->GetXmin() : 0;
380 Int_t cHigh = centAxis ? -centAxis->GetXmax() : -100;
382 if (onlyMB || !centAxis)
return;
384 for (
Int_t i = 1; i <= centAxis->GetNbins(); i++)
386 centAxis->GetBinUpEdge(i));
403 if (!bin0 || !bin || !trig || !type)
return;
405 type->SetFillStyle(3001);
406 type->SetFillColor(kGreen+1);
414 if (bin0->GetEntries() <= 0) {
435 if (!onlyMB && centAxis) {
437 for (
Int_t i = 1; i <= centAxis->GetNbins(); i++) {
439 Form(
"%6.2f%% - %6.2f%%",
440 centAxis->GetBinLowEdge(i),
441 centAxis->GetBinUpEdge(i)), size);
449 DrawParameter(y,
"Trigger",(oTrg ? oTrg->GetTitle() :
"?"), size);
451 TString scheme = oscheme ? oscheme->GetTitle() :
"";
452 if (scheme.IsNull()) scheme =
"1/N_{accepted}";
459 DrawParameter(y,
"#epsilon_{T,zero bin}", Form(
"%5.3f", epsT0), size);
462 DrawParameter(y,
"IP #delta_{xy}", Form(
"%5.3fmm", deltaIP), size);
465 TString opts(options->GetTitle());
467 TObjString*
opt = 0;;
470 while ((opt = static_cast<TObjString*>(oNext()))) {
496 TF1* dc =
static_cast<TF1*
>(
GetObject(c,
"deltaCorr"));
497 TF1* vw =
static_cast<TF1*
>(
GetObject(s,
"ipZw"));
498 TProfile* sc =
static_cast<TProfile*
>(
GetObject(s,
"sumVsC"));
499 if (vw) vw->SetRange(-4,6);
506 fBody->Divide(nPad,1);
509 if (dc)
DrawInPad(
fBody, iPad++, dc,
"", 0,
"\\hbox{IP} \\delta_{xy}");
513 DrawParameter(y,
"#mu_{Z}", Form(
"%5.3f", vw->GetParameter(0)));
514 DrawParameter(y,
"#sigma_{Z}", Form(
"%5.3f", vw->GetParameter(1)));
515 DrawParameter(y,
"#mu_{Z,ref}", Form(
"%5.3f", vw->GetParameter(2)));
516 DrawParameter(y,
"#sigma_{Z,ref}", Form(
"%5.3f", vw->GetParameter(3)));
519 PrintCanvas(Form(
"%s results - corrections", base.Data()));
523 if (centAxis && centAxis->GetNbins() < 1) centAxis = 0;
525 THStack* dndeta_ =
GetStack(c,
"dndeta");
526 if (!dndeta_ || !dndeta_->GetHists() ||
527 dndeta_->GetHists()->GetEntries() < 0)
return 0;
529 TLegend* l =
new TLegend(0.1, 0.1, 0.9, 0.9,
530 onlyMB || !centAxis?
"" :
"Centralities");
534 THStack* dndeta =
CleanStack(dndeta_, l, centAxis);
536 THStack* dndetaEmp =
GetStack(c,
"dndetaEmp");
537 if (!dndetaEmp || !dndetaEmp->GetHists() ||
538 dndetaEmp->GetHists()->GetEntries() < 0) dndetaEmp = 0;
540 THStack* leftRight =
GetStack(c,
"leftRight");
541 if (!leftRight || !leftRight->GetHists() ||
542 leftRight->GetHists()->GetEntries() < 0) leftRight = 0;
543 if (leftRight) { leftRight->SetMinimum(0.8); leftRight->SetMaximum(1.2); }
550 TPad* p1 =
new TPad(
"p1",
"p1", 0, y1, x2, 1, 0, 0);
551 TPad* p2 =
new TPad(
"p2",
"p2", x1, 0, 1, y2, 0, 0);
564 "\\mathrm{d}N_{\\mathrm{ch}}/\\mathrm{d}\\eta|" 565 "_{\\mathrm{incl}}");
567 "\\mathrm{d}N_{\\mathrm{ch}}/\\mathrm{d}\\eta|" 568 "_{\\mathrm{prim}}");
569 DrawInPad(p1, 3, leftRight,
"nostack", 0,
"Left/Right");
570 p1->GetPad(1)->SetGridx();
571 p1->GetPad(2)->SetGridx();
572 p1->GetPad(3)->SetGridx();
573 p1->GetPad(1)->SetGridy();
574 p1->GetPad(2)->SetGridy();
575 p1->GetPad(3)->SetGridy();
577 PrintCanvas(Form(
"%s results - stacks", base.Data()));
580 Int_t cLow = centAxis ? centAxis->GetXmin() : 0;
581 Int_t cHigh = centAxis ? -centAxis->GetXmax() : -100;
583 if (onlyMB || !centAxis) {
589 for (
Int_t i = 1; i <= centAxis->GetNbins(); i++)
591 centAxis->GetBinUpEdge(i));
602 TH1* dndeta =
GetH1(c, Form(
"dndeta%s",base.Data()));
603 if (!dndeta)
return 0;
605 THStack* ret =
new THStack(
"dndetaMB", title);
608 if (base.EqualTo(
"MCTruth")) {
609 dndeta =
GetH1(c,
"dndetaTruth");
610 if (dndeta) ret->Add(dndeta);
627 TH1* norm =
GetH1(c, Form(
"norm%s",base.Data()));
628 TH1* dndeta =
GetH1(c, Form(
"dndeta%s",base.Data()));
629 TH1* dndetaEmp =
GetH1(c, Form(
"dndeta%sEmp",base.Data()));
630 TH2* d2ndetadphi =
GetH2(c, Form(
"d2Ndetadphi%s", base.Data()));
631 if (!trig || !norm || !dndeta || !d2ndetadphi)
return;
632 if (norm->GetEntries() <= 0)
return;
634 norm->SetFillColor(kGreen+1);
635 norm->SetFillStyle(3001);
638 fBody->Divide(2, (dndetaEmp ? 4 : 3), 0.05, 0);
641 TVirtualPad* p =
fBody->GetPad(trP);
642 p->SetBottomMargin(0.15);
643 p->SetLeftMargin(0.15);
644 if (trP > 2) p->SetTopMargin(0.05);
648 "d^{2}#it{N}/d#it{#eta}d#it{phi}|_{incl}");
651 "d#it{N}_{ch}/d#it{#eta}|_{incl}");
653 fBody->GetPad(2)->SetGridx();
654 fBody->GetPad(4)->SetGridx();
655 fBody->GetPad(6)->SetGridx();
656 fBody->GetPad(2)->SetLeftMargin(0.15);
657 fBody->GetPad(4)->SetLeftMargin(0.15);
658 fBody->GetPad(6)->SetLeftMargin(0.15);
659 fBody->GetPad(4)->SetRightMargin(0.15);
660 fBody->GetPad(6)->SetRightMargin(0.15);
663 "d#it{N}_{ch}/d#it{#eta}|_{prim}");
664 fBody->GetPad(8)->SetGridx();
665 fBody->GetPad(8)->SetLeftMargin(0.15);
666 fBody->GetPad(8)->SetRightMargin(0.15);
670 TString calc = normCalc ? normCalc->GetTitle() :
"?";
673 calc.ReplaceAll(
"beta",
"#beta");
674 calc.ReplaceAll(
"eps",
"#varepsilon");
675 const char* sufs[] = {
"all",
"acc",
"trg",
"vtx",
"B",
"A",
"C",
"E",
677 const char** suf = sufs;
679 calc.ReplaceAll(Form(
"_%s", *suf), Form(
"_{%s}", *suf));
684 p->SetPad(p->GetXlowNDC(), 0,
685 p->GetXlowNDC()+p->GetWNDC(), p->GetYlowNDC()+p->GetHNDC());
686 fBody->GetPad(5)->Delete();
687 if (dndetaEmp)
fBody->GetPad(7)->Delete();
691 TObjString* sline = 0;
698 while ((sline = static_cast<TObjString*>(next()))) {
700 TString& line = sline->String();
701 Ssiz_t eq = line.Last(
'=');
707 TString val = line(eq+1,line.Length()-eq-1);
728 TString title = TString::Format(
"%s - details: ", base.Data());
732 Warning(
"",
"Collection partical not found in %s", sums->GetName());
737 fBody->Divide(3, 1, 0.05, 0);
739 const char* typs[] = {
"",
"0",
"All" };
740 const char* tits[] = {
"Non-zero events",
"Zero events",
"Weighted sum" };
741 for (
Int_t i = 1; i <= 3; i++) {
742 const char* suf = typs[i-1];
743 TVirtualPad* p =
fBody->cd(i);
744 p->SetTopMargin(0.10);
746 TLatex* ltx =
new TLatex(0.5, .99, tits[i-1]);
748 ltx->SetTextAlign(23);
749 ltx->SetTextSize(0.05);
752 TH1* sum =
GetH2(c, Form(
"sum%s", suf));
753 TH1* norm =
GetH1(c, Form(
"norm%s", suf));
754 TH1* phi =
GetH1(c, Form(
"phi%s", suf));
756 norm->SetFillColor(kGreen+1);
757 norm->SetFillStyle(3002);
758 phi->SetFillColor(kBlue+1);
759 phi->SetFillStyle(3001);
761 p->Divide(1, 3, 0, 0);
762 DrawInPad(p, 1, sum, sum->Integral()>0 ?
"col" :
"", 0,
763 "d^{2}#it{N}_{ch}/d#it{#varphi}d#it{#eta}");
765 "d#it{N}_{ch}/d#it{#eta}");
766 DrawInPad(p, 3, norm,
"", 0,
"#eta-coverage/#varphi-acceptance");
775 if (!stack)
return 0;
776 THStack* ret =
new THStack(stack->GetName(), stack->GetTitle());
777 TList* hists = stack->GetHists();
782 while ((h = static_cast<TH1*>(next()))) {
785 if (nme.Contains(
"_mirror", TString::kIgnoreCase)) {
793 if (j > axis->GetNbins())
796 name.Form(
"%3d%% - %3d%%",
797 Int_t(axis->GetBinLowEdge(bin)),
798 Int_t(axis->GetBinUpEdge(bin)));
799 ok = axis->GetBinUpEdge(bin) > 100;
802 name.ReplaceAll(
"ALICE",
"");
803 name.ReplaceAll(
"dNdeta",
" - work in progress");
806 TLegendEntry* e = l->AddEntry(
"dummy", name,
"f");
807 e->SetFillStyle(1001);
808 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)
TFile * file
TList with histograms for a given trigger.
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)