CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes
ContentsYRange Class Reference

#include <QTest.h>

Inheritance diagram for ContentsYRange:
SimpleTest QCriterion

Public Member Functions

 ContentsYRange (const std::string &name)
 
float runTest (const MonitorElement *me) override
 
virtual void setAllowedYRange (double ymin, double ymax)
 
void setUseEmptyBins (unsigned int useEmptyBins)
 
- Public Member Functions inherited from SimpleTest
std::vector< DQMChannelgetBadChannels () const override
 get vector of channels that failed test (not always relevant!) More...
 
void setMinimumEntries (unsigned n)
 set minimum # of entries needed More...
 
 SimpleTest (const std::string &name, bool keepBadChannels=false)
 
- Public Member Functions inherited from QCriterion
std::string algoName () const
 get algorithm name More...
 
std::string getMessage () const
 get message attached to test More...
 
std::string getName () const
 get name of quality test More...
 
int getStatus () const
 (class should be created by DQMStore class) More...
 
void setErrorProb (float prob)
 
void setWarningProb (float prob)
 set probability limit for warning and error (default: 90% and 50%) More...
 

Static Public Member Functions

static std::string getAlgoName ()
 

Protected Attributes

bool rangeInitialized_
 
unsigned int useEmptyBins_
 
double ymax_
 
double ymin_
 
- Protected Attributes inherited from SimpleTest
std::vector< DQMChannelbadChannels_
 
bool keepBadChannels_
 
unsigned minEntries_
 
- Protected Attributes inherited from QCriterion
std::string algoName_
 name of quality test More...
 
float errorProb_
 
std::string message_
 quality test status More...
 
float prob_
 name of algorithm More...
 
std::string qtname_
 
int status_
 
int verbose_
 
float warningProb_
 message attached to test More...
 

Additional Inherited Members

- Protected Member Functions inherited from SimpleTest
void setMessage () override
 set status & message after test has run More...
 
- Protected Member Functions inherited from QCriterion
void init ()
 initialize values More...
 
 QCriterion (std::string qtname)
 
float runTest (const MonitorElement *me, QReport &qr, DQMNet::QValue &qv)
 
void setAlgoName (std::string name)
 set algorithm name More...
 
void setVerbose (int verbose)
 probability limits for warnings, errors More...
 
virtual ~QCriterion ()=default
 

Detailed Description

Definition at line 281 of file QTest.h.

Constructor & Destructor Documentation

ContentsYRange::ContentsYRange ( const std::string &  name)
inline

Definition at line 284 of file QTest.h.

References QCriterion::setAlgoName().

284  : SimpleTest(name,true)
285  {
286  rangeInitialized_ = false;
288  }
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:80
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:140
bool rangeInitialized_
Definition: QTest.h:301
static std::string getAlgoName()
Definition: QTest.h:289

Member Function Documentation

static std::string ContentsYRange::getAlgoName ( )
inlinestatic

Definition at line 289 of file QTest.h.

References QCriterion::runTest().

Referenced by QTestConfigure::enableTests(), QTestConfigure::EnableYRangeTest(), and QTestParameterNames::QTestParameterNames().

289 { return "ContentsYRange"; }
float ContentsYRange::runTest ( const MonitorElement me)
overridevirtual

Standard test !

AS quality test !!!

end of AS quality tests

Reimplemented from QCriterion.

Definition at line 659 of file QTest.cc.

References stringResolutionProvider_cfi::bin, officialStyle::chan, relmon_rootfiles_spy::contents, gather_cfg::cout, MonitorElement::DQM_KIND_TH1D, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH1S, cmsPerfPublish::fail(), plotBeamSpotDB::first, MonitorElement::getFullname(), MonitorElement::getRootObject(), MonitorElement::getTH1D(), MonitorElement::getTH1F(), MonitorElement::getTH1S(), h, MonitorElement::kind(), and plotBeamSpotDB::last.

660 {
661  badChannels_.clear();
662 
663  if (!me)
664  return -1;
665  if (!me->getRootObject())
666  return -1;
667  TH1* h=nullptr;
668 
669  if (verbose_>1)
670  std::cout << "QTest:" << getAlgoName() << "::runTest called on "
671  << me-> getFullname() << "\n";
672 
674  {
675  h = me->getTH1F(); //access Test histo
676  }
677  else if (me->kind()==MonitorElement::DQM_KIND_TH1S)
678  {
679  h = me->getTH1S(); //access Test histo
680  }
681  else if (me->kind()==MonitorElement::DQM_KIND_TH1D)
682  {
683  h = me->getTH1D(); //access Test histo
684  }
685  else
686  {
687  if (verbose_>0)
688  std::cout << "QTest:ContentsYRange"
689  << " ME " << me->getFullname()
690  << " does not contain TH1F/TH1S/TH1D, exiting\n";
691  return -1;
692  }
693 
694  if (!rangeInitialized_ || !h->GetXaxis()) return 1; // all bins are accepted if no initialization
695  int ncx = h->GetXaxis()->GetNbins();
696  // do NOT use underflow bin
697  int first = 1;
698  // do NOT use overflow bin
699  int last = ncx;
700  // bins outside Y-range
701  int fail = 0;
702  int bin;
703 
704  if (useEmptyBins_)
705  {
706  for (bin = first; bin <= last; ++bin)
707  {
708  double contents = h->GetBinContent(bin);
709  bool failure = false;
710  failure = (contents < ymin_ || contents > ymax_); // allowed y-range: [ymin_, ymax_]
711  if (failure)
712  {
713  DQMChannel chan(bin, 0, 0, contents, h->GetBinError(bin));
714  badChannels_.push_back(chan);
715  ++fail;
716  }
717  }
718  // return fraction of bins that passed test
719  return 1.*(ncx - fail)/ncx;
720  }
721  else
722  {
723  for (bin = first; bin <= last; ++bin)
724  {
725  double contents = h->GetBinContent(bin);
726  bool failure = false;
727  if (contents) failure = (contents < ymin_ || contents > ymax_); // allowed y-range: [ymin_, ymax_]
728  if (failure) ++fail;
729  }
730  // return fraction of bins that passed test
731  return 1.*(ncx - fail)/ncx;
732  }
733 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
TH1F * getTH1F() const
int verbose_
Definition: QTest.h:120
TObject * getRootObject() const
bin
set the eta bin as selection string.
const std::string getFullname() const
get full name of ME including Pathname
std::vector< DQMChannel > badChannels_
Definition: QTest.h:162
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
bool rangeInitialized_
Definition: QTest.h:301
TH1D * getTH1D() const
TH1S * getTH1S() const
def fail(errstr="")
unsigned int useEmptyBins_
Definition: QTest.h:302
Kind kind() const
Get the type of the monitor element.
double ymax_
Definition: QTest.h:300
static std::string getAlgoName()
Definition: QTest.h:289
virtual void ContentsYRange::setAllowedYRange ( double  ymin,
double  ymax 
)
inlinevirtual
void ContentsYRange::setUseEmptyBins ( unsigned int  useEmptyBins)
inline

Definition at line 292 of file QTest.h.

Referenced by QTestConfigure::EnableYRangeTest().

292 { useEmptyBins_ = useEmptyBins; }
unsigned int useEmptyBins_
Definition: QTest.h:302

Member Data Documentation

bool ContentsYRange::rangeInitialized_
protected

Definition at line 301 of file QTest.h.

unsigned int ContentsYRange::useEmptyBins_
protected

Definition at line 302 of file QTest.h.

double ContentsYRange::ymax_
protected

Definition at line 300 of file QTest.h.

double ContentsYRange::ymin_
protected

Definition at line 300 of file QTest.h.