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

Constructor & Destructor Documentation

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

Definition at line 717 of file QTest.h.

References QCriterion::setAlgoName().

717  : SimpleTest(name)
718  {
720  }
static std::string getAlgoName(void)
get algorithm name
Definition: QTest.h:722
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:77
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:137

Member Function Documentation

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

get algorithm name

Definition at line 722 of file QTest.h.

References QCriterion::runTest().

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

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

Reimplemented from QCriterion.

Definition at line 1453 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().

1454 {
1455  badChannels_.clear();
1456 
1457  if (!me)
1458  return -1;
1459  if (!me->getRootObject())
1460  return -1;
1461  TH1* h=0;
1462 
1463  if (verbose_>1)
1464  std::cout << "QTest:" << getAlgoName() << "::runTest called on "
1465  << me-> getFullname() << "\n";
1466  // -- TH1F
1467  if (me->kind()==MonitorElement::DQM_KIND_TH1F )
1468  {
1469  h = me->getTH1F();
1470  }
1471  // -- TH1D
1472  else if ( me->kind()==MonitorElement::DQM_KIND_TH1D )
1473  {
1474  h = me->getTH1D();
1475  }
1476  else if (me->kind()==MonitorElement::DQM_KIND_TPROFILE)
1477  {
1478  h = me->getTProfile(); // access Test histo
1479  }
1480  else
1481  {
1482  if (verbose_>0) std::cout << "QTest:CheckVariance"
1483  << " ME " << me->getFullname()
1484  << " does not contain TH1F/TH1D/TPROFILE, exiting\n";
1485  return -1;
1486  }
1487 
1488  int ncx = h->GetXaxis()->GetNbins();
1489 
1490  double sum = 0;
1491  double sum2 = 0;
1492  for (int bin = 1; bin <= ncx; ++bin)
1493  {
1494  double contents = h->GetBinContent(bin);
1495  sum += contents;
1496  }
1497  if (sum==0) return -1;
1498  double avg = sum/ncx;
1499 
1500  for (int bin = 1; bin <= ncx; ++bin)
1501  {
1502  double contents = h->GetBinContent(bin);
1503  sum2 += (contents - avg)*(contents - avg);
1504  }
1505 
1506  double Variance = TMath::Sqrt(sum2/ncx);
1507  return Variance;
1508 }
static std::string getAlgoName(void)
get algorithm name
Definition: QTest.h:722
int verbose_
Definition: QTest.h:117
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:159
TProfile * getTProfile(void) const