test
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
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)
 
- Public Member Functions inherited from SimpleTest
virtual std::vector< DQMChannelgetBadChannels (void) const
 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 (void) const
 get algorithm name More...
 
std::string getMessage (void) const
 get message attached to test More...
 
std::string getName (void) const
 get name of quality test More...
 
int getStatus (void) 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 (void)
 

Additional Inherited Members

- Protected Member Functions inherited from SimpleTest
virtual void setMessage (void)
 set status & message after test has run More...
 
- Protected Member Functions inherited from QCriterion
void init (void)
 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 (void)
 
- 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 170 of file QTest.h.

Constructor & Destructor Documentation

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

Definition at line 173 of file QTest.h.

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

173  : SimpleTest(name,true)
174  {
175  setAlgoName( getAlgoName() );
176  }
void setAlgoName(std::string name)
set algorithm name
Definition: QTest.h:77
SimpleTest(const std::string &name, bool keepBadChannels=false)
Definition: QTest.h:137
static std::string getAlgoName(void)
Definition: QTest.h:177

Member Function Documentation

static std::string Comp2RefEqualH::getAlgoName ( void  )
inlinestatic
float Comp2RefEqualH::runTest ( const MonitorElement me)
virtual

Reimplemented from QCriterion.

Definition at line 40 of file QTest.cc.

References newFWLiteAna::bin, 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, first, MonitorElement::getRefRootObject(), MonitorElement::getRefTH1D(), MonitorElement::getRefTH1F(), MonitorElement::getRefTH1S(), MonitorElement::getRefTH2D(), MonitorElement::getRefTH2F(), MonitorElement::getRefTH2S(), MonitorElement::getRefTH3F(), MonitorElement::getRootObject(), MonitorElement::getTH1D(), MonitorElement::getTH1F(), MonitorElement::getTH1S(), MonitorElement::getTH2D(), MonitorElement::getTH2F(), MonitorElement::getTH2S(), MonitorElement::getTH3F(), h, MonitorElement::kind(), prof2calltree::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=0; //initialize histogram pointer
49  TH1* ref_=0;
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  //-- TH2
85  else if (me->kind()==MonitorElement::DQM_KIND_TH2F)
86  {
87  nbins = me->getTH2F()->GetXaxis()->GetNbins() *
88  me->getTH2F()->GetYaxis()->GetNbins();
89  nbinsref = me->getRefTH2F()->GetXaxis()->GetNbins() *
90  me->getRefTH2F()->GetYaxis()->GetNbins();
91  h = me->getTH2F(); // access Test histo
92  ref_ = me->getRefTH2F(); //access Ref hiso
93  if (nbins != nbinsref) return -1;
94  }
95 
96  //-- TH2
97  else if (me->kind()==MonitorElement::DQM_KIND_TH2S)
98  {
99  nbins = me->getTH2S()->GetXaxis()->GetNbins() *
100  me->getTH2S()->GetYaxis()->GetNbins();
101  nbinsref = me->getRefTH2S()->GetXaxis()->GetNbins() *
102  me->getRefTH2S()->GetYaxis()->GetNbins();
103  h = me->getTH2S(); // access Test histo
104  ref_ = me->getRefTH2S(); //access Ref hiso
105  if (nbins != nbinsref) return -1;
106  }
107 
108  //-- TH2
109  else if (me->kind()==MonitorElement::DQM_KIND_TH2D)
110  {
111  nbins = me->getTH2D()->GetXaxis()->GetNbins() *
112  me->getTH2D()->GetYaxis()->GetNbins();
113  nbinsref = me->getRefTH2D()->GetXaxis()->GetNbins() *
114  me->getRefTH2D()->GetYaxis()->GetNbins();
115  h = me->getTH2D(); // access Test histo
116  ref_ = me->getRefTH2D(); //access Ref hiso
117  if (nbins != nbinsref) return -1;
118  }
119 
120  //-- TH3
121  else if (me->kind()==MonitorElement::DQM_KIND_TH3F)
122  {
123  nbins = me->getTH3F()->GetXaxis()->GetNbins() *
124  me->getTH3F()->GetYaxis()->GetNbins() *
125  me->getTH3F()->GetZaxis()->GetNbins();
126  nbinsref = me->getRefTH3F()->GetXaxis()->GetNbins() *
127  me->getRefTH3F()->GetYaxis()->GetNbins() *
128  me->getRefTH3F()->GetZaxis()->GetNbins();
129  h = me->getTH3F(); // access Test histo
130  ref_ = me->getRefTH3F(); //access Ref hiso
131  if (nbins != nbinsref) return -1;
132  }
133 
134  else
135  {
136  if (verbose_>0)
137  std::cout << "QTest:Comp2RefEqualH"
138  << " ME does not contain TH1F/TH1S/TH1D/TH2F/TH2S/TH2D/TH3F, exiting\n";
139  return -1;
140  }
141 
142  //-- QUALITY TEST itself
143  int first = 0; // 1 //(use underflow bin)
144  int last = nbins+1; //(use overflow bin)
145  bool failure = false;
146  for (int bin=first;bin<=last;bin++)
147  {
148  double contents = h->GetBinContent(bin);
149  if (contents != ref_->GetBinContent(bin))
150  {
151  failure = true;
152  DQMChannel chan(bin, 0, 0, contents, h->GetBinError(bin));
153  badChannels_.push_back(chan);
154  }
155  }
156  if (failure) return 0;
157  return 1;
158 }
TH1F * getRefTH1F(void) const
TH2S * getTH2S(void) const
TH1S * getTH1S(void) const
int verbose_
Definition: QTest.h:117
TH3F * getTH3F(void) const
TH1D * getTH1D(void) const
TH2D * getTH2D(void) const
TH3F * getRefTH3F(void) const
TH2F * getRefTH2F(void) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
Kind kind(void) const
Get the type of the monitor element.
bool first
Definition: L1TdeRCT.cc:75
TH2D * getRefTH2D(void) const
static std::string getAlgoName(void)
Definition: QTest.h:177
TObject * getRootObject(void) const
TH1F * getTH1F(void) const
std::vector< DQMChannel > badChannels_
Definition: QTest.h:159
TH2S * getRefTH2S(void) const
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
TObject * getRefRootObject(void) const
TH1S * getRefTH1S(void) const
TH1D * getRefTH1D(void) const