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 More...
 
void init ()
 initialize values More...
 
 QCriterion (std::string qtname)
 
float runTest (const MonitorElement *me, QReport &qr, DQMNet::QValue &qv)
 
void setErrorProb (float prob)
 
void setWarningProb (float prob)
 set probability limit for warning and error (default: 90% and 50%) More...
 
virtual ~QCriterion ()=default
 

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...
 
- Static Public Attributes inherited from QCriterion
static const float ERROR_PROB_THRESHOLD = 0.50
 
static const float WARNING_PROB_THRESHOLD = 0.90
 default "probability" values for setting warnings & errors when running tests 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 setAlgoName (std::string name)
 set algorithm name More...
 
void setVerbose (int verbose)
 probability limits for warnings, errors More...
 

Detailed Description

test that histogram contents are above Ymin

Definition at line 198 of file QTest.h.

Constructor & Destructor Documentation

◆ DeadChannel()

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

Definition at line 200 of file QTest.h.

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

200  : SimpleTest(name, true) {
201  rangeInitialized_ = false;
203  }
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:96
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:124
static std::string getAlgoName()
Definition: QTest.h:204
bool rangeInitialized_
Definition: QTest.h:215

Member Function Documentation

◆ getAlgoName()

static std::string DeadChannel::getAlgoName ( )
inlinestatic

Definition at line 204 of file QTest.h.

Referenced by DeadChannel(), and QualityTester::makeQCriterion().

204 { return "DeadChannel"; }

◆ runTest()

float DeadChannel::runTest ( const MonitorElement me)
overridevirtual

loop over all channels

loop over all bins

Reimplemented from QCriterion.

Definition at line 162 of file QTest.cc.

References newFWLiteAna::bin, officialStyle::chan, relmon_rootfiles_spy::contents, gather_cfg::cout, first, dqmdumpme::last, hlt_dqm_clientPB-live_cfg::me, MonitorElementData::TH1D, MonitorElementData::TH1F, MonitorElementData::TH1S, MonitorElementData::TH2D, MonitorElementData::TH2F, and MonitorElementData::TH2S.

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

◆ setThreshold()

void DeadChannel::setThreshold ( double  ymin)
inline

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

Definition at line 208 of file QTest.h.

References rangeInitialized_, L1TOccupancyClient_cfi::ymin, and ymin_.

208  {
209  ymin_ = ymin;
210  rangeInitialized_ = true;
211  }
double ymin_
ymin - threshold
Definition: QTest.h:214
bool rangeInitialized_
Definition: QTest.h:215

Member Data Documentation

◆ rangeInitialized_

bool DeadChannel::rangeInitialized_
protected

Definition at line 215 of file QTest.h.

Referenced by DeadChannel(), and setThreshold().

◆ ymin_

double DeadChannel::ymin_
protected

ymin - threshold

Definition at line 214 of file QTest.h.

Referenced by setThreshold().