67 execute(
const std::string& name,
const TObject&
object,
const dqm_core::AlgorithmConfig&
config)
70 dqm_core::Result*
result =
new dqm_core::Result();
71 result->status_ = dqm_core::Result::Undefined;
74 if(
object.
IsA()->InheritsFrom(
"TH2" ) ) {
77 throw dqm_core::BadConfig( ERS_HERE, name,
"dimension > 2 " );
80 throw dqm_core::BadConfig( ERS_HERE, name,
"does not inherit from TH2" );
83 TProfile *profile =
histogram->ProfileX();
84 TH1 *projection =
histogram->ProjectionX(
"projection");
85 int Xbins =
histogram->GetXaxis()->GetNbins();
92 bool yellowflag =
false;
93 bool greenflag =
true;
95 TGraphErrors* ge =
new TGraphErrors;
97 for (
int ilb = 0; ilb<Xbins ;ilb++)
99 if (projection->GetBinContent(ilb+1) >= minstat)
101 ge->SetPoint(nge,ilb,profile->GetBinContent(ilb+1));
102 ge->SetPointError(nge,ilb,profile->GetBinError(ilb+1));
107 TFitResultPtr fit_res = ge->Fit(
"pol0",
"QNS0");
110 result->status_ = dqm_core::Result::Yellow;
114 double mean = fit_res->Value(0);
116 std::vector<int> yellowLBs;
117 std::vector<double> yellowR;
118 for (
int ip = 0; ip<ge->GetN() ;ip++)
121 ge->GetPoint(ip,
x,
y);
122 double ey = ge->GetErrorY(ip);
123 double r = TMath::Abs((
y -
mean ) / ey);
127 yellowLBs.push_back(
x);
128 yellowR.push_back(
r);
132 for (
size_t iy=0;iy<yellowLBs.size();iy++)
134 int LB = yellowLBs.at(iy);
135 double R = yellowR.at(iy);
137 sprintf(ctag,
"Bad LB %d with R", LB);
141 if (yellowLBs.size() > NsigMultRed)
148 result->status_ = dqm_core::Result::Red;
152 result->status_ = dqm_core::Result::Yellow;
156 result->status_ = dqm_core::Result::Green;
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="")