CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes

CompareLastFilledBin Class Reference

#include <QTest.h>

Inheritance diagram for CompareLastFilledBin:
SimpleTest QCriterion

List of all members.

Public Member Functions

 CompareLastFilledBin (const std::string &name)
float runTest (const MonitorElement *me)
void setAverage (float average)
void setMax (float max)
void setMin (float min)
 ~CompareLastFilledBin ()

Static Public Member Functions

static std::string getAlgoName (void)

Protected Member Functions

void setMessage (void)
 set status & message after test has run

Private Attributes

float _average
float _max
float _min

Detailed Description

Definition at line 646 of file QTest.h.


Constructor & Destructor Documentation

CompareLastFilledBin::CompareLastFilledBin ( const std::string &  name) [inline]

Definition at line 650 of file QTest.h.

References _average, _max, _min, getAlgoName(), and QCriterion::setAlgoName().

                                              : SimpleTest(name,true){
    this->_min = 0.0;
    this->_max = 1.0;
    this->_average = 0.0;
    setAlgoName( getAlgoName() );
  };
CompareLastFilledBin::~CompareLastFilledBin ( ) [inline]

Definition at line 657 of file QTest.h.

{};

Member Function Documentation

static std::string CompareLastFilledBin::getAlgoName ( void  ) [inline, static]
float CompareLastFilledBin::runTest ( const MonitorElement me) [virtual]

Reimplemented from QCriterion.

Definition at line 1395 of file QTest.cc.

References gather_cfg::cout, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH2F, MonitorElement::getRootObject(), MonitorElement::getTH1F(), MonitorElement::getTH2F(), MonitorElement::kind(), and NULL.

                                                           {
  if (!me)
    return -1;
  if (!me->getRootObject())
    return -1;
  TH1* h1=0;
  TH2* h2=0;
  if (verbose_>1){
    std::cout << "QTest:" << getAlgoName() << "::runTest called on "
              << me-> getFullname() << "\n";
    std::cout << "\tMin = " << _min << "; Max = " << _max << "\n";
  }
  if (me->kind()==MonitorElement::DQM_KIND_TH1F)
    {
      h1  = me->getTH1F(); // access Test histo
    }
  else if (me->kind()==MonitorElement::DQM_KIND_TH2F)
    {
      h2  = me->getTH2F(); // access Test histo
    }
  else
    {
      if (verbose_>0) 
        std::cout << "QTest:ContentsWithinExpected" 
         << " ME does not contain TH1F or TH2F, exiting\n"; 
      return -1;
    }
  int lastBinX = 0;
  int lastBinY = 0;
  float lastBinVal; 

  //--------- do the quality test for 1D histo ---------------// 
  if (h1 != NULL) 
  { 
    lastBinX = h1->FindLastBinAbove(_average,1);
    lastBinVal = h1->GetBinContent(lastBinX);
    if (h1->GetEntries() == 0 || lastBinVal < 0) return 1;
  } 
  else if (h2 != NULL) 
  {   
    
    lastBinX = h2->FindLastBinAbove(_average,1);
    lastBinY = h2->FindLastBinAbove(_average,2);
    if ( h2->GetEntries() == 0 || lastBinX < 0 || lastBinY < 0 )  return 1;
    lastBinVal = h2->GetBinContent(h2->GetBin(lastBinX,lastBinY));
  } else {
    if (verbose_ > 0) std::cout << "QTest:"<< getAlgoName() << " Histogram does not exist" << std::endl;
    return 1;
  } 
  if (verbose_ > 0) std::cout << "Min and Max values " << _min << " " << _max << " Av value " << _average << " lastBinX " << lastBinX<<  " lastBinY " << lastBinY <<  " lastBinVal " << lastBinVal << std::endl;
  if (lastBinVal > _min && lastBinVal <= _max)
    return 1;
  else
    return 0;
} 
void CompareLastFilledBin::setAverage ( float  average) [inline]

Definition at line 662 of file QTest.h.

References _average, and PDRates::average.

Referenced by QTestConfigure::EnableCompareLastFilledBinTest().

void CompareLastFilledBin::setMax ( float  max) [inline]

Definition at line 664 of file QTest.h.

References _max, and max().

Referenced by QTestConfigure::EnableCompareLastFilledBinTest().

{_max = max;};
void CompareLastFilledBin::setMessage ( void  ) [inline, protected, virtual]

set status & message after test has run

Reimplemented from SimpleTest.

Definition at line 668 of file QTest.h.

References QCriterion::algoName_, python::rootplot::argparse::message, QCriterion::message_, QCriterion::prob_, and QCriterion::qtname_.

                       {
    std::ostringstream message;
    message << "Test " << qtname_ << " (" << algoName_
            << "): Last Bin filled with desired value = " << prob_;
    message_ = message.str();
  }
void CompareLastFilledBin::setMin ( float  min) [inline]

Definition at line 663 of file QTest.h.

References _min, and min.

Referenced by QTestConfigure::EnableCompareLastFilledBinTest().

{_min = min;};

Member Data Documentation

Definition at line 677 of file QTest.h.

Referenced by CompareLastFilledBin(), and setAverage().

float CompareLastFilledBin::_max [private]

Definition at line 676 of file QTest.h.

Referenced by CompareLastFilledBin(), and setMax().

float CompareLastFilledBin::_min [private]

Definition at line 676 of file QTest.h.

Referenced by CompareLastFilledBin(), and setMin().