5 else if (c < 10)
return 1;
6 else if (c < 20)
return 2;
7 else if (c < 30)
return 3;
8 else if (c < 40)
return 4;
9 else if (c < 50)
return 5;
10 else if (c < 60)
return 6;
11 else if (c < 70)
return 7;
12 else if (c < 80)
return 8;
13 else if (c < 90)
return 9;
26 const Color_t
cc[] = { kMagenta+2,
45 Error(
"GetOject",
"No directory");
52 Error(
"GetObject",
"No object %s in directory %s", name, d->GetName());
58 if (!o->IsA()->InheritsFrom(cls)) {
60 Error(
"GetObject",
"%s from %s is not a %s, but a %s",
61 o->GetName(), d->GetName(), cls->GetName(), o->ClassName());
73 Error(
"GetOject",
"No collection");
77 TObject* o = d->FindObject(name);
80 Error(
"GetObject",
"No object %s in collection %s", name, d->GetName());
86 if (!o->IsA()->InheritsFrom(cls)) {
88 Error(
"GetObject",
"%s from %s is not a %s, but a %s",
89 o->GetName(), d->GetName(), cls->GetName(), o->ClassName());
111 return static_cast<TH2*
>(
GetObject(c, name, TH2::Class(), verb));
117 return static_cast<TH1*
>(
GetObject(c, name, TH1::Class(), verb));
123 return static_cast<THStack*
>(
GetObject(c, name, THStack::Class(),verb));
129 return static_cast<TAxis*
>(
GetObject(c, name, TAxis::Class(),verb));
144 const char* now = gROOT->GetMacroPath();
145 const char* fst = (before ? dir.Data() : now);
146 const char* lst = (before ? now : dir.Data());
147 gROOT->SetMacroPath(Form(
"%s:%s",fst,lst));
149 gSystem->AddIncludePath(Form(
"-I%s",dir.Data()));
156 TString alp(Form(
"$ALICE_PHYSICS/PWGLF/FORWARD/analysis2/%s",rel));
158 if (
gSystem->Getenv(
"ANA_SRC")) {
159 TString mine(Form(
"$ANA_SRC/%s", rel));
169 if (rebin <= 1)
return h;
171 Int_t nBins = h->GetNbinsX();
172 if(nBins % rebin != 0) {
173 Warning(
"Rebin",
"Rebin factor %d is not a devisor of current number "
174 "of bins %d in the histogram %s", rebin, nBins, h->GetName());
179 TH1* tmp =
static_cast<TH1*
>(h->Clone(
"tmp"));
181 tmp->SetDirectory(0);
185 for(
Int_t i = 1;i<= nBinsNew; i++) {
191 Int_t bin = (i-1)*rebin + j;
194 if (c <= 0)
continue;
197 if (h->GetBinContent(bin+1)<=0 ||
198 h->GetBinContent(bin-1)<=0) {
199 Warning(
"Rebin",
"removing bin %d=%f of %s (%d=%f,%d=%f)",
200 bin, c, h->GetName(),
201 bin+1, h->GetBinContent(bin+1),
202 bin-1, h->GetBinContent(bin-1));
214 if(content > 0 && nbins > 1 ) {
215 tmp->SetBinContent(i, wsum / sumw);
216 tmp->SetBinError(i,1./TMath::Sqrt(sumw));
245 hist =
Rebin(hist, rebin, cutEdges);
246 hist->SetMarkerColor(kBlack);
247 hist->SetFillColor(kBlack);
248 hist->SetLineColor(kBlack);
250 if (dir.BeginsWith(
"cent"))
251 hist->SetName(Form(
"%s_%s",hist->GetName(),dir.Data()));
253 Info(
"DoOne",
"Make graph from %s with eff=%f", hist->GetName(), eff);
258 gse->SetSumFillColor(gse->GetMarkerColor());
259 gse->SetSumFillStyle(3002);
261 gse->SetCommonSumFillColor(gse->GetMarkerColor());
262 gse->SetCommonSumFillStyle(3001);
275 min = TMath::Min(min, mn);
276 max = TMath::Max(max, mx);
279 TH1* hist = (mg ? mg->GetHistogram() : 0);
292 const char* name=
"Forward")
294 if (!gROOT->GetClass(
"GraphSysErr")) {
298 gROOT->LoadMacro(
"GraphSysErr.C+g");
300 if (!gROOT->GetClass(
"SysErrorAdder")) {
302 gROOT->LoadMacro(
"SysErrorAdder.C+g");
307 Warning(
"ExtractGSEs",
"Failed to open %s",
filename);
312 if (!results)
return 0;
315 TH1* empH =
GetH1 (results,
"empirical");
316 Bool_t emp = (empH != 0 && !raw);
322 TString sys = osys->GetTitle();
324 TString mth = (ocentM && centA ? ocentM->GetTitle() :
"");
325 if (mth.EqualTo(
"none",TString::kIgnoreCase) ||
326 (centA && centA->GetNbins() < 1)) mth =
"";
327 TString trg = (!mth.IsNull() && centA ?
"CENT" : otrg->GetTitle());
328 TString hname = Form(
"dndeta%s%s",name,emp?
"Emp":
"");
330 Printf(
"Read settings\n"
331 " Empirical: %s (%p)\n"
333 " Energy: %d (%s - %p)\n"
334 " Trigger: %s (%s - %p)\n"
335 " Centrality: %s (%p)\n"
337 (emp ?
"yes" :
"no"), empH,
339 sNN, (osNN ? osNN->GetTitle() :
""), osNN,
340 trg.Data(), otrg->GetTitle(), otrg, mth.Data(),
342 if (centA) Printf(
" %d bins between %f and %f",
343 centA->GetNbins(), centA->GetXmin(), centA->GetXmax());
346 Warning(
"ExtractGSEs",
"Failed to make adder");
351 TCanvas*
c =
new TCanvas(
"c",
"C");
352 c->SetTopMargin(0.01);
353 c->SetRightMargin(0.20);
354 TLegend* l =
new TLegend(0.8,0.1,0.99,0.99,
356 sys.Data(), osNN->GetTitle(), trg.Data()));
365 Double_t min = 100000, max = -1000000;
366 if (!centA || centA->GetNbins() < 1 || mth.IsNull()) {
367 Info(
"ExtractGSEs",
"Doing pp-like extraction"
368 " all bin, %s, rebin=%d, eff=%f, %p, %s",
369 hname.Data(),
rebin, eff, adder,
370 (cutEdges ?
"cut edges" :
"edges stay"));
373 Warning(
"ExtractGSEs",
"Nothing returned from DoOne(\"all\"...)");
377 frame =
DrawOne(all,
"SUM QUAD AXIS", min, max);
380 for (
Int_t i = 1; i <= centA->GetNbins(); i++) {
381 Double_t low = centA->GetBinLowEdge(i);
382 Double_t high = centA->GetBinUpEdge(i);
384 dir.Form(
"cent%03dd%02d_%03dd%02d",
394 gse->SetMarkerColor(col);
402 if (first) frame =
DrawOne(g,
"SUM QUAD AXIS", min, max);
403 else DrawOne(g,
"SUM QUAD", min, max);
404 TLegendEntry* e = l->AddEntry(
"", Form(
"%3d-%3d%%",
405 int(low),
int(high)),
"F");
406 e->SetFillColor(col);
407 e->SetFillStyle(1001);
408 e->SetLineColor(col);
409 e->SetMarkerColor(col);
414 Warning(
"ExtractGSEs",
"No frame given");
417 frame->SetMinimum(0.9*min);
418 frame->SetMaximum(1.1*max);
423 if (mth.EqualTo(
"V0M", TString::kIgnoreCase) &&
424 sys.EqualTo(
"PbPb",TString::kIgnoreCase))
426 if (raw) mth =
"RAW";
427 outName.Form(
"%s_%05d_%s%s.root",sys.Data(),sNN,trg.Data(),mth.Data());
428 TFile* out = TFile::Open(outName,
"RECREATE");
429 ret->Write(
"container",TObject::kSingleKey);
432 Info(
"ExtractGSEs",
"Written to %s", outName.Data());
static SysErrorAdder * Create(const TString &t, const TString &s, UShort_t e, const TString &c)
void Draw(Option_t *option="")
virtual GraphSysErr * Make(TH1 *h, TLegend *l, Double_t eff=1, Bool_t verb=false)
void SetCommonSumLineColor(Color_t color)
void GetMinMax(Option_t *option, Double_t &ymin, Double_t &ymax) const
void SetSumFillStyle(Style_t style)
TMultiGraph * GetMulti(Option_t *option="")
void SetSumOption(EDrawOption_t opt)
void SetSumFillColor(Color_t color)
void SetCommonSumFillStyle(Style_t style)
void SetSumLineColor(Color_t color)
void SetCommonSumFillColor(Color_t color)