154 if (!
data.IsA()->InheritsFrom(
"TH1")) {
155 throw dqm_core::BadConfig(ERS_HERE,
name,
"does not inherit from TH1");
157 const TH1*
h =
static_cast<const TH1*
>(&
data);
158 if (
h->GetDimension() > 2) {
159 throw dqm_core::BadConfig(ERS_HERE,
name,
"dimension > 2 ");
174 catch (dqm_core::Exception & ex) {
175 throw dqm_core::BadConfig( ERS_HERE,
name, ex.what(), ex );
177 if ( UseValue == 0 ) ERS_INFO(
"UseValue == 0 is meaningless");
182 if (
data.IsA()->InheritsFrom(
"TProfile") ) {
188 std::vector<BinThresh::mask_limits> Limits;
192 catch (dqm_core::Exception & ex) {
193 throw dqm_core::BadConfig( ERS_HERE,
name, ex.what(), ex );
198 if ((UseValue > 0 && Limits[
bin].WarningValue > Limits[
bin].ErrorValue) ||
199 (UseValue < 0 && Limits[
bin].WarningValue < Limits[
bin].ErrorValue)) {
201 if ( !Limits[
bin].Mask ) {
202 std::string problem_message = Form(
"Incompatible Warning and Error Values in bin_%d : Warning = %e -> Error = %e",
bin + 1, Limits[
bin].WarningValue, Limits[
bin].ErrorValue);
203 ERS_INFO(problem_message.c_str());
209 double h_entries = hp->GetEntries();
212 Limits[
bin].WarningValue = Limits[
bin].WarningValue * h_entries;
213 Limits[
bin].ErrorValue = Limits[
bin].ErrorValue * h_entries;
219 double bincon = hp->GetBinContent(
bin + 1);
220 if ( !Limits[
bin].Mask && hp->GetBinEntries(
bin + 1) >= BinMinEntries ) {
222 if ((UseValue == 1 && bincon >= Limits[
bin].ErrorValue) ||
223 (UseValue > 1 && bincon > Limits[
bin].ErrorValue) ||
224 (UseValue == -1 && bincon <= Limits[
bin].ErrorValue) ||
225 (UseValue < -1 && bincon < Limits[
bin].ErrorValue) ) {
227 if ( NErrors + NWarnings + NGoodPrint <= Publish ) {
228 double binval = hp->GetXaxis()->GetBinCenter(
bin + 1);
233 std::string binname = Form(
"%s_ErrorBin(%u | %.*e)",
name.c_str(),
bin, 2, binval);
235 if ( TypeValue > 0.5 ) {
236 result->tags_[binname.c_str()] = (bincon / h_entries);
238 result->tags_[binname.c_str()] = bincon;
243 else if ((UseValue == 1 && bincon >= Limits[
bin].WarningValue) ||
244 (UseValue > 1 && bincon > Limits[
bin].WarningValue) ||
245 (UseValue == -1 && bincon <= Limits[
bin].WarningValue) ||
246 (UseValue < -1 && bincon < Limits[
bin].WarningValue) ) {
248 if ( TypePublish >= 1 && NErrors + NWarnings + NGoodPrint <= Publish ) {
249 float binval = hp->GetXaxis()->GetBinCenter(
bin + 1);
253 std::string binname = Form(
"%s_WarningBin(%u | %.*e)",
name.c_str(),
bin, 2, binval);
254 if ( TypeValue > 0.5 ) {
255 result->tags_[binname.c_str()] = (bincon / h_entries);
257 result->tags_[binname.c_str()] = bincon;
264 if ( TypePublish >= 2 && NErrors + NWarnings + NGoodPrint <= Publish ) {
265 float binval = hp->GetXaxis()->GetBinCenter(
bin + 1);
269 std::string binname = Form(
"%s_GoodBin(%u | %.*e)",
name.c_str(),
bin, 2, binval);
270 if ( TypeValue > 0.5 ) {
271 result->tags_[binname.c_str()] = (bincon / h_entries);
273 result->tags_[binname.c_str()] = bincon;
284 if ( (!
data.IsA()->InheritsFrom(
"TProfile")) &&
h->GetDimension() == 1 ) {
288 std::vector<BinThresh::mask_limits> Limits;
292 catch (dqm_core::Exception & ex) {
293 throw dqm_core::BadConfig( ERS_HERE,
name, ex.what(), ex );
298 if ((UseValue > 0 && Limits[
bin].WarningValue > Limits[
bin].ErrorValue) ||
299 (UseValue < 0 && Limits[
bin].WarningValue < Limits[
bin].ErrorValue)) {
301 if ( !Limits[
bin].Mask ) {
302 std::string problem_message = Form(
"Incompatible Warning and Error Values in bin_%d : Warning = %e -> Error = %e",
bin + 1, Limits[
bin].WarningValue, Limits[
bin].ErrorValue);
303 ERS_INFO(problem_message.c_str());
309 double h_entries =
h->GetEntries();
312 Limits[
bin].WarningValue = Limits[
bin].WarningValue * h_entries;
313 Limits[
bin].ErrorValue = Limits[
bin].ErrorValue * h_entries;
319 double bincon =
h->GetBinContent(
bin + 1);
320 if ( !Limits[
bin].Mask ) {
322 if ((UseValue == 1 && bincon >= Limits[
bin].ErrorValue) ||
323 (UseValue > 1 && bincon > Limits[
bin].ErrorValue) ||
324 (UseValue == -1 && bincon <= Limits[
bin].ErrorValue) ||
325 (UseValue < -1 && bincon < Limits[
bin].ErrorValue) ) {
327 if ( NErrors + NWarnings + NGoodPrint <= Publish ) {
328 double binval =
h->GetXaxis()->GetBinCenter(
bin + 1);
333 std::string binname = Form(
"%s_ErrorBin(%u | %.*e)",
name.c_str(),
bin, 2, binval);
335 if ( TypeValue > 0.5 ) {
336 result->tags_[binname.c_str()] = (bincon / h_entries);
338 result->tags_[binname.c_str()] = bincon;
343 else if ((UseValue == 1 && bincon >= Limits[
bin].WarningValue) ||
344 (UseValue > 1 && bincon > Limits[
bin].WarningValue) ||
345 (UseValue == -1 && bincon <= Limits[
bin].WarningValue) ||
346 (UseValue < -1 && bincon < Limits[
bin].WarningValue) ) {
348 if ( TypePublish >= 1 && NErrors + NWarnings + NGoodPrint <= Publish ) {
349 float binval =
h->GetXaxis()->GetBinCenter(
bin + 1);
353 std::string binname = Form(
"%s_WarningBin(%u | %.*e)",
name.c_str(),
bin, 2, binval);
354 if ( TypeValue > 0.5 ) {
355 result->tags_[binname.c_str()] = (bincon / h_entries);
357 result->tags_[binname.c_str()] = bincon;
364 if ( TypePublish >= 2 && NErrors + NWarnings + NGoodPrint <= Publish ) {
365 float binval =
h->GetXaxis()->GetBinCenter(
bin + 1);
369 std::string binname = Form(
"%s_GoodBin(%u | %.*e)",
name.c_str(),
bin, 2, binval);
370 if ( TypeValue > 0.5 ) {
371 result->tags_[binname.c_str()] = (bincon / h_entries);
373 result->tags_[binname.c_str()] = bincon;
384 if ( (!
data.IsA()->InheritsFrom(
"TProfile")) &&
h->GetDimension() == 2 ) {
389 std::vector< std::vector<BinThresh::mask_limits> > Limits;
393 catch (dqm_core::Exception & ex) {
394 throw dqm_core::BadConfig( ERS_HERE,
name, ex.what(), ex );
400 if ( (UseValue > 0 && Limits[
binX][
binY].WarningValue > Limits[
binX][
binY].ErrorValue) ||
401 (UseValue < 0 && Limits[
binX][
binY].WarningValue < Limits[
binX][
binY].ErrorValue)) {
404 std::string problem_message = Form(
"Incompatible Warning and Error Values in bin_%d_%d : Warning = %e -> Error = %e",
binX + 1,
binY + 1, Limits[
binX][
binY].WarningValue, Limits[
binX][
binY].ErrorValue);
405 ERS_INFO(problem_message.c_str());
411 double h_entries =
h->GetEntries();
415 Limits[
binX][
binY].WarningValue = Limits[
binX][
binY].WarningValue * h_entries;
423 double bincon =
h->GetBinContent(
binX + 1,
binY + 1);
426 if ( (UseValue == 1 && bincon >= Limits[
binX][
binY].ErrorValue) ||
427 (UseValue > 1 && bincon > Limits[
binX][
binY].ErrorValue) ||
428 (UseValue == -1 && bincon <= Limits[
binX][
binY].ErrorValue) ||
429 (UseValue < -1 && bincon < Limits[
binX][
binY].ErrorValue) ) {
431 if ( NErrors + NWarnings + NGoodPrint <= Publish ) {
432 float binvalX =
h->GetXaxis()->GetBinCenter(
binX + 1);
433 float binvalY =
h->GetYaxis()->GetBinCenter(
binY + 1);
434 std::string binname = Form(
"%s_ErrorBin((%u,%u) | %.*e,%.*e)",
name.c_str(),
binX,
binY, 2, binvalX, 2, binvalY);
436 if ( TypeValue > 0.5 ) {
437 result->tags_[binname.c_str()] = (bincon / h_entries);
439 result->tags_[binname.c_str()] = bincon;
444 else if ( (UseValue == 1 && bincon >= Limits[
binX][
binY].WarningValue) ||
445 (UseValue > 1 && bincon > Limits[
binX][
binY].WarningValue) ||
446 (UseValue == -1 && bincon <= Limits[
binX][
binY].WarningValue) ||
447 (UseValue < -1 && bincon < Limits[
binX][
binY].WarningValue) ) {
449 if ( TypePublish >= 1 && NErrors + NWarnings + NGoodPrint <= Publish ) {
450 float binvalX =
h->GetXaxis()->GetBinCenter(
binX + 1);
451 float binvalY =
h->GetYaxis()->GetBinCenter(
binY + 1);
452 std::string binname = Form(
"%s_WarningBin((%u,%u) | %.*e,%.*e)",
name.c_str(),
binX,
binY, 2, binvalX, 2, binvalY);
453 if ( TypeValue > 0.5 ) {
454 result->tags_[binname.c_str()] = (bincon / h_entries);
456 result->tags_[binname.c_str()] = bincon;
463 if ( TypePublish >= 2 && NErrors + NWarnings + NGoodPrint <= Publish ) {
464 float binvalX =
h->GetXaxis()->GetBinCenter(
binX + 1);
465 float binvalY =
h->GetYaxis()->GetBinCenter(
binY + 1);
466 std::string binname = Form(
"%s_GoodBin((%u,%u) | %.*e,%.*e)",
name.c_str(),
binX,
binY, 2, binvalX, 2, binvalY);
467 if ( TypeValue > 0.5 ) {
468 result->tags_[binname.c_str()] = (bincon / h_entries);
470 result->tags_[binname.c_str()] = bincon;
479 if ( Publish >= 0 ) {
480 std::string pub_error = Form(
"%s_Bin_Errors",
name.c_str());
481 result->tags_[pub_error.c_str()] = NErrors;
482 if ( TypePublish >= 1 ) {
483 std::string pub_warning = Form(
"%s_Bin_Warnings",
name.c_str());
484 result->tags_[pub_warning.c_str()] = NWarnings;
490 if ( (NErrors == 0) && (NWarnings > 0) )
result->status_ = dqm_core::Result::Yellow;