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);
271 if (!sys.EqualTo(
"pp"))
272 g->
AddQualifier(
"SQRT(S)/NUCLEON IN GEV", Form(
"%d.0", sNN),
true);
274 g->
AddQualifier(
"SQRT(S) IN GEV", Form(
"%d.0", sNN),
true);
278 g->SetMarkerColor(col);
285 g->
Print(
"sys qual key");
296 min = TMath::Min(min, mn);
297 max = TMath::Max(max, mx);
300 TH1* hist = (mg ? mg->GetHistogram() : 0);
313 const char* name=
"Forward")
315 if (!gROOT->GetClass(
"GraphSysErr")) {
319 gROOT->LoadMacro(
"GraphSysErr.C+g");
321 if (!gROOT->GetClass(
"SysErrorAdder")) {
323 gROOT->LoadMacro(
"SysErrorAdder.C+g");
328 Warning(
"ExtractGSEs",
"Failed to open %s",
filename);
333 if (!results)
return 0;
338 Bool_t emp = (empO != 0 && !raw);
344 TString sys = osys->GetTitle();
346 TString mth = (ocentM && centA ? ocentM->GetTitle() :
"");
347 if (mth.EqualTo(
"none",TString::kIgnoreCase) ||
348 (centA && centA->GetNbins() < 1)) mth =
"";
349 TString trg = (!mth.IsNull() && centA ?
"CENT" : otrg->GetTitle());
350 TString hname = Form(
"dndeta%s%s",name,emp?
"Emp":
"");
352 Printf(
"Read settings\n"
353 " Empirical: %s (%p)\n"
355 " Energy: %d (%s - %p)\n"
356 " Trigger: %s (%s - %p)\n"
357 " Efficiency: %6.4f\n"
358 " Centrality: %s (%p)\n"
360 (emp ?
"yes" :
"no"), empO,
362 sNN, (osNN ? osNN->GetTitle() :
""), osNN,
363 trg.Data(), eff, otrg->GetTitle(), otrg, mth.Data(),
365 if (centA) Printf(
" %d bins between %f and %f",
366 centA->GetNbins(), centA->GetXmin(), centA->GetXmax());
369 if (trg.EqualTo(
"MBOR") && eff > 0 && eff < 1) trg=
"INEL";
370 if (trg.EqualTo(
"V0AND") && eff > 0 && eff < 1) trg=
"NSD";
371 if (trg.EqualTo(
"VISX") && eff > 0 && eff < 1) trg=
"NSD";
373 if (strg.Contains(
"INEL>0")) trg =
"INELGt0";
378 Warning(
"ExtractGSEs",
"Failed to make adder");
382 TCanvas*
c =
new TCanvas(
"c",
"C");
383 c->SetTopMargin(0.01);
384 c->SetRightMargin(0.20);
385 TLegend* l =
new TLegend(0.8,0.1,0.99,0.99,
387 sys.Data(), osNN->GetTitle(), trg.Data()));
396 Double_t min = 100000, max = -1000000;
397 if (!centA || centA->GetNbins() < 1 || mth.IsNull()) {
398 Info(
"ExtractGSEs",
"Doing pp-like extraction"
399 " all bin, %s, rebin=%d, eff=%f, %p, %s",
400 hname.Data(),
rebin, eff, adder,
401 (cutEdges ?
"cut edges" :
"edges stay"));
404 Warning(
"ExtractGSEs",
"Nothing returned from DoOne(\"all\"...)");
408 ModOne(gg, sys, sNN, trg, gg->GetMarkerColor());
411 frame =
DrawOne(all,
"SUM QUAD AXIS", min, max);
414 for (
Int_t i = 1; i <= centA->GetNbins(); i++) {
415 Double_t low = centA->GetBinLowEdge(i);
416 Double_t high = centA->GetBinUpEdge(i);
418 dir.Form(
"cent%03dd%02d_%03dd%02d",
428 ModOne(gse, sys, sNN, trg, col);
429 if (first) frame =
DrawOne(g,
"SUM QUAD AXIS", min, max);
430 else DrawOne(g,
"SUM QUAD", min, max);
431 TLegendEntry* e = l->AddEntry(
"", Form(
"%3d-%3d%%",
432 int(low),
int(high)),
"F");
433 e->SetFillColor(col);
434 e->SetFillStyle(1001);
435 e->SetLineColor(col);
436 e->SetMarkerColor(col);
441 Warning(
"ExtractGSEs",
"No frame given");
444 frame->SetMinimum(0.9*min);
445 frame->SetMaximum(1.1*max);
450 if (mth.EqualTo(
"V0M", TString::kIgnoreCase) &&
451 sys.EqualTo(
"PbPb",TString::kIgnoreCase))
453 if (raw) mth =
"RAW";
454 outName.Form(
"%s_%05d_%s%s.root",sys.Data(),sNN,strg.Data(),mth.Data());
455 TFile* out = TFile::Open(outName,
"RECREATE");
456 ret->Write(
"container",TObject::kSingleKey);
459 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 AddQualifier(const TString &key, const TString &value, Bool_t replace=false)
void GetMinMax(Option_t *option, Double_t &ymin, Double_t &ymax) const
virtual void Print(Option_t *option="R") const
void SetSumFillStyle(Style_t style)
TMultiGraph * GetMulti(Option_t *option="")
void SetSumOption(EDrawOption_t opt)
TFile * file
TList with histograms for a given trigger.
void SetSumFillColor(Color_t color)
void SetCommonSumFillStyle(Style_t style)
void SetSumLineColor(Color_t color)
void SetCommonSumFillColor(Color_t color)