34 {
35
37
38 if(
object.
IsA()->InheritsFrom(
"TH1" )) {
41 throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
42 }
43 } else {
44 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH2");
45 }
46
52
54 const TProfile2D* profile2D(nullptr);
56 if(minBinEntries > 0) {
58 else if (
object.InheritsFrom(
"TProfile2D")) profile2D =
dynamic_cast<const TProfile2D*
>(&
object);
59 }
60
62 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
65 }
66
69 double redThreshold;
70 double greenThreshold;
71 try {
76 } catch( dqm_core::Exception & ex ) {
77 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
78 }
79
80 TH1* resultHistogram = nullptr;
81 if (publishHistogram) {
83 resultHistogram =
static_cast<TH1*
>(
histogram->Clone());
84 } else {
85 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
86 }
87 resultHistogram->Reset();
88 }
89
91 int nSkippedBins = 0;
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) {
96
97 if (minBinEntries > 0) {
99 if (profile) {
100 if (
profile->GetBinEntries(bin) < minBinEntries) {
101 ++nSkippedBins;
102 continue;
103 }
104 } else if (profile2D) {
105 if (profile2D->GetBinEntries(bin) < minBinEntries) {
106 ++nSkippedBins;
107 continue;
108 }
109 }
110 }
111
112 double binValue =
histogram->GetBinContent(i, j);
113 if((binValue == ignoreValue) || (binValue >
minValue && binValue <
maxValue ))
continue;
114
116 if (resultHistogram){
117 resultHistogram->SetBinContent(i, binValue);
118 if (publish && nBins < maxPublish) {
120 }
121 }
122 }
123 }
124
125 ERS_DEBUG(1,"Number of bad bins is " << nBins );
126 ERS_DEBUG(1,"Green threshold: " << greenThreshold << " bin(s); Red threshold : " << redThreshold << " bin(s) ");
127
129 result->tags_[
"NSkippedBins"] = nSkippedBins;
130 if (resultHistogram)
result->object_ = boost::shared_ptr<TObject>(resultHistogram);
131
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;
137 } else {
138 result->status_ = dqm_core::Result::Red;
139 }
140 } else {
141 if (nBins <= greenThreshold) {
142 result->status_ = dqm_core::Result::Green;
143 } else if (nBins < redThreshold) {
144 result->status_ = dqm_core::Result::Yellow;
145 } else {
146 result->status_ = dqm_core::Result::Red;
147 }
148 }
149
151}
#define maxValue(current, test)
#define minValue(current, test)
TProfile(*args, **kwargs)
#define IsA
Declare the TObject style functions.