63{
64
65
66 const TEfficiency *
eff;
67 if(
object.
IsA()->InheritsFrom(
"TEfficiency" ))
68 {
69 eff =
static_cast<const TEfficiency*
>(&
object);
70 }
71 else {
72 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TEfficiency" );
73 }
74
75
78
81
85
86
91
92
93
94
95
96 const TH1* eff_hist =
eff->GetTotalHistogram();
97 const Int_t eff_points = eff_hist->GetNbinsX();
98 if (eff_points < minpoint || eff_points==0) {
99 if(
verbose)std::cout <<
name <<
" number of points are too small " << eff_points << std::endl;
100 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
101 result->tags_[
"InsufficientN"] = eff_points;
103 }
104 if(
verbose)std::cout <<
name <<
" enough number of points " << eff_points << std::endl;
105
106 const TAxis *
x = eff_hist->GetXaxis();
107 int nbins =
x->GetNbins();
108 double high =
x->GetBinUpEdge(nbins);
109 double low =
x->GetBinUpEdge(0);
110
111
113 throw dqm_core::BadConfig( ERS_HERE, name, "xmin and/or xmax value not in eff bin range" );
114 }
115
116 std::string option;
117
118
120
121
122 option="N";
123 } else {
124
125
126 option = "QN";
127 }
128
129
130
131 if ( minSig != 0 ) option += "E";
132 if ( improve ) option += "M";
133
135 std::cout <<
" eff name " <<
eff->GetName() << std::endl;
136 std::cout <<" fit option " << option << std::endl;
137 }
138
140 if(
verbose)std::cout <<
"set "<<
name<<
" parameters" << std::endl;
142 m_func->SetParameter(1,xaxismean);
143 m_func->SetParameter(2,xdiff/50.);
144 m_func->SetParNames(
"Plateau",
"Threshold",
"Resolution");
145
148 m_func->SetParLimits(2, 0., xdiff/4. );
149 }
150 else if(
m_name ==
"erf") {
151 if(
verbose)std::cout <<
"set "<<
name<<
" parameters" << std::endl;
153 m_func->SetParameter(1,xaxismean);
154 m_func->SetParameter(2,xdiff/50.);
155 m_func->SetParNames(
"Plateau",
"Threshold",
"Resolution");
156
159 m_func->SetParLimits(2, 0., xdiff/4. );
160 }
161 else if(
m_name ==
"flat") {
162 if(
verbose)std::cout <<
"set "<<
name<<
" parameters" << std::endl;
163 m_func->SetParNames(
"Height");
164 }
165
166
167
168
169
170
171
172
173
174 option += "R";
176
177 if(
verbose)std::cout <<
"fit "<<
name<<
" with interval cut " <<
xmin <<
" - " <<
xmax << std::endl;
178 std::shared_ptr<TGraphAsymmErrors> graph(
eff->CreateGraph());
179 graph->Fit(
m_func.get(), option.c_str());
180
181 const int numsig =
m_func->GetParNumber(
"Sigma");
182 if (numsig != -1 ){
184 m_func->SetParameter(numsig,std::abs(sigma));
185 }
186
187 try {
190 }
191 catch ( dqm_core::Exception & ex ) {
192 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
193 }
194}
#define IsA
Declare the TObject style functions.