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)
 
virtual void setAllowedYRange (double ymin, double ymax)
 
void setUseEmptyBins (unsigned int useEmptyBins)
 
- Public Member Functions inherited from SimpleTest
virtual std::vector< DQMChannelgetBadChannels (void) const
 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 (void) const
 get algorithm name More...
 
std::string getMessage (void) const
 get message attached to test More...
 
std::string getName (void) const
 get name of quality test More...
 
int getStatus (void) 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 (void)
 

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
virtual void setMessage (void)
 set status & message after test has run More...
 
- Protected Member Functions inherited from QCriterion
void init (void)
 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 (void)
 

Detailed Description

Definition at line 279 of file QTest.h.

Constructor & Destructor Documentation

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

Definition at line 282 of file QTest.h.

References QCriterion::setAlgoName().

282  : SimpleTest(name,true)
283  {
284  rangeInitialized_ = false;
286  }
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:78
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:138
static std::string getAlgoName(void)
Definition: QTest.h:287
bool rangeInitialized_
Definition: QTest.h:299

Member Function Documentation

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

Definition at line 287 of file QTest.h.

References QCriterion::runTest().

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

287 { 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 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 }
TH1S * getTH1S(void) const
int verbose_
Definition: QTest.h:118
TH1D * getTH1D(void) const
Kind kind(void) const
Get the type of the monitor element.
static std::string getAlgoName(void)
Definition: QTest.h:287
const std::string getFullname(void) const
get full name of ME including Pathname
bin
set the eta bin as selection string.
TObject * getRootObject(void) const
TH1F * getTH1F(void) const
std::vector< DQMChannel > badChannels_
Definition: QTest.h:160
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:299
def fail(errstr="")
unsigned int useEmptyBins_
Definition: QTest.h:300
double ymax_
Definition: QTest.h:298
virtual void ContentsYRange::setAllowedYRange ( double  ymin,
double  ymax 
)
inlinevirtual
void ContentsYRange::setUseEmptyBins ( unsigned int  useEmptyBins)
inline

Definition at line 290 of file QTest.h.

Referenced by QTestConfigure::EnableYRangeTest().

290 { useEmptyBins_ = useEmptyBins; }
unsigned int useEmptyBins_
Definition: QTest.h:300

Member Data Documentation

bool ContentsYRange::rangeInitialized_
protected

Definition at line 299 of file QTest.h.

unsigned int ContentsYRange::useEmptyBins_
protected

Definition at line 300 of file QTest.h.

double ContentsYRange::ymax_
protected

Definition at line 298 of file QTest.h.

double ContentsYRange::ymin_
protected

Definition at line 298 of file QTest.h.