9 #include <dqm_core/AlgorithmConfig.h>
12 #include <dqm_core/AlgorithmManager.h>
44 const TObject&
object,
45 const dqm_core::AlgorithmConfig&
config )
49 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
52 throw dqm_core::BadConfig( ERS_HERE,
name,
"dimension > 2 " );
55 throw dqm_core::BadConfig( ERS_HERE,
name,
"does not inherit from TH1" );
67 if (greaterthan && lessthan) {
68 ERS_INFO(
"Both GreaterThan and LessThan parameters set: Will check for for both");
73 if (
histogram->GetEntries() < minstat ) {
87 catch( dqm_core::Exception & ex ) {
88 throw dqm_core::BadConfig( ERS_HERE,
name, ex.what(), ex );
97 }
else if (
histogram->InheritsFrom(
"TH1")) {
100 throw dqm_core::BadConfig( ERS_HERE,
name,
"does not inherit from TH1" );
103 resulthisto->Reset();
109 for (
int j =
range[2]; j <=
range[3]; ++j ) {
110 if (
histogram->GetBinContent(
i,j) == ignoreval)
continue;
111 if (
histogram->GetBinError(
i,j) == 0 )
continue;
122 result->tags_[
"SumErrors"] = sume;
138 if (inputcont == ignoreval)
continue;
141 if (greaterthan &&
diff < 0. )
continue;
142 if (lessthan &&
diff > 0. )
continue;
144 if ( (std::abs(
sigma) > bin_threshold) && (std::abs(
diff) > maxdiffabs) && (std::abs(
reldiff) > maxdiffrel) ) {
145 resulthisto->SetBinContent(
k,
l,inputcont);
147 if (publish &&
count < maxpublish){
157 result->object_ = (boost::shared_ptr<TObject>)(TObject*)(resulthisto);
159 ERS_DEBUG(1,
"Number of bins " << bin_threshold <<
" Sigma away from average of "<<
avg <<
" is " <<
count);
160 ERS_DEBUG(1,
"Green threshold: "<< gthreshold <<
" bin(s); Red threshold : " << rthreshold <<
" bin(s) ");
164 if (
count <= gthreshold ) {
166 }
else if (
count < rthreshold ) {
167 result->status_ = dqm_core::Result::Yellow;
178 out<<
"Bins_Diff_FromAvg: Calculates average bin value and checks number of bins N sigma away from calculated average\n"<<std::endl;
180 out<<
"Mandatory Parameter: NSigma: Number of sigma each bin must be within average bin value\n"<<std::endl;
183 out<<
"Mandatory Green/Red Threshold: NBins: number of bins N sigma away from average to give Green/Red result\n"<<std::endl;
185 out<<
"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm"<<std::endl;
186 out<<
"Optional Parameter: xmin: minimum x range"<<std::endl;
187 out<<
"Optional Parameter: xmax: maximum x range"<<std::endl;
188 out<<
"Optional Parameter: ymin: minimum y range"<<std::endl;
189 out<<
"Optional Parameter: ymax: maximum y range"<<std::endl;
190 out<<
"Optional Parameter: ignoreval: valued to be ignored for calculating average"<<std::endl;
191 out<<
"Optional Parameter: GreaterThan: check only for bins which are GreaterThan average (set to 1)"<<std::endl;
192 out<<
"Optional Parameter: LessThan: check only for bins which are LessThan average (set to 1)"<<std::endl;
193 out<<
"Optional Parameter: PublishBins: Save bins which are different from average in Result (set to 1)"<<std::endl;
194 out<<
"Optional Parameter: MaxPublish: Max number of bins to save (default 20)"<<std::endl;
195 out<<
"Optional Parameter: MaxDiffAbs: test fails if NBins more than NSigma away and NBins more than MaxDiffAbs (absolut difference) away from average"<<std::endl;
196 out<<
"Optional Parameter: MaxDiffRel: test fails if NBins more than NSigma away and NBins more than MaxDiffRel (relative difference) away from average\n"<<std::endl;