52 const TObject &
object,
53 const dqm_core::AlgorithmConfig &
config )
57 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
60 throw dqm_core::BadConfig( ERS_HERE, name,
"dimension > 2 " );
63 throw dqm_core::BadConfig( ERS_HERE, name,
"does not inherit from TH1" );
76 std::vector<int> hotColumns, hotRows;
77 std::vector<std::vector<int>> hotBins;
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;
86 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
99 catch ( dqm_core::Exception & ex ) {
100 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
106 dqm_core::Result*
result =
new dqm_core::Result();
110 }
else if (
histogram->InheritsFrom(
"TH1")) {
113 throw dqm_core::BadConfig( ERS_HERE, name,
"does not inherit from TH1" );
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) );
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);
133 bin_threshold=median*bin_threshold;
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);
138 result->tags_[
"Effective_BinThreshold"] = bin_threshold;
142 bool skipColumn =
false;
144 bool skipBin =
false;
146 for (
int i = range[0]; i <= range[1]; ++i ) {
148 for (
int column : hotColumns){
149 if (vetoHotColumns && ( column == i || skipColumn ==
true)) skipColumn =
true;
152 if (skipColumn)
continue;
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;
163 for (
const auto&
pair : hotBins){
164 if (vetoHotBins && ( (
pair[0] == i &&
pair[1] == j) || skipBin ==
true)) skipBin =
true;
167 if (skipBin)
continue;
175 double content=
histogram -> GetBinContent(i,j);
178 resulthisto->SetBinContent(i,j,content);
179 if (publish &&
count< maxpublish){
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) ");
193 if(
m_name.find(
"LessThan")!=std::string::npos)
result->tags_[
"NBins_%"] = 100.*effectiveCount/TotalBins;
194 else result->tags_[
"NBins_%"] = 100.*
count/TotalBins;
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;
205 result->status_ = dqm_core::Result::Red;
208 if (
count <= gthreshold ) {
209 result->status_ = dqm_core::Result::Green;
210 }
else if (
count < rthreshold ) {
211 result->status_ = dqm_core::Result::Yellow;
213 result->status_ = dqm_core::Result::Red;
240 std::string inputNoQuotes;
241 for (
char c : input)
if (c !=
'"') inputNoQuotes += c;
243 std::stringstream
ss(inputNoQuotes);
246 while (std::getline(
ss, token,
',')) {
247 std::stringstream pairStream(token);
248 std::string first, second;
250 if (std::getline(pairStream, first,
':') && std::getline(pairStream, second,
':')) {
252 rows.push_back(std::stoi(second));
253 }
else if (second ==
"*") {
254 columns.push_back(std::stoi(first));
256 bins.push_back({std::stoi(first), std::stoi(second)});