CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
Comp2Ref2DChi2 Class Reference

#include <QTest.h>

Inheritance diagram for Comp2Ref2DChi2:
SimpleTest QCriterion

Public Member Functions

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

Protected Member Functions

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

double chi2_
 
int Ndof_
 
- 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 212 of file QTest.h.

Constructor & Destructor Documentation

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

Definition at line 215 of file QTest.h.

References QCriterion::setAlgoName().

215  :SimpleTest(name)
216  {
218  }
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:78
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:138
static std::string getAlgoName(void)
Definition: QTest.h:219

Member Function Documentation

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

Definition at line 219 of file QTest.h.

References QCriterion::runTest().

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

219 { return "Comp2Ref2DChi2"; }
float Comp2Ref2DChi2::runTest ( const MonitorElement me)
virtual

Reimplemented from QCriterion.

Definition at line 292 of file QTest.cc.

References gather_cfg::cout, MonitorElement::DQM_KIND_TH2D, MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TH2S, MonitorElement::DQM_KIND_TPROFILE2D, MonitorElement::getEntries(), MonitorElement::getRefRootObject(), MonitorElement::getRefTH2D(), MonitorElement::getRefTH2F(), MonitorElement::getRefTH2S(), MonitorElement::getRefTProfile2D(), MonitorElement::getRootObject(), MonitorElement::getTH2D(), MonitorElement::getTH2F(), MonitorElement::getTH2S(), MonitorElement::getTProfile2D(), and MonitorElement::kind().

293 {
294  if (!me)
295  return -1;
296  if (!me->getRootObject() || !me->getRefRootObject())
297  return -1;
298  if (minEntries_ != 0 && me->getEntries() < minEntries_)
299  return -1;
300 
301  TH2* h=0;
302  TH2* ref_=0;
303 
304  if (verbose_>1)
305  std::cout << "QTest:" << getAlgoName() << "::runTest called on "
306  << me-> getFullname() << "\n";
307  //-- TH2F
309  {
310  h = me->getTH2F(); // access Test histo
311  ref_ = me->getRefTH2F(); //access Ref histo
312  }
313  //-- TH2S
314  else if (me->kind()==MonitorElement::DQM_KIND_TH2S)
315  {
316  h = me->getTH2S(); // access Test histo
317  ref_ = me->getRefTH2S(); //access Ref histo
318  }
319  //-- TH2D
320  else if (me->kind()==MonitorElement::DQM_KIND_TH2D)
321  {
322  h = me->getTH2D(); // access Test histo
323  ref_ = me->getRefTH2D(); //access Ref histo
324  }
325  //-- TProfile
327  {
328  h = me->getTProfile2D(); // access Test histo
329  ref_ = me->getRefTProfile2D(); //access Ref histo
330  }
331  else
332  {
333  if (verbose_>0)
334  std::cout << "QTest::Comp2Ref2DChi2"
335  << " ME does not contain TH2F/TH2S/TH2D/TProfile2D, exiting\n";
336  return -1;
337  }
338 
339  //-- isInvalid ? - Check consistency in number of channels
340  int ncx1 = h->GetXaxis()->GetNbins();
341  int ncx2 = ref_->GetXaxis()->GetNbins();
342  int ncy1 = h->GetYaxis()->GetNbins();
343  int ncy2 = ref_->GetYaxis()->GetNbins();
344  if ( ( ncx1 != ncx2) || ( ncy1 != ncy2) )
345  {
346  if (verbose_>0)
347  std::cout << "QTest:Comp2Ref2DChi2"
348  << " different number of channels! ("
349  << ncx1 << ", " << ncx2 << "), ("
350  << ncy1 << ", " << ncy2 << "), exiting\n";
351  return -1;
352  }
353 
354  //-- QUALITY TEST itself
355  //reset Results
356  Ndof_ = 0; chi2_ = -1.;
357 
358  //check that the histograms are not empty
359  int i_start = h->GetXaxis()->GetFirst();
360  int i_end = h->GetXaxis()->GetLast();
361  int j_start = h->GetYaxis()->GetFirst();
362  int j_end = h->GetYaxis()->GetLast();
363  if (h->Integral(i_start, i_end, j_start, j_end) == 0)
364  {
365  if (verbose_>0)
366  std::cout << "QTest:Comp2Ref2DChi2"
367  << " Test Histogram " << h->GetName()
368  << " is empty, exiting\n";
369  return -1;
370  }
371  if (ref_->Integral(i_start, i_end, j_start, j_end) == 0)
372  {
373  if (verbose_>0)
374  std::cout << "QTest:Comp2Ref2DChi2"
375  << " Ref Histogram " << ref_->GetName()
376  << " is empty, exiting\n";
377  return -1;
378  }
379 
380  //use the chi2 test for 2D histograms defined in ROOT
381  int igood = 0;
382  double pValue = h->Chi2TestX(ref_, chi2_, Ndof_, igood, "");
383 
384  if (chi2_==-1. && Ndof_==0)
385  return -1;
386 
387  return pValue;
388 }
TH2S * getTH2S(void) const
TProfile2D * getTProfile2D(void) const
int verbose_
Definition: QTest.h:118
TProfile2D * getRefTProfile2D(void) const
TH2D * getTH2D(void) const
double getEntries(void) const
get # of entries
TH2F * getRefTH2F(void) const
double chi2_
Definition: QTest.h:235
Kind kind(void) const
Get the type of the monitor element.
TH2D * getRefTH2D(void) const
TObject * getRootObject(void) const
TH2S * getRefTH2S(void) const
static std::string getAlgoName(void)
Definition: QTest.h:219
unsigned minEntries_
Definition: QTest.h:159
TH2F * getTH2F(void) const
TObject * getRefRootObject(void) const
void Comp2Ref2DChi2::setMessage ( void  )
inlineprotectedvirtual

set status & message after test has run

Reimplemented from SimpleTest.

Definition at line 224 of file QTest.h.

References QCriterion::errorProb_, python.rootplot.argparse::message, QCriterion::message_, and QCriterion::warningProb_.

225  {
226  std::ostringstream message;
227  message << "chi2/Ndof = " << chi2_ << "/" << Ndof_
228  << ", minimum needed statistics = " << minEntries_
229  << " warning threshold = " << this->warningProb_
230  << " error threshold = " << this->errorProb_;
231  message_ = message.str();
232  }
float errorProb_
Definition: QTest.h:116
double chi2_
Definition: QTest.h:235
std::string message_
quality test status
Definition: QTest.h:115
unsigned minEntries_
Definition: QTest.h:159
float warningProb_
message attached to test
Definition: QTest.h:116

Member Data Documentation

double Comp2Ref2DChi2::chi2_
protected

Definition at line 235 of file QTest.h.

int Comp2Ref2DChi2::Ndof_
protected

Definition at line 235 of file QTest.h.