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 280 of file QTest.h.

Constructor & Destructor Documentation

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

Definition at line 283 of file QTest.h.

References QCriterion::setAlgoName().

283  : SimpleTest(name,true)
284  {
285  rangeInitialized_ = false;
287  }
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:79
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:139
bool rangeInitialized_
Definition: QTest.h:300
static std::string getAlgoName()
Definition: QTest.h:288

Member Function Documentation

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

Definition at line 288 of file QTest.h.

References QCriterion::runTest().

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

288 { 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 658 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(), MonitorElement::kind(), and plotBeamSpotDB::last.

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

Definition at line 291 of file QTest.h.

Referenced by QTestConfigure::EnableYRangeTest().

291 { useEmptyBins_ = useEmptyBins; }
unsigned int useEmptyBins_
Definition: QTest.h:301

Member Data Documentation

bool ContentsYRange::rangeInitialized_
protected

Definition at line 300 of file QTest.h.

unsigned int ContentsYRange::useEmptyBins_
protected

Definition at line 301 of file QTest.h.

double ContentsYRange::ymax_
protected

Definition at line 299 of file QTest.h.

double ContentsYRange::ymin_
protected

Definition at line 299 of file QTest.h.