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
 (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 ()
 

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

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

Constructor & Destructor Documentation

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

Definition at line 774 of file QTest.h.

References QCriterion::setAlgoName().

774  : SimpleTest(name,true){
775  this->_min = 0.0;
776  this->_max = 1.0;
777  this->_average = 0.0;
779  };
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:80
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:140
static std::string getAlgoName()
Definition: QTest.h:783
CompareLastFilledBin::~CompareLastFilledBin ( )
overridedefault

Member Function Documentation

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

Definition at line 783 of file QTest.h.

References QCriterion::runTest().

Referenced by QTestConfigure::EnableCompareLastFilledBinTest(), QTestConfigure::enableTests(), and QTestParameterNames::QTestParameterNames().

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

Reimplemented from QCriterion.

Definition at line 1983 of file QTest.cc.

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

1983  {
1984  if (!me)
1985  return -1;
1986  if (!me->getRootObject())
1987  return -1;
1988  TH1* h1=nullptr;
1989  TH2* h2=nullptr;
1990  if (verbose_>1){
1991  std::cout << "QTest:" << getAlgoName() << "::runTest called on "
1992  << me-> getFullname() << "\n";
1993  std::cout << "\tMin = " << _min << "; Max = " << _max << "\n";
1994  }
1996  {
1997  h1 = me->getTH1F(); // access Test histo
1998  }
1999  else if (me->kind()==MonitorElement::DQM_KIND_TH2F)
2000  {
2001  h2 = me->getTH2F(); // access Test histo
2002  }
2003  else
2004  {
2005  if (verbose_>0)
2006  std::cout << "QTest:ContentsWithinExpected"
2007  << " ME does not contain TH1F or TH2F, exiting\n";
2008  return -1;
2009  }
2010  int lastBinX = 0;
2011  int lastBinY = 0;
2012  float lastBinVal;
2013 
2014  //--------- do the quality test for 1D histo ---------------//
2015  if (h1 != nullptr)
2016  {
2017  lastBinX = h1->FindLastBinAbove(_average,1);
2018  lastBinVal = h1->GetBinContent(lastBinX);
2019  if (h1->GetEntries() == 0 || lastBinVal < 0) return 1;
2020  }
2021  else if (h2 != nullptr)
2022  {
2023 
2024  lastBinX = h2->FindLastBinAbove(_average,1);
2025  lastBinY = h2->FindLastBinAbove(_average,2);
2026  if ( h2->GetEntries() == 0 || lastBinX < 0 || lastBinY < 0 ) return 1;
2027  lastBinVal = h2->GetBinContent(h2->GetBin(lastBinX,lastBinY));
2028  } else {
2029  if (verbose_ > 0) std::cout << "QTest:"<< getAlgoName() << " Histogram does not exist" << std::endl;
2030  return 1;
2031  }
2032  if (verbose_ > 0) std::cout << "Min and Max values " << _min << " " << _max << " Av value " << _average << " lastBinX " << lastBinX<< " lastBinY " << lastBinY << " lastBinVal " << lastBinVal << std::endl;
2033  if (lastBinVal > _min && lastBinVal <= _max)
2034  return 1;
2035  else
2036  return 0;
2037 }
TH1F * getTH1F() const
int verbose_
Definition: QTest.h:120
TObject * getRootObject() const
TH2F * getTH2F() const
Kind kind() const
Get the type of the monitor element.
static std::string getAlgoName()
Definition: QTest.h:783
void CompareLastFilledBin::setAverage ( float  average)
inline

Definition at line 786 of file QTest.h.

Referenced by QTestConfigure::EnableCompareLastFilledBinTest().

786 {_average = average;};
void CompareLastFilledBin::setMax ( float  max)
inline
void CompareLastFilledBin::setMessage ( )
inlineoverrideprotectedvirtual

set status & message after test has run

Reimplemented from SimpleTest.

Definition at line 792 of file QTest.h.

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

792  {
793  std::ostringstream message;
794  message << "Test " << qtname_ << " (" << algoName_
795  << "): Last Bin filled with desired value = " << prob_;
796  message_ = message.str();
797  }
std::string algoName_
name of quality test
Definition: QTest.h:114
std::string qtname_
Definition: QTest.h:113
float prob_
name of algorithm
Definition: QTest.h:115
std::string message_
quality test status
Definition: QTest.h:117
void CompareLastFilledBin::setMin ( float  min)
inline

Definition at line 787 of file QTest.h.

References min().

Referenced by QTestConfigure::EnableCompareLastFilledBinTest().

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

Member Data Documentation

float CompareLastFilledBin::_average
private

Definition at line 801 of file QTest.h.

float CompareLastFilledBin::_max
private

Definition at line 800 of file QTest.h.

Referenced by generateEDF.LumiInfoCont::max().

float CompareLastFilledBin::_min
private

Definition at line 800 of file QTest.h.

Referenced by generateEDF.LumiInfoCont::min().