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);
28 const char* test = gSystem->GetLibraries("PWGLFforward2","D",false);
29 if (test && test[0] != '\0') return;
30 gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C");
34 * Draw energy loss fits to a multi-page PDF.
37 * The input file is expected to contain a AliFMDCorrELossFit object
38 * named @c elossfits in the top level directory.
41 * A multi-page PDF. Note, that the PDF generated by ROOT in this way
42 * is broken (cannot be read by Acrobat Reader on Windows and MacOSX)
43 * and one should pass it through a filter to correct these problems.
45 * @param fname File name
46 * @param option Drawing options
47 * @param tracklets Tracklets flag
49 * @ingroup pwglf_forward_scripts_corr
52 DrawCorrCentralSecMap2(const char* fname, const char* option="colz", bool tracklets=true)
54 //__________________________________________________________________
55 // Load libraries and object
58 TFile* file = TFile::Open(fname, "READ");
60 Error("DrawCorrSecMap", "Failed to open %s", fname);
64 pname.ReplaceAll(".root", ".png");
65 pname = gSystem->BaseName(pname);
67 AliCentralMultiplicityTask::Manager* mgr =
68 new AliCentralMultiplicityTask::Manager;
69 const char* objName = mgr->GetObjectName(0);
70 AliCentralCorrSecondaryMap* corr =
71 static_cast<AliCentralCorrSecondaryMap*>(file->Get(objName));
73 Error("DrawCorrCentralSecMap", "Object '%s' not found in %s",
79 //__________________________________________________________________
82 TCanvas* c = new TCanvas("c", "c", w, w / TMath::Sqrt(2));
86 // c->Print(Form("%s[", pname.Data()));
88 gStyle->SetOptStat(0);
89 gStyle->SetTitleColor(0);
90 gStyle->SetTitleStyle(0);
91 gStyle->SetTitleBorderSize(0);
92 gStyle->SetTitleX(.1);
94 gStyle->SetTitleW(.8);
95 gStyle->SetTitleH(.09);
96 gStyle->SetFrameFillColor(kWhite);
97 gStyle->SetFrameBorderSize(1);
98 gStyle->SetFrameBorderMode(1);
99 gStyle->SetPalette(1);
103 Bool_t h2d = (opt.Contains("lego") ||
104 opt.Contains("surf") ||
105 opt.Contains("col"));
107 //__________________________________________________________________
108 // Draw all corrections
109 const TAxis& vtxAxis = corr->GetVertexAxis();
110 Int_t nVtx = vtxAxis.GetNbins();
111 c->Divide((nVtx+2)/3, 3, 0, 0);
113 for (UShort_t v=1; v <= nVtx+1; v++) {
117 TLatex* l = new TLatex(.5, .5,
118 "#frac{#sum N_{ch,SPD0}}{#sum N_{ch,primary}}");
120 l->SetText(.5,.5,"#frac{dN_{ch}/d#eta}{#sum N_{ch,primary}}");
131 TFile* f = TFile::Open("forward_mccorr.root", "READ");
133 Warning("DrawCorrCentralSecMap2", "File forward_mccorr.root not found");
136 TList* l3 = static_cast<TList*>(f->Get("CentralSums"));
138 Warning("DrawCorrCentralSecMap2", "No CentralSums list found");
142 TH1* xyz = static_cast<TH1*>(l3->FindObject("xyz"));
144 Warning("DrawCorrCentralSecMap2", "no xyz histogram found");
148 xyz = static_cast<TH1*>(xyz->Clone());
149 xyz->SetDirectory(0);
154 TVirtualPad* p = c->cd(ipad);
155 p->SetFillColor(kWhite);
159 TH2* h1 = corr->GetCorrection(v);
161 p->SetRightMargin(0.13);
167 TH1D* pr = h1->ProjectionX(Form("vtxbin%02d", v), -1, -1, "e");
168 TH1D* nr = static_cast<TH1D*>(pr->Clone("norm"));
171 pr->SetTitle(Form("%+5.1f<v_{z}<%+5.1f",
172 vtxAxis.GetBinLowEdge(v),
173 vtxAxis.GetBinUpEdge(v)));
174 pr->SetMarkerColor(kRed+1);
175 pr->SetFillColor(kRed+1);
176 pr->SetFillStyle(3001);
177 pr->SetMaximum(1.65);
178 pr->GetXaxis()->SetRangeUser(-3.1,3.1);
180 Int_t nX = h1->GetNbinsX();
181 Int_t nY = h1->GetNbinsY();
183 for (Int_t i = 1; i <= nX; i++) {
185 for (Int_t j = 1; j <= nY; j++)
186 if (h1->GetBinContent(i,j) > 0.001) nonZero++;
187 nr->SetBinContent(i, nonZero);
189 // pr->Scale(1. / nY);
196 //__________________________________________________________________
198 c->SaveAs(pname.Data());