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

Constructor & Destructor Documentation

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

Definition at line 227 of file QTest.h.

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

227  : SimpleTest(name)
228  {
229  rangeInitialized_ = false;
231  }
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:76
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:136
static std::string getAlgoName(void)
Definition: QTest.h:232
bool rangeInitialized_
Definition: QTest.h:244

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(), first, MonitorElement::getFullname(), MonitorElement::getRootObject(), MonitorElement::getTH1D(), MonitorElement::getTH1F(), MonitorElement::getTH1S(), h, MonitorElement::kind(), prof2calltree::last, and vdt::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
int verbose_
Definition: QTest.h:116
virtual void setAllowedXRange(double xmin, double xmax)
set allowed range in X-axis (default values: histogram&#39;s X-range)
Definition: QTest.h:236
static std::string getAlgoName(void)
Definition: QTest.h:232
TH1D * getTH1D(void) const
bool rangeInitialized_
Definition: QTest.h:244
double xmax_
Definition: QTest.h:243
Kind kind(void) const
Get the type of the monitor element.
bool first
Definition: L1TdeRCT.cc:94
const std::string getFullname(void) const
get full name of ME including Pathname
TObject * getRootObject(void) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
TH1F * getTH1F(void) const
std::vector< DQMChannel > badChannels_
Definition: QTest.h:158
tuple cout
Definition: gather_cfg.py:121
x
Definition: VDTMath.h:216
virtual void ContentsXRange::setAllowedXRange ( double  xmin,
double  xmax 
)
inlinevirtual

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

Definition at line 236 of file QTest.h.

References rangeInitialized_, xmax_, and xmin_.

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

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

Member Data Documentation

bool ContentsXRange::rangeInitialized_
protected

Definition at line 244 of file QTest.h.

Referenced by ContentsXRange(), and setAllowedXRange().

double ContentsXRange::xmax_
protected

Definition at line 243 of file QTest.h.

Referenced by setAllowedXRange().

double ContentsXRange::xmin_
protected

Definition at line 243 of file QTest.h.

Referenced by setAllowedXRange().