15 #include "dqm_core/exceptions.h"
16 #include "dqm_core/AlgorithmManager.h"
17 #include "dqm_core/AlgorithmConfig.h"
18 #include "dqm_core/Result.h"
45 out <<
"Algorithm: \"" <<
m_name <<
"\"\n";
46 out <<
"Description: Evaluates <X> means per Y-bin in STGC timing histograms.\n";
47 out <<
"Flags sectors as RED if <X> deviates beyond redMean.\n";
48 out <<
"Overflow and underflow bins are excluded.\n";
57 execute(
const std::string&
name,
const TObject&
object,
const dqm_core::AlgorithmConfig&
config)
64 if(
object.
IsA()->InheritsFrom(
"TH2" ) ) {
67 throw dqm_core::BadConfig( ERS_HERE,
name,
"dimension > 2 " );
70 throw dqm_core::BadConfig( ERS_HERE,
name,
"does not inherit from TH2" );
74 int Xbins =
histogram->GetXaxis()->GetNbins();
75 int Ybins =
histogram->GetYaxis()->GetNbins();
77 double mean_global =
histogram->GetMean(1);
86 }
else if (Xbins < 15) {
96 std::vector<float> MeanX(Ybins, 0.0);
99 bool yellowflag =
false;
100 bool greenflag =
false;
102 for (
int i = 1;
i <= Ybins;
i++) {
103 MeanX[
i]=h2->GetBinContent(
i);
108 if (MeanX[
i] > Meanlow && MeanX[
i] < Meanhigh) Passed = Passed +1;
109 if (abs(MeanX[
i]-mean_global) > abs(redMean-mean_global)) redflag=
true;
117 catch ( dqm_core::Exception & ex ) {
118 throw dqm_core::BadConfig( ERS_HERE,
name, ex.what(), ex );
120 if (Passed >= (Ybins-gthreshold) && not redflag) greenflag=
true;
121 else if (Passed >= (Ybins-rthreshold) && not redflag) yellowflag=
true;
125 }
else if ( yellowflag ) {
126 result->status_ = dqm_core::Result::Yellow;
130 result->tags_[
"Xbins"] = Xbins;
131 result->tags_[
"Passed"] = Passed;
132 result->tags_[
"MeanGlobal"] = mean_global;