#include <QTest.h>
Public Member Functions | |
ContentsYRange (const std::string &name) | |
float | runTest (const MonitorElement *me) |
virtual void | setAllowedYRange (double ymin, double ymax) |
void | setUseEmptyBins (unsigned int useEmptyBins) |
Static Public Member Functions | |
static std::string | getAlgoName (void) |
Protected Attributes | |
bool | rangeInitialized_ |
unsigned int | useEmptyBins_ |
double | ymax_ |
double | ymin_ |
ContentsYRange::ContentsYRange | ( | const std::string & | name | ) | [inline] |
Definition at line 252 of file QTest.h.
References getAlgoName(), rangeInitialized_, and QCriterion::setAlgoName().
: SimpleTest(name,true) { rangeInitialized_ = false; setAlgoName(getAlgoName()); }
static std::string ContentsYRange::getAlgoName | ( | void | ) | [inline, static] |
Definition at line 257 of file QTest.h.
Referenced by ContentsYRange(), createYRangeTest(), QTestConfigure::enableTests(), QTestConfigure::EnableYRangeTest(), and QTestParameterNames::QTestParameterNames().
{ return "ContentsYRange"; }
float ContentsYRange::runTest | ( | const MonitorElement * | me | ) | [virtual] |
Standard test !
AS quality test !!!
end of AS quality tests
Reimplemented from QCriterion.
Definition at line 547 of file QTest.cc.
References newFWLiteAna::bin, cmsMakeMELists::contents, gather_cfg::cout, MonitorElement::DQM_KIND_TH1D, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH1S, cmsPerfPublish::fail(), first, MonitorElement::getFullname(), MonitorElement::getRootObject(), MonitorElement::getTH1D(), MonitorElement::getTH1F(), MonitorElement::getTH1S(), h, MonitorElement::kind(), and prof2calltree::last.
{ badChannels_.clear(); if (!me) return -1; if (!me->getRootObject()) return -1; TH1* h=0; if (verbose_>1) std::cout << "QTest:" << getAlgoName() << "::runTest called on " << me-> getFullname() << "\n"; if (me->kind()==MonitorElement::DQM_KIND_TH1F) { h = me->getTH1F(); //access Test histo } else if (me->kind()==MonitorElement::DQM_KIND_TH1S) { h = me->getTH1S(); //access Test histo } else if (me->kind()==MonitorElement::DQM_KIND_TH1D) { h = me->getTH1D(); //access Test histo } else { if (verbose_>0) std::cout << "QTest:ContentsYRange" << " ME " << me->getFullname() << " does not contain TH1F/TH1S/TH1D, exiting\n"; return -1; } if (!rangeInitialized_ || !h->GetXaxis()) return 1; // all bins are accepted if no initialization int ncx = h->GetXaxis()->GetNbins(); // do NOT use underflow bin int first = 1; // do NOT use overflow bin int last = ncx; // bins outside Y-range int fail = 0; int bin; if (useEmptyBins_) { for (bin = first; bin <= last; ++bin) { double contents = h->GetBinContent(bin); bool failure = false; failure = (contents < ymin_ || contents > ymax_); // allowed y-range: [ymin_, ymax_] if (failure) { DQMChannel chan(bin, 0, 0, contents, h->GetBinError(bin)); badChannels_.push_back(chan); ++fail; } } // return fraction of bins that passed test return 1.*(ncx - fail)/ncx; } else { for (bin = first; bin <= last; ++bin) { double contents = h->GetBinContent(bin); bool failure = false; if (contents) failure = (contents < ymin_ || contents > ymax_); // allowed y-range: [ymin_, ymax_] if (failure) ++fail; } // return fraction of bins that passed test return 1.*(ncx - fail)/ncx; } }
virtual void ContentsYRange::setAllowedYRange | ( | double | ymin, |
double | ymax | ||
) | [inline, virtual] |
Definition at line 261 of file QTest.h.
References rangeInitialized_, SiStripMonitorClusterAlca_cfi::ymax, ymax_, SiStripMonitorClusterAlca_cfi::ymin, and ymin_.
Referenced by createYRangeTest(), and QTestConfigure::EnableYRangeTest().
{ ymin_ = ymin; ymax_ = ymax; rangeInitialized_ = true; }
void ContentsYRange::setUseEmptyBins | ( | unsigned int | useEmptyBins | ) | [inline] |
Definition at line 260 of file QTest.h.
References useEmptyBins_.
Referenced by QTestConfigure::EnableYRangeTest().
{ useEmptyBins_ = useEmptyBins; }
bool ContentsYRange::rangeInitialized_ [protected] |
Definition at line 269 of file QTest.h.
Referenced by ContentsYRange(), and setAllowedYRange().
unsigned int ContentsYRange::useEmptyBins_ [protected] |
Definition at line 270 of file QTest.h.
Referenced by setUseEmptyBins().
double ContentsYRange::ymax_ [protected] |
Definition at line 268 of file QTest.h.
Referenced by setAllowedYRange().
double ContentsYRange::ymin_ [protected] |
Definition at line 268 of file QTest.h.
Referenced by setAllowedYRange().