CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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*/) {
50  Container::initialize(folder, qname, debug);
51  _qx = qx;
52  _qy = qy;
55  }
56 
58  ib.setCurrentFolder(subsystem + "/" + _folder + "/" + _qname);
59  _me = ib.book1DD(_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
virtual void setBits(TH1 *o)
Definition: Quantity.h:51
const edm::EventSetup & c
virtual void initialize(std::string const &folder, std::string const &qname, int debug=0)
Definition: Container.h:30
virtual std::string name()
Definition: Quantity.h:34
virtual void setAxisType(AxisType at)
Definition: Quantity.h:36
int ib
Definition: cuy.py:661
quantity::Quantity * _qx
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
virtual std::vector< std::string > getLabels()
Definition: Quantity.h:62
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
virtual double max()
Definition: Quantity.h:60
virtual void setBinContent(int, int)
quantity::Quantity * _qy
virtual void setMax(double)
Definition: Quantity.h:64
virtual void extendAxisRange(int)
void Fill(long long x)
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:155
virtual int getValue(HcalDetId const &)
Definition: Quantity.h:45
virtual void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *qy=new quantity::ValueQuantity(quantity::fN), int debug=0)
virtual Quantity * makeCopy()
Definition: Quantity.h:37
virtual uint32_t getBin(HcalDetId const &)
Definition: Quantity.h:39
virtual void showOverflowX(bool showOverflow)
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)
virtual double getBinContent(int binx) const
get content of bin (1-D)
virtual double getBinContent(int)
virtual void showOverflow(bool showOverflow)
Definition: Quantity.h:68
std::string _folder
Definition: Container.h:37
#define debug
Definition: HDRShower.cc:19
virtual void showOverflowY(bool showOverflow)
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
virtual double getBinEntries(int)
virtual double min()
Definition: Quantity.h:59
virtual double getBinEntries(int bin) const
get # of bin entries (for profiles)
virtual bool isCoordinate()
Definition: Quantity.h:61
std::string _qname
Definition: Container.h:38
float x
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
Readout chain identification for Hcal.
virtual TH1 * getTH1() const
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)