CMS 3D CMS Logo

ContainerSingle1D.cc
Go to the documentation of this file.
2 
3 namespace hcaldqm {
4  using namespace quantity;
5  using namespace constants;
7  _qx = nullptr;
8  _qy = nullptr;
9  }
10 
12  _qx = c._qx->makeCopy();
13  _qy = c._qy->makeCopy();
14  }
15 
17  : Container(folder, qy->name() + "vs" + qx->name()), _qx(qx), _qy(qy) {
20  }
21 
23  : Container(folder, qname), _qx(qx), _qy(qy) {
26  }
27 
29  if (_qx != nullptr)
30  delete _qx;
31  if (_qy != nullptr)
32  delete _qy;
33  _qx = nullptr;
34  _qy = nullptr;
35  }
36 
38  Quantity *qx,
39  Quantity *qy,
40  int debug /*=0*/) {
41  Container::initialize(folder, qy->name() + "vs" + qx->name(), debug);
42  _qx = qx;
43  _qy = qy;
46  }
47 
48  /* virtual */ void ContainerSingle1D::initialize(
49  std::string const &folder, std::string const &qname, Quantity *qx, Quantity *qy, int debug /*=0*/) {
51  _qx = qx;
52  _qy = qy;
55  }
56 
58  ib.setCurrentFolder(subsystem + "/" + _folder + "/" + _qname);
59  _me = ib.book1D(_qname + (aux.empty() ? aux : "_" + aux),
60  _qname + (aux.empty() ? aux : " " + aux),
61  _qx->nbins(),
62  _qx->min(),
63  _qx->max());
64  customize();
65  }
66 
67  /* virtual */ void ContainerSingle1D::customize() {
68  _me->setAxisTitle(_qx->name(), 1);
69  _me->setAxisTitle(_qy->name(), 2);
70 
71  TH1 *h = _me->getTH1();
72  _qx->setBits(h);
73  _qy->setBits(h);
74 
75  std::vector<std::string> xlabels = _qx->getLabels();
76  for (unsigned int i = 0; i < xlabels.size(); i++)
77  _me->setBinLabel(i + 1, xlabels[i], 1);
78  }
79 
80  /* virtual */ void ContainerSingle1D::fill(int x) { _me->Fill(_qx->getValue(x)); }
81 
82  /* virtual */ void ContainerSingle1D::fill(double x) { _me->Fill(_qx->getValue(x)); }
83 
84  /* virtual */ void ContainerSingle1D::fill(int x, int y) { _me->Fill(_qx->getValue(x), _qy->getValue(y)); }
85 
86  /* virtual */ void ContainerSingle1D::fill(int x, double y) { _me->Fill(_qx->getValue(x), _qy->getValue(y)); }
87 
88  /* virtual */ void ContainerSingle1D::fill(double x, int y) { _me->Fill(_qx->getValue(x), _qy->getValue(y)); }
89 
90  /* virtual */ void ContainerSingle1D::fill(double x, double y) { _me->Fill(_qx->getValue(x), _qy->getValue(y)); }
91 
92  /* virtual */ double ContainerSingle1D::getBinContent(int x) { return _me->getBinContent(_qx->getBin(x)); }
93  /* virtual */ double ContainerSingle1D::getBinContent(double x) { return _me->getBinContent(_qx->getBin(x)); }
94  /* virtual */ double ContainerSingle1D::getBinEntries(int x) { return _me->getBinEntries(_qx->getBin(x)); }
95  /* virtual */ double ContainerSingle1D::getBinEntries(double x) { return _me->getBinEntries(_qx->getBin(x)); }
96  /* virtual */ void ContainerSingle1D::setBinContent(int x, int y) { _me->setBinContent(_qx->getBin(x), y); }
97  /* virtual */ void ContainerSingle1D::setBinContent(int x, double y) { _me->setBinContent(_qx->getBin(x), y); }
98  /* virtual */ void ContainerSingle1D::setBinContent(double x, int y) { _me->setBinContent(_qx->getBin(x), y); }
99  /* virtual */ void ContainerSingle1D::setBinContent(double x, double y) { _me->setBinContent(_qx->getBin(x), y); }
100 
101  /* virtual */ void ContainerSingle1D::fill(HcalDetId const &id) { _me->Fill(_qx->getValue(id)); }
102 
103  /* virtual */ void ContainerSingle1D::fill(HcalDetId const &id, double x) {
104  if (_qx->isCoordinate())
105  _me->Fill(_qx->getValue(id), _qy->getValue(x));
106  else
107  _me->Fill(_qx->getValue(x));
108  }
109 
110  /* virtual */ void ContainerSingle1D::fill(HcalDetId const &id, double x, double y) {
111  if (_qx->isCoordinate())
112  _me->Fill(_qx->getValue(id), _qy->getValue(x), y);
113  else
114  _me->Fill(_qy->getValue(x), _qy->getValue(y));
115  }
116 
117  /* virtual */ double ContainerSingle1D::getBinContent(HcalDetId const &id) {
118  return _me->getBinContent(_qx->getBin(id));
119  }
120  /* virtual */ double ContainerSingle1D::getBinEntries(HcalDetId const &id) {
121  return _me->getBinEntries(_qx->getBin(id));
122  }
123 
124  /* virtual */ void ContainerSingle1D::setBinContent(HcalDetId const &id, int x) {
125  _me->setBinContent(_qx->getBin(id), x);
126  }
127  /* virtual */ void ContainerSingle1D::setBinContent(HcalDetId const &id, double x) {
128  _me->setBinContent(_qx->getBin(id), x);
129  }
130 
131  /* virtual */ void ContainerSingle1D::fill(HcalElectronicsId const &id) { _me->Fill(_qx->getValue(id)); }
132 
133  /* virtual */ void ContainerSingle1D::fill(HcalElectronicsId const &id, double x) {
134  if (_qx->isCoordinate())
135  _me->Fill(_qx->getValue(id), _qy->getValue(x));
136  else
137  _me->Fill(_qx->getValue(x));
138  }
139 
140  /* virtual */ void ContainerSingle1D::fill(HcalElectronicsId const &id, double x, double y) {
141  if (_qx->isCoordinate())
142  _me->Fill(_qx->getValue(id), _qy->getValue(x), y);
143  else
144  _me->Fill(_qy->getValue(x), _qy->getValue(y));
145  }
146 
147  /* virtual */ double ContainerSingle1D::getBinContent(HcalElectronicsId const &id) {
148  return _me->getBinContent(_qx->getBin(id));
149  }
150  /* virtual */ double ContainerSingle1D::getBinEntries(HcalElectronicsId const &id) {
151  return _me->getBinEntries(_qx->getBin(id));
152  }
153 
154  /* virtual */ void ContainerSingle1D::setBinContent(HcalElectronicsId const &id, int x) {
155  _me->setBinContent(_qx->getBin(id), x);
156  }
157  /* virtual */ void ContainerSingle1D::setBinContent(HcalElectronicsId const &id, double x) {
158  _me->setBinContent(_qx->getBin(id), x);
159  }
160 
161  /* virtual */ void ContainerSingle1D::fill(HcalTrigTowerDetId const &id) { _me->Fill(_qx->getValue(id)); }
162 
163  /* virtual */ void ContainerSingle1D::fill(HcalTrigTowerDetId const &id, double x) {
164  if (_qx->isCoordinate())
165  _me->Fill(_qx->getValue(id), _qy->getValue(x));
166  else
167  _me->Fill(_qx->getValue(x));
168  }
169 
170  /* virtual */ void ContainerSingle1D::fill(HcalTrigTowerDetId const &id, double x, double y) {
171  if (_qx->isCoordinate())
172  _me->Fill(_qx->getValue(id), _qy->getValue(x), y);
173  else
174  _me->Fill(_qy->getValue(x), _qy->getValue(y));
175  }
176 
177  /* virtual */ double ContainerSingle1D::getBinContent(HcalTrigTowerDetId const &id) {
178  return _me->getBinContent(_qx->getBin(id));
179  }
180  /* virtual */ double ContainerSingle1D::getBinEntries(HcalTrigTowerDetId const &id) {
181  return _me->getBinEntries(_qx->getBin(id));
182  }
183 
184  /* virtual */ void ContainerSingle1D::setBinContent(HcalTrigTowerDetId const &id, int x) {
185  _me->setBinContent(_qx->getBin(id), x);
186  }
187  /* virtual */ void ContainerSingle1D::setBinContent(HcalTrigTowerDetId const &id, double x) {
188  _me->setBinContent(_qx->getBin(id), x);
189  }
190 
191  /* virtual */ void ContainerSingle1D::extendAxisRange(int l) {
192  if (l < _qx->nbins())
193  return;
194 
195  int x = _qx->nbins();
196  while (l >= x) {
197  _me->getTH1()->LabelsInflate();
198  x *= 2;
199  _qx->setMax(x);
200  }
201  }
202 
203  void ContainerSingle1D::showOverflowX(bool showOverflow) { _qx->showOverflow(showOverflow); }
204 
205  void ContainerSingle1D::showOverflowY(bool showOverflow) { _qy->showOverflow(showOverflow); }
206 
207 } // namespace hcaldqm
hcal_dqm_sourceclient-live_cfg.subsystem
subsystem
Definition: hcal_dqm_sourceclient-live_cfg.py:16
hcaldqm::ContainerSingle1D::showOverflowX
virtual void showOverflowX(bool showOverflow)
Definition: ContainerSingle1D.cc:203
dqm::impl::MonitorElement::getBinEntries
virtual double getBinEntries(int bin) const
get # of bin entries (for profiles)
Definition: MonitorElement.cc:645
hcaldqm::quantity::Quantity::showOverflow
virtual void showOverflow(bool showOverflow)
Definition: Quantity.h:68
mps_fire.i
i
Definition: mps_fire.py:355
hcaldqm::quantity::Quantity::setAxisType
virtual void setAxisType(AxisType at)
Definition: Quantity.h:36
hcaldqm::ContainerSingle1D::showOverflowY
virtual void showOverflowY(bool showOverflow)
Definition: ContainerSingle1D.cc:205
printsummarytable.folder
folder
Definition: printsummarytable.py:7
hcaldqm
Definition: Constants.h:8
hcaldqm::quantity::Quantity::setBits
virtual void setBits(TH1 *o)
Definition: Quantity.h:51
hcaldqm::Container::initialize
virtual void initialize(std::string const &folder, std::string const &qname, int debug=0)
Definition: Container.h:30
hcaldqm::ContainerSingle1D::getBinContent
virtual double getBinContent(int)
Definition: ContainerSingle1D.cc:92
constants
hcaldqm::quantity::Quantity::min
virtual double min()
Definition: Quantity.h:59
hcaldqm::Container::_folder
std::string _folder
Definition: Container.h:37
hcaldqm::ContainerSingle1D::getBinEntries
virtual double getBinEntries(int)
Definition: ContainerSingle1D.cc:94
hcaldqm::quantity::Quantity::getBin
virtual uint32_t getBin(HcalDetId const &)
Definition: Quantity.h:39
hcaldqm::Container
Definition: Container.h:21
hcaldqm::quantity::Quantity::nbins
virtual int nbins()
Definition: Quantity.h:57
debug
#define debug
Definition: HDRShower.cc:19
hcaldqm::quantity::Quantity::getValue
virtual int getValue(HcalDetId const &)
Definition: Quantity.h:45
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
HcalElectronicsId
Readout chain identification for Hcal.
Definition: HcalElectronicsId.h:32
LaserClient_cfi.nbins
nbins
Definition: LaserClient_cfi.py:51
hcaldqm::quantity::Quantity::max
virtual double max()
Definition: Quantity.h:60
hcaldqm::ContainerSingle1D::_qx
quantity::Quantity * _qx
Definition: ContainerSingle1D.h:103
h
hcaldqm::ContainerSingle1D::~ContainerSingle1D
~ContainerSingle1D() override
Definition: ContainerSingle1D.cc:28
hcaldqm::quantity::fYAxis
Definition: Quantity.h:25
dqm::legacy::MonitorElement::getTH1
virtual TH1 * getTH1() const
Definition: MonitorElement.h:474
ContainerSingle1D.h
hcaldqm::ContainerSingle1D::customize
virtual void customize()
Definition: ContainerSingle1D.cc:67
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MjjMonitor_cfi.quantity
quantity
Definition: MjjMonitor_cfi.py:10
hcaldqm::quantity::Quantity::getLabels
virtual std::vector< std::string > getLabels()
Definition: Quantity.h:62
hcaldqm::quantity::Quantity::name
virtual std::string name()
Definition: Quantity.h:34
hcaldqm::ContainerSingle1D::extendAxisRange
virtual void extendAxisRange(int)
Definition: ContainerSingle1D.cc:191
printConversionInfo.aux
aux
Definition: printConversionInfo.py:19
HcalDetId
Definition: HcalDetId.h:12
dqm::impl::MonitorElement::setBinLabel
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:771
hcaldqm::ContainerSingle1D::fill
virtual void fill(int)
Definition: ContainerSingle1D.cc:80
cuy.ib
ib
Definition: cuy.py:662
hcaldqm::ContainerSingle1D::book
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
Definition: ContainerSingle1D.cc:57
hcaldqm::quantity::Quantity
Definition: Quantity.h:27
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
hcaldqm::ContainerSingle1D::setBinContent
virtual void setBinContent(int, int)
Definition: ContainerSingle1D.cc:96
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
hcaldqm::quantity::Quantity::setMax
virtual void setMax(double)
Definition: Quantity.h:64
dqm::impl::MonitorElement::setBinContent
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Definition: MonitorElement.cc:691
hcaldqm::ContainerSingle1D::_qy
quantity::Quantity * _qy
Definition: ContainerSingle1D.h:104
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
hcaldqm::ContainerSingle1D::_me
MonitorElement * _me
Definition: ContainerSingle1D.h:102
dqm::implementation::IBooker
Definition: DQMStore.h:43
hcaldqm::ContainerSingle1D::initialize
virtual void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *qy=new quantity::ValueQuantity(quantity::fN), int debug=0)
Definition: ContainerSingle1D.cc:37
hcaldqm::ContainerSingle1D
Definition: ContainerSingle1D.h:19
hcaldqm::quantity::Quantity::isCoordinate
virtual bool isCoordinate()
Definition: Quantity.h:61
hcaldqm::quantity::fXAxis
Definition: Quantity.h:25
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
dqm::impl::MonitorElement::getBinContent
virtual double getBinContent(int binx) const
get content of bin (1-D)
Definition: MonitorElement.cc:592
hcaldqm::ContainerSingle1D::ContainerSingle1D
ContainerSingle1D()
Definition: ContainerSingle1D.cc:6
hcaldqm::Container::_qname
std::string _qname
Definition: Container.h:38
HcalTrigTowerDetId
Definition: HcalTrigTowerDetId.h:14