14 #include <TEfficiency.h>
15 #include <TFitResult.h>
16 #include <TFitResultPtr.h>
21 namespace ActsExamples {
23 namespace PlotHelpers {
24 TH1F*
bookHisto(
const char* histName,
const char* histTitle,
27 new TH1F(histName, histTitle, varBinning.
nBins(), varBinning.
data());
28 hist->GetXaxis()->SetTitle(varBinning.
title().c_str());
29 hist->GetYaxis()->SetTitle(
"Entries");
34 TH2F*
bookHisto(
const char* histName,
const char* histTitle,
37 new TH2F(histName, histTitle, varXBinning.
nBins(), varXBinning.
data(),
39 hist->GetXaxis()->SetTitle(varXBinning.
title().c_str());
40 hist->GetYaxis()->SetTitle(varYBinning.
title().c_str());
47 hist->Fill(value, weight);
52 hist->Fill(xValue, yValue, weight);
55 void anaHisto(TH1D* inputHist,
int j, TH1F* meanHist, TH1F* widthHist) {
57 assert(inputHist !=
nullptr);
58 if (inputHist->GetEntries() > 0) {
59 TFitResultPtr
r = inputHist->Fit(
"gaus",
"QS0");
60 if ((r.Get() !=
nullptr) and ((r->Status() % 1000) == 0)) {
63 meanHist->SetBinContent(j, r->Parameter(1));
64 meanHist->SetBinError(j, r->ParError(1));
65 widthHist->SetBinContent(j, r->Parameter(2));
66 widthHist->SetBinError(j, r->ParError(2));
71 TEfficiency*
bookEff(
const char* effName,
const char* effTitle,
73 TEfficiency* efficiency =
74 new TEfficiency(effName, effTitle, varBinning.
nBins(), varBinning.
data());
78 TEfficiency*
bookEff(
const char* effName,
const char* effTitle,
80 TEfficiency* efficiency =
new TEfficiency(
81 effName, effTitle, varXBinning.
nBins(), varXBinning.
data(),
87 assert(efficiency !=
nullptr);
88 efficiency->Fill(status, value);
92 assert(efficiency !=
nullptr);
93 efficiency->Fill(status, xValue, yValue);
96 TProfile*
bookProf(
const char* profName,
const char* profTitle,
99 new TProfile(profName, profTitle, varXBinning.
nBins(), varXBinning.
data(),
100 varYBinning.
low(), varYBinning.
high());
101 prof->GetXaxis()->SetTitle(varXBinning.
title().c_str());
102 prof->GetYaxis()->SetTitle(varYBinning.
title().c_str());
107 assert(profile !=
nullptr);
108 profile->Fill(xValue, yValue, weight);