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