56 execute(
const std::string& name,
const TObject&
object,
const dqm_core::AlgorithmConfig& config)
59 dqm_core::Result* result =
new dqm_core::Result();
60 result->status_ = dqm_core::Result::Undefined;
63 if(
object.
IsA()->InheritsFrom(
"TH2" ) ) {
64 histogram =
static_cast<const TH2*
>(&object);
66 throw dqm_core::BadConfig( ERS_HERE, name,
"dimension > 2 " );
69 throw dqm_core::BadConfig( ERS_HERE, name,
"does not inherit from TH2" );
73 int Xbins =
histogram->GetXaxis()->GetNbins();
74 int Ybins =
histogram->GetYaxis()->GetNbins();
76 double mean_global =
histogram->GetMean(1);
85 }
else if (Xbins < 15) {
95 std::vector<float> MeanX(Ybins, 0.0);
98 bool yellowflag =
false;
99 bool greenflag =
false;
101 for (
int i = 1; i <= Ybins; i++) {
102 MeanX[i]=h2->GetBinContent(i);
107 else if (MeanX[i] > Meanlow && MeanX[i] < Meanhigh) Passed = Passed +1;
108 if (abs(MeanX[i]-mean_global) > abs(redMean-mean_global)) redflag=
true;
116 catch ( dqm_core::Exception & ex ) {
117 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
119 if (Passed >= (Ybins-gthreshold) && not redflag) greenflag=
true;
120 else if (Passed >= (Ybins-rthreshold) && not redflag) yellowflag=
true;
123 result->status_ = dqm_core::Result::Green;
124 }
else if ( yellowflag ) {
125 result->status_ = dqm_core::Result::Yellow;
127 result->status_ = dqm_core::Result::Red;
129 result->tags_[
"Ybins"] = Ybins;
130 result->tags_[
"Passed"] = Passed;
131 result->tags_[
"MeanGlobal"] = mean_global;