16 # include <TCollection.h> 22 # include <TBrowser.h> 25 # include <TLegendEntry.h> 85 fStack =
new THStack(
"dists", title);
86 fYields =
new TH1D(
"yields", title, 6, 0, 6);
87 fYields->SetMarkerSize(1.5);
88 ModHist(fYields, 0, color, offset, width);
92 while ((o = next())) {
93 if (!o->IsA()->InheritsFrom(TH1::Class()))
continue;
94 TH1* t =
static_cast<TH1*
>(o);
97 if (!nme.BeginsWith(
"eta_"))
continue;
99 nme.ReplaceAll(
"eta_",
"");
104 case 310: h = &
fK0S;
break;
105 case 321: h = &
fKpm;
break;
106 case 3122: h = &
fLambda;
break;
108 case 3312: h = &
fXi;
break;
109 case 3112: h = &
fSigma;
break;
111 case 3222: h = &
fSigma;
break;
112 default: h = &
fOther;
break;
115 Printf(
"Unknown PDG=%d", pdg);
119 *h =
static_cast<TH1*
>(t->Clone());
124 if (!fOther || !fK0S || !fKpm || !fLambda || !fXi || !fSigma)
126 fOther ->SetTitle(
"Other");
127 fOther ->SetMarkerStyle(20); fOther ->SetMarkerSize(1.2);
128 fK0S ->SetMarkerStyle(21); fK0S ->SetMarkerSize(1);
129 fKpm ->SetMarkerStyle(25); fKpm ->SetMarkerSize(1);
130 fLambda->SetMarkerStyle(23); fLambda->SetMarkerSize(1.2);
131 fXi ->SetMarkerStyle(22); fXi ->SetMarkerSize(1.2);
132 fSigma ->SetMarkerStyle(26); fSigma ->SetMarkerSize(1.2);
135 fStack->Add(fLambda);
137 fStack->Add(fSigma );
138 fStack->Add(fOther );
140 if (color == kMagenta+1) {
141 fK0S ->Scale(1.52233);
142 fKpm ->Scale(1.41178);
143 fLambda->Scale(2.75002);
144 fXi ->Scale(3.24110);
145 fSigma ->Scale(2.75002);
148 TIter nextH(fStack->GetHists());
151 while ((hist = static_cast<TH1*>(nextH()))) {
153 ModHist(hist, 0, color, offset, width);
164 h->SetMarkerColor(color);
165 h->SetLineColor(color);
166 h->SetFillColor(color);
167 h->SetBarOffset(offset);
168 h->SetBarWidth(width);
170 TString nme(Form(
"%s%s",h->GetName(),
title)); nme.ReplaceAll(
"-",
"");
173 if (h == fYields)
return;
174 TAxis* axis = h->GetXaxis();
175 Double_t shift = axis->GetBinWidth(1)*(offset-0.5);
176 axis->SetLimits(axis->GetXmin()+shift, axis->GetXmax()+shift);
177 if (title) h->SetTitle(Form(
"%s #minus %s", h->GetTitle(),
title));
182 Double_t yie = h->IntegralAndError(1,h->GetNbinsX(),err);
183 fYields->SetBinContent(bin, yie);
184 fYields->SetBinError (bin, err);
185 fYields->GetXaxis()->SetBinLabel(bin, h->GetTitle());
188 TLegend* ld, TLegend* ly)
190 TIter next(fStack->GetHists());
192 while ((hist = static_cast<TH1*>(next()))) {
195 TLegendEntry* e = ld->AddEntry(
"dummy", hist->GetTitle(),
"p");
196 e->SetMarkerStyle(hist->GetMarkerStyle());
197 e->SetMarkerSize(1.5*hist->GetMarkerSize());
200 yields->Add(fYields,
"hist bar text90");
201 TLegendEntry* e = ly->AddEntry(
"dummy", fYields->GetTitle(),
"f");
202 e->SetFillColor(fYields->GetFillColor());
203 e->SetFillStyle(1001);
208 One* stk =
new One(
"stk.root",
"Reduced", kRed+1, .15,.15,c1,c2);
209 One* expe =
new One(
"stk.root",
"Expected", kMagenta+1,.35,.15,c1,c2);
210 One* wstk =
new One(
"wstk.root",
"Reweighed",kBlue+1, .55,.15,c1,c2);
211 One* hijing =
new One(
"hijing.root",
"As-is", kGreen+1, .75,.15,c1,c2);
212 One* ones[] = { stk, expe, wstk, hijing, 0 };
215 gStyle->SetPaintTextFormat(
"5.0f");
216 gStyle->SetErrorX(0.2);
218 Int_t cw = (mode == 1 ? 1600 : mode == 2 ? 800 : 1000);
219 Int_t ch = (mode == 1 ? cw/2 : mode == 2 ? 1.5*cw : cw);
220 TCanvas*
c =
new TCanvas(Form(
"yieldExpectation_%s",
U::CentName(c1,c2)),
221 "YieldCanvas",cw,ch);
223 TVirtualPad* p = c->GetPad(1);
224 TVirtualPad* q = c->GetPad(2);
225 p->SetTopMargin(0.01);
226 p->SetRightMargin(0.01);
229 q->SetTopMargin(0.01);
230 q->SetRightMargin(0.01);
231 q->SetLeftMargin(0.13);
235 TLegend* le =
new TLegend(p->GetLeftMargin()+.01, .75,
236 1-p->GetRightMargin(), .85);
237 TLegend* ly =
new TLegend(q->GetLeftMargin()+.01, .75,
238 1-q->GetRightMargin(),
239 1-q->GetTopMargin());
240 le->SetBorderSize(0);
243 ly->SetBorderSize(0);
246 THStack* dists =
new THStack(
"dists",
"");
247 THStack* yields =
new THStack(
"yields",
"");
250 (*ptr)->AddToStacks(dists, yields, (*ptr == stk ? le : 0), ly);
254 dists->Draw(
"nostack");
255 dists->GetHistogram()->SetXTitle(
"#it{#eta}");
256 dists->GetHistogram()->SetYTitle(
"d#it{N}_{X}/d#it{#eta}");
260 yields->SetMaximum(2*yields->GetMaximum(
"nostack"));
261 yields->Draw(
"nostack");
262 yields->GetHistogram()->GetXaxis()->SetLabelSize(0.07);
263 yields->GetHistogram()->GetYaxis()->SetLabelSize(0);
264 yields->GetHistogram()->GetYaxis()->SetTitleOffset(1.2);
265 yields->GetHistogram()->SetYTitle(Form(
"#int_{-2}^{+2}d#it{#eta} %s",
266 dists->GetHistogram()->GetYaxis()
273 c->SaveAs(Form(
"%s.png", c->GetName()));
284 if (!gROOT->GetClass(
"AliTrackletAODUtils")) {
285 Printf(
"Loading utilities");
286 gROOT->LoadMacro(
"$ANA_SRC/dndeta/tracklets3/AliTrackletAODUtils.C+g");
289 gSystem->AddIncludePath(
"-DSELF_COMPILE__");
290 if (!gROOT->GetClass(
"YieldCalculations")) {
291 gInterpreter->ClearFileBusy();
293 Printf(
"Reload self compiled");
294 gROOT->LoadMacro(
"$ANA_SRC/dndeta/tracklets3/YieldExpectations.C+g");
Int_t color[]
print message on plot with ok/not ok
void CalcYield(TH1 *h, Int_t bin)
static TFile * OpenFile(const char *filename)
static const char * CentName(Double_t c1, Double_t c2)
One(const char *filename, const char *title, Color_t color, Double_t offset, Double_t width=.15, Double_t c1=0, Double_t c2=0)
void YieldExpectations(Double_t c1=0, Double_t c2=0)
void ModHist(TH1 *h, const char *title, Color_t color, Double_t offset, Double_t width)
Utilities for midrapidity analysis.
void AddToStacks(THStack *dists, THStack *yields, TLegend *ld, TLegend *ly)
void Run(Double_t c1, Double_t c2)
TFile * file
TList with histograms for a given trigger.
static Container * GetC(Container *parent, const char *name, Bool_t verb=true)