18 #include "dqm_core/exceptions.h"
19 #include "dqm_core/AlgorithmConfig.h"
20 #include "dqm_core/AlgorithmManager.h"
21 #include "dqm_core/Result.h"
38 : m_name(
"MDTTubeCheckError")
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());
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());
131 ERS_DEBUG(1,
"Undefined");
135 std::vector<int> Tubes;
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 );
164 if (Tubes.size()>0) {
165 for (
int k=0;
k<(
int)Tubes.size();
k++) {
166 std::string ToDB=
"ChangedStatusTube_";
168 result->tags_[ToDB] = Tubes[
k];
169 ERS_DEBUG(1,
"MDT Tube which changed status: "<<ToDB<<
" = "<<Tubes[
k] );
173 if ((EmptyTubes ==
range[1]) || ((LowStatTubes/
range[1]) > LowStatThre)) {
175 ERS_DEBUG(1,
"Undefined");
176 }
else if (
count >= redTh) {
179 }
else if (
count > greenTh) {
180 result->status_ = dqm_core::Result::Yellow;
181 ERS_DEBUG(1,
"Yellow");
184 ERS_DEBUG(1,
"Green");
196 message +=
"Description: Check if the number of entries in bins is less than BinThreshold and compare with Reference Histo \n";
197 message +=
"Mandatory Parameter: BinThreshold: Look for bins less than BinTreshold; Count number of bins satifying requirement \n";
198 message +=
"Mandatory Parameter: nErrBin: n-sigma of acceptance for check with the BinTreshold \n";
199 message +=
"Mandatory Parameter: ReferenceCheck: 0 if no check on reference is requested \n";
200 message +=
"Mandatory Green/Red Threshold: NBins: number of bins satifying requirement\n";
201 message +=
"Optional Parameters: MinStat = Minimum histogram statistics needed to perform Algorithm\n";
202 message +=
" LowStatErr = error threshold for bin with too low statistics \n";
203 message +=
" LowStatThre = threshold for fraction of bins with too low statistics \n";
204 message +=
" xmin: minimum x range\n";
205 message +=
" xmax: maximum x range\n";