9 #include <dqm_core/AlgorithmConfig.h>
12 #include <dqm_core/AlgorithmManager.h>
43 if (
lbs.empty())
return false;
44 if (
lbs.size() == 1)
return true;
45 const bool monotonic = std::is_sorted(
lbs.begin(),
lbs.end());
46 const bool withinRange = (
lbs.back() -
lbs.front() + 1) == std::ssize(
lbs);
47 return monotonic and withinRange;
53 const TObject&
object,
54 const dqm_core::AlgorithmConfig&
config )
58 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
61 throw dqm_core::BadConfig( ERS_HERE,
name,
"dimension > 2 " );
64 throw dqm_core::BadConfig( ERS_HERE,
name,
"does not inherit from TH1" );
75 if (greaterthan && lessthan) {
76 ERS_INFO(
"Both GreaterThan and LessThan parameters set: Will check for for both");
81 if (
histogram->GetEntries() < minstat ) {
97 catch( dqm_core::Exception & ex ) {
98 throw dqm_core::BadConfig( ERS_HERE,
name, ex.what(), ex );
101 TH1* resulthisto =
nullptr;
104 }
else if (
histogram->InheritsFrom(
"TH1")) {
107 throw dqm_core::BadConfig( ERS_HERE,
name,
"does not inherit from TH1" );
110 resulthisto->Reset();
114 std::vector<int> LBs;
121 double diff=inputcont - bin_threshold;
122 if (inputcont == ignoreval)
continue;
125 if (greaterthan &&
diff < 0. )
continue;
126 if (lessthan &&
diff > 0. )
continue;
127 if ( (std::abs(
sigma) > nsigmas) && (std::abs(
diff) > maxdiffabs) ) {
128 resulthisto->SetBinContent(
k,
l,inputcont);
130 if (publish && (
int)LBs.size() < maxpublish){
139 int count = LBs.size();
142 result->object_ = (boost::shared_ptr<TObject>)(TObject*)(resulthisto);
144 ERS_DEBUG(1,
"Number of bins " << nsigmas <<
" Sigma away from average of "<< bin_threshold <<
" is " <<
count);
145 ERS_DEBUG(1,
"Green threshold: "<< gthreshold <<
" bin(s); Red threshold : " << rthreshold <<
" bin(s) ");
147 if (
count <= gthreshold ) {
149 }
else if (
count < rthreshold ) {
150 result->status_ = dqm_core::Result::Yellow;
161 out<<
"BinsDiffFromPreviousLBs: Checks for number of bins (subsequent LBs) NSigma within threshold \n"<<std::endl;
163 out<<
"Mandatory Parameter: BinThreshold: Look for bins NSigna away from threshold \n"<<std::endl;
164 out<<
"Mandatory Parameter: NSigma: Number of sigma each bin must be within average bin value\n"<<std::endl;
165 out<<
"Mandatory Green/Red Threshold: NBins: number of bins N sigma away from average to give Green/Red result\n"<<std::endl;
167 out<<
"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm"<<std::endl;
168 out<<
"Optional Parameter: doCheckOnSingleLB: check done not necessarly on subsequent bins (set to 0)"<<std::endl;
169 out<<
"Optional Parameter: ignoreval: valued to be ignored for calculating average"<<std::endl;
170 out<<
"Optional Parameter: GreaterThan: check only for bins which are GreaterThan average (set to 1)"<<std::endl;
171 out<<
"Optional Parameter: LessThan: check only for bins which are LessThan average (set to 1)"<<std::endl;
172 out<<
"Optional Parameter: PublishBins: Save bins which are different from average in Result (set to 1)"<<std::endl;
173 out<<
"Optional Parameter: MaxPublish: Max number of bins to save (default 20)"<<std::endl;
174 out<<
"Optional Parameter: MaxDiffAbs: test fails if NBins more than NSigma away and NBins more than MaxDiffAbs (absolut difference) away from average"<<std::endl;