38 const dqm_core::AlgorithmConfig&
config) {
50 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
54 throw dqm_core::BadConfig( ERS_HERE, name,
"dimension > 2 " );
57 throw dqm_core::BadConfig( ERS_HERE, name,
"does not inherit from TH1" );
64 dqm_core::Result*
result =
new dqm_core::Result();
65 result->status_ = dqm_core::Result::Green;
66 result->tags_[
"Not enough Signal Statistics"] = minstat;
74 if ((checkZeroContent > 0) && (
histogram->Integral() == 0) && (
histogram->GetEntries() > 0)) {
75 ERS_DEBUG(1,
"Histogram " <<
histogram->GetName()<<
" is filled with zeroes!");
76 dqm_core::Result*
result =
new dqm_core::Result();
77 result->status_ = dqm_core::Result::Red;
84 int checkSigmaDev = 1;
85 int dontCountSigmaOutliers = 0;
103 catch( dqm_core::Exception & ex ) {
104 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
109 const int xminBin = range[0];
110 const int xmaxBin = range[1];
114 for (
int i = xminBin; i <= xmaxBin; i++) {
115 if (
histogram->GetBinContent(i) == 0) zeroBins++;
119 int totalBadBins = 0;
127 for(
int i=xminBin;i <= xmaxBin;i++){
128 if(
histogram->GetBinContent(i) != 0 || ignore0 ==
false) {
135 mean = counter > 0 ? sum/(double)counter : 0;
136 stdev = counter > 0 ? std::sqrt( sum2/
static_cast<double>(counter) -
mean*
mean) : 0;
141 double absdev_test = 0;
143 for (
int i = xminBin; i <= xmaxBin; i++) {
144 if ((
histogram->GetBinContent(i) != 0) || (ignore0 == 0)) {
147 if ((dev > sigmaDev) && (absdev_test > absDev)) {
148 if (!dontCountSigmaOutliers){
156 int totalBadBins_all = 0;
161 double sum_all=0,sum2_all=0;
164 for(
int i=0;i <=
histogram->GetNbinsX() ;i++){
165 if(
histogram->GetBinContent(i) != 0 || ignore0 ==
false) {
172 mean_all = counter_all > 0 ? sum_all/(double)counter_all : 0;
173 stdev_all = counter_all > 0 ? std::sqrt( sum2_all/
static_cast<double>(counter_all) - mean_all*mean_all) : 0;
178 double absdev_test_all = 0;
180 for (
int i=0;i <=
histogram->GetNbinsX() ;i++) {
181 if ((
histogram->GetBinContent(i) != 0) || (ignore0 == 0)) {
182 dev_all=std::abs(
histogram->GetBinContent(i) - mean_all)/stdev_all;
183 absdev_test_all=std::abs(
histogram->GetBinContent(i) - mean_all);
184 if ((dev_all > sigmaDev) && (absdev_test_all > absDev)) {
185 if (!dontCountSigmaOutliers){
195 std::map<std::string,double> algparams;
196 algparams[
"Number_of_outlier_bins"] = totalBadBins;
197 algparams[
"Number_of_outlier_bins_all"] = totalBadBins_all;
198 algparams[
"Mean"] =
mean;
199 algparams[
"Standard_deviation"] = stdev;
200 algparams[
"Number_of_bins_equal_zero"] = zeroBins;
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")