5 #include <TLegendEntry.h>
23 Printf(
"Opening file %s", filename);
29 THStack* prim =
DoOne(cent, mid,
"primaries");
30 THStack* seco =
DoOne(cent, mid,
"secondaries");
31 THStack* fake =
DoOne(cent, mid,
"combinatorics");
32 THStack* meas =
MakeMeas(prim, seco, fake);
36 prim->SetTitle(
"P: Primaries");
37 seco->SetTitle(
"S: Secondaries");
38 fake->SetTitle(
"C: Combinatorics");
39 meas->SetTitle(
"M=P+S+C: Measured");
40 norm->SetTitle(
"Normalized M");
41 rati->SetTitle(
"Ratio to total");
45 TCanvas*
canvas =
new TCanvas(filename,filename, 1200, 1200);
47 TLegend* l =
new TLegend(0.01,yr+.01,.99,.99);
51 TIter next(norm->GetHists());
53 while ((hist = static_cast<TH1*>(next()))) {
54 TLegendEntry* e = l->AddEntry(
"dummy",hist->GetTitle(),
"p");
55 e->SetMarkerStyle(hist->GetMarkerStyle());
56 e->SetMarkerColor(hist->GetMarkerColor());
57 e->SetMarkerSize (2*hist->GetMarkerSize());
63 TPad* body =
new TPad(
"body",
"body",0,0,1,yr);
66 body->SetTopMargin(0.01);
67 body->SetRightMargin(0.01);
70 TVirtualPad* q = body->cd(1);
71 q->SetTopMargin(0.01);
72 q->SetRightMargin(0.01);
81 q->SetTopMargin(0.01);
82 q->SetRightMargin(0.01);
87 DrawStack(q->cd(3), rati,
false,
"Ratio");
92 TString outName(filename); outName.ReplaceAll(
".root",
"");
93 outName.Prepend(
"deltaContrib");
95 TFile* outRoot = TFile::Open(Form(
"%s.root", outName.Data()),
"RECREATE");
103 canvas->SaveAs(Form(
"%s.png",outName.Data()));
106 const char*
title=
"d#it{N}_{X}/d#it{#Delta}")
110 p->SetRightMargin(0.01);
115 hs->GetHistogram()->SetXTitle(
"#it{#Delta}");
116 hs->GetHistogram()->SetYTitle(
title);
117 hs->GetHistogram()->GetYaxis()->SetTitleSize(0.025/p->GetHNDC());
118 hs->GetHistogram()->GetXaxis()->SetTitleSize(0.025/p->GetHNDC());
119 hs->GetHistogram()->GetYaxis()->SetTitleOffset(0.6);
120 hs->GetHistogram()->GetXaxis()->SetTitleOffset(0.6);
121 hs->GetHistogram()->GetYaxis()->SetLabelSize(0.02/p->GetHNDC());
122 hs->GetHistogram()->GetXaxis()->SetLabelSize(0.02/p->GetHNDC());
123 hs->GetHistogram()->GetXaxis()->SetNdivisions(210);
124 hs->GetHistogram()->GetXaxis()->SetLimits(-1,26);
132 THStack* all =
U::GetHS(regi,
"all");
135 TIter next(all->GetHists());
145 while ((hist = static_cast<TH1*>(next()))) {
147 if (name.EqualTo(
"total")) tot = static_cast<TH1*>(hist->Clone());
148 else if (name.EqualTo(
"321")) kpm = static_cast<TH1*>(hist->Clone());
149 else if (name.EqualTo(
"310")) k0s = static_cast<TH1*>(hist->Clone());
150 else if (name.EqualTo(
"3122")) lam = static_cast<TH1*>(hist->Clone());
151 else if (name.EqualTo(
"3112")) sim = static_cast<TH1*>(hist->Clone());
152 else if (name.EqualTo(
"3222")) sip = static_cast<TH1*>(hist->Clone());
153 else if (name.EqualTo(
"3312")) xi = static_cast<TH1*>(hist->Clone());
155 if (!oth) oth =
static_cast<TH1*
>(hist->Clone(
"0"));
160 tot->SetMarkerStyle(25);
161 tot->SetMarkerSize(1.5);
162 oth->SetMarkerColor(kRed+1);
163 oth->SetLineColor(kRed+1);
164 oth->SetFillColor(kRed+1);
165 oth->SetMarkerStyle(20);
166 oth->SetTitle(
"Other");
172 U::PdgAttr(321, nam, col, sty); kpm->SetTitle(nam);
173 U::PdgAttr(310, nam, col, sty); k0s->SetTitle(nam);
174 U::PdgAttr(3122, nam, col, sty); lam->SetTitle(nam);
175 U::PdgAttr(3112, nam, col, sty); sim->SetTitle(nam);
176 U::PdgAttr(3312, nam, col, sty); xi ->SetTitle(nam);
178 THStack* ret =
new THStack(subName,subName);
179 TH1* a[] = { k0s, kpm, lam, sim, xi, oth, tot };
180 for (
int i = 0; i < 7; i++) {
182 a[i]->SetDirectory(0);
189 return U::GetH1(s->GetHists(), name,
false);
191 TH1*
MakeMeas(
const char* name, THStack* prim, THStack* seco, THStack* fake)
197 for (
int i = 0; i < 3; i++) {
200 r =
static_cast<TH1*
>(a[i]->Clone());
209 THStack*
MakeMeas(THStack* prim, THStack* seco, THStack* fake)
211 THStack* ret =
new THStack(
"measured",
"measured");
212 ret->Add(
MakeMeas(
"310", prim, seco, fake));
213 ret->Add(
MakeMeas(
"321", prim, seco, fake));
214 ret->Add(
MakeMeas(
"3122", prim, seco, fake));
215 ret->Add(
MakeMeas(
"3112", prim, seco, fake));
216 ret->Add(
MakeMeas(
"3312", prim, seco, fake));
217 ret->Add(
MakeMeas(
"0", prim, seco, fake));
218 ret->Add(
MakeMeas(
"total", prim, seco, fake));
223 THStack* ret =
new THStack(Form(
"norm%s",inp->GetName()),
224 Form(
"%s normalised", inp->GetTitle()));
225 TIter next(inp->GetHists());
227 while ((hist = static_cast<TH1*>(next()))) {
229 Double_t ing = hist->IntegralAndError(1,hist->GetNbinsX(), err);
230 TH1* hir =
static_cast<TH1*
>(hist->Clone());
231 hir->SetDirectory(0);
233 Printf(
"%10s integral %f +/- %f", hist->GetTitle(), ing, err);
244 THStack* ret =
new THStack(Form(
"rat%s",inp->GetName()),
245 Form(
"%s ratios", inp->GetTitle()));
246 TIter next(inp->GetHists());
248 while ((hist = static_cast<TH1*>(next()))) {
252 Printf(
"%10s: integral %f \t-> %f",
254 hist->Integral(1,hist->GetNbinsX()),
255 t->Integral(1,t->GetNbinsX()));
259 TH1* hir =
static_cast<TH1*
>(hist->Clone());
262 hir->SetDirectory(0);
263 hir->Scale(25./hir->Integral(1,hir->GetNbinsX()),
"width");
266 Printf(
"%10s: integral %f \t-> %f",
268 hist->Integral(1,hist->GetNbinsX()),
269 hir->Integral(1,hir->GetNbinsX(),
"width"));
281 if (!gROOT->GetClass(
"AliTrackletAODUtils")) {
282 Printf(
"Loading utilities");
283 gROOT->LoadMacro(
"$ANA_SRC/dndeta/tracklets3/AliTrackletAODUtils.C+g");
static void PdgAttr(Int_t pdg, TString &nme, Color_t &c, Style_t &s)
THStack * MakeMeas(THStack *prim, THStack *seco, THStack *fake)
static TFile * OpenFile(const char *filename)
TH1 * MakeMeas(const char *name, THStack *prim, THStack *seco, THStack *fake)
static TH1 * GetH1(Container *parent, const char *name, Bool_t verb=true)
static const char * CentName(Double_t c1, Double_t c2)
TH1 * FindHist(THStack *s, const char *name)
void DeltaShapes(const char *what="hijing.root", Double_t c1=48, Double_t c2=52)
Utilities for midrapidity analysis.
void DrawStack(TVirtualPad *p, THStack *hs, Bool_t logy=true, const char *title="d#it{N}_{X}/d#it{#Delta}")
THStack * ToOther(THStack *inp)
THStack * DoOne(TList *c, Bool_t mid, const char *subName)
static THStack * GetHS(Container *parent, const char *name, Bool_t verb=true)
static Container * GetC(Container *parent, const char *name, Bool_t verb=true)
THStack * Normalize(THStack *inp)
void Run(const char *filename, Double_t c1, Double_t c2, Bool_t mid=true)