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

1555 {
1556  badChannels_.clear();
1557 
1558  if (!me)
1559  return -1;
1560  if (!me->getRootObject())
1561  return -1;
1562  TH1* h=0;
1563 
1564  if (verbose_>1)
1565  std::cout << "QTest:" << getAlgoName() << "::runTest called on "
1566  << me-> getFullname() << "\n";
1567  // -- TH1F
1568  if (me->kind()==MonitorElement::DQM_KIND_TH1F )
1569  {
1570  h = me->getTH1F();
1571  }
1572  // -- TH1D
1573  else if ( me->kind()==MonitorElement::DQM_KIND_TH1D )
1574  {
1575  h = me->getTH1D();
1576  }
1577  else if (me->kind()==MonitorElement::DQM_KIND_TPROFILE)
1578  {
1579  h = me->getTProfile(); // access Test histo
1580  }
1581  else
1582  {
1583  if (verbose_>0) std::cout << "QTest:CheckVariance"
1584  << " ME " << me->getFullname()
1585  << " does not contain TH1F/TH1D/TPROFILE, exiting\n";
1586  return -1;
1587  }
1588 
1589  int ncx = h->GetXaxis()->GetNbins();
1590 
1591  double sum = 0;
1592  double sum2 = 0;
1593  for (int bin = 1; bin <= ncx; ++bin)
1594  {
1595  double contents = h->GetBinContent(bin);
1596  sum += contents;
1597  }
1598  if (sum==0) return -1;
1599  double avg = sum/ncx;
1600 
1601  for (int bin = 1; bin <= ncx; ++bin)
1602  {
1603  double contents = h->GetBinContent(bin);
1604  sum2 += (contents - avg)*(contents - avg);
1605  }
1606 
1607  double Variance = TMath::Sqrt(sum2/ncx);
1608  return Variance;
1609 }
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