19 #include "dqm_core/exceptions.h"
20 #include "dqm_core/AlgorithmConfig.h"
21 #include "dqm_core/AlgorithmManager.h"
22 #include "dqm_core/Result.h"
39 : m_name(
"MDTTubeCheckError")
63 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
66 throw dqm_core::BadConfig( ERS_HERE,
name,
"dimension >= 2 " );
69 throw dqm_core::BadConfig( ERS_HERE,
name,
"does not inherit from TH1" );
91 catch ( dqm_core::Exception & ex ) {
92 throw dqm_core::BadConfig( ERS_HERE,
name, ex.what(), ex );
98 refhist =
static_cast<const TH1*
>(
config.getReference() );
100 catch ( dqm_core::Exception & ex ) {
101 throw dqm_core::BadRefHist(ERS_HERE,
name,
" Could not retreive reference");
103 if (
histogram->GetDimension() != refhist->GetDimension() ) {
104 throw dqm_core::BadRefHist( ERS_HERE,
name,
"Reference VS histo: Different dimension!" );
106 if (
histogram->GetNbinsX() != refhist->GetNbinsX() ) {
107 throw dqm_core::BadRefHist( ERS_HERE,
name,
"Reference VS histo: Different number of bins!" );
112 if (
histogram->GetEntries() < minstat ) {
113 ERS_INFO(
"Histogram does not satisfy MinStat requirement " <<
histogram->GetName());
118 ERS_DEBUG(1,
"Statistics: "<<
histogram->GetEntries()<<
" entries ");
121 std::vector<int>
range;
125 ERS_INFO(
"Histogram has not dimension 1 : " <<
histogram->GetName());
126 throw dqm_core::Exception( ERS_HERE,
histogram->GetName() );
129 ERS_INFO(
"Empty histogram: " <<
histogram->GetName());
132 ERS_DEBUG(1,
"Undefined");
136 std::vector<int> Tubes;
142 if (ErrCont > LowStatErr) LowStatTubes++;
143 if (Content+std::abs(ErrCont) != 0.) {
144 if ((Content + nErr*ErrCont) < bin_threshold ) {
147 double RefErrCont = refhist->GetBinError(
i);
148 double Diff = std::abs(Content - RefCont);
149 double ErrDiff = sqrt(ErrCont*ErrCont + RefErrCont*RefErrCont);
150 if (Diff > nErr*ErrDiff) {
159 }
else { ++EmptyTubes; }
161 ERS_DEBUG(1,
"Number of bins " <<
name <<
" different from a treshold of " << bin_threshold <<
" is " <<
count );
165 if (Tubes.size()>0) {
166 for (
int k=0;
k<(
int)Tubes.size();
k++) {
167 std::string ToDB=
"ChangedStatusTube_";
169 asprintf(&nn,
"%i",
k+1);
171 result->tags_[ToDB] = Tubes[
k];
172 ERS_DEBUG(1,
"MDT Tube which changed status: "<<ToDB<<
" = "<<Tubes[
k] );
176 if ((EmptyTubes ==
range[1]) || ((LowStatTubes/
range[1]) > LowStatThre)) {
178 ERS_DEBUG(1,
"Undefined");
179 }
else if (
count >= redTh) {
182 }
else if (
count > greenTh) {
183 result->status_ = dqm_core::Result::Yellow;
184 ERS_DEBUG(1,
"Yellow");
187 ERS_DEBUG(1,
"Green");
199 message +=
"Description: Check if the number of entries in bins is less than BinThreshold and compare with Reference Histo \n";
200 message +=
"Mandatory Parameter: BinThreshold: Look for bins less than BinTreshold; Count number of bins satifying requirement \n";
201 message +=
"Mandatory Parameter: nErrBin: n-sigma of acceptance for check with the BinTreshold \n";
202 message +=
"Mandatory Parameter: ReferenceCheck: 0 if no check on reference is requested \n";
203 message +=
"Mandatory Green/Red Threshold: NBins: number of bins satifying requirement\n";
204 message +=
"Optional Parameters: MinStat = Minimum histogram statistics needed to perform Algorithm\n";
205 message +=
" LowStatErr = error threshold for bin with too low statistics \n";
206 message +=
" LowStatThre = threshold for fraction of bins with too low statistics \n";
207 message +=
" xmin: minimum x range\n";
208 message +=
" xmax: maximum x range\n";