CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes
CompareLastFilledBin Class Reference

#include <QTest.h>

Inheritance diagram for CompareLastFilledBin:
SimpleTest QCriterion

Public Member Functions

 CompareLastFilledBin (const std::string &name)
 
float runTest (const MonitorElement *me) override
 
void setAverage (float average)
 
void setMax (float max)
 
void setMin (float min)
 
 ~CompareLastFilledBin () override=default
 
- Public Member Functions inherited from SimpleTest
std::vector< DQMChannelgetBadChannels () const override
 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 () const
 get algorithm name More...
 
std::string getMessage () const
 get message attached to test More...
 
std::string getName () const
 get name of quality test More...
 
int getStatus () const
 get test status More...
 
void init ()
 initialize values More...
 
 QCriterion (std::string qtname)
 
float runTest (const MonitorElement *me, QReport &qr, DQMNet::QValue &qv)
 
void setErrorProb (float prob)
 
void setWarningProb (float prob)
 set probability limit for warning and error (default: 90% and 50%) More...
 
virtual ~QCriterion ()=default
 

Static Public Member Functions

static std::string getAlgoName ()
 

Protected Member Functions

void setMessage () override
 set status & message after test has run More...
 
- Protected Member Functions inherited from QCriterion
void setAlgoName (std::string name)
 set algorithm name More...
 
void setVerbose (int verbose)
 probability limits for warnings, errors More...
 

Private Attributes

float _average
 
float _max
 
float _min
 

Additional Inherited Members

- Public Types inherited from QCriterion
typedef dqm::legacy::MonitorElement MonitorElement
 (class should be created by DQMStore class) More...
 
- Static Public Attributes inherited from QCriterion
static const float ERROR_PROB_THRESHOLD = 0.50
 
static const float WARNING_PROB_THRESHOLD = 0.90
 default "probability" values for setting warnings & errors when running tests More...
 
- 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...
 

Detailed Description

Definition at line 640 of file QTest.h.

Constructor & Destructor Documentation

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

Definition at line 643 of file QTest.h.

References _average, _max, _min, getAlgoName(), and QCriterion::setAlgoName().

643  : SimpleTest(name, true) {
644  this->_min = 0.0;
645  this->_max = 1.0;
646  this->_average = 0.0;
648  };
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:96
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:124
static std::string getAlgoName()
Definition: QTest.h:653
CompareLastFilledBin::~CompareLastFilledBin ( )
overridedefault

Member Function Documentation

static std::string CompareLastFilledBin::getAlgoName ( )
inlinestatic

Definition at line 653 of file QTest.h.

Referenced by CompareLastFilledBin(), and QualityTester::makeQCriterion().

653 { return "CompareLastFilledBin"; }
float CompareLastFilledBin::runTest ( const MonitorElement me)
overridevirtual

Reimplemented from QCriterion.

Definition at line 1304 of file QTest.cc.

References gather_cfg::cout, dqm::impl::MonitorElement::getFullname(), dqm::legacy::MonitorElement::getRootObject(), dqm::legacy::MonitorElement::getTH1F(), dqm::legacy::MonitorElement::getTH2F(), dqm::impl::MonitorElement::kind(), MonitorElementData::TH1F, and MonitorElementData::TH2F.

1304  {
1305  if (!me)
1306  return -1;
1307  if (!me->getRootObject())
1308  return -1;
1309  TH1* h1 = nullptr;
1310  TH2* h2 = nullptr;
1311  if (verbose_ > 1) {
1312  std::cout << "QTest:" << getAlgoName() << "::runTest called on " << me->getFullname() << "\n";
1313  std::cout << "\tMin = " << _min << "; Max = " << _max << "\n";
1314  }
1315  if (me->kind() == MonitorElement::Kind::TH1F) {
1316  h1 = me->getTH1F(); // access Test histo
1317  } else if (me->kind() == MonitorElement::Kind::TH2F) {
1318  h2 = me->getTH2F(); // access Test histo
1319  } else {
1320  if (verbose_ > 0)
1321  std::cout << "QTest:ContentsWithinExpected"
1322  << " ME does not contain TH1F or TH2F, exiting\n";
1323  return -1;
1324  }
1325  int lastBinX = 0;
1326  int lastBinY = 0;
1327  float lastBinVal;
1328 
1329  //--------- do the quality test for 1D histo ---------------//
1330  if (h1 != nullptr) {
1331  lastBinX = h1->FindLastBinAbove(_average, 1);
1332  lastBinVal = h1->GetBinContent(lastBinX);
1333  if (h1->GetEntries() == 0 || lastBinVal < 0)
1334  return 1;
1335  } else if (h2 != nullptr) {
1336  lastBinX = h2->FindLastBinAbove(_average, 1);
1337  lastBinY = h2->FindLastBinAbove(_average, 2);
1338  if (h2->GetEntries() == 0 || lastBinX < 0 || lastBinY < 0)
1339  return 1;
1340  lastBinVal = h2->GetBinContent(h2->GetBin(lastBinX, lastBinY));
1341  } else {
1342  if (verbose_ > 0)
1343  std::cout << "QTest:" << getAlgoName() << " Histogram does not exist" << std::endl;
1344  return 1;
1345  }
1346  if (verbose_ > 0)
1347  std::cout << "Min and Max values " << _min << " " << _max << " Av value " << _average << " lastBinX " << lastBinX
1348  << " lastBinY " << lastBinY << " lastBinVal " << lastBinVal << std::endl;
1349  if (lastBinVal > _min && lastBinVal <= _max)
1350  return 1;
1351  else
1352  return 0;
1353 }
virtual TH2F * getTH2F() const
int verbose_
Definition: QTest.h:110
virtual TH1F * getTH1F() const
Kind kind() const
Get the type of the monitor element.
std::string getFullname() const
get full name of ME including Pathname
tuple cout
Definition: gather_cfg.py:144
TObject * getRootObject() const override
static std::string getAlgoName()
Definition: QTest.h:653
void CompareLastFilledBin::setAverage ( float  average)
inline

Definition at line 656 of file QTest.h.

References _average, and PDRates::average.

656 { _average = average; };
int average
Definition: PDRates.py:138
void CompareLastFilledBin::setMax ( float  max)
inline

Definition at line 658 of file QTest.h.

References _max, and SiStripPI::max.

void CompareLastFilledBin::setMessage ( )
inlineoverrideprotectedvirtual

set status & message after test has run

Reimplemented from SimpleTest.

Definition at line 661 of file QTest.h.

References QCriterion::algoName_, QCriterion::message_, QCriterion::prob_, and QCriterion::qtname_.

661  {
662  std::ostringstream message;
663  message << "Test " << qtname_ << " (" << algoName_ << "): Last Bin filled with desired value = " << prob_;
664  message_ = message.str();
665  }
std::string algoName_
name of quality test
Definition: QTest.h:104
std::string qtname_
Definition: QTest.h:103
float prob_
name of algorithm
Definition: QTest.h:105
std::string message_
quality test status
Definition: QTest.h:107
void CompareLastFilledBin::setMin ( float  min)
inline

Definition at line 657 of file QTest.h.

References _min, and min().

657 { _min = min; };
T min(T a, T b)
Definition: MathUtil.h:58

Member Data Documentation

float CompareLastFilledBin::_average
private

Definition at line 669 of file QTest.h.

Referenced by CompareLastFilledBin(), and setAverage().

float CompareLastFilledBin::_max
private

Definition at line 668 of file QTest.h.

Referenced by CompareLastFilledBin(), generateEDF.LumiInfoCont::max(), and setMax().

float CompareLastFilledBin::_min
private

Definition at line 668 of file QTest.h.

Referenced by CompareLastFilledBin(), generateEDF.LumiInfoCont::min(), and setMin().