1 #include "SummaryDrawer.C"
4 # include <TGraphErrors.h>
12 * Class to draw a summary of the AOD production
15 * - The merged <tt>forward.root</tt> file.
16 * If the file isn't merged, it should still work.
19 * - A PDF file named after the input, but with <tt>.root</tt>
20 * replaced with <tt>pdf</tt>
23 class SummaryAODDrawer : public SummaryDrawer
27 kEventInspector = 0x001,
28 kSharingFilter = 0x002,
29 kDensityCalculator = 0x004,
31 kHistCollector = 0x010,
43 //__________________________________________________________________
50 void Run(const char* fname, UShort_t what=kNormal)
52 // --- Open the file ---------------------------------------------
53 TString filename(fname);
54 TFile* file = TFile::Open(filename, "READ");
56 Error("Run", "Failed to open \"%s\"", filename.Data());
61 // --- Get top-level collection ----------------------------------
62 fSums = GetCollection(file, "ForwardSums");
64 Info("Run", "Trying old name Forward");
65 fSums = GetCollection(file, "Forward");
69 // --- Do the results ----------------------------------------------
70 fResults = GetCollection(file, "ForwardResults");
71 if (!fResults) fResults = fSums; // Old-style
73 // --- Make our canvas -------------------------------------------
74 TString pdfName(filename);
75 pdfName.ReplaceAll(".root", ".pdf");
76 CreateCanvas(pdfName, what & kLandscape);
79 // --- Possibly make a chapter here ------------------------------
80 TCollection* centralSums = GetCollection(file, "CentralSums", false);
82 Info("Run", "Trying old name \"Central\"");
83 centralSums = GetCollection(file, "Central", false);
85 if (what & kCentral && centralSums)
86 MakeChapter("Forward");
88 // --- Set pause flag --------------------------------------------
89 fPause = what & kPause;
91 // --- Do each sub-algorithm -------------------------------------
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();
99 if (what & kSteps) DrawSteps();
100 if (what & kResults) DrawResults();
102 // --- SPD clusters ----------------------------------------------
103 if (what & kCentral) {
104 // --- Get top-level collection --------------------------------
105 fSums = GetCollection(file, "CentralSums");
107 fSums = GetCollection(file, "Central");
109 MakeChapter("Central");
111 if (what & kEventInspector) DrawEventInspector(fSums);
113 fResults = GetCollection(file, "CentralResults");
114 if (fResults && (what & kResults)) {
115 DrawCentralResults();
118 if (what & kResults) DrawBoth(file);
125 //____________________________________________________________________
126 void DrawTitlePage(TFile* f)
130 TLatex* ltx = new TLatex(.5, .7, "ESD #rightarrow AOD filtering");
132 ltx->SetTextSize(0.07);
133 ltx->SetTextAlign(22);
136 TCollection* fwd = fSums; // GetCollection(f, "ForwardSums");
137 TCollection* cen = GetCollection(f, "CentralSums");
140 Double_t save = fParName->GetTextSize();
141 fParName->SetTextSize(0.03);
142 fParVal->SetTextSize(0.03);
144 DrawParameter(y, "Tasks", (fwd ? "Forward" : ""));
145 DrawParameter(y, "", (cen ? "Central" : ""));
148 TCollection* ei = GetCollection(fwd, "fmdEventInspector");
151 UShort_t sys=0, sNN=0;
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;
161 TString sysString; SysString(sys, sysString);
162 TString sNNString; SNNString(sNN, sNNString);
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));
168 DrawParameter(y, "Simulation", (mc ? "yes" : "no"));
171 PrintCanvas("Title page");
172 fParName->SetTextSize(save);
173 fParVal->SetTextSize(save);
175 TGraph* CreateCutGraph(Int_t method, Int_t iy, TH2* cuts, TH1* eloss,
178 TGraph* ret = new TGraph(4);
179 Double_t y0 = TMath::Max(eloss->GetMinimum(),1.);
180 Double_t y1 = eloss->GetMaximum();
183 if (method == 0) { // Fixed value
184 max = cuts->GetBinContent(1, iy);
185 min = eloss->GetXaxis()->GetXmin();
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);
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());
210 //____________________________________________________________________
211 void DrawSharingFilter()
213 Info("DrawSharingFilter", "Drawing sharing filter");
214 TCollection* c = GetCollection(fSums, "fmdSharingFilter");
216 TCollection* rc = GetCollection(fResults, "fmdSharingFilter");
219 fBody->Divide(1, 3, 0, 0);
223 Bool_t angle=false, lowSignal=false, simple=false;
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"));
230 if (GetParameter(c, "simple", simple))
231 DrawParameter(y, "Simple method", (simple ? "yes" : "no"));
232 TParameter<int>* nFiles =
233 static_cast<TParameter<int>*>(GetObject(c, "nFiles"));
235 DrawParameter(y, "# files merged", Form("%d", nFiles->GetVal()));
238 TCollection* lc = GetCollection(c, "lCuts");
239 TCollection* hc = GetCollection(c, "hCuts");
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" :
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" :
255 TH2* hLow = GetH2(c, "lowCuts");
256 TH2* hHigh = GetH2(c, "highCuts");
257 // if (hLow && nFiles) hLow->Scale(1. / nFiles->GetVal());
258 // if (hHigh && nFiles) hHigh->Scale(1. / nFiles->GetVal());
259 DrawInPad(fBody, 2, hLow, "colz");
260 DrawInPad(fBody, 3, hHigh, "colz");
262 PrintCanvas("Sharing filter");
264 Double_t savX = fParVal->GetX();
265 Double_t savY = fParVal->GetY();
268 const char* subs[] = { "FMD1I", "FMD2I", "FMD2O", "FMD3O", "FMD3I", 0 };
269 const char** ptr = subs;
272 TCollection* sc = GetCollection(c, *ptr);
273 if (!sc) { ptr++; iq++; continue; }
275 if (fLandscape) fBody->Divide(3, 2);
276 else fBody->Divide(2,3);
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);
283 DrawInPad(fBody, 1, esdELoss, "", kLogy,
284 "#Delta/#Delta_{mip} reconstructed and merged");
285 DrawInPad(fBody, 1, GetH1(sc, "anaEloss"), "same");
286 DrawInPad(fBody, 1, lowCut, "lf same");
287 DrawInPad(fBody, 1, highCut, "lf same", kLogy|kLegend);
289 DrawInPad(fBody, 2, GetH1(sc, "singleEloss"), "", kLogy,
290 "#Delta/#Delta_{mip} for single, double, and tripple hits");
291 DrawInPad(fBody, 2, GetH1(sc, "doubleEloss"), "same", kLogy);
292 DrawInPad(fBody, 2, GetH1(sc, "tripleEloss"), "same", kLogy|kLegend);
294 DrawInPad(fBody, 3, GetH2(sc, "singlePerStrip"), "colz", kLogz);
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);
299 TH2* nB = GetH2(sc, "neighborsBefore");
301 nB->GetXaxis()->SetRangeUser(0,8);
302 nB->GetYaxis()->SetRangeUser(0,8);
304 DrawInPad(fBody, 5, nB, "colz", kLogz);
305 DrawInPad(fBody, 5, GetH2(sc, "neighborsAfter"), "p same", kLogz,
306 "Correlation of neighbors before and after merging");
307 DrawInPad(fBody, 6, GetH2(sc, "beforeAfter"), "colz", kLogz);
309 PrintCanvas(Form("Sharing filter - %s", *ptr));
316 // --- MC --------------------------------------------------------
317 TCollection* cc = GetCollection(c, "esd_mc_comparion", false); // Spelling!
318 if (!cc) return; // Not MC
320 DivideForRings(false, false);
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);
327 PrintCanvas("Sharing filter - MC vs Reco");
329 // --- MC --------------------------------------------------------
333 void ShowSliceFit(Bool_t inY, TH2* h, Double_t nVar,
334 TVirtualPad* p, Int_t sub, UShort_t flags=0,
339 TObjArray* fits = new TObjArray;
341 if (inY) h->FitSlicesY(0, 1, -1, 10, "QN", fits);
342 else h->FitSlicesX(0, 1, -1, 10, "QN", fits);
344 Warning("ShowSliceFit", "No fits returned");
347 TH1* mean = static_cast<TH1*>(fits->At(1));
348 TH1* var = static_cast<TH1*>(fits->At(2));
350 Warning("ShowSliceFit", "Didn't get histograms");
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");
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);
376 up ->SetLineColor(kBlack);
377 up ->SetLineWidth(2);
378 up ->SetLineStyle(2);
381 low->SetLineColor(kBlack);
382 low->SetLineWidth(2);
383 low->SetLineStyle(2);
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);
394 if (up) up ->SetPoint(i-1,x,x+cut*x);
395 if (low) low->SetPoint(i-1,x,x-cut*x);
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);
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) = "
409 yTit.Data(), xTit.Data(),
410 fmean->GetParameter(0),
411 fmean->GetParameter(1), xTit.Data()));
414 l->SetTextSize(0.04);
417 l->DrawLatex(0.15, y-0.07,
418 Form("#sigma_{%s}(%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",
425 flags & 0x8000 ? "log_{10}(#sigma)" : ""));
429 //____________________________________________________________________
430 void DrawDensityCalculator()
432 Info("DrawDensityCalculator", "Drawing density calculator");
433 TCollection* c = GetCollection(fSums, "fmdDensityCalculator");
440 Int_t maxParticles=0, phiAcceptance=0, etaLumping=0, phiLumping=0;
441 Bool_t method=false, recalcEta=false, recalcPhi=false;
442 Double_t maxOutliers=0, outlierCut=0;
443 Double_t size = fLandscape ? 0.06 : 0.04;
445 GetParameter(c, "maxParticle", maxParticles);
447 if (GetParameter(c, "phiAcceptance", phiAcceptance))
448 DrawParameter(y, "#phi acceptance method",
449 (phiAcceptance == 1 ? "N_{ch}" :
450 phiAcceptance == 2 ? "#DeltaE" : "none"), size);
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);
455 if (GetParameter(c, "method", method))
456 DrawParameter(y, "Method", (method ? "Poisson" : "#DeltaE"), size);
457 if (GetParameter(c, "recalcEta", recalcEta))
458 DrawParameter(y, "Recalculate #eta",(recalcEta ? "yes" : "no"),size);
459 if (GetParameter(c, "recalcPhi", recalcPhi))
460 DrawParameter(y, "Recalculate #phi",(recalcPhi ? "yes" : "no"),size);
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);
468 TParameter<int>* nFiles =
469 static_cast<TParameter<int>*>(GetObject(c, "nFiles"));
471 DrawParameter(y, "# files merged", Form("%d", nFiles->GetVal()), size);
473 TCollection* lc = GetCollection(c, "lCuts");
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" :
483 TVirtualPad* p = fBody; // fBody->cd(2);
486 TH1* accI = GetH1(c, "accI");
487 TH1* accO = GetH1(c, "accO");
489 Double_t scale = 1./accI->GetMaximum();
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());
498 DrawInPad(p, 2, accI);
499 DrawInPad(p, 2, accO, "same", kLegend);
500 DrawInPad(p, 3, lCuts, "colz");
501 DrawInPad(p, 4, maxW, "colz");
503 PrintCanvas("Density calculator");
505 const char* subs[] = { "FMD1I", "FMD2I", "FMD2O", "FMD3O", "FMD3I", 0 };
506 const char** ptr = subs;
508 TCollection* sc = GetCollection(c, *ptr);
509 if (!sc) { ptr++; continue; }
511 if (fLandscape) fBody->Divide(3,2);
512 else fBody->Divide(2,3);
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);
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,
530 "#Delta/#Delta_{mip} before and after cuts");
531 DrawInPad(fBody, 4, elossUsed, "same", kLogy|kLegend);
532 TH1* phiB = GetH1(sc, "phiBefore");
533 TH1* phiA = GetH1(sc, "phiAfter");
534 TH1* outliers = GetH1(sc, "outliers");
536 DrawInPad(fBody, 5, outliers, "hist", kLogy);
537 else if (phiB && phiA) {
540 phiA->SetTitle("#Delta#phi from Ip (x,y) correction");
541 phiA->SetYTitle("(#phi_{after}-#phi_{before})/#phi_{before}");
542 DrawInPad(fBody, 5, phiA);
546 TLatex* ltx = new TLatex(0.5, 0.5, "No outliers or #phi corrections");
547 ltx->SetTextAlign(22);
548 ltx->SetTextSize(0.07);
552 DrawInPad(fBody, 6, GetH2(sc, "phiAcc"), "colz", kLogz);
554 ShowSliceFit(true, corr, 10, fBody, 1, kLogz, outlierCut);
556 if (diff && diffOut) {
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)));
563 ltx->SetTextAlign(13);
564 ltx->SetTextSize(0.06);
567 PrintCanvas(Form("Density calculator - %s", *ptr));
571 TCollection* cc = GetCollection(c, "esd_mc_comparison", false);
572 if (!cc) return; // Not MC
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);
586 PrintCanvas("Density calculator - MC vs Reco");
589 //____________________________________________________________________
592 Info("DrawCorrector", "Drawing corrector");
593 TCollection* c = GetCollection(fSums, "fmdCorrector");
599 Bool_t secondary=false, vertexBias=false, acceptance=false, merging=false;
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");
609 PrintCanvas("Corrector");
611 TCollection* cc = GetCollection(c, "esd_mc_comparison", false);
612 if (!cc) return; // Not MC
614 DivideForRings(false, false);
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);
622 PrintCanvas("Corrector - MC vs Reco");
625 //____________________________________________________________________
626 void DrawHistCollector()
628 Info("DrawHistCollector", "Drawing histogram collector");
629 TCollection* c = GetCollection(fSums, "fmdHistCollector");
633 TVirtualPad* p = fBody->cd(1);
638 Int_t nCutBins=0, fiducial=0, merge=0, skipRings=0;
639 Double_t fiducialCut=0.;
640 Bool_t bgAndHits=false;
641 Double_t size = fLandscape ? 0.06 : 0.04;
642 if (GetParameter(c, "nCutBins", nCutBins))
643 DrawParameter(y, "# of bins to cut", Form("%d", nCutBins),size);
645 if (GetParameter(c, "skipRings", skipRings)) {
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 ");
652 if (skipped.IsNull()) skipped = "none";
653 DrawParameter(y, "Skipped rings", skipped, size);
655 if (GetParameter(c, "bgAndHits", bgAndHits))
656 DrawParameter(y, "Bg & hit maps stored.", bgAndHits?"yes":"no",size);
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" :
663 merge == 4 ? "sum" : "unknown"),size);
664 if (GetParameter(c, "fiducial", fiducial))
665 DrawParameter(y, "Fiducial method.",
666 fiducial == 0 ? "cut" : "distance", size);
667 if (GetParameter(c, "fiducialCut", fiducialCut))
668 DrawParameter(y, "Fiducial cut.", Form("%f", fiducialCut), size);
671 Printf("Drawing skipped");
672 TH1* skipped = GetH1(c, "skipped");
674 skipped->SetFillColor(kRed+1);
675 skipped->SetFillStyle(3001);
677 DrawInPad(p, 2, skipped, "hist");
682 Printf("Drawing sumRings");
683 DrawInPad(p, 1, GetH2(c, "sumRings"), "colz");
684 Printf("Drawing coverage");
685 DrawInPad(p, 2, GetH2(c, "coverage"), "colz");
686 Printf("Done drawing for now");
687 PrintCanvas("Histogram collector");
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;
697 TList* vl = static_cast<TList*>(o);
700 DivideForRings(false, false);
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);
713 PrintCanvas(Form("Histogram Collector - Vertex bin %s", vl->GetName()));
716 o = c->FindObject("byCentrality");
718 TList* bc = static_cast<TList*>(o);
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);
724 DrawInPad(fBody, GetH3(bc, "FMD3I"), "box same", kLegend);
727 //____________________________________________________________________
730 Info("DrawCentral", "Drawing central (SPD)");
731 TCollection* c = fSums;
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");
744 DrawInPad(fBody, 2, GetH2(c, "coverage"), "col", 0,
745 "#eta coverage per v_{z}");
746 TH2* cvst = GetH2(c, "nClusterVsnTracklet");
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);
754 DrawInPad(fBody, 3, cvst, "colz", kLogx|kLogy|kLogz,
755 "Correlation of # of tracklets and clusters");
756 DrawInPad(fBody, 4, GetH2(c, "clusterPerTracklet"), "colz", 0x0,
757 "# clusters per tracklet vs #eta");
758 ShowSliceFit(true, cvst, 3, fBody, 3, 0x8000|kLogz);
760 fBody->cd(1)->Modified();
761 fBody->cd(2)->Modified();
762 fBody->cd(3)->Modified();
763 fBody->cd(4)->Modified();
764 fBody->cd(1)->Update();
765 fBody->cd(2)->Update();
766 fBody->cd(3)->Update();
767 fBody->cd(4)->Update();
768 PrintCanvas("Central - overview");
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;
778 TList* vl = static_cast<TList*>(o);
782 DrawInPad(fBody, 1, GetH1(vl, "acceptance"), "", 0);
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);
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()));
803 //____________________________________________________________________
804 void AddToAll(THStack* all, const THStack* stack, Int_t curr, Int_t step)
808 TIter next(stack->GetHists());
810 while ((h = static_cast<TH1*>(next()))) {
811 TH1* copy = static_cast<TH1*>(h->Clone(Form("%s_copy", h->GetName())));
812 copy->SetDirectory(0);
814 copy->SetMarkerColor(kGray);
815 copy->SetLineColor(kGray);
820 //____________________________________________________________________
821 void AddToAll(THStack* all, const THStack* stack)
825 TIter next(stack->GetHists());
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);
836 //____________________________________________________________________
837 void DrawStep(Int_t step,
846 if (all->GetHists()->GetEntries() <= 0 || !cur) return;
848 // Info("", "Drawing step # %d", step);
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);
853 gStyle->SetOptTitle(0);
854 p->SetTitle(Form("Step # %d", step));
855 p->SetFillColor(kWhite);
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"));
862 all->Draw("nostack");
863 all->GetHistogram()->SetXTitle("#eta");
864 all->GetHistogram()->SetYTitle("signal");
867 static_cast<TLegendEntry*>(leg->GetListOfPrimitives()->At(step-1));
868 e->SetMarkerColor(kBlack);
869 e->SetLineColor(kBlack);
870 e->SetTextColor(kBlack);
874 gROOT->SetSelectedPad(p);
875 cur->DrawClone("same nostack");
878 TLatex* ltx = new TLatex(.97, .97, title);
880 ltx->SetTextSize(.06);
881 ltx->SetTextAlign(33);
884 ltx = new TLatex((left ? .12 : .02), .97, p->GetTitle());
886 ltx->SetTextSize(.06);
887 ltx->SetTextAlign(13);
891 Double_t x1 = 0.5*(p->GetUxmax()+p->GetUxmin());
893 Double_t y1 = p->GetUymax();
894 Double_t y2 = 0.92*y1;
897 x1 = 0.99*p->GetUxmin();
899 y1 = .5*(p->GetUymax()+p->GetUymin());
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);
914 e->SetMarkerColor(kGray);
915 e->SetLineColor(kGray);
916 e->SetTextColor(kGray);
918 gStyle->SetOptTitle(1);
921 //____________________________________________________________________
922 void FixStack(THStack* stack, const TString& title,
923 const TString& extra, Int_t marker)
926 stack->SetTitle(title);
927 TIter next(stack->GetHists());
929 while ((h = static_cast<TH1*>(next()))) {
930 h->SetMarkerStyle(marker);
931 TString tit(h->GetTitle());
932 tit.ReplaceAll("cache", "");
937 void AddLegendEntry(TLegend* l,
939 const TString& title)
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);
951 //____________________________________________________________________
954 // MakeChapter(can, "Steps");
956 THStack* esds = GetStack(GetCollection(fResults, "fmdSharingFilter"),
957 "sumsESD", "summedESD");
958 THStack* deltas = GetStack(GetCollection(fResults, "fmdSharingFilter"),
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");
969 if (dndeta) dndeta->SetMarkerColor(kBlack);
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);
976 FixStack(mcRings,"dN/d#eta per ring (MC)", "(MC)", 34);
978 THStack* all = new THStack;
979 AddToAll(all, mcRings);
981 AddToAll(all, deltas);
983 AddToAll(all, prims);
984 AddToAll(all, rings);
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);
996 TLegend* l = new TLegend(.35, .2, .55, .9);
997 l->SetFillColor(kWhite);
1000 TLegendEntry* e = 0;
1004 h = static_cast<TH1*>(mcRings->GetHists()->At(0));
1005 AddLegendEntry(l, h, mcRings->GetTitle());
1009 h = static_cast<TH1*>(esds->GetHists()->At(0));
1010 AddLegendEntry(l, h, esds->GetTitle());
1014 h = static_cast<TH1*>(deltas->GetHists()->At(0));
1015 AddLegendEntry(l, h, deltas->GetTitle());
1019 h = static_cast<TH1*>(nchs->GetHists()->At(0));
1020 AddLegendEntry(l, h, nchs->GetTitle());
1024 h = static_cast<TH1*>(prims->GetHists()->At(0));
1025 AddLegendEntry(l, h, prims->GetTitle());
1029 h = static_cast<TH1*>(rings->GetHists()->At(0));
1030 AddLegendEntry(l, h, rings->GetTitle());
1035 AddLegendEntry(l, h, h->GetTitle());
1038 TObject* objs[] = { mcRings,
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;
1059 fBody->Divide(nX, nY, 0, 0);
1062 for (Int_t i = 0; i < 7; i++) {
1063 TObject* obj = objs[i];
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;
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);
1083 if (!esds && !mcRings && deltas) {
1085 TLegend* ll = new TLegend(0.01, 0.11, 0.99, 0.99);
1087 ll->SetFillColor(kWhite);
1088 ll->SetFillStyle(0);
1089 ll->SetBorderSize(0);
1091 TIter next(deltas->GetHists());
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);
1101 Printf("Done drawing steps");
1102 PrintCanvas("Steps");
1106 //____________________________________________________________________
1109 // MakeChapter(can, "Results");
1113 TCollection* c = GetCollection(fResults, "ringResults");
1116 THStack* mcRings = GetStack(GetCollection(fResults, "mcRingResults", false),
1117 "all", "dndeta_eta", false);
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);
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;
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();
1138 etaCov->SetTitle(*pring);
1139 etaCov->SetFillColor(color);
1140 etaCov->SetLineColor(color);
1141 allEta->Add(etaCov);
1144 phiAcc->SetFillColor(color);
1145 phiAcc->SetLineColor(color);
1146 allPhi->Add(phiAcc);
1150 Double_t savX = fParVal->GetX();
1151 Double_t savY = fParVal->GetY();
1154 TVirtualPad* p = fBody->cd(1);
1156 DrawInPad(p, 1, GetStack(c, "all"), "nostack", mcRings ? 0 : kLegend,
1157 "Individual ring results");
1158 DrawInPad(p, 1, mcRings, "nostack same", kLegend|kSilent);
1159 DrawInPad(p, 2, allEta, "nostack hist", kLegend,
1160 "#phi acceptance and #eta coverage per ring");
1161 DrawInPad(p, 2, allPhi, "nostack hist same", 0x0);
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,
1169 "Total #phi acceptance and #eta coverage");
1170 DrawInPad(p, 2, GetH1(fResults, "phi"), "same", kLegend);
1171 // DrawInPad(fBody, 4, GetH1(fSums, "d2Ndetadphi"), "colz");
1174 // TLatex* l = new TLatex(.5, .2, "Ring results");
1176 // l->SetTextAlign(21);
1180 // l->DrawLatex(.5, .2, "1/N_{ev}dN_{ch}/d#eta");
1183 // l->DrawLatex(.5, .2, "1/N_{ev}dN_{ch}/d#eta (#vta norm.)");
1185 fParVal->SetX(savX);
1186 fParVal->SetY(savY);
1187 PrintCanvas("Results");
1190 //____________________________________________________________________
1191 void DrawCentralResults()
1193 // MakeChapter(can, "Results");
1194 Info("DrawCentralResults", "Drawing central results");
1196 fBody->Divide(1,2,0,0);
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_);
1205 DrawInPad(fBody, 1, stack, "nostack");
1206 TH1* h = stack->GetHistogram();
1208 h->SetXTitle("#it{#eta}");
1209 h->SetYTitle("#frac{d#it{N}_{ch}}{d#it{#eta}}");
1212 TLegend* l = new TLegend(.3, .05, .7, .4);
1215 l->SetBorderSize(0);
1216 l->AddEntry(dndeta_, "Normalized to coverage", "lp");
1217 l->AddEntry(dndeta, "Normalized to #phi acceptance", "lp");
1220 DrawInPad(fBody, 2, GetH1(fResults, "norm"));
1221 DrawInPad(fBody, 2, GetH1(fResults, "phi"), "same", kLegend);
1223 PrintCanvas("Central Results");
1226 void DrawBoth(TFile* file)
1228 Info("DrawBoth", "Drawing central & forward results");
1229 TCollection* central = GetCollection(file, "CentralResults");
1230 TCollection* forward = GetCollection(file, "ForwardResults");
1232 if (!central || !forward) {
1233 Warning("DrawBoth", "central %p or forward %p results not found",
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}");
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}}");
1263 TLegend* l = new TLegend(.4, .05, .8, .4);
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());
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());
1296 THStack* a = new THStack("norms", "Normalizations");
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)");
1308 l = new TLegend(.2, .94, .9, .99);
1311 l->SetBorderSize(0);
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);
1331 PrintCanvas("Both results");
1334 TCollection* fResults;