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
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 (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_
 
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...
 
- 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

Definition at line 207 of file QTest.h.

Constructor & Destructor Documentation

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

Definition at line 209 of file QTest.h.

References QCriterion::setAlgoName().

209  : SimpleTest(name, true) {
210  rangeInitialized_ = false;
212  }
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:95
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:158
bool rangeInitialized_
Definition: QTest.h:226
static std::string getAlgoName()
Definition: QTest.h:213

Member Function Documentation

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

Standard test !

AS quality test !!!

end of AS quality tests

Reimplemented from QCriterion.

Definition at line 98 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(), h, dqm::impl::MonitorElement::kind(), dqmdumpme::last, MonitorElementData::TH1D, MonitorElementData::TH1F, and MonitorElementData::TH1S.

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

Definition at line 217 of file QTest.h.

References L1TOccupancyClient_cfi::ymax, and L1TOccupancyClient_cfi::ymin.

Referenced by QTestConfigure::EnableYRangeTest().

217  {
218  ymin_ = ymin;
219  ymax_ = ymax;
220  rangeInitialized_ = true;
221  }
double ymin_
Definition: QTest.h:224
bool rangeInitialized_
Definition: QTest.h:226
double ymax_
Definition: QTest.h:225
void ContentsYRange::setUseEmptyBins ( unsigned int  useEmptyBins)
inline

Definition at line 216 of file QTest.h.

Referenced by QTestConfigure::EnableYRangeTest().

216 { useEmptyBins_ = useEmptyBins; }
unsigned int useEmptyBins_
Definition: QTest.h:227

Member Data Documentation

bool ContentsYRange::rangeInitialized_
protected

Definition at line 226 of file QTest.h.

unsigned int ContentsYRange::useEmptyBins_
protected

Definition at line 227 of file QTest.h.

double ContentsYRange::ymax_
protected

Definition at line 225 of file QTest.h.

double ContentsYRange::ymin_
protected

Definition at line 224 of file QTest.h.