CMS 3D CMS Logo

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::CompareLastFilledBin ( const std::string &  name)
inline

Definition at line 643 of file QTest.h.

643  : SimpleTest(name, true) {
644  this->_min = 0.0;
645  this->_max = 1.0;
646  this->_average = 0.0;
648  };

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

◆ ~CompareLastFilledBin()

CompareLastFilledBin::~CompareLastFilledBin ( )
overridedefault

Member Function Documentation

◆ getAlgoName()

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

Definition at line 653 of file QTest.h.

653 { return "CompareLastFilledBin"; }

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

◆ runTest()

float CompareLastFilledBin::runTest ( const MonitorElement me)
overridevirtual

Reimplemented from QCriterion.

Definition at line 1304 of file QTest.cc.

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 }

References gather_cfg::cout, hlt_dqm_clientPB-live_cfg::me, MonitorElementData::TH1F, and MonitorElementData::TH2F.

◆ setAverage()

void CompareLastFilledBin::setAverage ( float  average)
inline

Definition at line 656 of file QTest.h.

656 { _average = average; };

References _average, and PDRates::average.

◆ setMax()

void CompareLastFilledBin::setMax ( float  max)
inline

Definition at line 658 of file QTest.h.

658 { _max = max; };

References _max, and SiStripPI::max.

◆ setMessage()

void CompareLastFilledBin::setMessage ( )
inlineoverrideprotectedvirtual

set status & message after test has run

Reimplemented from SimpleTest.

Definition at line 661 of file QTest.h.

661  {
662  std::ostringstream message;
663  message << "Test " << qtname_ << " (" << algoName_ << "): Last Bin filled with desired value = " << prob_;
664  message_ = message.str();
665  }

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

◆ setMin()

void CompareLastFilledBin::setMin ( float  min)
inline

Definition at line 657 of file QTest.h.

657 { _min = min; };

References _min, and min().

Member Data Documentation

◆ _average

float CompareLastFilledBin::_average
private

Definition at line 669 of file QTest.h.

Referenced by CompareLastFilledBin(), and setAverage().

◆ _max

float CompareLastFilledBin::_max
private

Definition at line 668 of file QTest.h.

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

◆ _min

float CompareLastFilledBin::_min
private

Definition at line 668 of file QTest.h.

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

CompareLastFilledBin::getAlgoName
static std::string getAlgoName()
Definition: QTest.h:653
min
T min(T a, T b)
Definition: MathUtil.h:58
MonitorElementData::Kind::TH1F
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MonitorElementData::Kind::TH2F
PDRates.average
average
Definition: PDRates.py:139
SimpleTest::SimpleTest
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:124
QCriterion::verbose_
int verbose_
Definition: QTest.h:110
QCriterion::setAlgoName
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:96
CompareLastFilledBin::_min
float _min
Definition: QTest.h:668
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
QCriterion::prob_
float prob_
name of algorithm
Definition: QTest.h:105
CompareLastFilledBin::_average
float _average
Definition: QTest.h:669
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
CompareLastFilledBin::_max
float _max
Definition: QTest.h:668
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
QCriterion::algoName_
std::string algoName_
name of quality test
Definition: QTest.h:104
QCriterion::qtname_
std::string qtname_
Definition: QTest.h:103
QCriterion::message_
std::string message_
quality test status
Definition: QTest.h:107