60 const TObject &
object,
61 const dqm_core::AlgorithmConfig &
config )
66 if(
object.
IsA()->InheritsFrom(
"TGraph" ))
68 graph =
static_cast<const TGraph*
>(&
object);
71 throw dqm_core::BadConfig( ERS_HERE, name,
"does not inherit from TGraph" );
95 if (graph->GetN() < minpoint || graph->GetN()==0) {
96 if(
verbose)std::cout << name <<
" number of points are too small " << graph->GetN() << std::endl;
97 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
98 result->tags_[
"InsufficientN"] = graph->GetN();
101 if(
verbose)std::cout << name <<
" enough number of points " << graph->GetN() << std::endl;
103 TAxis *
x = graph->GetXaxis();
104 int nbins =
x->GetNbins();
105 double high =
x->GetBinUpEdge(nbins);
106 double low =
x->GetBinUpEdge(0);
110 throw dqm_core::BadConfig( ERS_HERE, name,
"xmin and/or xmax value not in graph bin range" );
128 if ( minSig != 0 ) option +=
"E";
129 if ( improve ) option +=
"M";
132 std::cout <<
" graph name " << graph->GetName() << std::endl;
133 std::cout <<
" fit option " << option << std::endl;
137 if(
verbose)std::cout <<
"set "<<name<<
" parameters" << std::endl;
139 m_func->SetParameter(1,xaxismean);
140 m_func->SetParameter(2,xdiff/50.);
141 m_func->SetParNames(
"Plateau",
"Threshold",
"Resolution");
145 m_func->SetParLimits(2, 0., xdiff/4. );
147 else if(
m_name ==
"erf") {
148 if(
verbose)std::cout <<
"set "<<name<<
" parameters" << std::endl;
150 m_func->SetParameter(1,xaxismean);
151 m_func->SetParameter(2,xdiff/50.);
152 m_func->SetParNames(
"Plateau",
"Threshold",
"Resolution");
156 m_func->SetParLimits(2, 0., xdiff/4. );
158 else if(
m_name ==
"flat") {
159 if(
verbose)std::cout <<
"set "<<name<<
" parameters" << std::endl;
160 m_func->SetParNames(
"Height");
171 if(
verbose)std::cout <<
"fit "<<name<<
" with interval cut " <<
xmin <<
" - " <<
xmax << std::endl;
172 const_cast<TGraph*
>(graph)->Fit(
m_func.get(), option.c_str(),
"",
xmin,
xmax );
174 const int numsig =
m_func->GetParNumber(
"Sigma");
176 double sigma=
m_func->GetParameter(numsig);
177 m_func->SetParameter(numsig,std::abs(sigma));
184 catch ( dqm_core::Exception & ex ) {
185 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );