CMS 3D CMS Logo

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

#include <QTest.h>

Inheritance diagram for ContentsYRange:
SimpleTest QCriterion

Public Member Functions

 ContentsYRange (const std::string &name)
 
float runTest (const MonitorElement *me)
 
virtual void setAllowedYRange (double ymin, double ymax)
 
void setUseEmptyBins (unsigned int useEmptyBins)
 
- 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 Attributes

bool rangeInitialized_
 
unsigned int useEmptyBins_
 
double ymax_
 
double ymin_
 
- 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...
 

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)
 

Detailed Description

Definition at line 279 of file QTest.h.

Constructor & Destructor Documentation

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

Definition at line 282 of file QTest.h.

References QCriterion::setAlgoName().

282  : SimpleTest(name,true)
283  {
284  rangeInitialized_ = false;
286  }
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:287
bool rangeInitialized_
Definition: QTest.h:299

Member Function Documentation

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

Definition at line 287 of file QTest.h.

References QCriterion::runTest().

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

287 { return "ContentsYRange"; }
float ContentsYRange::runTest ( const MonitorElement me)
virtual

Standard test !

AS quality test !!!

end of AS quality tests

Reimplemented from QCriterion.

Definition at line 648 of file QTest.cc.

References stringResolutionProvider_cfi::bin, officialStyle::chan, relmon_rootfiles_spy::contents, gather_cfg::cout, MonitorElement::DQM_KIND_TH1D, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH1S, cmsPerfPublish::fail(), plotBeamSpotDB::first, MonitorElement::getFullname(), MonitorElement::getRootObject(), MonitorElement::getTH1D(), MonitorElement::getTH1F(), MonitorElement::getTH1S(), MonitorElement::kind(), and plotBeamSpotDB::last.

649 {
650  badChannels_.clear();
651 
652  if (!me)
653  return -1;
654  if (!me->getRootObject())
655  return -1;
656  TH1* h=0;
657 
658  if (verbose_>1)
659  std::cout << "QTest:" << getAlgoName() << "::runTest called on "
660  << me-> getFullname() << "\n";
661 
663  {
664  h = me->getTH1F(); //access Test histo
665  }
666  else if (me->kind()==MonitorElement::DQM_KIND_TH1S)
667  {
668  h = me->getTH1S(); //access Test histo
669  }
670  else if (me->kind()==MonitorElement::DQM_KIND_TH1D)
671  {
672  h = me->getTH1D(); //access Test histo
673  }
674  else
675  {
676  if (verbose_>0)
677  std::cout << "QTest:ContentsYRange"
678  << " ME " << me->getFullname()
679  << " does not contain TH1F/TH1S/TH1D, exiting\n";
680  return -1;
681  }
682 
683  if (!rangeInitialized_ || !h->GetXaxis()) return 1; // all bins are accepted if no initialization
684  int ncx = h->GetXaxis()->GetNbins();
685  // do NOT use underflow bin
686  int first = 1;
687  // do NOT use overflow bin
688  int last = ncx;
689  // bins outside Y-range
690  int fail = 0;
691  int bin;
692 
693  if (useEmptyBins_)
694  {
695  for (bin = first; bin <= last; ++bin)
696  {
697  double contents = h->GetBinContent(bin);
698  bool failure = false;
699  failure = (contents < ymin_ || contents > ymax_); // allowed y-range: [ymin_, ymax_]
700  if (failure)
701  {
702  DQMChannel chan(bin, 0, 0, contents, h->GetBinError(bin));
703  badChannels_.push_back(chan);
704  ++fail;
705  }
706  }
707  // return fraction of bins that passed test
708  return 1.*(ncx - fail)/ncx;
709  }
710  else
711  {
712  for (bin = first; bin <= last; ++bin)
713  {
714  double contents = h->GetBinContent(bin);
715  bool failure = false;
716  if (contents) failure = (contents < ymin_ || contents > ymax_); // allowed y-range: [ymin_, ymax_]
717  if (failure) ++fail;
718  }
719  // return fraction of bins that passed test
720  return 1.*(ncx - fail)/ncx;
721  }
722 }
TH1S * getTH1S(void) const
int verbose_
Definition: QTest.h:118
TH1D * getTH1D(void) const
Kind kind(void) const
Get the type of the monitor element.
static std::string getAlgoName(void)
Definition: QTest.h:287
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
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
bool rangeInitialized_
Definition: QTest.h:299
def fail(errstr="")
unsigned int useEmptyBins_
Definition: QTest.h:300
double ymax_
Definition: QTest.h:298
virtual void ContentsYRange::setAllowedYRange ( double  ymin,
double  ymax 
)
inlinevirtual
void ContentsYRange::setUseEmptyBins ( unsigned int  useEmptyBins)
inline

Definition at line 290 of file QTest.h.

Referenced by QTestConfigure::EnableYRangeTest().

290 { useEmptyBins_ = useEmptyBins; }
unsigned int useEmptyBins_
Definition: QTest.h:300

Member Data Documentation

bool ContentsYRange::rangeInitialized_
protected

Definition at line 299 of file QTest.h.

unsigned int ContentsYRange::useEmptyBins_
protected

Definition at line 300 of file QTest.h.

double ContentsYRange::ymax_
protected

Definition at line 298 of file QTest.h.

double ContentsYRange::ymin_
protected

Definition at line 298 of file QTest.h.