4 * Scripts to draw energy loss fits from correction object file
6 * @ingroup pwglf_forward_scripts_corr
11 * @param c Canvas to clear
13 * @ingroup pwglf_forward_scripts_corr
16 ClearCanvas(TCanvas* c)
19 c->SetRightMargin(.05);
20 c->SetBottomMargin(.1);
26 * Draw energy loss fits to a multi-page PDF.
29 * The input file is expected to contain a AliFMDCorrELossFit object
30 * named @c elossfits in the top level directory.
33 * A multi-page PDF. Note, that the PDF generated by ROOT in this way
34 * is broken (cannot be read by Acrobat Reader on Windows and MacOSX)
35 * and one should pass it through a filter to correct these problems.
37 * @param fname File name
38 * @param option Drawing options
40 * @ingroup pwglf_forward_scripts_corr
43 DrawCorrAcc2(const char* fname, const char* option="colz")
45 //__________________________________________________________________
46 // Load libraries and object
47 gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C");
49 TFile* file = TFile::Open(fname, "READ");
51 Error("DrawCorrAcc", "Failed to open %s", fname);
55 pname.ReplaceAll(".root", ".pdf");
58 AliForwardCorrectionManager::Instance()
59 .GetObjectName(AliForwardCorrectionManager::kAcceptance);
60 AliFMDCorrAcceptance* corr =
61 static_cast<AliFMDCorrAcceptance*>(file->Get(objName));
63 Error("DrawCorrAcc", "Object '%s' not found in %s", objName, fname);
67 //__________________________________________________________________
69 // TCanvas* c = new TCanvas("c", "c", 800 / TMath::Sqrt(2), 800);
70 TCanvas* c = new TCanvas("c", "c", 800, 800 / TMath::Sqrt(2));
75 gStyle->SetOptStat(0);
76 gStyle->SetTitleColor(0);
77 gStyle->SetTitleStyle(0);
78 gStyle->SetTitleBorderSize(0);
79 gStyle->SetTitleX(.5);
81 gStyle->SetTitleW(.8);
82 gStyle->SetTitleH(.09);
83 gStyle->SetFrameFillColor(kWhite);
84 gStyle->SetFrameBorderSize(1);
85 gStyle->SetFrameBorderMode(1);
86 gStyle->SetPalette(1);
89 const TAxis& vtxAxis = corr->GetVertexAxis();
90 Int_t nVtx = vtxAxis.GetNbins();
91 c->Divide((nVtx+2)/3, 3, 0, 0);
94 //__________________________________________________________________
95 // Draw all corrections
96 for (UShort_t v = 1; v <= nVtx; v++) {
98 if (ipad == 1 || ipad == 12) ipad++;
100 TVirtualPad* p = c->cd(ipad);
101 p->SetFillColor(kWhite);
103 THStack* stack = new THStack(Form("vtx%02d", v),
104 Form("%+5.1f<v_{z}<%+5.1f",
105 vtxAxis.GetBinLowEdge(v),
106 vtxAxis.GetBinUpEdge(v)));
107 for (UShort_t d = 1; d <= 3; d++) {
108 UShort_t nQ = (d == 1 ? 1 : 2);
109 for (UShort_t q = 0; q < nQ; q++) {
110 Char_t r = (q == 0 ? 'I' : 'O');
112 TH2* h1 = corr->GetCorrection(d, r, v);
114 Warning("DrawCorrAcc", "No correction for r=%c, v=%d", r, v);
117 Int_t nY = h1->GetNbinsY();
118 TH1* hh = h1->ProjectionX(Form("FMD%d%c", d, r), 1, nY);
121 hh->SetMarkerColor(AliForwardUtil::RingColor(d, r));
122 hh->SetLineColor(AliForwardUtil::RingColor(d, r));
123 hh->SetFillColor(AliForwardUtil::RingColor(d, r));
124 hh->SetFillStyle(3004);
129 stack->SetMaximum(1.2);
130 stack->Draw("nostack");
132 //__________________________________________________________________
134 c->SaveAs("acceptance.png");