63 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
64 hist =
static_cast<const TH1*
>(&
object);
65 if (hist->GetDimension() >= 2 ){
66 throw dqm_core::BadConfig( ERS_HERE, name,
"dimension >= 2 " );
69 throw dqm_core::BadConfig( ERS_HERE, name,
"does not inherit from TH1" );
81 catch ( dqm_core::Exception & ex ) {
82 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
88 ref =
static_cast<const TH1*
>(
config.getReference() );
90 catch ( dqm_core::Exception & ex ) {
91 throw dqm_core::BadRefHist(ERS_HERE,name,
" Could not retreive reference");
93 if (hist->GetDimension() !=
ref->GetDimension() ) {
94 throw dqm_core::BadRefHist( ERS_HERE, name,
"Reference VS histo: Different dimension!" );
96 if (hist->GetNbinsX() !=
ref->GetNbinsX() ) {
97 throw dqm_core::BadRefHist( ERS_HERE, name,
"Reference VS histo: Different bin numbre in X axis!" );
101 if (hist->GetEntries() < minstat ) {
102 ERS_INFO(
"Histogram does not satisfy MinStat requirement " <<hist->GetName());
103 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
104 result->tags_[
"InsufficientEntries"] = hist->GetEntries();
107 ERS_DEBUG(1,
"Statistics: "<< hist->GetEntries()<<
" entries ");
117 int max_bin = hist -> GetNbinsX();
122 ERS_INFO(
"Histogram has no entries" <<hist->GetName());
123 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
124 result->tags_[
"InsufficientEntries"] = hist->GetEntries();
129 ERS_INFO(
"Reference histogram has no entries" <<hist->GetName());
130 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
131 result->tags_[
"InsufficientRefEntries"] =
ref->GetEntries();
139 if(N_ref != 0) norm_ref=1/N_ref;
141 for(i=1;i<=max_bin;i++){
142 n = hist->GetBinContent(i);
143 n_ref =
ref->GetBinContent(i);
144 if( n != 0 || n_ref != 0)
chi2+=(n*norm-n_ref*norm_ref)*(n*norm-n_ref*norm_ref)/(n*norm*norm+n_ref*norm_ref*norm_ref);
145 if( n == 0 && n_ref == 0)
count++;
154 dqm_core::Result*
result =
new dqm_core::Result();
155 result->tags_[
"chi2_prob"] = prob;
158 result->status_ = dqm_core::Result::Green;
159 ERS_DEBUG(1,
"Green");
160 }
else if ( prob<=greenTh && prob>redTh ) {
161 result->status_ = dqm_core::Result::Yellow;
162 ERS_DEBUG(1,
"Yellow");
163 }
else if (prob<=redTh) {
164 result->status_ = dqm_core::Result::Red;