59{
62
63 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
65 if (
hist->GetDimension() >= 2 ){
66 throw dqm_core::BadConfig( ERS_HERE, name, "dimension >= 2 " );
67 }
68 } else {
69 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
70 }
71
72
73 double minstat;
74 double greenTh;
75 double redTh;
76 try {
80 }
81 catch ( dqm_core::Exception & ex ) {
82 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
83 }
84
85
86
87 try {
88 ref =
static_cast<const TH1*
>(
config.getReference() );
89 }
90 catch ( dqm_core::Exception & ex ) {
91 throw dqm_core::BadRefHist(ERS_HERE,name," Could not retreive reference");
92 }
93 if (
hist->GetDimension() !=
ref->GetDimension() ) {
94 throw dqm_core::BadRefHist( ERS_HERE, name, "Reference VS histo: Different dimension!" );
95 }
96 if (
hist->GetNbinsX() !=
ref->GetNbinsX() ) {
97 throw dqm_core::BadRefHist( ERS_HERE, name, "Reference VS histo: Different bin numbre in X axis!" );
98 }
99
100
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();
106 }
107 ERS_DEBUG(1,
"Statistics: "<<
hist->GetEntries()<<
" entries ");
108
109
110
111
115 Double_t n_ref = 0;
117 int max_bin =
hist -> GetNbinsX();
120
121 if(N == 0){
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();
126 };
127
128 if(N_ref == 0){
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();
133 };
134
136 double norm_ref=1;
137
139 if(N_ref != 0) norm_ref=1/N_ref;
140
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++;
146 };
147
150
151
152
153
154 dqm_core::Result*
result =
new dqm_core::Result();
156
157 if (prob>greenTh) {
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;
165 ERS_DEBUG(1,"Red");
166 }
168}
const boost::regex ref(r_ef)
TGraphErrors * GetEntries(TH2F *histo)
double chi2(TH1 *h0, TH1 *h1)
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
#define IsA
Declare the TObject style functions.