CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 250 of file QTest.h.

Constructor & Destructor Documentation

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

Definition at line 253 of file QTest.h.

References getAlgoName(), rangeInitialized_, and QCriterion::setAlgoName().

253  : SimpleTest(name,true)
254  {
255  rangeInitialized_ = false;
257  }
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:77
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:137
static std::string getAlgoName(void)
Definition: QTest.h:258
bool rangeInitialized_
Definition: QTest.h:270

Member Function Documentation

static std::string ContentsYRange::getAlgoName ( void  )
inlinestatic
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, 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.

548 {
549  badChannels_.clear();
550 
551  if (!me)
552  return -1;
553  if (!me->getRootObject())
554  return -1;
555  TH1* h=0;
556 
557  if (verbose_>1)
558  std::cout << "QTest:" << getAlgoName() << "::runTest called on "
559  << me-> getFullname() << "\n";
560 
562  {
563  h = me->getTH1F(); //access Test histo
564  }
565  else if (me->kind()==MonitorElement::DQM_KIND_TH1S)
566  {
567  h = me->getTH1S(); //access Test histo
568  }
569  else if (me->kind()==MonitorElement::DQM_KIND_TH1D)
570  {
571  h = me->getTH1D(); //access Test histo
572  }
573  else
574  {
575  if (verbose_>0)
576  std::cout << "QTest:ContentsYRange"
577  << " ME " << me->getFullname()
578  << " does not contain TH1F/TH1S/TH1D, exiting\n";
579  return -1;
580  }
581 
582  if (!rangeInitialized_ || !h->GetXaxis()) return 1; // all bins are accepted if no initialization
583  int ncx = h->GetXaxis()->GetNbins();
584  // do NOT use underflow bin
585  int first = 1;
586  // do NOT use overflow bin
587  int last = ncx;
588  // bins outside Y-range
589  int fail = 0;
590  int bin;
591 
592  if (useEmptyBins_)
593  {
594  for (bin = first; bin <= last; ++bin)
595  {
596  double contents = h->GetBinContent(bin);
597  bool failure = false;
598  failure = (contents < ymin_ || contents > ymax_); // allowed y-range: [ymin_, ymax_]
599  if (failure)
600  {
601  DQMChannel chan(bin, 0, 0, contents, h->GetBinError(bin));
602  badChannels_.push_back(chan);
603  ++fail;
604  }
605  }
606  // return fraction of bins that passed test
607  return 1.*(ncx - fail)/ncx;
608  }
609  else
610  {
611  for (bin = first; bin <= last; ++bin)
612  {
613  double contents = h->GetBinContent(bin);
614  bool failure = false;
615  if (contents) failure = (contents < ymin_ || contents > ymax_); // allowed y-range: [ymin_, ymax_]
616  if (failure) ++fail;
617  }
618  // return fraction of bins that passed test
619  return 1.*(ncx - fail)/ncx;
620  }
621 }
TH1S * getTH1S(void) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
int verbose_
Definition: QTest.h:117
TH1D * getTH1D(void) const
Kind kind(void) const
Get the type of the monitor element.
static std::string getAlgoName(void)
Definition: QTest.h:258
const std::string getFullname(void) const
get full name of ME including Pathname
TObject * getRootObject(void) const
TH1F * getTH1F(void) const
std::vector< DQMChannel > badChannels_
Definition: QTest.h:159
bool rangeInitialized_
Definition: QTest.h:270
tuple cout
Definition: gather_cfg.py:145
unsigned int useEmptyBins_
Definition: QTest.h:271
double ymax_
Definition: QTest.h:269
virtual void ContentsYRange::setAllowedYRange ( double  ymin,
double  ymax 
)
inlinevirtual
void ContentsYRange::setUseEmptyBins ( unsigned int  useEmptyBins)
inline

Definition at line 261 of file QTest.h.

References useEmptyBins_.

Referenced by QTestConfigure::EnableYRangeTest().

261 { useEmptyBins_ = useEmptyBins; }
unsigned int useEmptyBins_
Definition: QTest.h:271

Member Data Documentation

bool ContentsYRange::rangeInitialized_
protected

Definition at line 270 of file QTest.h.

Referenced by ContentsYRange(), and setAllowedYRange().

unsigned int ContentsYRange::useEmptyBins_
protected

Definition at line 271 of file QTest.h.

Referenced by setUseEmptyBins().

double ContentsYRange::ymax_
protected

Definition at line 269 of file QTest.h.

Referenced by setAllowedYRange().

double ContentsYRange::ymin_
protected

Definition at line 269 of file QTest.h.

Referenced by setAllowedYRange().