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 (see Core/interface/DQMDefinitions.h) 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 ()
 

Protected Member Functions

void setMessage () override
 set status & message after test has run More...
 
- Protected Member Functions inherited from QCriterion
void init ()
 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 ()=default
 

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

Constructor & Destructor Documentation

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

Definition at line 677 of file QTest.h.

References QCriterion::setAlgoName().

677  : SimpleTest(name, true) {
678  this->_min = 0.0;
679  this->_max = 1.0;
680  this->_average = 0.0;
682  };
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:95
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:158
static std::string getAlgoName()
Definition: QTest.h:687
CompareLastFilledBin::~CompareLastFilledBin ( )
overridedefault

Member Function Documentation

static std::string CompareLastFilledBin::getAlgoName ( )
inlinestatic
float CompareLastFilledBin::runTest ( const MonitorElement me)
overridevirtual

Reimplemented from QCriterion.

Definition at line 1308 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.

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

Definition at line 690 of file QTest.h.

References PDRates::average.

Referenced by QTestConfigure::EnableCompareLastFilledBinTest().

690 { _average = average; };
void CompareLastFilledBin::setMax ( float  max)
inline

Definition at line 692 of file QTest.h.

References SiStripPI::max.

Referenced by QTestConfigure::EnableCompareLastFilledBinTest().

void CompareLastFilledBin::setMessage ( )
inlineoverrideprotectedvirtual

set status & message after test has run

Reimplemented from SimpleTest.

Definition at line 695 of file QTest.h.

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

695  {
696  std::ostringstream message;
697  message << "Test " << qtname_ << " (" << algoName_ << "): Last Bin filled with desired value = " << prob_;
698  message_ = message.str();
699  }
std::string algoName_
name of quality test
Definition: QTest.h:132
std::string qtname_
Definition: QTest.h:131
float prob_
name of algorithm
Definition: QTest.h:133
std::string message_
quality test status
Definition: QTest.h:135
void CompareLastFilledBin::setMin ( float  min)
inline

Definition at line 691 of file QTest.h.

References min().

Referenced by QTestConfigure::EnableCompareLastFilledBinTest().

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

Member Data Documentation

float CompareLastFilledBin::_average
private

Definition at line 703 of file QTest.h.

float CompareLastFilledBin::_max
private

Definition at line 702 of file QTest.h.

Referenced by generateEDF.LumiInfoCont::max().

float CompareLastFilledBin::_min
private

Definition at line 702 of file QTest.h.

Referenced by generateEDF.LumiInfoCont::min().