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()))) {
483 TF1* dc =
static_cast<TF1*
>(
GetObject(c,
"deltaCorr"));
484 TF1* vw =
static_cast<TF1*
>(
GetObject(s,
"ipZw"));
485 TProfile* sc =
static_cast<TProfile*
>(
GetObject(s,
"sumVsC"));
486 if (vw) vw->SetRange(-4,6);
493 fBody->Divide(nPad,1);
496 if (dc)
DrawInPad(
fBody, iPad++, dc,
"", 0,
"\\hbox{IP} \\delta_{xy}");
500 DrawParameter(y,
"#mu_{Z}", Form(
"%5.3f", vw->GetParameter(0)));
501 DrawParameter(y,
"#sigma_{Z}", Form(
"%5.3f", vw->GetParameter(1)));
502 DrawParameter(y,
"#mu_{Z,ref}", Form(
"%5.3f", vw->GetParameter(2)));
503 DrawParameter(y,
"#sigma_{Z,ref}", Form(
"%5.3f", vw->GetParameter(3)));
506 PrintCanvas(Form(
"%s results - corrections", base.Data()));
510 if (centAxis && centAxis->GetNbins() < 1) centAxis = 0;
512 THStack* dndeta_ =
GetStack(c,
"dndeta");
513 if (!dndeta_ || !dndeta_->GetHists() ||
514 dndeta_->GetHists()->GetEntries() < 0)
return 0;
516 TLegend* l =
new TLegend(0.1, 0.1, 0.9, 0.9,
517 onlyMB || !centAxis?
"" :
"Centralities");
521 THStack* dndeta =
CleanStack(dndeta_, l, centAxis);
523 THStack* dndetaEmp =
GetStack(c,
"dndetaEmp");
524 if (!dndetaEmp || !dndetaEmp->GetHists() ||
525 dndetaEmp->GetHists()->GetEntries() < 0) dndetaEmp = 0;
527 THStack* leftRight =
GetStack(c,
"leftRight");
528 if (!leftRight || !leftRight->GetHists() ||
529 leftRight->GetHists()->GetEntries() < 0) leftRight = 0;
536 TPad* p1 =
new TPad(
"p1",
"p1", 0, y1, x2, 1, 0, 0);
537 TPad* p2 =
new TPad(
"p2",
"p2", x1, 0, 1, y2, 0, 0);
550 "\\mathrm{d}N_{\\mathrm{ch}}/\\mathrm{d}\\eta|"
551 "_{\\mathrm{incl}}");
553 "\\mathrm{d}N_{\\mathrm{ch}}/\\mathrm{d}\\eta|"
554 "_{\\mathrm{prim}}");
555 DrawInPad(p1, 3, leftRight,
"nostack", 0,
"Left/Right");
556 p1->GetPad(1)->SetGridx();
557 p1->GetPad(2)->SetGridx();
558 p1->GetPad(3)->SetGridx();
560 PrintCanvas(Form(
"%s results - stacks", base.Data()));
563 Int_t cLow = centAxis ? centAxis->GetXmin() : 0;
564 Int_t cHigh = centAxis ? -centAxis->GetXmax() : -100;
566 if (onlyMB || !centAxis) {
572 for (
Int_t i = 1; i <= centAxis->GetNbins(); i++)
574 centAxis->GetBinUpEdge(i));
585 TH1* dndeta =
GetH1(c, Form(
"dndeta%s",base.Data()));
586 if (!dndeta)
return 0;
588 THStack* ret =
new THStack(
"dndetaMB", title);
591 if (base.EqualTo(
"MCTruth")) {
592 dndeta =
GetH1(c,
"dndetaTruth");
593 if (dndeta) ret->Add(dndeta);
610 TH1* norm =
GetH1(c, Form(
"norm%s",base.Data()));
611 TH1* dndeta =
GetH1(c, Form(
"dndeta%s",base.Data()));
612 TH1* dndetaEmp =
GetH1(c, Form(
"dndeta%sEmp",base.Data()));
613 TH2* d2ndetadphi =
GetH2(c, Form(
"d2Ndetadphi%s", base.Data()));
614 if (!trig || !norm || !dndeta || !d2ndetadphi)
return;
615 if (norm->GetEntries() <= 0)
return;
617 norm->SetFillColor(kGreen+1);
618 norm->SetFillStyle(3001);
621 fBody->Divide(2, (dndetaEmp ? 4 : 3), 0.05, 0);
624 TVirtualPad* p =
fBody->GetPad(trP);
625 p->SetBottomMargin(0.15);
626 p->SetLeftMargin(0.15);
627 if (trP > 2) p->SetTopMargin(0.05);
631 "d^{2}#it{N}/d#it{#eta}d#it{phi}|_{incl}");
634 "d#it{N}_{ch}/d#it{#eta}|_{incl}");
636 fBody->GetPad(2)->SetGridx();
637 fBody->GetPad(4)->SetGridx();
638 fBody->GetPad(6)->SetGridx();
639 fBody->GetPad(2)->SetLeftMargin(0.15);
640 fBody->GetPad(4)->SetLeftMargin(0.15);
641 fBody->GetPad(6)->SetLeftMargin(0.15);
642 fBody->GetPad(4)->SetRightMargin(0.15);
643 fBody->GetPad(6)->SetRightMargin(0.15);
646 "d#it{N}_{ch}/d#it{#eta}|_{prim}");
647 fBody->GetPad(8)->SetGridx();
648 fBody->GetPad(8)->SetLeftMargin(0.15);
649 fBody->GetPad(8)->SetRightMargin(0.15);
653 TString calc = normCalc ? normCalc->GetTitle() :
"?";
656 calc.ReplaceAll(
"beta",
"#beta");
657 calc.ReplaceAll(
"eps",
"#varepsilon");
658 const char* sufs[] = {
"all",
"acc",
"trg",
"vtx",
"B",
"A",
"C",
"E",
660 const char** suf = sufs;
662 calc.ReplaceAll(Form(
"_%s", *suf), Form(
"_{%s}", *suf));
667 p->SetPad(p->GetXlowNDC(), 0,
668 p->GetXlowNDC()+p->GetWNDC(), p->GetYlowNDC()+p->GetHNDC());
669 fBody->GetPad(5)->Delete();
670 if (dndetaEmp)
fBody->GetPad(7)->Delete();
674 TObjString* sline = 0;
681 while ((sline = static_cast<TObjString*>(next()))) {
683 TString& line = sline->String();
684 Ssiz_t eq = line.Last(
'=');
690 TString val = line(eq+1,line.Length()-eq-1);
711 TString title = TString::Format(
"%s - details: ", base.Data());
715 Warning(
"",
"Collection partical not found in %s", sums->GetName());
720 fBody->Divide(3, 1, 0.05, 0);
722 const char* typs[] = {
"",
"0",
"All" };
723 const char* tits[] = {
"Non-zero events",
"Zero events",
"Weighted sum" };
724 for (
Int_t i = 1; i <= 3; i++) {
725 const char* suf = typs[i-1];
726 TVirtualPad* p =
fBody->cd(i);
727 p->SetTopMargin(0.10);
729 TLatex* ltx =
new TLatex(0.5, .99, tits[i-1]);
731 ltx->SetTextAlign(23);
732 ltx->SetTextSize(0.05);
735 TH1* sum =
GetH2(c, Form(
"sum%s", suf));
736 TH1* norm =
GetH1(c, Form(
"norm%s", suf));
737 TH1* phi =
GetH1(c, Form(
"phi%s", suf));
739 norm->SetFillColor(kGreen+1);
740 norm->SetFillStyle(3002);
741 phi->SetFillColor(kBlue+1);
742 phi->SetFillStyle(3001);
744 p->Divide(1, 3, 0, 0);
745 DrawInPad(p, 1, sum, sum->Integral()>0 ?
"col" :
"", 0,
746 "d^{2}#it{N}_{ch}/d#it{#varphi}d#it{#eta}");
748 "d#it{N}_{ch}/d#it{#eta}");
749 DrawInPad(p, 3, norm,
"", 0,
"#eta-coverage/#varphi-acceptance");
758 if (!stack)
return 0;
759 THStack* ret =
new THStack(stack->GetName(), stack->GetTitle());
760 TList* hists = stack->GetHists();
765 while ((h = static_cast<TH1*>(next()))) {
768 if (nme.Contains(
"_mirror", TString::kIgnoreCase)) {
776 if (j > axis->GetNbins())
779 name.Form(
"%3d%% - %3d%%",
780 Int_t(axis->GetBinLowEdge(bin)),
781 Int_t(axis->GetBinUpEdge(bin)));
782 ok = axis->GetBinUpEdge(bin) > 100;
785 name.ReplaceAll(
"ALICE",
"");
786 name.ReplaceAll(
"dNdeta",
" - work in progress");
789 TLegendEntry* e = l->AddEntry(
"dummy", name,
"f");
790 e->SetFillStyle(1001);
791 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)