4 * Scripts to draw energy loss fits from correction object file
6 * @ingroup pwg2_forward_scripts_corr
11 * @param c Canvas to clear
13 * @ingroup pwg2_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 pwg2_forward_scripts_corr
43 DrawCorrSecMap2(const char* fname, const char* option="colz")
45 //__________________________________________________________________
46 // Load libraries and object
47 gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
49 TFile* file = TFile::Open(fname, "READ");
51 Error("DrawCorrSecMap", "Failed to open %s", fname);
55 pname.ReplaceAll(".root", ".png");
56 pname = gSystem->BaseName(pname);
59 AliForwardCorrectionManager::Instance()
60 .GetObjectName(AliForwardCorrectionManager::kSecondaryMap);
61 AliFMDCorrSecondaryMap* corr =
62 static_cast<AliFMDCorrSecondaryMap*>(file->Get(objName));
64 Error("DrawCorrSecMap", "Object '%s' not found in %s", objName, fname);
68 //__________________________________________________________________
70 TCanvas* c = new TCanvas("c", "c", 800, 800 / TMath::Sqrt(2));
74 // c->Print(Form("%s[", pname.Data()));
76 gStyle->SetOptStat(0);
77 gStyle->SetTitleColor(0);
78 gStyle->SetTitleStyle(0);
79 gStyle->SetTitleBorderSize(0);
80 gStyle->SetTitleX(.1);
82 gStyle->SetTitleW(.8);
83 gStyle->SetTitleH(.09);
84 gStyle->SetFrameFillColor(kWhite);
85 gStyle->SetFrameBorderSize(1);
86 gStyle->SetFrameBorderMode(1);
87 gStyle->SetPalette(1);
90 //__________________________________________________________________
91 // Draw all corrections
92 const TAxis& vtxAxis = corr->GetVertexAxis();
93 Int_t nVtx = vtxAxis.GetNbins();
94 c->Divide((nVtx+2)/3, 3, 0, 0);
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);
102 THStack* stack = new THStack(Form("vtxBin%02d", v),
103 Form("%-4.1f<v_{z}<%4.1f",
104 vtxAxis.GetBinLowEdge(v),
105 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("DrawCorrSecMap", "No correction for r=%c, v=%d", r, v);
118 // Info("DrawCorrSecMap2", "Getting FMD%d%c vtxbin %d", d, r, v);
119 TH1D* pr = h1->ProjectionX(Form("FMD%d%c", d, r), -1, -1, "e");
121 pr->SetTitle(Form("FMD%d%c", d, r));
122 pr->Scale(1. / (q == 0 ? 20 : 40));
123 pr->SetMarkerColor(AliForwardUtil::RingColor(d, r));
128 stack->SetMaximum(3.2);
129 stack->Draw("nostack");
132 //__________________________________________________________________
134 c->SaveAs(pname.Data());