CMS 3D CMS Logo

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

#include <QTest.h>

Inheritance diagram for ContentsXRange:
SimpleTest QCriterion

Public Member Functions

 ContentsXRange (const std::string &name)
 
float runTest (const MonitorElement *me)
 
virtual void setAllowedXRange (double xmin, double xmax)
 set allowed range in X-axis (default values: histogram's X-range) More...
 
- 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_
 
double xmax_
 
double xmin_
 
- 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 254 of file QTest.h.

Constructor & Destructor Documentation

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

Definition at line 257 of file QTest.h.

References QCriterion::setAlgoName().

257  : SimpleTest(name)
258  {
259  rangeInitialized_ = false;
261  }
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:262
bool rangeInitialized_
Definition: QTest.h:274

Member Function Documentation

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

Definition at line 262 of file QTest.h.

References QCriterion::runTest().

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

262 { return "ContentsXRange"; }
float ContentsXRange::runTest ( const MonitorElement me)
virtual

Reimplemented from QCriterion.

Definition at line 578 of file QTest.cc.

References stringResolutionProvider_cfi::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(), MonitorElement::kind(), plotBeamSpotDB::last, and x().

579 {
580  badChannels_.clear();
581 
582  if (!me)
583  return -1;
584  if (!me->getRootObject())
585  return -1;
586  TH1* h=0;
587 
588  if (verbose_>1)
589  std::cout << "QTest:" << getAlgoName() << "::runTest called on "
590  << me-> getFullname() << "\n";
591  // -- TH1F
592  if (me->kind()==MonitorElement::DQM_KIND_TH1F )
593  {
594  h = me->getTH1F();
595  }
596  // -- TH1S
597  else if ( me->kind()==MonitorElement::DQM_KIND_TH1S )
598  {
599  h = me->getTH1S();
600  }
601  // -- TH1D
602  else if ( me->kind()==MonitorElement::DQM_KIND_TH1D )
603  {
604  h = me->getTH1D();
605  }
606  else
607  {
608  if (verbose_>0) std::cout << "QTest:ContentsXRange"
609  << " ME " << me->getFullname()
610  << " does not contain TH1F/TH1S/TH1D, exiting\n";
611  return -1;
612  }
613 
614  if (!rangeInitialized_)
615  {
616  if ( h->GetXaxis() )
617  setAllowedXRange(h->GetXaxis()->GetXmin(), h->GetXaxis()->GetXmax());
618  else
619  return -1;
620  }
621  int ncx = h->GetXaxis()->GetNbins();
622  // use underflow bin
623  int first = 0; // 1
624  // use overflow bin
625  int last = ncx+1; // ncx
626  // all entries
627  double sum = 0;
628  // entries outside X-range
629  double fail = 0;
630  int bin;
631  for (bin = first; bin <= last; ++bin)
632  {
633  double contents = h->GetBinContent(bin);
634  double x = h->GetBinCenter(bin);
635  sum += contents;
636  if (x < xmin_ || x > xmax_)fail += contents;
637  }
638 
639  if (sum==0) return 1;
640  // return fraction of entries within allowed X-range
641  return (sum - fail)/sum;
642 
643 }
TH1S * getTH1S(void) const
int verbose_
Definition: QTest.h:118
virtual void setAllowedXRange(double xmin, double xmax)
set allowed range in X-axis (default values: histogram&#39;s X-range)
Definition: QTest.h:266
static std::string getAlgoName(void)
Definition: QTest.h:262
TH1D * getTH1D(void) const
bool rangeInitialized_
Definition: QTest.h:274
double xmax_
Definition: QTest.h:273
Kind kind(void) const
Get the type of the monitor element.
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
def fail(errstr="")
virtual void ContentsXRange::setAllowedXRange ( double  xmin,
double  xmax 
)
inlinevirtual

set allowed range in X-axis (default values: histogram's X-range)

Definition at line 266 of file QTest.h.

References TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

Referenced by QTestConfigure::EnableXRangeTest().

Member Data Documentation

bool ContentsXRange::rangeInitialized_
protected

Definition at line 274 of file QTest.h.

double ContentsXRange::xmax_
protected

Definition at line 273 of file QTest.h.

double ContentsXRange::xmin_
protected

Definition at line 273 of file QTest.h.