59 if (
object.
IsA()->InheritsFrom(
"TH2") ) {
60 throw dqm_core::BadConfig( ERS_HERE ,
name ,
" dimension > 1 ");
64 if (
object.
IsA()->InheritsFrom(
"TH1") ) {
67 throw dqm_core::BadConfig( ERS_HERE ,
name ,
" does not inherit from TH1");
76 std::ostringstream
msg;
77 msg <<
" Parameter \"SkipBinModulo\" is out of bounds. Value given = " << skipmod;
78 msg <<
"\n Range of values acceptable: integer >= 1";
79 msg <<
"\n Default Value: skip none. Do not set \"SkipBinModulo\" in your config to use default";
80 throw dqm_core::BadConfig(ERS_HERE,
name,
msg.str());
85 if (signL < 0.01 || signL > 0.95) {
86 std::ostringstream
msg;
87 msg <<
" Parameter \"Significance\" is out of bounds. Value given = " << signL;
88 msg <<
"\n Range of values acceptable: floating point number [0.01, 0.95]";
89 msg <<
"\n Default Value: 0.04. Do not set \"Significance\" in your config to use default";
90 throw dqm_core::BadConfig(ERS_HERE,
name,
msg.str());
96 std::ostringstream
msg;
97 msg <<
" Parameter \"MinStatPerBin\" is out of bounds. Value given = " << signL;
98 msg <<
"\n Range of values acceptable: integer >= 0";
99 msg <<
"\n Default Value: 10. Do not set \"MinStatPerBin\" in your config to use default";
100 throw dqm_core::BadConfig(ERS_HERE,
name,
msg.str());
105 const double notFound = -99999;
108 const int minbin = (
xmin == notFound) ? 1 :
histogram->GetXaxis()->FindBin(
xmin);
110 ERS_DEBUG(1,
"xmin = " <<
xmin <<
", xmax = " <<
xmax <<
" , minbin = " << minbin <<
", maxbin = " << maxbin);
114 ERS_DEBUG(1,
"useMinStat = " << useMinStat);
122 }
catch ( dqm_core::Exception & ex ) {
123 throw dqm_core::BadConfig(ERS_HERE,
name,
"Paramter: 'Threshold' is mandatory, cannot continue");
126 if ( grThr > 1.0 || reThr > 1.0) {
127 throw dqm_core::BadConfig(ERS_HERE,
m_name,
"Configuration Error: Threshold>100%");
132 std::vector<float> binCountVec;
133 std::vector<size_t> binIndices;
136 for(
int k = minbin;
k < maxbin;
k++) {
138 if (
k % skipmod == 0) {}
141 binCountVec.push_back(binval);
142 if((binval <= minStat) && useMinStat) {
143 binIndices.push_back(binc);
150 int minOutliers = binIndices.size();
151 int maxOutliers, nOutliers = minOutliers;
152 int nbinsDenominator = binCountVec.size();
156 std::ostringstream
msg;
159 maxOutliers =
GrubbsTest(binCountVec,binIndices,signL);
162 msg<<
"maxOutliers = " << maxOutliers <<
"\t bincountVecsize = " << nbinsDenominator <<
"\t";
163 if(binIndices.size() <= binCountVec.size())
164 for(
size_t g= 0;
g < binIndices.size();
g++)
165 msg << binIndices[
g] <<
":" << binCountVec[binIndices[
g]] <<
"\n";
166 ERS_DEBUG(1,
msg.str());
168 }
catch ( dqm_core::Exception & ex ) {
169 msg <<
" Exception caught in GrubbsTest \n";
170 throw dqm_core::BadConfig(ERS_HERE,
name,
msg.str());
174 if(maxOutliers >= 0) {
175 nOutliers += (useMinStat ? maxOutliers : 0);
177 result->tags_.insert(std::make_pair(
"NumOfOutliers",nOutliers));
180 float totalBins = nbinsDenominator > 0 ? nbinsDenominator :
histogram->GetNbinsX();
181 float outlierFraction = 0.;
183 bool IsInf = isinf(
float(nOutliers) / totalBins);
184 bool IsNaN = isnan(
float(nOutliers) / totalBins);
186 bool IsInf = std::isinf(
float(nOutliers) / totalBins);
187 bool IsNaN = std::isnan(
float(nOutliers) / totalBins);
190 outlierFraction =
float(nOutliers) / totalBins;
192 result->tags_.insert(std::make_pair(
"OutlierFraction",outlierFraction));
194 msg <<
"Outlier fraction = "<< nOutliers <<
"/" << totalBins <<
" = " << outlierFraction;
195 ERS_DEBUG(1,
msg.str());
201 if ( outlierFraction>reThr )
203 ERS_DEBUG(1,
"[RED] Result : "<<outlierFraction);
207 else if ( outlierFraction > grThr )
209 ERS_DEBUG(1,
"[YELLOW] Result : "<<outlierFraction);
210 result->status_=dqm_core::Result::Yellow;
214 if ( outlierFraction < reThr )
216 ERS_DEBUG(1,
"[RED] Result : "<<outlierFraction);
220 else if ( outlierFraction < grThr )
222 ERS_DEBUG(1,
"[YELLOW] Result : "<<outlierFraction);
223 result->status_=dqm_core::Result::Yellow;
229 ERS_DEBUG(1,
"[GREEN] Result");