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 "fraction of MPV";
215 case 2: return "fit range";
216 case 3: return "Landau width";
217 case 4: return "Probability";
221 //____________________________________________________________________
222 Int_t PrintCut(const TCollection* c, Double_t& y, const Char_t* name,
228 if (!GetParameter(c, "method", method)) return -1;
234 DrawParameter(y, name, "fixed", size);
237 GetParameter(c, "frac", val);
238 DrawParameter(y, name, Form("Fraction of #Delta_{p} (%3d%%)",
239 Int_t(val*100)), size);
242 DrawParameter(y, name, "Fit range");
244 case 3: // Landau width
245 GetParameter(c, "nXi", val);
246 GetParameter(c, "sigma", sig);
247 DrawParameter(y, name, Form("N#times%s#xi%s (N=%4.1f)",
249 (sig ? "+#sigma)" : ""),
252 case 4: // Probability;
253 GetParameter(c, "probability", val);
254 DrawParameter(y, name, Form("P(#Delta)<%f", val), size);
257 DrawParameter(y, name, "Unknown", size);
262 //____________________________________________________________________
263 void DrawSharingFilter()
265 Info("DrawSharingFilter", "Drawing sharing filter");
266 TCollection* c = GetCollection(fSums, "fmdSharingFilter");
268 TCollection* rc = GetCollection(fResults, "fmdSharingFilter");
271 // --- Draw summary information ----------------------------------
272 fBody->Divide(1, 3, 0, 0);
276 Bool_t angle=false, lowSignal=false, disabled=false;
278 if (GetParameter(c, "angle", angle))
279 DrawParameter(y, "Angle correct", (angle ? "yes" : "no"));
280 if (GetParameter(c, "lowSignal", lowSignal))
281 DrawParameter(y, "Lower signal", (lowSignal ? "yes" : "no"));
282 TParameter<int>* nFiles =
283 static_cast<TParameter<int>*>(GetObject(c, "nFiles"));
285 DrawParameter(y, "# files merged", Form("%d", nFiles->GetVal()));
286 if (GetParameter(c, "disabled", disabled))
287 DrawParameter(y, "Merging disabled", (disabled ? "yes" : "no"));
294 Bool_t simple=false, three=false;
295 if (GetParameter(c, "simple", simple))
296 DrawParameter(y, "Simple method", (simple ? "yes" : "no"));
297 if (GetParameter(c, "sumThree", three))
298 DrawParameter(y, "3-strip merging", (three ? "yes" : "no"));
300 TCollection* lc = GetCollection(c, "lCuts");
301 TCollection* hc = GetCollection(c, "hCuts");
302 lm = PrintCut(lc, y, "Low cut");
303 hm = PrintCut(hc, y, "High cut");
304 hLow = GetH2(c, "lowCuts");
305 hHigh = GetH2(c, "highCuts");
306 // if (hLow && nFiles) hLow->Scale(1. / nFiles->GetVal());
307 // if (hHigh && nFiles) hHigh->Scale(1. / nFiles->GetVal());
308 DrawInPad(fBody, 2, hLow, "colz");
309 DrawInPad(fBody, 3, hHigh, "colz");
311 PrintCanvas("Sharing filter");
314 // --- Draw rings individually -----------------------------------
315 Double_t savX = fParVal->GetX();
316 Double_t savY = fParVal->GetY();
319 const char** ptr = GetRingNames(false);
322 TCollection* sc = GetCollection(c, *ptr);
323 if (!sc) { ptr++; iq++; continue; }
325 if (fLandscape) fBody->Divide(3, 2);
326 else fBody->Divide(2,3);
328 TH1* esdELoss = GetH1(sc, "esdEloss");
329 esdELoss->GetXaxis()->SetRangeUser(-.1, 2);
330 TGraph* lowCut = CreateCutGraph(lm, iq, hLow, esdELoss, kYellow+1);
331 TGraph* highCut = CreateCutGraph(hm, iq, hHigh, esdELoss, kCyan+1);
333 DrawInPad(fBody, 1, esdELoss, "", kLogy,
334 "#Delta/#Delta_{mip} reconstructed and merged");
335 DrawInPad(fBody, 1, GetH1(sc, "anaEloss"), "same");
336 DrawInPad(fBody, 1, lowCut, "lf same");
337 DrawInPad(fBody, 1, highCut, "lf same", kLogy|kLegend);
339 DrawInPad(fBody, 2, GetH1(sc, "singleEloss"), "", kLogy,
340 "#Delta/#Delta_{mip} for single, double, and tripple hits");
341 DrawInPad(fBody, 2, GetH1(sc, "doubleEloss"), "same",kLogy);
342 DrawInPad(fBody, 2, GetH1(sc, "tripleEloss"), "same",kLogy|kLegend);
344 DrawInPad(fBody, 3, GetH2(sc, "singlePerStrip"), "colz",kLogz);
345 // DrawInPad(fBody, 4, GetH1(sc, "distanceBefore"), "", 0x2);
346 // DrawInPad(fBody, 4, GetH1(sc, "distanceAfter"), "same", 0x12);
347 DrawInPad(fBody, 4, GetH2(sc, "summed"), "colz",0x0);
349 TH2* nB = GetH2(sc, "neighborsBefore");
351 nB->GetXaxis()->SetRangeUser(0,8);
352 nB->GetYaxis()->SetRangeUser(0,8);
354 DrawInPad(fBody, 5, nB, "colz", kLogz);
355 DrawInPad(fBody, 5, GetH2(sc, "neighborsAfter"), "p same", kLogz,
356 "Correlation of neighbors before and after merging");
357 DrawInPad(fBody, 6, GetH2(sc, "beforeAfter"), "colz", kLogz);
359 PrintCanvas(Form("Sharing filter - %s", *ptr));
367 // --- MC --------------------------------------------------------
368 TCollection* cc = GetCollection(c, "esd_mc_comparion", false); // Spelling!
369 if (!cc) return; // Not MC
371 DivideForRings(false, false);
372 const char** ptr = GetRingNames(false);
374 DrawInRingPad(GetH2(cc, Form("%s_corr", *ptr)), "colz", kLogz);
378 PrintCanvas("Sharing filter - MC vs Reco");
380 // --- MC --------------------------------------------------------
384 void ShowSliceFit(Bool_t inY, TH2* h, Double_t nVar,
385 TVirtualPad* p, Int_t sub, UShort_t flags=0,
390 TObjArray* fits = new TObjArray;
392 if (inY) h->FitSlicesY(0, 1, -1, 10, "QN", fits);
393 else h->FitSlicesX(0, 1, -1, 10, "QN", fits);
395 Warning("ShowSliceFit", "No fits returned");
398 TH1* mean = static_cast<TH1*>(fits->At(1));
399 TH1* var = static_cast<TH1*>(fits->At(2));
401 Warning("ShowSliceFit", "Didn't get histograms");
405 TF1* fmean = new TF1("mean", "pol1");
406 TF1* fvar = new TF1("var", "pol1");
407 mean->Fit(fmean, "Q0+");
408 var->Fit(fvar, "Q0+");
409 if (!fmean || !fvar) {
410 Warning("ShowSliceFit", "No functions returned");
415 TGraphErrors* g = new TGraphErrors(h->GetNbinsX());
416 g->SetName(Form("g%s", h->GetName()));
417 TString xTit = h->GetXaxis()->GetTitle();
418 TString yTit = h->GetYaxis()->GetTitle();
419 g->SetTitle(Form("Correlation of %s and %s",
420 inY ? xTit.Data() : yTit.Data(),
421 !inY ? xTit.Data() : yTit.Data()));
422 g->SetFillColor(kBlue-10);
423 g->SetFillStyle(3001);
424 TGraph* up = (cut > 0 ? new TGraph(h->GetNbinsX()) : 0);
425 TGraph* low = (cut > 0 ? new TGraph(h->GetNbinsX()) : 0);
427 up ->SetLineColor(kBlack);
428 up ->SetLineWidth(2);
429 up ->SetLineStyle(2);
432 low->SetLineColor(kBlack);
433 low->SetLineWidth(2);
434 low->SetLineStyle(2);
436 for (Int_t i = 1; i <= h->GetNbinsX(); i++) {
437 Double_t x = h->GetXaxis()->GetBinCenter(i);
438 Double_t y = fmean->Eval(x);
439 Double_t e = fvar->Eval(x);
440 Double_t ee = nVar * e;
441 if (flags & 0x8000) ee *= e > 0 ? TMath::Log10(e) : 1;
442 g->SetPoint(i-1, x, y);
443 g->SetPointError(i-1, 0, ee);
445 if (up) up ->SetPoint(i-1,x,x+cut*x);
446 if (low) low->SetPoint(i-1,x,x-cut*x);
448 DrawInPad(p, sub, g, "3", flags);
449 if (up) DrawInPad(p, sub, up, "l", flags);
450 if (low) DrawInPad(p, sub, low, "l", flags);
451 fmean->SetRange(h->GetXaxis()->GetXmin(), h->GetXaxis()->GetXmax());
452 fmean->SetLineWidth(2);
453 DrawInPad(p, sub, fmean, "same", flags);
455 TVirtualPad* pp = p->GetPad(sub);
456 Double_t y = 1-pp->GetTopMargin()-.01;
457 TLatex* l = new TLatex(.15, y,
458 Form("#LT%s#GT(%s) = "
460 yTit.Data(), xTit.Data(),
461 fmean->GetParameter(0),
462 fmean->GetParameter(1), xTit.Data()));
465 l->SetTextSize(0.04);
468 l->DrawLatex(0.15, y-0.07,
469 Form("#sigma_{%s}(%s) = "
471 yTit.Data(), xTit.Data(),
472 fvar->GetParameter(0),
473 fvar->GetParameter(1), xTit.Data()));
474 l->DrawLatex(0.15, y-0.14, Form("#delta = %3.1f %s #sigma",
476 flags & 0x8000 ? "log_{10}(#sigma)" : ""));
480 //____________________________________________________________________
481 void DrawDensityCalculator()
483 Info("DrawDensityCalculator", "Drawing density calculator");
484 TCollection* c = GetCollection(fSums, "fmdDensityCalculator");
491 Int_t maxParticles=0, phiAcceptance=0, etaLumping=0, phiLumping=0;
492 Bool_t method=false, recalcEta=false, recalcPhi=false;
493 Double_t maxOutliers=0, outlierCut=0;
494 Double_t size = fLandscape ? 0.06 : 0.04;
496 GetParameter(c, "maxParticle", maxParticles);
498 if (GetParameter(c, "phiAcceptance", phiAcceptance))
499 DrawParameter(y, "#phi acceptance method",
500 (phiAcceptance == 1 ? "N_{ch}" :
501 phiAcceptance == 2 ? "#DeltaE" : "none"), size);
502 if (GetParameter(c, "etaLumping", etaLumping) &&
503 GetParameter(c, "phiLumping", phiLumping))
504 DrawParameter(y, "Region size (sector#timesstrip)",
505 Form("%2d #times %2d", phiLumping, etaLumping), size);
506 if (GetParameter(c, "method", method))
507 DrawParameter(y, "Method", (method ? "Poisson" : "#DeltaE"), size);
508 if (GetParameter(c, "recalcEta", recalcEta))
509 DrawParameter(y, "Recalculate #eta",(recalcEta ? "yes" : "no"),size);
510 if (GetParameter(c, "recalcPhi", recalcPhi))
511 DrawParameter(y, "Recalculate #phi",(recalcPhi ? "yes" : "no"),size);
512 if (GetParameter(c, "maxOutliers", maxOutliers))
513 DrawParameter(y, "Max relative N_{outlier}",
514 Form("%5.3f",maxOutliers),size);
515 if (GetParameter(c, "outlierCut", outlierCut))
516 DrawParameter(y, "Max relative deviation",Form("%5.3f",outlierCut),size);
519 TParameter<int>* nFiles =
520 static_cast<TParameter<int>*>(GetObject(c, "nFiles"));
522 DrawParameter(y, "# files merged", Form("%d", nFiles->GetVal()), size);
524 TCollection* lc = GetCollection(c, "lCuts");
525 PrintCut(lc, y, "Threshold", size);
527 TVirtualPad* p = fBody; // fBody->cd(2);
530 TH1* accI = GetH1(c, "accI");
531 TH1* accO = GetH1(c, "accO");
533 Double_t scale = 1./accI->GetMaximum();
538 TH2* lCuts = GetH2(c, "lowCuts");
539 TH2* maxW = GetH2(c, "maxWeights");
540 if (lCuts) lCuts->SetTitle("Thresholds");
541 if (nFiles && lCuts) lCuts->Scale(1. / nFiles->GetVal());
542 if (nFiles && maxW) maxW->Scale(1. / nFiles->GetVal());
543 DrawInPad(p, 2, accI);
544 DrawInPad(p, 2, accO, "same", kLegend);
545 DrawInPad(p, 3, lCuts, "colz");
546 DrawInPad(p, 4, maxW, "colz");
548 PrintCanvas("Density calculator");
550 const char** ptr = GetRingNames(false);
552 TCollection* sc = GetCollection(c, *ptr);
553 if (!sc) { ptr++; continue; }
555 if (fLandscape) fBody->Divide(3,2);
556 else fBody->Divide(2,3);
558 TH2* corr = GetH2(sc, "elossVsPoisson");
559 TH2* corrOut = GetH2(sc, "elossVsPoissonOutlier");
560 TH1* diff = GetH1(sc, "diffElossPoisson");
561 TH1* diffOut = GetH1(sc, "diffElossPoissonOutlier");
562 TH1* eloss = GetH1(sc, "eloss");
563 TH1* elossUsed = GetH1(sc, "elossUsed");
564 TH1* occ = GetH1(sc, "occupancy");
565 if (eloss) eloss ->SetLineWidth(1);
566 if (elossUsed) elossUsed->SetLineWidth(1);
568 DrawInPad(fBody, 1, corr, "colz", kLogz);
569 DrawInPad(fBody, 1, corrOut, "same", kLogz);
570 DrawInPad(fBody, 2, diff, "HIST E", kLogy);
571 DrawInPad(fBody, 2, diffOut, "HIST E SAME", kLogy|kLegend);
572 DrawInPad(fBody, 3, occ, "", kLogy);
573 DrawInPad(fBody, 4, eloss, "", kLogy,
574 "#Delta/#Delta_{mip} before and after cuts");
575 DrawInPad(fBody, 4, elossUsed, "same", kLogy|kLegend);
576 TH1* phiB = GetH1(sc, "phiBefore");
577 TH1* phiA = GetH1(sc, "phiAfter");
578 TH1* outliers = GetH1(sc, "outliers");
580 DrawInPad(fBody, 5, outliers, "hist", kLogy);
581 else if (phiB && phiA) {
584 phiA->SetTitle("#Delta#phi from Ip (x,y) correction");
585 phiA->SetYTitle("(#phi_{after}-#phi_{before})/#phi_{before}");
586 DrawInPad(fBody, 5, phiA);
590 TLatex* ltx = new TLatex(0.5, 0.5, "No outliers or #phi corrections");
591 ltx->SetTextAlign(22);
592 ltx->SetTextSize(0.07);
596 DrawInPad(fBody, 6, GetH2(sc, "phiAcc"), "colz", kLogz);
598 ShowSliceFit(true, corr, 10, fBody, 1, kLogz, outlierCut);
600 if (diff && diffOut) {
602 Double_t in = diff->GetEntries();
603 Double_t out = diffOut->GetEntries();
605 TLatex* ltx = new TLatex(0.11, 0.89,
606 Form("Fraction: %7.3f%%",
609 ltx->SetTextAlign(13);
610 ltx->SetTextSize(0.06);
614 PrintCanvas(Form("Density calculator - %s", *ptr));
618 TCollection* cc = GetCollection(c, "esd_mc_comparison", false);
619 if (!cc) return; // Not MC
622 ptr = GetRingNames(false);
625 DrawInPad(fBody, 2*cnt+1, GetH2(cc, Form("%s_corr_mc_esd", *ptr)),
627 DrawInPad(fBody, 2*(cnt+1), GetH2(cc, Form("%s_diff_mc_esd", *ptr)),
633 PrintCanvas("Density calculator - MC vs Reco");
636 //____________________________________________________________________
639 Info("DrawCorrector", "Drawing corrector");
640 TCollection* c = GetCollection(fSums, "fmdCorrector");
646 Bool_t secondary=false, vertexBias=false, acceptance=false, merging=false;
647 if (GetParameter(c, "secondary", secondary))
648 DrawParameter(y, "Secondary corr.", secondary ? "yes" : "no");
649 if (GetParameter(c, "acceptance", acceptance))
650 DrawParameter(y, "Acceptance corr.", acceptance ? "yes" : "no");
651 if (GetParameter(c, "vertexBias", vertexBias))
652 DrawParameter(y, "Vertex bias corr.", vertexBias ? "yes" : "no");
653 if (GetParameter(c, "merging", merging))
654 DrawParameter(y, "Merging eff.", merging ? "yes" : "no");
656 PrintCanvas("Corrector");
658 TCollection* cc = GetCollection(c, "esd_mc_comparison", false);
659 if (!cc) return; // Not MC
661 DivideForRings(false, false);
662 const char** ptr = GetRingNames(false);
664 DrawInRingPad(GetH2(cc, Form("%s_esd_vs_mc", *ptr)), "colz", 0x0);
668 PrintCanvas("Corrector - MC vs Reco");
671 //____________________________________________________________________
672 void DrawHistCollector()
674 Info("DrawHistCollector", "Drawing histogram collector");
675 TCollection* c = GetCollection(fSums, "fmdHistCollector");
679 TVirtualPad* p = fBody->cd(1);
684 Int_t nCutBins=0, fiducial=0, merge=0, skipRings=0;
685 Double_t fiducialCut=0.;
686 Bool_t bgAndHits=false;
687 Double_t size = fLandscape ? 0.06 : 0.04;
688 if (GetParameter(c, "nCutBins", nCutBins))
689 DrawParameter(y, "# of bins to cut", Form("%d", nCutBins),size);
691 if (GetParameter(c, "skipRings", skipRings)) {
693 if (skipRings & 0x05) skipped.Append("FMD1i ");
694 if (skipRings & 0x09) skipped.Append("FMD2i ");
695 if (skipRings & 0x0a) skipped.Append("FMD2o ");
696 if (skipRings & 0x11) skipped.Append("FMD3i ");
697 if (skipRings & 0x12) skipped.Append("FMD3o ");
698 if (skipped.IsNull()) skipped = "none";
699 DrawParameter(y, "Skipped rings", skipped, size);
701 if (GetParameter(c, "bgAndHits", bgAndHits))
702 DrawParameter(y, "Bg & hit maps stored.", bgAndHits?"yes":"no",size);
703 if (GetParameter(c, "merge", merge))
704 DrawParameter(y, "Merge method",
705 (merge == 0 ? "straight mean" :
706 merge == 1 ? "straight mean, no zeroes" :
707 merge == 2 ? "weighted mean" :
708 merge == 3 ? "least error" :
709 merge == 4 ? "sum" : "unknown"),size);
710 if (GetParameter(c, "fiducial", fiducial))
711 DrawParameter(y, "Fiducial method.",
712 fiducial == 0 ? "cut" : "distance", size);
713 if (GetParameter(c, "fiducialCut", fiducialCut))
714 DrawParameter(y, "Fiducial cut.", Form("%f", fiducialCut), size);
717 // Printf("Drawing skipped");
718 TH1* skipped = GetH1(c, "skipped");
720 skipped->SetFillColor(kRed+1);
721 skipped->SetFillStyle(3001);
723 DrawInPad(p, 2, skipped, "hist");
728 // Printf("Drawing sumRings");
729 DrawInPad(p, 1, GetH2(c, "sumRings"), "colz");
730 // Printf("Drawing coverage");
731 DrawInPad(p, 2, GetH2(c, "coverage"), "colz");
732 // Printf("Done drawing for now");
733 PrintCanvas("Histogram collector");
738 TRegexp regexp("[pm][0-9]+_[pm][0-9]+");
739 while ((o = next())) {
740 TString name(o->GetName());
741 if (name.Index(regexp) == kNPOS) continue;
743 TList* vl = static_cast<TList*>(o);
746 DivideForRings(false, false);
747 const char** ptr = GetRingNames(false);
749 DrawInRingPad(GetH2(vl, Form("secMap%s", *ptr)), "colz", 0x0);
750 DrawInRingPad(GetH2(vl, Form("hitMap%s", *ptr)), "box same", 0x0);
753 PrintCanvas(Form("Histogram Collector - Vertex bin %s", vl->GetName()));
756 o = c->FindObject("byCentrality");
758 TList* bc = static_cast<TList*>(o);
760 DrawInPad(fBody, GetH3(bc, "FMD1I"), "box", 0);
761 DrawInPad(fBody, GetH3(bc, "FMD2I"), "box same", 0);
762 DrawInPad(fBody, GetH3(bc, "FMD2O"), "box same", 0);
763 DrawInPad(fBody, GetH3(bc, "FMD3O"), "box same", 0);
764 DrawInPad(fBody, GetH3(bc, "FMD3I"), "box same", kLegend);
767 //____________________________________________________________________
770 Info("DrawCentral", "Drawing central (SPD)");
771 TCollection* c = fSums;
777 Bool_t secondary=false, acceptance=false;
778 if (GetParameter(c, "secondary", secondary))
779 DrawParameter(y, "Secondary corr.", secondary ? "yes" : "no");
780 if (GetParameter(c, "acceptance", acceptance))
781 DrawParameter(y, "Acceptance corr.", acceptance ? "yes" : "no");
784 DrawInPad(fBody, 2, GetH2(c, "coverage"), "col", 0,
785 "#eta coverage per v_{z}");
786 TH2* cvst = GetH2(c, "nClusterVsnTracklet");
788 // cvst->Scale(1, "width");
789 cvst->GetXaxis()->SetTitle("N_{free cluster}");
790 cvst->GetYaxis()->SetTitle("N_{tracklet}");
791 cvst->GetXaxis()->SetRangeUser(1,10000);
792 cvst->GetYaxis()->SetRangeUser(1,10000);
794 DrawInPad(fBody, 3, cvst, "colz", kLogx|kLogy|kLogz,
795 "Correlation of # of tracklets and clusters");
796 DrawInPad(fBody, 4, GetH2(c, "clusterPerTracklet"), "colz", 0x0,
797 "# clusters per tracklet vs #eta");
798 ShowSliceFit(true, cvst, 3, fBody, 3, 0x8000|kLogz);
800 fBody->cd(1)->Modified();
801 fBody->cd(2)->Modified();
802 fBody->cd(3)->Modified();
803 fBody->cd(4)->Modified();
804 fBody->cd(1)->Update();
805 fBody->cd(2)->Update();
806 fBody->cd(3)->Update();
807 fBody->cd(4)->Update();
808 PrintCanvas("Central - overview");
813 TRegexp regexp("[pm][0-9]+_[pm][0-9]+");
814 while ((o = next())) {
815 TString name(o->GetName());
816 if (name.Index(regexp) == kNPOS) continue;
818 TList* vl = static_cast<TList*>(o);
822 DrawInPad(fBody, 1, GetH1(vl, "acceptance"), "", 0);
824 TH1* sec = GetH1(vl, "secondary");
825 sec->SetMarkerStyle(21);
826 sec->SetMarkerSize(1.2);
827 DrawInPad(fBody, 2, sec, "", 0);
828 DrawInPad(fBody, 2, GetH1(vl, "secondaryFiducial"), "same", 0x0);
829 DrawInPad(fBody, 3, GetH2(vl, "secondaryMapFiducial"), "colz", 0);
830 DrawInPad(fBody, 3, GetH2(vl, "hitMap"), "box same", 0x0);
832 fBody->cd(1)->Modified();
833 fBody->cd(2)->Modified();
834 fBody->cd(3)->Modified();
835 fBody->cd(1)->Update();
836 fBody->cd(2)->Update();
837 fBody->cd(3)->Update();
838 PrintCanvas(Form("Central - Vertex bin %s", vl->GetName()));
843 //____________________________________________________________________
844 void AddToAll(THStack* all, const THStack* stack, Int_t curr, Int_t step)
848 TIter next(stack->GetHists());
850 while ((h = static_cast<TH1*>(next()))) {
851 TH1* copy = static_cast<TH1*>(h->Clone(Form("%s_copy", h->GetName())));
852 copy->SetDirectory(0);
854 copy->SetMarkerColor(kGray);
855 copy->SetLineColor(kGray);
860 //____________________________________________________________________
861 void AddToAll(THStack* all, const THStack* stack)
865 TIter next(stack->GetHists());
867 while ((h = static_cast<TH1*>(next()))) {
868 TH1* copy = static_cast<TH1*>(h->Clone(Form("%s_copy", h->GetName())));
869 copy->SetDirectory(0);
870 copy->SetMarkerColor(kGray);
871 copy->SetLineColor(kGray);
876 //____________________________________________________________________
877 void DrawStep(Int_t step,
886 if (all->GetHists()->GetEntries() <= 0 || !cur) return;
888 // Info("", "Drawing step # %d", step);
889 Bool_t left = sub % nCol == 1;
890 Bool_t right= sub % nCol == 0;
891 Bool_t top = (sub-1) / nCol == 0;
892 TVirtualPad* p = can->cd(sub);
893 gStyle->SetOptTitle(0);
894 p->SetTitle(Form("Step # %d", step));
895 p->SetFillColor(kWhite);
896 p->SetRightMargin(right ? 0.02 : 0);
897 p->SetTopMargin(top ? 0.02 : 0); // 0.02);
898 // Info("", "Drawing step %d in sub-pad %d (%s)",
899 // step, sub, (left?"left":"right"));
902 all->Draw("nostack");
903 all->GetHistogram()->SetXTitle("#eta");
904 all->GetHistogram()->SetYTitle("signal");
907 static_cast<TLegendEntry*>(leg->GetListOfPrimitives()->At(step-1));
909 e->SetMarkerColor(kBlack);
910 e->SetLineColor(kBlack);
911 e->SetTextColor(kBlack);
915 gROOT->SetSelectedPad(p);
916 cur->DrawClone("same nostack");
919 TLatex* ltx = new TLatex(.97, .97, title);
921 ltx->SetTextSize(.06);
922 ltx->SetTextAlign(33);
925 ltx = new TLatex((left ? .12 : .02), .97, p->GetTitle());
927 ltx->SetTextSize(.06);
928 ltx->SetTextAlign(13);
932 Double_t x1 = 0.5*(p->GetUxmax()+p->GetUxmin());
934 Double_t y1 = p->GetUymax();
935 Double_t y2 = 0.92*y1;
938 x1 = 0.99*p->GetUxmin();
940 y1 = .5*(p->GetUymax()+p->GetUymin());
944 // Info("", "Arrow at (x1,y1)=%f,%f (x2,y2)=%f,%f", x1, y1, x2, y2);
945 TArrow* a = new TArrow(x1, y1, x2, y2, sz, "|>");
946 // (fLandscape ? "<|" : "|>"));
947 a->SetFillColor(kGray+1);
948 a->SetLineColor(kGray+1);
956 e->SetMarkerColor(kGray);
957 e->SetLineColor(kGray);
958 e->SetTextColor(kGray);
960 gStyle->SetOptTitle(1);
963 //____________________________________________________________________
964 void FixStack(THStack* stack, const TString& title,
965 const TString& extra, Int_t marker)
968 stack->SetTitle(title);
969 TIter next(stack->GetHists());
971 while ((h = static_cast<TH1*>(next()))) {
972 h->SetMarkerStyle(marker);
973 TString tit(h->GetTitle());
974 tit.ReplaceAll("cache", "");
979 void AddLegendEntry(TLegend* l,
981 const TString& title)
985 TLegendEntry* e = l->AddEntry("dummy", title.Data(), "pl");
986 e->SetMarkerStyle(h->GetMarkerStyle());
987 e->SetMarkerColor(kGray);
988 e->SetLineColor(kGray);
989 e->SetTextColor(kGray);
993 //____________________________________________________________________
996 // MakeChapter(can, "Steps");
998 THStack* esds = GetStack(GetCollection(fResults, "fmdSharingFilter"),
999 "sumsESD", "summedESD");
1000 THStack* deltas = GetStack(GetCollection(fResults, "fmdSharingFilter"),
1002 THStack* nchs = GetStack(GetCollection(fResults,
1003 "fmdDensityCalculator"),
1004 "sums", "inclDensity");
1005 THStack* prims = GetStack(GetCollection(fResults, "fmdCorrector"),
1006 "sums", "primaryDensity");
1007 THStack* rings = GetStack(GetCollection(fResults, "ringResults"), "all");
1008 THStack* mcRings = GetStack(GetCollection(fResults, "mcRingResults", false),
1009 "all","dndeta_eta", false);
1010 TH1* dndeta = GetH1(fResults, "dNdeta");
1011 if (dndeta) dndeta->SetMarkerColor(kBlack);
1013 FixStack(esds, "#sum_{s} #Delta/#Delta_{mip}", "", 20);
1014 FixStack(deltas, "#sum_{c} #Delta/#Delta_{mip}", "", 21);
1015 FixStack(nchs, "#sum_{b} N_{ch,incl}", "", 22);
1016 FixStack(prims, "#sum_{b} N_{ch,primary}", "", 23);
1017 FixStack(rings, "dN/d#eta per ring", "", 33);
1018 FixStack(mcRings,"dN/d#eta per ring (MC)", "(MC)", 34);
1020 THStack* all = new THStack;
1021 AddToAll(all, mcRings);
1022 AddToAll(all, esds);
1023 AddToAll(all, deltas);
1024 AddToAll(all, nchs);
1025 AddToAll(all, prims);
1026 AddToAll(all, rings);
1030 res = static_cast<TH1*>(dndeta->Clone("dNdeta"));
1031 res->SetTitle("dN/d#eta");
1032 res->SetMarkerColor(kGray);
1033 res->SetLineColor(kGray);
1034 res->SetDirectory(0);
1038 TLegend* l = new TLegend(.35, .2, .55, .9);
1039 l->SetFillColor(kWhite);
1041 l->SetBorderSize(0);
1042 TLegendEntry* e = 0;
1046 h = static_cast<TH1*>(mcRings->GetHists()->At(0));
1047 AddLegendEntry(l, h, mcRings->GetTitle());
1051 h = static_cast<TH1*>(esds->GetHists()->At(0));
1052 AddLegendEntry(l, h, esds->GetTitle());
1056 h = static_cast<TH1*>(deltas->GetHists()->At(0));
1057 AddLegendEntry(l, h, deltas->GetTitle());
1061 h = static_cast<TH1*>(nchs->GetHists()->At(0));
1062 AddLegendEntry(l, h, nchs->GetTitle());
1066 h = static_cast<TH1*>(prims->GetHists()->At(0));
1067 AddLegendEntry(l, h, prims->GetTitle());
1071 h = static_cast<TH1*>(rings->GetHists()->At(0));
1072 AddLegendEntry(l, h, rings->GetTitle());
1077 AddLegendEntry(l, h, h->GetTitle());
1080 TObject* objs[] = { mcRings,
1087 const char* titles[] = { /* 1 */ "MC",
1088 /* 2 */ "ESD input",
1089 /* 3 */ "After merging",
1090 /* 4 */ "After particle counting",
1091 /* 5 */ "After corrections",
1092 /* 6 */ "After normalization",
1093 /* 7 */ "After combining" };
1094 Int_t nY = mcRings ? 4 : 3;
1101 fBody->Divide(nX, nY, 0, 0);
1104 for (Int_t i = 0; i < 7; i++) {
1105 TObject* obj = objs[i];
1112 case 1: padNo = 1; break;
1113 case 2: padNo = 3; break;
1114 case 3: padNo = 5; break;
1115 case 4: padNo = (mcRings ? 7 : 2); break;
1116 case 5: padNo = (mcRings ? 2 : 4); break;
1117 case 6: padNo = (mcRings ? 4 : 6); break;
1118 case 7: padNo = (mcRings ? 6 : 8); break;
1121 //Printf("Drawing step %d in sub-pad %d (%s)",step,padNo,obj->GetTitle());
1122 DrawStep(step, all, obj, l, titles[i], fBody, padNo, nX);
1125 if (!esds && !mcRings && deltas) {
1127 TLegend* ll = new TLegend(0.01, 0.11, 0.99, 0.99);
1129 ll->SetFillColor(kWhite);
1130 ll->SetFillStyle(0);
1131 ll->SetBorderSize(0);
1133 TIter next(deltas->GetHists());
1135 while ((hh = static_cast<TH1*>(next()))) {
1136 e = ll->AddEntry("dummy", hh->GetTitle(), "pl");
1137 e->SetMarkerColor(hh->GetMarkerColor());
1138 e->SetMarkerStyle(hh->GetMarkerStyle());
1139 e->SetLineColor(kBlack);
1143 // Printf("Done drawing steps");
1144 PrintCanvas("Steps");
1148 //____________________________________________________________________
1151 // MakeChapter(can, "Results");
1155 TCollection* c = GetCollection(fResults, "ringResults");
1158 THStack* mcRings = GetStack(GetCollection(fResults, "mcRingResults", false),
1159 "all", "dndeta_eta", false);
1161 TH1* dndeta_phi = GetH1(fResults, "dNdeta");
1162 TH1* dndeta_eta = GetH1(fResults, "dNdeta_");
1163 dndeta_phi->SetTitle("1/N_{ev}dN_{ch}/d#eta (#varphi norm)");
1164 dndeta_eta->SetTitle("1/N_{ev}dN_{ch}/d#eta (#eta norm)");
1165 dndeta_eta->SetMarkerSize(0.7);
1167 THStack* allPhi = new THStack("phiAcc", "#varphi Acceptance");
1168 THStack* allEta = new THStack("etaCov", "#eta Coverage");
1169 const char** pring = GetRingNames(false);
1172 TCollection* cc = GetCollection(c, *pring);
1173 TH1* etaCov = GetH1(cc, "etaCov");
1174 TH1* phiAcc = GetH1(cc, "phiAcc");
1175 TH1* dndeta = GetH1(cc, "dndeta_phi");
1176 Int_t color = kBlack;
1177 if (dndeta) color = dndeta->GetMarkerColor();
1179 etaCov->SetTitle(*pring);
1180 etaCov->SetFillColor(color);
1181 etaCov->SetLineColor(color);
1182 allEta->Add(etaCov);
1185 phiAcc->SetFillColor(color);
1186 phiAcc->SetLineColor(color);
1187 allPhi->Add(phiAcc);
1191 Double_t savX = fParVal->GetX();
1192 Double_t savY = fParVal->GetY();
1195 TVirtualPad* p = fBody->cd(1);
1197 DrawInPad(p, 1, GetStack(c, "all"), "nostack", mcRings ? 0 : kLegend,
1198 "Individual ring results");
1199 DrawInPad(p, 1, mcRings, "nostack same", kLegend|kSilent);
1200 DrawInPad(p, 2, allEta, "nostack hist", kLegend,
1201 "#phi acceptance and #eta coverage per ring");
1202 DrawInPad(p, 2, allPhi, "nostack hist same", 0x0);
1206 DrawInPad(p, 1, dndeta_phi, "", 0x0,
1207 "1/#it{N}_{ev} d#it{N}_{ch}/d#it{#eta}");
1208 DrawInPad(p, 1, dndeta_eta, "Same", kLegend);
1209 DrawInPad(p, 2, GetH1(fResults, "norm"), "", 0x0,
1210 "Total #phi acceptance and #eta coverage");
1211 DrawInPad(p, 2, GetH1(fResults, "phi"), "same", kLegend);
1212 // DrawInPad(fBody, 4, GetH1(fSums, "d2Ndetadphi"), "colz");
1215 // TLatex* l = new TLatex(.5, .2, "Ring results");
1217 // l->SetTextAlign(21);
1221 // l->DrawLatex(.5, .2, "1/N_{ev}dN_{ch}/d#eta");
1224 // l->DrawLatex(.5, .2, "1/N_{ev}dN_{ch}/d#eta (#vta norm.)");
1226 fParVal->SetX(savX);
1227 fParVal->SetY(savY);
1228 PrintCanvas("Results");
1231 //____________________________________________________________________
1232 void DrawCentralResults()
1234 // MakeChapter(can, "Results");
1235 Info("DrawCentralResults", "Drawing central results");
1237 fBody->Divide(1,2,0,0);
1239 TH1* dndeta_ = GetH1(fResults, "dNdeta_");
1240 TH1* dndeta = GetH1(fResults, "dNdeta");
1241 THStack* stack = new THStack("dndetas",
1242 "d#it{N}_{ch}/d#it{#eta} - central");
1243 stack->Add(dndeta_);
1246 DrawInPad(fBody, 1, stack, "nostack");
1247 TH1* h = stack->GetHistogram();
1249 h->SetXTitle("#it{#eta}");
1250 h->SetYTitle("#frac{d#it{N}_{ch}}{d#it{#eta}}");
1253 TLegend* l = new TLegend(.3, .05, .7, .4);
1256 l->SetBorderSize(0);
1257 l->AddEntry(dndeta_, "Normalized to coverage", "lp");
1258 l->AddEntry(dndeta, "Normalized to #phi acceptance", "lp");
1261 DrawInPad(fBody, 2, GetH1(fResults, "norm"));
1262 DrawInPad(fBody, 2, GetH1(fResults, "phi"), "same", kLegend);
1264 PrintCanvas("Central Results");
1267 void DrawBoth(TFile* file)
1269 Info("DrawBoth", "Drawing central & forward results");
1270 TCollection* central = GetCollection(file, "CentralResults");
1271 TCollection* forward = GetCollection(file, "ForwardResults");
1273 if (!central || !forward) {
1274 Warning("DrawBoth", "central %p or forward %p results not found",
1279 TH1* f1 = GetH1(forward, "dNdeta_");
1280 TH1* c1 = GetH1(central, "dNdeta_");
1281 TH1* f2 = GetH1(forward, "dNdeta");
1282 TH1* c2 = GetH1(central, "dNdeta");
1283 f1->SetLineColor(kBlack);
1284 f2->SetLineColor(kBlack);
1285 c1->SetLineColor(kBlack);
1286 c2->SetLineColor(kBlack);
1287 f1->SetMarkerColor(f2->GetMarkerColor());
1288 f1->SetMarkerStyle(24);
1289 c1->SetMarkerStyle(24);
1290 c2->SetMarkerStyle(20);
1291 c2->SetMarkerColor(c1->GetMarkerColor());
1292 THStack* s = new THStack("dndetas", "d#it{N}_{ch}/d#it{#eta}");
1298 fBody->Divide(1, 2, 0, 0);
1299 DrawInPad(fBody, 1, s, "nostack");
1300 s->GetHistogram()->SetXTitle("#it{#eta}");
1301 s->GetHistogram()->SetYTitle("#frac{d#it{N}_{ch}}{d#it{#eta}}");
1304 TLegend* l = new TLegend(.4, .05, .8, .4);
1307 l->SetBorderSize(0);
1308 TLegendEntry* entry = l->AddEntry("dummy", "Forward", "f");
1309 entry->SetFillColor(f1->GetMarkerColor());
1310 entry->SetLineColor(f1->GetMarkerColor());
1311 entry->SetFillStyle(1001);
1312 entry->SetLineWidth(0);
1313 entry = l->AddEntry("dummy", "Central", "f");
1314 entry->SetFillColor(c1->GetMarkerColor());
1315 entry->SetLineColor(c1->GetMarkerColor());
1316 entry->SetLineWidth(0);
1317 entry->SetFillStyle(1001);
1318 entry = l->AddEntry("dummy", "Normalized to coverage", "lp");
1319 entry->SetMarkerStyle(f1->GetMarkerStyle());
1320 entry = l->AddEntry("dummy", "Normalized to #phi acceptance", "lp");
1321 entry->SetMarkerStyle(f2->GetMarkerStyle());
1324 TH1* f3 = GetH1(forward, "norm");
1325 TH1* c3 = GetH1(central, "norm");
1326 TH1* f4 = GetH1(forward, "phi");
1327 TH1* c4 = GetH1(central, "phi");
1328 f3->SetFillColor(f1->GetMarkerColor());
1329 f4->SetFillColor(f1->GetMarkerColor());
1330 c3->SetFillColor(c1->GetMarkerColor());
1331 c4->SetFillColor(c1->GetMarkerColor());
1332 f3->SetLineColor(f1->GetMarkerColor());
1333 f4->SetLineColor(f1->GetMarkerColor());
1334 c3->SetLineColor(c1->GetMarkerColor());
1335 c4->SetLineColor(c1->GetMarkerColor());
1337 THStack* a = new THStack("norms", "Normalizations");
1343 a->SetMaximum(a->GetMaximum("nostack")*1.2);
1344 DrawInPad(fBody, 2, a, "nostack");
1345 a->GetHistogram()->SetXTitle("#it{#eta}");
1346 a->GetHistogram()->SetYTitle("Normalization (coverage or acceptance)");
1349 l = new TLegend(.2, .94, .9, .99);
1352 l->SetBorderSize(0);
1354 // entry = l->AddEntry("dummy", "Forward", "f");
1355 // entry->SetFillColor(f1->GetMarkerColor());
1356 // entry->SetLineColor(f1->GetMarkerColor());
1357 // entry->SetFillStyle(1001);
1358 // entry->SetLineWidth(0);
1359 // entry = l->AddEntry("dummy", "Central", "f");
1360 // entry->SetFillColor(c1->GetMarkerColor());
1361 // entry->SetLineColor(c1->GetMarkerColor());
1362 // entry->SetLineWidth(0);
1363 // entry->SetFillStyle(1001);
1364 entry = l->AddEntry("dummy", "#eta Coverage", "f");
1365 entry->SetFillStyle(f3->GetFillStyle());
1366 entry->SetFillColor(kBlack);
1367 entry = l->AddEntry("dummy", "#phi Acceptance", "f");
1368 entry->SetFillStyle(f4->GetFillStyle());
1369 entry->SetFillColor(kBlack);
1372 PrintCanvas("Both results");
1375 TCollection* fResults;