36 const TObject&
object,
37 const dqm_core::AlgorithmConfig&
config ) {
39 if ( !
object.
IsA()->InheritsFrom(
"TEfficiency" ) ) {
40 throw dqm_core::BadConfig( ERS_HERE, name,
"does not inherit from TEfficiency" );
43 auto efficiency_object =
static_cast<const TEfficiency*
>( &
object );
45 const TH1* h_total = efficiency_object->GetTotalHistogram();
46 if (h_total->GetEntries() == 0) {
47 auto result =
new dqm_core::Result();
48 result->status_ = dqm_core::Result::Undefined;
53 int MIN_STATISTICS_CUT = 50.0;
54 float EFF_THRESH_low = 0.50;
55 float EFF_THRESH_medium = 0.80;
56 float EFF_THRESH_high = 0.90;
57 int N_Sect_low_max = 4;
58 int N_Sect_medium = 5;
59 int N_Sect_high_min = 6;
67 }
catch ( dqm_core::Exception & ex ) {
68 MIN_STATISTICS_CUT = 50;
69 EFF_THRESH_low = 0.50;
70 EFF_THRESH_medium = 0.80;
71 EFF_THRESH_high = 0.90;
78 int nLBs = h_total->GetNbinsX();
79 int nSectors = h_total->GetNbinsY();
81 bool red_flag_triggered =
false;
83 uint32_t total_low_eff_bins = 0;
86 for (
int x_lb_bin = 1; x_lb_bin <= nLBs; ++x_lb_bin) {
88 int count_eff_lt_50 = 0;
89 int count_eff_lt_80 = 0;
90 int count_eff_lt_90 = 0;
93 for (
int y_sector_bin = 1; y_sector_bin <= nSectors; ++y_sector_bin) {
95 int bin_idx = h_total->GetBin(x_lb_bin, y_sector_bin);
96 double total_events = h_total->GetBinContent(bin_idx);
99 if (total_events > MIN_STATISTICS_CUT) {
101 double bin_eff = efficiency_object->GetEfficiency(bin_idx);
103 if (bin_eff < EFF_THRESH_high) {
106 if (bin_eff < EFF_THRESH_medium) {
109 if (bin_eff < EFF_THRESH_low) {
111 total_low_eff_bins++;
118 if (count_eff_lt_90 >= N_Sect_high_min) {
119 red_flag_triggered =
true;
122 else if (count_eff_lt_80 == N_Sect_medium) {
123 red_flag_triggered =
true;
126 else if (count_eff_lt_50 >= 2 && count_eff_lt_50 <= N_Sect_low_max) {
127 red_flag_triggered =
true;
133 auto result =
new dqm_core::Result();
135 if (red_flag_triggered) {
136 result->status_ = dqm_core::Result::Red;
138 result->status_ = dqm_core::Result::Green;
142 result->tags_[
"N_Bad_Bins_Lt_50_Percent" ] = (double)total_low_eff_bins;
143 result->tags_[
"Red_Flag_Triggered" ] = (double)(red_flag_triggered ? 1.0 : 0.0);