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) override
 
virtual void setAllowedYRange (double ymin, double ymax)
 
void setUseEmptyBins (unsigned int useEmptyBins)
 
- 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_
 
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

- 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

Definition at line 173 of file QTest.h.

Constructor & Destructor Documentation

◆ ContentsYRange()

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

Definition at line 175 of file QTest.h.

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

175  : SimpleTest(name, true) {
176  rangeInitialized_ = false;
178  }
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:96
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:124
bool rangeInitialized_
Definition: QTest.h:192
static std::string getAlgoName()
Definition: QTest.h:179

Member Function Documentation

◆ getAlgoName()

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

Definition at line 179 of file QTest.h.

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

179 { return "ContentsYRange"; }

◆ runTest()

float ContentsYRange::runTest ( const MonitorElement me)
overridevirtual

Standard test !

AS quality test !!!

end of AS quality tests

Reimplemented from QCriterion.

Definition at line 94 of file QTest.cc.

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

94  {
95  badChannels_.clear();
96 
97  if (!me)
98  return -1;
99  if (!me->getRootObject())
100  return -1;
101  TH1* h = nullptr;
102 
103  if (verbose_ > 1)
104  std::cout << "QTest:" << getAlgoName() << "::runTest called on " << me->getFullname() << "\n";
105 
106  if (me->kind() == MonitorElement::Kind::TH1F) {
107  h = me->getTH1F(); //access Test histo
108  } else if (me->kind() == MonitorElement::Kind::TH1S) {
109  h = me->getTH1S(); //access Test histo
110  } else if (me->kind() == MonitorElement::Kind::TH1D) {
111  h = me->getTH1D(); //access Test histo
112  } else {
113  if (verbose_ > 0)
114  std::cout << "QTest:ContentsYRange"
115  << " ME " << me->getFullname() << " does not contain TH1F/TH1S/TH1D, exiting\n";
116  return -1;
117  }
118 
119  if (!rangeInitialized_ || !h->GetXaxis())
120  return 1; // all bins are accepted if no initialization
121  int ncx = h->GetXaxis()->GetNbins();
122  // do NOT use underflow bin
123  int first = 1;
124  // do NOT use overflow bin
125  int last = ncx;
126  // bins outside Y-range
127  int fail = 0;
128  int bin;
129 
130  if (useEmptyBins_)
131  {
132  for (bin = first; bin <= last; ++bin) {
133  double contents = h->GetBinContent(bin);
134  bool failure = false;
135  failure = (contents < ymin_ || contents > ymax_); // allowed y-range: [ymin_, ymax_]
136  if (failure) {
137  DQMChannel chan(bin, 0, 0, contents, h->GetBinError(bin));
138  badChannels_.push_back(chan);
139  ++fail;
140  }
141  }
142  // return fraction of bins that passed test
143  return 1. * (ncx - fail) / ncx;
144  } else
145  {
146  for (bin = first; bin <= last; ++bin) {
147  double contents = h->GetBinContent(bin);
148  bool failure = false;
149  if (contents)
150  failure = (contents < ymin_ || contents > ymax_); // allowed y-range: [ymin_, ymax_]
151  if (failure)
152  ++fail;
153  }
154  // return fraction of bins that passed test
155  return 1. * (ncx - fail) / ncx;
156  }
157 }
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...
bool rangeInitialized_
Definition: QTest.h:192
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
unsigned int useEmptyBins_
Definition: QTest.h:193
double ymax_
Definition: QTest.h:191
static std::string getAlgoName()
Definition: QTest.h:179

◆ setAllowedYRange()

virtual void ContentsYRange::setAllowedYRange ( double  ymin,
double  ymax 
)
inlinevirtual

◆ setUseEmptyBins()

void ContentsYRange::setUseEmptyBins ( unsigned int  useEmptyBins)
inline

Definition at line 182 of file QTest.h.

References useEmptyBins_.

182 { useEmptyBins_ = useEmptyBins; }
unsigned int useEmptyBins_
Definition: QTest.h:193

Member Data Documentation

◆ rangeInitialized_

bool ContentsYRange::rangeInitialized_
protected

Definition at line 192 of file QTest.h.

Referenced by ContentsYRange(), and setAllowedYRange().

◆ useEmptyBins_

unsigned int ContentsYRange::useEmptyBins_
protected

Definition at line 193 of file QTest.h.

Referenced by setUseEmptyBins().

◆ ymax_

double ContentsYRange::ymax_
protected

Definition at line 191 of file QTest.h.

Referenced by setAllowedYRange().

◆ ymin_

double ContentsYRange::ymin_
protected

Definition at line 190 of file QTest.h.

Referenced by setAllowedYRange().