CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions
CheckVariance Class Reference

#include <QTest.h>

Inheritance diagram for CheckVariance:
SimpleTest QCriterion

Public Member Functions

 CheckVariance (const std::string &name)
 
float runTest (const MonitorElement *me)
 
- 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)
 get algorithm name More...
 

Additional Inherited Members

- Protected Member Functions inherited from SimpleTest
virtual 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)
 
- 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 743 of file QTest.h.

Constructor & Destructor Documentation

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

Definition at line 746 of file QTest.h.

References QCriterion::setAlgoName().

746  : SimpleTest(name)
747  {
749  }
static std::string getAlgoName(void)
get algorithm name
Definition: QTest.h:751
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:78
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:138

Member Function Documentation

static std::string CheckVariance::getAlgoName ( void  )
inlinestatic

get algorithm name

Definition at line 751 of file QTest.h.

References QCriterion::runTest().

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

751 { return "CheckVariance"; }
float CheckVariance::runTest ( const MonitorElement me)
virtual

Reimplemented from QCriterion.

Definition at line 1564 of file QTest.cc.

References stringResolutionProvider_cfi::bin, relmon_rootfiles_spy::contents, gather_cfg::cout, MonitorElement::DQM_KIND_TH1D, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TPROFILE, MonitorElement::getFullname(), MonitorElement::getRootObject(), MonitorElement::getTH1D(), MonitorElement::getTH1F(), MonitorElement::getTProfile(), MonitorElement::kind(), and combinedConstraintHelpers::sum2().

1565 {
1566  badChannels_.clear();
1567 
1568  if (!me)
1569  return -1;
1570  if (!me->getRootObject())
1571  return -1;
1572  TH1* h=nullptr;
1573 
1574  if (verbose_>1)
1575  std::cout << "QTest:" << getAlgoName() << "::runTest called on "
1576  << me-> getFullname() << "\n";
1577  // -- TH1F
1578  if (me->kind()==MonitorElement::DQM_KIND_TH1F )
1579  {
1580  h = me->getTH1F();
1581  }
1582  // -- TH1D
1583  else if ( me->kind()==MonitorElement::DQM_KIND_TH1D )
1584  {
1585  h = me->getTH1D();
1586  }
1587  else if (me->kind()==MonitorElement::DQM_KIND_TPROFILE)
1588  {
1589  h = me->getTProfile(); // access Test histo
1590  }
1591  else
1592  {
1593  if (verbose_>0) std::cout << "QTest:CheckVariance"
1594  << " ME " << me->getFullname()
1595  << " does not contain TH1F/TH1D/TPROFILE, exiting\n";
1596  return -1;
1597  }
1598 
1599  int ncx = h->GetXaxis()->GetNbins();
1600 
1601  double sum = 0;
1602  double sum2 = 0;
1603  for (int bin = 1; bin <= ncx; ++bin)
1604  {
1605  double contents = h->GetBinContent(bin);
1606  sum += contents;
1607  }
1608  if (sum==0) return -1;
1609  double avg = sum/ncx;
1610 
1611  for (int bin = 1; bin <= ncx; ++bin)
1612  {
1613  double contents = h->GetBinContent(bin);
1614  sum2 += (contents - avg)*(contents - avg);
1615  }
1616 
1617  double Variance = TMath::Sqrt(sum2/ncx);
1618  return Variance;
1619 }
static std::string getAlgoName(void)
get algorithm name
Definition: QTest.h:751
int verbose_
Definition: QTest.h:118
TH1D * getTH1D(void) const
Kind kind(void) const
Get the type of the monitor element.
const std::string getFullname(void) const
get full name of ME including Pathname
bin
set the eta bin as selection string.
TObject * getRootObject(void) const
TH1F * getTH1F(void) const
std::vector< DQMChannel > badChannels_
Definition: QTest.h:160
TProfile * getTProfile(void) const