62 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
65 throw dqm_core::BadConfig( ERS_HERE, name,
"dimension >= 2 " );
68 throw dqm_core::BadConfig( ERS_HERE, name,
"does not inherit from TH1" );
90 catch ( dqm_core::Exception & ex ) {
91 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
97 refhist =
static_cast<const TH1*
>(
config.getReference() );
99 catch ( dqm_core::Exception & ex ) {
100 throw dqm_core::BadRefHist(ERS_HERE,name,
" Could not retreive reference");
102 if (
histogram->GetDimension() != refhist->GetDimension() ) {
103 throw dqm_core::BadRefHist( ERS_HERE, name,
"Reference VS histo: Different dimension!" );
105 if (
histogram->GetNbinsX() != refhist->GetNbinsX() ) {
106 throw dqm_core::BadRefHist( ERS_HERE, name,
"Reference VS histo: Different number of bins!" );
111 if (
histogram->GetEntries() < minstat ) {
112 ERS_INFO(
"Histogram does not satisfy MinStat requirement " <<
histogram->GetName());
113 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
117 ERS_DEBUG(1,
"Statistics: "<<
histogram->GetEntries()<<
" entries ");
120 std::vector<int> range;
124 ERS_INFO(
"Histogram has not dimension 1 : " <<
histogram->GetName());
125 throw dqm_core::Exception( ERS_HERE,
histogram->GetName() );
128 ERS_INFO(
"Empty histogram: " <<
histogram->GetName());
129 dqm_core::Result*
result =
new dqm_core::Result();
130 result->status_ = dqm_core::Result::Undefined;
131 ERS_DEBUG(1,
"Undefined");
135 std::vector<int> Tubes;
138 for (
int i = range[0]; i <= range[1]; ++i ) {
139 double Content =
histogram->GetBinContent(i);
140 double ErrCont =
histogram->GetBinError(i);
141 if (ErrCont > LowStatErr) LowStatTubes++;
142 if (Content+std::abs(ErrCont) != 0.) {
143 if ((Content + nErr*ErrCont) < bin_threshold ) {
145 double RefCont = refhist->GetBinContent(i);
146 double RefErrCont = refhist->GetBinError(i);
147 double Diff = std::abs(Content - RefCont);
148 double ErrDiff = sqrt(ErrCont*ErrCont + RefErrCont*RefErrCont);
149 if (Diff > nErr*ErrDiff) {
158 }
else { ++EmptyTubes; }
160 ERS_DEBUG(1,
"Number of bins " << name <<
" different from a treshold of " << bin_threshold <<
" is " <<
count );
162 dqm_core::Result*
result =
new dqm_core::Result();
164 if (Tubes.size()>0) {
165 for (
int k=0; k<(int)Tubes.size(); k++) {
166 std::string ToDB=
"ChangedStatusTube_";
167 ToDB += std::to_string(k+1);
168 result->tags_[ToDB] = Tubes[k];
169 ERS_DEBUG(1,
"MDT Tube which changed status: "<<ToDB<<
" = "<<Tubes[k] );
173 if ((EmptyTubes == range[1]) || ((
static_cast<double>(LowStatTubes)/range[1]) > LowStatThre)) {
174 result->status_ = dqm_core::Result::Undefined;
175 ERS_DEBUG(1,
"Undefined");
176 }
else if (
count >= redTh) {
177 result->status_ = dqm_core::Result::Red;
179 }
else if (
count > greenTh) {
180 result->status_ = dqm_core::Result::Yellow;
181 ERS_DEBUG(1,
"Yellow");
183 result->status_ = dqm_core::Result::Green;
184 ERS_DEBUG(1,
"Green");