CMS 3D CMS Logo

Container2D.cc
Go to the documentation of this file.
3 
4 namespace hcaldqm {
5  using namespace constants;
6  using namespace quantity;
7  using namespace mapper;
8 
9  Container2D::Container2D() : _qz(nullptr) {}
10 
12  std::string const &folder, hashfunctions::HashType hashtype, Quantity *qx, Quantity *qy, Quantity *qz)
13  : Container1D(folder, hashtype, qx, qy), _qz(qz) {
17  }
18 
20  if (_qz != nullptr)
21  delete _qz;
22  _qz = nullptr;
23  }
24 
25  /* virtual */ void Container2D::initialize(std::string const &folder,
26  hashfunctions::HashType hashtype,
27  Quantity *qx,
28  Quantity *qy,
29  Quantity *qz,
30  int debug /*=0*/) {
31  Container1D::initialize(folder, qz->name() + "vs" + qy->name() + "vs" + qx->name(), hashtype, qx, qy, debug);
32  _qz = qz;
36  }
37 
38  /* virtual */ void Container2D::initialize(std::string const &folder,
39  std::string const &qname,
40  hashfunctions::HashType hashtype,
41  Quantity *qx,
42  Quantity *qy,
43  Quantity *qz,
44  int debug /*=0*/) {
45  Container1D::initialize(folder, qname, hashtype, qx, qy, debug);
46  _qz = qz;
50  }
51 
52  /* virtual */ void Container2D::fill(HcalDetId const &did) {
53  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did));
54  }
55 
56  // HcalDetId based
57  /* virtual */ void Container2D::fill(HcalDetId const &did, int x) {
58  if (_qx->isCoordinate() && _qy->isCoordinate())
59  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did), x);
60  else if (_qx->isCoordinate())
61  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
62  else if (_qy->isCoordinate())
63  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did));
64  }
65 
66  /* virtual */ void Container2D::fill(HcalDetId const &did, double x) {
67  if (_qx->isCoordinate() && _qy->isCoordinate())
68  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did), x);
69  else if (_qx->isCoordinate())
70  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
71  else if (_qy->isCoordinate())
72  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did));
73  }
74 
75  /* virtual */ void Container2D::fill(HcalDetId const &did, int x, double y) {
76  if (_qx->isCoordinate() && !_qy->isCoordinate())
77  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
78  else if (!_qx->isCoordinate() && _qy->isCoordinate())
79  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
80  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
81  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
82  }
83 
84  /* virtual */ void Container2D::fill(HcalDetId const &did, int x, int y) {
85  if (_qx->isCoordinate() && !_qy->isCoordinate())
86  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
87  else if (!_qx->isCoordinate() && _qy->isCoordinate())
88  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
89  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
90  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
91  }
92 
93  /* virtual */ void Container2D::fill(HcalDetId const &did, double x, double y) {
94  if (_qx->isCoordinate() && !_qy->isCoordinate())
95  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
96  else if (!_qx->isCoordinate() && _qy->isCoordinate())
97  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
98  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
99  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
100  }
101 
102  /* virtual */ double Container2D::getBinEntries(HcalDetId const &id) {
103  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(id) + _qy->getBin(id) * _qx->wofnbins());
104  }
105 
106  /* virtual */ double Container2D::getBinEntries(HcalDetId const &id, int x) {
107  if (_qx->isCoordinate())
108  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(id) + _qy->getBin(x) * _qx->wofnbins());
109  else
110  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(id) * _qx->wofnbins());
111  }
112 
113  /* virtual */ double Container2D::getBinEntries(HcalDetId const &id, double x) {
114  if (_qx->isCoordinate())
115  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(id) + _qy->getBin(x) * _qx->wofnbins());
116  else
117  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(id) * _qx->wofnbins());
118  }
119 
120  /* virtual */ double Container2D::getBinEntries(HcalDetId const &id, int x, int y) {
121  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(y) * _qx->wofnbins());
122  }
123 
124  /* virtual */ double Container2D::getBinEntries(HcalDetId const &id, int x, double y) {
125  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(y) * _qx->wofnbins());
126  }
127 
128  /* virtual */ double Container2D::getBinEntries(HcalDetId const &id, double x, double y) {
129  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(y) * _qx->wofnbins());
130  }
131 
132  /* virtual */ double Container2D::getBinContent(HcalDetId const &id) {
133  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(id), _qy->getBin(id));
134  }
135 
136  /* virtual */ double Container2D::getBinContent(HcalDetId const &id, int x) {
137  if (_qx->isCoordinate())
138  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(id), _qy->getBin(x));
139  else
140  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(id));
141  }
142 
143  /* virtual */ double Container2D::getBinContent(HcalDetId const &id, double x) {
144  if (_qx->isCoordinate())
145  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(id), _qy->getBin(x));
146  else
147  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(id));
148  }
149 
150  /* virtual */ double Container2D::getBinContent(HcalDetId const &id, int x, int y) {
151  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(y));
152  }
153 
154  /* virtual */ double Container2D::getBinContent(HcalDetId const &id, int x, double y) {
155  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(y));
156  }
157 
158  /* virtual */ double Container2D::getBinContent(HcalDetId const &id, double x, double y) {
159  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(y));
160  }
161 
162  // setBinContent
163  /* virtual */ void Container2D::setBinContent(HcalDetId const &id, int x) {
164  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(id), x);
165  }
166  /* virtual */ void Container2D::setBinContent(HcalDetId const &id, double x) {
167  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(id), x);
168  }
169  /* virtual */ void Container2D::setBinContent(HcalDetId const &id, int x, int y) {
170  if (_qx->isCoordinate())
171  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
172  else
173  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
174  }
175 
176  /* virtual */ void Container2D::setBinContent(HcalDetId const &id, int x, double y) {
177  if (_qx->isCoordinate())
178  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
179  else
180  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
181  }
182  /* virtual */ void Container2D::setBinContent(HcalDetId const &id, double x, int y) {
183  if (_qx->isCoordinate())
184  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
185  else
186  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
187  }
188  /* virtual */ void Container2D::setBinContent(HcalDetId const &id, double x, double y) {
189  if (_qx->isCoordinate())
190  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
191  else
192  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
193  }
194 
195  /* virtual */ void Container2D::setBinContent(HcalDetId const &id, int x, int y, int z) {
196  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
197  }
198  /* virtual */ void Container2D::setBinContent(HcalDetId const &id, int x, double y, int z) {
199  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
200  }
201  /* virtual */ void Container2D::setBinContent(HcalDetId const &id, double x, int y, int z) {
202  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
203  }
204  /* virtual */ void Container2D::setBinContent(HcalDetId const &id, double x, double y, int z) {
205  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
206  }
207  /* virtual */ void Container2D::setBinContent(HcalDetId const &id, int x, int y, double z) {
208  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
209  }
210  /* virtual */ void Container2D::setBinContent(HcalDetId const &id, int x, double y, double z) {
211  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
212  }
213  /* virtual */ void Container2D::setBinContent(HcalDetId const &id, double x, int y, double z) {
214  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
215  }
216  /* virtual */ void Container2D::setBinContent(HcalDetId const &id, double x, double y, double z) {
217  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
218  }
219 
220  // by ElectronicsId
221  /* virtual */ void Container2D::fill(HcalElectronicsId const &did) {
222  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did));
223  }
224 
225  /* virtual */ void Container2D::fill(HcalElectronicsId const &did, int x) {
226  if (_qx->isCoordinate() && _qy->isCoordinate())
227  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did), x);
228  else if (_qx->isCoordinate())
229  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
230  else if (_qy->isCoordinate())
231  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did));
232  }
233 
234  /* virtual */ void Container2D::fill(HcalElectronicsId const &did, double x) {
235  if (_qx->isCoordinate() && _qy->isCoordinate())
236  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did), x);
237  else if (_qx->isCoordinate())
238  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
239  else if (_qy->isCoordinate())
240  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did));
241  }
242 
243  /* virtual */ void Container2D::fill(HcalElectronicsId const &did, int x, double y) {
244  if (_qx->isCoordinate() && !_qy->isCoordinate())
245  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
246  else if (!_qx->isCoordinate() && _qy->isCoordinate())
247  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
248  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
249  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
250  }
251 
252  /* virtual */ void Container2D::fill(HcalElectronicsId const &did, int x, int y) {
253  if (_qx->isCoordinate() && !_qy->isCoordinate())
254  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
255  else if (!_qx->isCoordinate() && _qy->isCoordinate())
256  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
257  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
258  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
259  }
260 
261  /* virtual */ void Container2D::fill(HcalElectronicsId const &did, double x, double y) {
262  if (_qx->isCoordinate() && !_qy->isCoordinate())
263  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
264  else if (!_qx->isCoordinate() && _qy->isCoordinate())
265  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
266  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
267  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
268  }
269 
270  /* virtual */ double Container2D::getBinEntries(HcalElectronicsId const &id) {
271  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(id) + _qy->getBin(id) * _qx->wofnbins());
272  }
273 
274  /* virtual */ double Container2D::getBinEntries(HcalElectronicsId const &id, int x) {
275  if (_qx->isCoordinate())
276  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(id) + _qy->getBin(x) * _qx->wofnbins());
277  else
278  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(id) * _qx->wofnbins());
279  }
280 
281  /* virtual */ double Container2D::getBinEntries(HcalElectronicsId const &id, double x) {
282  if (_qx->isCoordinate())
283  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(id) + _qy->getBin(x) * _qx->wofnbins());
284  else
285  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(id) * _qx->wofnbins());
286  }
287 
288  /* virtual */ double Container2D::getBinEntries(HcalElectronicsId const &id, int x, int y) {
289  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(y) * _qx->wofnbins());
290  }
291 
292  /* virtual */ double Container2D::getBinEntries(HcalElectronicsId const &id, int x, double y) {
293  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(y) * _qx->wofnbins());
294  }
295 
296  /* virtual */ double Container2D::getBinEntries(HcalElectronicsId const &id, double x, double y) {
297  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(y) * _qx->wofnbins());
298  }
299 
300  /* virtual */ double Container2D::getBinContent(HcalElectronicsId const &id) {
301  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(id), _qy->getBin(id));
302  }
303 
304  /* virtual */ double Container2D::getBinContent(HcalElectronicsId const &id, int x) {
305  if (_qx->isCoordinate())
306  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(id), _qy->getBin(x));
307  else
308  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(id));
309  }
310 
311  /* virtual */ double Container2D::getBinContent(HcalElectronicsId const &id, double x) {
312  if (_qx->isCoordinate())
313  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(id), _qy->getBin(x));
314  else
315  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(id));
316  }
317 
318  /* virtual */ double Container2D::getBinContent(HcalElectronicsId const &id, int x, int y) {
319  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(y));
320  }
321 
322  /* virtual */ double Container2D::getBinContent(HcalElectronicsId const &id, int x, double y) {
323  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(y));
324  }
325 
326  /* virtual */ double Container2D::getBinContent(HcalElectronicsId const &id, double x, double y) {
327  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(y));
328  }
329 
330  // setBinContent
331  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const &id, int x) {
332  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(id), x);
333  }
334  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const &id, double x) {
335  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(id), x);
336  }
337  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const &id, int x, int y) {
338  if (_qx->isCoordinate())
339  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
340  else
341  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
342  }
343 
344  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const &id, int x, double y) {
345  if (_qx->isCoordinate())
346  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
347  else
348  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
349  }
350  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const &id, double x, int y) {
351  if (_qx->isCoordinate())
352  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
353  else
354  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
355  }
356  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const &id, double x, double y) {
357  if (_qx->isCoordinate())
358  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
359  else
360  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
361  }
362 
363  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const &id, int x, int y, int z) {
364  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
365  }
366  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const &id, int x, double y, int z) {
367  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
368  }
369  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const &id, double x, int y, int z) {
370  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
371  }
372  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const &id, double x, double y, int z) {
373  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
374  }
375  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const &id, int x, int y, double z) {
376  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
377  }
378  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const &id, int x, double y, double z) {
379  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
380  }
381  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const &id, double x, int y, double z) {
382  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
383  }
384  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const &id, double x, double y, double z) {
385  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
386  }
387 
388  // by TrigTowerDetId
389  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const &did) {
390  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did));
391  }
392 
393  // HcalDetId based
394  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const &did, int x) {
395  if (_qx->isCoordinate() && _qy->isCoordinate())
396  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did), x);
397  else if (_qx->isCoordinate())
398  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
399  else if (_qy->isCoordinate())
400  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did));
401  }
402 
403  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const &did, double x) {
404  if (_qx->isCoordinate() && _qy->isCoordinate())
405  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did), x);
406  else if (_qx->isCoordinate())
407  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
408  else if (_qy->isCoordinate())
409  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did));
410  }
411 
412  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const &did, int x, double y) {
413  if (_qx->isCoordinate() && !_qy->isCoordinate())
414  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
415  else if (!_qx->isCoordinate() && _qy->isCoordinate())
416  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
417  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
418  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
419  }
420 
421  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const &did, int x, int y) {
422  if (_qx->isCoordinate() && !_qy->isCoordinate())
423  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
424  else if (!_qx->isCoordinate() && _qy->isCoordinate())
425  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
426  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
427  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
428  }
429 
430  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const &did, double x, double y) {
431  if (_qx->isCoordinate() && !_qy->isCoordinate())
432  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
433  else if (!_qx->isCoordinate() && _qy->isCoordinate())
434  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
435  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
436  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
437  }
438 
439  void Container2D::fill(HcalTrigTowerDetId const &did, HcalElectronicsId const &eid, int x, int y) {
440  if (_qx->isCoordinate() && !_qy->isCoordinate())
441  _mes[_hashmap.getHash(did, eid)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
442  else if (!_qx->isCoordinate() && _qy->isCoordinate())
443  _mes[_hashmap.getHash(did, eid)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
444  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
445  _mes[_hashmap.getHash(did, eid)]->Fill(_qx->getValue(x), _qy->getValue(y));
446  }
447 
448  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const &id) {
449  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(id) + _qy->getBin(id) * _qx->wofnbins());
450  }
451 
452  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const &id, int x) {
453  if (_qx->isCoordinate())
454  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(id) + _qy->getBin(x) * _qx->wofnbins());
455  else
456  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(id) * _qx->wofnbins());
457  }
458 
459  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const &id, double x) {
460  if (_qx->isCoordinate())
461  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(id) + _qy->getBin(x) * _qx->wofnbins());
462  else
463  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(id) * _qx->wofnbins());
464  }
465 
466  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const &id, int x, int y) {
467  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(y) * _qx->wofnbins());
468  }
469 
470  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const &id, int x, double y) {
471  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(y) * _qx->wofnbins());
472  }
473 
474  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const &id, double x, double y) {
475  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(y) * _qx->wofnbins());
476  }
477 
478  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const &id) {
479  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(id), _qy->getBin(id));
480  }
481 
482  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const &id, int x) {
483  if (_qx->isCoordinate())
484  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(id), _qy->getBin(x));
485  else
486  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(id));
487  }
488 
489  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const &id, double x) {
490  if (_qx->isCoordinate())
491  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(id), _qy->getBin(x));
492  else
493  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(id));
494  }
495 
496  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const &id, int x, int y) {
497  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(y));
498  }
499 
500  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const &id, int x, double y) {
501  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(y));
502  }
503 
504  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const &id, double x, double y) {
505  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(y));
506  }
507 
508  // setBinContent
509  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, int x) {
510  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(id), x);
511  }
512  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, double x) {
513  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(id), x);
514  }
515  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, int x, int y) {
516  if (_qx->isCoordinate())
517  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
518  else
519  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
520  }
521 
522  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, int x, double y) {
523  if (_qx->isCoordinate())
524  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
525  else
526  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
527  }
528  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, double x, int y) {
529  if (_qx->isCoordinate())
530  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
531  else
532  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
533  }
534  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, double x, double y) {
535  if (_qx->isCoordinate())
536  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
537  else
538  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
539  }
540 
541  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, int x, int y, int z) {
542  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
543  }
544  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, int x, double y, int z) {
545  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
546  }
547  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, double x, int y, int z) {
548  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
549  }
550  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, double x, double y, int z) {
551  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
552  }
553  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, int x, int y, double z) {
554  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
555  }
556  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, int x, double y, double z) {
557  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
558  }
559  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, double x, int y, double z) {
560  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
561  }
562  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, double x, double y, double z) {
563  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
564  }
565 
566  // booking
568  HcalElectronicsMap const *emap,
570  std::string aux) {
571  // full path as in Container1D.cc
572  //
573  ib.setCurrentFolder(subsystem + "/" + _folder + "/" + _qname + (aux.empty() ? aux : "_" + aux) + "/" +
575  if (_hashmap.isDHash()) {
576  // for Detector Hashes
577  std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
578  for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
579  // skip trigger towers and calib
580  if (!it->isHcalDetId())
581  continue;
582 
583  HcalDetId did = HcalDetId(it->rawId());
584  uint32_t hash = _hashmap.getHash(did);
585  MEMap::iterator mit = _mes.find(hash);
586  if (mit != _mes.end())
587  continue;
588 
590  _mes.insert(std::make_pair(hash,
591  ib.book2D(_hashmap.getName(did),
592  _hashmap.getName(did),
593  _qx->nbins(),
594  _qx->min(),
595  _qx->max(),
596  _qy->nbins(),
597  _qy->min(),
598  _qy->max())));
599  customize(_mes[hash]);
600  }
601  } else if (_hashmap.isEHash()) {
602  // for Electronics hashes
603  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
604  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
605  HcalElectronicsId eid = HcalElectronicsId(it->rawId());
606  uint32_t hash = _hashmap.getHash(eid);
607  MEMap::iterator mit = _mes.find(hash);
608  if (mit != _mes.end())
609  continue;
610 
612  _mes.insert(std::make_pair(hash,
613  ib.book2D(_hashmap.getName(eid),
615  _qx->nbins(),
616  _qx->min(),
617  _qx->max(),
618  _qy->nbins(),
619  _qy->min(),
620  _qy->max())));
621  customize(_mes[hash]);
622  }
623  } else if (_hashmap.isTHash()) {
624  // for TrigTower hashes
625  std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
626  for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
627  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
629  uint32_t hash = _hashmap.getHash(tid);
630  MEMap::iterator mit = _mes.find(hash);
631  if (mit != _mes.end())
632  continue;
633 
635  _mes.insert(std::make_pair(hash,
636  ib.book2D(_hashmap.getName(tid),
637  _hashmap.getName(tid),
638  _qx->nbins(),
639  _qx->min(),
640  _qx->max(),
641  _qy->nbins(),
642  _qy->min(),
643  _qy->max())));
644 
645  customize(_mes[hash]);
646  }
647  } else if (_hashmap.isMixHash()) {
648  // for Mixed hashes
649  std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
650  for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
651  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
654  uint32_t hash = _hashmap.getHash(tid, eid);
655  MEMap::iterator mit = _mes.find(hash);
656  if (mit != _mes.end())
657  continue;
658 
660  _mes.insert(std::make_pair(hash,
661  ib.book2D(_hashmap.getName(tid, eid),
662  _hashmap.getName(tid, eid),
663  _qx->nbins(),
664  _qx->min(),
665  _qx->max(),
666  _qy->nbins(),
667  _qy->min(),
668  _qy->max())));
669 
670  customize(_mes[hash]);
671  }
672  }
673  }
674 
676  HcalElectronicsMap const *emap,
677  filter::HashFilter const &filter,
679  std::string aux) {
680  // full path as in Container1D.cc
681  //
682  ib.setCurrentFolder(subsystem + "/" + _folder + "/" + _qname + (aux.empty() ? aux : "_" + aux) + "/" +
684  if (_hashmap.isDHash()) {
685  // for Detector Hashes
686  std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
687  for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
688  // skip trigger towers and calib
689  if (!it->isHcalDetId())
690  continue;
691 
692  HcalDetId did = HcalDetId(it->rawId());
693  uint32_t hash = _hashmap.getHash(did);
694  MEMap::iterator mit = _mes.find(hash);
695  if (mit != _mes.end())
696  continue;
697  if (filter.filter(did))
698  continue;
699 
701  _mes.insert(std::make_pair(hash,
702  ib.book2D(_hashmap.getName(did),
703  _hashmap.getName(did),
704  _qx->nbins(),
705  _qx->min(),
706  _qx->max(),
707  _qy->nbins(),
708  _qy->min(),
709  _qy->max())));
710  customize(_mes[hash]);
711  }
712  } else if (_hashmap.isEHash()) {
713  // for Electronics hashes
714  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
715  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
716  HcalElectronicsId eid = HcalElectronicsId(it->rawId());
717  uint32_t hash = _hashmap.getHash(eid);
718  MEMap::iterator mit = _mes.find(hash);
719  if (mit != _mes.end())
720  continue;
721  if (filter.filter(eid))
722  continue;
723 
725  _mes.insert(std::make_pair(hash,
726  ib.book2D(_hashmap.getName(eid),
728  _qx->nbins(),
729  _qx->min(),
730  _qx->max(),
731  _qy->nbins(),
732  _qy->min(),
733  _qy->max())));
734  customize(_mes[hash]);
735  }
736  } else if (_hashmap.isTHash()) {
737  // for TrigTower hashes
738  std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
739  for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
740  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
742  uint32_t hash = _hashmap.getHash(tid);
743  MEMap::iterator mit = _mes.find(hash);
744  if (mit != _mes.end())
745  continue;
746  if (filter.filter(tid))
747  continue;
748 
750  _mes.insert(std::make_pair(hash,
751  ib.book2D(_hashmap.getName(tid),
752  _hashmap.getName(tid),
753  _qx->nbins(),
754  _qx->min(),
755  _qx->max(),
756  _qy->nbins(),
757  _qy->min(),
758  _qy->max())));
759 
760  customize(_mes[hash]);
761  }
762  } else if (_hashmap.isMixHash()) {
763  // for Mixed hashes
764  std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
765  for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
766  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
769  uint32_t hash = _hashmap.getHash(tid, eid);
770  MEMap::iterator mit = _mes.find(hash);
771  if (mit != _mes.end())
772  continue;
773  if (filter.filter(tid))
774  continue;
775 
777  _mes.insert(std::make_pair(hash,
778  ib.book2D(_hashmap.getName(tid, eid),
779  _hashmap.getName(tid, eid),
780  _qx->nbins(),
781  _qx->min(),
782  _qx->max(),
783  _qy->nbins(),
784  _qy->min(),
785  _qy->max())));
786 
787  customize(_mes[hash]);
788  }
789  }
790  }
791 
792  /* virtual */ void Container2D::customize(MonitorElement *me) {
793  me->setAxisTitle(_qx->name(), 1);
794  me->setAxisTitle(_qy->name(), 2);
795  me->setAxisTitle(_qz->name(), 3);
796 
797  TH1 *h = me->getTH1();
798  _qx->setBits(h);
799  _qy->setBits(h);
800  _qz->setBits(h);
801 
802  std::vector<std::string> xlabels = _qx->getLabels();
803  std::vector<std::string> ylabels = _qy->getLabels();
804  for (unsigned int i = 0; i < xlabels.size(); i++) {
805  me->setBinLabel(i + 1, xlabels[i], 1);
806  }
807  for (unsigned int i = 0; i < ylabels.size(); i++) {
808  me->setBinLabel(i + 1, ylabels[i], 2);
809  }
810  }
811 
812  void Container2D::showOverflowZ(bool showOverflow) { _qz->showOverflow(showOverflow); }
813 } // namespace hcaldqm
void customize(MonitorElement *) override
Definition: Container2D.cc:792
virtual void setBits(TH1 *o)
Definition: Quantity.h:51
virtual bool isMixHash() const
Definition: HashMapper.h:65
virtual void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *qy=new quantity::ValueQuantity(quantity::fN), int debug=0)
Definition: Container1D.cc:33
virtual std::string name()
Definition: Quantity.h:34
virtual void setAxisType(AxisType at)
Definition: Quantity.h:36
uint32_t getHash(HcalDetId const &did) const override
Definition: HashMapper.h:29
virtual int wofnbins()
Definition: Quantity.h:58
virtual std::vector< std::string > getLabels()
Definition: Quantity.h:62
virtual double max()
Definition: Quantity.h:60
virtual bool isTHash() const
Definition: HashMapper.h:62
std::vector< HcalTrigTowerDetId > allTriggerId() const
virtual std::string getHashTypeName() const
Definition: HashMapper.h:54
~Container2D() override
Definition: Container2D.cc:19
double getBinEntries(HcalDetId const &) override
Definition: Container2D.cc:102
quantity::Quantity * _qx
Definition: Container1D.h:234
virtual int getValue(HcalDetId const &)
Definition: Quantity.h:45
virtual uint32_t getBin(HcalDetId const &)
Definition: Quantity.h:39
void debug(STDTYPE const &msg) const
Definition: Logger.h:20
virtual bool isEHash() const
Definition: HashMapper.h:59
virtual void showOverflow(bool showOverflow)
Definition: Quantity.h:68
std::string _folder
Definition: Container.h:37
void showOverflowZ(bool showOverflow)
Definition: Container2D.cc:812
double getBinContent(HcalDetId const &) override
Definition: Container2D.cc:132
#define debug
Definition: HDRShower.cc:19
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
virtual void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0)
Definition: Container2D.cc:25
mapper::HashMapper _hashmap
Definition: Container1D.h:233
virtual double min()
Definition: Quantity.h:59
virtual bool isDHash() const
Definition: HashMapper.h:58
virtual bool isCoordinate()
Definition: Quantity.h:61
void setBinContent(HcalDetId const &, int) override
Definition: Container2D.cc:163
std::string getName(HcalDetId const &did) const override
Definition: HashMapper.h:42
std::vector< HcalGenericDetId > allPrecisionId() const
std::string _qname
Definition: Container.h:38
void fill(HcalDetId const &) override
Definition: Container2D.cc:52
float x
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:567
quantity::Quantity * _qz
Definition: Container2D.h:174
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
quantity::Quantity * _qy
Definition: Container1D.h:235
Readout chain identification for Hcal.
ib
Definition: cuy.py:661