52 out = TString::Format(
"forward_%s.pdf", prefix.Data());
69 extra, options, local);
93 Run(what, runNo, sys, sNN, fld, mc, sat, options, local);
117 const char* local=
"")
121 sNN, field, mc, sat, options, local);
144 const char* local=
"")
155 AppendName(name, AliForwardCorrectionManager::kSecondaryMap);
157 AppendName(name, AliForwardCorrectionManager::kAcceptance);
159 AppendName(name, AliForwardCorrectionManager::kELossFits);
161 AppendName(name, AliForwardCorrectionManager::kNoiseGain);
163 Warning(
"CorrDrawer",
"Vertex bias not implemented yet");
165 Warning(
"CorrDrawer",
"Double hit not implemented yet");
167 Warning(
"CorrDrawer",
"Merging efficiency not implemented yet");
170 UShort_t flags = what & (AliForwardCorrectionManager::kELossFits|
171 AliForwardCorrectionManager::kAcceptance|
172 AliForwardCorrectionManager::kSecondaryMap|
174 if (!mgr.
Init(runNo, sys, sNN, field, mc, sat, flags,
true)) {
175 Error(
"CorrDrawer",
"Failed to initialize for flags=0x%02x" 176 "run=%lu, sys=%hu, sNN=%hu, field=%hd, mc=%d, sat=%d",
177 flags, runNo, sys, sNN, field, mc, sat);
187 Bool_t few = opts.Contains(
"FEW");
188 Bool_t details = !opts.Contains(
"SINGLE");
189 if (opts.Contains(
"PORTRAIT")) landscape =
false;
201 DrawParameter(y,
"Simulation", Form(
"%s", mc ?
"yes" :
"no"));
202 DrawParameter(y,
"Satellite", Form(
"%s", sat ?
"yes" :
"no"));
206 if (what & AliForwardCorrectionManager::kSecondaryMap)
208 if (what & AliForwardCorrectionManager::kAcceptance)
210 if (what & AliForwardCorrectionManager::kELossFits)
212 if (what & AliForwardCorrectionManager::kNoiseGain)
226 Warning(
"CorrDrawer",
"Don't know how to draw a %s object",
270 const char* local=
"")
274 sNN, field, mc, sat, options, local);
299 const char* local=
"")
301 Run(what, runNo, sys, sNN, field, mc, sat, options, local);
312 Warning(
"CorrDrawer",
"Don't know how to draw a %s object (PDF: %s)",
313 o->ClassName(), pdf ?
"yes" :
"no");
381 const TString& local =
"fmd_corrections.root",
386 output, local, options);
402 const TString& local =
"fmd_corrections.root",
406 drawer->
Run(what, output, options, local);
417 if (!what.IsNull()) what.Append(
"_");
420 what.Append(
"secondary");
break;
422 what.Append(
"acceptance");
break;
424 what.Append(
"elossfits");
break;
426 what.Append(
"noisegain");
break;
428 what.Append(
"unknown");
break;
451 TFile*
fout = TFile::Open(fELossExtra,
"READ");
453 Warning(
"SummarizeELoss",
"Correction task output \"%s\" not found",
462 if (!forward)
throw false;
466 if (!eventInsp)
throw false;
470 if (!
GetParameter(eventInsp,
"field", fld))
throw false;
471 if (!
GetParameter(eventInsp,
"satellite", sat))
throw false;
472 if (!
GetParameter(eventInsp,
"runNo", runNo))
throw false;
480 if (fout) fout->Close();
494 if (!fELossExtra.IsNull()) {
495 canName =
gSystem->BaseName(fELossExtra.Data());
496 canName.ReplaceAll(
".root",
".pdf");
508 Warning(
"CorrDrawer",
"Don't know how to summarize a %s object",
520 Warning(
"CorrDrawer",
"No acceptance available");
525 Warning(
"CorrDrawer",
"No canvas");
531 Int_t nVtx = vtxAxis.GetNbins();
542 TLatex* ll =
new TLatex(.5,.8,
fCanvas->GetTitle());
543 ll->SetTextAlign(22);
544 ll->SetTextSize(0.03);
548 TLatex* l =
new TLatex(.5,.8,
"");
550 l->SetTextSize(0.03);
553 l->DrawLatex(0.2, 0.70,
"Acceptance due to dead channels");
555 l->DrawLatex(0.5, 0.55,
"c_{v,r}(#eta,#phi) = #frac{" 556 "#sum active strips #in (#eta,#phi)}{" 557 "#sum strips #in (#eta,#phi)}");
563 for (
UShort_t v=1; v <= nVtx; v++) {
564 Double_t vzMin = vtxAxis.GetBinLowEdge(v);
565 Double_t vzMax = vtxAxis.GetBinUpEdge(v);
573 Char_t r = (q == 0 ?
'I' :
'O');
577 Warning(
"DrawCorrAcc",
"No correction for FMD%d%c, v=%d", d, r, v);
584 Int_t nY = h2->GetNbinsY();
585 TH1* hh = h2->ProjectionX(Form(
"FMD%d%c", d, r), 1, nY);
591 hh->SetFillStyle(3001);
593 THStack*
stack =
static_cast<THStack*
>(stacks->At(v-1));
595 Error(
"",
"No stack at v=%d", v-1);
601 Warning(
"",
"No phi acceptance defined");
604 stack =
static_cast<THStack*
>(stacks2->At(v-1));
606 Error(
"",
"No stack at v=%d", v-1);
611 Error(
"",
"No phi acceptance at v=%d", v-1);
618 hp->SetFillStyle(3001);
625 PrintCanvas(Form(
"%+5.1fcm<IP_{z}<%+5.1fcm", vzMin, vzMax));
643 Warning(
"CorrDrawer",
"No secondary map available");
648 Warning(
"CorrDrawer",
"No canvas");
653 Int_t nVtx = vtxAxis.GetNbins();
660 TLatex* ll =
new TLatex(.5,.8,
fCanvas->GetTitle());
661 ll->SetTextAlign(22);
662 ll->SetTextSize(0.03);
666 TLatex* l =
new TLatex(.5,.8,
"");
668 l->SetTextSize(0.03);
671 l->DrawLatex(0.2, 0.70,
"Secondary map");
673 l->DrawLatex(0.5, 0.60,
"c_{v,r}(#eta,#phi)=#frac{" 674 "#sum N_{ch,primary,i}(#eta,#phi)}{" 675 "#sum N_{ch,FMD,i}(#eta,#phi)}");
677 l->DrawLatex(0.2, 0.50,
"N: Number of events");
678 l->DrawLatex(0.2, 0.45,
"N_{ch,primary,i}(#eta,#phi): Number of charged, " 679 "primary particles in (#eta,#phi) bin");
680 l->DrawLatex(0.2, 0.40,
"N_{ch,primary,i}(#eta,#phi): Number of charged, " 681 "particles that hit the FMD in (#eta,#phi) bin");
682 l->DrawLatex(0.2, 0.35,
"All quantities determined in MC");
688 for (
UShort_t v=1; v <= nVtx; v++) {
689 Double_t vzMin = vtxAxis.GetBinLowEdge(v);
690 Double_t vzMax = vtxAxis.GetBinUpEdge(v);
698 Char_t r = (q == 0 ?
'I' :
'O');
702 Warning(
"DrawCorrSec",
"No correction for FMD%d%c, v=%d", d, r, v);
708 Int_t nY = h2->GetNbinsY();
709 TH1* hh = h2->ProjectionX(Form(
"FMD%d%c", d, r), 1, nY);
715 hh->SetFillStyle(3001);
717 THStack*
stack =
static_cast<THStack*
>(stacks->At(v-1));
719 Error(
"",
"No stack at v=%d", v-1);
726 PrintCanvas(Form(
"%+5.1fcm<IP_{z}<%+5.1fcm", vzMin, vzMax));
735 Warning(
"CorrDrawer",
"No noise-gain correction available");
740 Warning(
"CorrDrawer",
"No canvas");
749 Char_t r = q == 0 ?
'I' :
'O';
753 TH2* h =
new TH2D(Form(
"fmd%d%c", d, r),
754 Form(
"FMD%d%c", d, r),
755 nT, -.5, nT-.5, nS, -.5, nS-.5);
757 h->SetXTitle(
"Strip");
758 h->SetYTitle(
"Sector");
766 h->GetZaxis()->SetRangeUser(0,0.05);
784 Warning(
"CorrDrawer",
"No energy loss fits available");
789 Warning(
"CorrDrawer",
"No canvas");
799 TDirectory* savDir = gDirectory;
800 if (!
gSystem->AccessPathName(fELossExtra.Data())) {
801 hists = TFile::Open(fELossExtra,
"READ");
802 Info(
"",
"Opened %s -> %p", fELossExtra.Data(), hists);
805 Warning(
"",
"Couldn't open %s", fELossExtra.Data());
807 TList* fr =
static_cast<TList*
>(hists->Get(
"ForwardELossResults"));
809 fr =
static_cast<TList*
>(hists->Get(
"forwardQAResults"));
812 fitter =
static_cast<TList*
>(fr->FindObject(
"fmdEnergyFitter"));
821 TLatex* ll =
new TLatex(.5,.9,
"ESD #rightarrow #Delta-fits" 823 ll->SetTextAlign(22);
824 ll->SetTextSize(0.05);
829 #define DL(X,Y,T) do { l->DrawLatex(X,Y,T); Y -= fontSize; } while (false) 830 TLatex* l =
new TLatex(.5,.8,
"");
832 l->SetTextSize(fontSize);
838 DL(x,y,
"1^{st} page is a summary of fit parameters");
839 DL(x,y,
"2^{nd} page is a summary of relative errors");
840 DL(x,y,
"Subsequent pages shows the fitted functions");
842 DL(z,y,
"Black line is the full fitted function");
843 DL(z,y,
"Coloured lines are the individual N-mip comp.");
844 DL(x,y,
"Each component has the form");
846 DL(z,y,
"f_{n}(x; #Delta, #xi, #sigma') = " 847 "#int_{-#infty}^{+#infty}dx' " 848 "landau(x'; #Delta, #xi)gaus(x'; x, #sigma')");
850 DL(x,y,
"The full function is given by");
852 DL(z,y,
"f_{N}(x; #Delta, #xi, #sigma', #bf{a}) = " 853 "C #sum_{i=1}^{N} a_{i} " 854 "f_{i}(x; #Delta_{i}, #xi_{i}, #sigma_{i}')");
856 DL(z,y,
"#Delta_{i} = i (#Delta_{1} + #xi_{1} log(i)) +#delta_{i}");
857 DL(z,y,
"#xi_{i} = i #xi_{1}");
858 DL(z,y,
"#sigma_{i} = #sqrt{i} #sigma_{1}");
859 DL(z,y,
"#sigma_{n} #dot{=} 0");
860 DL(z,y,
"#sigma_{i}'^{2} = #sigma^{2}_{n} + #sigma_{i}^{2}");
861 DL(z,y,
"#delta_{i} = c#sigmau/(1+1/i)^{pu#sqrt{u}}");
862 DL(z,y,
"u = #sigma/#xi");
863 DL(z,y,
"a_{1} #dot{=} 1");
865 DL(z,y,Form(
"Least quality: %d", fMinQuality));
868 TObject* refit = fitter->FindObject(
"refitted");
869 if (refit)
DL(z,y,
"Refitted distributions");
874 if (details && fitter) {
882 DrawTParameter<double>(y,
fitter,
"lowCut");
883 DrawTParameter<int> (y,
fitter,
"nParticles");
884 DrawTParameter<int> (y,
fitter,
"minEntries");
885 DrawTParameter<int> (y,
fitter,
"subtractBins");
886 DrawTParameter<bool> (y,
fitter,
"doFits");
887 DrawTParameter<double>(y,
fitter,
"maxE");
888 DrawTParameter<int> (y,
fitter,
"nEbins");
889 DrawTParameter<bool> (y,
fitter,
"increasingBins");
890 DrawTParameter<double>(y,
fitter,
"maxRelPerError");
891 DrawTParameter<double>(y,
fitter,
"maxChi2PerNDF");
892 DrawTParameter<double>(y,
fitter,
"minWeight");
893 DrawTParameter<double>(y,
fitter,
"regCut");
904 fits->
Draw(
"error good");
906 if (!details)
return;
911 fits->
Draw(
"relative good");
919 Char_t r = (q == 0 ?
'I' :
'O');
925 static_cast<TList*
>(fitter->FindObject(Form(
"FMD%d%c",d,r)));
929 dists =
static_cast<TList*
>(dl->FindObject(
"elossDists"));
931 resis =
static_cast<TList*
>(dl->FindObject(
"elossResiduals"));
936 printf(
"FMD%d%c ", d, r);
959 Int_t nCol = (few ? 1 : 2);
960 Int_t nPad = nRow * nCol;
966 while ((fit = static_cast<AliFMDCorrELossFit::ELossFit*>(next()))) {
968 Bool_t last = j == nPad-1;
969 if (j == 0) divided.
Divide(
true,
true);
972 TVirtualPad* drawPad = divided.
GetPad(j);
979 TString hName(Form(
"FMD%d%c_etabin%03d", d,r,fit->
GetBin()));
980 TH1* dist =
static_cast<TH1*
>(dists->FindObject(hName));
982 if (resis) resi =
static_cast<TH1*
>(resis->FindObject(hName));
985 Bool_t err = resi->GetUniqueID() <= 1;
988 resi->SetYTitle(
"#chi^{2}_{bin}=(h-f)^{2}/#delta^{2}h");
989 for (
Int_t k=1; k<=resi->GetNbinsX(); k++) {
992 if (e <= 0)
continue;
995 resi->SetBinContent(k, c);
996 resi->SetBinError(k, 0);
999 drawPad->Divide(1,2,0,0);
1005 TLine* l =
new TLine(resi->GetXaxis()->GetXmin(), red,
1006 resi->GetXaxis()->GetXmax(), red);
1010 TLatex* cltx =
new TLatex(0.5, 0.5,
1011 Form(
"#chi^{2}/#nu=%6.2f", red));
1013 cltx->SetTextAlign(22);
1014 cltx->SetTextFont(42);
1015 cltx->SetTextSize(0.07);
1017 cltx->DrawLatex(0.5,0.4,Form(
"%g", dist->GetEntries()));
1022 dist->SetFillStyle(3001);
1023 dist->SetMarkerStyle(0);
1030 Form(
"comp good values legend peak %s", (same ?
"same" :
"")),
1033 TLatex* ltx =
new TLatex(.2, .2,
"NOT USED");
1035 ltx->SetTextFont(62);
1036 ltx->SetTextColor(kRed+1);
1037 ltx->SetTextAngle(30);
1038 ltx->SetTextSize(0.2);
1048 PrintCanvas(Form(
"FMD%d%c page %d", d, r, (i/nPad)+1));
1053 PrintCanvas(Form(
"FMD%d%c page %d", d, r, (i/nPad)+1));
1067 Int_t nVtx = vtxAxis.GetNbins();
1069 for (
UShort_t v = 1; v <= nVtx; v++) {
1070 THStack*
stack =
new THStack(Form(
"vtx%02d", v),
1071 Form(
"%+5.1f<v_{z}<%+5.1f",
1072 vtxAxis.GetBinLowEdge(v),
1073 vtxAxis.GetBinUpEdge(v)));
1074 stacks->AddAt(stack, v-1);
1088 if (!stacks)
return false;
1090 Int_t nVtx = stacks->GetEntries();
1092 fBody->Divide(3, (nVtx+2)/3, 0, 0);
1094 for (
UShort_t v = 1; v <= nVtx; v++) {
1097 if (nVtx == 10 && (ipad == 1 || ipad == 12)) ipad++;
1099 THStack*
stack =
static_cast<THStack*
>(stacks->At(v-1));
1101 Error(
"",
"No stack at v=%d", v-1);
1104 TVirtualPad* pad =
fBody->cd(ipad);
1106 Error(
"",
"No pad at %d", ipad);
1109 pad->SetFillColor(kWhite);
1111 if (max > 0) stack->SetMaximum(max);
1112 stack->Draw(
"nostack hist");
TH2D * GetCorrection(UShort_t d, Char_t r, Double_t v) const
virtual void DrawIt(const AliFMDCorrAcceptance *corr, Bool_t details=true)
Base class for classes to draw summaries.
static const char * CenterOfMassEnergyString(UShort_t cms)
void ls(Option_t *option="") const
virtual void SetPrefix(const TString &prefix)
void Run(const Char_t *what, ULong_t runNo, const Char_t *sys, UShort_t sNN, UShort_t field, Bool_t mc=false, Bool_t sat=false, Option_t *options="", const char *local="")
void DrawInRingPad(UShort_t d, Char_t r, TObject *h, Option_t *opts="", UShort_t flags=0x0, const char *title="")
void Divide(Bool_t commonX, Bool_t commonY)
TH2D * GetCorrection(UShort_t d, Char_t r, Double_t v) const
Float_t Get(UShort_t d, Char_t r, UShort_t s, UShort_t t) const
virtual void Draw(const AliFMDCorrELossFit *fits)
void Print(Option_t *option="R") const
virtual void Summarize(const AliFMDCorrSecondaryMap *sec, Bool_t pdf=true)
Bool_t DrawVtxStacks(TObjArray *stacks, Double_t max=-1)
void CacheBins(UShort_t minQuality=kDefaultQuality) const
const TAxis & GetVertexAxis() const
static void Summarize(const TString &what="", Bool_t=false, const TString &output="", const TString &local="fmd_corrections.root", Option_t *options="")
virtual void Draw(const TObject *o)
void DrawELossFits(UShort_t d, Char_t r, TObjArray *ra, TList *dists, TList *resis, bool few)
TH1D * GetPhiAcceptance(UShort_t d, Char_t r, Double_t v) const
virtual TString CanvasName(const char *def)
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)
void Run(UShort_t what, ULong_t runNo, UShort_t sys, UShort_t sNN, UShort_t field, Bool_t mc=false, Bool_t sat=false, Option_t *options="", const char *local="")
static const char * MagneticFieldString(Short_t field)
static Color_t RingColor(UShort_t d, Char_t r)
Bool_t HasOverflow() const
TObjArray * GetRingArray(UShort_t d, Char_t r) const
void Run(const Char_t *what, const Char_t *extra, Option_t *options="", const Char_t *local="")
void AppendName(TString &what, UShort_t which)
Various utilities used in PWGLF/FORWARD.
virtual void Summarize(const AliFMDCorrNoiseGain *corr, Bool_t pdf=true)
static Bool_t GetParameter(const TObject *c, const TString &name, Short_t &value, Bool_t verb=true)
TVirtualPad * GetPad(Int_t idx)
virtual void DrawIt(const AliFMDCorrNoiseGain *corr, bool)
void Run(UShort_t what, const Char_t *extra, Option_t *options="", const Char_t *local="")
virtual void SetDebug(Bool_t debug)
const AliFMDCorrELossFit * GetELossFit() const
const AliFMDCorrNoiseGain * GetNoiseGain() const
void CreateCanvas(const TString &pname, Bool_t landscape=false, Bool_t pdf=true, Bool_t useTop=true)
virtual void DrawIt(const AliFMDCorrSecondaryMap *corr, bool details)
static void MakeFileName(TString &out, const TString &prefix)
void DrawParameter(Double_t &y, const TString &name, const TString &value, Double_t size=0)
static UInt_t ParseFields(const TString &what)
void PrintCanvas(const TString &title, Float_t size=.7)
virtual void Summarize(UShort_t what, ULong_t runNo, UShort_t sys, UShort_t sNN, Short_t field, Bool_t mc=false, Bool_t sat=false, Option_t *options="", const char *local="")
virtual void Draw(const AliFMDCorrAcceptance *acc)
virtual void Summarize(const TString &what, ULong_t runNo, const Char_t *sys, UShort_t sNN, Short_t field, Bool_t mc=false, Bool_t sat=false, Option_t *options="", const char *local="")
const TAxis & GetVertexAxis() const
static UShort_t ParseCollisionSystem(const char *sys)
virtual Bool_t GetInformation(ULong_t &runNo, UShort_t &sys, UShort_t &sNN, Short_t &fld, Bool_t &mc, Bool_t &sat)
virtual void DrawEventInspector(TCollection *parent)
void DivideForRings(Bool_t commonX, Bool_t commonY)
const AliFMDCorrAcceptance * GetAcceptance() const
virtual void Draw(const AliFMDCorrSecondaryMap *sec)
static void Summarize(UShort_t what, Bool_t=false, const TString &output="", const TString &local="fmd_corrections.root", Option_t *options="")
void Draw(Option_t *option="")
virtual void DrawIt(const TObject *o)
TObjArray * CreateVtxStacks(const TAxis &vtxAxis)
static const char * CollisionSystemString(UShort_t sys)
virtual void DrawIt(const AliFMDCorrELossFit *corr, bool details, bool few=true)
TObject * DrawInPad(TVirtualPad *c, Int_t padNo, TObject *h, Option_t *opts="", UInt_t flags=0x0, const char *title="")
const AliFMDCorrSecondaryMap * GetSecondaryMap() const
static TCollection * GetCollection(const TObject *parent, const TString &name, Bool_t verb=true)
virtual void Summarize(const AliFMDCorrELossFit *fits, Bool_t pdf=true)
virtual void Summarize(const AliFMDCorrAcceptance *acc, Bool_t pdf=true)
static AliForwardCorrectionManager & Instance()
virtual void Summarize(const TObject *o, Bool_t pdf=true)