27 TList* lsub =
static_cast<TList*
>(forward.FindObject(sub));
29 Warning(
"GetStack",
"Sub list %s not found in %s", sub, forward.GetName());
32 THStack* ret =
static_cast<THStack*
>(lsub->FindObject(name));
34 Warning(
"GetStack" "Stack %s not found in %s", name, sub);
52 if (rebin <= 1)
return h;
75 TH1* copy =
static_cast<TH1*
>(h2->Clone(
"tmp"));
76 copy->SetName(Form(
"%s_%s", h2->GetName(), h1->GetName()));
77 copy->SetTitle(Form(
"%s/%s", h2->GetTitle(), h1->GetTitle()));
78 copy->SetDirectory(0);
96 Ratio(THStack* r,
const THStack* h1,
const THStack* h2)
101 int n1 = h1->GetHists()->GetEntries();
102 int n2 = h2->GetHists()->GetEntries();
104 for (
int i = 0; i < n1 && i < n2; i++) {
105 TH1* hh1 =
static_cast<TH1*
>(h1->GetHists()->At(i));
106 TH1* hh2 =
static_cast<TH1*
>(h2->GetHists()->At(i));
128 gStyle->SetPalette(1);
129 gStyle->SetOptFit(0);
130 gStyle->SetOptStat(0);
134 Error(
"DrawMCResult",
"failed to open %s",
filename);
138 TList* forward =
static_cast<TList*
>(file->Get(
"Forward"));
140 Error(
"DrawMCResult",
"List Forward not found in %s",
filename);
143 THStack* res =
GetStack(*forward,
"ringResults",
"all");
144 THStack* mcRes =
GetStack(*forward,
"mcRingResults",
"all");
145 THStack* deltas =
GetStack(*forward,
"fmdSharingFilter",
"sums");
146 THStack* nchs =
GetStack(*forward,
"fmdDensityCalculator",
"sums");
147 THStack* prims =
GetStack(*forward,
"fmdCorrector",
"sums");
149 TH1* sumEta =
static_cast<TH1*
>(forward->FindObject(
"mcSumEta"));
151 Warning(
"DrawMCResults",
"mcSumEta not found in Forward");
155 gStyle->SetTitleBorderSize(0);
156 gStyle->SetTitleFillColor(0);
157 gStyle->SetTitleStyle(0);
161 TCanvas*
c =
new TCanvas(
"c",
"C", 900, 700);
164 c->SetTopMargin(0.05);
165 c->SetRightMargin(0.05);
168 TPad* p1 =
new TPad(
"p1",
"p1", 0, y1, 1, 1, 0, 0, 0);
169 p1->SetBottomMargin(ratios ? 0.01 : .10);
171 p1->SetBorderSize(0);
172 p1->SetTopMargin(0.05);
173 p1->SetRightMargin(0.05);
177 THStack* all =
new THStack(
"all",
"Analysis steps");
179 res->SetTitle(
"dN_{ch}/d#eta");
180 TIter next(res->GetHists());
182 while ((h = static_cast<TH1*>(next()))) all->Add(
Rebin(h,
rebin));
185 mcRes->SetTitle(
"Track-Refs");
186 TIter next(mcRes->GetHists());
188 while ((h = static_cast<TH1*>(next()))) all->Add(
Rebin(h,
rebin));
191 deltas->SetTitle(
"#sum_{} #Delta/#Delta_{mip}");
192 TIter next(deltas->GetHists());
194 while ((h = static_cast<TH1*>(next()))) {
195 h->SetMarkerStyle(25);
200 nchs->SetTitle(
"#sum_{} N_{ch,incl}");
201 TIter next(nchs->GetHists());
203 while ((h = static_cast<TH1*>(next()))) {
204 h->SetMarkerStyle(21);
209 prims->SetTitle(
"#sum_{} N_{ch,primary}");
210 TIter next(prims->GetHists());
212 while ((h = static_cast<TH1*>(next()))) {
213 h->SetMarkerStyle(22);
217 if (sumEta) all->Add(sumEta);
218 all->Draw(
"nostack");
219 all->GetHistogram()->SetXTitle(
"#eta");
220 all->GetHistogram()->SetYTitle(
"signal");
221 all->GetHistogram()->GetXaxis()->SetLabelFont(132);
222 all->GetHistogram()->GetXaxis()->SetTitleFont(132);
223 all->GetHistogram()->GetYaxis()->SetLabelFont(132);
224 all->GetHistogram()->GetYaxis()->SetTitleFont(132);
227 TLegend* l =
new TLegend(.33, .2, .53, .9);
236 TIter next(res->GetHists());
238 while ((h = static_cast<TH1*>(next()))) {
239 e = l->AddEntry(Form(
"dummy%02d", i++),h->GetTitle(),
"pl");
240 e->SetMarkerStyle(20);
241 e->SetMarkerColor(h->GetMarkerColor());
243 e = l->AddEntry(Form(
"dummy%02d", i++),res->GetTitle(),
"pl");
244 e->SetMarkerStyle(20);
245 e->SetMarkerColor(kBlack);
248 e = l->AddEntry(Form(
"dummy%02d", i++), deltas->GetTitle(),
"pl");
249 TH1* h =
static_cast<TH1*
>(deltas->GetHists()->At(0));
250 e->SetMarkerStyle(h->GetMarkerStyle());
251 e->SetMarkerColor(kBlack);
254 e = l->AddEntry(Form(
"dummy%02d",i++),nchs->GetTitle(),
"pl");
255 TH1* h =
static_cast<TH1*
>(nchs->GetHists()->At(0));
256 e->SetMarkerStyle(h->GetMarkerStyle());
257 e->SetMarkerColor(kBlack);
260 e = l->AddEntry(Form(
"dummy%02d", i++), prims->GetTitle(),
"pl");
261 TH1* h =
static_cast<TH1*
>(prims->GetHists()->At(0));
262 e->SetMarkerStyle(h->GetMarkerStyle());
263 e->SetMarkerColor(kBlack);
267 e = l->AddEntry(Form(
"dummy%02d", i++), mcRes->GetTitle(),
"pl");
268 TH1* h =
static_cast<TH1*
>(mcRes->GetHists()->At(0));
269 e->SetMarkerStyle(h->GetMarkerStyle());
270 e->SetMarkerColor(kBlack);
273 if (sumEta) l->AddEntry(sumEta);
280 TPad* p2 =
new TPad(
"p2",
"p2", 0, 0, 1, y1, 0, 0, 0);
283 p2->SetBorderSize(0);
284 p2->SetRightMargin(0.05);
288 THStack* rs =
new THStack(
"ratios",
"Ratios");
294 TLegend* ll =
new TLegend(.38, .2, .48, .9);
297 ll->SetBorderSize(0);
299 ll->SetTextFont(132);
301 e = ll->AddEntry(
"d1", Form(
"#frac{%s}{%s}",
303 deltas->GetTitle()),
"lp");
304 e->SetMarkerStyle(21);
307 e = ll->AddEntry(
"d2", Form(
"#frac{%s}{%s}", res->GetTitle(),
308 nchs->GetTitle()),
"lp");
309 e->SetMarkerStyle(20);
312 e = ll->AddEntry(
"d3", Form(
"#frac{%s}{%s}", prims->GetTitle(),
313 res->GetTitle()),
"lp");
314 e->SetMarkerStyle(22);
THStack * GetStack(const TList &forward, const char *sub, const char *name)
TH1 * Rebin(TH1 *h, Int_t rebin)
TH1 * Ratio(const TH1 *h1, const TH1 *h2)
void DrawMCResult(const char *filename="forward.root", Int_t rebin=1, Bool_t ratios=true)
TFile * file
TList with histograms for a given trigger.