11 namespace ActsExamples {
13 namespace PlotHelpers {
14 TH1F*
bookHisto(
const char* histName,
const char* histTitle,
16 TH1F* hist =
new TH1F(histName, histTitle, varBinning.
nBins, varBinning.
min,
18 hist->GetXaxis()->SetTitle(varBinning.
title.c_str());
19 hist->GetYaxis()->SetTitle(
"Entries");
24 TH2F*
bookHisto(
const char* histName,
const char* histTitle,
26 TH2F* hist =
new TH2F(histName, histTitle, varXBinning.
nBins, varXBinning.
min,
27 varXBinning.
max, varYBinning.
nBins, varYBinning.
min,
29 hist->GetXaxis()->SetTitle(varXBinning.
title.c_str());
30 hist->GetYaxis()->SetTitle(varYBinning.
title.c_str());
36 assert(hist !=
nullptr);
37 hist->Fill(value, weight);
40 void fillHisto(TH2F* hist,
float xValue,
float yValue,
float weight) {
41 assert(hist !=
nullptr);
42 hist->Fill(xValue, yValue, weight);
45 void anaHisto(TH1D* inputHist,
int j, TH1F* meanHist, TH1F* widthHist) {
47 assert(inputHist !=
nullptr);
48 if (inputHist->GetEntries() > 0) {
49 TFitResultPtr r = inputHist->Fit(
"gaus",
"QS0");
50 if (r.Get() and ((r->Status() % 1000) == 0)) {
53 meanHist->SetBinContent(j, r->Parameter(1));
54 meanHist->SetBinError(j, r->ParError(1));
55 widthHist->SetBinContent(j, r->Parameter(2));
56 widthHist->SetBinError(j, r->ParError(2));
61 TEfficiency*
bookEff(
const char* effName,
const char* effTitle,
63 TEfficiency* efficiency =
new TEfficiency(effName, effTitle, varBinning.
nBins,
64 varBinning.
min, varBinning.
max);
68 TEfficiency*
bookEff(
const char* effName,
const char* effTitle,
70 TEfficiency* efficiency =
new TEfficiency(
71 effName, effTitle, varXBinning.
nBins, varXBinning.
min, varXBinning.
max,
72 varYBinning.
nBins, varYBinning.
min, varYBinning.
max);
77 assert(efficiency !=
nullptr);
78 efficiency->Fill(status, value);
81 void fillEff(TEfficiency* efficiency,
float xValue,
float yValue,
bool status) {
82 assert(efficiency !=
nullptr);
83 efficiency->Fill(status, xValue, yValue);
86 TProfile*
bookProf(
const char* profName,
const char* profTitle,
89 new TProfile(profName, profTitle, varXBinning.
nBins, varXBinning.
min,
90 varXBinning.
max, varYBinning.
min, varYBinning.
max);
91 prof->GetXaxis()->SetTitle(varXBinning.
title.c_str());
92 prof->GetYaxis()->SetTitle(varYBinning.
title.c_str());
97 assert(profile !=
nullptr);
98 profile->Fill(xValue, yValue, weight);