68 {
69
70 dqm_core::Result*
result =
new dqm_core::Result();
71 result->status_ = dqm_core::Result::Undefined;
73
74 if(
object.
IsA()->InheritsFrom(
"TH2" ) ) {
77 throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
78 }
79 } else {
80 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH2" );
81 }
82
84 TH1 *projection =
histogram->ProjectionX(
"projection");
85 int Xbins =
histogram->GetXaxis()->GetNbins();
86
90
91 bool redflag = false;
92 bool yellowflag = false;
93 bool greenflag = true;
94
95 TGraphErrors* ge = new TGraphErrors;
96 int nge =0;
97 for (
int ilb = 0;
ilb<Xbins ;
ilb++)
98 {
99 if (projection->GetBinContent(ilb+1) >= minstat)
100 {
101 ge->SetPoint(nge,ilb,
profile->GetBinContent(ilb+1));
102 ge->SetPointError(nge,ilb,
profile->GetBinError(ilb+1));
103 nge++;
104 }
105 }
106
107 TFitResultPtr fit_res = ge->Fit("pol0","QNS0");
108 if (!fit_res.Get())
109 {
110 result->status_ = dqm_core::Result::Yellow;
112 }
113
114 double mean = fit_res->Value(0);
115
116 std::vector<int> yellowLBs;
117 std::vector<double> yellowR;
118 for (
int ip = 0;
ip<ge->GetN() ;
ip++)
119 {
121 ge->GetPoint(ip,
x,
y);
122 double ey = ge->GetErrorY(ip);
123 double r = TMath::Abs((
y -
mean ) / ey);
125 {
126 yellowflag = true;
127 yellowLBs.push_back(
x);
128 yellowR.push_back(
r);
129 }
130 }
131
132 for (size_t iy=0;iy<yellowLBs.size();iy++)
133 {
134 int LB = yellowLBs.at(iy);
135 double R = yellowR.at(iy);
136 char ctag[256];
137 sprintf(ctag,"Bad LB %d with R", LB);
139 }
140
141 if (yellowLBs.size() > NsigMultRed)
142 {
143 redflag = true;
144 }
145
146 if (redflag)
147 {
148 result->status_ = dqm_core::Result::Red;
149 }
150 else if (yellowflag)
151 {
152 result->status_ = dqm_core::Result::Yellow;
153 }
154 else if (greenflag)
155 {
156 result->status_ = dqm_core::Result::Green;
157 }
158
160 }
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="")
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
TProfile(*args, **kwargs)
#define IsA
Declare the TObject style functions.