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.

175  : SimpleTest(name, true) {
176  rangeInitialized_ = false;
178  }

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

Member Function Documentation

◆ getAlgoName()

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

Definition at line 179 of file QTest.h.

179 { return "ContentsYRange"; }

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

◆ 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.

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 }

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, and MonitorElementData::TH1S.

◆ setAllowedYRange()

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

Definition at line 183 of file QTest.h.

183  {
184  ymin_ = ymin;
185  ymax_ = ymax;
186  rangeInitialized_ = true;
187  }

References rangeInitialized_, L1TOccupancyClient_cfi::ymax, ymax_, L1TOccupancyClient_cfi::ymin, and ymin_.

◆ setUseEmptyBins()

void ContentsYRange::setUseEmptyBins ( unsigned int  useEmptyBins)
inline

Definition at line 182 of file QTest.h.

182 { useEmptyBins_ = useEmptyBins; }

References useEmptyBins_.

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

MonitorElementData::Kind::TH1S
MonitorElementData::Kind::TH1F
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ContentsYRange::rangeInitialized_
bool rangeInitialized_
Definition: QTest.h:192
relmon_rootfiles_spy.contents
contents
Definition: relmon_rootfiles_spy.py:129
SimpleTest::SimpleTest
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:124
dqmdumpme.last
last
Definition: dqmdumpme.py:56
h
L1TOccupancyClient_cfi.ymax
ymax
Definition: L1TOccupancyClient_cfi.py:43
ContentsYRange::getAlgoName
static std::string getAlgoName()
Definition: QTest.h:179
QCriterion::verbose_
int verbose_
Definition: QTest.h:110
QCriterion::setAlgoName
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:96
ContentsYRange::ymax_
double ymax_
Definition: QTest.h:191
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
ContentsYRange::useEmptyBins_
unsigned int useEmptyBins_
Definition: QTest.h:193
MonitorElementData::Kind::TH1D
SimpleTest::badChannels_
std::vector< DQMChannel > badChannels_
Definition: QTest.h:139
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
L1TOccupancyClient_cfi.ymin
ymin
Definition: L1TOccupancyClient_cfi.py:43
MonitorElementData::QReport::DQMChannel
Definition: MonitorElementCollection.h:64
officialStyle.chan
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi....
Definition: officialStyle.py:106
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
ContentsYRange::ymin_
double ymin_
Definition: QTest.h:190