33 const TObject&
object,
34 const dqm_core::AlgorithmConfig&
config) {
38 if(
object.
IsA()->InheritsFrom(
"TH1" )) {
41 throw dqm_core::BadConfig( ERS_HERE, name,
"dimension > 2 " );
44 throw dqm_core::BadConfig( ERS_HERE, name,
"does not inherit from TH2");
53 const TProfile* profile(
nullptr);
54 const TProfile2D* profile2D(
nullptr);
56 if(minBinEntries > 0) {
57 if (
object.InheritsFrom(
"TProfile")) profile =
dynamic_cast<const TProfile*
>(&
object);
58 else if (
object.InheritsFrom(
"TProfile2D")) profile2D =
dynamic_cast<const TProfile2D*
>(&
object);
62 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
70 double greenThreshold;
76 }
catch( dqm_core::Exception & ex ) {
77 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
80 TH1* resultHistogram =
nullptr;
81 if (publishHistogram) {
83 resultHistogram =
static_cast<TH1*
>(
histogram->Clone());
85 throw dqm_core::BadConfig( ERS_HERE, name,
"does not inherit from TH1" );
87 resultHistogram->Reset();
92 dqm_core::Result*
result =
new dqm_core::Result();
94 for (
int i = range[0]; i <= range[1]; ++i) {
95 for (
int j = range[2]; j <= range[3]; ++j) {
97 if (minBinEntries > 0) {
100 if (profile->GetBinEntries(
bin) < minBinEntries) {
104 }
else if (profile2D) {
105 if (profile2D->GetBinEntries(
bin) < minBinEntries) {
112 double binValue =
histogram->GetBinContent(i, j);
113 if((binValue == ignoreValue) || (binValue >
minValue && binValue <
maxValue ))
continue;
116 if (resultHistogram){
117 resultHistogram->SetBinContent(i, binValue);
118 if (publish && nBins < maxPublish) {
125 ERS_DEBUG(1,
"Number of bad bins is " << nBins );
126 ERS_DEBUG(1,
"Green threshold: " << greenThreshold <<
" bin(s); Red threshold : " << redThreshold <<
" bin(s) ");
128 result->tags_[
"NBins"] = nBins;
129 result->tags_[
"NSkippedBins"] = nSkippedBins;
130 if (resultHistogram)
result->object_ = boost::shared_ptr<TObject>(resultHistogram);
132 if (greenThreshold > redThreshold) {
133 if (nBins >= greenThreshold) {
134 result->status_ = dqm_core::Result::Green;
135 }
else if (nBins > redThreshold) {
136 result->status_ = dqm_core::Result::Yellow;
138 result->status_ = dqm_core::Result::Red;
141 if (nBins <= greenThreshold) {
142 result->status_ = dqm_core::Result::Green;
143 }
else if (nBins < redThreshold) {
144 result->status_ = dqm_core::Result::Yellow;
146 result->status_ = dqm_core::Result::Red;
static dqm_algorithms::BinContentComp myInstance