1 #include "SummaryDrawer.C"
4 # include <TGraphErrors.h>
13 * Class to draw a summary of the AOD production
16 * - The merged <tt>forward.root</tt> file.
17 * If the file isn't merged, it should still work.
20 * - A PDF file named after the input, but with <tt>.root</tt>
21 * replaced with <tt>pdf</tt>
24 class SummaryAODDrawer : public SummaryDrawer
28 kEventInspector = 0x001,
29 kSharingFilter = 0x002,
30 kDensityCalculator = 0x004,
32 kHistCollector = 0x010,
44 //__________________________________________________________________
45 TFile* Init(const char* fname)
47 // --- Open the file ---------------------------------------------
48 TString filename(fname);
49 TFile* file = TFile::Open(filename, "READ");
51 Error("Run", "Failed to open \"%s\"", filename.Data());
55 // --- Get top-level collection ----------------------------------
56 fSums = GetCollection(file, "ForwardSums");
58 Info("Run", "Trying old name Forward");
59 fSums = GetCollection(file, "Forward");
63 // --- Do the results ----------------------------------------------
64 fResults = GetCollection(file, "ForwardResults");
65 if (!fResults) fResults = fSums; // Old-style
69 void SummarizeSharing(const char* fname, UShort_t what=0)
71 // --- Initialize ------------------------------------------------
73 if (!(file = Init(fname))) return;
75 // --- Make our canvas -------------------------------------------
76 TString pdfName("sharing.pdf");
77 pdfName.ReplaceAll(".root", ".pdf");
78 CreateCanvas(pdfName, what & kLandscape, true, false);
80 TCollection* c = GetCollection(fSums, "fmdSharingFilter");
82 TCollection* rc = GetCollection(fResults, "fmdSharingFilter");
86 TParameter<int>* pnFiles =
87 static_cast<TParameter<int>*>(GetObject(c, "nFiles"));
89 nFiles = pnFiles->GetVal();
92 TCollection* lc = GetCollection(c, "lCuts");
93 TCollection* hc = GetCollection(c, "hCuts");
96 TH2* hLow = GetH2(c, "lowCuts");
97 TH2* hHigh = GetH2(c, "highCuts");
98 GetParameter(lc, "method", lm);
99 GetParameter(hc, "method", hm);
100 if (hLow && nFiles > 0 && !hLow->TestBit(BIT(20)))
101 hLow->Scale(1. / nFiles);
102 if (hHigh && nFiles > 0 && !hHigh->TestBit(BIT(20)))
103 hHigh->Scale(1. / nFiles);
105 DivideForRings(true,true);
106 const char** ptr = GetRingNames(false);
109 TCollection* sc = GetCollection(c, *ptr);
110 if (!sc) { ptr++; iq++; continue; }
111 UShort_t d = Int_t((*ptr)[3])-48;
112 Char_t r = (*ptr)[4];
114 TH1* esdELoss = GetH1(sc, "esdEloss");
115 TH1* anaELoss = GetH1(sc, "anaEloss");
116 TGraph* lowCut = CreateCutGraph(lm, iq, hLow, esdELoss, kYellow+1);
117 TGraph* highCut = CreateCutGraph(hm, iq, hHigh, esdELoss, kCyan+1);
118 // Double_t ignCut = TMath::Max(lowCut->GetX()[3],0.);
119 // Int_t esdLow = esdELoss->FindBin(ignCut);
120 // Int_t anaLow = anaELoss->FindBin(ignCut);
121 // Double_t esdInt = esdELoss->Integral(esdLow,esdELoss->GetNbinsX()+1);
122 // Double_t anaInt = anaELoss->Integral(anaLow,anaELoss->GetNbinsX()+1);
123 // Double_t frac = esdInt > 0 ? (esdInt-anaInt)/esdInt : 1;
124 esdELoss->GetXaxis()->SetRangeUser(-.1, 2);
126 DrawInRingPad(d,r, esdELoss, "", kLogy, *ptr);
127 // "#Delta/#Delta_{mip} reconstructed and merged");
128 DrawInRingPad(d, r, anaELoss, "same");
129 DrawInRingPad(d, r, lowCut, "lf same");
130 DrawInRingPad(d, r, highCut, "lf same");
134 TVirtualPad* p = RingPad(0,0);
136 TLegend* l = new TLegend(0.1, 0.1, 0.98, 0.98, "");
141 e = l->AddEntry("dummy", "ESD signal", "f");
142 e->SetFillStyle(3002);
143 e->SetFillColor(kBlack);
144 e = l->AddEntry("dummy", "Merged signal", "f");
145 e->SetFillStyle(3001);
146 e->SetFillColor(kBlack);
147 e = l->AddEntry("dummy", "Low cut", "f");
148 e->SetFillStyle(3002);
149 e->SetFillColor(kYellow+1);
151 e->SetLineColor(kWhite);
152 e = l->AddEntry("dummy", "High cut", "f");
153 e->SetFillStyle(3002);
154 e->SetFillColor(kCyan+1);
156 e->SetLineColor(kWhite);
159 PrintCanvas("Summary of sharing filter");
163 void SummarizeSteps(const char* fname, UShort_t what=0)
165 // --- Initialize ------------------------------------------------
167 if (!(file = Init(fname))) return;
169 // --- Make our canvas -------------------------------------------
170 TString pdfName("steps.pdf");
171 pdfName.ReplaceAll(".root", ".pdf");
172 CreateCanvas(pdfName, what & kLandscape, true, false);
177 //__________________________________________________________________
184 void Run(const char* fname, UShort_t what=kNormal)
186 // --- Initialize ------------------------------------------------
188 if (!(file = Init(fname))) return;
190 // --- Make our canvas -------------------------------------------
191 TString pdfName(fname);
192 pdfName.ReplaceAll(".root", ".pdf");
193 CreateCanvas(pdfName, what & kLandscape);
196 // --- Possibly make a chapter here ------------------------------
197 TCollection* centralSums = GetCollection(file, "CentralSums", false);
199 Info("Run", "Trying old name \"Central\"");
200 centralSums = GetCollection(file, "Central", false);
202 if (what & kCentral && centralSums)
203 MakeChapter("Forward");
205 // --- Set pause flag --------------------------------------------
206 fPause = what & kPause;
208 // Plot status if found
209 TH1* hStatus = GetH1(fSums, "status", false);
211 hStatus->SetMaximum(hStatus->GetMaximum()*1.2);
212 fBody->SetRightMargin(0.10);
213 DrawInPad(fBody,0,hStatus, "hist text30");
214 PrintCanvas("Status");
217 // --- Do each sub-algorithm -------------------------------------
218 if (what & kEventInspector) DrawEventInspector(fSums);
219 if (what & kESDFixer) DrawESDFixer(fSums);
220 if (what & kSharingFilter) DrawSharingFilter();
221 if (what & kDensityCalculator) DrawDensityCalculator();
222 if (what & kCorrector) DrawCorrector();
223 if (what & kHistCollector) DrawHistCollector();
226 if (what & kSteps) DrawSteps();
227 if (what & kResults) DrawResults();
229 // --- SPD clusters ----------------------------------------------
230 if (what & kCentral) {
231 // --- Get top-level collection --------------------------------
232 fSums = GetCollection(file, "CentralSums");
234 fSums = GetCollection(file, "Central");
236 MakeChapter("Central");
238 if (what & kEventInspector) DrawEventInspector(fSums);
240 fResults = GetCollection(file, "CentralResults");
241 if (fResults && (what & kResults)) {
242 DrawCentralResults();
245 if (what & kResults) DrawBoth(file);
252 //____________________________________________________________________
253 void DrawTitlePage(TFile* f)
257 TLatex* ltx = new TLatex(.5, .7, "ESD #rightarrow AOD filtering");
259 ltx->SetTextSize(0.07);
260 ltx->SetTextAlign(22);
263 TCollection* fwd = fSums; // GetCollection(f, "ForwardSums");
264 TCollection* cen = GetCollection(f, "CentralSums");
267 Double_t save = fParName->GetTextSize();
268 fParName->SetTextSize(0.03);
269 fParVal->SetTextSize(0.03);
271 DrawParameter(y, "Tasks", (fwd ? "Forward" : ""));
272 DrawParameter(y, "", (cen ? "Central" : ""));
275 TCollection* ei = GetCollection(fwd, "fmdEventInspector");
278 UShort_t sys=0, sNN=0;
282 GetParameter(ei, "sys", sys);
283 GetParameter(ei, "sNN", sNN);
284 GetParameter(ei, "field", field);
285 GetParameter(ei, "runNo", runNo);
286 if (!GetParameter(ei, "mc", mc, false)) mc = false;
288 TString sysString; SysString(sys, sysString);
289 TString sNNString; SNNString(sNN, sNNString);
291 DrawParameter(y, "System", sysString);
292 DrawParameter(y, "#sqrt{s_{NN}}", sNNString);
293 DrawParameter(y, "L3 B field", Form("%+2dkG", field));
294 DrawParameter(y, "Run #", Form("%6lu", runNo));
295 DrawParameter(y, "Simulation", (mc ? "yes" : "no"));
298 PrintCanvas("Title page");
299 fParName->SetTextSize(save);
300 fParVal->SetTextSize(save);
302 TGraph* CreateCutGraph(Int_t method, Int_t iy, TH2* cuts, TH1* eloss,
305 TGraph* ret = new TGraph(4);
306 Double_t y0 = TMath::Max(eloss->GetMinimum(),1.);
307 Double_t y1 = eloss->GetMaximum();
310 Int_t iiy = (iy == 4 ? 5 : iy == 5 ? 4 : iy);
311 if (method == 0) { // Fixed value
312 max = cuts->GetBinContent(1, iiy);
313 min = eloss->GetXaxis()->GetXmin();
316 for (Int_t ix=1; ix <= cuts->GetNbinsX(); ix++) {
317 Double_t c = cuts->GetBinContent(ix, iiy);
318 if (c <= 0.0001) continue;
319 min = TMath::Min(c, min);
320 max = TMath::Max(c, max);
323 // Printf("Cuts between %f,%f @%f, %f", min, max, y0,y1);
324 ret->SetPoint(0, min, y0);
325 ret->SetPoint(1, min, y1);
326 ret->SetPoint(2, max, y1);
327 ret->SetPoint(3, max, y0);
328 ret->SetFillColor(color);
329 ret->SetFillStyle(3002);
330 ret->SetLineColor(kBlack);
331 ret->SetLineStyle(2);
332 ret->SetName(Form("g%s", cuts->GetName()));
333 ret->SetTitle(cuts->GetTitle());
337 //____________________________________________________________________
338 const Char_t* CutMethodName(Int_t lm) const
341 case 0: return "c=X";
342 case 1: return "c=X#times#Delta_{p}";
343 case 2: return "c:Lower bound of fit range";
344 case 3: return "c=#Delta_{p}-X#times#xi";
345 case 4: return "c=#Delta_{p}-X#times(#xi+#sigma)";
346 case 5: return "c:P(#Delta<c)<X";
350 //____________________________________________________________________
351 Int_t PrintCut(const TCollection* c, Double_t& y, const Char_t* name,
357 if (!GetParameter(c, "method", method)) return -1;
358 DrawParameter(y, name, CutMethodName(method), size);
361 const char* cuts[] = { "fmd1i", "fmd2i", "fmd2o", "fmd3i", "fmd3o", 0 };
362 const char** pcut = cuts;
365 GetParameter(c, *pcut, cut, false);
366 if (pcut != cuts) params.Append(", ");
367 params.Append(Form("%5.2f", cut));
370 if (params.IsNull()) {
372 GetParameter(c, "frac", frac);
373 params = Form("%f", frac);
375 DrawParameter(y, "Parameters", params, size);
378 //____________________________________________________________________
379 void DrawCut(TVirtualPad* parent, Int_t sub, TH2* cuts)
382 THStack* stack = new THStack(cuts,"x");
383 stack->SetTitle(cuts->GetTitle());
384 for (Int_t i = 1; i <= cuts->GetNbinsY(); i++) {
385 TH1* hist = static_cast<TH1*>(stack->GetHists()->At(i-1));
386 TString name(cuts->GetYaxis()->GetBinLabel(i));
387 UShort_t det = UShort_t(name[3]-48);
388 Char_t rng = name[4];
389 Color_t col = RingColor(det, rng);
390 hist->SetDirectory(0);
391 hist->SetTitle(name);
392 hist->SetMarkerStyle(20);
393 hist->SetMarkerColor(col);
394 hist->SetLineColor(col);
395 hist->SetFillColor(col);
396 hist->SetLineWidth(0);
397 hist->SetFillStyle(0);
398 hist->SetXTitle("#eta");
399 hist->SetYTitle(cuts->GetZaxis()->GetTitle());
401 DrawInPad(parent, sub, stack, "nostack p", kLegend|kCenter|kSouth);
403 //____________________________________________________________________
404 void DrawSharingFilter()
406 Info("DrawSharingFilter", "Drawing sharing filter");
407 TCollection* c = GetCollection(fSums, "fmdSharingFilter");
409 TCollection* rc = GetCollection(fResults, "fmdSharingFilter");
412 // --- Draw summary information ----------------------------------
413 fBody->Divide(1, 3, 0, 0);
417 Bool_t angle=false, lowSignal=false, disabled=false;
419 if (GetParameter(c, "angle", angle))
420 DrawParameter(y, "Angle correct", (angle ? "yes" : "no"));
421 if (GetParameter(c, "lowSignal", lowSignal))
422 DrawParameter(y, "Lower signal", (lowSignal ? "yes" : "no"));
423 TParameter<int>* pnFiles =
424 static_cast<TParameter<int>*>(GetObject(c, "nFiles"));
426 nFiles = pnFiles->GetVal();
427 DrawParameter(y, "# files merged", Form("%d", nFiles));
429 if (GetParameter(c, "disabled", disabled, false))
430 DrawParameter(y, "Merging disabled", (disabled ? "yes" : "no"));
437 Bool_t simple=false, three=false;
438 if (GetParameter(c, "simple", simple))
439 DrawParameter(y, "Simple method", (simple ? "yes" : "no"));
440 if (GetParameter(c, "sumThree", three))
441 DrawParameter(y, "3-strip merging", (three ? "yes" : "no"));
443 TCollection* lc = GetCollection(c, "lCuts");
444 TCollection* hc = GetCollection(c, "hCuts");
445 lm = PrintCut(lc, y, "Low cut");
446 hm = PrintCut(hc, y, "High cut");
447 hLow = GetH2(c, "lowCuts");
448 hHigh = GetH2(c, "highCuts");
449 if (hLow && nFiles > 0 && !hLow->TestBit(BIT(20)))
450 hLow->Scale(1. / nFiles);
451 if (hHigh && nFiles > 0 && !hHigh->TestBit(BIT(20)))
452 hHigh->Scale(1. / nFiles);
453 DrawCut(fBody, 2, hLow);
454 DrawCut(fBody, 3, hHigh);
456 PrintCanvas("Sharing filter");
459 // --- Draw rings individually -----------------------------------
460 Double_t savX = fParVal->GetX();
461 Double_t savY = fParVal->GetY();
464 const char** ptr = GetRingNames(false);
467 TCollection* sc = GetCollection(c, *ptr);
468 if (!sc) { ptr++; iq++; continue; }
470 if (fLandscape) fBody->Divide(3, 2);
471 else fBody->Divide(2,3);
473 TH1* esdELoss = GetH1(sc, "esdEloss");
474 TH1* anaELoss = GetH1(sc, "anaEloss");
475 TGraph* lowCut = CreateCutGraph(lm, iq, hLow, esdELoss, kYellow+1);
476 TGraph* highCut = CreateCutGraph(hm, iq, hHigh, esdELoss, kCyan+1);
477 Double_t ignCut = TMath::Max(lowCut->GetX()[3],0.);
478 Int_t esdLow = esdELoss->FindBin(ignCut);
479 Int_t anaLow = anaELoss->FindBin(ignCut);
480 Double_t esdInt = esdELoss->Integral(esdLow,esdELoss->GetNbinsX()+1);
481 Double_t anaInt = anaELoss->Integral(anaLow,anaELoss->GetNbinsX()+1);
482 Double_t frac = esdInt > 0 ? (esdInt-anaInt)/esdInt : 1;
483 esdELoss->GetXaxis()->SetRangeUser(-.1, 2);
485 DrawInPad(fBody, 1, esdELoss, "", kLogy,
486 "#Delta/#Delta_{mip} reconstructed and merged");
487 DrawInPad(fBody, 1, anaELoss, "same");
488 DrawInPad(fBody, 1, lowCut, "lf same");
489 DrawInPad(fBody, 1, highCut, "lf same", kLogy|kLegend|kNorth|kWest);
490 TVirtualPad* p = fBody->GetPad(1);
492 TLatex* l = new TLatex(1-p->GetRightMargin(),
493 0.5, Form("Loss: %5.1f%%", frac*100));
497 l->DrawLatex(1-p->GetRightMargin(), 0.45,
498 Form("%f #rightarrow #infty", ignCut));
500 TH1* singles = GetH1(sc, "singleEloss");
501 TH1* doubles = GetH1(sc, "doubleEloss");
502 TH1* tripples = GetH1(sc, "tripleEloss");
503 Double_t int1 = singles->Integral(0,singles->GetNbinsX()+1);
504 Double_t int2 = doubles->Integral(0,doubles->GetNbinsX()+1);
505 Double_t int3 = tripples->Integral(0,tripples->GetNbinsX()+1);
506 Double_t intT = int1 + int2 + int3;
507 Double_t f1 = intT > 0 ? int1 / intT : 0;
508 Double_t f2 = intT > 0 ? int2 / intT : 0;
509 Double_t f3 = intT > 0 ? int3 / intT : 0;
511 singles->GetXaxis()->SetRangeUser(-.1, 2);
512 DrawInPad(fBody, 2, singles, "", kLogy,
513 "#Delta/#Delta_{mip} for single, double, and tripple hits");
514 DrawInPad(fBody, 2, doubles, "same", kLogy);
515 DrawInPad(fBody, 2, tripples, "same", kLogy);
516 DrawInPad(fBody, 2, lowCut, "lf same", kLogy);
517 DrawInPad(fBody, 2, highCut, "lf same", kLogy|kLegend|kNorth|kWest);
520 Double_t nameX = fParName->GetX();
521 Double_t valX = fParVal->GetX();
525 DrawParameter(intY, "Singles", Form("%5.1f%%", 100*f1), 0.05);
526 DrawParameter(intY, "Doubles", Form("%5.1f%%", 100*f2), 0.05);
527 DrawParameter(intY, "Tripples", Form("%5.1f%%", 100*f3), 0.05);
528 fParName->SetX(nameX);
531 DrawInPad(fBody, 3, GetH2(sc, "singlePerStrip"), "colz",kLogz);
532 // DrawInPad(fBody, 4, GetH1(sc, "distanceBefore"), "", 0x2);
533 // DrawInPad(fBody, 4, GetH1(sc, "distanceAfter"), "same", 0x12);
534 DrawInPad(fBody, 4, GetH2(sc, "summed"), "colz",0x0);
536 TH2* nB = GetH2(sc, "neighborsBefore");
538 nB->GetXaxis()->SetRangeUser(0,2);
539 nB->GetYaxis()->SetRangeUser(0,2);
541 DrawInPad(fBody, 5, nB, "colz cont3", kLogz,
542 "Correlation of neighbors before merging");
544 TH2* nA = GetH2(sc, "neighborsAfter");
546 nA->GetXaxis()->SetRangeUser(0,2);
547 nA->GetYaxis()->SetRangeUser(0,2);
549 DrawInPad(fBody, 6, nA, "colz cont3", kLogz,
550 "Correlation of neighbors after merging");
552 // DrawInPad(fBody, 6, GetH2(sc, "beforeAfter"), "colz", kLogz);
554 PrintCanvas(Form("Sharing filter - %s", *ptr));
562 // --- MC --------------------------------------------------------
563 TCollection* cc = GetCollection(c, "esd_mc_comparion", false); // Spelling!
565 cc = GetCollection(c, "esd_mc_comparison", false); // Spelling!
566 if (!cc) return; // Not MC
569 DivideForRings(false, false);
570 const char** ptr = GetRingNames(false);
572 TString nam(Form("%s_corr", *ptr));
573 TH2* hc = GetH2(cc, nam, false);
575 nam[4] = (nam[4] == 'I' ? 'i' : 'o');
576 hc = GetH2(cc, nam, false);
582 DrawInRingPad(hc, "colz", kLogz);
586 PrintCanvas("Sharing filter - MC vs Reco");
588 // --- MC --------------------------------------------------------
591 //__________________________________________________________________
593 * Draw a slice fit on a 2D histogram
595 * @param inY Whether to slice in Y
596 * @param h 2D histogram
597 * @param nVar Number of variances
598 * @param p Master pad to draw in
599 * @param sub Sub pad number
601 * @param cut Cut value
603 void ShowSliceFit(Bool_t inY, TH2* h, Double_t nVar,
604 TVirtualPad* p, Int_t sub, UShort_t flags=0,
608 TAxis* indep = (inY ? h->GetXaxis() : h->GetYaxis());
609 TAxis* dep = (inY ? h->GetYaxis() : h->GetXaxis());
612 TObjArray* fits = new TObjArray;
614 // FitSlicesX sets onX to true. If onX is true, then it calls
615 // ProjectionX for each Y bin. That is, we fit each X slice.
616 Int_t minB = dep->FindBin(0.)+1;
617 Int_t maxB = dep->GetNbins();
618 Info("", "Bin range: %d - %d", minB, maxB);
619 if (inY) h->FitSlicesY(0, minB, maxB, 10, "QN", fits);
620 else h->FitSlicesX(0, minB, maxB, 10, "QN", fits);
622 Warning("ShowSliceFit", "No fits returned");
626 // If inY is true then this is the mean,variance as a function of X
627 TH1* mean = static_cast<TH1*>(fits->At(1));
628 TH1* var = static_cast<TH1*>(fits->At(2));
630 Warning("ShowSliceFit", "Didn't get histograms");
635 TH1* hh[] = { mean, var, 0 };
636 for (Int_t ib=1; ib<=mean->GetNbinsX();ib++) {
639 if ((*hp)->GetBinContent(ib) <= 0) {
640 (*hp)->SetBinContent(ib,0);
641 (*hp)->SetBinError(ib,0);
648 // If inY is true then this is the mean,variance as a function of X
649 TF1* fmean = new TF1("mean", "pol1");
650 TF1* fvar = new TF1("var", "pol1");
651 mean->Fit(fmean, "Q0+");
652 var->Fit(fvar, "Q0+");
653 if (!fmean || !fvar) {
654 Warning("ShowSliceFit", "No functions returned");
659 TGraphErrors* g = new TGraphErrors(h->GetNbinsX());
660 g->SetName(Form("g%s", h->GetName()));
661 TString xTit = indep->GetTitle();
662 TString yTit = dep->GetTitle();
663 g->SetTitle(Form("Correlation of %s and %s",xTit.Data(),yTit.Data()));
664 g->SetFillColor(kBlue-10);
665 g->SetFillStyle(3001);
666 TGraph* up = (cut > 0 ? new TGraph(indep->GetNbins()) : 0);
667 TGraph* low = (cut > 0 ? new TGraph(indep->GetNbins()) : 0);
669 up ->SetLineColor(kBlack);
670 up ->SetLineWidth(2);
671 up ->SetLineStyle(2);
674 low->SetLineColor(kBlack);
675 low->SetLineWidth(2);
676 low->SetLineStyle(2);
678 for (Int_t i = 1; i <= h->GetNbinsX(); i++) {
679 Double_t x = indep->GetBinCenter(i);
680 Double_t y = fmean->Eval(x);
681 Double_t e = fvar->Eval(x);
682 // Double_t y = mean->GetBinContent(i);
683 // Double_t e = var->GetBinContent(i);
684 Double_t ee = nVar * e;
685 if (flags & 0x8000) ee *= e > 0 ? TMath::Log10(e) : 1;
687 g->SetPoint(i-1, x, y);
688 g->SetPointError(i-1, 0, ee);
691 g->SetPoint(i-1, y, x);
692 g->SetPointError(i-1, ee, 0);
695 if (inY) up->SetPoint(i-1,x,x+cut*x);
696 else up->SetPoint(i-1,y+cut*y,y);
699 if (inY) low->SetPoint(i-1,x,x-cut*x);
700 else low->SetPoint(i-1,y-cut*y,y);
703 DrawInPad(p, sub, g, "3", flags);
704 if (up) DrawInPad(p, sub, up, "l", flags);
705 if (low) DrawInPad(p, sub, low, "l", flags);
706 fmean->SetRange(indep->GetXmin(), indep->GetXmax());
707 fmean->SetLineWidth(2);
708 DrawInPad(p, sub, fmean, "same", flags);
710 TVirtualPad* pp = p->GetPad(sub);
711 Double_t y = 1-pp->GetTopMargin()-.01;
712 TLatex* l = new TLatex(.15, y,
713 Form("#LT%s#GT(%s) = "
715 yTit.Data(), xTit.Data(),
716 fmean->GetParameter(0),
717 fmean->GetParameter(1), xTit.Data()));
720 l->SetTextSize(fParVal->GetTextSize());
723 l->DrawLatex(0.15, y-0.07,
724 Form("#sigma_{%s}(%s) = "
726 yTit.Data(), xTit.Data(),
727 fvar->GetParameter(0),
728 fvar->GetParameter(1), xTit.Data()));
729 l->DrawLatex(0.15, y-0.14, Form("#delta = %3.1f %s #sigma",
731 flags & 0x8000 ? "log_{10}(#sigma)" : ""));
735 //____________________________________________________________________
736 void DrawDensityCalculator()
738 Info("DrawDensityCalculator", "Drawing density calculator");
739 TCollection* c = GetCollection(fSums, "fmdDensityCalculator");
746 Int_t maxParticles=0, phiAcceptance=0, etaLumping=0, phiLumping=0;
747 Bool_t method=false, recalcPhi=false;
748 Double_t maxOutliers=0, outlierCut=-1;
749 Double_t size = fLandscape ? 0.05 : 0.03;
751 GetParameter(c, "maxParticle", maxParticles);
753 if (GetParameter(c, "phiAcceptance", phiAcceptance))
754 DrawParameter(y, "#phi acceptance method",
755 (phiAcceptance == 1 ? "N_{ch}" :
756 phiAcceptance == 2 ? "#DeltaE" : "none"), size);
757 if (GetParameter(c, "etaLumping", etaLumping) &&
758 GetParameter(c, "phiLumping", phiLumping))
759 DrawParameter(y, "Region size (sector#timesstrip)",
760 Form("%2d #times %2d", phiLumping, etaLumping), size);
761 if (GetParameter(c, "method", method))
762 DrawParameter(y, "Method", (method ? "Poisson" : "#DeltaE"), size);
763 if (GetParameter(c, "recalcPhi", recalcPhi))
764 DrawParameter(y, "Recalculate #phi",(recalcPhi ? "yes" : "no"),size);
765 if (GetParameter(c, "maxOutliers", maxOutliers, false))
766 DrawParameter(y, "Max relative N_{outlier}",
767 Form("%5.3f",maxOutliers),size);
768 Bool_t hasOutCut = false;
769 if ((hasOutCut = GetParameter(c, "outlierCut", outlierCut, false)))
770 DrawParameter(y, "Max relative deviation",Form("%5.3f",outlierCut),size);
773 TParameter<int>* nFiles =
774 static_cast<TParameter<int>*>(GetObject(c, "nFiles"));
776 DrawParameter(y, "# files merged", Form("%d", nFiles->GetVal()), size);
778 TCollection* lc = GetCollection(c, "lCuts");
779 Int_t tm = PrintCut(lc, y, "Threshold", size);
781 TVirtualPad* p = fBody; // fBody->cd(2);
784 TH1* accI = GetH1(c, "accI");
785 TH1* accO = GetH1(c, "accO");
787 Double_t scale = 1./accI->GetMaximum();
791 accI->SetMaximum(1.3);
793 TH2* lCuts = GetH2(c, "lowCuts");
794 TH2* maxW = GetH2(c, "maxWeights");
795 if (lCuts) lCuts->SetTitle("Thresholds");
796 if (nFiles && lCuts) lCuts->Scale(1. / nFiles->GetVal());
797 if (nFiles && maxW) maxW->Scale(1. / nFiles->GetVal());
798 DrawInPad(p, 2, accI);
799 DrawInPad(p, 2, accO, "same", kLegend|kNorth|kCenter);
800 DrawCut(p, 3, lCuts);
803 PrintCanvas("Density calculator");
804 Float_t save = fParVal->GetTextSize();
805 fParVal->SetTextSize(0.03);
808 const char** ptr = GetRingNames(false);
810 TCollection* sc = GetCollection(c, *ptr);
811 if (!sc) { ptr++; continue; }
813 if (fLandscape) fBody->Divide(3,2);
814 else fBody->Divide(2,3);
816 TH2* corr = GetH2(sc, "elossVsPoisson");
817 TH2* corrOut = GetH2(sc, "elossVsPoissonOutlier", false);
818 TH1* diff = GetH1(sc, "diffElossPoisson");
819 TH1* diffOut = GetH1(sc, "diffElossPoissonOutlier", false);
820 TH1* eloss = GetH1(sc, "eloss");
821 TH1* elossUsed = GetH1(sc, "elossUsed");
822 TH1* occ = GetH1(sc, "occupancy");
823 if (eloss) eloss ->SetLineWidth(1);
824 if (elossUsed) elossUsed->SetLineWidth(1);
825 if (eloss) eloss->GetXaxis()->SetRangeUser(0.05, 2);
827 corr->SetXTitle("N_{ch,#Delta}");
828 corr->SetYTitle("N_{ch,Poisson}");
829 DrawInPad(fBody, 1, corr, "colz", kLogz);
831 DrawInPad(fBody,1, corrOut, "same", kLogz);
832 ShowSliceFit(true, corr, 10, fBody, 1, kLogz, outlierCut);
834 DrawInPad(fBody, 2, diff, "HIST E", kLogy);
836 DrawInPad(fBody,2, diffOut, "HIST E SAME", kLogy|kLegend|kNorth|kWest);
837 DrawInPad(fBody, 3, occ, "", kLogy);
838 DrawInPad(fBody, 4, eloss, "", kLogy,
839 "#Delta/#Delta_{mip} before and after cuts");
840 DrawInPad(fBody, 4, elossUsed, "same", kLogy);
841 TGraph* thres = CreateCutGraph(tm, iq, lCuts, eloss, kYellow+1);
842 DrawInPad(fBody, 4, thres, "lf same", kLogy|kLegend|kNorth|kWest);
844 if (eloss && elossUsed) {
845 Int_t lowBin = eloss->GetXaxis()->FindBin(0.)+1;
846 Int_t upBin = eloss->GetNbinsX()+1;
847 Double_t beforeInt = eloss->Integral(lowBin,upBin);
848 Double_t afterInt = elossUsed->Integral(lowBin,upBin);
849 Double_t frac = beforeInt > 0 ? (beforeInt-afterInt)/beforeInt : 1;
850 TVirtualPad* pp = fBody->GetPad(4);
852 TLatex* l = new TLatex(1-pp->GetRightMargin(),
853 0.5, Form("Loss: %5.1f%%", frac*100));
860 TH1* phiB = GetH1(sc, "phiBefore");
861 TH1* phiA = GetH1(sc, "phiAfter");
862 TH1* outliers = GetH1(sc, "outliers", false);
864 DrawInPad(fBody, 5, outliers, "hist", kLogy);
865 else if (phiB && phiA) {
868 phiA->SetTitle("#Delta#phi from Ip (x,y) correction");
869 phiA->SetYTitle("(#phi_{after}-#phi_{before})/#phi_{before}");
870 DrawInPad(fBody, 5, phiA);
874 TLatex* ltx = new TLatex(0.5, 0.5, "No outliers or #phi corrections");
875 ltx->SetTextAlign(22);
876 ltx->SetTextSize(0.07);
880 DrawInPad(fBody, 6, GetH2(sc, "phiAcc"), "colz", kLogz);
883 if (diff && diffOut) {
885 Double_t in = diff->GetEntries();
886 Double_t out = diffOut->GetEntries();
888 TLatex* ltx = new TLatex(0.11, 0.89,
889 Form("Fraction: %7.3f%%",
892 ltx->SetTextAlign(13);
893 ltx->SetTextSize(0.06);
897 PrintCanvas(Form("Density calculator - %s", *ptr));
902 TCollection* cc = GetCollection(c, "esd_mc_comparison", false);
904 fParVal->SetTextSize(save);
908 ptr = GetRingNames(false);
909 THStack* profiles = new THStack("profiles", "MC-ESD");
914 TH2* corr = GetH2(cc, Form("%s_corr_mc_esd", *ptr));
916 // corr->GetXaxis()->SetRangeUser(-1,51);
917 // corr->GetYaxis()->SetRangeUser(-1,51);
918 corr->SetXTitle("MC");
919 corr->SetYTitle("ANA");
920 TH1* h = new TH1F("",Form("Correlation of N_{ch,incl} for %s", *ptr),
922 corr->GetXaxis()->GetXmin(),
923 corr->GetXaxis()->GetXmax());
924 h->SetMinimum(corr->GetYaxis()->GetXmin());
925 h->SetMaximum(1.2*corr->GetYaxis()->GetXmax());
926 h->SetXTitle("MC"); // corr->GetXaxis()->GetTitle());
927 h->SetYTitle(corr->GetYaxis()->GetTitle());
928 DrawInPad(fBody, 1, h, "", kLogz);
929 DrawInPad(fBody, 1, corr, "colz same", kLogz);
930 ShowSliceFit(true, corr, 1, fBody, 1, 0, -1);
932 TH1* diff = GetH1(cc, Form("%s_diff_mc_esd", *ptr));
933 if (diff && diff->GetEntries() > 0) {
936 diff->Scale(1./diff->GetEntries(), "width");
937 TF1* f = new TF1(Form("%s_tri", *ptr),
938 "[0]*TMath::Exp(-TMath::Abs(x-[1])/[2])",-20,20);
939 f->SetParNames("A", "x_{0}", "w");
940 f->SetParameters(1, diff->GetMean(), diff->GetRMS());
942 DrawInPad(fBody, 2, diff, "", kLogy);
943 DrawInPad(fBody, 2, f, "same", kLogy);
945 TLatex* l = new TLatex(.89, py, "Ae^{-|x-x_{0}|/w}");
947 l->SetTextSize(fParVal->GetTextSize());
951 py -= fParVal->GetTextSize();
952 l->DrawLatex(.89, py, Form("#chi^{2}/#nu=%f", f->GetNDF()>0 ?
953 f->GetChisquare()/f->GetNDF() : 0));
954 for (Int_t i = 0; i < 3; i++) {
955 py -= fParVal->GetTextSize();
956 l->DrawLatex(.89, py, Form("%s: %f #pm %f", f->GetParName(i),
957 f->GetParameter(i), f->GetParError(i)));
960 TH2* vs = GetH2(cc, Form("%s_esd_vs_mc", *ptr));
962 const Double_t lVs = -0.3;
963 const Double_t hVs = +0.4;
964 Int_t nX = vs->GetNbinsX();
965 Int_t nY = vs->GetNbinsY();
966 TProfile* vsp = new TProfile(Form("%s_esd_vs_mc_px", *ptr), *ptr,
967 nX, vs->GetXaxis()->GetXmin(),
968 vs->GetXaxis()->GetXmax());
969 vsp->SetXTitle(vs->GetXaxis()->GetTitle());
970 vsp->SetYTitle("#LT#deltaN_{ch}#GT");
971 vsp->SetLineColor(diff->GetLineColor());
972 vsp->SetMarkerColor(diff->GetLineColor());
973 vsp->SetFillColor(diff->GetLineColor());
974 vsp->SetDirectory(0);
975 Bool_t hasSome = false;
976 for (Int_t ix = 1; ix <= nX; ix++) {
977 Double_t vsx = vs->GetXaxis()->GetBinCenter(ix);
978 for (Int_t iy = 1; iy <= nY; iy++) {
979 Double_t vsc = vs->GetBinContent(ix, iy);
980 Double_t vse = vs->GetBinError(ix, iy);
981 if (vsc < lVs || vsc > hVs) continue;
983 vsp->Fill(vsx, vsc, vse);
986 if (hasSome) profiles->Add(vsp);
989 PrintCanvas(Form("Density calculator - MC vs Reco - %s", *ptr));
993 if (profiles->GetHists() && profiles->GetHists()->GetEntries() > 0) {
994 Double_t pmax = profiles->GetMaximum("nostack")*1.3;
995 profiles->SetMaximum(+pmax);
996 profiles->SetMinimum(-pmax);
997 DrawInPad(fBody, 0, profiles, "nostack");
998 PrintCanvas("Density calculator - MC vs Reco - All");
1001 fParVal->SetTextSize(save);
1004 //____________________________________________________________________
1005 void DrawCorrector()
1007 Info("DrawCorrector", "Drawing corrector");
1008 TCollection* c = GetCollection(fSums, "fmdCorrector");
1014 Bool_t secondary=false, vertexBias=false, acceptance=false, merging=false;
1015 if (GetParameter(c, "secondary", secondary))
1016 DrawParameter(y, "Secondary corr.", secondary ? "yes" : "no");
1017 if (GetParameter(c, "acceptance", acceptance))
1018 DrawParameter(y, "Acceptance corr.", acceptance ? "yes" : "no");
1019 if (GetParameter(c, "vertexBias", vertexBias))
1020 DrawParameter(y, "Vertex bias corr.", vertexBias ? "yes" : "no");
1021 if (GetParameter(c, "merging", merging))
1022 DrawParameter(y, "Merging eff.", merging ? "yes" : "no");
1024 PrintCanvas("Corrector");
1026 TCollection* cc = GetCollection(c, "esd_mc_comparison", false);
1027 if (!cc) return; // Not MC
1029 DivideForRings(false, false);
1030 const char** ptr = GetRingNames(false);
1032 DrawInRingPad(GetH2(cc, Form("%s_esd_vs_mc", *ptr)), "colz", 0x0);
1036 PrintCanvas("Corrector - MC vs Reco");
1039 //____________________________________________________________________
1040 void DrawHistCollector()
1042 Info("DrawHistCollector", "Drawing histogram collector");
1043 TCollection* c = GetCollection(fSums, "fmdHistCollector");
1046 fBody->Divide(2, 1);
1047 TVirtualPad* p = fBody->cd(1);
1052 Int_t nCutBins=0, fiducial=0, merge=0, skipRings=0;
1053 Double_t fiducialCut=0.;
1054 Bool_t bgAndHits=false;
1055 Double_t size = fLandscape ? 0.06 : 0.04;
1056 if (GetParameter(c, "nCutBins", nCutBins))
1057 DrawParameter(y, "# of bins to cut", Form("%d", nCutBins),size);
1059 if (GetParameter(c, "skipRings", skipRings)) {
1061 if (skipRings & 0x05) skipped.Append("FMD1i ");
1062 if (skipRings & 0x09) skipped.Append("FMD2i ");
1063 if (skipRings & 0x0a) skipped.Append("FMD2o ");
1064 if (skipRings & 0x11) skipped.Append("FMD3i ");
1065 if (skipRings & 0x12) skipped.Append("FMD3o ");
1066 if (skipped.IsNull()) skipped = "none";
1067 DrawParameter(y, "Skipped rings", skipped, size);
1069 if (GetParameter(c, "bgAndHits", bgAndHits))
1070 DrawParameter(y, "Bg & hit maps stored.", bgAndHits?"yes":"no",size);
1071 if (GetParameter(c, "merge", merge))
1072 DrawParameter(y, "Merge method",
1073 (merge == 0 ? "straight mean" :
1074 merge == 1 ? "straight mean, no zeroes" :
1075 merge == 2 ? "weighted mean" :
1076 merge == 3 ? "least error" :
1077 merge == 4 ? "sum" : "unknown"),size);
1078 if (GetParameter(c, "fiducial", fiducial))
1079 DrawParameter(y, "Fiducial method.",
1080 fiducial == 0 ? "cut" : "distance", size);
1081 if (GetParameter(c, "fiducialCut", fiducialCut))
1082 DrawParameter(y, "Fiducial cut.", Form("%f", fiducialCut), size);
1085 // Printf("Drawing skipped");
1086 TH1* skipped = GetH1(c, "skipped", false);
1088 skipped->SetFillColor(kRed+1);
1089 skipped->SetFillStyle(3001);
1091 DrawInPad(p, 2, skipped, "hist");
1096 // Printf("Drawing sumRings");
1097 DrawInPad(p, 1, GetH2(c, "sumRings"), "colz");
1098 // Printf("Drawing coverage");
1099 DrawInPad(p, 2, GetH2(c, "coverage"), "colz");
1100 // Printf("Done drawing for now");
1101 PrintCanvas("Histogram collector");
1106 TRegexp regexp("[pm][0-9]+_[pm][0-9]+");
1107 while ((o = next())) {
1108 TString name(o->GetName());
1109 if (name.Index(regexp) == kNPOS) continue;
1111 TList* vl = static_cast<TList*>(o);
1114 DivideForRings(false, false);
1115 const char** ptr = GetRingNames(false);
1117 DrawInRingPad(GetH2(vl, Form("secMap%s", *ptr)), "colz", 0x0);
1118 DrawInRingPad(GetH2(vl, Form("hitMap%s", *ptr)), "box same", 0x0);
1121 PrintCanvas(Form("Histogram Collector - Vertex bin %s", vl->GetName()));
1124 o = c->FindObject("byCentrality");
1126 TList* bc = static_cast<TList*>(o);
1128 DrawInPad(fBody, GetH3(bc, "FMD1I"), "box", 0);
1129 DrawInPad(fBody, GetH3(bc, "FMD2I"), "box same", 0);
1130 DrawInPad(fBody, GetH3(bc, "FMD2O"), "box same", 0);
1131 DrawInPad(fBody, GetH3(bc, "FMD3O"), "box same", 0);
1132 DrawInPad(fBody, GetH3(bc, "FMD3I"), "box same", kLegend);
1135 //____________________________________________________________________
1138 Info("DrawCentral", "Drawing central (SPD)");
1139 TCollection* c = fSums;
1142 fBody->Divide(2, 2);
1145 Bool_t secondary=false, acceptance=false;
1146 if (GetParameter(c, "secondary", secondary))
1147 DrawParameter(y, "Secondary corr.", secondary ? "yes" : "no");
1148 if (GetParameter(c, "acceptance", acceptance))
1149 DrawParameter(y, "Acceptance corr.", acceptance ? "yes" : "no");
1152 DrawInPad(fBody, 2, GetH2(c, "coverage"), "col", 0,
1153 "#eta coverage per v_{z}");
1154 TH2* cvst = GetH2(c, "nClusterVsnTracklet");
1156 // cvst->Scale(1, "width");
1157 cvst->GetXaxis()->SetTitle("N_{free cluster}");
1158 cvst->GetYaxis()->SetTitle("N_{tracklet}");
1159 cvst->GetXaxis()->SetRangeUser(1,10000);
1160 cvst->GetYaxis()->SetRangeUser(1,10000);
1162 DrawInPad(fBody, 3, cvst, "colz", kLogx|kLogy|kLogz,
1163 "Correlation of # of tracklets and clusters");
1164 DrawInPad(fBody, 4, GetH2(c, "clusterPerTracklet"), "colz", 0x0,
1165 "# clusters per tracklet vs #eta");
1166 ShowSliceFit(true, cvst, 3, fBody, 3, 0x8000|kLogz);
1168 fBody->cd(1)->Modified();
1169 fBody->cd(2)->Modified();
1170 fBody->cd(3)->Modified();
1171 fBody->cd(4)->Modified();
1172 fBody->cd(1)->Update();
1173 fBody->cd(2)->Update();
1174 fBody->cd(3)->Update();
1175 fBody->cd(4)->Update();
1176 PrintCanvas("Central - overview");
1181 TRegexp regexp("[pm][0-9]+_[pm][0-9]+");
1182 while ((o = next())) {
1183 TString name(o->GetName());
1184 if (name.Index(regexp) == kNPOS) continue;
1186 TList* vl = static_cast<TList*>(o);
1188 fBody->Divide(1, 3);
1190 DrawInPad(fBody, 1, GetH1(vl, "acceptance"), "", 0);
1192 TH1* sec = GetH1(vl, "secondary");
1193 sec->SetMarkerStyle(21);
1194 sec->SetMarkerSize(1.2);
1195 DrawInPad(fBody, 2, sec, "", 0);
1196 DrawInPad(fBody, 2, GetH1(vl, "secondaryFiducial"), "same", 0x0);
1197 DrawInPad(fBody, 3, GetH2(vl, "secondaryMapFiducial"), "colz", 0);
1198 DrawInPad(fBody, 3, GetH2(vl, "hitMap"), "box same", 0x0);
1200 fBody->cd(1)->Modified();
1201 fBody->cd(2)->Modified();
1202 fBody->cd(3)->Modified();
1203 fBody->cd(1)->Update();
1204 fBody->cd(2)->Update();
1205 fBody->cd(3)->Update();
1206 PrintCanvas(Form("Central - Vertex bin %s", vl->GetName()));
1211 //____________________________________________________________________
1212 void AddToAll(THStack* all, const THStack* stack, Int_t curr, Int_t step)
1216 TIter next(stack->GetHists());
1218 while ((h = static_cast<TH1*>(next()))) {
1219 TH1* copy = static_cast<TH1*>(h->Clone(Form("%s_copy", h->GetName())));
1220 copy->SetDirectory(0);
1222 copy->SetMarkerColor(kGray);
1223 copy->SetLineColor(kGray);
1228 //____________________________________________________________________
1229 void AddToAll(THStack* all, const THStack* stack)
1233 TIter next(stack->GetHists());
1235 while ((h = static_cast<TH1*>(next()))) {
1236 TH1* copy = static_cast<TH1*>(h->Clone(Form("%s_copy", h->GetName())));
1237 copy->SetDirectory(0);
1238 copy->SetMarkerColor(kGray);
1239 copy->SetLineColor(kGray);
1244 //____________________________________________________________________
1245 void DrawStep(Int_t step,
1254 if (all->GetHists()->GetEntries() <= 0 || !cur) return;
1256 // Info("", "Drawing step # %d", step);
1257 Bool_t left = sub % nCol == 1;
1258 Bool_t right= sub % nCol == 0;
1259 Bool_t top = (sub-1) / nCol == 0;
1260 TVirtualPad* p = can->cd(sub);
1261 gStyle->SetOptTitle(0);
1262 p->SetTitle(Form("Step # %d", step));
1263 p->SetFillColor(kWhite);
1264 p->SetRightMargin(right ? 0.02 : 0);
1265 p->SetTopMargin(top ? 0.02 : 0); // 0.02);
1266 // Info("", "Drawing step %d in sub-pad %d (%s)",
1267 // step, sub, (left?"left":"right"));
1270 all->Draw("nostack");
1271 all->GetHistogram()->SetXTitle("#eta");
1272 all->GetHistogram()->SetYTitle("signal");
1275 static_cast<TLegendEntry*>(leg->GetListOfPrimitives()->At(step-1));
1277 e->SetMarkerColor(kBlack);
1278 e->SetLineColor(kBlack);
1279 e->SetTextColor(kBlack);
1283 gROOT->SetSelectedPad(p);
1284 cur->DrawClone("same nostack");
1287 TLatex* ltx = new TLatex(.97, .97, title);
1289 ltx->SetTextSize(.06);
1290 ltx->SetTextAlign(33);
1293 ltx = new TLatex((left ? .12 : .02), .97, p->GetTitle());
1295 ltx->SetTextSize(.06);
1296 ltx->SetTextAlign(13);
1300 Double_t x1 = 0.5*(p->GetUxmax()+p->GetUxmin());
1302 Double_t y1 = p->GetUymax();
1303 Double_t y2 = 0.92*y1;
1306 x1 = 0.99*p->GetUxmin();
1308 y1 = .5*(p->GetUymax()+p->GetUymin());
1312 // Info("", "Arrow at (x1,y1)=%f,%f (x2,y2)=%f,%f", x1, y1, x2, y2);
1313 TArrow* a = new TArrow(x1, y1, x2, y2, sz, "|>");
1314 // (fLandscape ? "<|" : "|>"));
1315 a->SetFillColor(kGray+1);
1316 a->SetLineColor(kGray+1);
1324 e->SetMarkerColor(kGray);
1325 e->SetLineColor(kGray);
1326 e->SetTextColor(kGray);
1328 gStyle->SetOptTitle(1);
1331 //____________________________________________________________________
1332 void FixStack(THStack* stack, const TString& title,
1333 const TString& extra, Int_t marker)
1336 stack->SetTitle(title);
1337 TIter next(stack->GetHists());
1339 while ((h = static_cast<TH1*>(next()))) {
1340 h->SetMarkerStyle(marker);
1341 TString tit(h->GetTitle());
1342 tit.ReplaceAll("cache", "");
1347 void AddLegendEntry(TLegend* l,
1349 const TString& title)
1353 TLegendEntry* e = l->AddEntry("dummy", title.Data(), "pl");
1354 e->SetMarkerStyle(h->GetMarkerStyle());
1355 e->SetMarkerColor(kGray);
1356 e->SetLineColor(kGray);
1357 e->SetTextColor(kGray);
1361 //____________________________________________________________________
1364 // MakeChapter(can, "Steps");
1366 THStack* esds = GetStack(GetCollection(fResults, "fmdSharingFilter"),
1367 "sumsESD", "summedESD",false);
1368 THStack* deltas = GetStack(GetCollection(fResults, "fmdSharingFilter"),
1369 "sums", "summed",false);
1370 THStack* nchs = GetStack(GetCollection(fResults,
1371 "fmdDensityCalculator"),
1372 "sums", "inclDensity",false);
1373 THStack* prims = GetStack(GetCollection(fResults, "fmdCorrector"),
1374 "sums", "primaryDensity",false);
1375 THStack* rings = GetStack(GetCollection(fResults, "ringResults"),
1377 THStack* mcRings = GetStack(GetCollection(fResults, "mcRingResults", false),
1378 "all","dndeta_eta", false);
1379 TH1* dndeta = GetH1(fResults, "dNdeta", false);
1380 if (dndeta) dndeta->SetMarkerColor(kBlack);
1381 if (!(esds || deltas || nchs || prims || rings)) return;
1383 FixStack(esds, "#sum_{s} #Delta/#Delta_{mip}", "", 20);
1384 FixStack(deltas, "#sum_{c} #Delta/#Delta_{mip}", "", 21);
1385 FixStack(nchs, "#sum_{b} N_{ch,incl}", "", 22);
1386 FixStack(prims, "#sum_{b} N_{ch,primary}", "", 23);
1387 FixStack(rings, "dN/d#eta per ring", "", 33);
1388 FixStack(mcRings,"dN/d#eta per ring (MC)", "(MC)", 34);
1390 THStack* all = new THStack;
1391 AddToAll(all, mcRings);
1392 AddToAll(all, esds);
1393 AddToAll(all, deltas);
1394 AddToAll(all, nchs);
1395 AddToAll(all, prims);
1396 AddToAll(all, rings);
1400 res = static_cast<TH1*>(dndeta->Clone("dNdeta"));
1401 res->SetTitle("dN/d#eta");
1402 res->SetMarkerColor(kGray);
1403 res->SetLineColor(kGray);
1404 res->SetDirectory(0);
1408 TLegend* l = new TLegend(.35, .2, .55, .9);
1409 l->SetFillColor(kWhite);
1411 l->SetBorderSize(0);
1412 TLegendEntry* e = 0;
1414 THStack* stacks[] = { mcRings,
1422 for (Int_t i = 0; i < 6; i++) {
1423 if (!stacks[i]) continue;
1424 TH1* h = static_cast<TH1*>(stacks[i]->GetHists()->At(0));
1425 AddLegendEntry(l, h, stacks[i]->GetTitle());
1429 AddLegendEntry(l, res, res->GetTitle());
1433 TObject* objs[] = { stacks[0],
1440 const char* titles[] = { /* 1 */ "MC",
1441 /* 2 */ "ESD input",
1442 /* 3 */ "After merging",
1443 /* 4 */ "After particle counting",
1444 /* 5 */ "After corrections",
1445 /* 6 */ "After normalization",
1446 /* 7 */ "After combining" };
1447 Int_t nY = nHist > 6 ? 4 : 3;
1454 fBody->Divide(nX, nY, 0, 0);
1457 for (Int_t i = 0; i < 7; i++) {
1458 TObject* obj = objs[i];
1465 case 1: padNo = 1; break;
1466 case 2: padNo = 3; break;
1467 case 3: padNo = 5; break;
1468 case 4: padNo = (mcRings ? 7 : 2); break;
1469 case 5: padNo = (mcRings ? 2 : 4); break;
1470 case 6: padNo = (mcRings ? 4 : 6); break;
1471 case 7: padNo = (mcRings ? 6 : 8); break;
1474 //Printf("Drawing step %d in sub-pad %d (%s)",step,padNo,obj->GetTitle());
1475 DrawStep(step, all, obj, l, titles[i], fBody, padNo, nX);
1478 if (!esds && !mcRings && deltas) {
1480 TLegend* ll = new TLegend(0.01, 0.11, 0.99, 0.99);
1482 ll->SetFillColor(kWhite);
1483 ll->SetFillStyle(0);
1484 ll->SetBorderSize(0);
1486 TIter next(deltas->GetHists());
1488 while ((hh = static_cast<TH1*>(next()))) {
1489 e = ll->AddEntry("dummy", hh->GetTitle(), "pl");
1490 e->SetMarkerColor(hh->GetMarkerColor());
1491 e->SetMarkerStyle(hh->GetMarkerStyle());
1492 e->SetLineColor(kBlack);
1496 // Printf("Done drawing steps");
1497 PrintCanvas("Steps");
1501 //____________________________________________________________________
1504 // MakeChapter(can, "Results");
1508 TCollection* c = GetCollection(fResults, "ringResults");
1511 THStack* mcRings = GetStack(GetCollection(fResults, "mcRingResults", false),
1512 "all", "dndeta_eta", false);
1514 TH1* dndeta_phi = GetH1(fResults, "dNdeta");
1515 TH1* dndeta_eta = GetH1(fResults, "dNdeta_");
1516 dndeta_phi->SetTitle("1/N_{ev}dN_{ch}/d#eta (#varphi norm)");
1517 dndeta_eta->SetTitle("1/N_{ev}dN_{ch}/d#eta (#eta norm)");
1518 dndeta_eta->SetMarkerSize(0.7);
1520 THStack* allPhi = new THStack("phiAcc", "#varphi Acceptance");
1521 THStack* allEta = new THStack("etaCov", "#eta Coverage");
1522 const char** pring = GetRingNames(false);
1525 TCollection* cc = GetCollection(c, *pring);
1526 TH1* etaCov = GetH1(cc, "etaCov");
1527 TH1* phiAcc = GetH1(cc, "phiAcc");
1528 TH1* dndeta = GetH1(cc, "dndeta_phi");
1529 Int_t color = kBlack;
1530 if (dndeta) color = dndeta->GetMarkerColor();
1532 etaCov->SetTitle(*pring);
1533 etaCov->SetFillColor(color);
1534 etaCov->SetLineColor(color);
1535 allEta->Add(etaCov);
1538 phiAcc->SetFillColor(color);
1539 phiAcc->SetLineColor(color);
1540 allPhi->Add(phiAcc);
1544 Double_t savX = fParVal->GetX();
1545 Double_t savY = fParVal->GetY();
1548 TVirtualPad* p = fBody->cd(1);
1550 DrawInPad(p, 1, GetStack(c, "all"), "nostack", mcRings ? 0 : kLegend,
1551 "Individual ring results");
1552 DrawInPad(p, 1, mcRings, "nostack same", kLegend|kSilent);
1553 DrawInPad(p, 2, allEta, "nostack hist", kLegend,
1554 "#phi acceptance and #eta coverage per ring");
1555 DrawInPad(p, 2, allPhi, "nostack hist same", 0x0);
1559 DrawInPad(p, 1, dndeta_phi, "", 0x0,
1560 "1/#it{N}_{ev} d#it{N}_{ch}/d#it{#eta}");
1561 DrawInPad(p, 1, dndeta_eta, "Same", kLegend);
1562 DrawInPad(p, 2, GetH1(fResults, "norm"), "", 0x0,
1563 "Total #phi acceptance and #eta coverage");
1564 DrawInPad(p, 2, GetH1(fResults, "phi"), "same", kLegend);
1565 // DrawInPad(fBody, 4, GetH1(fSums, "d2Ndetadphi"), "colz");
1568 // TLatex* l = new TLatex(.5, .2, "Ring results");
1570 // l->SetTextAlign(21);
1574 // l->DrawLatex(.5, .2, "1/N_{ev}dN_{ch}/d#eta");
1577 // l->DrawLatex(.5, .2, "1/N_{ev}dN_{ch}/d#eta (#vta norm.)");
1579 fParVal->SetX(savX);
1580 fParVal->SetY(savY);
1581 PrintCanvas("Results");
1584 //____________________________________________________________________
1585 void DrawCentralResults()
1587 // MakeChapter(can, "Results");
1588 Info("DrawCentralResults", "Drawing central results");
1590 fBody->Divide(1,2,0,0);
1592 TH1* dndeta_ = GetH1(fResults, "dNdeta_");
1593 TH1* dndeta = GetH1(fResults, "dNdeta");
1594 THStack* stack = new THStack("dndetas",
1595 "d#it{N}_{ch}/d#it{#eta} - central");
1596 stack->Add(dndeta_);
1599 DrawInPad(fBody, 1, stack, "nostack");
1600 TH1* h = stack->GetHistogram();
1602 h->SetXTitle("#it{#eta}");
1603 h->SetYTitle("#frac{d#it{N}_{ch}}{d#it{#eta}}");
1606 TLegend* l = new TLegend(.3, .05, .7, .4);
1609 l->SetBorderSize(0);
1610 l->AddEntry(dndeta_, "Normalized to coverage", "lp");
1611 l->AddEntry(dndeta, "Normalized to #phi acceptance", "lp");
1614 DrawInPad(fBody, 2, GetH1(fResults, "norm"));
1615 DrawInPad(fBody, 2, GetH1(fResults, "phi"), "same", kLegend);
1617 PrintCanvas("Central Results");
1620 void DrawBoth(TFile* file)
1622 Info("DrawBoth", "Drawing central & forward results");
1623 TCollection* central = GetCollection(file, "CentralResults");
1624 TCollection* forward = GetCollection(file, "ForwardResults");
1626 if (!central || !forward) {
1627 Warning("DrawBoth", "central %p or forward %p results not found",
1632 TH1* f1 = GetH1(forward, "dNdeta_");
1633 TH1* c1 = GetH1(central, "dNdeta_");
1634 TH1* f2 = GetH1(forward, "dNdeta");
1635 TH1* c2 = GetH1(central, "dNdeta");
1636 if (!f1 || !c1 || !f2 || !c2) return;
1637 f1->SetLineColor(kBlack);
1638 f2->SetLineColor(kBlack);
1639 c1->SetLineColor(kBlack);
1640 c2->SetLineColor(kBlack);
1641 f1->SetMarkerColor(f2->GetMarkerColor());
1642 f1->SetMarkerStyle(24);
1643 c1->SetMarkerStyle(24);
1644 c2->SetMarkerStyle(20);
1645 c2->SetMarkerColor(c1->GetMarkerColor());
1646 THStack* s = new THStack("dndetas", "d#it{N}_{ch}/d#it{#eta}");
1652 fBody->Divide(1, 2, 0, 0);
1653 DrawInPad(fBody, 1, s, "nostack");
1654 s->GetHistogram()->SetXTitle("#it{#eta}");
1655 s->GetHistogram()->SetYTitle("#frac{d#it{N}_{ch}}{d#it{#eta}}");
1658 TLegend* l = new TLegend(.4, .05, .8, .4);
1661 l->SetBorderSize(0);
1662 TLegendEntry* entry = l->AddEntry("dummy", "Forward", "f");
1663 entry->SetFillColor(f1->GetMarkerColor());
1664 entry->SetLineColor(f1->GetMarkerColor());
1665 entry->SetFillStyle(1001);
1666 entry->SetLineWidth(0);
1667 entry = l->AddEntry("dummy", "Central", "f");
1668 entry->SetFillColor(c1->GetMarkerColor());
1669 entry->SetLineColor(c1->GetMarkerColor());
1670 entry->SetLineWidth(0);
1671 entry->SetFillStyle(1001);
1672 entry = l->AddEntry("dummy", "Normalized to coverage", "lp");
1673 entry->SetMarkerStyle(f1->GetMarkerStyle());
1674 entry = l->AddEntry("dummy", "Normalized to #phi acceptance", "lp");
1675 entry->SetMarkerStyle(f2->GetMarkerStyle());
1678 TH1* f3 = GetH1(forward, "norm");
1679 TH1* c3 = GetH1(central, "norm");
1680 TH1* f4 = GetH1(forward, "phi");
1681 TH1* c4 = GetH1(central, "phi");
1682 f3->SetFillColor(f1->GetMarkerColor());
1683 f4->SetFillColor(f1->GetMarkerColor());
1684 c3->SetFillColor(c1->GetMarkerColor());
1685 c4->SetFillColor(c1->GetMarkerColor());
1686 f3->SetLineColor(f1->GetMarkerColor());
1687 f4->SetLineColor(f1->GetMarkerColor());
1688 c3->SetLineColor(c1->GetMarkerColor());
1689 c4->SetLineColor(c1->GetMarkerColor());
1691 THStack* a = new THStack("norms", "Normalizations");
1697 a->SetMaximum(a->GetMaximum("nostack")*1.2);
1698 DrawInPad(fBody, 2, a, "nostack");
1699 a->GetHistogram()->SetXTitle("#it{#eta}");
1700 a->GetHistogram()->SetYTitle("Normalization (coverage or acceptance)");
1703 l = new TLegend(.2, .94, .9, .99);
1706 l->SetBorderSize(0);
1708 // entry = l->AddEntry("dummy", "Forward", "f");
1709 // entry->SetFillColor(f1->GetMarkerColor());
1710 // entry->SetLineColor(f1->GetMarkerColor());
1711 // entry->SetFillStyle(1001);
1712 // entry->SetLineWidth(0);
1713 // entry = l->AddEntry("dummy", "Central", "f");
1714 // entry->SetFillColor(c1->GetMarkerColor());
1715 // entry->SetLineColor(c1->GetMarkerColor());
1716 // entry->SetLineWidth(0);
1717 // entry->SetFillStyle(1001);
1718 entry = l->AddEntry("dummy", "#eta Coverage", "f");
1719 entry->SetFillStyle(f3->GetFillStyle());
1720 entry->SetFillColor(kBlack);
1721 entry = l->AddEntry("dummy", "#phi Acceptance", "f");
1722 entry->SetFillStyle(f4->GetFillStyle());
1723 entry->SetFillColor(kBlack);
1726 PrintCanvas("Both results");
1729 TCollection* fResults;