10 # include <TGraphErrors.h> 11 # include <TMultiGraph.h> 59 fCuts.Add(
new TNamed(
"mpv",
"0.85 0.7 0.4 0.15"));
60 fCuts.Add(
new TNamed(
"xi",
"1 2.5 4.5 6.8"));
61 fCuts.Add(
new TNamed(
"sig",
".8 .9 1 1.5"));
62 fCuts.Add(
new TNamed(
"prob",
"0.01 0.025 0.04 0.06"));
72 : fMinQuality(o.fMinQuality),
88 if (&o ==
this)
return *
this;
90 fCuts.AddAll(&o.
fCuts);
121 if (!
Init(runNo, sys, sNN, field, mc, sat, local))
return;
131 while ((pCut = iCut())) {
139 fBody->SetBottomMargin(0.20);
140 fBody->SetLeftMargin(0.06);
141 fBody->Divide(1, aP->GetEntries(), 0, 0);
143 while ((pP = static_cast<TObjString*>(iP()))) {
148 if (tM.IsNull()) tM = stack->GetTitle();
152 stack->GetYaxis()->SetTitleSize(0.12);
153 stack->GetYaxis()->SetTitleOffset(0.2);
154 stack->GetYaxis()->SetLabelSize(0.07);
155 if (iPad == 1) stack->GetYaxis()->SetTitle(tM);
156 stack->GetXaxis()->SetTitle(
"#eta");
157 stack->GetXaxis()->SetTitleSize(0.12);
158 stack->GetXaxis()->SetTitleOffset(0.6);
159 stack->GetXaxis()->SetTitleColor(kBlack);
160 stack->GetXaxis()->SetLabelSize(0.07);
163 Color_t col = kBlack;
166 TLatex* nLtx =
new TLatex(-0.75, yLtx,
"Ring");
167 TLatex* pLtx =
new TLatex(-0.7, yLtx,
"Param");
168 TLatex* vLtx =
new TLatex(+0, yLtx,
"Mean#pmVar_{min}^{max}");
169 nLtx->SetTextAlign(31);pLtx->SetTextAlign(11);
170 nLtx->SetTextSize(hLtx);
171 pLtx->SetTextSize(hLtx);
172 vLtx->SetTextSize(hLtx);
173 nLtx->SetTextColor(col);
174 pLtx->SetTextColor(col);
175 vLtx->SetTextColor(col);
186 PrintCanvas(Form(
"%s X={%s}", tM.Data(), sP.Data()));
189 Int_t nAll = fStacks.GetEntries();
190 fBody->SetBottomMargin(0.20);
191 fBody->SetLeftMargin(0.06);
192 fBody->Divide(1, nAll, 0, 0);
193 for (
Int_t iAll = 0; iAll < nAll; iAll++) {
196 all->GetYaxis()->SetTitleSize(0.12);
197 all->GetYaxis()->SetTitleOffset(0.2);
198 all->GetYaxis()->SetLabelSize(0.07);
199 if (iAll == 0) all->GetYaxis()->SetTitle(
"c");
200 all->GetXaxis()->SetTitle(
"#eta");
201 all->GetXaxis()->SetTitleSize(0.12);
202 all->GetXaxis()->SetTitleOffset(0.6);
203 all->GetXaxis()->SetTitleColor(kBlack);
204 all->GetXaxis()->SetLabelSize(0.07);
206 TVirtualPad* p =
fBody->GetPad(iAll+1);
212 Double_t y1 = ((iAll + 2 >= nAll) ? yT - .3 : p->GetBottomMargin());
213 Double_t y2 = ((iAll + 2 >= nAll) ? yT : 0.3);
222 Int_t nSum = fMultiGraphs.GetEntries();
223 fBody->Divide(1,nSum);
224 for (
Int_t i = 1; i <= nSum; i++) {
230 TFile* out = TFile::Open(
"cutMethods.root",
"RECREATE");
231 fStacks.Write(
"stacks", TObject::kSingleKey);
232 fMultiGraphs.Write(
"trends", TObject::kSingleKey);
233 TIter nextMG(&fMultiGraphs);
235 while ((mg = static_cast<TMultiGraph*>(nextMG()))) {
236 TDirectory*
dir = out->mkdir(mg->GetName());
238 mg->GetListOfGraphs()->Write();
258 TLegend* l =
new TLegend(x1,y1,x2,y2);
265 while ((pCut = iCut())) {
270 TLegendEntry* e = l->AddEntry(
"dummy", title,
"p");
271 e->SetMarkerStyle(style);
272 e->SetMarkerColor(kBlack);
290 TLegend* l =
new TLegend(x1,y1,x2,y2);
296 TIter iHist(stack->GetHists());
299 while ((pHist = static_cast<TH1*>(iHist()))) {
300 TString name(pHist->GetName());
301 if (seen.Contains(name))
continue;
302 seen.Append(Form(
" %s", name.Data()));
307 TLegendEntry* e = l->AddEntry(
"dummy", pHist->GetTitle(),
"p");
308 e->SetMarkerStyle(s);
309 e->SetMarkerColor(kBlack);
311 if (nHist < 5) l->SetNColumns(nHist);
312 else l->SetNColumns(nHist/2);
327 if (o)
return static_cast<THStack*
>(o);
328 THStack* s =
new THStack(Form(
"all%02d", i),
"");
343 TObject* o = fMultiGraphs.FindObject(method);
344 if (o)
return static_cast<TMultiGraph*
>(o);
345 TMultiGraph* mg =
new TMultiGraph(method, title);
346 fMultiGraphs.Add(mg);
367 TObject* o = (summaries->GetListOfGraphs() ?
368 summaries->GetListOfGraphs()->FindObject(n) : 0);
372 summary->SetTitle(method);
373 summary->SetLineColor(col);
374 summary->SetMarkerColor(col);
375 summary->SetFillColor(col);
376 summary->SetMarkerStyle(style);
377 summary->SetFillStyle(0);
378 summaries->Add(summary);
401 return kFullDotMedium;
418 mean += (y - mean) / cnt;
419 var += (cnt > 1 ? (TMath::Power(y-mean,2)/(cnt-1)-var/cnt) : 0);
448 for (
Int_t i = 1; i <= h->GetNbinsX(); i++) {
450 if (TMath::Abs(y) <= 1e-9)
continue;
451 min = TMath::Min(min, y);
452 max = TMath::Max(max, y);
471 THStack* all, TMultiGraph* summaries)
474 Info(
"CutStack",
"Method %s -> %d", method.Data(), m);
483 TH2* hist =
new TH2D(
"cut", cut->GetMethodString(
true),
484 200, -4, 6, 5, 0.5, 5.5);
485 hist->GetYaxis()->SetBinLabel(1,
"FMD1i");
486 hist->GetYaxis()->SetBinLabel(2,
"FMD2i");
487 hist->GetYaxis()->SetBinLabel(3,
"FMD2o");
488 hist->GetYaxis()->SetBinLabel(4,
"FMD3o");
489 hist->GetYaxis()->SetBinLabel(5,
"FMD3i");
492 cut->FillHistogram(hist);
496 THStack*
stack =
new THStack(hist,
"x");
497 TList* hists = stack->GetHists();
503 printf(
" %6s %7.4f | ", method.Data(), param[0]);
505 for (
Int_t i = 1; i <= 5; i++) {
506 TH1* h =
static_cast<TH1*
>(hists->At(i-1));
507 TString n(hist->GetYaxis()->GetBinLabel(i));
512 if (!first) first = h;
514 h->SetTitle(Form(
"%f", param[i-1]));
515 h->SetYTitle(cut->GetMethodString(
true));
516 h->SetXTitle(
"#eta");
517 h->SetMarkerColor(col);
518 h->SetFillColor(col);
519 h->SetLineColor(col);
520 h->SetMarkerStyle(style);
525 rMin = TMath::Min(min, rMin);
526 rMax = TMath::Max(max, rMax);
531 TLatex* nLtx =
new TLatex(-0.75, yLtx, n);
532 TLatex* pLtx =
new TLatex(-0.7, yLtx, Form(
"X=%g", param[i-1]));
533 TLatex* vLtx =
new TLatex(+0, yLtx,
534 Form(
"%5.3f#pm%6.4f_{%6.4f}^{%6.4f}",
535 avg, var, max-avg, avg-min));
536 nLtx->SetTextAlign(31);pLtx->SetTextAlign(11);
537 nLtx->SetTextSize(hLtx);pLtx->SetTextSize(hLtx),vLtx->SetTextSize(hLtx);
538 nLtx->SetTextColor(col);pLtx->SetTextColor(col);vLtx->SetTextColor(col);
539 lines->Add(nLtx);lines->Add(pLtx);lines->Add(vLtx);
540 h->GetListOfFunctions()->Add(lines);
541 printf(
"%5.3f+/-%6.4f ", avg, var);
544 Int_t nSum = summary->GetN();
545 summary->SetPoint(nSum, param[i-1], avg);
546 summary->SetPointError(nSum, 0, var);
548 TLatex* rLtx =
new TLatex(6, fMC ? 0.65 : 0.55,
549 Form(
"All: %5.3f#pm%6.4f_{%6.4f}^{%6.4f}",
550 rAvg, rVar, rMin, rMax));
551 rLtx->SetTextSize(0.05);
552 rLtx->SetTextAlign(31);
553 first->GetListOfFunctions()->Add(rLtx);
554 Printf(
"-> %5.3f+/-%6.4f", rAvg, rVar);
555 stack->SetTitle(cut->GetMethodString(
true));
556 stack->SetMinimum(0);
557 stack->SetMaximum(fMC ? 0.7 : 0.6);
559 all->SetMaximum(fMC ? 0.7 : 0.6);
561 summaries->SetTitle(cut->GetMethodString(
true));
563 Int_t nSum = summary->GetN();
564 summary->SetPoint(nSum, param[0], rAvg);
565 summary->SetPointError(nSum, 0, rVar);
599 if (!mgr.
Init(runNo, sys, sNN, field, mc,
false, flags,
true)) {
600 Error(
"DrawMultCuts",
"Failed to initialize for flags=0x%02x, " 601 "run=%lu, sys=%hu, sNN=%hu, field=%hd, mc=%s, sat=%s",
602 flags, runNo, sys, sNN, field, mc ?
"true" :
"false",
"false");
614 TLatex*
title =
new TLatex(.5, y,
"#Delta Cuts");
615 title->SetTextAlign(23);
616 title->SetTextFont(42);
617 title->SetTextSize(0.1);
626 DrawParameter(y,
"Simulation", Form(
"%s", mc ?
"yes" :
"no"));
627 DrawParameter(y,
"Satellite", Form(
"%s", sat ?
"yes" :
"no"));
static EMethod String2Method(const char *str)
Base class for classes to draw summaries.
static const char * CenterOfMassEnergyString(UShort_t cms)
TMultiGraph * AllSummary(const TString &method, const TString &title)
void DrawMethodLegend(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Bool_t Init(ULong_t runNo=999, UShort_t sys=0, UShort_t sNN=0, Short_t field=999, Bool_t mc=false, Bool_t sat=false, const Char_t *local=0)
MultCutDrawer & operator=(const MultCutDrawer &o)
TLegend * DrawRingLegend(TVirtualPad *p, UInt_t flags)
THStack * CutStack(const TString &method, Double_t *param, THStack *all, TMultiGraph *summaries)
void Run(ULong_t runNo=999, UShort_t sys=0, UShort_t sNN=0, Short_t field=999, Bool_t mc=false, const Char_t *local=0)
void CacheBins(UShort_t minQuality=kDefaultQuality) const
Bool_t Init(ULong_t runNumber, UShort_t collisionSystem, UShort_t cmsNN, Short_t field, Bool_t mc=false, Bool_t satelliteCollisions=false, UInt_t what=kDefault, Bool_t force=false)
static const char * Method2String(EMethod method, Bool_t latex)
static const char * MagneticFieldString(Short_t field)
static Color_t RingColor(UShort_t d, Char_t r)
Various utilities used in PWGLF/FORWARD.
void DrawValueLegend(THStack *stack, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
static Style_t CutStyle(UShort_t m)
virtual void SetDebug(Bool_t debug)
TGraphErrors * FindSummary(TMultiGraph *summaries, const TString &n, const TString &method, Color_t col, Style_t style)
const AliFMDCorrELossFit * GetELossFit() const
void CreateCanvas(const TString &pname, Bool_t landscape=false, Bool_t pdf=true, Bool_t useTop=true)
static void Statistics(Double_t y, Int_t &cnt, Double_t &mean, Double_t &var)
void DrawParameter(Double_t &y, const TString &name, const TString &value, Double_t size=0)
void PrintCanvas(const TString &title, Float_t size=.7)
static void HistStatistics(const TH1 *h, Double_t &mean, Double_t &var, Double_t &min, Double_t &max, Int_t &rCnt, Double_t &rMean, Double_t &rVar)
MultCutDrawer(const MultCutDrawer &o)
static const char * CollisionSystemString(UShort_t sys)
TObject * DrawInPad(TVirtualPad *c, Int_t padNo, TObject *h, Option_t *opts="", UInt_t flags=0x0, const char *title="")
THStack * AllStack(Int_t i)
void SetELossFitsPath(const char *d)
static AliForwardCorrectionManager & Instance()