#include <MTT0PatternRecognition.h>
Definition at line 35 of file MTT0PatternRecognition.h.
◆ MTT0PatternRecognition()
| MuonCalib::MTT0PatternRecognition::MTT0PatternRecognition |
( |
| ) |
|
|
inline |
Default constructor.
Definition at line 39 of file MTT0PatternRecognition.h.
39 :
double m_fit_min
fit range
double m_background
background level
const T0MTSettingsT0 * m_settings
settings
double m_t0_est
t0 estimate
◆ estimate_background()
| bool MuonCalib::MTT0PatternRecognition::estimate_background |
( |
TH1F * | hist, |
|
|
double | scale_min ) |
|
private |
estimates the background level
- Parameters
-
| hist | input histogram |
| scale_min | lower end of the scale region as returned from estimate_height() |
Definition at line 19 of file MTT0PatternRecognition.cxx.
19 {
20
21
23 for (
int i = 1;
i <=
hist->GetNbinsX();
i++) {
24 if (
hist->GetBinContent(i) > 0) {
26 break;
27 }
28 }
31 log << MSG::WARNING <<
"estimate_background() - No hits in input histogram!" <<
endmsg;
33 return false;
34 }
35 double maxx = scale_min - 40;
37
41 }
42
45 log << MSG::WARNING <<
"estimate_background() - Rising edge is to close to lower histogram range!" <<
endmsg;
47 return false;
48 }
49
51 double back_squared = 0.0;
52 double n_bins = 0.0;
53 double referenceChi2 = 0.0;
55 n_bins++;
57 back_squared +=
hist->GetBinContent(i) *
hist->GetBinContent(i);
58 if (n_bins ==
m_settings->MinBackgroundBins()) {
59
61
62 referenceChi2 = 2 * (back_squared / n_bins - bac * bac);
63 }
64 if (n_bins >
m_settings->MinBackgroundBins()) {
65
67
68 double chi2 = 2 * (back_squared / n_bins - bac * bac);
69 if (
chi2 > 5 * referenceChi2)
break;
70 }
71 }
72 if (n_bins == 0){
73
75 log << MSG::WARNING <<
"n_bins is zero" <<
endmsg;
77 } else {
79 }
80
83
85 (
new TLine(
hist->GetBinCenter(
min), 0,
hist->GetBinCenter(
min),
hist->GetMaximum()))->Write(
"t0_back_left");
86 (
new TLine(
hist->GetBinCenter(
max), 0,
hist->GetBinCenter(
max),
hist->GetMaximum()))->Write(
"t0_back_right");
87 }
88
89 return true;
90 }
double chi2(TH1 *h0, TH1 *h1)
IMessageSvc * getMessageSvc(bool quiet=false)
◆ estimate_height()
| double MuonCalib::MTT0PatternRecognition::estimate_height |
( |
TH1F * | hist | ) |
|
|
private |
estimates the height of the spectrum.
It returns the lower end of the scale region
- Parameters
-
Definition at line 96 of file MTT0PatternRecognition.cxx.
96 {
97
98 if (!
m_vbh.Smooth(
hist->GetBinWidth(1))) {
100 return -1;
101 }
102 if (!
m_vbh.Smooth(
hist->GetBinWidth(1) / 2)) {
104 return -1;
105 }
106
108 m_vbh.DenistyGraph()->Write(
"t0_density");
109 m_vbh.BinWidthGraph()->Write(
"t0_binwidth");
110 m_vbh.BinContentGraph()->Write(
"t0_bin_content");
111 m_vbh.DiffDensityGraph()->Write(
"t0_diff_density");
112 m_vbh.DiffDensityGraph()->Write(
"t0_diffbinwidth");
113 }
114
115 double lower =
m_vbh.GetSortedBin(0).Width();
116 double left(9e9), right(-9e9);
117
118 for (
unsigned int i = 0;
i <
m_vbh.GetNumberOfBins();
i++) {
119 if (
m_vbh.GetSortedBin(i).Left() < left) left =
m_vbh.GetSortedBin(i).Left();
120 if (
m_vbh.GetSortedBin(i).Right() > right) right =
m_vbh.GetSortedBin(i).Right();
121
122
123
124 if ((
m_vbh.GetSortedBin(i).Width() - lower) >
hist->GetBinWidth(1) / 100.0) {
125
126 if (right - left > 50 && i > 20) break;
127 lower =
m_vbh.GetSortedBin(i).Width();
128 }
129 }
130
132 (
new TLine(left, 0, left,
hist->GetMaximum()))->Write(
"t0_height_left");
133 (
new TLine(right, 0, right,
hist->GetMaximum()))->Write(
"t0_height_right");
134 }
135
136 int bleft(
hist->FindBin(left)), bright(
hist->FindBin(right));
139 for (
int i = bleft;
i <= bright;
i++) {
142 }
143 if (nbins < 1) {
145 log << MSG::WARNING <<
"estimate_height() - top region is too small! left=" << left <<
" right=" << right <<
endmsg;
147 return -1;
148 }
151 return left;
152 }
VariableBinwidthHistogram m_vbh
Variable binwidth histogram.
◆ GetBackground()
| double MuonCalib::MTT0PatternRecognition::GetBackground |
( |
| ) |
const |
|
inline |
◆ GetError()
| bool MuonCalib::MTT0PatternRecognition::GetError |
( |
| ) |
const |
|
inline |
◆ GetEstimatedT0()
| double MuonCalib::MTT0PatternRecognition::GetEstimatedT0 |
( |
| ) |
const |
|
inline |
◆ GetFitRangeMax()
| double MuonCalib::MTT0PatternRecognition::GetFitRangeMax |
( |
| ) |
const |
|
inline |
◆ GetFitRangeMin()
| double MuonCalib::MTT0PatternRecognition::GetFitRangeMin |
( |
| ) |
const |
|
inline |
◆ GetHeight()
| double MuonCalib::MTT0PatternRecognition::GetHeight |
( |
| ) |
const |
|
inline |
◆ Initialize()
| bool MuonCalib::MTT0PatternRecognition::Initialize |
( |
TH1F * | hist, |
|
|
const T0MTSettings * | settings ) |
|
inline |
Initialize class - returns true if pattern recognition was successfull.
- Parameters
-
| hist | Histogram which is to be fitted |
Definition at line 53 of file MTT0PatternRecognition.h.
53 {
57 double scale_min = 0.;
61 }
double estimate_height(TH1F *hist)
estimates the height of the spectrum.
bool estimate_background(TH1F *hist, double scale_min)
estimates the background level
◆ m_background
| double MuonCalib::MTT0PatternRecognition::m_background |
|
private |
◆ m_draw_debug_graph
| bool MuonCalib::MTT0PatternRecognition::m_draw_debug_graph |
|
private |
◆ m_error
| bool MuonCalib::MTT0PatternRecognition::m_error |
|
private |
◆ m_fit_max
| double MuonCalib::MTT0PatternRecognition::m_fit_max |
|
private |
◆ m_fit_min
| double MuonCalib::MTT0PatternRecognition::m_fit_min |
|
private |
◆ m_height
| double MuonCalib::MTT0PatternRecognition::m_height |
|
private |
◆ m_settings
◆ m_t0_est
| double MuonCalib::MTT0PatternRecognition::m_t0_est |
|
private |
◆ m_vbh
The documentation for this class was generated from the following files: