46{
48 TH1 * refhist;
49
50 if(
object.
IsA()->InheritsFrom(
"TH1" )) {
53 throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
54 }
55 } else {
56 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1");
57 }
58
60 try {
61 refhist =
static_cast<TH1*
>(
config.getReference() );
62 }
63 catch (dqm_core::BadConfig &ex ) {
64 refhist=0;
65 try {
67 }
68 catch( dqm_core::Exception & ex ) {
69 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
70 }
71 }
72 if ( ! refhist ) {
73 try {
75 }
76 catch( dqm_core::Exception & ex ) {
77 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
78 }
79 } else {
80
81 if (
histogram->GetDimension() != refhist->GetDimension() ) {
82 throw dqm_core::BadRefHist( ERS_HERE, name, "Dimension" );
83 }
84
85 if ((
histogram->GetNbinsX() != refhist->GetNbinsX()) || (
histogram->GetNbinsY() != refhist->GetNbinsY())) {
86 throw dqm_core::BadRefHist( ERS_HERE, "number of bins", name );
87 }
88}
89
92 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
95 }
96
98 const TProfile2D* profile2D(nullptr);
100 if(minBinEntries > 0) {
102 else if (
object.InheritsFrom(
"TProfile2D")) profile2D =
dynamic_cast<const TProfile2D*
>(&
object);
103 }
104
117
118 if (greaterthan && lessthan) {
119 ERS_INFO("Both GreaterThan and LessThan parameters set: Will check for for both");
120 greaterthan = false;
121 lessthan = false;
122 }
123
124 double bin_threshold;
125 double gthreshold;
126 double rthreshold;
127 try {
131 }
132 catch( dqm_core::Exception & ex ) {
133 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
134 }
135
136
138
139
141
142 dqm_core::Result*
result =
new dqm_core::Result();
143 double refcont =0;
144 TH1* resulthisto = nullptr;
145 if (publishHistogram) {
148 }
else if (
histogram->InheritsFrom(
"TH1")) {
150 } else {
151 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
152 }
153
154 resulthisto->Reset();
155 }
156
157 if (refhist && normref) {
159 refhist->Scale(ratio);
160 }
161
162 int nSkippedBins(0);
163 for (
int i = range[0];
i <=
range[1]; ++
i ) {
164 for (
int j = range[2]; j <=
range[3]; ++j ) {
165 if (minBinEntries > 0) {
167 if (profile) {
168 if (
profile->GetBinEntries(bin) < minBinEntries) {
169 ++nSkippedBins;
170 continue;
171 }
172 } else if (profile2D) {
173 if (profile2D->GetBinEntries(bin) < minBinEntries) {
174 ++nSkippedBins;
175 continue;
176 }
177 }
178 }
179
180 if ( ! refhist ){
182 } else {
183 refcont = refhist->GetBinContent(i,j);
184 }
185
186 double histerr =
histogram->GetBinError(i,j);
187 double inputerr=0;
188
189
190 if (increferr && refhist ) {
191 double referr = refhist->GetBinError(i,j);
192 inputerr = std::sqrt(std::pow(histerr,2)+std::pow(referr,2));
193 } else {
194 inputerr = histerr;
195 }
196
197 if (fixerr) {
198 inputerr = fixerr;
199 }
200
201 double inputcont =
histogram->GetBinContent(i,j);
202 double diff=inputcont - refcont;
206
207 if (ignorezero && refcont==0) continue;
208 if (ignorezero && !refhist && inputcont==0) continue;
209 if (ignoreInputZero && inputcont==0) continue;
210
211 if (inputerr !=0){
213 if (greaterthan &&
diff < 0. )
continue;
214 if (lessthan &&
diff > 0. )
continue;
215
216 if ( (std::abs(sigma) > bin_threshold) && (std::abs(
diff) > maxdiffabs) && (std::abs(reldiff) > maxdiffrel) ){
217 if (resulthisto) resulthisto->SetBinContent(i,j,inputcont);
219 if (publish &&
count<maxpublish){
221 }
222 }
223 }
224 }
225 }
226
227 if (value == -99999) {
228 ERS_DEBUG(1,
"Number of bins " << bin_threshold <<
" Sigma away from reference is " <<
count);
229 }else {
230 ERS_DEBUG(1,
"Number of bins " << bin_threshold <<
" Sigma away from "<<value<<
" is " <<
count);
231 }
232
233 ERS_DEBUG(1, "Green threshold: "<< gthreshold << " bin(s); Red threshold : " << rthreshold << " bin(s) ");
234
235
237 result->tags_[
"NSkippedBins"] = nSkippedBins;
238 if (resulthisto)
result->object_ = boost::shared_ptr<TObject>(resulthisto);
239
240 if (gthreshold > rthreshold) {
241 if (
count >= gthreshold ) {
242 result->status_ = dqm_core::Result::Green;
243 }
else if (
count > rthreshold ) {
244 result->status_ = dqm_core::Result::Yellow;
245 } else {
246 result->status_ = dqm_core::Result::Red;
247 }
248 } else {
249 if (
count <= gthreshold ) {
250 result->status_ = dqm_core::Result::Green;
251 }
else if (
count < rthreshold ) {
252 result->status_ = dqm_core::Result::Yellow;
253 } else {
254 result->status_ = dqm_core::Result::Red;
255 }
256 }
258
259}
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
TProfile(*args, **kwargs)
setBGCode setTAP setLVL2ErrorBits bool
#define IsA
Declare the TObject style functions.