20 const char*
obs =
"\\mathrm{d}N_{\\mathrm{ch}}/\\mathrm{d}\\eta";
31 Printf(
"Content of %s - %s", h->GetName(), h->GetTitle());
32 for (
Int_t i = 1; i <= h->GetNbinsX(); i++) {
33 if (h->GetBinContent(i) <= 1e-6)
continue;
34 printf(
"%3d (%+6.3f): %.*f+/-%.*f\n", i,
35 h->GetXaxis()->GetBinCenter(i),
36 prec, h->GetBinContent(i),
37 prec, h->GetBinError(i));
44 Warning(
"GetHS",
"No directory");
50 if (!par.EqualTo(
".")) {
51 TDirectory* save =
dir;
52 dir = save->GetDirectory(par);
54 Warning(
"",
"Failed to get directory %s", par.Data());
61 Warning(
"GetHS",
"%s not found in %s", name, dir->GetName());
65 if (!o->IsA()->InheritsFrom(cls)) {
66 Warning(
"GetHS",
"%s is not a %s!", name, cls->GetName());
72 THStack*
GetHS(TDirectory*
dir,
const char* name=
"result")
74 return static_cast<THStack*
>(
GetO(dir,name,THStack::Class()));
78 return static_cast<TH1*
>(
GetO(dir,name,TH1::Class()));
83 const char* stackName=
"result",
86 const char*
filename = Form(
"results/combine_%s_0x%x.root", var, flags);
87 TFile*
file = TFile::Open(filename,
"READ");
90 THStack*
stack =
GetHS(file, Form(
"%s%s",sub,stackName));
93 return stack->GetHists();
99 const char*
filename = Form(
"results/combine_%s_0x%x.root", var, flags);
100 TFile*
file = TFile::Open(filename,
"READ");
103 return GetH1(file,
"mid");
108 const char*
filename = Form(
"results/combine_%s_0x%x.root", var, flags);
109 TFile*
file = TFile::Open(filename,
"READ");
112 return GetH1(file,
"cent");
117 TLine* l =
new TLine(h->GetXaxis()->GetXmin(), 1,
118 h->GetXaxis()->GetXmax(), 1);;
121 h->GetListOfFunctions()->Add(l);
127 TH1* r =
static_cast<TH1*
>(oth->Clone());
130 for (
Int_t i = 1; i <= def->GetNbinsX(); i++) {
131 Double_t cd = def->GetBinContent(i);
132 Double_t co = oth->GetBinContent(i);
135 if (cd < 1e-6 || co < 1e-6) {
136 r->SetBinContent(i, 0);
137 r->SetBinError (i, 0);
141 r->SetBinError(i, TMath::Max(ed/cd*ch,eo/co*ch));
154 if (!defs || !others)
return;
157 TIter nextOth(others);
158 THStack* result =
new THStack(Form(
"compare_%s_0x%x",
160 Form(
"\\hbox{%s vs. default }%s\\hbox{ %s}",
162 (flags & 0x3) == 0x3 ?
167 while ((def = static_cast<TH1*>(nextDef())) &&
168 (oth = static_cast<TH1*>(nextOth()))) {
169 if (noTruth &&
TString(def->GetName()).EqualTo(
"truth"))
continue;
170 def->SetName(
"default");
173 h->SetYTitle(Form(
"%s / default", var));
176 TCanvas*
c =
new TCanvas(result->GetName(),result->GetTitle(),
cW,
cH);
177 c->SetTopMargin(0.01);
178 c->SetRightMargin(0.01);
180 result->Draw(
"nostack");
181 result->GetHistogram()->SetMinimum(0.9);
182 result->GetHistogram()->SetMaximum(1.2);
183 result->GetHistogram()->GetYaxis()->SetTitleOffset(1.5);
184 result->GetHistogram()->SetXTitle(
"\\eta");
185 result->GetHistogram()->SetYTitle(Form(
"%s / default", var));
186 result->SetMinimum(0.9);
187 result->SetMaximum(1.1);
188 AddLine(result->GetHistogram());
190 c->Print(Form(
"plots/%s.png", result->GetName()));
196 Double_t bins[] = { 0., 5., 10., 20., 30., 40., 50., 60., 70., 80., };
197 Double_t vals[] = { 1948, 1590, 1180, 786, 512, 318, 183, 96.3, 44.9, };
198 Double_t errs[] = { 38, 32, 31, 20, 15, 12, 8, 5.8, 3.4, };
199 TH1* ret =
new TH1D(
"published",
"dNch/deta in |eta|<0.5",
201 for (
Int_t i = 0; i < nbin; i++) {
202 ret->SetBinContent(i+1, vals[i]);
203 ret->SetBinError (i+1, errs[i]);
209 printf(
"%3d bins: ");
210 for (
Int_t i = 1; i <= axis->GetNbins(); i++)
211 printf(
"%6.3f-", axis->GetBinLowEdge(i));
212 Printf(
"%6.3f", axis->GetBinUpEdge(i));
219 if (!def || !other)
return;
223 def->SetName(
"default");
225 TH1* hs =
static_cast<TH1*
>(def->Clone(
"ratioSys"));
226 TH1* ht =
static_cast<TH1*
>(def->Clone(
"ratioStat"));
227 hs->SetTitle(
"Syst.uncer.");
228 ht->SetTitle(
"Stat.error");
231 ht->SetMarkerStyle(20);
232 ht->SetMarkerSize(2);
233 ht->SetMarkerColor(kBlack);
234 ht->SetLineColor(kBlack);
236 hs->SetFillColor(kBlue-10);
237 hs->SetFillStyle(1001);
238 hs->SetYTitle(Form(
"%s / published", var));
239 ht->SetYTitle(Form(
"%s / published", var));
242 for (
Int_t i = 1; i <= def->GetNbinsX(); i++) {
243 Double_t oc = other->GetBinContent(i);
244 Double_t oe = other->GetBinError (i);
245 Double_t dc = def ->GetBinContent(i);
246 Double_t de = def ->GetBinError (i);
250 hs->SetBinContent(i, y);
251 ht->SetBinContent(i, y);
252 hs->SetBinError (i, sy);
253 ht->SetBinError (i, st);
255 THStack*
stack =
new THStack(Form(
"mid_%s_0x%x", var, flags),
"");
256 stack->Add(hs,
"e2");
263 TCanvas*
c =
new TCanvas(ht->GetName(),hs->GetTitle(),
cW,
cH);
264 c->SetTopMargin(0.01);
265 c->SetRightMargin(0.01);
267 stack->SetMinimum(0.9);
268 stack->SetMaximum(1.1);
269 stack->Draw(
"nostack");
270 TH1* h = stack->GetHistogram();
273 h->GetYaxis()->SetTitleOffset(1.5);
274 h->SetXTitle(
"Centrality [%]");
275 h->SetYTitle(Form(
"%s / published", var));
277 TLegend* l = c->BuildLegend(c->GetLeftMargin(),
278 c->GetBottomMargin(),
284 c->Print(Form(
"plots/%s.png", h->GetName()));
298 THStack* result =
new THStack(Form(
"compare_%s", var),
299 Form(
"\\hbox{combinatorics vs. injection }"
300 "%s\\hbox{ %s}",
obs, var));
303 while ((def = static_cast<TH1*>(nextDef())) &&
304 (oth = static_cast<TH1*>(nextOth()))) {
305 if (noTruth &&
TString(def->GetName()).EqualTo(
"truth"))
continue;
306 def->SetName(f1 == 0x3 ?
"combinatorics" :
"injection");
307 oth->SetName(f2 == 0x3 ?
"combinatorics" :
"injection");
310 TCanvas*
c =
new TCanvas(result->GetName(),result->GetTitle(),
cW,
cH);
311 c->SetTopMargin(0.01);
312 c->SetRightMargin(0.01);
314 result->Draw(
"nostack");
315 result->GetHistogram()->SetMinimum(.9);
316 result->GetHistogram()->SetMaximum(1.1);
317 result->GetHistogram()->GetYaxis()->SetTitleOffset(1.5);
318 result->GetHistogram()->SetXTitle(
"\\eta");
319 result->GetHistogram()->SetYTitle(Form(
"%s / %s",
320 f2==0?
"injection":
"combinatorial",
321 f1==0?
"injection":
"combinatorial"));
322 AddLine(result->GetHistogram());
323 result->SetMinimum(.9);
324 result->SetMaximum(1.1);
326 c->Print(Form(
"plots/%s.png", result->GetName()));
331 TFile*
file = TFile::Open(Form(
"results/combine_none_0x%x.root",flgs),
"READ");
336 for (
Int_t i = 1; i <= cent->GetNbinsX(); i++) {
338 Double_t c1 = cent->GetXaxis()->GetBinLowEdge(i);
339 Double_t c2 = cent->GetXaxis()->GetBinUpEdge (i);
340 name.Form(
"cent%03d%02d_%03d%02d",
342 TString sname(name); sname.Append(
"/summary");
344 pname.ReplaceAll(
"_",
"");
345 pname.ReplaceAll(
"cent",
"");
346 pname.ReplaceAll(
"00",
"");
349 if (!defs || !oths)
break;
353 THStack* result =
new THStack(Form(
"compare_%s_0x%x_%s",
354 var, flgs, name.Data()),
355 Form(
"\\hbox{%s vs. default }%s"
358 (flgs & 0x3) == 0x3 ?
364 while ((def = static_cast<TH1*>(nextDef())) &&
365 (oth = static_cast<TH1*>(nextOth()))) {
366 if (noTruth &&
TString(def->GetName()).EqualTo(
"truth"))
continue;
369 TCanvas*
c =
new TCanvas(result->GetName(),result->GetTitle(),
cW,
cH);
370 c->SetTopMargin(0.01);
371 c->SetRightMargin(0.01);
372 result->Draw(
"nostack");
373 result->GetHistogram()->SetMinimum(.9);
374 result->GetHistogram()->SetMaximum(1.1);
375 result->GetHistogram()->GetYaxis()->SetTitleOffset(1.5);
376 result->GetHistogram()->SetXTitle(
"\\eta");
377 result->GetHistogram()->SetYTitle(Form(
"%s / default", var));
378 result->SetMinimum(.9);
379 result->SetMaximum(1.1);
380 AddLine(result->GetHistogram());
382 c->Print(Form(
"plots/%s.png", result->GetName()));
391 TCanvas*
c =
new TCanvas(
"legend",
"Legend",
cW,
cH);
392 c->SetTopMargin(0.01);
393 c->SetRightMargin(0.01);
394 TLegend* l =
new TLegend(0.01, 0.01, .99, .99);
401 while ((h = static_cast<TH1*>(next()))) {
402 if (
TString(h->GetName()).Contains(
"truth"))
continue;
403 TString nme; nme.Form(
"%2d - %3d%%",
404 Int_t(cent->GetXaxis()->GetBinLowEdge(bin)),
405 Int_t(cent->GetXaxis()->GetBinUpEdge(bin)));
407 TLegendEntry* e = l->AddEntry(
"", nme,
"F");
408 e->SetFillColor(h->GetMarkerColor());
409 e->SetFillStyle(1001);
414 c->Print(Form(
"plots/%s.png", c->GetName()));
423 if (!gROOT->GetClass(
"GraphSysErr"))
424 gROOT->LoadMacro(
"$HOME/GraphSysErr/GraphSysErr.C+g");
432 if (w.EqualTo(
"none"))
CentPlot(0x3);
void CompareFlgs(UShort_t f1, UShort_t f2, const char *var, Bool_t noTruth=true)
void CompareMids(UShort_t flags, const char *var)
TH1 * GetH1(TDirectory *dir, const char *name="result")
void PrintAxis(TAxis *axis)
const Bool_t kCompareVarLoaded
TH1 * Compare(TH1 *def, TH1 *oth)
TH1 * GetCent(UShort_t flags, const char *var)
void CentPlot(UShort_t flags)
TFile * file
TList with histograms for a given trigger.
void PrintH(TH1 *h, Int_t prec=2)
THStack * GetHS(TDirectory *dir, const char *name="result")
TList * GetHists(UShort_t flags, const char *var, const char *stackName="result", const char *sub="")
TH1 * GetMid(UShort_t flags, const char *var)
TObject * GetO(TDirectory *dir, const char *name="result", TClass *cls=0)
void CompareVars(UShort_t flags, const char *var, Bool_t noTruth=true)
void CompareSubs(UShort_t flgs, const char *var, Bool_t noTruth=false)