24 float under = histo.GetBinContent(0) / histo.GetEntries();
25 float over = histo.GetBinContent(histo.GetNbinsX() + 1) / histo.GetEntries();
26 float minFit = histo.GetMean() - histo.GetRMS();
27 float maxFit = histo.GetMean() + histo.GetRMS();
29 if ((under > 0.1) || (over > 0.1))
30 edm::LogError(
"DTResidualFitter") <<
"WARNING in histogram: " << histo.GetName() <<
"\n"
31 <<
" entries: " << histo.GetEntries() <<
"\n"
32 <<
" underflow: " << under * 100. <<
"% \n"
33 <<
" overflow: " << over * 100. <<
"%";
35 TString funcName = TString(histo.GetName()) +
"_gaus";
36 TF1* fitFunc =
new TF1(funcName,
"gaus", minFit, maxFit);
38 histo.Fit(fitFunc, option);
40 minFit = fitFunc->GetParameter(1) - nSigmas * fitFunc->GetParameter(2);
41 maxFit = fitFunc->GetParameter(1) + nSigmas * fitFunc->GetParameter(2);
42 fitFunc->SetRange(minFit, maxFit);
43 histo.Fit(fitFunc, option);
46 fitFunc->GetParameter(1), fitFunc->GetParError(1), fitFunc->GetParameter(2), fitFunc->GetParError(2));
Log< level::Error, false > LogError
DTResidualFitResult fitResiduals(TH1F &histo, int nSigmas=1)
DTResidualFitter(bool debug=false)