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()));
274 min = TMath::Min(min, mn);
275 max = TMath::Max(max, mx);
278 TH1* hist = (mg ? mg->GetHistogram() : 0);
291 const char* name=
"Forward")
293 if (!gROOT->GetClass(
"GraphSysErr")) {
297 gROOT->LoadMacro(
"GraphSysErr.C+g");
299 if (!gROOT->GetClass(
"SysErrorAdder")) {
301 gROOT->LoadMacro(
"SysErrorAdder.C+g");
306 Warning(
"ExtractGSEs",
"Failed to open %s",
filename);
311 if (!results)
return 0;
314 TH1* empH =
GetH1 (results,
"empirical");
315 Bool_t emp = (empH != 0 && !raw);
321 TString sys = osys->GetTitle();
323 TString mth = (ocentM && centA ? ocentM->GetTitle() :
"");
324 if (mth.EqualTo(
"none",TString::kIgnoreCase) ||
325 (centA && centA->GetNbins() < 1)) mth =
"";
326 TString trg = (!mth.IsNull() && centA ?
"CENT" : otrg->GetTitle());
327 TString hname = Form(
"dndeta%s%s",name,emp?
"Emp":
"");
329 Printf(
"Read settings\n"
330 " Empirical: %s (%p)\n"
332 " Energy: %d (%s - %p)\n"
333 " Trigger: %s (%s - %p)\n"
334 " Centrality: %s (%p)\n"
336 (emp ?
"yes" :
"no"), empH,
338 sNN, (osNN ? osNN->GetTitle() :
""), osNN,
339 trg.Data(), otrg->GetTitle(), otrg, mth.Data(),
341 if (centA) Printf(
" %d bins between %f and %f",
342 centA->GetNbins(), centA->GetXmin(), centA->GetXmax());
345 Warning(
"ExtractGSEs",
"Failed to make adder");
350 TCanvas*
c =
new TCanvas(
"c",
"C");
351 c->SetTopMargin(0.01);
352 c->SetRightMargin(0.20);
353 TLegend* l =
new TLegend(0.8,0.1,0.99,0.99,
355 sys.Data(), osNN->GetTitle(), trg.Data()));
364 Double_t min = 100000, max = -1000000;
365 if (!centA || centA->GetNbins() < 1 || mth.IsNull()) {
366 Info(
"ExtractGSEs",
"Doing pp-like extraction");
369 Warning(
"ExtractGSEs",
"Nothing returned from DoOne(\"all\"...)");
373 frame =
DrawOne(all,
"SUM QUAD AXIS", min, max);
376 for (
Int_t i = 1; i <= centA->GetNbins(); i++) {
377 Double_t low = centA->GetBinLowEdge(i);
378 Double_t high = centA->GetBinUpEdge(i);
380 dir.Form(
"cent%03dd%02d_%03dd%02d",
390 gse->SetMarkerColor(col);
398 if (first) frame =
DrawOne(g,
"SUM QUAD AXIS", min, max);
399 else DrawOne(g,
"SUM QUAD", min, max);
400 TLegendEntry* e = l->AddEntry(
"", Form(
"%3d-%3d%%",
401 int(low),
int(high)),
"F");
402 e->SetFillColor(col);
403 e->SetFillStyle(1001);
404 e->SetLineColor(col);
405 e->SetMarkerColor(col);
410 Warning(
"ExtractGSEs",
"No frame given");
413 frame->SetMinimum(0.9*min);
414 frame->SetMaximum(1.1*max);
419 if (mth.EqualTo(
"V0M", TString::kIgnoreCase) &&
420 sys.EqualTo(
"PbPb",TString::kIgnoreCase))
422 if (raw) mth =
"RAW";
423 outName.Form(
"%s_%05d_%s%s.root",sys.Data(),sNN,trg.Data(),mth.Data());
424 TFile* out = TFile::Open(outName,
"RECREATE");
425 ret->Write(
"container",TObject::kSingleKey);
428 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 SetCommonSumOption(EDrawOption_t opt)
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)