43{
45
46 if(
object.
IsA()->InheritsFrom(
"TH2" )) {
49 throw dqm_core::BadConfig( ERS_HERE, name, "dimension != 2 " );
50 }
51 } else {
52 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH2");
53 }
54
55
64
65 std::set<int> ignoredBins;
66 for (
const std::pair<std::string,double> keyValuePair :
config.getParameters()) {
67 if (keyValuePair.first.compare(0, 9, "IgnoreBin") == 0) {
68 ignoredBins.insert(keyValuePair.second);
69 }
70 }
71
72 TH2* refhist=0;
73 if (useReference) {
74 refhist =
static_cast<TH2 *
>(
config.getReference() );
75 }
76
77 if(refhist !=0){
78 if(refhist->InheritsFrom( "TH2" )) {
79 if (refhist->GetDimension() != 2 ){
80 throw dqm_core::BadConfig( ERS_HERE, name, "reference histogram dimension != 2 " );
81 }
82 } else {
83 throw dqm_core::BadConfig( ERS_HERE, name, "reference does not inherit from TH2");
84 }
85 if ((
histogram->GetNbinsX() != refhist->GetNbinsX()) || (
histogram->GetNbinsY() != refhist->GetNbinsY())) {
86 throw dqm_core::BadRefHist( ERS_HERE, "number of bins", name );
87 }
88 }
89
90
91
92
93 if ( !testrows && okbin >
histogram->GetNbinsX() ) {
94 throw dqm_core::BadConfig( ERS_HERE, name, " MaskedBin is outside range" );
95 }
96 if ( testrows && okbin >
histogram->GetNbinsY() ) {
97 throw dqm_core::BadConfig( ERS_HERE, name, " MaskedBin is outside range" );
98 }
99
100 double gthreshold;
101 double rthreshold;
102 try {
105 }
106 catch( dqm_core::Exception & ex ) {
107 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
108 }
109
110
111 int redcount = 0;
112 int yellowcount = 0;
113 int redrows= 0;
114 int yellowrows = 0;
116
117 if (useTotalEntries) {
119 if (totalEntries == 0) {
120 useTotalEntries = 0;
121 dorate = 0;
122 }
123 }
124
125 if (entriesBin > -1) {
128 }
129
130 dqm_core::Result*
result =
new dqm_core::Result();
133 std::vector<float> rowtotal;
134 rowtotal.clear();
135
136 if (dorate && !useTotalEntries) {
137 for(
int i =0;
i<
max; ++
i){ rowtotal.push_back(0.0); }
138
140 for(
int j =1; j<
histogram->GetNbinsY()+1; ++j){
141 if(testrows==0 && j == maskedbin ) continue;
142 if(testrows==1 && i == maskedbin ) continue;
143 if( testrows ) {
144 rowtotal[j-1] +=
histogram->GetBinContent(i,j);
145 } else {
146 rowtotal[
i-1] +=
histogram->GetBinContent(i,j);
147 }
148 }
149 }
150 }
151
152
153
154
155
157 for(
int j =1; j<
histogram->GetNbinsY()+1; ++j){
158 float bincontent=
histogram->GetBinContent(i,j);
159 if (dorate) {
160 if (useTotalEntries) {
162 } else if (testrows) {
163 bincontent /= rowtotal[j - 1];
164 } else {
165 bincontent /= rowtotal[
i - 1];
166 }
167 }
168
169 if(bincontent>gthreshold){
170 if( testrows==1 &&
histogram->GetBinContent(maskedbin,j) != 0)
continue;
171 if( testrows==0 &&
histogram->GetBinContent(i,maskedbin) != 0)
continue;
172
174 if (ignoredBins.count(bin)) continue;
175
176 if(refhist != 0){
177 if( refhist->GetBinContent(i,j) != 0){
178 if(bincontent < 1.0-gthreshold && bincontent > 1.0-rthreshold ) ++yellowrows;
179 if(bincontent < 1.0-rthreshold ) ++redrows;
180 continue;
181 }
182 }
183 if( testrows==0 && j == okbin){
184 if(bincontent < 1.0-gthreshold && bincontent > 1.0-rthreshold ) ++yellowrows;
185 if(bincontent < 1.0-rthreshold ) redrows++;
186 continue; }
187 if( testrows==1 && i == okbin){
188 if(bincontent < 1.0-gthreshold && bincontent > 1.0-rthreshold ) ++yellowrows;
189 if(bincontent < 1.0-rthreshold ) ++redrows;
190 continue; }
191
192 ERS_DEBUG(1,"Found bin : ("<< i<< ","<<j<<" ) = " << bincontent ) ;
193
195 if(bincontent>rthreshold){
196 ++redcount;
197 }else{
198 ++yellowcount;
199 }
200 }
201
202 }
203 }
204
205
206 if (checkstrip) {
207 if (dorate) {
208 if(redrows > 0 ){
209 result->tags_[
"RedRows"] = redrows;
210 result->status_ = dqm_core::Result::Red;
212 } else if (yellowrows > 0 ){
213 result->tags_[
"YellowRows"] = yellowrows;
214 result->status_ = dqm_core::Result::Yellow;
216 }
217 }
218
219 } else {
220 if( redcount > 0 ) {
221 result->tags_[
"RedBins"] = redcount;
222 result->status_ = dqm_core::Result::Red;
224 } else if(yellowcount > 0 ) {
225 result->tags_[
"YellowBins"] = yellowcount;
226 result->status_ = dqm_core::Result::Yellow;
228 }
229 }
230
231
232 result->status_ = dqm_core::Result::Green;
234
235}
#define IsA
Declare the TObject style functions.