7 const char* full = Form(
"$ALICE_PHYSICS/PWGLF/FORWARD/analysis2/dndeta/%s",
9 TImage* dimg = TImage::Open(
gSystem->ExpandPathName(full));
11 Error(
"Failed to open image file: %s", img);
15 UInt_t w = (dimg ? dimg->GetWidth() : 1000);
16 UInt_t h = (dimg ? dimg->GetHeight() : 900);
17 Printf(
"Canvas size: (%dx%d)", w, h);
18 TCanvas*
c =
new TCanvas(name, title, w, h);
19 c->SetTopMargin(0.01);
20 c->SetRightMargin(0.01);
32 TPad* p =
new TPad(
"overlay",
"Overlay", 0, 0, 1, 1, 0, 0, 0);
36 p->SetTopMargin(0.01);
37 p->SetRightMargin(0.01);
48 if (r < 1e-3)
return c;
51 TVirtualPad* p = c->cd(1);
52 p->SetPad(0, r , 1, 1);
53 p->SetBottomMargin(0.001);
54 p->SetTopMargin(0.01);
55 p->SetRightMargin(0.01);
61 p->SetPad(0, 0, 1, r);
63 p->SetRightMargin(0.01);
64 p->SetBottomMargin(p->GetBottomMargin()/yp);
80 dl =
new TLegend(.12, .65, .35, .93);
87 e = dl->AddEntry(
"dummy",
"PWGLF/GEO",
"p");
88 e->SetMarkerStyle(20);
89 e->SetMarkerSize(1.5);
90 e = dl->AddEntry(
"dummy",
"PWGPP/GLOB",
"p");
91 e->SetMarkerStyle(21);
92 e->SetMarkerSize(1.5);
95 const char* trigs[] = {
"CENTV0A", 0 };
96 const char* exps[] = {
"ALICE",
"WIP", 0 };
99 if (!pair || !pair->Key()) {
100 Error(
"",
"Didn't get the results");
103 THStack* data =
static_cast<THStack*
>(pair->Key());
104 TMultiGraph* other =
static_cast<TMultiGraph*
>(pair->Value());
105 TString tit = Form(
"pPb %s %s", data->GetTitle(), trigs[0]);
106 other->GetListOfGraphs()->Sort();
110 if (!sumLast)
return pair;
112 TList* hl = data->GetHists();
113 TList* ol = other->GetListOfGraphs();
114 TH1* h6080 =
static_cast<TH1*
>(hl->At(hl->GetEntries()-1));
115 TH1* h8099 =
static_cast<TH1*
>(hl->At(hl->GetEntries()-2));
123 TH1* h6099 =
Average(
"h6099",
"(*) 60%-90%", h6080, .25, h8099, .75);
128 TList* el = dl->GetListOfPrimitives();
129 el->Remove(el->Last());
130 el->Remove(el->Last());
131 dl->AddEntry(h6099, h6099->GetTitle(),
"pl");
138 THStack* data =
static_cast<THStack*
>(pair->Key());
139 TMultiGraph* other =
static_cast<TMultiGraph*
>(pair->Value());
141 data->Draw(
"nostack");
142 data->GetHistogram()->SetXTitle(
"#it{#eta}");
143 data->GetHistogram()->GetYaxis()->SetTitleOffset(1.1);
144 data->GetHistogram()->SetYTitle(
"1/#it{N} d#it{N}_{ch}/d#it{#eta}");
145 if (other) other->Draw(
"p");
148 data->SetMaximum(max);
159 (overlay ?
"ATLAS_pPb_dndeta.png" : 0));
161 TVirtualPad* p = (overlay ? c->GetPad(10) :
c);
163 p->SetLeftMargin(0.15);
165 c->SetTopMargin(0.2);
166 p->SetLeftMargin(0.117);
167 p->SetRightMargin(0.016);
168 p->SetTopMargin(0.01);
169 p->SetBottomMargin(0.115);
175 TPair* pair =
GetUs(dl);
176 DrawUs(pair, dl, overlay ? 79.5 : 105);
179 TLegend* al =
new TLegend(.79, .65, .97, .93);
180 al->SetTextAlign(32);
184 al->SetBorderSize(0);
185 e = al->AddEntry(
"dummy",
"ATLAS",
"p");
186 e->SetMarkerStyle(22);
187 e->SetMarkerSize(1.5);
189 TLatex* ltx =
new TLatex(.97, .64,
"(read off arXiv/1403.5738v1)");
190 ltx->SetTextAlign(33);
191 ltx->SetTextColor(kGray+2);
193 ltx->SetTextSize(0.015);
196 TMultiGraph* mg =
ATLASpPb(
false, al);
201 THStack* s =
static_cast<THStack*
>(pair->Key());
203 s->GetHistogram()->SetMinimum(0);
204 s->GetHistogram()->GetXaxis()->SetRangeUser(-3,3);
206 static_cast<TFrame*
>(p->GetListOfPrimitives()->FindObject(
"TFrame"));
208 Warning(
"",
"No frame");
218 if (!overlay) c->Print(
"plots/alice_atlas_v0a.pdf");
219 c->Print(
"plots/alice_atlas_v0a.png");
220 c->Print(
"plots/alice_atlas_v0a.C");
226 TGraph* perip =
static_cast<TGraph*
>(mg->GetListOfGraphs()->Last());
228 Error(
"",
"No periphiral bin found!");
231 TMultiGraph* rmg =
new TMultiGraph;
232 rmg->SetName(mg->GetName());
233 rmg->SetTitle(mg->GetTitle());
236 TIter next(mg->GetListOfGraphs());
238 while ((g = static_cast<TGraph*>(next()))) {
239 if (g == perip)
continue;
241 r->SetFillStyle(3002);
242 r->SetLineColor(g->GetMarkerColor());
243 rmg->Add(r,
"p 1 z");
245 TFitResultPtr fit = r->Fit(func,
"Q0S+");
246 TF1* f = r->GetListOfFunctions()->FindObject(func)->Clone();
247 Printf(
"%s | %f | %f +/- %f | %f +/- %f | %f +/- %f | %p",
249 fit->Chi2()/fit->Ndf(),
250 fit->Parameter(0), fit->ParError(0),
251 fit->Parameter(1), fit->ParError(1),
252 fit->Parameter(2), fit->ParError(2), f);
253 rmg->GetListOfFunctions()->Add(f);
260 TH1* perip =
static_cast<TH1*
>(mg->GetHists()->Last());
262 Error(
"",
"No periphiral bin found!");
265 THStack* rmg =
new THStack(mg->GetName(), mg->GetTitle());
268 TIter next(mg->GetHists());
270 while ((g = static_cast<TH1*>(next()))) {
271 if (g == perip)
continue;
272 TH1* r =
static_cast<TH1*
>(g->Clone());
275 r->SetFillStyle(3002);
276 r->SetLineColor(g->GetMarkerColor());
280 TFitResultPtr fit = r->Fit(func,
"Q0S+");
281 TF1* f = r->GetListOfFunctions()->FindObject(func);
282 Printf(
"%s | %f | %f +/- %f | %f +/- %f | %f +/- %f | %p",
284 fit->Chi2()/fit->Ndf(),
285 fit->Parameter(0), fit->ParError(0),
286 fit->Parameter(1), fit->ParError(1),
287 fit->Parameter(2), fit->ParError(2), f);
288 if (l) l->Add(f->Clone());
297 TCanvas*
c =
MakeCanvas(
"ratio",
"ATLAS dN/deta|cp",
298 (overlay ?
"ATLAS_pPb_dndeta_cp.png" : 0));
299 TVirtualPad* p = (overlay ? c->GetPad(10) :
c);
301 p->SetLeftMargin(0.15);
303 p->SetLeftMargin(0.123);
304 p->SetRightMargin(0.0175);
305 p->SetTopMargin(0.005);
306 p->SetBottomMargin(0.11);
310 TLegend* al =
new TLegend(.18, .65, .4, .93);
311 al->SetTextAlign(32);
315 al->SetBorderSize(0);
316 e = al->AddEntry(
"dummy",
"ATLAS",
"p");
317 e->SetMarkerStyle(22);
318 e->SetMarkerSize(1.5);
319 al->GetListOfPrimitives()->Remove(al->GetListOfPrimitives()->Last());
321 TMultiGraph* mg =
ATLASpPb(
false, al);
323 rmg->SetTitle(Form(
"%s pPb ratio to peripheral", mg->GetTitle()));
325 rmg->GetListOfFunctions()->Draw(
"same");
327 const char* dndeta =
"1/#it{N} d#it{N}_{ch}/d#it{#eta}";
328 rmg->GetHistogram()->GetXaxis()->SetTitle(
"#it{#eta}");
329 rmg->GetHistogram()->SetYTitle(Form(
"#frac{%s|_{#it{c}}}{%s|_{60%%-90%%}}",
331 rmg->GetHistogram()->GetYaxis()->SetTitleOffset(1.4);
333 al->GetListOfPrimitives()->Remove(al->GetListOfPrimitives()->Last());
336 TLatex* ltx =
new TLatex(.97, .14,
"(read off arXiv/1403.5738v1)");
337 ltx->SetTextAlign(33);
338 ltx->SetTextColor(kGray+2);
340 ltx->SetTextSize(0.015);
344 rmg->GetHistogram()->SetMaximum(9.9);
345 rmg->GetHistogram()->SetMinimum(0);
347 static_cast<TFrame*
>(p->GetListOfPrimitives()->FindObject(
"TFrame"));
349 Warning(
"",
"No frame");
363 if (!overlay) c->Print(
"plots/alice_atlas_cp_v0a.pdf");
364 c->Print(
"plots/alice_atlas_cp_v0a.png");
365 c->Print(
"plots/alice_atlas_cp_v0a.C");
379 rat->SetMarkerStyle(num->GetMarkerStyle());
380 rat->SetMarkerSize(num->GetMarkerSize());
392 rat->SetMarkerStyle(num->GetMarkerStyle());
393 rat->SetMarkerSize(num->GetMarkerSize());
400 Add2Ratio(mg, static_cast<TH1*>(hl->At(idx)), g);
407 Add2Ratio(mg, static_cast<TGraphErrors*>(gl->FindObject(name)),g);
414 TCanvas*
c =
MakeCanvas(
"averaged",
"ATLAS & ALICE (averaged)", 0, yp);
417 TLegend* dl =
new TLegend(.12, .6, .35, .93);
418 dl->SetTextAlign(32);
422 dl->SetBorderSize(0);
423 TLegendEntry* e = dl->AddEntry(
"dummy",
"ATLAS (resummed)",
"p");
424 e->SetMarkerStyle(22);
425 e->SetMarkerSize(1.7);
427 TPair* pair =
GetUs(dl,
true);
428 THStack* data =
static_cast<THStack*
>(pair->Key());
429 TMultiGraph* other =
static_cast<TMultiGraph*
>(pair->Value());
434 TIter nextG(mg->GetListOfGraphs());
435 TIter nextO(other->GetListOfGraphs());
436 TIter nextH(data->GetHists());
440 TMultiGraph* ratios =
new TMultiGraph();
442 while ((g = static_cast<TGraphErrors*>(nextG())) &&
443 (o = static_cast<TGraphErrors*>(nextO())) &&
444 (h = static_cast<TH1*>(nextH()))) {
445 g->SetMarkerColor(h->GetMarkerColor());
446 g->SetLineColor(h->GetLineColor());
449 Printf(
"%s %s %s", g->GetName(), o->GetName(), h->GetName());
452 TLatex* ltx =
new TLatex(.15, .6,
453 "#splitline{(ATLAS read off arXiv/1403.5738v1}"
454 "{Averaged w/centrality bin width)}");
455 ltx->SetTextAlign(13);
456 ltx->SetTextColor(kGray+2);
458 ltx->SetTextSize(0.015);
461 ltx->DrawLatex(.15, .56,
462 "#splitline{(*) For ALICE: Weighted sum}"
463 "{of 60-80% and 80-100%}");
469 band->SetPoint(0,-3.95,1);
470 band->SetPoint(1,5.95,1);
471 band->SetPointError(0,0,.05);
472 band->SetPointError(1,0,.05);
473 band->SetFillColor(kYellow-10);
474 band->SetFillStyle(1001);
475 band->SetLineStyle(2);
476 ratios->GetListOfGraphs()->AddFirst(band,
"3l");
479 TAxis* yaxis = ratios->GetHistogram()->GetYaxis();
480 TAxis* xaxis = ratios->GetHistogram()->GetXaxis();
481 yaxis->SetTitle(
"ALICE/ATLAS");
482 yaxis->SetLabelSize(yaxis->GetLabelSize()/yp);
483 yaxis->SetTitleSize(yaxis->GetTitleSize()/yp);
484 yaxis->SetTitleOffset(yaxis->GetTitleOffset()*yp);
485 xaxis->SetTitle(
"#eta");
486 xaxis->Set(200, -4, 6);
487 xaxis->SetLabelSize(xaxis->GetLabelSize()/yp);
488 xaxis->SetTitleSize(xaxis->GetTitleSize()/yp);
489 band->Draw(
"same l");
495 c->Print(
"plots/alice_watlas_v0a.pdf");
496 c->Print(
"plots/alice_watlas_v0a.C");
497 c->Print(
"plots/alice_watlas_v0a.png");
504 TCanvas*
c =
MakeCanvas(
"ratioboth",
"ATLAS & ALICE dN/deta|cp", 0, yp);
505 c->SetLeftMargin(0.15);
508 TLegend* dl =
new TLegend(.12, .6, .35, .93);
509 dl->SetTextAlign(32);
513 dl->SetBorderSize(0);
514 TLegendEntry* e = dl->AddEntry(
"dummy",
"ATLAS (resummed)",
"p");
515 e->SetMarkerStyle(22);
516 e->SetMarkerSize(1.7);
517 TPair* pair =
GetUs(dl,
true);
518 THStack* data =
static_cast<THStack*
>(pair->Key());
519 TMultiGraph* other =
static_cast<TMultiGraph*
>(pair->Value());
526 rmg->SetTitle(Form(
"%s pPb ratio to peripheral", mg->GetTitle()));
528 rdata->Draw(
"nostack");
531 rother->GetListOfFunctions()->Draw(
"same");
533 dl->GetListOfPrimitives()->Remove(dl->GetListOfPrimitives()->Last());
535 rdata->SetMaximum(9.1);
537 const char* dndeta =
"1/#it{N} d#it{N}_{ch}/d#it{#eta}";
538 rdata->GetHistogram()->GetXaxis()->SetTitle(
"#it{#eta}");
539 rdata->GetHistogram()->SetYTitle(Form(
"#frac{%s|_{#it{c}}}"
540 "{%s|_{60%%-90%% (*)}}",
542 rdata->GetHistogram()->GetYaxis()->SetTitleOffset(1.4);
544 TLatex* ltx =
new TLatex(.15, .6,
545 "#splitline{(ATLAS read off arXiv/1403.5738v1}"
546 "{Averaged w/centrality bin width)}");
547 ltx->SetTextAlign(13);
548 ltx->SetTextColor(kGray+2);
550 ltx->SetTextSize(0.015);
553 ltx->DrawLatex(.15, .56,
554 "#splitline{(*) For ALICE: Weighted sum}"
555 "{of 60-80% and 80-100%}");
557 TIter nextG(rmg->GetListOfGraphs());
558 TIter nextO(rother->GetListOfGraphs());
559 TIter nextH(rdata->GetHists());
563 TMultiGraph* ratios =
new TMultiGraph();
565 while ((g = static_cast<TGraphErrors*>(nextG())) &&
566 (o = static_cast<TGraphErrors*>(nextO())) &&
567 (h = static_cast<TH1*>(nextH()))) {
568 g->SetMarkerColor(h->GetMarkerColor());
569 g->SetLineColor(h->GetLineColor());
572 Printf(
"%s %s %s", g->GetName(), o->GetName(), h->GetName());
579 band->SetPoint(0,-3.95,1);
580 band->SetPoint(1,5.95,1);
581 band->SetPointError(0,0,.05);
582 band->SetPointError(1,0,.05);
583 band->SetFillColor(kYellow-10);
584 band->SetFillStyle(1001);
585 band->SetLineStyle(2);
586 ratios->GetListOfGraphs()->AddFirst(band,
"3l");
589 TAxis* yaxis = ratios->GetHistogram()->GetYaxis();
590 TAxis* xaxis = ratios->GetHistogram()->GetXaxis();
591 yaxis->SetTitle(
"ALICE/ATLAS");
592 yaxis->SetLabelSize(yaxis->GetLabelSize()/yp);
593 yaxis->SetTitleSize(yaxis->GetTitleSize()/yp);
594 yaxis->SetTitleOffset(yaxis->GetTitleOffset()*yp);
595 xaxis->SetTitle(
"#eta");
596 xaxis->Set(200, -4, 6);
597 xaxis->SetLabelSize(xaxis->GetLabelSize()/yp);
598 xaxis->SetTitleSize(xaxis->GetTitleSize()/yp);
599 band->Draw(
"same l");
605 c->Print(
"plots/alice_watlas_cp_v0a.pdf");
606 c->Print(
"plots/alice_watlas_cp_v0a.C");
607 c->Print(
"plots/alice_watlas_cp_v0a.png");
614 gROOT->SetMacroPath(Form(
"%s:%s", gROOT->GetMacroPath(),
615 "$ALICE_PHYSICS/PWGLF/FORWARD/analysis2/dndeta"));
616 gROOT->LoadMacro(
"Drawer.C+g");
617 gROOT->LoadMacro(
"ATLASpPb.C");
TMultiGraph * ATLASpPb(Bool_t draw=false, TLegend *l=0)
static TPair * GetDataOther(TLegend *leg, TObjArray &unique, const TString &system, UShort_t sNN, const char **trigs, const char **exps, Option_t *errOpt="e5", Bool_t rebinned=false, Bool_t empirical=true, const Double_t *effs=0)
TMultiGraph * ATLASpPbResum(Bool_t draw=false, TLegend *l=0)
void DrawOrigATLAS(Bool_t overlay=false)
TCanvas * MakeCanvas(const char *name, const char *title, const char *img=0, Double_t r=0)
static TGraphErrors * H2G(TH1 *h, Double_t xOff, Int_t sign=1)
TPair * GetUs(TLegend *&dl, Bool_t sumLast=false)
void DrawUs(TPair *pair, TLegend *dl, Double_t max=105)
static TGraph * GOverG(const TGraph *num, const TGraph *den, const TGraph *dlow, const TGraph *dup, Double_t dx=0)
void DrawOrigATLASRatio(Bool_t overlay=false)
static void ErrorGraphs(const TGraph *g, TGraph *&low, TGraph *&up)
void DrawATLAS(Bool_t overlay=false)
void Add2Ratio(TMultiGraph *mg, TH1 *num, TGraphErrors *den)
TGraphErrors * Average(const char *name, const char *title, TGraphErrors *g1, Double_t w1, TGraphErrors *g2, Double_t w2)
static void AddSystematics(THStack *stack, Double_t sys)
TMultiGraph * Ratio2Peripheral(TMultiGraph *mg, const char *func=0)