11 TFile*
file = TFile::Open(filename,
"READ");
13 Warning(
"DrawDeltas2",
"File %s couldn't be opened", filename);
17 TString dname; dname.Form(
"cent%06.2f_%06.2f", c1, c2);
18 dname.ReplaceAll(
".",
"d");
19 TDirectory* d = file->GetDirectory(dname);
21 Warning(
"DrawDeltas2",
"Directory %s not found in %s",
22 dname.Data(), file->GetName());
26 TDirectory* det = d->GetDirectory(
"details");
28 Warning(
"DrawDeltas2",
"Directory details not found in %s",
34 TObject* o = det->Get(
"deltas");
36 Warning(
"DrawDeltas2",
"Object deltas not found in %s",
41 if (!o->IsA()->InheritsFrom(THStack::Class())) {
42 Warning(
"DrawDeltas2",
"Object %s is not a THStack, but a %s",
43 o->GetName(), o->ClassName());
46 THStack* s =
static_cast<THStack*
>(o);
49 t.ReplaceAll(
"results/",
"");
50 t.ReplaceAll(
"combine_",
"");
51 t.ReplaceAll(
"_0x3.root",
"");
53 nm.ReplaceAll(
".root",
"_");
54 nm.ReplaceAll(
"results/",
"plots/");
55 nm.ReplaceAll(
"combine",
"deltas");
56 if (t.Contains(
"none"))
57 t.ReplaceAll(
"none",
"No weights,");
59 t.Append(
" weights,");
60 if (det->Get(
"scalar")) {
61 t.Append(
" #it{k}(#eta),"); nm.Append(
"keta_");
64 t.Append(
" #it{k}#equiv1,"); nm.Append(
"kunit_");
66 t.Append(Form(
" %5.2f - %5.2f%%", c1, c2));
71 TCanvas*
c =
new TCanvas(nm,t,cW, cH);
72 c->SetTopMargin(0.10);
73 c->SetRightMargin(0.01);
76 TLatex* tit =
new TLatex(0.55, 0.99, t);
78 tit->SetTextAlign(23);
79 tit->SetTextSize(0.03);
82 TVirtualPad* p = c->cd(1);
83 p->SetRightMargin(0.01);
91 TH1* h = s->GetHistogram();
94 h->SetXTitle(
"#Delta");
95 h->SetYTitle(
"Tracklets/event");
97 TLine* ll =
new TLine(1.5, min, 1.5, max);
98 ll->SetLineColor(kGreen+2);
102 TLine* lh =
new TLine(5, min, 5, max);
103 lh->SetLineColor(kRed+2);
108 TLegend* l = p->BuildLegend(.11,.0,.7,.35);
110 Int_t n = l->GetListOfPrimitives()->GetEntries();
111 ((
TNamed*)(l->GetListOfPrimitives()->At(n-2)))->SetTitle(
"Signal cut");
112 ((
TNamed*)(l->GetListOfPrimitives()->At(n-1)))->SetTitle(
"Background cut");
118 TH1* realMeas =
static_cast<TH1*
>(s->GetHists()->At(0));
119 TH1* simMeas =
static_cast<TH1*
>(s->GetHists()->At(1));
120 TH1* realInj =
static_cast<TH1*
>(s->GetHists()->At(2));
121 TH1* simInj =
static_cast<TH1*
>(s->GetHists()->At(3));
122 TH1* simComb =
static_cast<TH1*
>(s->GetHists()->At(4));
124 TH1* measRat =
static_cast<TH1*
>(simMeas->Clone(
"ratioMeas"));
125 measRat->Divide(realMeas);
126 measRat->SetTitle(
"Sim./Real Measured");
129 TH1* simInjRat =
static_cast<TH1*
>(simInj->Clone(
"ratioSimInj"));
130 simInjRat->Divide(simComb);
131 simInjRat->SetDirectory(0);
132 simInjRat->SetTitle(
"Sim. Inj./Combinatorics");
134 TH1* realInjRat =
static_cast<TH1*
>(realInj->Clone(
"ratioRealInj"));
135 realInjRat->Divide(simComb);
136 realInjRat->SetDirectory(0);
137 realInjRat->SetTitle(
"Real Inj./Combinatorics");
139 THStack* ratios =
new THStack(
"ratios",
"");
140 ratios->Add(measRat);
141 ratios->Add(realInjRat);
142 ratios->Add(simInjRat);
145 p->SetRightMargin(0.01);
151 ratios->SetMinimum(0.5);
152 ratios->SetMaximum(1.5);
153 ratios->Draw(
"nostack");
154 h = ratios->GetHistogram();
155 h->SetXTitle(realMeas->GetXaxis()->GetTitle());
156 h->SetYTitle(
"Ratio");
158 l = p->BuildLegend(.11,.11,.7,.35);
173 DrawDeltas2(Form(
"results/combine_%s_0x%x.root", which, flags), 0, 5);
174 c->SaveAs(Form(
"plots/deltas_%s_0x%x.png", which, flags));
TCanvas * DrawDeltas2(const char *filename, Double_t c1=0, Double_t c2=5)
TFile * file
TList with histograms for a given trigger.