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

Constructor & Destructor Documentation

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

Definition at line 228 of file QTest.h.

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

228  : SimpleTest(name)
229  {
230  rangeInitialized_ = false;
232  }
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:233
bool rangeInitialized_
Definition: QTest.h:245

Member Function Documentation

static std::string ContentsXRange::getAlgoName ( void  )
inlinestatic
float ContentsXRange::runTest ( const MonitorElement me)
virtual

Reimplemented from QCriterion.

Definition at line 477 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(), plotBeamSpotDB::last, and x().

478 {
479  badChannels_.clear();
480 
481  if (!me)
482  return -1;
483  if (!me->getRootObject())
484  return -1;
485  TH1* h=0;
486 
487  if (verbose_>1)
488  std::cout << "QTest:" << getAlgoName() << "::runTest called on "
489  << me-> getFullname() << "\n";
490  // -- TH1F
491  if (me->kind()==MonitorElement::DQM_KIND_TH1F )
492  {
493  h = me->getTH1F();
494  }
495  // -- TH1S
496  else if ( me->kind()==MonitorElement::DQM_KIND_TH1S )
497  {
498  h = me->getTH1S();
499  }
500  // -- TH1D
501  else if ( me->kind()==MonitorElement::DQM_KIND_TH1D )
502  {
503  h = me->getTH1D();
504  }
505  else
506  {
507  if (verbose_>0) std::cout << "QTest:ContentsXRange"
508  << " ME " << me->getFullname()
509  << " does not contain TH1F/TH1S/TH1D, exiting\n";
510  return -1;
511  }
512 
513  if (!rangeInitialized_)
514  {
515  if ( h->GetXaxis() )
516  setAllowedXRange(h->GetXaxis()->GetXmin(), h->GetXaxis()->GetXmax());
517  else
518  return -1;
519  }
520  int ncx = h->GetXaxis()->GetNbins();
521  // use underflow bin
522  int first = 0; // 1
523  // use overflow bin
524  int last = ncx+1; // ncx
525  // all entries
526  double sum = 0;
527  // entries outside X-range
528  double fail = 0;
529  int bin;
530  for (bin = first; bin <= last; ++bin)
531  {
532  double contents = h->GetBinContent(bin);
533  double x = h->GetBinCenter(bin);
534  sum += contents;
535  if (x < xmin_ || x > xmax_)fail += contents;
536  }
537 
538  if (sum==0) return 1;
539  // return fraction of entries within allowed X-range
540  return (sum - fail)/sum;
541 
542 }
TH1S * getTH1S(void) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
int verbose_
Definition: QTest.h:117
virtual void setAllowedXRange(double xmin, double xmax)
set allowed range in X-axis (default values: histogram&#39;s X-range)
Definition: QTest.h:237
static std::string getAlgoName(void)
Definition: QTest.h:233
TH1D * getTH1D(void) const
bool rangeInitialized_
Definition: QTest.h:245
double xmax_
Definition: QTest.h:244
Kind kind(void) const
Get the type of the monitor element.
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
tuple cout
Definition: gather_cfg.py:145
virtual void ContentsXRange::setAllowedXRange ( double  xmin,
double  xmax 
)
inlinevirtual

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

Definition at line 237 of file QTest.h.

References rangeInitialized_, hlt_dqm_clientPB-live_cfg::xmax, xmax_, hlt_dqm_clientPB-live_cfg::xmin, and xmin_.

Referenced by createXRangeTest(), and QTestConfigure::EnableXRangeTest().

238  {
239  xmin_ = xmin; xmax_ = xmax;
240  rangeInitialized_ = true;
241  }
bool rangeInitialized_
Definition: QTest.h:245
double xmax_
Definition: QTest.h:244
double xmin_
Definition: QTest.h:244

Member Data Documentation

bool ContentsXRange::rangeInitialized_
protected

Definition at line 245 of file QTest.h.

Referenced by ContentsXRange(), and setAllowedXRange().

double ContentsXRange::xmax_
protected

Definition at line 244 of file QTest.h.

Referenced by setAllowedXRange().

double ContentsXRange::xmin_
protected

Definition at line 244 of file QTest.h.

Referenced by setAllowedXRange().