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

#include <All_Bins_Filled.h>

Inheritance diagram for dqm_algorithms::All_Bins_Filled:
Collaboration diagram for dqm_algorithms::All_Bins_Filled:

Public Member Functions

 All_Bins_Filled ()
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 16 of file All_Bins_Filled.h.

Constructor & Destructor Documentation

◆ All_Bins_Filled()

dqm_algorithms::All_Bins_Filled::All_Bins_Filled ( )
inline

Definition at line 18 of file All_Bins_Filled.h.

18: BasicHistoCheck("All_Bins_Filled") {};
BasicHistoCheck(const std::string &name)

Member Function Documentation

◆ clone()

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

Definition at line 38 of file BasicHistoCheck.cxx.

39{
40
41 return new BasicHistoCheck( m_name );
42}

◆ execute()

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

Definition at line 46 of file BasicHistoCheck.cxx.

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

220{
221 if ( m_name == "All_Bins_Filled"){
222 out<<"All_Bins_Filled: Checks that all bins of histogram are filled\n"<<std::endl;
223 } else if ( m_name == "Histogram_Not_Empty"){
224 out<<"Histogram_Not_Empty: Checks that histogram is not empty\n"<<std::endl;
225 }else if ( m_name == "No_UnderFlows"){
226 out<<"No_UnderFlows: Checks that histogram has no Underflows"<<std::endl;
227 }else if ( m_name == "No_OverFlows"){
228 out<<"No_OverFlows: Checks that histogram has no Overflows"<<std::endl;
229
230
231 } else if ( m_name == "Histogram_Empty"){
232 out<<"Histogram_Empty: Checks that histogram is empty\n"<<std::endl;
233 } else if ( m_name == "Histogram_Effective_Empty"){
234 out<<"Histogram_Not_Empty:\tChecks that histogram has no effective entries\n\t\t\t(see ROOT doc -> TH1 -> GetEffectiveEntries())\n"<<std::endl;
235 }
236
237 out<<"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm\n"<<std::endl;
238}

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: