ATLAS Offline Software
Loading...
Searching...
No Matches
dqm_algorithms::Dummy_Algorithm Struct Reference

#include <Dummy_Algorithm.h>

Inheritance diagram for dqm_algorithms::Dummy_Algorithm:
Collaboration diagram for dqm_algorithms::Dummy_Algorithm:

Public Member Functions

 Dummy_Algorithm ()
BasicHistoCheckclone ()
dqm_core::Result * execute (const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
void printDescription (std::ostream &out)

Private Attributes

std::string m_name

Detailed Description

Definition at line 12 of file Dummy_Algorithm.h.

Constructor & Destructor Documentation

◆ Dummy_Algorithm()

dqm_algorithms::Dummy_Algorithm::Dummy_Algorithm ( )
inline

Definition at line 13 of file Dummy_Algorithm.h.

13: BasicHistoCheck("Dummy_Algorithm") {};
BasicHistoCheck(const std::string &name)

Member Function Documentation

◆ clone()

dqm_algorithms::BasicHistoCheck * dqm_algorithms::BasicHistoCheck::clone ( )
inherited

Definition at line 40 of file BasicHistoCheck.cxx.

41{
42
43 return new BasicHistoCheck( m_name );
44}

◆ execute()

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

Definition at line 48 of file BasicHistoCheck.cxx.

51{
52 const TH1 * histogram;
53
54 if( object.IsA()->InheritsFrom( "TH1" ) ) {
55 histogram = static_cast<const TH1*>(&object);
56 if (histogram->GetDimension() > 3 ){
57 throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 3 " );
58 }
59 } else {
60 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
61 }
62
63 if (m_name == "Dummy_Algorithm") {
64 ERS_DEBUG(1, "Dummy_Algorithm: Always returning Disabled for " << histogram->GetName());
65 return new dqm_core::Result(dqm_core::Result::Disabled);
66 }
67
68 const double minstat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), -1);
69
70 if (histogram->GetEntries() < minstat ) {
71 dqm_core::Result *result = new dqm_core::Result(dqm_core::Result::Undefined);
72 result->tags_["InsufficientEntries"] = histogram->GetEntries();
73 return result;
74 }
75
76 if (m_name == "Histogram_Not_Empty") {
77 if (histogram->GetEntries() != 0) {
78 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" is Not Empty");
79 return new dqm_core::Result(dqm_core::Result::Green);
80 }else {
81 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" is Empty");
82 return new dqm_core::Result(dqm_core::Result::Red);
83 }
84 } else if (m_name == "No_OverFlows" ) {
85 const unsigned int binsx = histogram->GetNbinsX()+1;
86 const unsigned int binsy = histogram->GetNbinsY()+1;
87 const unsigned int binsz = histogram->GetNbinsZ()+1;
88 switch (histogram->GetDimension()){
89 case 1:
90 if (histogram->GetBinContent(binsx) != 0) {
91 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has OverFlows X");
92 return new dqm_core::Result(dqm_core::Result::Red);
93 }
94 break;
95 case 2:
96 for (unsigned int i(0); i <= binsx; ++i)
97 if (histogram->GetBinContent(i,binsy) != 0) {
98 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has OverFlows Y");
99 return new dqm_core::Result(dqm_core::Result::Red);
100 }
101 for (unsigned int i(0); i <= binsy; ++i)
102 if (histogram->GetBinContent(binsx,i) != 0) {
103 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has OverFlows X");
104 return new dqm_core::Result(dqm_core::Result::Red);
105 }
106 break;
107 case 3:
108 for (unsigned int i(0); i <= binsx; ++i)
109 for (unsigned int j(0); j <= binsy; ++j)
110 if (histogram->GetBinContent(i,j,binsz) != 0) {
111 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has OverFlows Z");
112 return new dqm_core::Result(dqm_core::Result::Red);
113 }
114 for (unsigned int i(0); i <= binsx; ++i)
115 for (unsigned int j(0); j <= binsz; ++j)
116 if (histogram->GetBinContent(i,binsy,j) != 0) {
117 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has OverFlows Y");
118 return new dqm_core::Result(dqm_core::Result::Red);
119 }
120 for (unsigned int i(0); i <= binsz; ++i)
121 for (unsigned int j(0); j <= binsy; ++j)
122 if (histogram->GetBinContent(binsx,j,i) != 0) {
123 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has OverFlows X");
124 return new dqm_core::Result(dqm_core::Result::Red);
125 }
126 break;
127 default:
128 throw dqm_core::BadConfig( ERS_HERE, name, "Something is wrong with the Dimension of the Histogram");
129 }
130 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" does NOT have OverFlows");
131 return new dqm_core::Result(dqm_core::Result::Green);
132 }else if (m_name == "No_UnderFlows") {
133 const unsigned int binsx = histogram->GetNbinsX()+1;
134 const unsigned int binsy = histogram->GetNbinsY()+1;
135 const unsigned int binsz = histogram->GetNbinsZ()+1;
136 switch (histogram->GetDimension()){
137 case 1:
138 if (histogram->GetBinContent(0) != 0) {
139 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has UnderFlows X");
140 return new dqm_core::Result(dqm_core::Result::Red);
141 }
142 break;
143 case 2:
144 for (unsigned int i(0); i <= binsx; ++i)
145 if (histogram->GetBinContent(i,0) != 0) {
146 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has UnderFlows Y");
147 return new dqm_core::Result(dqm_core::Result::Red);
148 }
149 for (unsigned int i(0); i <= binsy; ++i)
150 if (histogram->GetBinContent(0,i) != 0) {
151 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has UnderFlows X");
152 return new dqm_core::Result(dqm_core::Result::Red);
153 }
154 break;
155 case 3:
156 for (unsigned int i(0); i <= binsx; ++i)
157 for (unsigned int j(0); j <= binsy; ++j)
158 if (histogram->GetBinContent(i,j,0) != 0) {
159 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has UnderFlows Z");
160 return new dqm_core::Result(dqm_core::Result::Red);
161 }
162 for (unsigned int i(0); i <= binsx; ++i)
163 for (unsigned int j(0); j <= binsz; ++j)
164 if (histogram->GetBinContent(i,0,j) != 0) {
165 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has UnderFlows Y");
166 return new dqm_core::Result(dqm_core::Result::Red);
167 }
168 for (unsigned int i(0); i <= binsz; ++i)
169 for (unsigned int j(0); j <= binsy; ++j)
170 if (histogram->GetBinContent(0,j,i) != 0) {
171 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has UnderFlows X");
172 return new dqm_core::Result(dqm_core::Result::Red);
173 }
174 break;
175 default:
176 throw dqm_core::BadConfig( ERS_HERE, name, "Something is wrong with the Dimension of the Histogram");
177 }
178 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" does NOT have UnderFlows");
179 return new dqm_core::Result(dqm_core::Result::Green);
180 } else if ( m_name == "All_Bins_Filled" ) {
181 const unsigned int binsx = histogram->GetNbinsX();
182 const unsigned int binsy = histogram->GetNbinsY();
183 const unsigned int binsz = histogram->GetNbinsZ();
184 for ( unsigned int i(1); i <= binsx; ++i ) {
185 for ( unsigned int j(1); j <= binsy; ++j ) {
186 for ( unsigned int k(1); k<= binsz; ++k ) {
187 double content= histogram -> GetBinContent(i,j);
188 if ( content == 0) {
189 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has empty bins");
190 return new dqm_core::Result(dqm_core::Result::Red);
191 }
192 }
193 }
194 }
195
196 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has all filled bins");
197 return new dqm_core::Result(dqm_core::Result::Green);
198
199
200 } else if (m_name == "Histogram_Empty") {
201 if (histogram->GetEntries() == 0) {
202 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" is Empty");
203 return new dqm_core::Result(dqm_core::Result::Green);
204 }else {
205 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" is Not Empty");
206 return new dqm_core::Result(dqm_core::Result::Red);
207 }
208 } else if (m_name == "Histogram_Effective_Empty") {
209 if (histogram->GetEffectiveEntries() == 0) {
210 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" is Empty");
211 return new dqm_core::Result(dqm_core::Result::Green);
212 }else {
213 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" is Not Empty");
214 return new dqm_core::Result(dqm_core::Result::Red);
215 }
216 } else if (m_name == "Histogram_Not_Empty_Disabled") {
217 if (histogram->GetEntries() != 0) {
218 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" is Not Empty -> Green");
219 return new dqm_core::Result(dqm_core::Result::Green);
220 }else {
221 ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" is Empty -> Disabled");
222 return new dqm_core::Result(dqm_core::Result::Disabled);
223 }
224 } else {
225 return new dqm_core::Result();
226 }
227}
std::string histogram
Definition chains.cxx:52
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
str content
Definition grepfile.py:56
#define IsA
Declare the TObject style functions.

◆ printDescription()

void dqm_algorithms::BasicHistoCheck::printDescription ( std::ostream & out)
inherited

Definition at line 230 of file BasicHistoCheck.cxx.

231{
232 if ( m_name == "All_Bins_Filled"){
233 out<<"All_Bins_Filled: Checks that all bins of histogram are filled\n"<<std::endl;
234 } else if ( m_name == "Histogram_Not_Empty"){
235 out<<"Histogram_Not_Empty: Checks that histogram is not empty\n"<<std::endl;
236 }else if ( m_name == "No_UnderFlows"){
237 out<<"No_UnderFlows: Checks that histogram has no Underflows"<<std::endl;
238 }else if ( m_name == "No_OverFlows"){
239 out<<"No_OverFlows: Checks that histogram has no Overflows"<<std::endl;
240 } else if ( m_name == "Histogram_Empty"){
241 out<<"Histogram_Empty: Checks that histogram is empty\n"<<std::endl;
242 } else if ( m_name == "Histogram_Effective_Empty"){
243 out<<"Histogram_Not_Empty:\tChecks that histogram has no effective entries\n\t\t\t(see ROOT doc -> TH1 -> GetEffectiveEntries())\n"<<std::endl;
244 } else if ( m_name == "Histogram_Not_Empty_Disabled"){
245 out<<"Histogram_Not_Empty_Disabled: Checks that histogram is not empty (Green if filled, Disabled if empty)\n"<<std::endl;
246 } else if ( m_name == "Dummy_Algorithm"){
247 out<<"Dummy_Algorithm: Always returns Result::Disabled regardless of histogram content or entries.\n"<<std::endl;
248 }
249
250 out<<"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm\n"<<std::endl;
251}

Member Data Documentation

◆ m_name

std::string dqm_algorithms::BasicHistoCheck::m_name
privateinherited

Definition at line 29 of file BasicHistoCheck.h.


The documentation for this struct was generated from the following file: