]>
Commit | Line | Data |
---|---|---|
b0e36b4a | 1 | /** |
2 | * @file | |
3 | * | |
4 | * Scripts to draw energy loss fits from correction object file | |
5 | * | |
6 | * @ingroup pwg2_forward_analysis_scripts | |
7 | */ | |
8 | /** | |
9 | * Clear canvas | |
10 | * | |
11 | * @param c Canvas to clear | |
12 | * | |
13 | * @ingroup pwg2_forward_analysis_scripts | |
14 | */ | |
15 | void | |
16 | ClearCanvas(TCanvas* c) | |
17 | { | |
18 | c->SetLeftMargin(.1); | |
19 | c->SetRightMargin(.05); | |
20 | c->SetBottomMargin(.1); | |
21 | c->SetTopMargin(.05); | |
22 | c->Clear(); | |
23 | } | |
24 | ||
25 | /** | |
26 | * Draw energy loss fits to a multi-page PDF. | |
27 | * | |
28 | * @par Input: | |
29 | * The input file is expected to contain a AliFMDCorrELossFit object | |
30 | * named @i elossfits in the top level directory. | |
31 | * | |
32 | * @para Output: | |
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. | |
36 | * | |
37 | * @param fname File name | |
38 | * @param option Drawing options | |
39 | * | |
40 | * @ingroup pwg2_forward_analysis_scripts | |
41 | */ | |
42 | void | |
43 | DrawCorrSecMap(const char* fname, const char* option="colz") | |
44 | { | |
45 | //__________________________________________________________________ | |
46 | // Load libraries and object | |
47 | gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C"); | |
48 | ||
49 | TFile* file = TFile::Open(fname, "READ"); | |
50 | if (!file) { | |
51 | Error("DrawCorrSecMap", "Failed to open %s", fname); | |
52 | return; | |
53 | } | |
54 | TString pname(fname); | |
55 | pname.ReplaceAll(".root", ".pdf"); | |
56 | ||
57 | const char* objName = | |
58 | AliForwardCorrectionManager::Instance() | |
59 | .GetObjectName(AliForwardCorrectionManager::kSecondaryMap); | |
60 | AliFMDCorrSecondaryMap* corr = | |
61 | static_cast<AliFMDCorrSecondaryMap*>(file->Get(objName)); | |
62 | if (!corr) { | |
63 | Error("DrawCorrSecMap", "Object '%s' not found in %s", objName, fname); | |
64 | return; | |
65 | } | |
66 | ||
67 | //__________________________________________________________________ | |
68 | // Create a canvas | |
69 | TCanvas* c = new TCanvas("c", "c", 800 / TMath::Sqrt(2), 800); | |
70 | c->SetFillColor(0); | |
71 | c->SetBorderSize(0); | |
72 | c->SetBorderMode(0); | |
73 | c->Print(Form("%s[", pname.Data())); | |
74 | ||
75 | gStyle->SetOptStat(0); | |
76 | gStyle->SetTitleColor(0); | |
77 | gStyle->SetTitleStyle(0); | |
78 | gStyle->SetTitleBorderSize(0); | |
79 | gStyle->SetTitleX(.1); | |
80 | gStyle->SetTitleY(1); | |
81 | gStyle->SetTitleW(.8); | |
82 | gStyle->SetTitleH(.09); | |
83 | gStyle->SetFrameFillColor(kWhite); | |
84 | gStyle->SetFrameBorderSize(1); | |
85 | gStyle->SetFrameBorderMode(1); | |
86 | gStyle->SetPalette(1); | |
87 | ||
88 | ClearCanvas(c); | |
89 | //__________________________________________________________________ | |
90 | // Create a title page | |
91 | TLatex* ll = new TLatex(.5,.8, fname); | |
92 | ll->SetTextAlign(22); | |
93 | ll->SetTextSize(0.03); | |
94 | ll->SetNDC(); | |
95 | ll->Draw(); | |
96 | ||
97 | TLatex* l = new TLatex(.5,.8, fname); | |
98 | l->SetNDC(); | |
99 | l->SetTextSize(0.03); | |
100 | l->SetTextFont(132); | |
101 | l->SetTextAlign(12); | |
102 | l->DrawLatex(0.2, 0.70, "Secondary map"); | |
103 | l->SetTextAlign(22); | |
104 | l->DrawLatex(0.5, 0.60, "c_{v,r}(#eta,#phi)=#frac{" | |
105 | "#sum N_{ch,primary,i}(#eta,#phi)}{" | |
106 | "#sum N_{ch,FMD,i}(#eta,#phi)}"); | |
107 | l->SetTextAlign(12); | |
108 | l->DrawLatex(0.2, 0.50, "N: Number of events"); | |
109 | l->DrawLatex(0.2, 0.45, "N_{ch,primary,i}(#eta,#phi): Number of charged, " | |
110 | "primary particles in (#eta,#phi) bin"); | |
111 | l->DrawLatex(0.2, 0.40, "N_{ch,primary,i}(#eta,#phi): Number of charged, " | |
112 | "particles that hit the FMD in (#eta,#phi) bin"); | |
113 | l->DrawLatex(0.2, 0.35, "All quantities determined in MC"); | |
114 | ||
115 | c->Print(pname.Data(), "Title:Title page"); | |
116 | ||
117 | ClearCanvas(c); | |
118 | ||
119 | //__________________________________________________________________ | |
120 | // Draw all corrections | |
121 | const TAxis& vtxAxis = corr->GetVertexAxis(); | |
122 | Int_t nVtx = vtxAxis.GetNbins(); | |
123 | for (UShort_t d = 1; d <= 3; d++) { | |
124 | UShort_t nQ = (d == 1 ? 1 : 2); | |
125 | for (UShort_t q = 0; q < nQ; q++) { | |
126 | Char_t r = (q == 0 ? 'I' : 'O'); | |
127 | ||
128 | ClearCanvas(c); | |
129 | c->Divide(2, (nVtx+1)/2); | |
130 | for (UShort_t v=1; v <= nVtx; v++) { | |
131 | TVirtualPad* p = c->cd(v); | |
132 | ||
133 | ||
134 | TH2* h1 = corr->GetCorrection(d, r, v); | |
135 | if (!h1) { | |
136 | Warning("DrawCorrSecMap", "No correction for r=%c, v=%d", r, v); | |
137 | continue; | |
138 | } | |
139 | h1->Draw(option); | |
140 | } | |
141 | c->Print(pname.Data(), Form("Title:FMD%d%c", d, r)); | |
142 | } | |
143 | } | |
144 | ||
145 | //__________________________________________________________________ | |
146 | // Close output file | |
147 | c->Print(Form("%s]", pname.Data())); | |
148 | } | |
149 | // | |
150 | // EOF | |
151 | // |