6 TFile*
file = TFile::Open(filename,
"READ");
8 Warning(
"DrawDeltas2",
"File %s couldn't be opened", filename);
12 TString dname; dname.Form(
"cent%06.2f_%06.2f", c1, c2);
13 dname.ReplaceAll(
".",
"d");
14 TDirectory* d = file->GetDirectory(dname);
16 Warning(
"DrawDeltas2",
"Directory %s not found in %s",
17 dname.Data(), file->GetName());
21 TDirectory* det = d->GetDirectory(
"details");
23 Warning(
"DrawDeltas2",
"Directory details not found in %s",
28 k = (det->Get(
"scalar") != 0);
30 TObject* o = det->Get(
"deltas");
33 Warning(
"DrawDeltas2",
"Object deltas not found in %s",
38 if (!o->IsA()->InheritsFrom(THStack::Class())) {
39 Warning(
"DrawDeltas2",
"Object %s is not a THStack, but a %s",
40 o->GetName(), o->ClassName());
43 THStack* s =
static_cast<THStack*
>(o);
60 TH1* h = s->GetHistogram();
61 h->SetXTitle(
"#Delta");
62 h->SetYTitle(
"Tracklets/event");
64 TLine* ll =
new TLine(1.5, min, 1.5, max);
65 ll->SetLineColor(kGreen+2);
69 TLine* lh =
new TLine(5, min, 5, max);
70 lh->SetLineColor(kRed+2);
75 TLegend* l = p->BuildLegend(p->GetLeftMargin(),
78 p->GetBottomMargin()+.35);
80 Int_t n = l->GetListOfPrimitives()->GetEntries();
81 ((
TNamed*)(l->GetListOfPrimitives()->At(n-2)))->SetTitle(
"Signal cut");
82 ((
TNamed*)(l->GetListOfPrimitives()->At(n-1)))->SetTitle(
"Background cut");
98 TH1* realMeas =
static_cast<TH1*
>(s->GetHists()->At(0));
99 TH1* simMeas =
static_cast<TH1*
>(s->GetHists()->At(1));
100 TH1* realInj =
static_cast<TH1*
>(s->GetHists()->At(2));
101 TH1* simInj =
static_cast<TH1*
>(s->GetHists()->At(3));
103 TH1* ratioMeas =
static_cast<TH1*
>(simMeas->Clone(
"ratioMeas"));
104 TH1* ratioInj =
static_cast<TH1*
>(simInj ->Clone(
"ratioInj"));
105 ratioMeas->SetDirectory(0);
106 ratioInj ->SetDirectory(0);
107 ratioMeas->SetTitle(Form(
"%s/%s",simMeas->GetTitle(),realMeas->GetTitle()));
108 ratioInj ->SetTitle(Form(
"%s/%s",simInj ->GetTitle(),realInj ->GetTitle()));
109 ratioMeas->SetTitle(
"Measured");
110 ratioInj ->SetTitle(
"Injection");
111 ratioInj ->SetMarkerColor(realMeas->GetMarkerColor());
112 ratioMeas->Divide(realMeas);
113 ratioInj ->Divide(realInj );
114 ratioMeas->SetYTitle(
"Sim./Real");
115 ratioInj ->SetYTitle(
"Sim./Real");
117 THStack* r =
new THStack(
"ratios",
"");
124 TH1* h = r->GetHistogram();
125 h->SetXTitle(ratioMeas->GetXaxis()->GetTitle());
126 h->SetYTitle(ratioMeas->GetYaxis()->GetTitle());
128 TLegend* l = p->BuildLegend(p->GetLeftMargin(),
129 p->GetBottomMargin(),
130 1-p->GetRightMargin(),
131 p->GetBottomMargin()+.15);
145 t.ReplaceAll(
"results/",
"");
146 t.ReplaceAll(
"combine_",
"");
147 t.ReplaceAll(
"_0x3.root",
"");
148 t.Prepend(
"Weights: ");
149 if (k) t.Append(
", #it{k}(#eta),");
150 else t.Append(
", #it{k}#equiv1,");
151 t.Append(Form(
" %4.1f - %4.1f%%", c1, c2));
154 Double_t xm = p->GetXlowNDC() + p->GetWNDC()/2;
155 TLatex* tit =
new TLatex(xm, 0.99, t);
156 tit->SetTextFont(42);
157 tit->SetTextAlign(23);
158 tit->SetTextSize(0.03);
171 THStack* s1 =
GetDeltas(file1, c1, c2, k1);
172 THStack* s2 =
GetDeltas(file2, c1, c2, k2);
173 Double_t min = TMath::Min(s1->GetMinimum(
"nostack"),
174 s2->GetMinimum(
"nostack"));
175 Double_t max = TMath::Max(s1->GetMaximum(
"nostack"),
176 s2->GetMaximum(
"nostack"));
180 TCanvas*
c =
new TCanvas(
"c",
"C", cW, cH);
181 c->SetTopMargin(0.1);
182 c->SetRightMargin(0.01);
185 TVirtualPad* p = c->cd(1);
189 p->SetRightMargin(0.01);
196 p->SetRightMargin(0.01);
199 DrawTitle(c, c->GetPad(1), file1, c1, c2, k1);
200 DrawTitle(c, c->GetPad(2), file2, c1, c2, k2);
210 TCanvas*
c =
DrawDeltas3(Form(
"results/combine_none_0x%x.root",flags),
211 Form(
"results/combine_%s_0x%x.root",var,flags),
216 c->SaveAs(Form(
"plots/deltas2_%s_0x%x.png", var, flags));
void DrawStack(TVirtualPad *p, THStack *s, Double_t min, Double_t max)
TCanvas * DrawDeltas3(const char *file1, const char *file2, Double_t c1=0, Double_t c2=5)
THStack * GetDeltas(const char *filename, Double_t c1, Double_t c2, Bool_t &k)
void DrawRatios(TVirtualPad *p, THStack *s, Double_t min=0.8, Double_t max=1.22)
void DrawTitle(TVirtualPad *c, TVirtualPad *p, const char *file, Double_t c1, Double_t c2, Bool_t k)
TFile * file
TList with histograms for a given trigger.