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 173 of file QTest.h.

Constructor & Destructor Documentation

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

Definition at line 176 of file QTest.h.

References QCriterion::setAlgoName().

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

Member Function Documentation

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

Definition at line 180 of file QTest.h.

References QCriterion::runTest().

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

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

Reimplemented from QCriterion.

Definition at line 41 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.

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