23 for (
int i = 1; i <= hist->GetNbinsX(); i++) {
24 if (hist->GetBinContent(i) > 0) {
31 log << MSG::WARNING <<
"estimate_background() - No hits in input histogram!" <<
endmsg;
35 double maxx = scale_min - 40;
36 int max = hist->FindBin(maxx);
45 log << MSG::WARNING <<
"estimate_background() - Rising edge is to glose to lower histogram range!" <<
endmsg;
51 double back_squared = 0.0;
53 double referece_chi2 = 0.0;
54 for (
int i =
min; i <
max; i++) {
57 back_squared += hist->GetBinContent(i) * hist->GetBinContent(i);
58 if (n_bins ==
m_settings->MinBackgroundBins()) {
60 referece_chi2 = 2 * (back_squared / n_bins - bac * bac);
62 if (n_bins >
m_settings->MinBackgroundBins()) {
64 double chi2 = 2 * (back_squared / n_bins - bac * bac);
65 if (
chi2 > 5 * referece_chi2)
break;
71 m_t0_est = 0.5 * (scale_min + hist->GetBinCenter(
max));
74 (
new TLine(hist->GetBinCenter(
min), 0, hist->GetBinCenter(
min), hist->GetMaximum()))->Write(
"t0_back_left");
75 (
new TLine(hist->GetBinCenter(
max), 0, hist->GetBinCenter(
max), hist->GetMaximum()))->Write(
"t0_back_right");
87 if (!
m_vbh.Smooth(hist->GetBinWidth(1))) {
91 if (!
m_vbh.Smooth(hist->GetBinWidth(1) / 2)) {
97 m_vbh.DenistyGraph()->Write(
"t0_density");
98 m_vbh.BinWidthGraph()->Write(
"t0_binwidth");
99 m_vbh.BinContentGraph()->Write(
"t0_bin_content");
100 m_vbh.DiffDensityGraph()->Write(
"t0_diff_density");
101 m_vbh.DiffDensityGraph()->Write(
"t0_diffbinwidth");
104 double lower =
m_vbh.GetSortedBin(0).Width();
105 double left(9e9), right(-9e9);
107 for (
unsigned int i = 0; i <
m_vbh.GetNumberOfBins(); i++) {
108 if (
m_vbh.GetSortedBin(i).Left() < left) left =
m_vbh.GetSortedBin(i).Left();
109 if (
m_vbh.GetSortedBin(i).Right() > right) right =
m_vbh.GetSortedBin(i).Right();
113 if ((
m_vbh.GetSortedBin(i).Width() - lower) > hist->GetBinWidth(1) / 100.0) {
115 if (right - left > 50 && i > 20)
break;
116 lower =
m_vbh.GetSortedBin(i).Width();
121 (
new TLine(left, 0, left, hist->GetMaximum()))->Write(
"t0_height_left");
122 (
new TLine(right, 0, right, hist->GetMaximum()))->Write(
"t0_height_right");
125 int bleft(hist->FindBin(left)), bright(hist->FindBin(right));
128 for (
int i = bleft; i <= bright; i++) {
134 log << MSG::WARNING <<
"estimate_height() - top region is too small! left=" << left <<
" right=" << right <<
endmsg;