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 
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;
35  _qz->setAxisType(quantity::fZAxis);
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  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const &id) {
440  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(id) + _qy->getBin(id) * _qx->wofnbins());
441  }
442 
443  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const &id, int x) {
444  if (_qx->isCoordinate())
445  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(id) + _qy->getBin(x) * _qx->wofnbins());
446  else
447  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(id) * _qx->wofnbins());
448  }
449 
450  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const &id, double x) {
451  if (_qx->isCoordinate())
452  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(id) + _qy->getBin(x) * _qx->wofnbins());
453  else
454  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(id) * _qx->wofnbins());
455  }
456 
457  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const &id, int x, int y) {
458  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(y) * _qx->wofnbins());
459  }
460 
461  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const &id, int x, double y) {
462  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(y) * _qx->wofnbins());
463  }
464 
465  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const &id, double x, double y) {
466  return _mes[_hashmap.getHash(id)]->getBinEntries(_qx->getBin(x) + _qy->getBin(y) * _qx->wofnbins());
467  }
468 
469  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const &id) {
470  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(id), _qy->getBin(id));
471  }
472 
473  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const &id, int x) {
474  if (_qx->isCoordinate())
475  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(id), _qy->getBin(x));
476  else
477  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(id));
478  }
479 
480  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const &id, double x) {
481  if (_qx->isCoordinate())
482  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(id), _qy->getBin(x));
483  else
484  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(id));
485  }
486 
487  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const &id, int x, int y) {
488  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(y));
489  }
490 
491  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const &id, int x, double y) {
492  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(y));
493  }
494 
495  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const &id, double x, double y) {
496  return _mes[_hashmap.getHash(id)]->getBinContent(_qx->getBin(x), _qy->getBin(y));
497  }
498 
499  // setBinContent
500  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, int x) {
501  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(id), x);
502  }
503  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, double x) {
504  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(id), x);
505  }
506  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, int x, int y) {
507  if (_qx->isCoordinate())
508  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
509  else
510  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
511  }
512 
513  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, int x, double y) {
514  if (_qx->isCoordinate())
515  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
516  else
517  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
518  }
519  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, double x, int y) {
520  if (_qx->isCoordinate())
521  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
522  else
523  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
524  }
525  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, double x, double y) {
526  if (_qx->isCoordinate())
527  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id), _qy->getBin(x), y);
528  else
529  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(id), y);
530  }
531 
532  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, int x, int y, int z) {
533  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
534  }
535  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, int x, double y, int z) {
536  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
537  }
538  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, double x, int y, int z) {
539  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
540  }
541  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, double x, double 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, int y, double z) {
545  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
546  }
547  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, int x, double y, double 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, int y, double z) {
551  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
552  }
553  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const &id, double x, double y, double z) {
554  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x), _qy->getBin(y), z);
555  }
556 
557  // booking
559  HcalElectronicsMap const *emap,
560  std::string subsystem,
561  std::string aux) {
562  // full path as in Container1D.cc
563  //
564  ib.setCurrentFolder(subsystem + "/" + _folder + "/" + _qname + (aux.empty() ? aux : "_" + aux) + "/" +
566  if (_hashmap.isDHash()) {
567  // for Detector Hashes
568  std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
569  for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
570  // skip trigger towers and calib
571  if (!it->isHcalDetId())
572  continue;
573 
574  HcalDetId did = HcalDetId(it->rawId());
575  uint32_t hash = _hashmap.getHash(did);
576  MEMap::iterator mit = _mes.find(hash);
577  if (mit != _mes.end())
578  continue;
579 
581  _mes.insert(std::make_pair(hash,
582  ib.book2D(_hashmap.getName(did),
583  _hashmap.getName(did),
584  _qx->nbins(),
585  _qx->min(),
586  _qx->max(),
587  _qy->nbins(),
588  _qy->min(),
589  _qy->max())));
590  customize(_mes[hash]);
591  }
592  } else if (_hashmap.isEHash()) {
593  // for Electronics hashes
594  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
595  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
596  HcalElectronicsId eid = HcalElectronicsId(it->rawId());
597  uint32_t hash = _hashmap.getHash(eid);
598  MEMap::iterator mit = _mes.find(hash);
599  if (mit != _mes.end())
600  continue;
601 
603  _mes.insert(std::make_pair(hash,
604  ib.book2D(_hashmap.getName(eid),
605  _hashmap.getName(eid),
606  _qx->nbins(),
607  _qx->min(),
608  _qx->max(),
609  _qy->nbins(),
610  _qy->min(),
611  _qy->max())));
612  customize(_mes[hash]);
613  }
614  } else if (_hashmap.isTHash()) {
615  // for TrigTower hashes
616  std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
617  for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
618  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
620  uint32_t hash = _hashmap.getHash(tid);
621  MEMap::iterator mit = _mes.find(hash);
622  if (mit != _mes.end())
623  continue;
624 
626  _mes.insert(std::make_pair(hash,
627  ib.book2D(_hashmap.getName(tid),
628  _hashmap.getName(tid),
629  _qx->nbins(),
630  _qx->min(),
631  _qx->max(),
632  _qy->nbins(),
633  _qy->min(),
634  _qy->max())));
635 
636  customize(_mes[hash]);
637  }
638  }
639  }
640 
642  HcalElectronicsMap const *emap,
643  filter::HashFilter const &filter,
644  std::string subsystem,
645  std::string aux) {
646  // full path as in Container1D.cc
647  //
648  ib.setCurrentFolder(subsystem + "/" + _folder + "/" + _qname + (aux.empty() ? aux : "_" + aux) + "/" +
650  if (_hashmap.isDHash()) {
651  // for Detector Hashes
652  std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
653  for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
654  // skip trigger towers and calib
655  if (!it->isHcalDetId())
656  continue;
657 
658  HcalDetId did = HcalDetId(it->rawId());
659  uint32_t hash = _hashmap.getHash(did);
660  MEMap::iterator mit = _mes.find(hash);
661  if (mit != _mes.end())
662  continue;
663  if (filter.filter(did))
664  continue;
665 
667  _mes.insert(std::make_pair(hash,
668  ib.book2D(_hashmap.getName(did),
669  _hashmap.getName(did),
670  _qx->nbins(),
671  _qx->min(),
672  _qx->max(),
673  _qy->nbins(),
674  _qy->min(),
675  _qy->max())));
676  customize(_mes[hash]);
677  }
678  } else if (_hashmap.isEHash()) {
679  // for Electronics hashes
680  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
681  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
682  HcalElectronicsId eid = HcalElectronicsId(it->rawId());
683  uint32_t hash = _hashmap.getHash(eid);
684  MEMap::iterator mit = _mes.find(hash);
685  if (mit != _mes.end())
686  continue;
687  if (filter.filter(eid))
688  continue;
689 
691  _mes.insert(std::make_pair(hash,
692  ib.book2D(_hashmap.getName(eid),
693  _hashmap.getName(eid),
694  _qx->nbins(),
695  _qx->min(),
696  _qx->max(),
697  _qy->nbins(),
698  _qy->min(),
699  _qy->max())));
700  customize(_mes[hash]);
701  }
702  } else if (_hashmap.isTHash()) {
703  // for TrigTower hashes
704  std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
705  for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
706  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
708  uint32_t hash = _hashmap.getHash(tid);
709  MEMap::iterator mit = _mes.find(hash);
710  if (mit != _mes.end())
711  continue;
712  if (filter.filter(tid))
713  continue;
714 
716  _mes.insert(std::make_pair(hash,
717  ib.book2D(_hashmap.getName(tid),
718  _hashmap.getName(tid),
719  _qx->nbins(),
720  _qx->min(),
721  _qx->max(),
722  _qy->nbins(),
723  _qy->min(),
724  _qy->max())));
725 
726  customize(_mes[hash]);
727  }
728  }
729  }
730 
731  /* virtual */ void Container2D::customize(MonitorElement *me) {
732  me->setAxisTitle(_qx->name(), 1);
733  me->setAxisTitle(_qy->name(), 2);
734  me->setAxisTitle(_qz->name(), 3);
735 
736  TH1 *h = me->getTH1();
737  _qx->setBits(h);
738  _qy->setBits(h);
739  _qz->setBits(h);
740 
741  std::vector<std::string> xlabels = _qx->getLabels();
742  std::vector<std::string> ylabels = _qy->getLabels();
743  for (unsigned int i = 0; i < xlabels.size(); i++) {
744  me->setBinLabel(i + 1, xlabels[i], 1);
745  }
746  for (unsigned int i = 0; i < ylabels.size(); i++) {
747  me->setBinLabel(i + 1, ylabels[i], 2);
748  }
749  }
750 
751  void Container2D::showOverflowZ(bool showOverflow) { _qz->showOverflow(showOverflow); }
752 } // namespace hcaldqm
void customize(MonitorElement *) override
Definition: Container2D.cc:731
virtual void setBits(TH1 *o)
Definition: Quantity.h:51
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
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
virtual int wofnbins()
Definition: Quantity.h:58
virtual std::vector< std::string > getLabels()
Definition: Quantity.h:62
virtual bool isTHash() const
Definition: HashMapper.h:56
virtual double max()
Definition: Quantity.h:60
void debug(STDTYPE const &msg) const
Definition: Logger.h:20
#define nullptr
TH1 * getTH1() const
~Container2D() override
Definition: Container2D.cc:19
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 std::string getHashTypeName() const
Definition: HashMapper.h:48
double getBinEntries(HcalDetId const &) override
Definition: Container2D.cc:102
quantity::Quantity * _qx
Definition: Container1D.h:237
virtual int getValue(HcalDetId const &)
Definition: Quantity.h:45
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
virtual uint32_t getBin(HcalDetId const &)
Definition: Quantity.h:39
std::vector< HcalGenericDetId > allPrecisionId() const
virtual void showOverflow(bool showOverflow)
Definition: Quantity.h:68
std::string _folder
Definition: Container.h:34
void showOverflowZ(bool showOverflow)
Definition: Container2D.cc:751
uint32_t getHash(HcalDetId const &did) const override
Definition: HashMapper.h:29
double getBinContent(HcalDetId const &) override
Definition: Container2D.cc:132
#define debug
Definition: HDRShower.cc:19
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
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:236
virtual double min()
Definition: Quantity.h:59
virtual bool isCoordinate()
Definition: Quantity.h:61
virtual bool isDHash() const
Definition: HashMapper.h:52
void setBinContent(HcalDetId const &, int) override
Definition: Container2D.cc:163
std::string _qname
Definition: Container.h:35
void fill(HcalDetId const &) override
Definition: Container2D.cc:52
virtual bool filter(HcalDetId const &) const
Definition: HashFilter.cc:24
virtual bool isEHash() const
Definition: HashMapper.h:53
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:558
quantity::Quantity * _qz
Definition: Container2D.h:172
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
quantity::Quantity * _qy
Definition: Container1D.h:238
Readout chain identification for Hcal.
std::vector< HcalTrigTowerDetId > allTriggerId() const
std::string getName(HcalDetId const &did) const override
Definition: HashMapper.h:39
ib
Definition: cuy.py:662