49 const TObject &
object,
50 const dqm_core::AlgorithmConfig & config)
54 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
55 histogram =
static_cast<const TH1*
>(&object);
57 throw dqm_core::BadConfig( ERS_HERE, name,
"dimension > 3 " );
60 throw dqm_core::BadConfig( ERS_HERE, name,
"does not inherit from TH1" );
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);
71 dqm_core::Result *result =
new dqm_core::Result(dqm_core::Result::Undefined);
72 result->tags_[
"InsufficientEntries"] =
histogram->GetEntries();
76 if (
m_name ==
"Histogram_Not_Empty") {
78 ERS_DEBUG(1,
"Histogram " <<
histogram->GetName()<<
" is Not Empty");
79 return new dqm_core::Result(dqm_core::Result::Green);
81 ERS_DEBUG(1,
"Histogram " <<
histogram->GetName()<<
" is Empty");
82 return new dqm_core::Result(dqm_core::Result::Red);
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;
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);
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);
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);
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);
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);
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);
128 throw dqm_core::BadConfig( ERS_HERE, name,
"Something is wrong with the Dimension of the Histogram");
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;
139 ERS_DEBUG(1,
"Histogram " <<
histogram->GetName()<<
" has UnderFlows X");
140 return new dqm_core::Result(dqm_core::Result::Red);
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);
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);
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);
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);
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);
176 throw dqm_core::BadConfig( ERS_HERE, name,
"Something is wrong with the Dimension of the Histogram");
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);
189 ERS_DEBUG(1,
"Histogram " <<
histogram->GetName()<<
" has empty bins");
190 return new dqm_core::Result(dqm_core::Result::Red);
196 ERS_DEBUG(1,
"Histogram " <<
histogram->GetName()<<
" has all filled bins");
197 return new dqm_core::Result(dqm_core::Result::Green);
200 }
else if (
m_name ==
"Histogram_Empty") {
202 ERS_DEBUG(1,
"Histogram " <<
histogram->GetName()<<
" is Empty");
203 return new dqm_core::Result(dqm_core::Result::Green);
205 ERS_DEBUG(1,
"Histogram " <<
histogram->GetName()<<
" is Not Empty");
206 return new dqm_core::Result(dqm_core::Result::Red);
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);
213 ERS_DEBUG(1,
"Histogram " <<
histogram->GetName()<<
" is Not Empty");
214 return new dqm_core::Result(dqm_core::Result::Red);
216 }
else if (
m_name ==
"Histogram_Not_Empty_Disabled") {
218 ERS_DEBUG(1,
"Histogram " <<
histogram->GetName()<<
" is Not Empty -> Green");
219 return new dqm_core::Result(dqm_core::Result::Green);
221 ERS_DEBUG(1,
"Histogram " <<
histogram->GetName()<<
" is Empty -> Disabled");
222 return new dqm_core::Result(dqm_core::Result::Disabled);
225 return new dqm_core::Result();