CMS 3D CMS Logo

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) override
 
void setThreshold (double ymin)
 set Ymin (inclusive) threshold for "dead" channel (default: 0) More...
 
- Public Member Functions inherited from SimpleTest
std::vector< DQMChannelgetBadChannels () const override
 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 () const
 get algorithm name More...
 
std::string getMessage () const
 get message attached to test More...
 
std::string getName () const
 get name of quality test More...
 
int getStatus () const
 get test status (see Core/interface/DQMDefinitions.h) 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 ()
 

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

- Public Types inherited from QCriterion
typedef dqm::legacy::MonitorElement MonitorElement
 (class should be created by DQMStore class) More...
 
- Protected Member Functions inherited from SimpleTest
void setMessage () override
 set status & message after test has run More...
 
- Protected Member Functions inherited from QCriterion
void init ()
 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 ()=default
 

Detailed Description

test that histogram contents are above Ymin

Definition at line 232 of file QTest.h.

Constructor & Destructor Documentation

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

Definition at line 234 of file QTest.h.

References QCriterion::setAlgoName().

234  : SimpleTest(name, true) {
235  rangeInitialized_ = false;
237  }
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:95
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:158
static std::string getAlgoName()
Definition: QTest.h:238
bool rangeInitialized_
Definition: QTest.h:249

Member Function Documentation

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

loop over all channels

loop over all bins

Reimplemented from QCriterion.

Definition at line 166 of file QTest.cc.

References newFWLiteAna::bin, officialStyle::chan, relmon_rootfiles_spy::contents, gather_cfg::cout, dqmdumpme::first, dqm::impl::MonitorElement::getFullname(), dqm::legacy::MonitorElement::getRootObject(), dqm::legacy::MonitorElement::getTH1D(), dqm::legacy::MonitorElement::getTH1F(), dqm::legacy::MonitorElement::getTH1S(), dqm::legacy::MonitorElement::getTH2D(), dqm::legacy::MonitorElement::getTH2F(), dqm::legacy::MonitorElement::getTH2S(), dqm::impl::MonitorElement::kind(), dqmdumpme::last, MonitorElementData::TH1D, MonitorElementData::TH1F, MonitorElementData::TH1S, MonitorElementData::TH2D, MonitorElementData::TH2F, and MonitorElementData::TH2S.

166  {
167  badChannels_.clear();
168  if (!me)
169  return -1;
170  if (!me->getRootObject())
171  return -1;
172  TH1* h1 = nullptr;
173  TH2* h2 = nullptr; //initialize histogram pointers
174 
175  if (verbose_ > 1)
176  std::cout << "QTest:" << getAlgoName() << "::runTest called on " << me->getFullname() << "\n";
177  //TH1F
178  if (me->kind() == MonitorElement::Kind::TH1F) {
179  h1 = me->getTH1F(); //access Test histo
180  }
181  //TH1S
182  else if (me->kind() == MonitorElement::Kind::TH1S) {
183  h1 = me->getTH1S(); //access Test histo
184  }
185  //TH1D
186  else if (me->kind() == MonitorElement::Kind::TH1D) {
187  h1 = me->getTH1D(); //access Test histo
188  }
189  //-- TH2F
190  else if (me->kind() == MonitorElement::Kind::TH2F) {
191  h2 = me->getTH2F(); // access Test histo
192  }
193  //-- TH2S
194  else if (me->kind() == MonitorElement::Kind::TH2S) {
195  h2 = me->getTH2S(); // access Test histo
196  }
197  //-- TH2D
198  else if (me->kind() == MonitorElement::Kind::TH2D) {
199  h2 = me->getTH2D(); // access Test histo
200  } else {
201  if (verbose_ > 0)
202  std::cout << "QTest:DeadChannel"
203  << " ME " << me->getFullname() << " does not contain TH1F/TH1S/TH1D/TH2F/TH2S/TH2D, exiting\n";
204  return -1;
205  }
206 
207  int fail = 0; // number of failed channels
208 
209  //--------- do the quality test for 1D histo ---------------//
210  if (h1 != nullptr) {
211  if (!rangeInitialized_ || !h1->GetXaxis())
212  return 1; // all bins are accepted if no initialization
213  int ncx = h1->GetXaxis()->GetNbins();
214  int first = 1;
215  int last = ncx;
216  int bin;
217 
219  for (bin = first; bin <= last; ++bin) {
220  double contents = h1->GetBinContent(bin);
221  bool failure = false;
222  failure = contents <= ymin_; // dead channel: equal to or less than ymin_
223  if (failure) {
224  DQMChannel chan(bin, 0, 0, contents, h1->GetBinError(bin));
225  badChannels_.push_back(chan);
226  ++fail;
227  }
228  }
229  //return fraction of alive channels
230  return 1. * (ncx - fail) / ncx;
231  }
232  //----------------------------------------------------------//
233 
234  //--------- do the quality test for 2D -------------------//
235  else if (h2 != nullptr) {
236  int ncx = h2->GetXaxis()->GetNbins(); // get X bins
237  int ncy = h2->GetYaxis()->GetNbins(); // get Y bins
238 
240  for (int cx = 1; cx <= ncx; ++cx) {
241  for (int cy = 1; cy <= ncy; ++cy) {
242  double contents = h2->GetBinContent(h2->GetBin(cx, cy));
243  bool failure = false;
244  failure = contents <= ymin_; // dead channel: equal to or less than ymin_
245  if (failure) {
246  DQMChannel chan(cx, cy, 0, contents, h2->GetBinError(h2->GetBin(cx, cy)));
247  badChannels_.push_back(chan);
248  ++fail;
249  }
250  }
251  }
252  //return fraction of alive channels
253  return 1. * (ncx * ncy - fail) / (ncx * ncy);
254  } else {
255  if (verbose_ > 0)
256  std::cout << "QTest:DeadChannel"
257  << " TH1/TH2F are NULL, exiting\n";
258  return -1;
259  }
260 }
virtual TH2D * getTH2D() const
virtual TH2F * getTH2F() const
double ymin_
ymin - threshold
Definition: QTest.h:248
int verbose_
Definition: QTest.h:138
virtual TH1F * getTH1F() const
Kind kind() const
Get the type of the monitor element.
virtual TH1S * getTH1S() const
const std::string getFullname() const
get full name of ME including Pathname
virtual TH2S * getTH2S() const
virtual TH1D * getTH1D() const
std::vector< DQMChannel > badChannels_
Definition: QTest.h:173
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
static std::string getAlgoName()
Definition: QTest.h:238
TObject * getRootObject() const override
bool rangeInitialized_
Definition: QTest.h:249
void DeadChannel::setThreshold ( double  ymin)
inline

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

Definition at line 242 of file QTest.h.

References L1TOccupancyClient_cfi::ymin.

Referenced by QTestConfigure::EnableDeadChannelTest().

242  {
243  ymin_ = ymin;
244  rangeInitialized_ = true;
245  }
double ymin_
ymin - threshold
Definition: QTest.h:248
bool rangeInitialized_
Definition: QTest.h:249

Member Data Documentation

bool DeadChannel::rangeInitialized_
protected

Definition at line 249 of file QTest.h.

double DeadChannel::ymin_
protected

ymin - threshold

Definition at line 248 of file QTest.h.