4 * Scripts to draw energy loss fits from correction object file
6 * @ingroup pwg2_forward_analysis_scripts
11 * @param c Canvas to clear
13 * @ingroup pwg2_forward_analysis_scripts
16 ClearCanvas(TCanvas* c)
19 c->SetRightMargin(.05);
20 c->SetBottomMargin(.1);
28 const char* test = gSystem->GetLibraries("PWG2forward2","D",false);
29 if (test && test[0] != '\0') return;
30 gROOT->Macro("$ALICE_ROOT/PWG2/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 @i 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
48 * @ingroup pwg2_forward_analysis_scripts
51 DrawCorrCentralSecMap2(const char* fname, const char* option="colz", bool tracklets=true)
53 //__________________________________________________________________
54 // Load libraries and object
57 TFile* file = TFile::Open(fname, "READ");
59 Error("DrawCorrSecMap", "Failed to open %s", fname);
63 pname.ReplaceAll(".root", ".png");
64 pname = gSystem->BaseName(pname);
66 AliCentralMultiplicityTask::Manager* mgr =
67 new AliCentralMultiplicityTask::Manager;
68 const char* objName = mgr->GetObjectName(0);
69 AliCentralCorrSecondaryMap* corr =
70 static_cast<AliCentralCorrSecondaryMap*>(file->Get(objName));
72 Error("DrawCorrCentralSecMap", "Object '%s' not found in %s",
78 //__________________________________________________________________
81 TCanvas* c = new TCanvas("c", "c", w, w / TMath::Sqrt(2));
85 // c->Print(Form("%s[", pname.Data()));
87 gStyle->SetOptStat(0);
88 gStyle->SetTitleColor(0);
89 gStyle->SetTitleStyle(0);
90 gStyle->SetTitleBorderSize(0);
91 gStyle->SetTitleX(.1);
93 gStyle->SetTitleW(.8);
94 gStyle->SetTitleH(.09);
95 gStyle->SetFrameFillColor(kWhite);
96 gStyle->SetFrameBorderSize(1);
97 gStyle->SetFrameBorderMode(1);
98 gStyle->SetPalette(1);
102 Bool_t h2d = (opt.Contains("lego") ||
103 opt.Contains("surf") ||
104 opt.Contains("col"));
106 //__________________________________________________________________
107 // Draw all corrections
108 const TAxis& vtxAxis = corr->GetVertexAxis();
109 Int_t nVtx = vtxAxis.GetNbins();
110 c->Divide((nVtx+2)/3, 3, 0, 0);
112 for (UShort_t v=1; v <= nVtx+1; v++) {
116 TLatex* l = new TLatex(.5, .5,
117 "#frac{#sum N_{ch,SPD0}}{#sum N_{ch,primary}}");
119 l->SetText(.5,.5,"#frac{dN_{ch}/d#eta}{#sum N_{ch,primary}}");
130 TFile* f = TFile::Open("forward_mccorr.root", "READ");
132 Warning("DrawCorrCentralSecMap2", "File forward_mccorr.root not found");
135 TList* l3 = static_cast<TList*>(f->Get("CentralSums"));
137 Warning("DrawCorrCentralSecMap2", "No CentralSums list found");
141 TH1* xyz = static_cast<TH1*>(l3->FindObject("xyz"));
143 Warning("DrawCorrCentralSecMap2", "no xyz histogram found");
147 xyz = static_cast<TH1*>(xyz->Clone());
148 xyz->SetDirectory(0);
153 TVirtualPad* p = c->cd(ipad);
154 p->SetFillColor(kWhite);
158 TH2* h1 = corr->GetCorrection(v);
160 p->SetRightMargin(0.13);
166 TH1D* pr = h1->ProjectionX(Form("vtxbin%02d", v), -1, -1, "e");
167 TH1D* nr = static_cast<TH1D*>(pr->Clone("norm"));
170 pr->SetTitle(Form("%+5.1f<v_{z}<%+5.1f",
171 vtxAxis.GetBinLowEdge(v),
172 vtxAxis.GetBinUpEdge(v)));
173 pr->SetMarkerColor(kRed+1);
174 pr->SetFillColor(kRed+1);
175 pr->SetFillStyle(3001);
176 pr->SetMaximum(1.65);
177 pr->GetXaxis()->SetRangeUser(-3.1,3.1);
179 Int_t nX = h1->GetNbinsX();
180 Int_t nY = h1->GetNbinsY();
182 for (Int_t i = 1; i <= nX; i++) {
184 for (Int_t j = 1; j <= nY; j++)
185 if (h1->GetBinContent(i,j) > 0.001) nonZero++;
186 nr->SetBinContent(i, nonZero);
188 // pr->Scale(1. / nY);
195 //__________________________________________________________________
197 c->SaveAs(pname.Data());