]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/scripts/SummaryAODDrawer.C
upated for flattering
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / scripts / SummaryAODDrawer.C
CommitLineData
2955f67c 1#include "SummaryDrawer.C"
2
8449e3e0 3/**
4 * Class to draw a summary of the AOD production
5 *
6 * @par Input:
7 * - The merged <tt>forward.root</tt> file.
8 * If the file isn't merged, it should still work.
9 *
10 * @par Output:
11 * - A PDF file named after the input, but with <tt>.root</tt>
12 * replaced with <tt>pdf</tt>
13 *
14 */
2955f67c 15class SummaryAODDrawer : public SummaryDrawer
16{
17public:
8449e3e0 18 enum EFlags {
19 kEventInspector = 0x001,
20 kSharingFilter = 0x002,
21 kDensityCalculator = 0x004,
22 kCorrector = 0x008,
23 kHistCollector = 0x010,
24 kSteps = 0x020,
25 kResults = 0x040,
26 kPause = 0x080,
27 kLandscape = 0x100,
28 kCentral = 0x200,
29 kNormal = 0x27F
30 };
2955f67c 31 SummaryAODDrawer()
32 : SummaryDrawer(),
33 fSums(0),
34 fResults(0)
35 {}
36
37 //__________________________________________________________________
38 /**
39 *
40 *
41 * @param fname
42 * @param what
43 */
8449e3e0 44 void Run(const char* fname, UShort_t what=kNormal)
2955f67c 45 {
46 // --- Open the file ---------------------------------------------
47 TString filename(fname);
48 TFile* file = TFile::Open(filename, "READ");
49 if (!file) {
50 Error("Run", "Failed to open \"%s\"", filename.Data());
51 return;
52 }
bfab35d9 53
8449e3e0 54
2955f67c 55 // --- Get top-level collection ----------------------------------
56 fSums = GetCollection(file, "Forward");
57 if (!fSums) return;
58
bfab35d9 59 // --- Do the results ----------------------------------------------
60 fResults = GetCollection(file, "ForwardResults");
61 if (!fResults) fResults = fSums; // Old-style
62
2955f67c 63 // --- Make our canvas -------------------------------------------
64 TString pdfName(filename);
65 pdfName.ReplaceAll(".root", ".pdf");
bfab35d9 66 CreateCanvas(pdfName, what & kLandscape);
67 DrawTitlePage(file);
8449e3e0 68
69 // --- Possibly make a chapter here ------------------------------
70 if (what & kCentral && GetCollection(file, "Central"))
71 MakeChapter("Forward");
2955f67c 72
73 // --- Set pause flag --------------------------------------------
bfab35d9 74 fPause = what & kPause;
2955f67c 75
76 // --- Do each sub-algorithm -------------------------------------
bfab35d9 77 if (what & kEventInspector) DrawEventInspector(fSums);
78 if (what & kSharingFilter) DrawSharingFilter();
79 if (what & kDensityCalculator) DrawDensityCalculator();
80 if (what & kCorrector) DrawCorrector();
81 if (what & kHistCollector) DrawHistCollector();
2955f67c 82
2955f67c 83
bfab35d9 84 if (what & kSteps) DrawSteps();
85 if (what & kResults) DrawResults();
8449e3e0 86
87 // --- SPD clusters ----------------------------------------------
bfab35d9 88 if (what & kCentral) {
8449e3e0 89 // --- Get top-level collection --------------------------------
90 fSums = GetCollection(file, "Central");
91 if (fSums) {
92 MakeChapter("Central");
93 DrawCentral();
bfab35d9 94 if (what & kEventInspector) DrawEventInspector(fSums);
95 }
96 fResults = GetCollection(file, "CentralResults");
97 if (fResults && (what & kResults)) {
98 DrawCentralResults();
8449e3e0 99 }
bfab35d9 100
101 if (what & kResults) DrawBoth(file);
8449e3e0 102 }
103
bfab35d9 104
2955f67c 105 CloseCanvas();
106 }
107protected:
108 //____________________________________________________________________
bfab35d9 109 void DrawTitlePage(TFile* f)
2955f67c 110 {
2955f67c 111 fBody->cd();
112
bfab35d9 113 TLatex* ltx = new TLatex(.5, .7, "ESD #rightarrow AOD filtering");
114 ltx->SetNDC();
115 ltx->SetTextSize(0.07);
116 ltx->SetTextAlign(22);
117 ltx->Draw();
118
119 TCollection* fwd = GetCollection(f, "Forward");
120 TCollection* cen = GetCollection(f, "Central");
121 Double_t y = .6;
122
2955f67c 123 Double_t save = fParName->GetTextSize();
124 fParName->SetTextSize(0.03);
125 fParVal->SetTextSize(0.03);
8449e3e0 126
bfab35d9 127 DrawParameter(y, "Tasks", (fwd ? "Forward" : ""));
128 DrawParameter(y, "", (cen ? "Central" : ""));
129
130 if (fwd) {
131 TCollection* ei = GetCollection(fwd, "fmdEventInspector");
132 if (ei) {
133
134 Int_t sys=0, sNN=0, field=0, runNo=0;
135 Bool_t mc=false;
136
137 if (GetParameter(ei, "sys", sys))
138 DrawParameter(y, "System", (sys == 1 ? "pp" : sys == 2 ? "PbPb" :
139 sys == 3 ? "pPb" : "unknown"));
140 if (GetParameter(ei, "sNN", sNN)) {
141 TString tsNN = TString::Format("%dGeV", sNN);
142 if (sNN >= 10000)
143 tsNN = TString::Format("%5.2f", float(sNN)/1000);
144 else if (sNN >= 1000)
145 tsNN = TString::Format("%4.2f", float(sNN)/1000);
146 DrawParameter(y, "#sqrt{s_{NN}}", tsNN);
147 }
148
149 if (GetParameter(ei, "field", field))
150 DrawParameter(y, "L3 B field", Form("%+2dkG", field));
151
152 if (GetParameter(ei, "runNo", runNo))
153 DrawParameter(y, "Run #", Form("%6d", runNo));
154
155 if (!GetParameter(ei, "mc", mc)) mc = false;
156 DrawParameter(y, "Simulation", (mc ? "yes" : "no"));
157 }
158 }
159 PrintCanvas("Title page");
2955f67c 160 fParName->SetTextSize(save);
161 fParVal->SetTextSize(save);
2955f67c 162 }
163 //____________________________________________________________________
164 void DrawSharingFilter()
165 {
bfab35d9 166 Info("DrawSharingFilter", "Drawing sharing filter");
2955f67c 167 TCollection* c = GetCollection(fSums, "fmdSharingFilter");
168 if (!c) return;
bfab35d9 169 TCollection* rc = GetCollection(fResults, "fmdSharingFilter");
170 if (!rc) rc = c;
2955f67c 171
172 fBody->Divide(1, 3);
173 fBody->cd(1);
174
175 Double_t y = .8;
176 Bool_t angle=false, lowSignal=false, simple=false;
bfab35d9 177
8449e3e0 178 if (GetParameter(c, "angle", angle))
179 DrawParameter(y, "Angle correct", (angle ? "yes" : "no"));
180 if (GetParameter(c, "lowSignal", lowSignal))
181 DrawParameter(y, "Lower signal", (lowSignal ? "yes" : "no"));
bfab35d9 182
8449e3e0 183 if (GetParameter(c, "simple", simple))
184 DrawParameter(y, "Simple method", (simple ? "yes" : "no"));
bfab35d9 185 TParameter<int>* nFiles =
186 static_cast<TParameter<int>*>(GetObject(c, "nFiles"));
187 if (nFiles)
188 DrawParameter(y, "# files merged", Form("%d", nFiles->GetVal()));
2955f67c 189
bfab35d9 190
191 TCollection* lc = GetCollection(c, "lCuts");
192 TCollection* hc = GetCollection(c, "hCuts");
193 Int_t lm, hm;
194 if (GetParameter(lc, "method", lm))
195 DrawParameter(y, "Low cut method", (lm == 0 ? "fixed" :
196 lm == 1 ? "fraction of MPV" :
197 lm == 2 ? "fit range" :
198 lm == 3 ? "Landau width" :
199 "unknown"));
200 if (GetParameter(hc, "method", hm))
201 DrawParameter(y, "High cut method", (hm == 0 ? "fixed" :
202 hm == 1 ? "fraction of MPV" :
203 hm == 2 ? "fit range" :
204 hm == 3 ? "Landau width" :
205 "unknown"));
206
207
208 TH2* hLow = GetH2(c, "lowCuts");
209 TH2* hHigh = GetH2(c, "highCuts");
210 if (hLow && nFiles) hLow->Scale(1. / nFiles->GetVal());
211 if (hHigh && nFiles) hHigh->Scale(1. / nFiles->GetVal());
212 DrawInPad(fBody, 2, hLow, "colz");
213 DrawInPad(fBody, 3, hHigh, "colz");
2955f67c 214
215 PrintCanvas("Sharing filter");
216
217 const char* subs[] = { "FMD1I", "FMD2I", "FMD2O", "FMD3O", "FMD3I", 0 };
218 const char** ptr = subs;
219 while (*ptr) {
220 TCollection* sc = GetCollection(c, *ptr);
221 if (!sc) { ptr++; continue; }
222
223 fBody->Divide(2,3);
079fd669 224 DrawInPad(fBody, 1, GetH1(sc, "esdEloss"), "", 0x2,
225 "#Delta/#Delta_{mip} reconstructed and merged");
2955f67c 226 DrawInPad(fBody, 1, GetH1(sc, "anaEloss"), "same", 0x12);
079fd669 227 DrawInPad(fBody, 2, GetH1(sc, "singleEloss"), "", 0x2,
228 "#Delta/#Delta_{mip} for single, double, and tripple hits");
2955f67c 229 DrawInPad(fBody, 2, GetH1(sc, "doubleEloss"), "same", 0x2);
230 DrawInPad(fBody, 2, GetH1(sc, "tripleEloss"), "same", 0x12);
231 DrawInPad(fBody, 3, GetH2(sc, "singlePerStrip"), "colz", 0x4);
8449e3e0 232 // DrawInPad(fBody, 4, GetH1(sc, "distanceBefore"), "", 0x2);
233 // DrawInPad(fBody, 4, GetH1(sc, "distanceAfter"), "same", 0x12);
234 DrawInPad(fBody, 4, GetH2(sc, "summed"), "colz", 0x0);
2955f67c 235
236 TH2* nB = GetH2(sc, "neighborsBefore");
237 if (nB) {
238 nB->GetXaxis()->SetRangeUser(0,8);
239 nB->GetYaxis()->SetRangeUser(0,8);
240 }
241 DrawInPad(fBody, 5, nB, "colz", 0x4);
079fd669 242 DrawInPad(fBody, 5, GetH2(sc, "neighborsAfter"), "p same", 0x4,
243 "Correlation of neighbors before and after merging");
2955f67c 244 DrawInPad(fBody, 6, GetH2(sc, "beforeAfter"), "colz", 0x4);
245
246 PrintCanvas(Form("Sharing filter - %s", *ptr));
247 ptr++;
248 }
249
250 // --- MC --------------------------------------------------------
251 TCollection* cc = GetCollection(c, "esd_mc_comparion", false); // Spelling!
252 if (!cc) return; // Not MC
253
254 DivideForRings(false, false);
255 DrawInRingPad(1, 'I', GetH2(cc, "FMD1i_corr"), "colz", 0x4);
256 DrawInRingPad(2, 'I', GetH2(cc, "FMD2i_corr"), "colz", 0x4);
257 DrawInRingPad(2, 'O', GetH2(cc, "FMD2o_corr"), "colz", 0x4);
258 DrawInRingPad(3, 'I', GetH2(cc, "FMD3i_corr"), "colz", 0x4);
259 DrawInRingPad(3, 'O', GetH2(cc, "FMD3o_corr"), "colz", 0x4);
260
261 PrintCanvas("Sharing filter - MC vs Reco");
262
263 // --- MC --------------------------------------------------------
bfab35d9 264 DrawTrackDensity(c);
2955f67c 265 }
266
267 //____________________________________________________________________
268 void DrawDensityCalculator()
269 {
270 Info("DrawDensityCalculator", "Drawing density calculator");
271 TCollection* c = GetCollection(fSums, "fmdDensityCalculator");
272 if (!c) return;
273
274 fBody->Divide(2, 2);
275 fBody->cd(1);
276
277 Double_t y = .8;
278 Int_t maxParticles=0, phiAcceptance=0, etaLumping=0, phiLumping=0;
279 Bool_t method=false, recalcEta=false, recalcPhi=false;
8449e3e0 280 Double_t size = fLandscape ? 0.06 : 0.04;
2955f67c 281
8449e3e0 282 GetParameter(c, "maxParticle", maxParticles);
283
284 if (GetParameter(c, "phiAcceptance", phiAcceptance))
285 DrawParameter(y, "#phi acceptance method",
286 (phiAcceptance == 1 ? "N_{ch}" :
287 phiAcceptance == 2 ? "#DeltaE" : "none"), size);
288
289 if (GetParameter(c, "etaLumping", etaLumping) &&
290 GetParameter(c, "phiLumping", phiLumping))
291 DrawParameter(y, "Region size (sector#timesstrip)",
292 Form("%2d #times %2d", phiLumping, etaLumping), size);
293
294 if (GetParameter(c, "method", method))
295 DrawParameter(y, "Method", (method ? "Poisson" : "#DeltaE"), size);
296
297 if (GetParameter(c, "recalcEta", recalcEta))
298 DrawParameter(y, "Recalculate #eta",(recalcEta ? "yes" : "no"),size);
299
300 if (GetParameter(c, "recalcPhi", recalcPhi))
301 DrawParameter(y, "Recalculate #phi",(recalcPhi ? "yes" : "no"),size);
bfab35d9 302 TParameter<int>* nFiles =
303 static_cast<TParameter<int>*>(GetObject(c, "nFiles"));
304 if (nFiles)
305 DrawParameter(y, "# files merged", Form("%d", nFiles->GetVal()));
8449e3e0 306
bfab35d9 307 TCollection* lc = GetCollection(c, "lCuts");
308 Int_t lm;
309 if (GetParameter(lc, "method", lm))
310 DrawParameter(y, "Low cut method", (lm == 0 ? "fixed" :
311 lm == 1 ? "fraction of MPV" :
312 lm == 2 ? "fit range" :
313 lm == 3 ? "Landau width" :
314 "unknown"));
2955f67c 315
2955f67c 316
317 TVirtualPad* p = fBody; // fBody->cd(2);
318 // p->Divide(3,1);
319
320 TH1* accI = GetH1(c, "accI");
321 TH1* accO = GetH1(c, "accO");
322 if (accI) {
323 Double_t scale = 1./accI->GetMaximum();
324 accI->Scale(scale);
325 accO->Scale(scale);
326 accI->SetMinimum(0);
327 }
bfab35d9 328 TH2* lCuts = GetH2(c, "lowCuts");
329 TH2* maxW = GetH2(c, "maxWeights");
330 if (nFiles && lCuts) lCuts->Scale(1. / nFiles->GetVal());
331 if (nFiles && maxW) maxW->Scale(1. / nFiles->GetVal());
2955f67c 332 DrawInPad(p, 2, accI);
bfab35d9 333 DrawInPad(p, 2, accO, "same", 0x10);
334 DrawInPad(p, 3, lCuts, "colz");
335 DrawInPad(p, 4, maxW, "colz");
2955f67c 336
337 PrintCanvas("Density calculator");
338
339 const char* subs[] = { "FMD1I", "FMD2I", "FMD2O", "FMD3O", "FMD3I", 0 };
340 const char** ptr = subs;
341 while (*ptr) {
342 TCollection* sc = GetCollection(c, *ptr);
343 if (!sc) { ptr++; continue; }
344
345 fBody->Divide(2,3);
346
bfab35d9 347 DrawInPad(fBody, 1, GetH2(sc, "elossVsPoisson"), "colz", 0x4);
348 DrawInPad(fBody, 2, GetH1(sc, "diffElossPoisson"), "HIST E", 0x2);
349 DrawInPad(fBody, 3, GetH1(sc, "occupancy"), "", 0x2);
079fd669 350 DrawInPad(fBody, 4, GetH1(sc, "eloss"), "", 0x2,
351 "#Delta/#Delta_{mip} before and after cuts");
bfab35d9 352 DrawInPad(fBody, 4, GetH1(sc, "elossUsed"), "same", 0x12);
2955f67c 353 TH1* phiB = GetH1(sc, "phiBefore");
354 TH1* phiA = GetH1(sc, "phiAfter");
355 if (phiB && phiA) {
356 phiA->Add(phiB, -1);
357 phiA->Divide(phiB);
358 phiA->SetTitle("#Delta#phi from Ip (x,y) correction");
359 phiA->SetYTitle("(#phi_{after}-#phi_{before})/#phi_{before}");
360 }
361 DrawInPad(fBody, 5, phiA);
362 DrawInPad(fBody, 6, GetH2(sc, "phiAcc"), "colz", 0x4);
363
364 PrintCanvas(Form("Density calculator - %s", *ptr));
365 ptr++;
366 }
367
368 TCollection* cc = GetCollection(c, "esd_mc_comparison", false);
369 if (!cc) return; // Not MC
370
371 fBody->Divide(2,5);
372 DrawInPad(fBody, 1, GetH2(cc, "FMD1I_corr_mc_esd"), "colz", 0x4);
373 DrawInPad(fBody, 3, GetH2(cc, "FMD2I_corr_mc_esd"), "colz", 0x4);
374 DrawInPad(fBody, 5, GetH2(cc, "FMD2O_corr_mc_esd"), "colz", 0x4);
375 DrawInPad(fBody, 7, GetH2(cc, "FMD3O_corr_mc_esd"), "colz", 0x4);
376 DrawInPad(fBody, 9, GetH2(cc, "FMD3I_corr_mc_esd"), "colz", 0x4);
377 DrawInPad(fBody, 2, GetH1(cc, "FMD1I_diff_mc_esd"), "", 0x2);
378 DrawInPad(fBody, 4, GetH1(cc, "FMD2I_diff_mc_esd"), "", 0x2);
379 DrawInPad(fBody, 6, GetH1(cc, "FMD2O_diff_mc_esd"), "", 0x2);
380 DrawInPad(fBody, 8, GetH1(cc, "FMD3O_diff_mc_esd"), "", 0x2);
381 DrawInPad(fBody, 10, GetH1(cc, "FMD3I_diff_mc_esd"), "", 0x2);
382
383 PrintCanvas("Density calculator - MC vs Reco");
384 }
385
386 //____________________________________________________________________
387 void DrawCorrector()
388 {
389 Info("DrawCorrector", "Drawing corrector");
390 TCollection* c = GetCollection(fSums, "fmdCorrector");
391 if (!c) return;
392
393 fBody->cd();
394
395 Double_t y = .8;
396 Bool_t secondary=false, vertexBias=false, acceptance=false, merging=false;
8449e3e0 397 if (GetParameter(c, "secondary", secondary))
398 DrawParameter(y, "Secondary corr.", secondary ? "yes" : "no");
399 if (GetParameter(c, "acceptance", acceptance))
400 DrawParameter(y, "Acceptance corr.", acceptance ? "yes" : "no");
401 if (GetParameter(c, "vertexBias", vertexBias))
402 DrawParameter(y, "Vertex bias corr.", vertexBias ? "yes" : "no");
403 if (GetParameter(c, "merging", merging))
404 DrawParameter(y, "Merging eff.", merging ? "yes" : "no");
2955f67c 405
406 PrintCanvas("Corrector");
407
408 TCollection* cc = GetCollection(c, "esd_mc_comparison", false);
409 if (!cc) return; // Not MC
410
411 DivideForRings(false, false);
412
413 DrawInRingPad(1, 'I', GetH2(cc, "FMD1I_esd_vs_mc"), "colz", 0x0);
414 DrawInRingPad(2, 'I', GetH2(cc, "FMD2I_esd_vs_mc"), "colz", 0x0);
415 DrawInRingPad(2, 'O', GetH2(cc, "FMD2O_esd_vs_mc"), "colz", 0x0);
416 DrawInRingPad(3, 'O', GetH2(cc, "FMD3O_esd_vs_mc"), "colz", 0x0);
417 DrawInRingPad(3, 'I', GetH2(cc, "FMD3I_esd_vs_mc"), "colz", 0x0);
418
419 PrintCanvas("Corrector - MC vs Reco");
420 }
421
422 //____________________________________________________________________
423 void DrawHistCollector()
424 {
425 Info("DrawHistCollector", "Drawing histogram collector");
426 TCollection* c = GetCollection(fSums, "fmdHistCollector");
427 if (!c) return;
428
429 fBody->Divide(1, 3);
430 fBody->cd(1);
431
432 Double_t y = .8;
433 Int_t nCutBins=0, fiducial=0, merge=0, skipRings=0;
434 Double_t fiducialCut=0.;
435 Bool_t bgAndHits=false;
436
8449e3e0 437 if (GetParameter(c, "nCutBins", nCutBins))
438 DrawParameter(y, "# of bins to cut", Form("%d", nCutBins));
439
440 if (GetParameter(c, "skipRings", skipRings)) {
441 TString skipped;
442 if (skipRings & 0x05) skipped.Append("FMD1i ");
443 if (skipRings & 0x09) skipped.Append("FMD2i ");
444 if (skipRings & 0x0a) skipped.Append("FMD2o ");
445 if (skipRings & 0x11) skipped.Append("FMD3i ");
446 if (skipRings & 0x12) skipped.Append("FMD3o ");
447 DrawParameter(y, "Skipped rings", skipped);
448 }
449
450 if (GetParameter(c, "bgAndHits", bgAndHits))
451 DrawParameter(y, "Bg & hit maps stored.", bgAndHits?"yes":"no");
452
453 if (GetParameter(c, "merge", merge))
454 DrawParameter(y, "Merge method",
455 (merge == 0 ? "straight mean" :
456 merge == 1 ? "straight mean, no zeroes" :
457 merge == 2 ? "weighted mean" :
458 merge == 3 ? "least error" :
459 merge == 4 ? "sum" : "unknown"));
460
461 if (GetParameter(c, "fiducial", fiducial))
462 DrawParameter(y, "Fiducial method.",
463 fiducial == 0 ? "cut" : "distance");
464
465 if (GetParameter(c, "fiducialCut", fiducialCut))
466 DrawParameter(y, "Fiducial cut.", Form("%f", fiducialCut));
467
2955f67c 468
469 DrawInPad(fBody, 2, GetH2(c, "sumRings"), "colz");
470 DrawInPad(fBody, 3, GetH2(c, "coverage"), "colz");
471
472 fBody->cd(1)->Modified();
473 fBody->cd(2)->Modified();
474 fBody->cd(3)->Modified();
475 fBody->cd(1)->Update();
476 fBody->cd(2)->Update();
477 fBody->cd(3)->Update();
478 PrintCanvas("Histogram collector");
8449e3e0 479
480
481 TIter next(c);
482 TObject* o = 0;
483 TRegexp regexp("[pm][0-9]+_[pm][0-9]+");
484 while ((o = next())) {
485 TString name(o->GetName());
486 if (name.Index(regexp) == kNPOS) continue;
487
488 TList* vl = static_cast<TList*>(o);
489
490 DivideForRings(false, false);
491
492 DrawInRingPad(1, 'I', GetH2(vl, "secMapFMD1I"), "colz", 0x0);
493 DrawInRingPad(2, 'I', GetH2(vl, "secMapFMD2I"), "colz", 0x0);
494 DrawInRingPad(2, 'O', GetH2(vl, "secMapFMD2O"), "colz", 0x0);
495 DrawInRingPad(3, 'O', GetH2(vl, "secMapFMD3O"), "colz", 0x0);
496 DrawInRingPad(3, 'I', GetH2(vl, "secMapFMD3I"), "colz", 0x0);
497 DrawInRingPad(1, 'I', GetH2(vl, "hitMapFMD1I"), "box same", 0x0);
498 DrawInRingPad(2, 'I', GetH2(vl, "hitMapFMD2I"), "box same", 0x0);
499 DrawInRingPad(2, 'O', GetH2(vl, "hitMapFMD2O"), "box same", 0x0);
500 DrawInRingPad(3, 'O', GetH2(vl, "hitMapFMD3O"), "box same", 0x0);
501 DrawInRingPad(3, 'I', GetH2(vl, "hitMapFMD3I"), "box same", 0x0);
502
503 PrintCanvas(Form("Histogram Collector - Vertex bin %s", vl->GetName()));
504 }
505
506 o = c->FindObject("byCentrality");
507 if (!o) return;
508 TList* bc = static_cast<TList*>(o);
509
510 DrawInPad(fBody, GetH3(bc, "FMD1I"), "box", 0);
511 DrawInPad(fBody, GetH3(bc, "FMD2I"), "box same", 0);
512 DrawInPad(fBody, GetH3(bc, "FMD2O"), "box same", 0);
513 DrawInPad(fBody, GetH3(bc, "FMD3O"), "box same", 0);
514 DrawInPad(fBody, GetH3(bc, "FMD3I"), "box same", 0x10);
2955f67c 515 }
8449e3e0 516
517 //____________________________________________________________________
518 void DrawCentral()
519 {
520 Info("DrawCentral", "Drawing central (SPD)");
521 TCollection* c = fSums;
522 if (!c) return;
523
524 fBody->Divide(1, 3);
525 fBody->cd(1);
526
527
079fd669 528 DrawInPad(fBody, 1, GetH2(c, "coverage"), "col", 0,
529 "#eta coverage per v_{z}");
530 DrawInPad(fBody, 2, GetH2(c, "nClusterVsnTracklet"), "colz", 0x03,
531 "Correlation of # of tracklets and clusters");
532 DrawInPad(fBody, 3, GetH2(c, "clusterPerTracklet"), "colz", 0x0,
533 "# clusters per tracklet vs #eta");
8449e3e0 534
535 fBody->cd(1)->Modified();
536 fBody->cd(2)->Modified();
537 fBody->cd(3)->Modified();
538 fBody->cd(1)->Update();
539 fBody->cd(2)->Update();
540 fBody->cd(3)->Update();
541 PrintCanvas("Central - overview");
542
543
544 TIter next(c);
545 TObject* o = 0;
546 TRegexp regexp("[pm][0-9]+_[pm][0-9]+");
547 while ((o = next())) {
548 TString name(o->GetName());
549 if (name.Index(regexp) == kNPOS) continue;
550
551 TList* vl = static_cast<TList*>(o);
552
553 fBody->Divide(1, 3);
554
555 DrawInPad(fBody, 1, GetH1(vl, "acceptance"), "", 0);
556
557 TH1* sec = GetH1(vl, "secondary");
558 sec->SetMarkerStyle(21);
559 sec->SetMarkerSize(1.2);
560 DrawInPad(fBody, 2, sec, "", 0);
561 DrawInPad(fBody, 2, GetH1(vl, "secondaryFiducial"), "same", 0x0);
562 DrawInPad(fBody, 3, GetH2(vl, "secondaryMapFiducial"), "colz", 0);
563 DrawInPad(fBody, 3, GetH2(vl, "hitMap"), "box same", 0x0);
564
565 fBody->cd(1)->Modified();
566 fBody->cd(2)->Modified();
567 fBody->cd(3)->Modified();
568 fBody->cd(1)->Update();
569 fBody->cd(2)->Update();
570 fBody->cd(3)->Update();
571 PrintCanvas(Form("Central - Vertex bin %s", vl->GetName()));
572 }
573 }
574
2955f67c 575
576 //____________________________________________________________________
577 void AddToAll(THStack* all, const THStack* stack, Int_t curr, Int_t step)
578 {
579 if (!stack) return;
580
581 TIter next(stack->GetHists());
582 TH1* h = 0;
583 while ((h = static_cast<TH1*>(next()))) {
584 TH1* copy = static_cast<TH1*>(h->Clone(Form("%s_copy", h->GetName())));
585 copy->SetDirectory(0);
586 if (curr != step) {
587 copy->SetMarkerColor(kGray);
588 copy->SetLineColor(kGray);
589 }
590 all->Add(copy);
591 }
592 }
593 //____________________________________________________________________
594 void AddToAll(THStack* all, const THStack* stack)
595 {
596 if (!stack) return;
597
598 TIter next(stack->GetHists());
599 TH1* h = 0;
600 while ((h = static_cast<TH1*>(next()))) {
601 TH1* copy = static_cast<TH1*>(h->Clone(Form("%s_copy", h->GetName())));
602 copy->SetDirectory(0);
603 copy->SetMarkerColor(kGray);
604 copy->SetLineColor(kGray);
605 all->Add(copy);
606 }
607 }
608
609 //____________________________________________________________________
610 void DrawStep(Int_t step,
611 THStack* all,
612 TObject* cur,
613 TLegend* leg,
614 const char* title,
615 TVirtualPad* can)
616 {
8449e3e0 617 if (all->GetHists()->GetEntries() <= 0 || !cur) return;
618
2955f67c 619 // Info("", "Drawing step # %d", step);
620 Bool_t left = (step % 2) == 1;
621 TVirtualPad* p = can->cd(step);
622 gStyle->SetOptTitle(0);
623 p->SetTitle(Form("Step # %d", step));
624 p->SetFillColor(kWhite);
625 p->SetRightMargin(left ? 0 : 0.02);
626 p->SetTopMargin(0); // 0.02);
627
628 p->cd();
629 all->Draw("nostack");
630 all->GetHistogram()->SetXTitle("#eta");
631 all->GetHistogram()->SetYTitle("signal");
632
633 // p->cd();
634 gROOT->SetSelectedPad(p);
635 cur->DrawClone("same nostack");
636 leg->DrawClone("");
637
638 TLatex* ltx = new TLatex(.97, .97, title);
639 ltx->SetNDC();
640 ltx->SetTextSize(.06);
641 ltx->SetTextAlign(33);
642 ltx->Draw();
643
644 ltx = new TLatex((left ? .12 : .02), .97, p->GetTitle());
645 ltx->SetNDC();
646 ltx->SetTextSize(.06);
647 ltx->SetTextAlign(13);
648 ltx->Draw();
649
650 p->Modified();
651 p->Update();
652 p->cd();
079fd669 653
654 gStyle->SetOptTitle(1);
2955f67c 655 }
656
657 //____________________________________________________________________
658 void FixStack(THStack* stack, const TString& title,
659 const TString& extra, Int_t marker)
660 {
661 if (!stack) return;
662 stack->SetTitle(title);
663 TIter next(stack->GetHists());
664 TH1* h = 0;
665 while ((h = static_cast<TH1*>(next()))) {
666 h->SetMarkerStyle(marker);
667 TString tit(h->GetTitle());
668 tit.ReplaceAll("cache", "");
669 tit.Append(extra);
670 h->SetTitle(tit);
671 }
672 }
8449e3e0 673 void AddLegendEntry(TLegend* l,
674 const TH1* h,
675 const TString& title)
676 {
677 if (!h) return;
678
679 TLegendEntry* e = l->AddEntry("dummy", title.Data(), "pl");
680 e->SetMarkerStyle(h->GetMarkerStyle());
681 e->SetMarkerColor(kGray);
682 e->SetLineColor(kGray);
683 e->SetTextColor(kGray);
684 }
685
686
2955f67c 687 //____________________________________________________________________
688 void DrawSteps()
689 {
690 // MakeChapter(can, "Steps");
691
692 THStack* deltas = GetStack(GetCollection(fResults, "fmdSharingFilter"),
693 "sums", "summed");
694 THStack* nchs = GetStack(GetCollection(fResults,
695 "fmdDensityCalculator"),
696 "sums", "inclDensity");
697 THStack* prims = GetStack(GetCollection(fResults, "fmdCorrector"),
698 "sums", "primaryDensity");
699 THStack* rings = GetStack(GetCollection(fResults, "ringResults"), "all");
700 THStack* mcRings = GetStack(GetCollection(fResults, "mcRingResults", false),
701 "all","dndeta_eta", false);
702 TH1* dndeta = GetH1(fResults, "dNdeta");
8449e3e0 703 if (dndeta) dndeta->SetMarkerColor(kBlack);
2955f67c 704
705 FixStack(deltas, "#sum_{} #Delta/#Delta_{mip}", "", 20);
706 FixStack(nchs, "#sum_{} N_{ch,incl}", "", 21);
707 FixStack(prims, "#sum_{} N_{ch,primary}", "", 22);
708 FixStack(rings, "dN/d#eta per ring", "", 23);
709 FixStack(mcRings,"dN/d#eta per ring (MC)", "(MC)", 34);
710
711 THStack* all = new THStack;
712 AddToAll(all, mcRings);
713 AddToAll(all, deltas);
714 AddToAll(all, nchs);
715 AddToAll(all, prims);
716 AddToAll(all, rings);
717
8449e3e0 718 TH1* res = 0;
719 if (dndeta) {
720 res = static_cast<TH1*>(dndeta->Clone("dNdeta"));
721 res->SetTitle("dN/d#eta");
722 res->SetMarkerColor(kGray);
723 res->SetLineColor(kGray);
724 res->SetDirectory(0);
725 all->Add(res);
726 }
2955f67c 727
728 TLegend* l = new TLegend(.35, .2, .55, .9);
729 l->SetFillColor(kWhite);
730 l->SetFillStyle(0);
731 l->SetBorderSize(0);
732 TLegendEntry* e = 0;
733
734 TH1* h = 0;
735 if (mcRings) {
736 h = static_cast<TH1*>(mcRings->GetHists()->At(0));
8449e3e0 737 AddLegendEntry(l, h, mcRings->GetTitle());
2955f67c 738 }
739
8449e3e0 740 if (deltas) {
741 h = static_cast<TH1*>(deltas->GetHists()->At(0));
742 AddLegendEntry(l, h, deltas->GetTitle());
743 }
744
745 if (nchs) {
746 h = static_cast<TH1*>(nchs->GetHists()->At(0));
747 AddLegendEntry(l, h, nchs->GetTitle());
748 }
749
750 if (prims) {
751 h = static_cast<TH1*>(prims->GetHists()->At(0));
752 AddLegendEntry(l, h, prims->GetTitle());
753 }
754
755 if (rings) {
756 h = static_cast<TH1*>(rings->GetHists()->At(0));
757 AddLegendEntry(l, h, rings->GetTitle());
758 }
759
760 if (res) {
761 h = res;
762 AddLegendEntry(l, h, h->GetTitle());
763 }
2955f67c 764
765 TObject* objs[] = { mcRings,
766 deltas,
767 nchs,
768 prims,
769 rings,
770 dndeta };
771 const char* titles[] = { "MC",
772 "After merging",
773 "After particle counting",
774 "After corrections",
775 "After normalization",
776 "After combining" };
777
778 fBody->Divide(2, 3, 0, 0); // mcRings ? 4 : 3, 0, 0);
779 Int_t step = 0;
780 for (Int_t i = 0; i < 6; i++) {
781 TObject* obj = objs[i];
782 if (!obj) continue;
783 e = static_cast<TLegendEntry*>(l->GetListOfPrimitives()->At(step));
784 e->SetMarkerColor(kBlack);
785 e->SetLineColor(kBlack);
786 e->SetTextColor(kBlack);
787 step++;
788
789 DrawStep(step, all, obj, l, titles[i], fBody);
790 e->SetMarkerColor(kGray);
791 e->SetLineColor(kGray);
792 e->SetTextColor(kGray);
793 }
794
8449e3e0 795 if (!mcRings && deltas) {
2955f67c 796 fBody->cd(6);
797 TLegend* ll = new TLegend(0.01, 0.11, 0.99, 0.99);
798 // ll->SetNDC();
799 ll->SetFillColor(kWhite);
800 ll->SetFillStyle(0);
801 ll->SetBorderSize(0);
802
803 TIter next(deltas->GetHists());
804 TH1* hh = 0;
805 while ((hh = static_cast<TH1*>(next()))) {
806 e = ll->AddEntry("dummy", hh->GetTitle(), "pl");
807 e->SetMarkerColor(hh->GetMarkerColor());
808 e->SetMarkerStyle(hh->GetMarkerStyle());
809 e->SetLineColor(kBlack);
810 }
811 ll->Draw();
812 }
813 PrintCanvas("Steps");
814 }
815
816
817 //____________________________________________________________________
818 void DrawResults()
819 {
820 // MakeChapter(can, "Results");
821
822 fBody->Divide(2,2);
823
824 TCollection* c = GetCollection(fResults, "ringResults");
825 if (!c) return;
826
827 THStack* mcRings = GetStack(GetCollection(fResults, "mcRingResults", false),
828 "all", "dndeta_eta", false);
829
830 TH1* dndeta_phi = GetH1(fResults, "dNdeta");
831 TH1* dndeta_eta = GetH1(fResults, "dNdeta_");
832 dndeta_phi->SetTitle("1/N_{ev}dN_{ch}/d#eta (#varphi norm)");
833 dndeta_eta->SetTitle("1/N_{ev}dN_{ch}/d#eta (#eta norm)");
834 dndeta_eta->SetMarkerSize(0.7);
835
bfab35d9 836 THStack* allPhi = new THStack("phiAcc", "#varphi Acceptance");
837 THStack* allEta = new THStack("etaCov", "#eta Coverage");
838 const char* rings[] = { "FMD1I", "FMD2I", "FMD2O", "FMD3I", "FMD3O", 0 };
839 const char** pring = rings;
840
841 while ((*pring)) {
842 TCollection* cc = GetCollection(c, *pring);
843 TH1* etaCov = GetH1(cc, "etaCov");
844 TH1* phiAcc = GetH1(cc, "phiAcc");
845 TH1* dndeta = GetH1(cc, "dndeta_phi");
846 Int_t color = kBlack;
847 if (dndeta) color = dndeta->GetMarkerColor();
848 if (etaCov) {
849 etaCov->SetTitle(*pring);
850 etaCov->SetFillColor(color);
851 etaCov->SetLineColor(color);
852 allEta->Add(etaCov);
853 }
854 if (phiAcc) {
855 phiAcc->SetFillColor(color);
856 phiAcc->SetLineColor(color);
857 allPhi->Add(phiAcc);
858 }
859 pring++;
860 }
079fd669 861 DrawInPad(fBody, 1, GetStack(c, "all"), "nostack", mcRings ? 0 : 0x10,
862 "Individual ring results");
863 DrawInPad(fBody, 1, mcRings, "nostack same", 0x10);
864 DrawInPad(fBody, 2, dndeta_phi,
865 "1/#it{N}_{ev} d#it{N}_{ch}/d#it{#eta}");
2955f67c 866 DrawInPad(fBody, 2, dndeta_eta, "Same", 0x10);
079fd669 867 DrawInPad(fBody, 3, allEta, "nostack hist", 0x10,
868 "#phi acceptance and #eta coverage per ring");
bfab35d9 869 DrawInPad(fBody, 3, allPhi, "nostack hist same", 0x0);
079fd669 870 DrawInPad(fBody, 4, GetH1(fResults, "norm"), "", 0x0,
871 "Total #phi acceptance and #eta coverage");
bfab35d9 872 DrawInPad(fBody, 4, GetH1(fResults, "phi"), "same", 0x10);
873 // DrawInPad(fBody, 4, GetH1(fSums, "d2Ndetadphi"), "colz");
2955f67c 874
079fd669 875 // fBody->cd(1);
876 // TLatex* l = new TLatex(.5, .2, "Ring results");
877 // l->SetNDC();
878 // l->SetTextAlign(21);
879 // l->Draw();
2955f67c 880
079fd669 881 // fBody->cd(2);
882 // l->DrawLatex(.5, .2, "1/N_{ev}dN_{ch}/d#eta");
2955f67c 883
884 // fBody->cd(3);
885 // l->DrawLatex(.5, .2, "1/N_{ev}dN_{ch}/d#eta (#vta norm.)");
886
887 PrintCanvas("Results");
888 }
889
bfab35d9 890 //____________________________________________________________________
891 void DrawCentralResults()
892 {
893 // MakeChapter(can, "Results");
894 Info("DrawCentralResults", "Drawing central results");
895
896 fBody->Divide(1,2,0,0);
897
898 TH1* dndeta_ = GetH1(fResults, "dNdeta_");
899 TH1* dndeta = GetH1(fResults, "dNdeta");
900 THStack* stack = new THStack("dndetas",
901 "d#it{N}_{ch}/d#it{#eta} - central");
902 stack->Add(dndeta_);
903 stack->Add(dndeta);
904
905 DrawInPad(fBody, 1, stack, "nostack");
906 stack->GetHistogram()->SetXTitle("#it{#eta}");
907 stack->GetHistogram()->SetYTitle("#frac{d#it{N}_{ch}}{d#it{#eta}}");
908 fBody->cd(1);
909 TLegend* l = new TLegend(.3, .05, .7, .4);
910 l->SetFillColor(0);
911 l->SetFillStyle(0);
912 l->SetBorderSize(0);
913 l->AddEntry(dndeta_, "Normalized to coverage", "lp");
914 l->AddEntry(dndeta, "Normalized to #phi acceptance", "lp");
915 l->Draw();
916
917 DrawInPad(fBody, 2, GetH1(fResults, "norm"));
918 DrawInPad(fBody, 2, GetH1(fResults, "phi"), "same", kLegend);
919
920 PrintCanvas("Central Results");
921
922 }
923 void DrawBoth(TFile* file)
924 {
925 Info("DrawBoth", "Drawing central & forward results");
926 TCollection* central = GetCollection(file, "CentralResults");
927 TCollection* forward = GetCollection(file, "ForwardResults");
928
929 if (!central || !forward) {
930 Warning("DrawBoth", "central %p or forward %p results not found",
931 central, forward);
932 return;
933 }
934
935 TH1* f1 = GetH1(forward, "dNdeta_");
936 TH1* c1 = GetH1(central, "dNdeta_");
937 TH1* f2 = GetH1(forward, "dNdeta");
938 TH1* c2 = GetH1(central, "dNdeta");
939 f1->SetLineColor(kBlack);
940 f2->SetLineColor(kBlack);
941 c1->SetLineColor(kBlack);
942 c2->SetLineColor(kBlack);
943 f1->SetMarkerColor(f2->GetMarkerColor());
944 f1->SetMarkerStyle(24);
945 c1->SetMarkerStyle(24);
946 c2->SetMarkerStyle(20);
947 c2->SetMarkerColor(c1->GetMarkerColor());
948 THStack* s = new THStack("dndetas", "d#it{N}_{ch}/d#it{#eta}");
949 s->Add(f1);
950 s->Add(c1);
951 s->Add(f2);
952 s->Add(c2);
953
954 fBody->Divide(1, 2, 0, 0);
955 DrawInPad(fBody, 1, s, "nostack");
956 s->GetHistogram()->SetXTitle("#it{#eta}");
957 s->GetHistogram()->SetYTitle("#frac{d#it{N}_{ch}}{d#it{#eta}}");
958
959 fBody->cd(1);
960 TLegend* l = new TLegend(.4, .05, .8, .4);
961 l->SetFillColor(0);
962 l->SetFillStyle(0);
963 l->SetBorderSize(0);
964 TLegendEntry* entry = l->AddEntry("dummy", "Forward", "f");
965 entry->SetFillColor(f1->GetMarkerColor());
966 entry->SetLineColor(f1->GetMarkerColor());
967 entry->SetFillStyle(1001);
968 entry->SetLineWidth(0);
969 entry = l->AddEntry("dummy", "Central", "f");
970 entry->SetFillColor(c1->GetMarkerColor());
971 entry->SetLineColor(c1->GetMarkerColor());
972 entry->SetLineWidth(0);
973 entry->SetFillStyle(1001);
974 entry = l->AddEntry("dummy", "Normalized to coverage", "lp");
975 entry->SetMarkerStyle(f1->GetMarkerStyle());
976 entry = l->AddEntry("dummy", "Normalized to #phi acceptance", "lp");
977 entry->SetMarkerStyle(f2->GetMarkerStyle());
978 l->Draw();
979
980 TH1* f3 = GetH1(forward, "norm");
981 TH1* c3 = GetH1(central, "norm");
982 TH1* f4 = GetH1(forward, "phi");
983 TH1* c4 = GetH1(central, "phi");
984 f3->SetFillColor(f1->GetMarkerColor());
985 f4->SetFillColor(f1->GetMarkerColor());
986 c3->SetFillColor(c1->GetMarkerColor());
987 c4->SetFillColor(c1->GetMarkerColor());
988 f3->SetLineColor(f1->GetMarkerColor());
989 f4->SetLineColor(f1->GetMarkerColor());
990 c3->SetLineColor(c1->GetMarkerColor());
991 c4->SetLineColor(c1->GetMarkerColor());
992
993 THStack* a = new THStack("norms", "Normalizations");
994 a->Add(f3);
995 a->Add(c3);
996 a->Add(f4);
997 a->Add(c4);
998
999 a->SetMaximum(a->GetMaximum("nostack")*1.2);
1000 DrawInPad(fBody, 2, a, "nostack");
1001 a->GetHistogram()->SetXTitle("#it{#eta}");
1002 a->GetHistogram()->SetYTitle("Normalization (coverage or acceptance)");
1003
1004 fBody->cd(2);
1005 l = new TLegend(.2, .94, .9, .99);
1006 l->SetFillColor(0);
1007 l->SetFillStyle(0);
1008 l->SetBorderSize(0);
1009 l->SetNColumns(2);
1010 // entry = l->AddEntry("dummy", "Forward", "f");
1011 // entry->SetFillColor(f1->GetMarkerColor());
1012 // entry->SetLineColor(f1->GetMarkerColor());
1013 // entry->SetFillStyle(1001);
1014 // entry->SetLineWidth(0);
1015 // entry = l->AddEntry("dummy", "Central", "f");
1016 // entry->SetFillColor(c1->GetMarkerColor());
1017 // entry->SetLineColor(c1->GetMarkerColor());
1018 // entry->SetLineWidth(0);
1019 // entry->SetFillStyle(1001);
1020 entry = l->AddEntry("dummy", "#eta Coverage", "f");
1021 entry->SetFillStyle(f3->GetFillStyle());
1022 entry->SetFillColor(kBlack);
1023 entry = l->AddEntry("dummy", "#phi Acceptance", "f");
1024 entry->SetFillStyle(f4->GetFillStyle());
1025 entry->SetFillColor(kBlack);
1026 l->Draw();
1027
1028 PrintCanvas("Both results");
1029 }
2955f67c 1030 TCollection* fSums;
1031 TCollection* fResults;
1032};
1033
1034// #endif