2 #include <TMultiGraph.h>
16 void Run(
const char* fname)
19 TFile*
file = TFile::Open(filename,
"READ");
21 Error(
"Run",
"Failed to open \"%s\"", filename.Data());
26 pdfName.ReplaceAll(
".root",
".pdf");
33 TIter next(file->GetListOfKeys());
35 while ((k = static_cast<TKey*>(next()))) {
38 TString clName = k->GetClassName();
39 TClass* cl = gROOT->GetClass(clName);
45 if (!cl->InheritsFrom(TDirectory::Class())) {
50 file->cd(k->GetName());
61 TLatex* ltx =
new TLatex(.5, .7,
"Raw P(#it{N}_{ch}) #rightarrow "
62 "corrected P(#it{N}_{ch})");
64 ltx->SetTextSize(0.07);
65 ltx->SetTextAlign(22);
104 Printf(
" ProcessType: %s", d->GetPath());
107 static TRegexp regex(
"[pm][0-9]d[0-9]*_[pm][0-9]d[0-9]*");
110 TIter next(d->GetListOfKeys());
112 while ((k = static_cast<TKey*>(next()))) {
114 TString clName = k->GetClassName();
115 TClass* cl = gROOT->GetClass(clName);
121 if (!cl->InheritsFrom(TDirectory::Class())) {
127 if (n.Index(regex) == kNPOS) {
128 Warning(
"ProcessType",
"Ignoring non-bin directory %s", n.Data());
142 Warning(
"DrawResults",
"Stack of corrected results not found!");
146 c->GetXaxis()->SetTitle(
"#it{N}_{ch}");
147 c->GetYaxis()->SetTitle(
"P(#it{N}_{ch})");
149 TObject* alice = d->Get(
"alice");
151 if (cms) cms->Draw();
152 if (alice) alice->Draw();
156 TLegend* l =
new TLegend(0.15, 0.12, .4, .3,
"",
"NDC");
160 TLegendEntry* e = l->AddEntry(dummy,
"This work",
"F");
161 e->SetFillColor(kRed+2);
162 e->SetFillStyle(1001);
164 e = l->AddEntry(dummy,
"ALICE",
"F");
165 e->SetFillColor(kPink+1);
166 e->SetFillStyle(1001);
169 e = l->AddEntry(dummy,
"CMS",
"F");
170 e->SetFillColor(kGreen+2);
171 e->SetFillStyle(1001);
179 fBody->SetLogy(
false);
181 s->GetYaxis()->SetTitle(
"(this - other)/other");
182 s->GetXaxis()->SetTitle(
"#it{N}_{ch}");
185 TLegend* l =
new TLegend(0.65, 0.12, .95, .3,
"",
"NDC");
191 e = l->AddEntry(dummy,
"to ALICE",
"F");
192 e->SetFillColor(kPink+1);
193 e->SetFillStyle(1001);
196 e = l->AddEntry(dummy,
"to CMS",
"F");
197 e->SetFillColor(kGreen+2);
198 e->SetFillStyle(1001);
201 if (s->GetMinimum() > -1) s->SetMinimum(-1);
209 Printf(
" ProcessBin: %s", d->GetPath());
212 tmp.ReplaceAll(
"p",
"+");
213 tmp.ReplaceAll(
"m",
"-");
214 tmp.ReplaceAll(
"d",
".");
215 tmp.ReplaceAll(
"_",
" ");
217 if (!tokens || tokens->GetEntriesFast() < 2) {
218 Error(
"Other2Stack",
"Failed to decode eta range from %s",
220 if (tokens) tokens->Delete();
223 Double_t eta1 =
static_cast<TObjString*
>(tokens->At(0))->String().Atof();
224 Double_t eta2 =
static_cast<TObjString*
>(tokens->At(1))->String().Atof();
227 fBody->Divide(1,5,0,0);
228 TVirtualPad* p =
fBody->cd(5);
229 p->SetRightMargin(0.15);
230 p->SetTopMargin(0.05);
232 p->SetBottomMargin(0.15);
235 Warning(
"ProcessBin",
"Argh! All stack not found!");
243 all->GetXaxis()->SetTitle(
"#it{N}_{ch}");
244 all->GetYaxis()->SetTitle(
"P(#it{N}_{ch})");
246 PrintCanvas(Form(
" %+5.2f<eta<%+5.2f", eta1, eta2));
253 fBody->Divide(2, 3, 0, 0);
254 TList* hists = stack->GetHists();
255 Int_t nHist = hists->GetEntries();
258 THStack* bg =
static_cast<THStack*
>(stack->Clone(
"bg"));
261 for (
Int_t i = 0; i < nHist; i++) {
263 TH1* h =
static_cast<TH1*
>(bg->GetHists()->At(i));
264 h->SetMarkerColor(kGray+1);
265 h->SetFillColor(kGray);
266 h->SetLineColor(kGray);
268 TList* lf = h->GetListOfFunctions();
270 TObject* ll = lf->FindObject(
"legend");
271 if (ll) lf->Remove(ll);
274 const char* txt[] = {
"MC 'truth'",
275 "Selected MC 'truth'",
280 for (
Int_t i = 0; i < nHist; i++) {
286 bg->GetXaxis()->SetTitle(
"#it{N}_{ch}");
287 bg->GetYaxis()->SetTitle(
"P(#it{N}_{ch})");
289 TLatex* l =
new TLatex(.95, .95, Form(
"Step %d", i));
292 l->SetTextSize(0.06);
294 l->DrawLatex(.95, .88, txt[i]);
297 PrintCanvas(Form(
" %+5.2f<eta<%+5.2f - Steps", e1, e2));
Base class for classes to draw summaries.
static TH1 * GetH1(const TObject *parent, const TString &name, Bool_t verb=true)
static TH2 * GetH2(const TObject *parent, const TString &name, Bool_t verb=true)
void ProcessBin(TDirectory *d)
void MakeChapter(const TString &title)
void DrawTitlePage(const TDirectory *file)
void DrawSteps(THStack *stack, Double_t e1, Double_t e2)
void Run(const char *fname)
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 PrintCanvas(const TString &title, Float_t size=.7)
void DrawResults(TDirectory *d)
void ProcessType(TDirectory *d)
TObject * DrawInPad(TVirtualPad *c, Int_t padNo, TObject *h, Option_t *opts="", UInt_t flags=0x0, const char *title="")
static THStack * GetStack(const TObject *parent, const TString &name, const char *sub=0, Bool_t verb=true)