]>
Commit | Line | Data |
---|---|---|
2955f67c | 1 | #include "SummaryDrawer.C" |
77f97e3f CHC |
2 | #ifndef __CINT__ |
3 | # include <TGraph.h> | |
4 | # include <TGraphErrors.h> | |
5 | # include <TF1.h> | |
6 | # include <TArrow.h> | |
7 | #else | |
8 | class TGraph; | |
06963733 | 9 | class TFile; |
77f97e3f | 10 | #endif |
2955f67c | 11 | |
8449e3e0 | 12 | /** |
13 | * Class to draw a summary of the AOD production | |
14 | * | |
15 | * @par Input: | |
16 | * - The merged <tt>forward.root</tt> file. | |
17 | * If the file isn't merged, it should still work. | |
18 | * | |
19 | * @par Output: | |
20 | * - A PDF file named after the input, but with <tt>.root</tt> | |
21 | * replaced with <tt>pdf</tt> | |
22 | * | |
23 | */ | |
2955f67c | 24 | class SummaryAODDrawer : public SummaryDrawer |
25 | { | |
26 | public: | |
8449e3e0 | 27 | enum EFlags { |
28 | kEventInspector = 0x001, | |
29 | kSharingFilter = 0x002, | |
30 | kDensityCalculator = 0x004, | |
31 | kCorrector = 0x008, | |
32 | kHistCollector = 0x010, | |
33 | kSteps = 0x020, | |
34 | kResults = 0x040, | |
fba5d22d | 35 | kCentral = 0x080, |
24338c03 | 36 | kESDFixer = 0x100, |
37 | kNormal = 0x1FF | |
8449e3e0 | 38 | }; |
2955f67c | 39 | SummaryAODDrawer() |
40 | : SummaryDrawer(), | |
41 | fSums(0), | |
42 | fResults(0) | |
43 | {} | |
2955f67c | 44 | //__________________________________________________________________ |
06963733 | 45 | TFile* Init(const char* fname) |
2955f67c | 46 | { |
47 | // --- Open the file --------------------------------------------- | |
48 | TString filename(fname); | |
49 | TFile* file = TFile::Open(filename, "READ"); | |
50 | if (!file) { | |
51 | Error("Run", "Failed to open \"%s\"", filename.Data()); | |
06963733 | 52 | return 0; |
2955f67c | 53 | } |
8449e3e0 | 54 | |
2955f67c | 55 | // --- Get top-level collection ---------------------------------- |
c8b1a7db | 56 | fSums = GetCollection(file, "ForwardSums"); |
b767da2c | 57 | if (!fSums) { |
58 | Info("Run", "Trying old name Forward"); | |
59 | fSums = GetCollection(file, "Forward"); | |
06963733 | 60 | if (!fSums) return 0; |
b767da2c | 61 | } |
2955f67c | 62 | |
bfab35d9 | 63 | // --- Do the results ---------------------------------------------- |
64 | fResults = GetCollection(file, "ForwardResults"); | |
65 | if (!fResults) fResults = fSums; // Old-style | |
66 | ||
06963733 | 67 | return file; |
68 | } | |
69 | void SummarizeSharing(const char* fname, UShort_t what=0) | |
70 | { | |
71 | // --- Initialize ------------------------------------------------ | |
72 | TFile* file = 0; | |
73 | if (!(file = Init(fname))) return; | |
74 | ||
75 | // --- Make our canvas ------------------------------------------- | |
76 | TString pdfName("sharing.pdf"); | |
77 | pdfName.ReplaceAll(".root", ".pdf"); | |
78 | CreateCanvas(pdfName, what & kLandscape, true, false); | |
79 | ||
80 | TCollection* c = GetCollection(fSums, "fmdSharingFilter"); | |
81 | if (!c) return; | |
82 | TCollection* rc = GetCollection(fResults, "fmdSharingFilter"); | |
83 | if (!rc) rc = c; | |
84 | ||
85 | Int_t nFiles = 0; | |
86 | TParameter<int>* pnFiles = | |
87 | static_cast<TParameter<int>*>(GetObject(c, "nFiles")); | |
88 | if (pnFiles) { | |
89 | nFiles = pnFiles->GetVal(); | |
90 | } | |
91 | ||
92 | TCollection* lc = GetCollection(c, "lCuts"); | |
93 | TCollection* hc = GetCollection(c, "hCuts"); | |
94 | Int_t lm = 0; | |
95 | Int_t hm = 0; | |
96 | TH2* hLow = GetH2(c, "lowCuts"); | |
97 | TH2* hHigh = GetH2(c, "highCuts"); | |
98 | GetParameter(lc, "method", lm); | |
99 | GetParameter(hc, "method", hm); | |
100 | if (hLow && nFiles > 0 && !hLow->TestBit(BIT(20))) | |
101 | hLow->Scale(1. / nFiles); | |
102 | if (hHigh && nFiles > 0 && !hHigh->TestBit(BIT(20))) | |
103 | hHigh->Scale(1. / nFiles); | |
104 | ||
105 | DivideForRings(true,true); | |
106 | const char** ptr = GetRingNames(false); | |
107 | UShort_t iq = 1; | |
108 | while (*ptr) { | |
109 | TCollection* sc = GetCollection(c, *ptr); | |
110 | if (!sc) { ptr++; iq++; continue; } | |
111 | UShort_t d = Int_t((*ptr)[3])-48; | |
112 | Char_t r = (*ptr)[4]; | |
113 | ||
114 | TH1* esdELoss = GetH1(sc, "esdEloss"); | |
115 | TH1* anaELoss = GetH1(sc, "anaEloss"); | |
116 | TGraph* lowCut = CreateCutGraph(lm, iq, hLow, esdELoss, kYellow+1); | |
117 | TGraph* highCut = CreateCutGraph(hm, iq, hHigh, esdELoss, kCyan+1); | |
118 | // Double_t ignCut = TMath::Max(lowCut->GetX()[3],0.); | |
119 | // Int_t esdLow = esdELoss->FindBin(ignCut); | |
120 | // Int_t anaLow = anaELoss->FindBin(ignCut); | |
121 | // Double_t esdInt = esdELoss->Integral(esdLow,esdELoss->GetNbinsX()+1); | |
122 | // Double_t anaInt = anaELoss->Integral(anaLow,anaELoss->GetNbinsX()+1); | |
123 | // Double_t frac = esdInt > 0 ? (esdInt-anaInt)/esdInt : 1; | |
124 | esdELoss->GetXaxis()->SetRangeUser(-.1, 2); | |
125 | ||
126 | DrawInRingPad(d,r, esdELoss, "", kLogy, *ptr); | |
127 | // "#Delta/#Delta_{mip} reconstructed and merged"); | |
128 | DrawInRingPad(d, r, anaELoss, "same"); | |
129 | DrawInRingPad(d, r, lowCut, "lf same"); | |
130 | DrawInRingPad(d, r, highCut, "lf same"); | |
131 | ptr++; | |
132 | iq++; | |
133 | } | |
134 | TVirtualPad* p = RingPad(0,0); | |
135 | p->cd(); | |
136 | TLegend* l = new TLegend(0.1, 0.1, 0.98, 0.98, ""); | |
137 | l->SetFillStyle(0); | |
138 | l->SetFillColor(0); | |
139 | l->SetBorderSize(0); | |
140 | TLegendEntry* e = 0; | |
141 | e = l->AddEntry("dummy", "ESD signal", "f"); | |
142 | e->SetFillStyle(3002); | |
143 | e->SetFillColor(kBlack); | |
144 | e = l->AddEntry("dummy", "Merged signal", "f"); | |
145 | e->SetFillStyle(3001); | |
146 | e->SetFillColor(kBlack); | |
147 | e = l->AddEntry("dummy", "Low cut", "f"); | |
148 | e->SetFillStyle(3002); | |
149 | e->SetFillColor(kYellow+1); | |
150 | e->SetLineWidth(0); | |
151 | e->SetLineColor(kWhite); | |
152 | e = l->AddEntry("dummy", "High cut", "f"); | |
153 | e->SetFillStyle(3002); | |
154 | e->SetFillColor(kCyan+1); | |
155 | e->SetLineWidth(0); | |
156 | e->SetLineColor(kWhite); | |
157 | l->Draw(); | |
158 | ||
159 | PrintCanvas("Summary of sharing filter"); | |
160 | CloseCanvas(); | |
161 | ||
162 | } | |
163 | void SummarizeSteps(const char* fname, UShort_t what=0) | |
164 | { | |
165 | // --- Initialize ------------------------------------------------ | |
166 | TFile* file = 0; | |
167 | if (!(file = Init(fname))) return; | |
168 | ||
169 | // --- Make our canvas ------------------------------------------- | |
170 | TString pdfName("steps.pdf"); | |
171 | pdfName.ReplaceAll(".root", ".pdf"); | |
172 | CreateCanvas(pdfName, what & kLandscape, true, false); | |
173 | DrawSteps(); | |
174 | CloseCanvas(); | |
175 | } | |
176 | ||
177 | //__________________________________________________________________ | |
178 | /** | |
179 | * | |
180 | * | |
181 | * @param fname | |
182 | * @param what | |
183 | */ | |
184 | void Run(const char* fname, UShort_t what=kNormal) | |
185 | { | |
186 | // --- Initialize ------------------------------------------------ | |
187 | TFile* file = 0; | |
188 | if (!(file = Init(fname))) return; | |
189 | ||
2955f67c | 190 | // --- Make our canvas ------------------------------------------- |
06963733 | 191 | TString pdfName(fname); |
2955f67c | 192 | pdfName.ReplaceAll(".root", ".pdf"); |
bfab35d9 | 193 | CreateCanvas(pdfName, what & kLandscape); |
194 | DrawTitlePage(file); | |
8449e3e0 | 195 | |
196 | // --- Possibly make a chapter here ------------------------------ | |
b767da2c | 197 | TCollection* centralSums = GetCollection(file, "CentralSums", false); |
77f97e3f CHC |
198 | if (!centralSums) { |
199 | Info("Run", "Trying old name \"Central\""); | |
b767da2c | 200 | centralSums = GetCollection(file, "Central", false); |
77f97e3f | 201 | } |
b767da2c | 202 | if (what & kCentral && centralSums) |
8449e3e0 | 203 | MakeChapter("Forward"); |
2955f67c | 204 | |
205 | // --- Set pause flag -------------------------------------------- | |
bfab35d9 | 206 | fPause = what & kPause; |
2955f67c | 207 | |
29dc6eb3 | 208 | // Plot status if found |
209 | TH1* hStatus = GetH1(fSums, "status"); | |
210 | if (hStatus) { | |
211 | hStatus->SetMaximum(hStatus->GetMaximum()*1.2); | |
212 | fBody->SetRightMargin(0.10); | |
213 | DrawInPad(fBody,0,hStatus, "hist text30"); | |
214 | PrintCanvas("Status"); | |
215 | } | |
216 | ||
2955f67c | 217 | // --- Do each sub-algorithm ------------------------------------- |
bfab35d9 | 218 | if (what & kEventInspector) DrawEventInspector(fSums); |
24338c03 | 219 | if (what & kESDFixer) DrawESDFixer(fSums); |
bfab35d9 | 220 | if (what & kSharingFilter) DrawSharingFilter(); |
221 | if (what & kDensityCalculator) DrawDensityCalculator(); | |
222 | if (what & kCorrector) DrawCorrector(); | |
223 | if (what & kHistCollector) DrawHistCollector(); | |
2955f67c | 224 | |
2955f67c | 225 | |
bfab35d9 | 226 | if (what & kSteps) DrawSteps(); |
227 | if (what & kResults) DrawResults(); | |
8449e3e0 | 228 | |
229 | // --- SPD clusters ---------------------------------------------- | |
bfab35d9 | 230 | if (what & kCentral) { |
8449e3e0 | 231 | // --- Get top-level collection -------------------------------- |
c8b1a7db | 232 | fSums = GetCollection(file, "CentralSums"); |
77f97e3f CHC |
233 | if (!fSums) |
234 | fSums = GetCollection(file, "Central"); | |
8449e3e0 | 235 | if (fSums) { |
236 | MakeChapter("Central"); | |
237 | DrawCentral(); | |
bfab35d9 | 238 | if (what & kEventInspector) DrawEventInspector(fSums); |
239 | } | |
240 | fResults = GetCollection(file, "CentralResults"); | |
241 | if (fResults && (what & kResults)) { | |
242 | DrawCentralResults(); | |
8449e3e0 | 243 | } |
bfab35d9 | 244 | |
245 | if (what & kResults) DrawBoth(file); | |
8449e3e0 | 246 | } |
247 | ||
bfab35d9 | 248 | |
2955f67c | 249 | CloseCanvas(); |
250 | } | |
251 | protected: | |
252 | //____________________________________________________________________ | |
bfab35d9 | 253 | void DrawTitlePage(TFile* f) |
2955f67c | 254 | { |
2955f67c | 255 | fBody->cd(); |
256 | ||
bfab35d9 | 257 | TLatex* ltx = new TLatex(.5, .7, "ESD #rightarrow AOD filtering"); |
258 | ltx->SetNDC(); | |
259 | ltx->SetTextSize(0.07); | |
260 | ltx->SetTextAlign(22); | |
261 | ltx->Draw(); | |
262 | ||
b767da2c | 263 | TCollection* fwd = fSums; // GetCollection(f, "ForwardSums"); |
c8b1a7db | 264 | TCollection* cen = GetCollection(f, "CentralSums"); |
bfab35d9 | 265 | Double_t y = .6; |
266 | ||
2955f67c | 267 | Double_t save = fParName->GetTextSize(); |
268 | fParName->SetTextSize(0.03); | |
269 | fParVal->SetTextSize(0.03); | |
8449e3e0 | 270 | |
bfab35d9 | 271 | DrawParameter(y, "Tasks", (fwd ? "Forward" : "")); |
272 | DrawParameter(y, "", (cen ? "Central" : "")); | |
273 | ||
274 | if (fwd) { | |
275 | TCollection* ei = GetCollection(fwd, "fmdEventInspector"); | |
276 | if (ei) { | |
277 | ||
fba5d22d | 278 | UShort_t sys=0, sNN=0; |
279 | Int_t field=0; | |
280 | ULong_t runNo=0; | |
bfab35d9 | 281 | Bool_t mc=false; |
fba5d22d | 282 | GetParameter(ei, "sys", sys); |
283 | GetParameter(ei, "sNN", sNN); | |
284 | GetParameter(ei, "field", field); | |
285 | GetParameter(ei, "runNo", runNo); | |
286 | if (!GetParameter(ei, "mc", mc, false)) mc = false; | |
287 | ||
288 | TString sysString; SysString(sys, sysString); | |
289 | TString sNNString; SNNString(sNN, sNNString); | |
bfab35d9 | 290 | |
fba5d22d | 291 | DrawParameter(y, "System", sysString); |
292 | DrawParameter(y, "#sqrt{s_{NN}}", sNNString); | |
293 | DrawParameter(y, "L3 B field", Form("%+2dkG", field)); | |
294 | DrawParameter(y, "Run #", Form("%6lu", runNo)); | |
bfab35d9 | 295 | DrawParameter(y, "Simulation", (mc ? "yes" : "no")); |
296 | } | |
297 | } | |
298 | PrintCanvas("Title page"); | |
2955f67c | 299 | fParName->SetTextSize(save); |
300 | fParVal->SetTextSize(save); | |
2955f67c | 301 | } |
77f97e3f CHC |
302 | TGraph* CreateCutGraph(Int_t method, Int_t iy, TH2* cuts, TH1* eloss, |
303 | Int_t color) | |
304 | { | |
305 | TGraph* ret = new TGraph(4); | |
306 | Double_t y0 = TMath::Max(eloss->GetMinimum(),1.); | |
307 | Double_t y1 = eloss->GetMaximum(); | |
308 | Double_t min = 1000; | |
309 | Double_t max = 0; | |
29dc6eb3 | 310 | Int_t iiy = (iy == 4 ? 5 : iy == 5 ? 4 : iy); |
77f97e3f | 311 | if (method == 0) { // Fixed value |
29dc6eb3 | 312 | max = cuts->GetBinContent(1, iiy); |
77f97e3f CHC |
313 | min = eloss->GetXaxis()->GetXmin(); |
314 | } | |
315 | else { | |
316 | for (Int_t ix=1; ix <= cuts->GetNbinsX(); ix++) { | |
29dc6eb3 | 317 | Double_t c = cuts->GetBinContent(ix, iiy); |
77f97e3f CHC |
318 | if (c <= 0.0001) continue; |
319 | min = TMath::Min(c, min); | |
320 | max = TMath::Max(c, max); | |
321 | } | |
322 | } | |
323 | // Printf("Cuts between %f,%f @%f, %f", min, max, y0,y1); | |
324 | ret->SetPoint(0, min, y0); | |
325 | ret->SetPoint(1, min, y1); | |
326 | ret->SetPoint(2, max, y1); | |
327 | ret->SetPoint(3, max, y0); | |
328 | ret->SetFillColor(color); | |
329 | ret->SetFillStyle(3002); | |
330 | ret->SetLineColor(kBlack); | |
331 | ret->SetLineStyle(2); | |
332 | ret->SetName(Form("g%s", cuts->GetName())); | |
333 | ret->SetTitle(cuts->GetTitle()); | |
334 | ||
335 | return ret; | |
336 | } | |
7095962e CHC |
337 | //____________________________________________________________________ |
338 | const Char_t* CutMethodName(Int_t lm) const | |
339 | { | |
340 | switch (lm) { | |
a19faec0 | 341 | case 0: return "c=X"; |
342 | case 1: return "c=X#times#Delta_{p}"; | |
343 | case 2: return "c:Lower bound of fit range"; | |
344 | case 3: return "c=#Delta_{p}-X#times#xi"; | |
345 | case 4: return "c=#Delta_{p}-X#times(#xi+#sigma)"; | |
346 | case 5: return "c:P(#Delta<c)<X"; | |
7095962e CHC |
347 | } |
348 | return "unknown"; | |
349 | } | |
350 | //____________________________________________________________________ | |
351 | Int_t PrintCut(const TCollection* c, Double_t& y, const Char_t* name, | |
352 | Double_t size=0) | |
353 | { | |
354 | if (!c) return -1; | |
355 | ||
356 | Int_t method = 0; | |
357 | if (!GetParameter(c, "method", method)) return -1; | |
70849dc0 | 358 | DrawParameter(y, name, CutMethodName(method), size); |
359 | ||
360 | TString params; | |
361 | const char* cuts[] = { "fmd1i", "fmd2i", "fmd2o", "fmd3i", "fmd3o", 0 }; | |
362 | const char** pcut = cuts; | |
363 | while (*pcut) { | |
364 | Double_t cut; | |
365 | GetParameter(c, *pcut, cut); | |
366 | if (pcut != cuts) params.Append(", "); | |
367 | params.Append(Form("%5.2f", cut)); | |
368 | pcut++; | |
7095962e | 369 | } |
70849dc0 | 370 | DrawParameter(y, "Parameters", params, size); |
7095962e CHC |
371 | return method; |
372 | } | |
2955f67c | 373 | //____________________________________________________________________ |
a19faec0 | 374 | void DrawCut(TVirtualPad* parent, Int_t sub, TH2* cuts) |
375 | { | |
376 | if (!cuts) return; | |
377 | THStack* stack = new THStack(cuts,"x"); | |
378 | stack->SetTitle(cuts->GetTitle()); | |
379 | for (Int_t i = 1; i <= cuts->GetNbinsY(); i++) { | |
380 | TH1* hist = static_cast<TH1*>(stack->GetHists()->At(i-1)); | |
381 | TString name(cuts->GetYaxis()->GetBinLabel(i)); | |
382 | UShort_t det = UShort_t(name[3]-48); | |
383 | Char_t rng = name[4]; | |
384 | Color_t col = RingColor(det, rng); | |
24338c03 | 385 | hist->SetDirectory(0); |
a19faec0 | 386 | hist->SetTitle(name); |
387 | hist->SetMarkerStyle(20); | |
388 | hist->SetMarkerColor(col); | |
389 | hist->SetLineColor(col); | |
390 | hist->SetFillColor(col); | |
391 | hist->SetLineWidth(0); | |
392 | hist->SetFillStyle(0); | |
393 | hist->SetXTitle("#eta"); | |
394 | hist->SetYTitle(cuts->GetZaxis()->GetTitle()); | |
395 | } | |
396 | DrawInPad(parent, sub, stack, "nostack p", kLegend|kCenter|kSouth); | |
397 | } | |
398 | //____________________________________________________________________ | |
2955f67c | 399 | void DrawSharingFilter() |
400 | { | |
bfab35d9 | 401 | Info("DrawSharingFilter", "Drawing sharing filter"); |
2955f67c | 402 | TCollection* c = GetCollection(fSums, "fmdSharingFilter"); |
403 | if (!c) return; | |
bfab35d9 | 404 | TCollection* rc = GetCollection(fResults, "fmdSharingFilter"); |
405 | if (!rc) rc = c; | |
2955f67c | 406 | |
7095962e | 407 | // --- Draw summary information ---------------------------------- |
77f97e3f | 408 | fBody->Divide(1, 3, 0, 0); |
2955f67c | 409 | fBody->cd(1); |
410 | ||
70849dc0 | 411 | Double_t y = .95; |
7095962e | 412 | Bool_t angle=false, lowSignal=false, disabled=false; |
24338c03 | 413 | Int_t nFiles = 0; |
8449e3e0 | 414 | if (GetParameter(c, "angle", angle)) |
415 | DrawParameter(y, "Angle correct", (angle ? "yes" : "no")); | |
416 | if (GetParameter(c, "lowSignal", lowSignal)) | |
417 | DrawParameter(y, "Lower signal", (lowSignal ? "yes" : "no")); | |
24338c03 | 418 | TParameter<int>* pnFiles = |
bfab35d9 | 419 | static_cast<TParameter<int>*>(GetObject(c, "nFiles")); |
24338c03 | 420 | if (pnFiles) { |
421 | nFiles = pnFiles->GetVal(); | |
422 | DrawParameter(y, "# files merged", Form("%d", nFiles)); | |
423 | } | |
7095962e CHC |
424 | if (GetParameter(c, "disabled", disabled)) |
425 | DrawParameter(y, "Merging disabled", (disabled ? "yes" : "no")); | |
426 | ||
427 | Int_t lm = 0; | |
428 | Int_t hm = 0; | |
429 | TH2* hLow = 0; | |
430 | TH2* hHigh = 0; | |
431 | if (!disabled) { | |
432 | Bool_t simple=false, three=false; | |
433 | if (GetParameter(c, "simple", simple)) | |
434 | DrawParameter(y, "Simple method", (simple ? "yes" : "no")); | |
435 | if (GetParameter(c, "sumThree", three)) | |
436 | DrawParameter(y, "3-strip merging", (three ? "yes" : "no")); | |
24338c03 | 437 | |
7095962e CHC |
438 | TCollection* lc = GetCollection(c, "lCuts"); |
439 | TCollection* hc = GetCollection(c, "hCuts"); | |
440 | lm = PrintCut(lc, y, "Low cut"); | |
441 | hm = PrintCut(hc, y, "High cut"); | |
442 | hLow = GetH2(c, "lowCuts"); | |
443 | hHigh = GetH2(c, "highCuts"); | |
29dc6eb3 | 444 | if (hLow && nFiles > 0 && !hLow->TestBit(BIT(20))) |
445 | hLow->Scale(1. / nFiles); | |
446 | if (hHigh && nFiles > 0 && !hHigh->TestBit(BIT(20))) | |
447 | hHigh->Scale(1. / nFiles); | |
a19faec0 | 448 | DrawCut(fBody, 2, hLow); |
449 | DrawCut(fBody, 3, hHigh); | |
7095962e | 450 | } |
2955f67c | 451 | PrintCanvas("Sharing filter"); |
452 | ||
7095962e CHC |
453 | if (!disabled) { |
454 | // --- Draw rings individually ----------------------------------- | |
455 | Double_t savX = fParVal->GetX(); | |
456 | Double_t savY = fParVal->GetY(); | |
457 | fParVal->SetX(0.6); | |
458 | fParVal->SetY(0.6); | |
459 | const char** ptr = GetRingNames(false); | |
460 | UShort_t iq = 1; | |
461 | while (*ptr) { | |
462 | TCollection* sc = GetCollection(c, *ptr); | |
463 | if (!sc) { ptr++; iq++; continue; } | |
464 | ||
465 | if (fLandscape) fBody->Divide(3, 2); | |
466 | else fBody->Divide(2,3); | |
467 | ||
468 | TH1* esdELoss = GetH1(sc, "esdEloss"); | |
70849dc0 | 469 | TH1* anaELoss = GetH1(sc, "anaEloss"); |
7095962e CHC |
470 | TGraph* lowCut = CreateCutGraph(lm, iq, hLow, esdELoss, kYellow+1); |
471 | TGraph* highCut = CreateCutGraph(hm, iq, hHigh, esdELoss, kCyan+1); | |
29dc6eb3 | 472 | Double_t ignCut = TMath::Max(lowCut->GetX()[3],0.); |
473 | Int_t esdLow = esdELoss->FindBin(ignCut); | |
474 | Int_t anaLow = anaELoss->FindBin(ignCut); | |
475 | Double_t esdInt = esdELoss->Integral(esdLow,esdELoss->GetNbinsX()+1); | |
476 | Double_t anaInt = anaELoss->Integral(anaLow,anaELoss->GetNbinsX()+1); | |
477 | Double_t frac = esdInt > 0 ? (esdInt-anaInt)/esdInt : 1; | |
478 | esdELoss->GetXaxis()->SetRangeUser(-.1, 2); | |
7095962e CHC |
479 | |
480 | DrawInPad(fBody, 1, esdELoss, "", kLogy, | |
481 | "#Delta/#Delta_{mip} reconstructed and merged"); | |
70849dc0 | 482 | DrawInPad(fBody, 1, anaELoss, "same"); |
7095962e | 483 | DrawInPad(fBody, 1, lowCut, "lf same"); |
a19faec0 | 484 | DrawInPad(fBody, 1, highCut, "lf same", kLogy|kLegend|kNorth|kWest); |
70849dc0 | 485 | TVirtualPad* p = fBody->GetPad(1); |
486 | p->cd(); | |
487 | TLatex* l = new TLatex(1-p->GetRightMargin(), | |
488 | 0.5, Form("Loss: %5.1f%%", frac*100)); | |
489 | l->SetNDC(); | |
490 | l->SetTextAlign(32); | |
491 | l->Draw(); | |
29dc6eb3 | 492 | l->DrawLatex(1-p->GetRightMargin(), 0.45, |
493 | Form("%f #rightarrow #infty", ignCut)); | |
a19faec0 | 494 | |
495 | TH1* singles = GetH1(sc, "singleEloss"); | |
496 | TH1* doubles = GetH1(sc, "doubleEloss"); | |
497 | TH1* tripples = GetH1(sc, "tripleEloss"); | |
498 | Double_t int1 = singles->Integral(0,singles->GetNbinsX()+1); | |
499 | Double_t int2 = doubles->Integral(0,doubles->GetNbinsX()+1); | |
500 | Double_t int3 = tripples->Integral(0,tripples->GetNbinsX()+1); | |
501 | Double_t intT = int1 + int2 + int3; | |
502 | Double_t f1 = intT > 0 ? int1 / intT : 0; | |
503 | Double_t f2 = intT > 0 ? int2 / intT : 0; | |
504 | Double_t f3 = intT > 0 ? int3 / intT : 0; | |
505 | ||
506 | singles->GetXaxis()->SetRangeUser(-.1, 2); | |
507 | DrawInPad(fBody, 2, singles, "", kLogy, | |
7095962e | 508 | "#Delta/#Delta_{mip} for single, double, and tripple hits"); |
a19faec0 | 509 | DrawInPad(fBody, 2, doubles, "same", kLogy); |
510 | DrawInPad(fBody, 2, tripples, "same", kLogy); | |
511 | DrawInPad(fBody, 2, lowCut, "lf same", kLogy); | |
512 | DrawInPad(fBody, 2, highCut, "lf same", kLogy|kLegend|kNorth|kWest); | |
7095962e | 513 | |
a19faec0 | 514 | fBody->cd(2); |
515 | Double_t nameX = fParName->GetX(); | |
516 | Double_t valX = fParVal->GetX(); | |
517 | Double_t intY = 0.4; | |
518 | fParName->SetX(0.5); | |
519 | fParVal->SetX(0.7); | |
520 | DrawParameter(intY, "Singles", Form("%5.1f%%", 100*f1), 0.05); | |
521 | DrawParameter(intY, "Doubles", Form("%5.1f%%", 100*f2), 0.05); | |
522 | DrawParameter(intY, "Tripples", Form("%5.1f%%", 100*f3), 0.05); | |
523 | fParName->SetX(nameX); | |
524 | fParVal->SetX(valX); | |
525 | ||
7095962e CHC |
526 | DrawInPad(fBody, 3, GetH2(sc, "singlePerStrip"), "colz",kLogz); |
527 | // DrawInPad(fBody, 4, GetH1(sc, "distanceBefore"), "", 0x2); | |
528 | // DrawInPad(fBody, 4, GetH1(sc, "distanceAfter"), "same", 0x12); | |
529 | DrawInPad(fBody, 4, GetH2(sc, "summed"), "colz",0x0); | |
530 | ||
531 | TH2* nB = GetH2(sc, "neighborsBefore"); | |
532 | if (nB) { | |
a19faec0 | 533 | nB->GetXaxis()->SetRangeUser(0,2); |
534 | nB->GetYaxis()->SetRangeUser(0,2); | |
7095962e | 535 | } |
29dc6eb3 | 536 | DrawInPad(fBody, 5, nB, "colz cont3", kLogz, |
537 | "Correlation of neighbors before merging"); | |
538 | ||
539 | TH2* nA = GetH2(sc, "neighborsAfter"); | |
540 | if (nA) { | |
541 | nA->GetXaxis()->SetRangeUser(0,2); | |
542 | nA->GetYaxis()->SetRangeUser(0,2); | |
543 | } | |
544 | DrawInPad(fBody, 6, nA, "colz cont3", kLogz, | |
545 | "Correlation of neighbors after merging"); | |
24338c03 | 546 | |
29dc6eb3 | 547 | // DrawInPad(fBody, 6, GetH2(sc, "beforeAfter"), "colz", kLogz); |
7095962e CHC |
548 | |
549 | PrintCanvas(Form("Sharing filter - %s", *ptr)); | |
550 | ptr++; | |
551 | iq++; | |
2955f67c | 552 | } |
7095962e CHC |
553 | fParVal->SetX(savX); |
554 | fParVal->SetY(savY); | |
2955f67c | 555 | } |
556 | ||
557 | // --- MC -------------------------------------------------------- | |
558 | TCollection* cc = GetCollection(c, "esd_mc_comparion", false); // Spelling! | |
559 | if (!cc) return; // Not MC | |
560 | ||
561 | DivideForRings(false, false); | |
7095962e CHC |
562 | const char** ptr = GetRingNames(false); |
563 | while (*ptr) { | |
564 | DrawInRingPad(GetH2(cc, Form("%s_corr", *ptr)), "colz", kLogz); | |
565 | ptr++; | |
566 | } | |
2955f67c | 567 | |
568 | PrintCanvas("Sharing filter - MC vs Reco"); | |
569 | ||
570 | // --- MC -------------------------------------------------------- | |
bfab35d9 | 571 | DrawTrackDensity(c); |
2955f67c | 572 | } |
70849dc0 | 573 | //__________________________________________________________________ |
574 | /** | |
575 | * Draw a slice fit on a 2D histogram | |
576 | * | |
577 | * @param inY Whether to slice in Y | |
578 | * @param h 2D histogram | |
579 | * @param nVar Number of variances | |
580 | * @param p Master pad to draw in | |
581 | * @param sub Sub pad number | |
582 | * @param flags Flags | |
583 | * @param cut Cut value | |
584 | */ | |
77f97e3f CHC |
585 | void ShowSliceFit(Bool_t inY, TH2* h, Double_t nVar, |
586 | TVirtualPad* p, Int_t sub, UShort_t flags=0, | |
587 | Double_t cut=-1) | |
588 | { | |
589 | if (!h) return; | |
590 | ||
591 | TObjArray* fits = new TObjArray; | |
592 | fits->SetOwner(); | |
593 | if (inY) h->FitSlicesY(0, 1, -1, 10, "QN", fits); | |
594 | else h->FitSlicesX(0, 1, -1, 10, "QN", fits); | |
595 | if (!fits) { | |
596 | Warning("ShowSliceFit", "No fits returned"); | |
597 | return; | |
598 | } | |
599 | TH1* mean = static_cast<TH1*>(fits->At(1)); | |
600 | TH1* var = static_cast<TH1*>(fits->At(2)); | |
601 | if (!mean || !var) { | |
602 | Warning("ShowSliceFit", "Didn't get histograms"); | |
603 | fits->Delete(); | |
604 | return; | |
605 | } | |
606 | TF1* fmean = new TF1("mean", "pol1"); | |
607 | TF1* fvar = new TF1("var", "pol1"); | |
608 | mean->Fit(fmean, "Q0+"); | |
609 | var->Fit(fvar, "Q0+"); | |
610 | if (!fmean || !fvar) { | |
611 | Warning("ShowSliceFit", "No functions returned"); | |
612 | fits->Delete(); | |
613 | return; | |
614 | } | |
615 | ||
616 | TGraphErrors* g = new TGraphErrors(h->GetNbinsX()); | |
617 | g->SetName(Form("g%s", h->GetName())); | |
618 | TString xTit = h->GetXaxis()->GetTitle(); | |
619 | TString yTit = h->GetYaxis()->GetTitle(); | |
620 | g->SetTitle(Form("Correlation of %s and %s", | |
621 | inY ? xTit.Data() : yTit.Data(), | |
622 | !inY ? xTit.Data() : yTit.Data())); | |
623 | g->SetFillColor(kBlue-10); | |
624 | g->SetFillStyle(3001); | |
625 | TGraph* up = (cut > 0 ? new TGraph(h->GetNbinsX()) : 0); | |
626 | TGraph* low = (cut > 0 ? new TGraph(h->GetNbinsX()) : 0); | |
627 | if (up) { | |
628 | up ->SetLineColor(kBlack); | |
629 | up ->SetLineWidth(2); | |
630 | up ->SetLineStyle(2); | |
631 | } | |
632 | if (low) { | |
633 | low->SetLineColor(kBlack); | |
634 | low->SetLineWidth(2); | |
635 | low->SetLineStyle(2); | |
636 | } | |
637 | for (Int_t i = 1; i <= h->GetNbinsX(); i++) { | |
638 | Double_t x = h->GetXaxis()->GetBinCenter(i); | |
639 | Double_t y = fmean->Eval(x); | |
640 | Double_t e = fvar->Eval(x); | |
641 | Double_t ee = nVar * e; | |
642 | if (flags & 0x8000) ee *= e > 0 ? TMath::Log10(e) : 1; | |
643 | g->SetPoint(i-1, x, y); | |
644 | g->SetPointError(i-1, 0, ee); | |
645 | ||
646 | if (up) up ->SetPoint(i-1,x,x+cut*x); | |
647 | if (low) low->SetPoint(i-1,x,x-cut*x); | |
648 | } | |
649 | DrawInPad(p, sub, g, "3", flags); | |
650 | if (up) DrawInPad(p, sub, up, "l", flags); | |
651 | if (low) DrawInPad(p, sub, low, "l", flags); | |
652 | fmean->SetRange(h->GetXaxis()->GetXmin(), h->GetXaxis()->GetXmax()); | |
653 | fmean->SetLineWidth(2); | |
654 | DrawInPad(p, sub, fmean, "same", flags); | |
655 | ||
656 | TVirtualPad* pp = p->GetPad(sub); | |
657 | Double_t y = 1-pp->GetTopMargin()-.01; | |
658 | TLatex* l = new TLatex(.15, y, | |
659 | Form("#LT%s#GT(%s) = " | |
660 | "%f + %f %s", | |
661 | yTit.Data(), xTit.Data(), | |
662 | fmean->GetParameter(0), | |
663 | fmean->GetParameter(1), xTit.Data())); | |
664 | l->SetNDC(); | |
665 | l->SetTextAlign(13); | |
666 | l->SetTextSize(0.04); | |
667 | l->SetTextFont(42); | |
668 | l->Draw(); | |
669 | l->DrawLatex(0.15, y-0.07, | |
670 | Form("#sigma_{%s}(%s) = " | |
671 | "%f + %f %s", | |
672 | yTit.Data(), xTit.Data(), | |
673 | fvar->GetParameter(0), | |
674 | fvar->GetParameter(1), xTit.Data())); | |
675 | l->DrawLatex(0.15, y-0.14, Form("#delta = %3.1f %s #sigma", | |
676 | nVar, | |
677 | flags & 0x8000 ? "log_{10}(#sigma)" : "")); | |
678 | fits->Delete(); | |
679 | } | |
680 | ||
2955f67c | 681 | //____________________________________________________________________ |
682 | void DrawDensityCalculator() | |
683 | { | |
684 | Info("DrawDensityCalculator", "Drawing density calculator"); | |
685 | TCollection* c = GetCollection(fSums, "fmdDensityCalculator"); | |
686 | if (!c) return; | |
687 | ||
688 | fBody->Divide(2, 2); | |
689 | fBody->cd(1); | |
690 | ||
70849dc0 | 691 | Double_t y = .9; |
2955f67c | 692 | Int_t maxParticles=0, phiAcceptance=0, etaLumping=0, phiLumping=0; |
24338c03 | 693 | Bool_t method=false, recalcPhi=false; |
77f97e3f | 694 | Double_t maxOutliers=0, outlierCut=0; |
70849dc0 | 695 | Double_t size = fLandscape ? 0.05 : 0.03; |
2955f67c | 696 | |
8449e3e0 | 697 | GetParameter(c, "maxParticle", maxParticles); |
698 | ||
699 | if (GetParameter(c, "phiAcceptance", phiAcceptance)) | |
700 | DrawParameter(y, "#phi acceptance method", | |
701 | (phiAcceptance == 1 ? "N_{ch}" : | |
702 | phiAcceptance == 2 ? "#DeltaE" : "none"), size); | |
8449e3e0 | 703 | if (GetParameter(c, "etaLumping", etaLumping) && |
704 | GetParameter(c, "phiLumping", phiLumping)) | |
705 | DrawParameter(y, "Region size (sector#timesstrip)", | |
706 | Form("%2d #times %2d", phiLumping, etaLumping), size); | |
8449e3e0 | 707 | if (GetParameter(c, "method", method)) |
708 | DrawParameter(y, "Method", (method ? "Poisson" : "#DeltaE"), size); | |
8449e3e0 | 709 | if (GetParameter(c, "recalcPhi", recalcPhi)) |
710 | DrawParameter(y, "Recalculate #phi",(recalcPhi ? "yes" : "no"),size); | |
77f97e3f CHC |
711 | if (GetParameter(c, "maxOutliers", maxOutliers)) |
712 | DrawParameter(y, "Max relative N_{outlier}", | |
713 | Form("%5.3f",maxOutliers),size); | |
714 | if (GetParameter(c, "outlierCut", outlierCut)) | |
7095962e | 715 | DrawParameter(y, "Max relative deviation",Form("%5.3f",outlierCut),size); |
77f97e3f CHC |
716 | |
717 | ||
bfab35d9 | 718 | TParameter<int>* nFiles = |
719 | static_cast<TParameter<int>*>(GetObject(c, "nFiles")); | |
720 | if (nFiles) | |
77f97e3f | 721 | DrawParameter(y, "# files merged", Form("%d", nFiles->GetVal()), size); |
8449e3e0 | 722 | |
bfab35d9 | 723 | TCollection* lc = GetCollection(c, "lCuts"); |
70849dc0 | 724 | Int_t tm = PrintCut(lc, y, "Threshold", size); |
2955f67c | 725 | |
726 | TVirtualPad* p = fBody; // fBody->cd(2); | |
727 | // p->Divide(3,1); | |
728 | ||
729 | TH1* accI = GetH1(c, "accI"); | |
730 | TH1* accO = GetH1(c, "accO"); | |
731 | if (accI) { | |
732 | Double_t scale = 1./accI->GetMaximum(); | |
733 | accI->Scale(scale); | |
734 | accO->Scale(scale); | |
735 | accI->SetMinimum(0); | |
a19faec0 | 736 | accI->SetMaximum(1.3); |
2955f67c | 737 | } |
bfab35d9 | 738 | TH2* lCuts = GetH2(c, "lowCuts"); |
739 | TH2* maxW = GetH2(c, "maxWeights"); | |
7095962e | 740 | if (lCuts) lCuts->SetTitle("Thresholds"); |
bfab35d9 | 741 | if (nFiles && lCuts) lCuts->Scale(1. / nFiles->GetVal()); |
742 | if (nFiles && maxW) maxW->Scale(1. / nFiles->GetVal()); | |
2955f67c | 743 | DrawInPad(p, 2, accI); |
a19faec0 | 744 | DrawInPad(p, 2, accO, "same", kLegend|kNorth|kCenter); |
745 | DrawCut(p, 3, lCuts); | |
a19faec0 | 746 | DrawCut(p, 4, maxW); |
2955f67c | 747 | |
748 | PrintCanvas("Density calculator"); | |
749 | ||
70849dc0 | 750 | UShort_t iq = 1; |
7095962e | 751 | const char** ptr = GetRingNames(false); |
2955f67c | 752 | while (*ptr) { |
753 | TCollection* sc = GetCollection(c, *ptr); | |
754 | if (!sc) { ptr++; continue; } | |
755 | ||
77f97e3f CHC |
756 | if (fLandscape) fBody->Divide(3,2); |
757 | else fBody->Divide(2,3); | |
2955f67c | 758 | |
77f97e3f CHC |
759 | TH2* corr = GetH2(sc, "elossVsPoisson"); |
760 | TH2* corrOut = GetH2(sc, "elossVsPoissonOutlier"); | |
761 | TH1* diff = GetH1(sc, "diffElossPoisson"); | |
762 | TH1* diffOut = GetH1(sc, "diffElossPoissonOutlier"); | |
763 | TH1* eloss = GetH1(sc, "eloss"); | |
764 | TH1* elossUsed = GetH1(sc, "elossUsed"); | |
765 | TH1* occ = GetH1(sc, "occupancy"); | |
766 | if (eloss) eloss ->SetLineWidth(1); | |
767 | if (elossUsed) elossUsed->SetLineWidth(1); | |
a19faec0 | 768 | if (eloss) eloss->GetXaxis()->SetRangeUser(0.05, 2); |
77f97e3f CHC |
769 | |
770 | DrawInPad(fBody, 1, corr, "colz", kLogz); | |
771 | DrawInPad(fBody, 1, corrOut, "same", kLogz); | |
24338c03 | 772 | ShowSliceFit(true, corr, 10, fBody, 1, kLogz, outlierCut); |
773 | ||
77f97e3f | 774 | DrawInPad(fBody, 2, diff, "HIST E", kLogy); |
a19faec0 | 775 | DrawInPad(fBody, 2, diffOut, "HIST E SAME", kLogy|kLegend|kNorth|kWest); |
77f97e3f CHC |
776 | DrawInPad(fBody, 3, occ, "", kLogy); |
777 | DrawInPad(fBody, 4, eloss, "", kLogy, | |
079fd669 | 778 | "#Delta/#Delta_{mip} before and after cuts"); |
70849dc0 | 779 | DrawInPad(fBody, 4, elossUsed, "same", kLogy); |
780 | TGraph* thres = CreateCutGraph(tm, iq, lCuts, eloss, kYellow+1); | |
a19faec0 | 781 | DrawInPad(fBody, 4, thres, "lf same", kLogy|kLegend|kNorth|kWest); |
70849dc0 | 782 | |
783 | if (eloss && elossUsed) { | |
784 | Int_t lowBin = eloss->GetXaxis()->FindBin(0.)+1; | |
785 | Int_t upBin = eloss->GetNbinsX()+1; | |
786 | Double_t beforeInt = eloss->Integral(lowBin,upBin); | |
787 | Double_t afterInt = elossUsed->Integral(lowBin,upBin); | |
788 | Double_t frac = beforeInt > 0 ? (beforeInt-afterInt)/beforeInt : 1; | |
789 | TVirtualPad* pp = fBody->GetPad(4); | |
790 | pp->cd(); | |
791 | TLatex* l = new TLatex(1-pp->GetRightMargin(), | |
792 | 0.5, Form("Loss: %5.1f%%", frac*100)); | |
793 | l->SetNDC(); | |
794 | l->SetTextAlign(32); | |
795 | l->Draw(); | |
796 | } | |
797 | ||
798 | ||
2955f67c | 799 | TH1* phiB = GetH1(sc, "phiBefore"); |
800 | TH1* phiA = GetH1(sc, "phiAfter"); | |
77f97e3f CHC |
801 | TH1* outliers = GetH1(sc, "outliers"); |
802 | if (outliers) | |
803 | DrawInPad(fBody, 5, outliers, "hist", kLogy); | |
804 | else if (phiB && phiA) { | |
2955f67c | 805 | phiA->Add(phiB, -1); |
806 | phiA->Divide(phiB); | |
807 | phiA->SetTitle("#Delta#phi from Ip (x,y) correction"); | |
808 | phiA->SetYTitle("(#phi_{after}-#phi_{before})/#phi_{before}"); | |
77f97e3f CHC |
809 | DrawInPad(fBody, 5, phiA); |
810 | } | |
811 | else { | |
812 | fBody->cd(5); | |
813 | TLatex* ltx = new TLatex(0.5, 0.5, "No outliers or #phi corrections"); | |
814 | ltx->SetTextAlign(22); | |
815 | ltx->SetTextSize(0.07); | |
816 | ltx->SetNDC(); | |
817 | ltx->Draw(); | |
2955f67c | 818 | } |
fba5d22d | 819 | DrawInPad(fBody, 6, GetH2(sc, "phiAcc"), "colz", kLogz); |
2955f67c | 820 | |
77f97e3f CHC |
821 | |
822 | if (diff && diffOut) { | |
823 | fBody->cd(2); | |
824 | Double_t in = diff->GetEntries(); | |
825 | Double_t out = diffOut->GetEntries(); | |
7095962e CHC |
826 | if ((in+out) > 0) { |
827 | TLatex* ltx = new TLatex(0.11, 0.89, | |
828 | Form("Fraction: %7.3f%%", | |
829 | 100*out/(in+out))); | |
830 | ltx->SetNDC(); | |
831 | ltx->SetTextAlign(13); | |
832 | ltx->SetTextSize(0.06); | |
833 | ltx->Draw(); | |
834 | } | |
77f97e3f | 835 | } |
2955f67c | 836 | PrintCanvas(Form("Density calculator - %s", *ptr)); |
837 | ptr++; | |
70849dc0 | 838 | iq++; |
2955f67c | 839 | } |
840 | ||
841 | TCollection* cc = GetCollection(c, "esd_mc_comparison", false); | |
842 | if (!cc) return; // Not MC | |
843 | ||
844 | fBody->Divide(2,5); | |
7095962e CHC |
845 | ptr = GetRingNames(false); |
846 | Int_t cnt = 0; | |
847 | while (*ptr) { | |
848 | DrawInPad(fBody, 2*cnt+1, GetH2(cc, Form("%s_corr_mc_esd", *ptr)), | |
849 | "colz", kLogz); | |
850 | DrawInPad(fBody, 2*(cnt+1), GetH2(cc, Form("%s_diff_mc_esd", *ptr)), | |
851 | "", kLogz); | |
852 | ptr++; | |
853 | cnt++; | |
854 | } | |
2955f67c | 855 | |
856 | PrintCanvas("Density calculator - MC vs Reco"); | |
857 | } | |
858 | ||
859 | //____________________________________________________________________ | |
860 | void DrawCorrector() | |
861 | { | |
862 | Info("DrawCorrector", "Drawing corrector"); | |
863 | TCollection* c = GetCollection(fSums, "fmdCorrector"); | |
864 | if (!c) return; | |
865 | ||
866 | fBody->cd(); | |
867 | ||
868 | Double_t y = .8; | |
869 | Bool_t secondary=false, vertexBias=false, acceptance=false, merging=false; | |
8449e3e0 | 870 | if (GetParameter(c, "secondary", secondary)) |
871 | DrawParameter(y, "Secondary corr.", secondary ? "yes" : "no"); | |
872 | if (GetParameter(c, "acceptance", acceptance)) | |
873 | DrawParameter(y, "Acceptance corr.", acceptance ? "yes" : "no"); | |
874 | if (GetParameter(c, "vertexBias", vertexBias)) | |
875 | DrawParameter(y, "Vertex bias corr.", vertexBias ? "yes" : "no"); | |
876 | if (GetParameter(c, "merging", merging)) | |
877 | DrawParameter(y, "Merging eff.", merging ? "yes" : "no"); | |
2955f67c | 878 | |
879 | PrintCanvas("Corrector"); | |
880 | ||
881 | TCollection* cc = GetCollection(c, "esd_mc_comparison", false); | |
882 | if (!cc) return; // Not MC | |
883 | ||
884 | DivideForRings(false, false); | |
7095962e CHC |
885 | const char** ptr = GetRingNames(false); |
886 | while (*ptr) { | |
887 | DrawInRingPad(GetH2(cc, Form("%s_esd_vs_mc", *ptr)), "colz", 0x0); | |
888 | ptr++; | |
889 | } | |
2955f67c | 890 | |
891 | PrintCanvas("Corrector - MC vs Reco"); | |
892 | } | |
893 | ||
894 | //____________________________________________________________________ | |
895 | void DrawHistCollector() | |
896 | { | |
897 | Info("DrawHistCollector", "Drawing histogram collector"); | |
898 | TCollection* c = GetCollection(fSums, "fmdHistCollector"); | |
899 | if (!c) return; | |
900 | ||
77f97e3f CHC |
901 | fBody->Divide(2, 1); |
902 | TVirtualPad* p = fBody->cd(1); | |
903 | p->Divide(1,2); | |
904 | p->cd(1); | |
2955f67c | 905 | |
906 | Double_t y = .8; | |
907 | Int_t nCutBins=0, fiducial=0, merge=0, skipRings=0; | |
908 | Double_t fiducialCut=0.; | |
909 | Bool_t bgAndHits=false; | |
77f97e3f | 910 | Double_t size = fLandscape ? 0.06 : 0.04; |
8449e3e0 | 911 | if (GetParameter(c, "nCutBins", nCutBins)) |
77f97e3f | 912 | DrawParameter(y, "# of bins to cut", Form("%d", nCutBins),size); |
8449e3e0 | 913 | |
914 | if (GetParameter(c, "skipRings", skipRings)) { | |
915 | TString skipped; | |
916 | if (skipRings & 0x05) skipped.Append("FMD1i "); | |
917 | if (skipRings & 0x09) skipped.Append("FMD2i "); | |
918 | if (skipRings & 0x0a) skipped.Append("FMD2o "); | |
919 | if (skipRings & 0x11) skipped.Append("FMD3i "); | |
920 | if (skipRings & 0x12) skipped.Append("FMD3o "); | |
77f97e3f CHC |
921 | if (skipped.IsNull()) skipped = "none"; |
922 | DrawParameter(y, "Skipped rings", skipped, size); | |
8449e3e0 | 923 | } |
8449e3e0 | 924 | if (GetParameter(c, "bgAndHits", bgAndHits)) |
77f97e3f | 925 | DrawParameter(y, "Bg & hit maps stored.", bgAndHits?"yes":"no",size); |
8449e3e0 | 926 | if (GetParameter(c, "merge", merge)) |
927 | DrawParameter(y, "Merge method", | |
928 | (merge == 0 ? "straight mean" : | |
929 | merge == 1 ? "straight mean, no zeroes" : | |
930 | merge == 2 ? "weighted mean" : | |
931 | merge == 3 ? "least error" : | |
77f97e3f | 932 | merge == 4 ? "sum" : "unknown"),size); |
8449e3e0 | 933 | if (GetParameter(c, "fiducial", fiducial)) |
934 | DrawParameter(y, "Fiducial method.", | |
77f97e3f | 935 | fiducial == 0 ? "cut" : "distance", size); |
8449e3e0 | 936 | if (GetParameter(c, "fiducialCut", fiducialCut)) |
77f97e3f CHC |
937 | DrawParameter(y, "Fiducial cut.", Form("%f", fiducialCut), size); |
938 | ||
939 | // p->cd(2); | |
67a4bb96 | 940 | // Printf("Drawing skipped"); |
77f97e3f CHC |
941 | TH1* skipped = GetH1(c, "skipped"); |
942 | if (skipped) { | |
943 | skipped->SetFillColor(kRed+1); | |
944 | skipped->SetFillStyle(3001); | |
945 | } | |
946 | DrawInPad(p, 2, skipped, "hist"); | |
2955f67c | 947 | |
77f97e3f CHC |
948 | p = fBody->cd(2); |
949 | p->Divide(1,2,0,0); | |
950 | ||
67a4bb96 | 951 | // Printf("Drawing sumRings"); |
77f97e3f | 952 | DrawInPad(p, 1, GetH2(c, "sumRings"), "colz"); |
67a4bb96 | 953 | // Printf("Drawing coverage"); |
77f97e3f | 954 | DrawInPad(p, 2, GetH2(c, "coverage"), "colz"); |
67a4bb96 | 955 | // Printf("Done drawing for now"); |
2955f67c | 956 | PrintCanvas("Histogram collector"); |
8449e3e0 | 957 | |
958 | ||
959 | TIter next(c); | |
960 | TObject* o = 0; | |
961 | TRegexp regexp("[pm][0-9]+_[pm][0-9]+"); | |
962 | while ((o = next())) { | |
963 | TString name(o->GetName()); | |
964 | if (name.Index(regexp) == kNPOS) continue; | |
965 | ||
966 | TList* vl = static_cast<TList*>(o); | |
77f97e3f | 967 | if (!vl) continue; |
8449e3e0 | 968 | |
969 | DivideForRings(false, false); | |
7095962e CHC |
970 | const char** ptr = GetRingNames(false); |
971 | while (*ptr) { | |
972 | DrawInRingPad(GetH2(vl, Form("secMap%s", *ptr)), "colz", 0x0); | |
973 | DrawInRingPad(GetH2(vl, Form("hitMap%s", *ptr)), "box same", 0x0); | |
974 | ptr++; | |
975 | } | |
8449e3e0 | 976 | PrintCanvas(Form("Histogram Collector - Vertex bin %s", vl->GetName())); |
977 | } | |
978 | ||
979 | o = c->FindObject("byCentrality"); | |
980 | if (!o) return; | |
981 | TList* bc = static_cast<TList*>(o); | |
982 | ||
983 | DrawInPad(fBody, GetH3(bc, "FMD1I"), "box", 0); | |
984 | DrawInPad(fBody, GetH3(bc, "FMD2I"), "box same", 0); | |
985 | DrawInPad(fBody, GetH3(bc, "FMD2O"), "box same", 0); | |
986 | DrawInPad(fBody, GetH3(bc, "FMD3O"), "box same", 0); | |
fba5d22d | 987 | DrawInPad(fBody, GetH3(bc, "FMD3I"), "box same", kLegend); |
2955f67c | 988 | } |
8449e3e0 | 989 | |
990 | //____________________________________________________________________ | |
991 | void DrawCentral() | |
992 | { | |
993 | Info("DrawCentral", "Drawing central (SPD)"); | |
994 | TCollection* c = fSums; | |
995 | if (!c) return; | |
996 | ||
77f97e3f | 997 | fBody->Divide(2, 2); |
8449e3e0 | 998 | fBody->cd(1); |
77f97e3f CHC |
999 | Double_t y = .7; |
1000 | Bool_t secondary=false, acceptance=false; | |
1001 | if (GetParameter(c, "secondary", secondary)) | |
1002 | DrawParameter(y, "Secondary corr.", secondary ? "yes" : "no"); | |
1003 | if (GetParameter(c, "acceptance", acceptance)) | |
1004 | DrawParameter(y, "Acceptance corr.", acceptance ? "yes" : "no"); | |
8449e3e0 | 1005 | |
1006 | ||
77f97e3f | 1007 | DrawInPad(fBody, 2, GetH2(c, "coverage"), "col", 0, |
079fd669 | 1008 | "#eta coverage per v_{z}"); |
77f97e3f CHC |
1009 | TH2* cvst = GetH2(c, "nClusterVsnTracklet"); |
1010 | if (cvst) { | |
1011 | // cvst->Scale(1, "width"); | |
1012 | cvst->GetXaxis()->SetTitle("N_{free cluster}"); | |
1013 | cvst->GetYaxis()->SetTitle("N_{tracklet}"); | |
1014 | cvst->GetXaxis()->SetRangeUser(1,10000); | |
1015 | cvst->GetYaxis()->SetRangeUser(1,10000); | |
1016 | } | |
1017 | DrawInPad(fBody, 3, cvst, "colz", kLogx|kLogy|kLogz, | |
079fd669 | 1018 | "Correlation of # of tracklets and clusters"); |
77f97e3f | 1019 | DrawInPad(fBody, 4, GetH2(c, "clusterPerTracklet"), "colz", 0x0, |
079fd669 | 1020 | "# clusters per tracklet vs #eta"); |
77f97e3f | 1021 | ShowSliceFit(true, cvst, 3, fBody, 3, 0x8000|kLogz); |
8449e3e0 | 1022 | |
1023 | fBody->cd(1)->Modified(); | |
1024 | fBody->cd(2)->Modified(); | |
1025 | fBody->cd(3)->Modified(); | |
77f97e3f | 1026 | fBody->cd(4)->Modified(); |
8449e3e0 | 1027 | fBody->cd(1)->Update(); |
1028 | fBody->cd(2)->Update(); | |
1029 | fBody->cd(3)->Update(); | |
77f97e3f | 1030 | fBody->cd(4)->Update(); |
8449e3e0 | 1031 | PrintCanvas("Central - overview"); |
1032 | ||
1033 | ||
1034 | TIter next(c); | |
1035 | TObject* o = 0; | |
1036 | TRegexp regexp("[pm][0-9]+_[pm][0-9]+"); | |
1037 | while ((o = next())) { | |
1038 | TString name(o->GetName()); | |
1039 | if (name.Index(regexp) == kNPOS) continue; | |
1040 | ||
1041 | TList* vl = static_cast<TList*>(o); | |
1042 | ||
1043 | fBody->Divide(1, 3); | |
1044 | ||
1045 | DrawInPad(fBody, 1, GetH1(vl, "acceptance"), "", 0); | |
1046 | ||
1047 | TH1* sec = GetH1(vl, "secondary"); | |
1048 | sec->SetMarkerStyle(21); | |
1049 | sec->SetMarkerSize(1.2); | |
1050 | DrawInPad(fBody, 2, sec, "", 0); | |
1051 | DrawInPad(fBody, 2, GetH1(vl, "secondaryFiducial"), "same", 0x0); | |
1052 | DrawInPad(fBody, 3, GetH2(vl, "secondaryMapFiducial"), "colz", 0); | |
1053 | DrawInPad(fBody, 3, GetH2(vl, "hitMap"), "box same", 0x0); | |
1054 | ||
1055 | fBody->cd(1)->Modified(); | |
1056 | fBody->cd(2)->Modified(); | |
1057 | fBody->cd(3)->Modified(); | |
1058 | fBody->cd(1)->Update(); | |
1059 | fBody->cd(2)->Update(); | |
1060 | fBody->cd(3)->Update(); | |
1061 | PrintCanvas(Form("Central - Vertex bin %s", vl->GetName())); | |
1062 | } | |
1063 | } | |
1064 | ||
2955f67c | 1065 | |
1066 | //____________________________________________________________________ | |
1067 | void AddToAll(THStack* all, const THStack* stack, Int_t curr, Int_t step) | |
1068 | { | |
1069 | if (!stack) return; | |
1070 | ||
1071 | TIter next(stack->GetHists()); | |
1072 | TH1* h = 0; | |
1073 | while ((h = static_cast<TH1*>(next()))) { | |
1074 | TH1* copy = static_cast<TH1*>(h->Clone(Form("%s_copy", h->GetName()))); | |
1075 | copy->SetDirectory(0); | |
1076 | if (curr != step) { | |
1077 | copy->SetMarkerColor(kGray); | |
1078 | copy->SetLineColor(kGray); | |
1079 | } | |
1080 | all->Add(copy); | |
1081 | } | |
1082 | } | |
1083 | //____________________________________________________________________ | |
1084 | void AddToAll(THStack* all, const THStack* stack) | |
1085 | { | |
1086 | if (!stack) return; | |
1087 | ||
1088 | TIter next(stack->GetHists()); | |
1089 | TH1* h = 0; | |
1090 | while ((h = static_cast<TH1*>(next()))) { | |
1091 | TH1* copy = static_cast<TH1*>(h->Clone(Form("%s_copy", h->GetName()))); | |
1092 | copy->SetDirectory(0); | |
1093 | copy->SetMarkerColor(kGray); | |
1094 | copy->SetLineColor(kGray); | |
1095 | all->Add(copy); | |
1096 | } | |
1097 | } | |
1098 | ||
1099 | //____________________________________________________________________ | |
1100 | void DrawStep(Int_t step, | |
1101 | THStack* all, | |
1102 | TObject* cur, | |
1103 | TLegend* leg, | |
1104 | const char* title, | |
77f97e3f CHC |
1105 | TVirtualPad* can, |
1106 | Int_t sub, | |
1107 | Int_t nCol) | |
2955f67c | 1108 | { |
8449e3e0 | 1109 | if (all->GetHists()->GetEntries() <= 0 || !cur) return; |
1110 | ||
2955f67c | 1111 | // Info("", "Drawing step # %d", step); |
77f97e3f CHC |
1112 | Bool_t left = sub % nCol == 1; |
1113 | Bool_t right= sub % nCol == 0; | |
1114 | Bool_t top = (sub-1) / nCol == 0; | |
1115 | TVirtualPad* p = can->cd(sub); | |
2955f67c | 1116 | gStyle->SetOptTitle(0); |
1117 | p->SetTitle(Form("Step # %d", step)); | |
1118 | p->SetFillColor(kWhite); | |
77f97e3f CHC |
1119 | p->SetRightMargin(right ? 0.02 : 0); |
1120 | p->SetTopMargin(top ? 0.02 : 0); // 0.02); | |
1121 | // Info("", "Drawing step %d in sub-pad %d (%s)", | |
1122 | // step, sub, (left?"left":"right")); | |
2955f67c | 1123 | |
1124 | p->cd(); | |
1125 | all->Draw("nostack"); | |
1126 | all->GetHistogram()->SetXTitle("#eta"); | |
1127 | all->GetHistogram()->SetYTitle("signal"); | |
1128 | ||
77f97e3f CHC |
1129 | TLegendEntry* e = |
1130 | static_cast<TLegendEntry*>(leg->GetListOfPrimitives()->At(step-1)); | |
7095962e CHC |
1131 | if (e) { |
1132 | e->SetMarkerColor(kBlack); | |
1133 | e->SetLineColor(kBlack); | |
1134 | e->SetTextColor(kBlack); | |
1135 | } | |
77f97e3f | 1136 | |
2955f67c | 1137 | // p->cd(); |
1138 | gROOT->SetSelectedPad(p); | |
1139 | cur->DrawClone("same nostack"); | |
1140 | leg->DrawClone(""); | |
1141 | ||
1142 | TLatex* ltx = new TLatex(.97, .97, title); | |
1143 | ltx->SetNDC(); | |
1144 | ltx->SetTextSize(.06); | |
1145 | ltx->SetTextAlign(33); | |
1146 | ltx->Draw(); | |
1147 | ||
1148 | ltx = new TLatex((left ? .12 : .02), .97, p->GetTitle()); | |
1149 | ltx->SetNDC(); | |
1150 | ltx->SetTextSize(.06); | |
1151 | ltx->SetTextAlign(13); | |
1152 | ltx->Draw(); | |
1153 | ||
77f97e3f CHC |
1154 | if (step > 1) { |
1155 | Double_t x1 = 0.5*(p->GetUxmax()+p->GetUxmin()); | |
1156 | Double_t x2 = x1; | |
1157 | Double_t y1 = p->GetUymax(); | |
1158 | Double_t y2 = 0.92*y1; | |
1159 | Double_t sz = 0.05; | |
1160 | if (fLandscape) { | |
1161 | x1 = 0.99*p->GetUxmin(); | |
1162 | x2 = 0.80*x1; | |
1163 | y1 = .5*(p->GetUymax()+p->GetUymin()); | |
1164 | y2 = y1; | |
1165 | sz = 0.034; | |
1166 | } | |
1167 | // Info("", "Arrow at (x1,y1)=%f,%f (x2,y2)=%f,%f", x1, y1, x2, y2); | |
1168 | TArrow* a = new TArrow(x1, y1, x2, y2, sz, "|>"); | |
1169 | // (fLandscape ? "<|" : "|>")); | |
1170 | a->SetFillColor(kGray+1); | |
1171 | a->SetLineColor(kGray+1); | |
1172 | a->Draw(); | |
1173 | } | |
2955f67c | 1174 | p->Modified(); |
1175 | p->Update(); | |
1176 | p->cd(); | |
079fd669 | 1177 | |
7095962e CHC |
1178 | if (e) { |
1179 | e->SetMarkerColor(kGray); | |
1180 | e->SetLineColor(kGray); | |
1181 | e->SetTextColor(kGray); | |
1182 | } | |
079fd669 | 1183 | gStyle->SetOptTitle(1); |
2955f67c | 1184 | } |
1185 | ||
1186 | //____________________________________________________________________ | |
1187 | void FixStack(THStack* stack, const TString& title, | |
1188 | const TString& extra, Int_t marker) | |
1189 | { | |
1190 | if (!stack) return; | |
1191 | stack->SetTitle(title); | |
1192 | TIter next(stack->GetHists()); | |
1193 | TH1* h = 0; | |
1194 | while ((h = static_cast<TH1*>(next()))) { | |
1195 | h->SetMarkerStyle(marker); | |
1196 | TString tit(h->GetTitle()); | |
1197 | tit.ReplaceAll("cache", ""); | |
1198 | tit.Append(extra); | |
1199 | h->SetTitle(tit); | |
1200 | } | |
1201 | } | |
8449e3e0 | 1202 | void AddLegendEntry(TLegend* l, |
1203 | const TH1* h, | |
1204 | const TString& title) | |
1205 | { | |
1206 | if (!h) return; | |
1207 | ||
1208 | TLegendEntry* e = l->AddEntry("dummy", title.Data(), "pl"); | |
1209 | e->SetMarkerStyle(h->GetMarkerStyle()); | |
1210 | e->SetMarkerColor(kGray); | |
1211 | e->SetLineColor(kGray); | |
1212 | e->SetTextColor(kGray); | |
1213 | } | |
1214 | ||
1215 | ||
2955f67c | 1216 | //____________________________________________________________________ |
1217 | void DrawSteps() | |
1218 | { | |
1219 | // MakeChapter(can, "Steps"); | |
1220 | ||
77f97e3f CHC |
1221 | THStack* esds = GetStack(GetCollection(fResults, "fmdSharingFilter"), |
1222 | "sumsESD", "summedESD"); | |
2955f67c | 1223 | THStack* deltas = GetStack(GetCollection(fResults, "fmdSharingFilter"), |
1224 | "sums", "summed"); | |
1225 | THStack* nchs = GetStack(GetCollection(fResults, | |
1226 | "fmdDensityCalculator"), | |
1227 | "sums", "inclDensity"); | |
1228 | THStack* prims = GetStack(GetCollection(fResults, "fmdCorrector"), | |
1229 | "sums", "primaryDensity"); | |
1230 | THStack* rings = GetStack(GetCollection(fResults, "ringResults"), "all"); | |
1231 | THStack* mcRings = GetStack(GetCollection(fResults, "mcRingResults", false), | |
1232 | "all","dndeta_eta", false); | |
1233 | TH1* dndeta = GetH1(fResults, "dNdeta"); | |
8449e3e0 | 1234 | if (dndeta) dndeta->SetMarkerColor(kBlack); |
2955f67c | 1235 | |
77f97e3f CHC |
1236 | FixStack(esds, "#sum_{s} #Delta/#Delta_{mip}", "", 20); |
1237 | FixStack(deltas, "#sum_{c} #Delta/#Delta_{mip}", "", 21); | |
1238 | FixStack(nchs, "#sum_{b} N_{ch,incl}", "", 22); | |
1239 | FixStack(prims, "#sum_{b} N_{ch,primary}", "", 23); | |
1240 | FixStack(rings, "dN/d#eta per ring", "", 33); | |
2955f67c | 1241 | FixStack(mcRings,"dN/d#eta per ring (MC)", "(MC)", 34); |
1242 | ||
1243 | THStack* all = new THStack; | |
1244 | AddToAll(all, mcRings); | |
77f97e3f | 1245 | AddToAll(all, esds); |
2955f67c | 1246 | AddToAll(all, deltas); |
1247 | AddToAll(all, nchs); | |
1248 | AddToAll(all, prims); | |
1249 | AddToAll(all, rings); | |
1250 | ||
8449e3e0 | 1251 | TH1* res = 0; |
1252 | if (dndeta) { | |
1253 | res = static_cast<TH1*>(dndeta->Clone("dNdeta")); | |
1254 | res->SetTitle("dN/d#eta"); | |
1255 | res->SetMarkerColor(kGray); | |
1256 | res->SetLineColor(kGray); | |
1257 | res->SetDirectory(0); | |
1258 | all->Add(res); | |
1259 | } | |
2955f67c | 1260 | |
1261 | TLegend* l = new TLegend(.35, .2, .55, .9); | |
1262 | l->SetFillColor(kWhite); | |
1263 | l->SetFillStyle(0); | |
1264 | l->SetBorderSize(0); | |
1265 | TLegendEntry* e = 0; | |
1266 | ||
1267 | TH1* h = 0; | |
1268 | if (mcRings) { | |
1269 | h = static_cast<TH1*>(mcRings->GetHists()->At(0)); | |
8449e3e0 | 1270 | AddLegendEntry(l, h, mcRings->GetTitle()); |
2955f67c | 1271 | } |
1272 | ||
77f97e3f CHC |
1273 | if (esds) { |
1274 | h = static_cast<TH1*>(esds->GetHists()->At(0)); | |
1275 | AddLegendEntry(l, h, esds->GetTitle()); | |
1276 | } | |
1277 | ||
8449e3e0 | 1278 | if (deltas) { |
1279 | h = static_cast<TH1*>(deltas->GetHists()->At(0)); | |
1280 | AddLegendEntry(l, h, deltas->GetTitle()); | |
1281 | } | |
1282 | ||
1283 | if (nchs) { | |
1284 | h = static_cast<TH1*>(nchs->GetHists()->At(0)); | |
1285 | AddLegendEntry(l, h, nchs->GetTitle()); | |
1286 | } | |
1287 | ||
1288 | if (prims) { | |
1289 | h = static_cast<TH1*>(prims->GetHists()->At(0)); | |
1290 | AddLegendEntry(l, h, prims->GetTitle()); | |
1291 | } | |
1292 | ||
1293 | if (rings) { | |
1294 | h = static_cast<TH1*>(rings->GetHists()->At(0)); | |
1295 | AddLegendEntry(l, h, rings->GetTitle()); | |
1296 | } | |
1297 | ||
1298 | if (res) { | |
1299 | h = res; | |
1300 | AddLegendEntry(l, h, h->GetTitle()); | |
1301 | } | |
2955f67c | 1302 | |
1303 | TObject* objs[] = { mcRings, | |
77f97e3f | 1304 | esds, |
2955f67c | 1305 | deltas, |
1306 | nchs, | |
1307 | prims, | |
1308 | rings, | |
1309 | dndeta }; | |
77f97e3f CHC |
1310 | const char* titles[] = { /* 1 */ "MC", |
1311 | /* 2 */ "ESD input", | |
1312 | /* 3 */ "After merging", | |
1313 | /* 4 */ "After particle counting", | |
1314 | /* 5 */ "After corrections", | |
1315 | /* 6 */ "After normalization", | |
1316 | /* 7 */ "After combining" }; | |
1317 | Int_t nY = mcRings ? 4 : 3; | |
1318 | Int_t nX = 2; | |
1319 | if (fLandscape) { | |
1320 | Int_t tmp = nX; | |
1321 | nX = nY; | |
1322 | nY = tmp; | |
1323 | } | |
1324 | fBody->Divide(nX, nY, 0, 0); | |
2955f67c | 1325 | |
2955f67c | 1326 | Int_t step = 0; |
77f97e3f | 1327 | for (Int_t i = 0; i < 7; i++) { |
2955f67c | 1328 | TObject* obj = objs[i]; |
1329 | if (!obj) continue; | |
77f97e3f | 1330 | |
2955f67c | 1331 | step++; |
77f97e3f CHC |
1332 | Int_t padNo = step; |
1333 | if (!fLandscape) { | |
1334 | switch (step) { | |
1335 | case 1: padNo = 1; break; | |
1336 | case 2: padNo = 3; break; | |
1337 | case 3: padNo = 5; break; | |
1338 | case 4: padNo = (mcRings ? 7 : 2); break; | |
1339 | case 5: padNo = (mcRings ? 2 : 4); break; | |
1340 | case 6: padNo = (mcRings ? 4 : 6); break; | |
1341 | case 7: padNo = (mcRings ? 6 : 8); break; | |
1342 | } | |
1343 | } | |
1344 | //Printf("Drawing step %d in sub-pad %d (%s)",step,padNo,obj->GetTitle()); | |
1345 | DrawStep(step, all, obj, l, titles[i], fBody, padNo, nX); | |
2955f67c | 1346 | } |
1347 | ||
77f97e3f | 1348 | if (!esds && !mcRings && deltas) { |
2955f67c | 1349 | fBody->cd(6); |
1350 | TLegend* ll = new TLegend(0.01, 0.11, 0.99, 0.99); | |
1351 | // ll->SetNDC(); | |
1352 | ll->SetFillColor(kWhite); | |
1353 | ll->SetFillStyle(0); | |
1354 | ll->SetBorderSize(0); | |
1355 | ||
1356 | TIter next(deltas->GetHists()); | |
1357 | TH1* hh = 0; | |
1358 | while ((hh = static_cast<TH1*>(next()))) { | |
1359 | e = ll->AddEntry("dummy", hh->GetTitle(), "pl"); | |
1360 | e->SetMarkerColor(hh->GetMarkerColor()); | |
1361 | e->SetMarkerStyle(hh->GetMarkerStyle()); | |
1362 | e->SetLineColor(kBlack); | |
1363 | } | |
1364 | ll->Draw(); | |
1365 | } | |
67a4bb96 | 1366 | // Printf("Done drawing steps"); |
2955f67c | 1367 | PrintCanvas("Steps"); |
1368 | } | |
1369 | ||
1370 | ||
1371 | //____________________________________________________________________ | |
1372 | void DrawResults() | |
1373 | { | |
1374 | // MakeChapter(can, "Results"); | |
1375 | ||
77f97e3f | 1376 | fBody->Divide(2,1); |
2955f67c | 1377 | |
1378 | TCollection* c = GetCollection(fResults, "ringResults"); | |
1379 | if (!c) return; | |
1380 | ||
1381 | THStack* mcRings = GetStack(GetCollection(fResults, "mcRingResults", false), | |
1382 | "all", "dndeta_eta", false); | |
1383 | ||
1384 | TH1* dndeta_phi = GetH1(fResults, "dNdeta"); | |
1385 | TH1* dndeta_eta = GetH1(fResults, "dNdeta_"); | |
1386 | dndeta_phi->SetTitle("1/N_{ev}dN_{ch}/d#eta (#varphi norm)"); | |
1387 | dndeta_eta->SetTitle("1/N_{ev}dN_{ch}/d#eta (#eta norm)"); | |
1388 | dndeta_eta->SetMarkerSize(0.7); | |
1389 | ||
bfab35d9 | 1390 | THStack* allPhi = new THStack("phiAcc", "#varphi Acceptance"); |
1391 | THStack* allEta = new THStack("etaCov", "#eta Coverage"); | |
7095962e | 1392 | const char** pring = GetRingNames(false); |
bfab35d9 | 1393 | |
1394 | while ((*pring)) { | |
1395 | TCollection* cc = GetCollection(c, *pring); | |
1396 | TH1* etaCov = GetH1(cc, "etaCov"); | |
1397 | TH1* phiAcc = GetH1(cc, "phiAcc"); | |
1398 | TH1* dndeta = GetH1(cc, "dndeta_phi"); | |
1399 | Int_t color = kBlack; | |
1400 | if (dndeta) color = dndeta->GetMarkerColor(); | |
1401 | if (etaCov) { | |
1402 | etaCov->SetTitle(*pring); | |
1403 | etaCov->SetFillColor(color); | |
1404 | etaCov->SetLineColor(color); | |
1405 | allEta->Add(etaCov); | |
1406 | } | |
1407 | if (phiAcc) { | |
1408 | phiAcc->SetFillColor(color); | |
1409 | phiAcc->SetLineColor(color); | |
1410 | allPhi->Add(phiAcc); | |
1411 | } | |
1412 | pring++; | |
1413 | } | |
77f97e3f CHC |
1414 | Double_t savX = fParVal->GetX(); |
1415 | Double_t savY = fParVal->GetY(); | |
1416 | fParVal->SetX(.3); | |
1417 | fParVal->SetY(.2); | |
1418 | TVirtualPad* p = fBody->cd(1); | |
1419 | p->Divide(1,2,0,0); | |
1420 | DrawInPad(p, 1, GetStack(c, "all"), "nostack", mcRings ? 0 : kLegend, | |
079fd669 | 1421 | "Individual ring results"); |
77f97e3f CHC |
1422 | DrawInPad(p, 1, mcRings, "nostack same", kLegend|kSilent); |
1423 | DrawInPad(p, 2, allEta, "nostack hist", kLegend, | |
079fd669 | 1424 | "#phi acceptance and #eta coverage per ring"); |
77f97e3f CHC |
1425 | DrawInPad(p, 2, allPhi, "nostack hist same", 0x0); |
1426 | ||
1427 | p = fBody->cd(2); | |
1428 | p->Divide(1,2,0,0); | |
1429 | DrawInPad(p, 1, dndeta_phi, "", 0x0, | |
1430 | "1/#it{N}_{ev} d#it{N}_{ch}/d#it{#eta}"); | |
1431 | DrawInPad(p, 1, dndeta_eta, "Same", kLegend); | |
1432 | DrawInPad(p, 2, GetH1(fResults, "norm"), "", 0x0, | |
079fd669 | 1433 | "Total #phi acceptance and #eta coverage"); |
77f97e3f | 1434 | DrawInPad(p, 2, GetH1(fResults, "phi"), "same", kLegend); |
bfab35d9 | 1435 | // DrawInPad(fBody, 4, GetH1(fSums, "d2Ndetadphi"), "colz"); |
2955f67c | 1436 | |
079fd669 | 1437 | // fBody->cd(1); |
1438 | // TLatex* l = new TLatex(.5, .2, "Ring results"); | |
1439 | // l->SetNDC(); | |
1440 | // l->SetTextAlign(21); | |
1441 | // l->Draw(); | |
2955f67c | 1442 | |
079fd669 | 1443 | // fBody->cd(2); |
1444 | // l->DrawLatex(.5, .2, "1/N_{ev}dN_{ch}/d#eta"); | |
2955f67c | 1445 | |
1446 | // fBody->cd(3); | |
1447 | // l->DrawLatex(.5, .2, "1/N_{ev}dN_{ch}/d#eta (#vta norm.)"); | |
1448 | ||
77f97e3f CHC |
1449 | fParVal->SetX(savX); |
1450 | fParVal->SetY(savY); | |
2955f67c | 1451 | PrintCanvas("Results"); |
1452 | } | |
1453 | ||
bfab35d9 | 1454 | //____________________________________________________________________ |
1455 | void DrawCentralResults() | |
1456 | { | |
1457 | // MakeChapter(can, "Results"); | |
1458 | Info("DrawCentralResults", "Drawing central results"); | |
1459 | ||
1460 | fBody->Divide(1,2,0,0); | |
1461 | ||
1462 | TH1* dndeta_ = GetH1(fResults, "dNdeta_"); | |
1463 | TH1* dndeta = GetH1(fResults, "dNdeta"); | |
1464 | THStack* stack = new THStack("dndetas", | |
1465 | "d#it{N}_{ch}/d#it{#eta} - central"); | |
1466 | stack->Add(dndeta_); | |
1467 | stack->Add(dndeta); | |
1468 | ||
1469 | DrawInPad(fBody, 1, stack, "nostack"); | |
77f97e3f CHC |
1470 | TH1* h = stack->GetHistogram(); |
1471 | if (h) { | |
1472 | h->SetXTitle("#it{#eta}"); | |
1473 | h->SetYTitle("#frac{d#it{N}_{ch}}{d#it{#eta}}"); | |
1474 | } | |
bfab35d9 | 1475 | fBody->cd(1); |
1476 | TLegend* l = new TLegend(.3, .05, .7, .4); | |
1477 | l->SetFillColor(0); | |
1478 | l->SetFillStyle(0); | |
1479 | l->SetBorderSize(0); | |
1480 | l->AddEntry(dndeta_, "Normalized to coverage", "lp"); | |
1481 | l->AddEntry(dndeta, "Normalized to #phi acceptance", "lp"); | |
1482 | l->Draw(); | |
1483 | ||
1484 | DrawInPad(fBody, 2, GetH1(fResults, "norm")); | |
1485 | DrawInPad(fBody, 2, GetH1(fResults, "phi"), "same", kLegend); | |
1486 | ||
1487 | PrintCanvas("Central Results"); | |
1488 | ||
1489 | } | |
1490 | void DrawBoth(TFile* file) | |
1491 | { | |
1492 | Info("DrawBoth", "Drawing central & forward results"); | |
1493 | TCollection* central = GetCollection(file, "CentralResults"); | |
1494 | TCollection* forward = GetCollection(file, "ForwardResults"); | |
1495 | ||
1496 | if (!central || !forward) { | |
1497 | Warning("DrawBoth", "central %p or forward %p results not found", | |
1498 | central, forward); | |
1499 | return; | |
1500 | } | |
1501 | ||
1502 | TH1* f1 = GetH1(forward, "dNdeta_"); | |
1503 | TH1* c1 = GetH1(central, "dNdeta_"); | |
1504 | TH1* f2 = GetH1(forward, "dNdeta"); | |
1505 | TH1* c2 = GetH1(central, "dNdeta"); | |
24338c03 | 1506 | if (!f1 || !c1 || !f2 || !c2) return; |
bfab35d9 | 1507 | f1->SetLineColor(kBlack); |
1508 | f2->SetLineColor(kBlack); | |
1509 | c1->SetLineColor(kBlack); | |
1510 | c2->SetLineColor(kBlack); | |
1511 | f1->SetMarkerColor(f2->GetMarkerColor()); | |
1512 | f1->SetMarkerStyle(24); | |
1513 | c1->SetMarkerStyle(24); | |
1514 | c2->SetMarkerStyle(20); | |
1515 | c2->SetMarkerColor(c1->GetMarkerColor()); | |
1516 | THStack* s = new THStack("dndetas", "d#it{N}_{ch}/d#it{#eta}"); | |
1517 | s->Add(f1); | |
1518 | s->Add(c1); | |
1519 | s->Add(f2); | |
1520 | s->Add(c2); | |
1521 | ||
1522 | fBody->Divide(1, 2, 0, 0); | |
1523 | DrawInPad(fBody, 1, s, "nostack"); | |
1524 | s->GetHistogram()->SetXTitle("#it{#eta}"); | |
1525 | s->GetHistogram()->SetYTitle("#frac{d#it{N}_{ch}}{d#it{#eta}}"); | |
1526 | ||
1527 | fBody->cd(1); | |
1528 | TLegend* l = new TLegend(.4, .05, .8, .4); | |
1529 | l->SetFillColor(0); | |
1530 | l->SetFillStyle(0); | |
1531 | l->SetBorderSize(0); | |
1532 | TLegendEntry* entry = l->AddEntry("dummy", "Forward", "f"); | |
1533 | entry->SetFillColor(f1->GetMarkerColor()); | |
1534 | entry->SetLineColor(f1->GetMarkerColor()); | |
1535 | entry->SetFillStyle(1001); | |
1536 | entry->SetLineWidth(0); | |
1537 | entry = l->AddEntry("dummy", "Central", "f"); | |
1538 | entry->SetFillColor(c1->GetMarkerColor()); | |
1539 | entry->SetLineColor(c1->GetMarkerColor()); | |
1540 | entry->SetLineWidth(0); | |
1541 | entry->SetFillStyle(1001); | |
1542 | entry = l->AddEntry("dummy", "Normalized to coverage", "lp"); | |
1543 | entry->SetMarkerStyle(f1->GetMarkerStyle()); | |
1544 | entry = l->AddEntry("dummy", "Normalized to #phi acceptance", "lp"); | |
1545 | entry->SetMarkerStyle(f2->GetMarkerStyle()); | |
1546 | l->Draw(); | |
1547 | ||
1548 | TH1* f3 = GetH1(forward, "norm"); | |
1549 | TH1* c3 = GetH1(central, "norm"); | |
1550 | TH1* f4 = GetH1(forward, "phi"); | |
1551 | TH1* c4 = GetH1(central, "phi"); | |
1552 | f3->SetFillColor(f1->GetMarkerColor()); | |
1553 | f4->SetFillColor(f1->GetMarkerColor()); | |
1554 | c3->SetFillColor(c1->GetMarkerColor()); | |
1555 | c4->SetFillColor(c1->GetMarkerColor()); | |
1556 | f3->SetLineColor(f1->GetMarkerColor()); | |
1557 | f4->SetLineColor(f1->GetMarkerColor()); | |
1558 | c3->SetLineColor(c1->GetMarkerColor()); | |
1559 | c4->SetLineColor(c1->GetMarkerColor()); | |
1560 | ||
1561 | THStack* a = new THStack("norms", "Normalizations"); | |
1562 | a->Add(f3); | |
1563 | a->Add(c3); | |
1564 | a->Add(f4); | |
1565 | a->Add(c4); | |
1566 | ||
1567 | a->SetMaximum(a->GetMaximum("nostack")*1.2); | |
1568 | DrawInPad(fBody, 2, a, "nostack"); | |
1569 | a->GetHistogram()->SetXTitle("#it{#eta}"); | |
1570 | a->GetHistogram()->SetYTitle("Normalization (coverage or acceptance)"); | |
1571 | ||
1572 | fBody->cd(2); | |
1573 | l = new TLegend(.2, .94, .9, .99); | |
1574 | l->SetFillColor(0); | |
1575 | l->SetFillStyle(0); | |
1576 | l->SetBorderSize(0); | |
1577 | l->SetNColumns(2); | |
1578 | // entry = l->AddEntry("dummy", "Forward", "f"); | |
1579 | // entry->SetFillColor(f1->GetMarkerColor()); | |
1580 | // entry->SetLineColor(f1->GetMarkerColor()); | |
1581 | // entry->SetFillStyle(1001); | |
1582 | // entry->SetLineWidth(0); | |
1583 | // entry = l->AddEntry("dummy", "Central", "f"); | |
1584 | // entry->SetFillColor(c1->GetMarkerColor()); | |
1585 | // entry->SetLineColor(c1->GetMarkerColor()); | |
1586 | // entry->SetLineWidth(0); | |
1587 | // entry->SetFillStyle(1001); | |
1588 | entry = l->AddEntry("dummy", "#eta Coverage", "f"); | |
1589 | entry->SetFillStyle(f3->GetFillStyle()); | |
1590 | entry->SetFillColor(kBlack); | |
1591 | entry = l->AddEntry("dummy", "#phi Acceptance", "f"); | |
1592 | entry->SetFillStyle(f4->GetFillStyle()); | |
1593 | entry->SetFillColor(kBlack); | |
1594 | l->Draw(); | |
1595 | ||
1596 | PrintCanvas("Both results"); | |
1597 | } | |
2955f67c | 1598 | TCollection* fSums; |
1599 | TCollection* fResults; | |
1600 | }; | |
1601 | ||
1602 | // #endif |