43 const TH1*
h =
dynamic_cast<const TH1*
>( &
data );
45 throw dqm_core::BadConfig( ERS_HERE, name,
"Cannot cast data to type TH1" );
47 const TH1*
ref =
dynamic_cast<const TH1*
>(
config.getReference() );
49 throw dqm_core::BadConfig( ERS_HERE, name,
"Cannot obtain reference of type TH1" );
51 double greenThr, redThr;
53 std::string thrName=
"MaxDist";
59 catch ( dqm_core::Exception & ex ) {
60 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
66 std::unique_ptr<dqm_core::Result>
result (
new dqm_core::Result());
71 result->status_ = dqm_core::Result::Green;
74 result->status_ = dqm_core::Result::Red;
77 result->status_ = dqm_core::Result::Yellow;
83 std::vector<float> values;
84 for (
int ibin=1; ibin<hist->GetNbinsX()+1; ibin++ ){
85 float ref = (hist->GetBinContent(ibin-1) + hist->GetBinContent(ibin+1))*0.5;
87 ref = (hist->GetBinContent(hist->GetNbinsX()) + hist->GetBinContent(ibin+1))*0.5;
89 if ( ibin==hist->GetNbinsX() ){
90 ref = (hist->GetBinContent(1) + hist->GetBinContent(ibin-1))*0.5;
92 float test = hist->GetBinContent(ibin);
93 values.push_back(test/
ref);
95 result = *std::max_element(values.begin(),values.end());
96 int bin = std::max_element(values.begin(),values.end()) - values.begin();
97 detectedBin = hist->GetXaxis()->GetBinCenter(
bin);