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 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)
 
void setAverage (float average)
 
void setMax (float max)
 
void setMin (float min)
 
 ~CompareLastFilledBin ()
 
- 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 Member Functions

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)
 

Private Attributes

float _average
 
float _max
 
float _min
 

Additional Inherited Members

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

Constructor & Destructor Documentation

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

Definition at line 651 of file QTest.h.

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

651  : SimpleTest(name,true){
652  this->_min = 0.0;
653  this->_max = 1.0;
654  this->_average = 0.0;
656  };
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:660
CompareLastFilledBin::~CompareLastFilledBin ( )
inline

Definition at line 658 of file QTest.h.

658 {};

Member Function Documentation

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

Reimplemented from QCriterion.

Definition at line 1395 of file QTest.cc.

References gather_cfg::cout, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH2F, MonitorElement::getRootObject(), MonitorElement::getTH1F(), MonitorElement::getTH2F(), MonitorElement::kind(), and NULL.

1395  {
1396  if (!me)
1397  return -1;
1398  if (!me->getRootObject())
1399  return -1;
1400  TH1* h1=0;
1401  TH2* h2=0;
1402  if (verbose_>1){
1403  std::cout << "QTest:" << getAlgoName() << "::runTest called on "
1404  << me-> getFullname() << "\n";
1405  std::cout << "\tMin = " << _min << "; Max = " << _max << "\n";
1406  }
1408  {
1409  h1 = me->getTH1F(); // access Test histo
1410  }
1411  else if (me->kind()==MonitorElement::DQM_KIND_TH2F)
1412  {
1413  h2 = me->getTH2F(); // access Test histo
1414  }
1415  else
1416  {
1417  if (verbose_>0)
1418  std::cout << "QTest:ContentsWithinExpected"
1419  << " ME does not contain TH1F or TH2F, exiting\n";
1420  return -1;
1421  }
1422  int lastBinX = 0;
1423  int lastBinY = 0;
1424  float lastBinVal;
1425 
1426  //--------- do the quality test for 1D histo ---------------//
1427  if (h1 != NULL)
1428  {
1429  lastBinX = h1->FindLastBinAbove(_average,1);
1430  lastBinVal = h1->GetBinContent(lastBinX);
1431  if (h1->GetEntries() == 0 || lastBinVal < 0) return 1;
1432  }
1433  else if (h2 != NULL)
1434  {
1435 
1436  lastBinX = h2->FindLastBinAbove(_average,1);
1437  lastBinY = h2->FindLastBinAbove(_average,2);
1438  if ( h2->GetEntries() == 0 || lastBinX < 0 || lastBinY < 0 ) return 1;
1439  lastBinVal = h2->GetBinContent(h2->GetBin(lastBinX,lastBinY));
1440  } else {
1441  if (verbose_ > 0) std::cout << "QTest:"<< getAlgoName() << " Histogram does not exist" << std::endl;
1442  return 1;
1443  }
1444  if (verbose_ > 0) std::cout << "Min and Max values " << _min << " " << _max << " Av value " << _average << " lastBinX " << lastBinX<< " lastBinY " << lastBinY << " lastBinVal " << lastBinVal << std::endl;
1445  if (lastBinVal > _min && lastBinVal <= _max)
1446  return 1;
1447  else
1448  return 0;
1449 }
int verbose_
Definition: QTest.h:117
#define NULL
Definition: scimark2.h:8
Kind kind(void) const
Get the type of the monitor element.
TObject * getRootObject(void) const
TH1F * getTH1F(void) const
tuple cout
Definition: gather_cfg.py:145
TH2F * getTH2F(void) const
static std::string getAlgoName(void)
Definition: QTest.h:660
void CompareLastFilledBin::setAverage ( float  average)
inline

Definition at line 663 of file QTest.h.

References _average, and PDRates::average.

Referenced by QTestConfigure::EnableCompareLastFilledBinTest().

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

Definition at line 665 of file QTest.h.

References _max, and bookConverter::max.

Referenced by QTestConfigure::EnableCompareLastFilledBinTest().

void CompareLastFilledBin::setMessage ( void  )
inlineprotectedvirtual

set status & message after test has run

Reimplemented from SimpleTest.

Definition at line 669 of file QTest.h.

References QCriterion::algoName_, python.rootplot.argparse::message, QCriterion::message_, QCriterion::prob_, and QCriterion::qtname_.

669  {
670  std::ostringstream message;
671  message << "Test " << qtname_ << " (" << algoName_
672  << "): Last Bin filled with desired value = " << prob_;
673  message_ = message.str();
674  }
std::string algoName_
name of quality test
Definition: QTest.h:111
std::string qtname_
Definition: QTest.h:110
float prob_
name of algorithm
Definition: QTest.h:112
std::string message_
quality test status
Definition: QTest.h:114
void CompareLastFilledBin::setMin ( float  min)
inline

Definition at line 664 of file QTest.h.

References _min, and min().

Referenced by QTestConfigure::EnableCompareLastFilledBinTest().

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

Member Data Documentation

float CompareLastFilledBin::_average
private

Definition at line 678 of file QTest.h.

Referenced by CompareLastFilledBin(), and setAverage().

float CompareLastFilledBin::_max
private

Definition at line 677 of file QTest.h.

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

float CompareLastFilledBin::_min
private

Definition at line 677 of file QTest.h.

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