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());
209 //____________________________________________________________________
210 const Char_t* CutMethodName(Int_t lm) const
213 case 0: return "fixed";
214 case 1: return "X#times#Delta_{p}";
215 case 2: return "Fit range";
216 case 3: return "N#times#xi";
217 case 4: return "N#times(#xi+#sigma)";
218 case 5: return "P(#Delta<c)<X";
222 //____________________________________________________________________
223 Int_t PrintCut(const TCollection* c, Double_t& y, const Char_t* name,
229 if (!GetParameter(c, "method", method)) return -1;
230 DrawParameter(y, name, CutMethodName(method), size);
233 const char* cuts[] = { "fmd1i", "fmd2i", "fmd2o", "fmd3i", "fmd3o", 0 };
234 const char** pcut = cuts;
237 GetParameter(c, *pcut, cut);
238 if (pcut != cuts) params.Append(", ");
239 params.Append(Form("%5.2f", cut));
242 DrawParameter(y, "Parameters", params, size);
245 //____________________________________________________________________
246 void DrawSharingFilter()
248 Info("DrawSharingFilter", "Drawing sharing filter");
249 TCollection* c = GetCollection(fSums, "fmdSharingFilter");
251 TCollection* rc = GetCollection(fResults, "fmdSharingFilter");
254 // --- Draw summary information ----------------------------------
255 fBody->Divide(1, 3, 0, 0);
259 Bool_t angle=false, lowSignal=false, disabled=false;
261 if (GetParameter(c, "angle", angle))
262 DrawParameter(y, "Angle correct", (angle ? "yes" : "no"));
263 if (GetParameter(c, "lowSignal", lowSignal))
264 DrawParameter(y, "Lower signal", (lowSignal ? "yes" : "no"));
265 TParameter<int>* nFiles =
266 static_cast<TParameter<int>*>(GetObject(c, "nFiles"));
268 DrawParameter(y, "# files merged", Form("%d", nFiles->GetVal()));
269 if (GetParameter(c, "disabled", disabled))
270 DrawParameter(y, "Merging disabled", (disabled ? "yes" : "no"));
277 Bool_t simple=false, three=false;
278 if (GetParameter(c, "simple", simple))
279 DrawParameter(y, "Simple method", (simple ? "yes" : "no"));
280 if (GetParameter(c, "sumThree", three))
281 DrawParameter(y, "3-strip merging", (three ? "yes" : "no"));
283 TCollection* lc = GetCollection(c, "lCuts");
284 TCollection* hc = GetCollection(c, "hCuts");
285 lm = PrintCut(lc, y, "Low cut");
286 hm = PrintCut(hc, y, "High cut");
287 hLow = GetH2(c, "lowCuts");
288 hHigh = GetH2(c, "highCuts");
289 // if (hLow && nFiles) hLow->Scale(1. / nFiles->GetVal());
290 // if (hHigh && nFiles) hHigh->Scale(1. / nFiles->GetVal());
291 DrawInPad(fBody, 2, hLow, "colz");
292 DrawInPad(fBody, 3, hHigh, "colz");
294 PrintCanvas("Sharing filter");
297 // --- Draw rings individually -----------------------------------
298 Double_t savX = fParVal->GetX();
299 Double_t savY = fParVal->GetY();
302 const char** ptr = GetRingNames(false);
305 TCollection* sc = GetCollection(c, *ptr);
306 if (!sc) { ptr++; iq++; continue; }
308 if (fLandscape) fBody->Divide(3, 2);
309 else fBody->Divide(2,3);
311 TH1* esdELoss = GetH1(sc, "esdEloss");
312 TH1* anaELoss = GetH1(sc, "anaEloss");
313 Double_t esdInt = esdELoss->Integral(0,esdELoss->GetNbinsX()+1);
314 Double_t anaInt = anaELoss->Integral(0,anaELoss->GetNbinsX()+1);
315 Double_t frac = esdInt > 0 ? (esdInt-anaInt)/esdInt : 1;
316 esdELoss->GetXaxis()->SetRangeUser(-.1, 2);
317 TGraph* lowCut = CreateCutGraph(lm, iq, hLow, esdELoss, kYellow+1);
318 TGraph* highCut = CreateCutGraph(hm, iq, hHigh, esdELoss, kCyan+1);
320 DrawInPad(fBody, 1, esdELoss, "", kLogy,
321 "#Delta/#Delta_{mip} reconstructed and merged");
322 DrawInPad(fBody, 1, anaELoss, "same");
323 DrawInPad(fBody, 1, lowCut, "lf same");
324 DrawInPad(fBody, 1, highCut, "lf same", kLogy|kLegend);
325 TVirtualPad* p = fBody->GetPad(1);
327 TLatex* l = new TLatex(1-p->GetRightMargin(),
328 0.5, Form("Loss: %5.1f%%", frac*100));
333 DrawInPad(fBody, 2, GetH1(sc, "singleEloss"), "", kLogy,
334 "#Delta/#Delta_{mip} for single, double, and tripple hits");
335 DrawInPad(fBody, 2, GetH1(sc, "doubleEloss"), "same",kLogy);
336 DrawInPad(fBody, 2, GetH1(sc, "tripleEloss"), "same",kLogy|kLegend);
338 DrawInPad(fBody, 3, GetH2(sc, "singlePerStrip"), "colz",kLogz);
339 // DrawInPad(fBody, 4, GetH1(sc, "distanceBefore"), "", 0x2);
340 // DrawInPad(fBody, 4, GetH1(sc, "distanceAfter"), "same", 0x12);
341 DrawInPad(fBody, 4, GetH2(sc, "summed"), "colz",0x0);
343 TH2* nB = GetH2(sc, "neighborsBefore");
345 nB->GetXaxis()->SetRangeUser(0,8);
346 nB->GetYaxis()->SetRangeUser(0,8);
348 DrawInPad(fBody, 5, nB, "colz", kLogz);
349 DrawInPad(fBody, 5, GetH2(sc, "neighborsAfter"), "p same", kLogz,
350 "Correlation of neighbors before and after merging");
351 DrawInPad(fBody, 6, GetH2(sc, "beforeAfter"), "colz", kLogz);
353 PrintCanvas(Form("Sharing filter - %s", *ptr));
361 // --- MC --------------------------------------------------------
362 TCollection* cc = GetCollection(c, "esd_mc_comparion", false); // Spelling!
363 if (!cc) return; // Not MC
365 DivideForRings(false, false);
366 const char** ptr = GetRingNames(false);
368 DrawInRingPad(GetH2(cc, Form("%s_corr", *ptr)), "colz", kLogz);
372 PrintCanvas("Sharing filter - MC vs Reco");
374 // --- MC --------------------------------------------------------
377 //__________________________________________________________________
379 * Draw a slice fit on a 2D histogram
381 * @param inY Whether to slice in Y
382 * @param h 2D histogram
383 * @param nVar Number of variances
384 * @param p Master pad to draw in
385 * @param sub Sub pad number
387 * @param cut Cut value
389 void ShowSliceFit(Bool_t inY, TH2* h, Double_t nVar,
390 TVirtualPad* p, Int_t sub, UShort_t flags=0,
395 TObjArray* fits = new TObjArray;
397 if (inY) h->FitSlicesY(0, 1, -1, 10, "QN", fits);
398 else h->FitSlicesX(0, 1, -1, 10, "QN", fits);
400 Warning("ShowSliceFit", "No fits returned");
403 TH1* mean = static_cast<TH1*>(fits->At(1));
404 TH1* var = static_cast<TH1*>(fits->At(2));
406 Warning("ShowSliceFit", "Didn't get histograms");
410 TF1* fmean = new TF1("mean", "pol1");
411 TF1* fvar = new TF1("var", "pol1");
412 mean->Fit(fmean, "Q0+");
413 var->Fit(fvar, "Q0+");
414 if (!fmean || !fvar) {
415 Warning("ShowSliceFit", "No functions returned");
420 TGraphErrors* g = new TGraphErrors(h->GetNbinsX());
421 g->SetName(Form("g%s", h->GetName()));
422 TString xTit = h->GetXaxis()->GetTitle();
423 TString yTit = h->GetYaxis()->GetTitle();
424 g->SetTitle(Form("Correlation of %s and %s",
425 inY ? xTit.Data() : yTit.Data(),
426 !inY ? xTit.Data() : yTit.Data()));
427 g->SetFillColor(kBlue-10);
428 g->SetFillStyle(3001);
429 TGraph* up = (cut > 0 ? new TGraph(h->GetNbinsX()) : 0);
430 TGraph* low = (cut > 0 ? new TGraph(h->GetNbinsX()) : 0);
432 up ->SetLineColor(kBlack);
433 up ->SetLineWidth(2);
434 up ->SetLineStyle(2);
437 low->SetLineColor(kBlack);
438 low->SetLineWidth(2);
439 low->SetLineStyle(2);
441 for (Int_t i = 1; i <= h->GetNbinsX(); i++) {
442 Double_t x = h->GetXaxis()->GetBinCenter(i);
443 Double_t y = fmean->Eval(x);
444 Double_t e = fvar->Eval(x);
445 Double_t ee = nVar * e;
446 if (flags & 0x8000) ee *= e > 0 ? TMath::Log10(e) : 1;
447 g->SetPoint(i-1, x, y);
448 g->SetPointError(i-1, 0, ee);
450 if (up) up ->SetPoint(i-1,x,x+cut*x);
451 if (low) low->SetPoint(i-1,x,x-cut*x);
453 DrawInPad(p, sub, g, "3", flags);
454 if (up) DrawInPad(p, sub, up, "l", flags);
455 if (low) DrawInPad(p, sub, low, "l", flags);
456 fmean->SetRange(h->GetXaxis()->GetXmin(), h->GetXaxis()->GetXmax());
457 fmean->SetLineWidth(2);
458 DrawInPad(p, sub, fmean, "same", flags);
460 TVirtualPad* pp = p->GetPad(sub);
461 Double_t y = 1-pp->GetTopMargin()-.01;
462 TLatex* l = new TLatex(.15, y,
463 Form("#LT%s#GT(%s) = "
465 yTit.Data(), xTit.Data(),
466 fmean->GetParameter(0),
467 fmean->GetParameter(1), xTit.Data()));
470 l->SetTextSize(0.04);
473 l->DrawLatex(0.15, y-0.07,
474 Form("#sigma_{%s}(%s) = "
476 yTit.Data(), xTit.Data(),
477 fvar->GetParameter(0),
478 fvar->GetParameter(1), xTit.Data()));
479 l->DrawLatex(0.15, y-0.14, Form("#delta = %3.1f %s #sigma",
481 flags & 0x8000 ? "log_{10}(#sigma)" : ""));
485 //____________________________________________________________________
486 void DrawDensityCalculator()
488 Info("DrawDensityCalculator", "Drawing density calculator");
489 TCollection* c = GetCollection(fSums, "fmdDensityCalculator");
496 Int_t maxParticles=0, phiAcceptance=0, etaLumping=0, phiLumping=0;
497 Bool_t method=false, recalcEta=false, recalcPhi=false;
498 Double_t maxOutliers=0, outlierCut=0;
499 Double_t size = fLandscape ? 0.05 : 0.03;
501 GetParameter(c, "maxParticle", maxParticles);
503 if (GetParameter(c, "phiAcceptance", phiAcceptance))
504 DrawParameter(y, "#phi acceptance method",
505 (phiAcceptance == 1 ? "N_{ch}" :
506 phiAcceptance == 2 ? "#DeltaE" : "none"), size);
507 if (GetParameter(c, "etaLumping", etaLumping) &&
508 GetParameter(c, "phiLumping", phiLumping))
509 DrawParameter(y, "Region size (sector#timesstrip)",
510 Form("%2d #times %2d", phiLumping, etaLumping), size);
511 if (GetParameter(c, "method", method))
512 DrawParameter(y, "Method", (method ? "Poisson" : "#DeltaE"), size);
513 if (GetParameter(c, "recalcEta", recalcEta))
514 DrawParameter(y, "Recalculate #eta",(recalcEta ? "yes" : "no"),size);
515 if (GetParameter(c, "recalcPhi", recalcPhi))
516 DrawParameter(y, "Recalculate #phi",(recalcPhi ? "yes" : "no"),size);
517 if (GetParameter(c, "maxOutliers", maxOutliers))
518 DrawParameter(y, "Max relative N_{outlier}",
519 Form("%5.3f",maxOutliers),size);
520 if (GetParameter(c, "outlierCut", outlierCut))
521 DrawParameter(y, "Max relative deviation",Form("%5.3f",outlierCut),size);
524 TParameter<int>* nFiles =
525 static_cast<TParameter<int>*>(GetObject(c, "nFiles"));
527 DrawParameter(y, "# files merged", Form("%d", nFiles->GetVal()), size);
529 TCollection* lc = GetCollection(c, "lCuts");
530 Int_t tm = PrintCut(lc, y, "Threshold", size);
532 TVirtualPad* p = fBody; // fBody->cd(2);
535 TH1* accI = GetH1(c, "accI");
536 TH1* accO = GetH1(c, "accO");
538 Double_t scale = 1./accI->GetMaximum();
543 TH2* lCuts = GetH2(c, "lowCuts");
544 TH2* maxW = GetH2(c, "maxWeights");
545 if (lCuts) lCuts->SetTitle("Thresholds");
546 if (nFiles && lCuts) lCuts->Scale(1. / nFiles->GetVal());
547 if (nFiles && maxW) maxW->Scale(1. / nFiles->GetVal());
548 DrawInPad(p, 2, accI);
549 DrawInPad(p, 2, accO, "same", kLegend);
550 DrawInPad(p, 3, lCuts, "colz");
551 DrawInPad(p, 4, maxW, "colz");
553 PrintCanvas("Density calculator");
556 const char** ptr = GetRingNames(false);
558 TCollection* sc = GetCollection(c, *ptr);
559 if (!sc) { ptr++; continue; }
561 if (fLandscape) fBody->Divide(3,2);
562 else fBody->Divide(2,3);
564 TH2* corr = GetH2(sc, "elossVsPoisson");
565 TH2* corrOut = GetH2(sc, "elossVsPoissonOutlier");
566 TH1* diff = GetH1(sc, "diffElossPoisson");
567 TH1* diffOut = GetH1(sc, "diffElossPoissonOutlier");
568 TH1* eloss = GetH1(sc, "eloss");
569 TH1* elossUsed = GetH1(sc, "elossUsed");
570 TH1* occ = GetH1(sc, "occupancy");
571 if (eloss) eloss ->SetLineWidth(1);
572 if (elossUsed) elossUsed->SetLineWidth(1);
573 if (eloss) eloss->GetXaxis()->SetRangeUser(-.1, 2);
575 DrawInPad(fBody, 1, corr, "colz", kLogz);
576 DrawInPad(fBody, 1, corrOut, "same", kLogz);
577 DrawInPad(fBody, 2, diff, "HIST E", kLogy);
578 DrawInPad(fBody, 2, diffOut, "HIST E SAME", kLogy|kLegend);
579 DrawInPad(fBody, 3, occ, "", kLogy);
580 DrawInPad(fBody, 4, eloss, "", kLogy,
581 "#Delta/#Delta_{mip} before and after cuts");
582 DrawInPad(fBody, 4, elossUsed, "same", kLogy);
583 TGraph* thres = CreateCutGraph(tm, iq, lCuts, eloss, kYellow+1);
584 DrawInPad(fBody, 4, thres, "lf same", kLogy|kLegend);
586 if (eloss && elossUsed) {
587 Int_t lowBin = eloss->GetXaxis()->FindBin(0.)+1;
588 Int_t upBin = eloss->GetNbinsX()+1;
589 Double_t beforeInt = eloss->Integral(lowBin,upBin);
590 Double_t afterInt = elossUsed->Integral(lowBin,upBin);
591 Double_t frac = beforeInt > 0 ? (beforeInt-afterInt)/beforeInt : 1;
592 TVirtualPad* pp = fBody->GetPad(4);
594 TLatex* l = new TLatex(1-pp->GetRightMargin(),
595 0.5, Form("Loss: %5.1f%%", frac*100));
602 TH1* phiB = GetH1(sc, "phiBefore");
603 TH1* phiA = GetH1(sc, "phiAfter");
604 TH1* outliers = GetH1(sc, "outliers");
606 DrawInPad(fBody, 5, outliers, "hist", kLogy);
607 else if (phiB && phiA) {
610 phiA->SetTitle("#Delta#phi from Ip (x,y) correction");
611 phiA->SetYTitle("(#phi_{after}-#phi_{before})/#phi_{before}");
612 DrawInPad(fBody, 5, phiA);
616 TLatex* ltx = new TLatex(0.5, 0.5, "No outliers or #phi corrections");
617 ltx->SetTextAlign(22);
618 ltx->SetTextSize(0.07);
622 DrawInPad(fBody, 6, GetH2(sc, "phiAcc"), "colz", kLogz);
624 ShowSliceFit(true, corr, 10, fBody, 1, kLogz, outlierCut);
626 if (diff && diffOut) {
628 Double_t in = diff->GetEntries();
629 Double_t out = diffOut->GetEntries();
631 TLatex* ltx = new TLatex(0.11, 0.89,
632 Form("Fraction: %7.3f%%",
635 ltx->SetTextAlign(13);
636 ltx->SetTextSize(0.06);
640 PrintCanvas(Form("Density calculator - %s", *ptr));
645 TCollection* cc = GetCollection(c, "esd_mc_comparison", false);
646 if (!cc) return; // Not MC
649 ptr = GetRingNames(false);
652 DrawInPad(fBody, 2*cnt+1, GetH2(cc, Form("%s_corr_mc_esd", *ptr)),
654 DrawInPad(fBody, 2*(cnt+1), GetH2(cc, Form("%s_diff_mc_esd", *ptr)),
660 PrintCanvas("Density calculator - MC vs Reco");
663 //____________________________________________________________________
666 Info("DrawCorrector", "Drawing corrector");
667 TCollection* c = GetCollection(fSums, "fmdCorrector");
673 Bool_t secondary=false, vertexBias=false, acceptance=false, merging=false;
674 if (GetParameter(c, "secondary", secondary))
675 DrawParameter(y, "Secondary corr.", secondary ? "yes" : "no");
676 if (GetParameter(c, "acceptance", acceptance))
677 DrawParameter(y, "Acceptance corr.", acceptance ? "yes" : "no");
678 if (GetParameter(c, "vertexBias", vertexBias))
679 DrawParameter(y, "Vertex bias corr.", vertexBias ? "yes" : "no");
680 if (GetParameter(c, "merging", merging))
681 DrawParameter(y, "Merging eff.", merging ? "yes" : "no");
683 PrintCanvas("Corrector");
685 TCollection* cc = GetCollection(c, "esd_mc_comparison", false);
686 if (!cc) return; // Not MC
688 DivideForRings(false, false);
689 const char** ptr = GetRingNames(false);
691 DrawInRingPad(GetH2(cc, Form("%s_esd_vs_mc", *ptr)), "colz", 0x0);
695 PrintCanvas("Corrector - MC vs Reco");
698 //____________________________________________________________________
699 void DrawHistCollector()
701 Info("DrawHistCollector", "Drawing histogram collector");
702 TCollection* c = GetCollection(fSums, "fmdHistCollector");
706 TVirtualPad* p = fBody->cd(1);
711 Int_t nCutBins=0, fiducial=0, merge=0, skipRings=0;
712 Double_t fiducialCut=0.;
713 Bool_t bgAndHits=false;
714 Double_t size = fLandscape ? 0.06 : 0.04;
715 if (GetParameter(c, "nCutBins", nCutBins))
716 DrawParameter(y, "# of bins to cut", Form("%d", nCutBins),size);
718 if (GetParameter(c, "skipRings", skipRings)) {
720 if (skipRings & 0x05) skipped.Append("FMD1i ");
721 if (skipRings & 0x09) skipped.Append("FMD2i ");
722 if (skipRings & 0x0a) skipped.Append("FMD2o ");
723 if (skipRings & 0x11) skipped.Append("FMD3i ");
724 if (skipRings & 0x12) skipped.Append("FMD3o ");
725 if (skipped.IsNull()) skipped = "none";
726 DrawParameter(y, "Skipped rings", skipped, size);
728 if (GetParameter(c, "bgAndHits", bgAndHits))
729 DrawParameter(y, "Bg & hit maps stored.", bgAndHits?"yes":"no",size);
730 if (GetParameter(c, "merge", merge))
731 DrawParameter(y, "Merge method",
732 (merge == 0 ? "straight mean" :
733 merge == 1 ? "straight mean, no zeroes" :
734 merge == 2 ? "weighted mean" :
735 merge == 3 ? "least error" :
736 merge == 4 ? "sum" : "unknown"),size);
737 if (GetParameter(c, "fiducial", fiducial))
738 DrawParameter(y, "Fiducial method.",
739 fiducial == 0 ? "cut" : "distance", size);
740 if (GetParameter(c, "fiducialCut", fiducialCut))
741 DrawParameter(y, "Fiducial cut.", Form("%f", fiducialCut), size);
744 // Printf("Drawing skipped");
745 TH1* skipped = GetH1(c, "skipped");
747 skipped->SetFillColor(kRed+1);
748 skipped->SetFillStyle(3001);
750 DrawInPad(p, 2, skipped, "hist");
755 // Printf("Drawing sumRings");
756 DrawInPad(p, 1, GetH2(c, "sumRings"), "colz");
757 // Printf("Drawing coverage");
758 DrawInPad(p, 2, GetH2(c, "coverage"), "colz");
759 // Printf("Done drawing for now");
760 PrintCanvas("Histogram collector");
765 TRegexp regexp("[pm][0-9]+_[pm][0-9]+");
766 while ((o = next())) {
767 TString name(o->GetName());
768 if (name.Index(regexp) == kNPOS) continue;
770 TList* vl = static_cast<TList*>(o);
773 DivideForRings(false, false);
774 const char** ptr = GetRingNames(false);
776 DrawInRingPad(GetH2(vl, Form("secMap%s", *ptr)), "colz", 0x0);
777 DrawInRingPad(GetH2(vl, Form("hitMap%s", *ptr)), "box same", 0x0);
780 PrintCanvas(Form("Histogram Collector - Vertex bin %s", vl->GetName()));
783 o = c->FindObject("byCentrality");
785 TList* bc = static_cast<TList*>(o);
787 DrawInPad(fBody, GetH3(bc, "FMD1I"), "box", 0);
788 DrawInPad(fBody, GetH3(bc, "FMD2I"), "box same", 0);
789 DrawInPad(fBody, GetH3(bc, "FMD2O"), "box same", 0);
790 DrawInPad(fBody, GetH3(bc, "FMD3O"), "box same", 0);
791 DrawInPad(fBody, GetH3(bc, "FMD3I"), "box same", kLegend);
794 //____________________________________________________________________
797 Info("DrawCentral", "Drawing central (SPD)");
798 TCollection* c = fSums;
804 Bool_t secondary=false, acceptance=false;
805 if (GetParameter(c, "secondary", secondary))
806 DrawParameter(y, "Secondary corr.", secondary ? "yes" : "no");
807 if (GetParameter(c, "acceptance", acceptance))
808 DrawParameter(y, "Acceptance corr.", acceptance ? "yes" : "no");
811 DrawInPad(fBody, 2, GetH2(c, "coverage"), "col", 0,
812 "#eta coverage per v_{z}");
813 TH2* cvst = GetH2(c, "nClusterVsnTracklet");
815 // cvst->Scale(1, "width");
816 cvst->GetXaxis()->SetTitle("N_{free cluster}");
817 cvst->GetYaxis()->SetTitle("N_{tracklet}");
818 cvst->GetXaxis()->SetRangeUser(1,10000);
819 cvst->GetYaxis()->SetRangeUser(1,10000);
821 DrawInPad(fBody, 3, cvst, "colz", kLogx|kLogy|kLogz,
822 "Correlation of # of tracklets and clusters");
823 DrawInPad(fBody, 4, GetH2(c, "clusterPerTracklet"), "colz", 0x0,
824 "# clusters per tracklet vs #eta");
825 ShowSliceFit(true, cvst, 3, fBody, 3, 0x8000|kLogz);
827 fBody->cd(1)->Modified();
828 fBody->cd(2)->Modified();
829 fBody->cd(3)->Modified();
830 fBody->cd(4)->Modified();
831 fBody->cd(1)->Update();
832 fBody->cd(2)->Update();
833 fBody->cd(3)->Update();
834 fBody->cd(4)->Update();
835 PrintCanvas("Central - overview");
840 TRegexp regexp("[pm][0-9]+_[pm][0-9]+");
841 while ((o = next())) {
842 TString name(o->GetName());
843 if (name.Index(regexp) == kNPOS) continue;
845 TList* vl = static_cast<TList*>(o);
849 DrawInPad(fBody, 1, GetH1(vl, "acceptance"), "", 0);
851 TH1* sec = GetH1(vl, "secondary");
852 sec->SetMarkerStyle(21);
853 sec->SetMarkerSize(1.2);
854 DrawInPad(fBody, 2, sec, "", 0);
855 DrawInPad(fBody, 2, GetH1(vl, "secondaryFiducial"), "same", 0x0);
856 DrawInPad(fBody, 3, GetH2(vl, "secondaryMapFiducial"), "colz", 0);
857 DrawInPad(fBody, 3, GetH2(vl, "hitMap"), "box same", 0x0);
859 fBody->cd(1)->Modified();
860 fBody->cd(2)->Modified();
861 fBody->cd(3)->Modified();
862 fBody->cd(1)->Update();
863 fBody->cd(2)->Update();
864 fBody->cd(3)->Update();
865 PrintCanvas(Form("Central - Vertex bin %s", vl->GetName()));
870 //____________________________________________________________________
871 void AddToAll(THStack* all, const THStack* stack, Int_t curr, Int_t step)
875 TIter next(stack->GetHists());
877 while ((h = static_cast<TH1*>(next()))) {
878 TH1* copy = static_cast<TH1*>(h->Clone(Form("%s_copy", h->GetName())));
879 copy->SetDirectory(0);
881 copy->SetMarkerColor(kGray);
882 copy->SetLineColor(kGray);
887 //____________________________________________________________________
888 void AddToAll(THStack* all, const THStack* stack)
892 TIter next(stack->GetHists());
894 while ((h = static_cast<TH1*>(next()))) {
895 TH1* copy = static_cast<TH1*>(h->Clone(Form("%s_copy", h->GetName())));
896 copy->SetDirectory(0);
897 copy->SetMarkerColor(kGray);
898 copy->SetLineColor(kGray);
903 //____________________________________________________________________
904 void DrawStep(Int_t step,
913 if (all->GetHists()->GetEntries() <= 0 || !cur) return;
915 // Info("", "Drawing step # %d", step);
916 Bool_t left = sub % nCol == 1;
917 Bool_t right= sub % nCol == 0;
918 Bool_t top = (sub-1) / nCol == 0;
919 TVirtualPad* p = can->cd(sub);
920 gStyle->SetOptTitle(0);
921 p->SetTitle(Form("Step # %d", step));
922 p->SetFillColor(kWhite);
923 p->SetRightMargin(right ? 0.02 : 0);
924 p->SetTopMargin(top ? 0.02 : 0); // 0.02);
925 // Info("", "Drawing step %d in sub-pad %d (%s)",
926 // step, sub, (left?"left":"right"));
929 all->Draw("nostack");
930 all->GetHistogram()->SetXTitle("#eta");
931 all->GetHistogram()->SetYTitle("signal");
934 static_cast<TLegendEntry*>(leg->GetListOfPrimitives()->At(step-1));
936 e->SetMarkerColor(kBlack);
937 e->SetLineColor(kBlack);
938 e->SetTextColor(kBlack);
942 gROOT->SetSelectedPad(p);
943 cur->DrawClone("same nostack");
946 TLatex* ltx = new TLatex(.97, .97, title);
948 ltx->SetTextSize(.06);
949 ltx->SetTextAlign(33);
952 ltx = new TLatex((left ? .12 : .02), .97, p->GetTitle());
954 ltx->SetTextSize(.06);
955 ltx->SetTextAlign(13);
959 Double_t x1 = 0.5*(p->GetUxmax()+p->GetUxmin());
961 Double_t y1 = p->GetUymax();
962 Double_t y2 = 0.92*y1;
965 x1 = 0.99*p->GetUxmin();
967 y1 = .5*(p->GetUymax()+p->GetUymin());
971 // Info("", "Arrow at (x1,y1)=%f,%f (x2,y2)=%f,%f", x1, y1, x2, y2);
972 TArrow* a = new TArrow(x1, y1, x2, y2, sz, "|>");
973 // (fLandscape ? "<|" : "|>"));
974 a->SetFillColor(kGray+1);
975 a->SetLineColor(kGray+1);
983 e->SetMarkerColor(kGray);
984 e->SetLineColor(kGray);
985 e->SetTextColor(kGray);
987 gStyle->SetOptTitle(1);
990 //____________________________________________________________________
991 void FixStack(THStack* stack, const TString& title,
992 const TString& extra, Int_t marker)
995 stack->SetTitle(title);
996 TIter next(stack->GetHists());
998 while ((h = static_cast<TH1*>(next()))) {
999 h->SetMarkerStyle(marker);
1000 TString tit(h->GetTitle());
1001 tit.ReplaceAll("cache", "");
1006 void AddLegendEntry(TLegend* l,
1008 const TString& title)
1012 TLegendEntry* e = l->AddEntry("dummy", title.Data(), "pl");
1013 e->SetMarkerStyle(h->GetMarkerStyle());
1014 e->SetMarkerColor(kGray);
1015 e->SetLineColor(kGray);
1016 e->SetTextColor(kGray);
1020 //____________________________________________________________________
1023 // MakeChapter(can, "Steps");
1025 THStack* esds = GetStack(GetCollection(fResults, "fmdSharingFilter"),
1026 "sumsESD", "summedESD");
1027 THStack* deltas = GetStack(GetCollection(fResults, "fmdSharingFilter"),
1029 THStack* nchs = GetStack(GetCollection(fResults,
1030 "fmdDensityCalculator"),
1031 "sums", "inclDensity");
1032 THStack* prims = GetStack(GetCollection(fResults, "fmdCorrector"),
1033 "sums", "primaryDensity");
1034 THStack* rings = GetStack(GetCollection(fResults, "ringResults"), "all");
1035 THStack* mcRings = GetStack(GetCollection(fResults, "mcRingResults", false),
1036 "all","dndeta_eta", false);
1037 TH1* dndeta = GetH1(fResults, "dNdeta");
1038 if (dndeta) dndeta->SetMarkerColor(kBlack);
1040 FixStack(esds, "#sum_{s} #Delta/#Delta_{mip}", "", 20);
1041 FixStack(deltas, "#sum_{c} #Delta/#Delta_{mip}", "", 21);
1042 FixStack(nchs, "#sum_{b} N_{ch,incl}", "", 22);
1043 FixStack(prims, "#sum_{b} N_{ch,primary}", "", 23);
1044 FixStack(rings, "dN/d#eta per ring", "", 33);
1045 FixStack(mcRings,"dN/d#eta per ring (MC)", "(MC)", 34);
1047 THStack* all = new THStack;
1048 AddToAll(all, mcRings);
1049 AddToAll(all, esds);
1050 AddToAll(all, deltas);
1051 AddToAll(all, nchs);
1052 AddToAll(all, prims);
1053 AddToAll(all, rings);
1057 res = static_cast<TH1*>(dndeta->Clone("dNdeta"));
1058 res->SetTitle("dN/d#eta");
1059 res->SetMarkerColor(kGray);
1060 res->SetLineColor(kGray);
1061 res->SetDirectory(0);
1065 TLegend* l = new TLegend(.35, .2, .55, .9);
1066 l->SetFillColor(kWhite);
1068 l->SetBorderSize(0);
1069 TLegendEntry* e = 0;
1073 h = static_cast<TH1*>(mcRings->GetHists()->At(0));
1074 AddLegendEntry(l, h, mcRings->GetTitle());
1078 h = static_cast<TH1*>(esds->GetHists()->At(0));
1079 AddLegendEntry(l, h, esds->GetTitle());
1083 h = static_cast<TH1*>(deltas->GetHists()->At(0));
1084 AddLegendEntry(l, h, deltas->GetTitle());
1088 h = static_cast<TH1*>(nchs->GetHists()->At(0));
1089 AddLegendEntry(l, h, nchs->GetTitle());
1093 h = static_cast<TH1*>(prims->GetHists()->At(0));
1094 AddLegendEntry(l, h, prims->GetTitle());
1098 h = static_cast<TH1*>(rings->GetHists()->At(0));
1099 AddLegendEntry(l, h, rings->GetTitle());
1104 AddLegendEntry(l, h, h->GetTitle());
1107 TObject* objs[] = { mcRings,
1114 const char* titles[] = { /* 1 */ "MC",
1115 /* 2 */ "ESD input",
1116 /* 3 */ "After merging",
1117 /* 4 */ "After particle counting",
1118 /* 5 */ "After corrections",
1119 /* 6 */ "After normalization",
1120 /* 7 */ "After combining" };
1121 Int_t nY = mcRings ? 4 : 3;
1128 fBody->Divide(nX, nY, 0, 0);
1131 for (Int_t i = 0; i < 7; i++) {
1132 TObject* obj = objs[i];
1139 case 1: padNo = 1; break;
1140 case 2: padNo = 3; break;
1141 case 3: padNo = 5; break;
1142 case 4: padNo = (mcRings ? 7 : 2); break;
1143 case 5: padNo = (mcRings ? 2 : 4); break;
1144 case 6: padNo = (mcRings ? 4 : 6); break;
1145 case 7: padNo = (mcRings ? 6 : 8); break;
1148 //Printf("Drawing step %d in sub-pad %d (%s)",step,padNo,obj->GetTitle());
1149 DrawStep(step, all, obj, l, titles[i], fBody, padNo, nX);
1152 if (!esds && !mcRings && deltas) {
1154 TLegend* ll = new TLegend(0.01, 0.11, 0.99, 0.99);
1156 ll->SetFillColor(kWhite);
1157 ll->SetFillStyle(0);
1158 ll->SetBorderSize(0);
1160 TIter next(deltas->GetHists());
1162 while ((hh = static_cast<TH1*>(next()))) {
1163 e = ll->AddEntry("dummy", hh->GetTitle(), "pl");
1164 e->SetMarkerColor(hh->GetMarkerColor());
1165 e->SetMarkerStyle(hh->GetMarkerStyle());
1166 e->SetLineColor(kBlack);
1170 // Printf("Done drawing steps");
1171 PrintCanvas("Steps");
1175 //____________________________________________________________________
1178 // MakeChapter(can, "Results");
1182 TCollection* c = GetCollection(fResults, "ringResults");
1185 THStack* mcRings = GetStack(GetCollection(fResults, "mcRingResults", false),
1186 "all", "dndeta_eta", false);
1188 TH1* dndeta_phi = GetH1(fResults, "dNdeta");
1189 TH1* dndeta_eta = GetH1(fResults, "dNdeta_");
1190 dndeta_phi->SetTitle("1/N_{ev}dN_{ch}/d#eta (#varphi norm)");
1191 dndeta_eta->SetTitle("1/N_{ev}dN_{ch}/d#eta (#eta norm)");
1192 dndeta_eta->SetMarkerSize(0.7);
1194 THStack* allPhi = new THStack("phiAcc", "#varphi Acceptance");
1195 THStack* allEta = new THStack("etaCov", "#eta Coverage");
1196 const char** pring = GetRingNames(false);
1199 TCollection* cc = GetCollection(c, *pring);
1200 TH1* etaCov = GetH1(cc, "etaCov");
1201 TH1* phiAcc = GetH1(cc, "phiAcc");
1202 TH1* dndeta = GetH1(cc, "dndeta_phi");
1203 Int_t color = kBlack;
1204 if (dndeta) color = dndeta->GetMarkerColor();
1206 etaCov->SetTitle(*pring);
1207 etaCov->SetFillColor(color);
1208 etaCov->SetLineColor(color);
1209 allEta->Add(etaCov);
1212 phiAcc->SetFillColor(color);
1213 phiAcc->SetLineColor(color);
1214 allPhi->Add(phiAcc);
1218 Double_t savX = fParVal->GetX();
1219 Double_t savY = fParVal->GetY();
1222 TVirtualPad* p = fBody->cd(1);
1224 DrawInPad(p, 1, GetStack(c, "all"), "nostack", mcRings ? 0 : kLegend,
1225 "Individual ring results");
1226 DrawInPad(p, 1, mcRings, "nostack same", kLegend|kSilent);
1227 DrawInPad(p, 2, allEta, "nostack hist", kLegend,
1228 "#phi acceptance and #eta coverage per ring");
1229 DrawInPad(p, 2, allPhi, "nostack hist same", 0x0);
1233 DrawInPad(p, 1, dndeta_phi, "", 0x0,
1234 "1/#it{N}_{ev} d#it{N}_{ch}/d#it{#eta}");
1235 DrawInPad(p, 1, dndeta_eta, "Same", kLegend);
1236 DrawInPad(p, 2, GetH1(fResults, "norm"), "", 0x0,
1237 "Total #phi acceptance and #eta coverage");
1238 DrawInPad(p, 2, GetH1(fResults, "phi"), "same", kLegend);
1239 // DrawInPad(fBody, 4, GetH1(fSums, "d2Ndetadphi"), "colz");
1242 // TLatex* l = new TLatex(.5, .2, "Ring results");
1244 // l->SetTextAlign(21);
1248 // l->DrawLatex(.5, .2, "1/N_{ev}dN_{ch}/d#eta");
1251 // l->DrawLatex(.5, .2, "1/N_{ev}dN_{ch}/d#eta (#vta norm.)");
1253 fParVal->SetX(savX);
1254 fParVal->SetY(savY);
1255 PrintCanvas("Results");
1258 //____________________________________________________________________
1259 void DrawCentralResults()
1261 // MakeChapter(can, "Results");
1262 Info("DrawCentralResults", "Drawing central results");
1264 fBody->Divide(1,2,0,0);
1266 TH1* dndeta_ = GetH1(fResults, "dNdeta_");
1267 TH1* dndeta = GetH1(fResults, "dNdeta");
1268 THStack* stack = new THStack("dndetas",
1269 "d#it{N}_{ch}/d#it{#eta} - central");
1270 stack->Add(dndeta_);
1273 DrawInPad(fBody, 1, stack, "nostack");
1274 TH1* h = stack->GetHistogram();
1276 h->SetXTitle("#it{#eta}");
1277 h->SetYTitle("#frac{d#it{N}_{ch}}{d#it{#eta}}");
1280 TLegend* l = new TLegend(.3, .05, .7, .4);
1283 l->SetBorderSize(0);
1284 l->AddEntry(dndeta_, "Normalized to coverage", "lp");
1285 l->AddEntry(dndeta, "Normalized to #phi acceptance", "lp");
1288 DrawInPad(fBody, 2, GetH1(fResults, "norm"));
1289 DrawInPad(fBody, 2, GetH1(fResults, "phi"), "same", kLegend);
1291 PrintCanvas("Central Results");
1294 void DrawBoth(TFile* file)
1296 Info("DrawBoth", "Drawing central & forward results");
1297 TCollection* central = GetCollection(file, "CentralResults");
1298 TCollection* forward = GetCollection(file, "ForwardResults");
1300 if (!central || !forward) {
1301 Warning("DrawBoth", "central %p or forward %p results not found",
1306 TH1* f1 = GetH1(forward, "dNdeta_");
1307 TH1* c1 = GetH1(central, "dNdeta_");
1308 TH1* f2 = GetH1(forward, "dNdeta");
1309 TH1* c2 = GetH1(central, "dNdeta");
1310 f1->SetLineColor(kBlack);
1311 f2->SetLineColor(kBlack);
1312 c1->SetLineColor(kBlack);
1313 c2->SetLineColor(kBlack);
1314 f1->SetMarkerColor(f2->GetMarkerColor());
1315 f1->SetMarkerStyle(24);
1316 c1->SetMarkerStyle(24);
1317 c2->SetMarkerStyle(20);
1318 c2->SetMarkerColor(c1->GetMarkerColor());
1319 THStack* s = new THStack("dndetas", "d#it{N}_{ch}/d#it{#eta}");
1325 fBody->Divide(1, 2, 0, 0);
1326 DrawInPad(fBody, 1, s, "nostack");
1327 s->GetHistogram()->SetXTitle("#it{#eta}");
1328 s->GetHistogram()->SetYTitle("#frac{d#it{N}_{ch}}{d#it{#eta}}");
1331 TLegend* l = new TLegend(.4, .05, .8, .4);
1334 l->SetBorderSize(0);
1335 TLegendEntry* entry = l->AddEntry("dummy", "Forward", "f");
1336 entry->SetFillColor(f1->GetMarkerColor());
1337 entry->SetLineColor(f1->GetMarkerColor());
1338 entry->SetFillStyle(1001);
1339 entry->SetLineWidth(0);
1340 entry = l->AddEntry("dummy", "Central", "f");
1341 entry->SetFillColor(c1->GetMarkerColor());
1342 entry->SetLineColor(c1->GetMarkerColor());
1343 entry->SetLineWidth(0);
1344 entry->SetFillStyle(1001);
1345 entry = l->AddEntry("dummy", "Normalized to coverage", "lp");
1346 entry->SetMarkerStyle(f1->GetMarkerStyle());
1347 entry = l->AddEntry("dummy", "Normalized to #phi acceptance", "lp");
1348 entry->SetMarkerStyle(f2->GetMarkerStyle());
1351 TH1* f3 = GetH1(forward, "norm");
1352 TH1* c3 = GetH1(central, "norm");
1353 TH1* f4 = GetH1(forward, "phi");
1354 TH1* c4 = GetH1(central, "phi");
1355 f3->SetFillColor(f1->GetMarkerColor());
1356 f4->SetFillColor(f1->GetMarkerColor());
1357 c3->SetFillColor(c1->GetMarkerColor());
1358 c4->SetFillColor(c1->GetMarkerColor());
1359 f3->SetLineColor(f1->GetMarkerColor());
1360 f4->SetLineColor(f1->GetMarkerColor());
1361 c3->SetLineColor(c1->GetMarkerColor());
1362 c4->SetLineColor(c1->GetMarkerColor());
1364 THStack* a = new THStack("norms", "Normalizations");
1370 a->SetMaximum(a->GetMaximum("nostack")*1.2);
1371 DrawInPad(fBody, 2, a, "nostack");
1372 a->GetHistogram()->SetXTitle("#it{#eta}");
1373 a->GetHistogram()->SetYTitle("Normalization (coverage or acceptance)");
1376 l = new TLegend(.2, .94, .9, .99);
1379 l->SetBorderSize(0);
1381 // entry = l->AddEntry("dummy", "Forward", "f");
1382 // entry->SetFillColor(f1->GetMarkerColor());
1383 // entry->SetLineColor(f1->GetMarkerColor());
1384 // entry->SetFillStyle(1001);
1385 // entry->SetLineWidth(0);
1386 // entry = l->AddEntry("dummy", "Central", "f");
1387 // entry->SetFillColor(c1->GetMarkerColor());
1388 // entry->SetLineColor(c1->GetMarkerColor());
1389 // entry->SetLineWidth(0);
1390 // entry->SetFillStyle(1001);
1391 entry = l->AddEntry("dummy", "#eta Coverage", "f");
1392 entry->SetFillStyle(f3->GetFillStyle());
1393 entry->SetFillColor(kBlack);
1394 entry = l->AddEntry("dummy", "#phi Acceptance", "f");
1395 entry->SetFillStyle(f4->GetFillStyle());
1396 entry->SetFillColor(kBlack);
1399 PrintCanvas("Both results");
1402 TCollection* fResults;