CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes
DeadChannel Class Reference

test that histogram contents are above Ymin More...

#include <QTest.h>

Inheritance diagram for DeadChannel:
SimpleTest QCriterion

Public Member Functions

 DeadChannel (const std::string &name)
 
float runTest (const MonitorElement *me)
 
void setThreshold (double ymin)
 set Ymin (inclusive) threshold for "dead" channel (default: 0) More...
 
- 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_
 
double ymin_
 ymin - threshold More...
 
- 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

test that histogram contents are above Ymin

Definition at line 277 of file QTest.h.

Constructor & Destructor Documentation

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

Definition at line 280 of file QTest.h.

References getAlgoName(), rangeInitialized_, and QCriterion::setAlgoName().

280  : SimpleTest(name,true)
281  {
282  rangeInitialized_ = false;
284  }
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:77
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:137
static std::string getAlgoName(void)
Definition: QTest.h:285
bool rangeInitialized_
Definition: QTest.h:297

Member Function Documentation

static std::string DeadChannel::getAlgoName ( void  )
inlinestatic
float DeadChannel::runTest ( const MonitorElement me)
virtual

loop over all channels

loop over all bins

Reimplemented from QCriterion.

Definition at line 626 of file QTest.cc.

References newFWLiteAna::bin, relmon_rootfiles_spy::contents, gather_cfg::cout, MonitorElement::DQM_KIND_TH1D, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH1S, MonitorElement::DQM_KIND_TH2D, MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TH2S, cmsPerfPublish::fail(), plotBeamSpotDB::first, MonitorElement::getFullname(), MonitorElement::getRootObject(), MonitorElement::getTH1D(), MonitorElement::getTH1F(), MonitorElement::getTH1S(), MonitorElement::getTH2D(), MonitorElement::getTH2F(), MonitorElement::getTH2S(), MonitorElement::kind(), prof2calltree::last, and NULL.

627 {
628  badChannels_.clear();
629  if (!me)
630  return -1;
631  if (!me->getRootObject())
632  return -1;
633  TH1* h1=0;
634  TH2* h2=0;//initialize histogram pointers
635 
636  if (verbose_>1)
637  std::cout << "QTest:" << getAlgoName() << "::runTest called on "
638  << me-> getFullname() << "\n";
639  //TH1F
641  {
642  h1 = me->getTH1F(); //access Test histo
643  }
644  //TH1S
645  else if (me->kind()==MonitorElement::DQM_KIND_TH1S)
646  {
647  h1 = me->getTH1S(); //access Test histo
648  }
649  //TH1D
650  else if (me->kind()==MonitorElement::DQM_KIND_TH1D)
651  {
652  h1 = me->getTH1D(); //access Test histo
653  }
654  //-- TH2F
655  else if (me->kind()==MonitorElement::DQM_KIND_TH2F)
656  {
657  h2 = me->getTH2F(); // access Test histo
658  }
659  //-- TH2S
660  else if (me->kind()==MonitorElement::DQM_KIND_TH2S)
661  {
662  h2 = me->getTH2S(); // access Test histo
663  }
664  //-- TH2D
665  else if (me->kind()==MonitorElement::DQM_KIND_TH2D)
666  {
667  h2 = me->getTH2D(); // access Test histo
668  }
669  else
670  {
671  if (verbose_>0)
672  std::cout << "QTest:DeadChannel"
673  << " ME " << me->getFullname()
674  << " does not contain TH1F/TH1S/TH1D/TH2F/TH2S/TH2D, exiting\n";
675  return -1;
676  }
677 
678  int fail = 0; // number of failed channels
679 
680  //--------- do the quality test for 1D histo ---------------//
681  if (h1 != NULL)
682  {
683  if (!rangeInitialized_ || !h1->GetXaxis() )
684  return 1; // all bins are accepted if no initialization
685  int ncx = h1->GetXaxis()->GetNbins();
686  int first = 1;
687  int last = ncx;
688  int bin;
689 
691  for (bin = first; bin <= last; ++bin)
692  {
693  double contents = h1->GetBinContent(bin);
694  bool failure = false;
695  failure = contents <= ymin_; // dead channel: equal to or less than ymin_
696  if (failure)
697  {
698  DQMChannel chan(bin, 0, 0, contents, h1->GetBinError(bin));
699  badChannels_.push_back(chan);
700  ++fail;
701  }
702  }
703  //return fraction of alive channels
704  return 1.*(ncx - fail)/ncx;
705  }
706  //----------------------------------------------------------//
707 
708  //--------- do the quality test for 2D -------------------//
709  else if (h2 !=NULL )
710  {
711  int ncx = h2->GetXaxis()->GetNbins(); // get X bins
712  int ncy = h2->GetYaxis()->GetNbins(); // get Y bins
713 
715  for (int cx = 1; cx <= ncx; ++cx)
716  {
717  for (int cy = 1; cy <= ncy; ++cy)
718  {
719  double contents = h2->GetBinContent(h2->GetBin(cx, cy));
720  bool failure = false;
721  failure = contents <= ymin_; // dead channel: equal to or less than ymin_
722  if (failure)
723  {
724  DQMChannel chan(cx, cy, 0, contents, h2->GetBinError(h2->GetBin(cx, cy)));
725  badChannels_.push_back(chan);
726  ++fail;
727  }
728  }
729  }
730  //return fraction of alive channels
731  return 1.*(ncx*ncy - fail) / (ncx*ncy);
732  }
733  else
734  {
735  if (verbose_>0)
736  std::cout << "QTest:DeadChannel"
737  << " TH1/TH2F are NULL, exiting\n";
738  return -1;
739  }
740 }
TH2S * getTH2S(void) const
TH1S * getTH1S(void) const
double ymin_
ymin - threshold
Definition: QTest.h:296
int verbose_
Definition: QTest.h:117
TH1D * getTH1D(void) const
#define NULL
Definition: scimark2.h:8
TH2D * getTH2D(void) const
static std::string getAlgoName(void)
Definition: QTest.h:285
Kind kind(void) const
Get the type of the monitor element.
const std::string getFullname(void) const
get full name of ME including Pathname
TObject * getRootObject(void) const
TH1F * getTH1F(void) const
std::vector< DQMChannel > badChannels_
Definition: QTest.h:159
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
bool rangeInitialized_
Definition: QTest.h:297
void DeadChannel::setThreshold ( double  ymin)
inline

set Ymin (inclusive) threshold for "dead" channel (default: 0)

Definition at line 289 of file QTest.h.

References rangeInitialized_, SiStripMonitorClusterAlca_cfi::ymin, and ymin_.

Referenced by QTestConfigure::EnableDeadChannelTest().

290  {
291  ymin_ = ymin;
292  rangeInitialized_ = true;
293  }
double ymin_
ymin - threshold
Definition: QTest.h:296
bool rangeInitialized_
Definition: QTest.h:297

Member Data Documentation

bool DeadChannel::rangeInitialized_
protected

Definition at line 297 of file QTest.h.

Referenced by DeadChannel(), and setThreshold().

double DeadChannel::ymin_
protected

ymin - threshold

Definition at line 296 of file QTest.h.

Referenced by setThreshold().