#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 glose to lower histogram range!" <<
endmsg;
47 return false;
48 }
49
51 double back_squared = 0.0;
52 double n_bins = 0.0;
53 double referece_chi2 = 0.0;
55 n_bins++;
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);
61 }
62 if (n_bins >
m_settings->MinBackgroundBins()) {
64 double chi2 = 2 * (back_squared / n_bins - bac * bac);
65 if (
chi2 > 5 * referece_chi2)
break;
66 }
67 }
69
72
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");
76 }
77
78 return true;
79 }
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 85 of file MTT0PatternRecognition.cxx.
85 {
86
87 if (!
m_vbh.Smooth(
hist->GetBinWidth(1))) {
89 return -1;
90 }
91 if (!
m_vbh.Smooth(
hist->GetBinWidth(1) / 2)) {
93 return -1;
94 }
95
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");
102 }
103
104 double lower =
m_vbh.GetSortedBin(0).Width();
105 double left(9e9), right(-9e9);
106
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();
110
111
112
113 if ((
m_vbh.GetSortedBin(i).Width() - lower) >
hist->GetBinWidth(1) / 100.0) {
114
115 if (right - left > 50 && i > 20) break;
116 lower =
m_vbh.GetSortedBin(i).Width();
117 }
118 }
119
121 (
new TLine(left, 0, left,
hist->GetMaximum()))->Write(
"t0_height_left");
122 (
new TLine(right, 0, right,
hist->GetMaximum()))->Write(
"t0_height_right");
123 }
124
125 int bleft(
hist->FindBin(left)), bright(
hist->FindBin(right));
128 for (
int i = bleft;
i <= bright;
i++) {
131 }
132 if (nbins < 1) {
134 log << MSG::WARNING <<
"estimate_height() - top region is too small! left=" << left <<
" right=" << right <<
endmsg;
136 return -1;
137 }
140 return left;
141 }
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: