ATLAS Offline Software
Loading...
Searching...
No Matches
dqm_algorithms::SectorEfficiencyCheck Class Reference

#include <SectorEfficiencyCheck.h>

Inheritance diagram for dqm_algorithms::SectorEfficiencyCheck:
Collaboration diagram for dqm_algorithms::SectorEfficiencyCheck:

Public Member Functions

 SectorEfficiencyCheck ()
 ~SectorEfficiencyCheck () override
SectorEfficiencyCheckclone () override
dqm_core::Result * execute (const std::string &name, const TObject &object, const dqm_core::AlgorithmConfig &config) override
void printDescriptionTo (std::ostream &out) override

Detailed Description

Definition at line 17 of file SectorEfficiencyCheck.h.

Constructor & Destructor Documentation

◆ SectorEfficiencyCheck()

dqm_algorithms::SectorEfficiencyCheck::SectorEfficiencyCheck ( )

Definition at line 22 of file SectorEfficiencyCheck.cxx.

22 {
23 dqm_core::AlgorithmManager::instance().registerAlgorithm("SectorEfficiencyCheck", this);
24}

◆ ~SectorEfficiencyCheck()

dqm_algorithms::SectorEfficiencyCheck::~SectorEfficiencyCheck ( )
override

Definition at line 26 of file SectorEfficiencyCheck.cxx.

26 {
27}

Member Function Documentation

◆ clone()

dqm_algorithms::SectorEfficiencyCheck * dqm_algorithms::SectorEfficiencyCheck::clone ( )
override

Definition at line 30 of file SectorEfficiencyCheck.cxx.

◆ execute()

dqm_core::Result * dqm_algorithms::SectorEfficiencyCheck::execute ( const std::string & name,
const TObject & object,
const dqm_core::AlgorithmConfig & config )
override

Definition at line 35 of file SectorEfficiencyCheck.cxx.

37 {
38
39 if ( !object.IsA()->InheritsFrom( "TEfficiency" ) ) {
40 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TEfficiency" );
41 }
42
43 auto efficiency_object = static_cast<const TEfficiency*>( &object );
44
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;
49 return result;
50 }
51
52
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;
60 try {
61 MIN_STATISTICS_CUT = static_cast<int>( dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters() ) );
62 EFF_THRESH_high = static_cast<float>( dqm_algorithms::tools::GetFirstFromMap( "EffThreshHigh", config.getParameters() ));
63 EFF_THRESH_medium = static_cast<float>( dqm_algorithms::tools::GetFirstFromMap( "EffThreshMedium", config.getParameters() ));
64 N_Sect_low_max = static_cast<float>( dqm_algorithms::tools::GetFirstFromMap( "NSectLowMax", config.getParameters() ));
65 N_Sect_medium = static_cast<float>( dqm_algorithms::tools::GetFirstFromMap( "NSectMedium", config.getParameters() ));
66 N_Sect_high_min = static_cast<float>( dqm_algorithms::tools::GetFirstFromMap( "NSectHighMin", config.getParameters() ));
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;
72 N_Sect_low_max = 4;
73 N_Sect_medium = 5;
74 N_Sect_high_min = 6;
75 }
76
77
78 int nLBs = h_total->GetNbinsX();
79 int nSectors = h_total->GetNbinsY();
80
81 bool red_flag_triggered = false;
82
83 uint32_t total_low_eff_bins = 0;
84
85 //loop on lb
86 for (int x_lb_bin = 1; x_lb_bin <= nLBs; ++x_lb_bin) {
87
88 int count_eff_lt_50 = 0;
89 int count_eff_lt_80 = 0;
90 int count_eff_lt_90 = 0;
91
92 //loop on sectors
93 for (int y_sector_bin = 1; y_sector_bin <= nSectors; ++y_sector_bin) {
94
95 int bin_idx = h_total->GetBin(x_lb_bin, y_sector_bin);
96 double total_events = h_total->GetBinContent(bin_idx);
97
98 // min stat cut
99 if (total_events > MIN_STATISTICS_CUT) {
100
101 double bin_eff = efficiency_object->GetEfficiency(bin_idx);
102
103 if (bin_eff < EFF_THRESH_high) {
104 count_eff_lt_90++;
105 }
106 if (bin_eff < EFF_THRESH_medium) {
107 count_eff_lt_80++;
108 }
109 if (bin_eff < EFF_THRESH_low) {
110 count_eff_lt_50++;
111 total_low_eff_bins++;
112 }
113 }
114 } // sector loop
115
116 // --- RED Flag criteria ---
117
118 if (count_eff_lt_90 >= N_Sect_high_min) {
119 red_flag_triggered = true;
120 break;
121 }
122 else if (count_eff_lt_80 == N_Sect_medium) {
123 red_flag_triggered = true;
124 break;
125 }
126 else if (count_eff_lt_50 >= 2 && count_eff_lt_50 <= N_Sect_low_max) {
127 red_flag_triggered = true;
128 break;
129 }
130
131 } // loop LB
132
133 auto result = new dqm_core::Result();
134
135 if (red_flag_triggered) {
136 result->status_ = dqm_core::Result::Red;
137 } else {
138 result->status_ = dqm_core::Result::Green;
139 }
140
141
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);
144
145
146 return result;
147}
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
setEventNumber uint32_t
#define IsA
Declare the TObject style functions.

◆ printDescriptionTo()

void dqm_algorithms::SectorEfficiencyCheck::printDescriptionTo ( std::ostream & out)
override

Definition at line 149 of file SectorEfficiencyCheck.cxx.

149 {
150 out << "SectorEfficiencyCheck: analysis of an 2d efficiency map \n"
151 << std::endl;
152}

The documentation for this class was generated from the following files: