Algorithm for testing if histogram's mean value is near expected value. More...
#include <QTest.h>
Public Member Functions | |
MeanWithinExpected (const std::string &name) | |
float | runTest (const MonitorElement *me) |
void | setExpectedMean (double mean) |
void | useRange (double xmin, double xmax) |
void | useRMS (void) |
void | useSigma (double expectedSigma) |
Static Public Member Functions | |
static std::string | getAlgoName (void) |
Protected Attributes | |
double | expMean_ |
double | sigma_ |
bool | useRange_ |
bool | useRMS_ |
bool | useSigma_ |
double | xmax_ |
double | xmin_ |
Algorithm for testing if histogram's mean value is near expected value.
MeanWithinExpected::MeanWithinExpected | ( | const std::string & | name | ) | [inline] |
Definition at line 395 of file QTest.h.
References getAlgoName(), and QCriterion::setAlgoName().
: SimpleTest(name) { setAlgoName(getAlgoName()); }
static std::string MeanWithinExpected::getAlgoName | ( | void | ) | [inline, static] |
Definition at line 399 of file QTest.h.
Referenced by QTestConfigure::EnableMeanWithinExpectedTest(), QTestConfigure::enableTests(), MeanWithinExpected(), and QTestParameterNames::QTestParameterNames().
{ return "MeanWithinExpected"; }
float MeanWithinExpected::runTest | ( | const MonitorElement * | me | ) | [virtual] |
Reimplemented from QCriterion.
Definition at line 1147 of file QTest.cc.
References gather_cfg::cout, MonitorElement::DQM_KIND_TH1D, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH1S, MonitorElement::getEntries(), MonitorElement::getFullname(), MonitorElement::getRootObject(), MonitorElement::getTH1D(), MonitorElement::getTH1F(), MonitorElement::getTH1S(), h, MonitorElement::kind(), and timingPdfMaker::mean.
{ if (!me) return -1; if (!me->getRootObject()) return -1; TH1* h=0; if (verbose_>1) std::cout << "QTest:" << getAlgoName() << "::runTest called on " << me-> getFullname() << "\n"; if (minEntries_ != 0 && me->getEntries() < minEntries_) return -1; if (me->kind()==MonitorElement::DQM_KIND_TH1F) { h = me->getTH1F(); //access Test histo } else if (me->kind()==MonitorElement::DQM_KIND_TH1S) { h = me->getTH1S(); //access Test histo } else if (me->kind()==MonitorElement::DQM_KIND_TH1D) { h = me->getTH1D(); //access Test histo } else { if (verbose_>0) std::cout << "QTest:MeanWithinExpected" << " ME " << me->getFullname() << " does not contain TH1F/TH1S/TH1D, exiting\n"; return -1; } if (useRange_) { double mean = h->GetMean(); if (mean <= xmax_ && mean >= xmin_) return 1; else return 0; } else if (useSigma_) { if (sigma_ != 0.) { double chi = (h->GetMean() - expMean_)/sigma_; return TMath::Prob(chi*chi, 1); } else { if (verbose_>0) std::cout << "QTest:MeanWithinExpected" << " Error, sigma_ is zero, exiting\n"; return 0; } } else if (useRMS_) { if (h->GetRMS() != 0.) { double chi = (h->GetMean() - expMean_)/h->GetRMS(); return TMath::Prob(chi*chi, 1); } else { if (verbose_>0) std::cout << "QTest:MeanWithinExpected" << " Error, RMS is zero, exiting\n"; return 0; } } else if (verbose_>0) std::cout << "QTest:MeanWithinExpected" << " Error, neither Range, nor Sigma, nor RMS, exiting\n"; return -1; }
void MeanWithinExpected::setExpectedMean | ( | double | mean | ) | [inline] |
Definition at line 402 of file QTest.h.
References expMean_, and timingPdfMaker::mean.
Referenced by createMeanValueTest(), and QTestConfigure::EnableMeanWithinExpectedTest().
void MeanWithinExpected::useRange | ( | double | xmin, |
double | xmax | ||
) |
Definition at line 1226 of file QTest.cc.
References gather_cfg::cout, SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::xmin.
Referenced by QTestConfigure::EnableMeanWithinExpectedTest().
void MeanWithinExpected::useRMS | ( | void | ) |
Definition at line 1247 of file QTest.cc.
Referenced by createMeanValueTest(), and QTestConfigure::EnableMeanWithinExpectedTest().
void MeanWithinExpected::useSigma | ( | double | expectedSigma | ) |
Definition at line 1236 of file QTest.cc.
References gather_cfg::cout.
Referenced by createMeanValueTest(), and QTestConfigure::EnableMeanWithinExpectedTest().
double MeanWithinExpected::expMean_ [protected] |
Definition at line 412 of file QTest.h.
Referenced by setExpectedMean().
double MeanWithinExpected::sigma_ [protected] |
bool MeanWithinExpected::useRange_ [protected] |
bool MeanWithinExpected::useRMS_ [protected] |
bool MeanWithinExpected::useSigma_ [protected] |
double MeanWithinExpected::xmax_ [protected] |
double MeanWithinExpected::xmin_ [protected] |