54{
56
57 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
60 throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
61 }
62 } else {
63 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
64 }
65
73
75
76 std::vector<int> hotColumns, hotRows;
77 std::vector<std::vector<int>> hotBins;
78
80
81 bool vetoHotRows = false; if (hotRows.size() > 0) vetoHotRows = true;
82 bool vetoHotBins = false; if (hotBins.size() > 0) vetoHotBins = true;
83 bool vetoHotColumns = false; if (hotColumns.size() > 0) vetoHotColumns = true;
84
86 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
89 }
90
91 double bin_threshold;
92 double gthreshold;
93 double rthreshold;
94 try {
98 }
99 catch ( dqm_core::Exception & ex ) {
100 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
101 }
102
103
106 dqm_core::Result*
result =
new dqm_core::Result();
107 TH1* resulthisto;
110 }
else if (
histogram->InheritsFrom(
"TH1")) {
112 } else {
113 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
114 }
115
116 resulthisto->Reset();
117 if(
m_name.find(
"Median")!=std::string::npos){
118 std::vector<double> bin_vals;
119 for (
int i = range[0];
i <=
range[1]; ++
i ) {
120 for (
int j = range[2]; j <=
range[3]; ++j ) {
121 if(
histogram -> GetBinContent(i,j) > 0) bin_vals . push_back(
histogram -> GetBinContent(i,j) );
122 }
123 }
124 std::sort(bin_vals.begin(), bin_vals.end());
125 unsigned bin_vals_size = bin_vals.size();
127 if(bin_vals_size%2==0 && bin_vals_size>1)
median = (bin_vals.at(bin_vals_size/2-1)+bin_vals.at(bin_vals_size/2))/2;
128 else if(bin_vals_size%2==1 && bin_vals_size>1)
median = bin_vals.at(bin_vals_size/2-1);
129 else if(bin_vals_size==1)
median = bin_vals.at(0);
130
133 bin_threshold=
median*bin_threshold;
134
135 bin_threshold = std::max(bin_threshold, min_bin_threshold);
136 if(max_bin_threshold > -1 ) bin_threshold = std::min(bin_threshold, max_bin_threshold);
137
138 result->tags_[
"Effective_BinThreshold"] = bin_threshold;
139 }
140
141
142 bool skipColumn = false;
144 bool skipBin = false;
145
146 for (
int i = range[0];
i <=
range[1]; ++
i ) {
147 skipColumn = false;
148 for (int column : hotColumns){
149 if (vetoHotColumns && ( column == i || skipColumn == true)) skipColumn = true;
150 }
151
152 if (skipColumn) continue;
153
155
157
158 for (
int j = range[2]; j <=
range[3]; ++j ) {
159 skipRow =
false; skipBin =
false;
160 for (int row : hotRows){
161 if (vetoHotRows && ( row == j ||
skipRow ==
true))
skipRow =
true;
162 }
163 for (const auto& pair : hotBins){
164 if (vetoHotBins && ( (pair[0] == i && pair[1] == j) || skipBin == true)) skipBin = true;
165 }
166
167 if (skipBin) continue;
168
170
172
174
178 resulthisto->SetBinContent(i,j,content);
179 if (publish &&
count< maxpublish){
181 }
182 }
183 }
184 }
185
186 ERS_DEBUG(1,
"Number of bins " <<
m_name <<
" treshold of " << bin_threshold <<
" is " <<
count );
187 ERS_DEBUG(1,"Green threshold: "<< gthreshold << " bin(s); Red threshold : " << rthreshold << " bin(s) ");
188
190 if(TotalBins > -10){
193 if(
m_name.find(
"LessThan")!=std::string::npos)
result->tags_[
"NBins_%"] = 100.*effectiveCount/TotalBins;
194 else result->tags_[
"NBins_%"] = 100.*
count/TotalBins;
195 }
196
198 result->object_ = boost::shared_ptr<TObject>(resulthisto);
199 if (gthreshold > rthreshold) {
200 if (
count >= gthreshold ) {
201 result->status_ = dqm_core::Result::Green;
202 }
else if (
count > rthreshold ) {
203 result->status_ = dqm_core::Result::Yellow;
204 } else {
205 result->status_ = dqm_core::Result::Red;
206 }
207 } else {
208 if (
count <= gthreshold ) {
209 result->status_ = dqm_core::Result::Green;
210 }
else if (
count < rthreshold ) {
211 result->status_ = dqm_core::Result::Yellow;
212 } else {
213 result->status_ = dqm_core::Result::Red;
214 }
215 }
216
218
219}
static const uint32_t skipRow
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
float median(std::vector< float > &Vec)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
setBGCode setTAP setLVL2ErrorBits bool
bool CompareBinThreshold(const std::string &objname, double bincontent, double threshold)
void parseVetoList(const std::string &input, std::vector< int > &rows, std::vector< int > &columns, std::vector< std::vector< int > > &bins)
#define IsA
Declare the TObject style functions.