CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions
Comp2RefEqualH Class Reference

#include <QTest.h>

Inheritance diagram for Comp2RefEqualH:
SimpleTest QCriterion

Public Member Functions

 Comp2RefEqualH (const std::string &name)
 
float runTest (const MonitorElement *me) override
 
- 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
 (class should be created by DQMStore class) 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 ()
 

Additional Inherited Members

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

Detailed Description

Definition at line 172 of file QTest.h.

Constructor & Destructor Documentation

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

Definition at line 175 of file QTest.h.

References QCriterion::setAlgoName().

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

Member Function Documentation

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

Definition at line 179 of file QTest.h.

References QCriterion::runTest().

Referenced by QTestConfigure::EnableComp2RefEqualHTest(), QTestConfigure::enableTests(), and QTestParameterNames::QTestParameterNames().

179 { return "Comp2RefEqualH"; }
float Comp2RefEqualH::runTest ( const MonitorElement me)
overridevirtual

Reimplemented from QCriterion.

Definition at line 40 of file QTest.cc.

References stringResolutionProvider_cfi::bin, officialStyle::chan, relmon_rootfiles_spy::contents, gather_cfg::cout, MonitorElement::DQM_KIND_TH1D, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH1S, MonitorElement::DQM_KIND_TH2D, MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TH2S, MonitorElement::DQM_KIND_TH3F, MonitorElement::DQM_KIND_TPROFILE, plotBeamSpotDB::first, MonitorElement::getRefRootObject(), MonitorElement::getRefTH1D(), MonitorElement::getRefTH1F(), MonitorElement::getRefTH1S(), MonitorElement::getRefTH2D(), MonitorElement::getRefTH2F(), MonitorElement::getRefTH2S(), MonitorElement::getRefTH3F(), MonitorElement::getRefTProfile(), MonitorElement::getRootObject(), MonitorElement::getTH1D(), MonitorElement::getTH1F(), MonitorElement::getTH1S(), MonitorElement::getTH2D(), MonitorElement::getTH2F(), MonitorElement::getTH2S(), MonitorElement::getTH3F(), MonitorElement::getTProfile(), MonitorElement::kind(), plotBeamSpotDB::last, and pileupCalc::nbins.

41 {
42  badChannels_.clear();
43 
44  if (!me)
45  return -1;
46  if (!me->getRootObject() || !me->getRefRootObject())
47  return -1;
48  TH1* h=nullptr; //initialize histogram pointer
49  TH1* ref_=nullptr;
50 
51  if (verbose_>1)
52  std::cout << "QTest:" << getAlgoName() << "::runTest called on "
53  << me-> getFullname() << "\n";
54 
55  int nbins=0;
56  int nbinsref=0;
57  //-- TH1F
59  {
60  nbins = me->getTH1F()->GetXaxis()->GetNbins();
61  nbinsref = me->getRefTH1F()->GetXaxis()->GetNbins();
62  h = me->getTH1F(); // access Test histo
63  ref_ = me->getRefTH1F(); //access Ref hiso
64  if (nbins != nbinsref) return -1;
65  }
66  //-- TH1S
67  else if (me->kind()==MonitorElement::DQM_KIND_TH1S)
68  {
69  nbins = me->getTH1S()->GetXaxis()->GetNbins();
70  nbinsref = me->getRefTH1S()->GetXaxis()->GetNbins();
71  h = me->getTH1S(); // access Test histo
72  ref_ = me->getRefTH1S(); //access Ref hiso
73  if (nbins != nbinsref) return -1;
74  }
75  //-- TH1D
76  else if (me->kind()==MonitorElement::DQM_KIND_TH1D)
77  {
78  nbins = me->getTH1D()->GetXaxis()->GetNbins();
79  nbinsref = me->getRefTH1D()->GetXaxis()->GetNbins();
80  h = me->getTH1D(); // access Test histo
81  ref_ = me->getRefTH1D(); //access Ref hiso
82  if (nbins != nbinsref) return -1;
83  }
84  //-- TPROFILE
86  {
87  nbins = me->getTProfile()->GetXaxis()->GetNbins();
88  nbinsref = me->getRefTProfile()->GetXaxis()->GetNbins();
89  h = me->getTProfile(); // access Test histo
90  ref_ = me->getRefTProfile(); //access Ref hiso
91  if (nbins != nbinsref) return -1;
92  }
93 
94  //-- TH2
95  else if (me->kind()==MonitorElement::DQM_KIND_TH2F)
96  {
97  nbins = me->getTH2F()->GetXaxis()->GetNbins() *
98  me->getTH2F()->GetYaxis()->GetNbins();
99  nbinsref = me->getRefTH2F()->GetXaxis()->GetNbins() *
100  me->getRefTH2F()->GetYaxis()->GetNbins();
101  h = me->getTH2F(); // access Test histo
102  ref_ = me->getRefTH2F(); //access Ref hiso
103  if (nbins != nbinsref) return -1;
104  }
105 
106  //-- TH2
107  else if (me->kind()==MonitorElement::DQM_KIND_TH2S)
108  {
109  nbins = me->getTH2S()->GetXaxis()->GetNbins() *
110  me->getTH2S()->GetYaxis()->GetNbins();
111  nbinsref = me->getRefTH2S()->GetXaxis()->GetNbins() *
112  me->getRefTH2S()->GetYaxis()->GetNbins();
113  h = me->getTH2S(); // access Test histo
114  ref_ = me->getRefTH2S(); //access Ref hiso
115  if (nbins != nbinsref) return -1;
116  }
117 
118  //-- TH2
119  else if (me->kind()==MonitorElement::DQM_KIND_TH2D)
120  {
121  nbins = me->getTH2D()->GetXaxis()->GetNbins() *
122  me->getTH2D()->GetYaxis()->GetNbins();
123  nbinsref = me->getRefTH2D()->GetXaxis()->GetNbins() *
124  me->getRefTH2D()->GetYaxis()->GetNbins();
125  h = me->getTH2D(); // access Test histo
126  ref_ = me->getRefTH2D(); //access Ref hiso
127  if (nbins != nbinsref) return -1;
128  }
129 
130  //-- TH3
131  else if (me->kind()==MonitorElement::DQM_KIND_TH3F)
132  {
133  nbins = me->getTH3F()->GetXaxis()->GetNbins() *
134  me->getTH3F()->GetYaxis()->GetNbins() *
135  me->getTH3F()->GetZaxis()->GetNbins();
136  nbinsref = me->getRefTH3F()->GetXaxis()->GetNbins() *
137  me->getRefTH3F()->GetYaxis()->GetNbins() *
138  me->getRefTH3F()->GetZaxis()->GetNbins();
139  h = me->getTH3F(); // access Test histo
140  ref_ = me->getRefTH3F(); //access Ref hiso
141  if (nbins != nbinsref) return -1;
142  }
143 
144  else
145  {
146  if (verbose_>0)
147  std::cout << "QTest:Comp2RefEqualH"
148  << " ME does not contain TH1F/TH1S/TH1D/TH2F/TH2S/TH2D/TH3F, exiting\n";
149  return -1;
150  }
151 
152  //-- QUALITY TEST itself
153  int first = 0; // 1 //(use underflow bin)
154  int last = nbins+1; //(use overflow bin)
155  bool failure = false;
156  for (int bin=first;bin<=last;bin++)
157  {
158  double contents = h->GetBinContent(bin);
159  if (contents != ref_->GetBinContent(bin))
160  {
161  failure = true;
162  DQMChannel chan(bin, 0, 0, contents, h->GetBinError(bin));
163  badChannels_.push_back(chan);
164  }
165  }
166  if (failure) return 0;
167  return 1;
168 }
TProfile * getTProfile() const
TH1F * getTH1F() const
TH2S * getTH2S() const
int verbose_
Definition: QTest.h:119
TObject * getRootObject() const
TObject * getRefRootObject() const
TH2S * getRefTH2S() const
TH1F * getRefTH1F() const
TH1S * getRefTH1S() const
TH2D * getTH2D() const
TH3F * getRefTH3F() const
TH2F * getTH2F() const
bin
set the eta bin as selection string.
TH3F * getTH3F() const
std::vector< DQMChannel > badChannels_
Definition: QTest.h:161
TH2D * getRefTH2D() const
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
TH2F * getRefTH2F() const
TH1D * getTH1D() const
TH1D * getRefTH1D() const
TH1S * getTH1S() const
static std::string getAlgoName()
Definition: QTest.h:179
TProfile * getRefTProfile() const
Kind kind() const
Get the type of the monitor element.