CMS 3D CMS Logo

Container2D.cc
Go to the documentation of this file.
3 
4 namespace hcaldqm
5 {
6  using namespace constants;
7  using namespace quantity;
8  using namespace mapper;
9 
11  _qz(nullptr)
12  {}
13 
15  hashfunctions::HashType hashtype, Quantity *qx, Quantity *qy,
16  Quantity *qz) :
17  Container1D(folder, hashtype, qx, qy), _qz(qz)
18  {
22  }
23 
25  {
26  if (_qz!=nullptr)
27  delete _qz;
28  _qz = nullptr;
29  }
30 
31  /* virtual */ void Container2D::initialize(std::string const& folder,
32  hashfunctions::HashType hashtype,
33  Quantity *qx, Quantity *qy, Quantity *qz,
34  int debug/*=0*/)
35  {
37  qz->name()+"vs"+qy->name()+"vs"+qx->name(),
38  hashtype, qx, qy, debug);
39  _qz = qz;
42  _qz->setAxisType(quantity::fZAxis);
43  }
44 
45  /* virtual */ void Container2D::initialize(std::string const& folder,
46  std::string const& qname,
47  hashfunctions::HashType hashtype,
48  Quantity *qx, Quantity *qy, Quantity *qz,
49  int debug/*=0*/)
50  {
51  Container1D::initialize(folder, qname, hashtype, qx, qy, debug);
52  _qz = qz;
56  }
57 
58  /* virtual */ void Container2D::fill(HcalDetId const& did)
59  {
60  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
61  _qy->getValue(did));
62  }
63 
64  // HcalDetId based
65  /* virtual */ void Container2D::fill(HcalDetId const& did, int x)
66  {
67  if (_qx->isCoordinate() && _qy->isCoordinate())
68  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
69  _qy->getValue(did), x);
70  else if (_qx->isCoordinate())
71  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
72  _qy->getValue(x));
73  else if (_qy->isCoordinate())
74  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
75  _qy->getValue(did));
76  }
77 
78  /* virtual */ void Container2D::fill(HcalDetId const& did, double x)
79  {
80  if (_qx->isCoordinate() && _qy->isCoordinate())
81  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
82  _qy->getValue(did), x);
83  else if (_qx->isCoordinate())
84  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
85  _qy->getValue(x));
86  else if (_qy->isCoordinate())
87  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
88  _qy->getValue(did));
89  }
90 
91  /* virtual */ void Container2D::fill(HcalDetId const& did,
92  int x, double y)
93  {
94  if (_qx->isCoordinate() && !_qy->isCoordinate())
95  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
96  _qy->getValue(x), y);
97  else if (!_qx->isCoordinate() && _qy->isCoordinate())
98  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
99  _qy->getValue(did), y);
100  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
101  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
102  _qy->getValue(y));
103  }
104 
105  /* virtual */ void Container2D::fill(HcalDetId const& did,
106  int x, int y)
107  {
108  if (_qx->isCoordinate() && !_qy->isCoordinate())
109  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
110  _qy->getValue(x), y);
111  else if (!_qx->isCoordinate() && _qy->isCoordinate())
112  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
113  _qy->getValue(did), y);
114  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
115  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
116  _qy->getValue(y));
117  }
118 
119  /* virtual */ void Container2D::fill(HcalDetId const& did,
120  double x, double y)
121  {
122  if (_qx->isCoordinate() && !_qy->isCoordinate())
123  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
124  _qy->getValue(x), y);
125  else if (!_qx->isCoordinate() && _qy->isCoordinate())
126  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
127  _qy->getValue(did), y);
128  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
129  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
130  _qy->getValue(y));
131  }
132 
133  /* virtual */ double Container2D::getBinEntries(HcalDetId const&
134  id)
135  {
136  return _mes[_hashmap.getHash(id)]->getBinEntries(
137  _qx->getBin(id)+_qy->getBin(id)*_qx->wofnbins());
138  }
139 
140  /* virtual */ double Container2D::getBinEntries(HcalDetId const&
141  id, int x)
142  {
143  if (_qx->isCoordinate())
144  return _mes[_hashmap.getHash(id)]->getBinEntries(
145  _qx->getBin(id)+_qy->getBin(x)*_qx->wofnbins());
146  else
147  return _mes[_hashmap.getHash(id)]->getBinEntries(
148  _qx->getBin(x)+_qy->getBin(id)*_qx->wofnbins());
149  }
150 
151  /* virtual */ double Container2D::getBinEntries(HcalDetId const&
152  id, double x)
153  {
154  if (_qx->isCoordinate())
155  return _mes[_hashmap.getHash(id)]->getBinEntries(
156  _qx->getBin(id)+ _qy->getBin(x)*_qx->wofnbins());
157  else
158  return _mes[_hashmap.getHash(id)]->getBinEntries(
159  _qx->getBin(x)+_qy->getBin(id)*_qx->wofnbins());
160  }
161 
162  /* virtual */ double Container2D::getBinEntries(HcalDetId const&
163  id, int x, int y)
164  {
165  return _mes[_hashmap.getHash(id)]->getBinEntries(
166  _qx->getBin(x)+ _qy->getBin(y)*_qx->wofnbins());
167  }
168 
169  /* virtual */ double Container2D::getBinEntries(HcalDetId const&
170  id, int x, double y)
171  {
172  return _mes[_hashmap.getHash(id)]->getBinEntries(
173  _qx->getBin(x)+_qy->getBin(y)*_qx->wofnbins());
174  }
175 
176  /* virtual */ double Container2D::getBinEntries(HcalDetId const&
177  id, double x, double y)
178  {
179  return _mes[_hashmap.getHash(id)]->getBinEntries(
180  _qx->getBin(x)+ _qy->getBin(y)*_qx->wofnbins());
181  }
182 
183  /* virtual */ double Container2D::getBinContent(HcalDetId const&
184  id)
185  {
186  return _mes[_hashmap.getHash(id)]->getBinContent(
187  _qx->getBin(id), _qy->getBin(id));
188  }
189 
190  /* virtual */ double Container2D::getBinContent(HcalDetId const&
191  id, int x)
192  {
193  if (_qx->isCoordinate())
194  return _mes[_hashmap.getHash(id)]->getBinContent(
195  _qx->getBin(id), _qy->getBin(x));
196  else
197  return _mes[_hashmap.getHash(id)]->getBinContent(
198  _qx->getBin(x), _qy->getBin(id));
199  }
200 
201  /* virtual */ double Container2D::getBinContent(HcalDetId const&
202  id, double x)
203  {
204  if (_qx->isCoordinate())
205  return _mes[_hashmap.getHash(id)]->getBinContent(
206  _qx->getBin(id), _qy->getBin(x));
207  else
208  return _mes[_hashmap.getHash(id)]->getBinContent(
209  _qx->getBin(x), _qy->getBin(id));
210  }
211 
212  /* virtual */ double Container2D::getBinContent(HcalDetId const&
213  id, int x, int y)
214  {
215  return _mes[_hashmap.getHash(id)]->getBinContent(
216  _qx->getBin(x), _qy->getBin(y));
217  }
218 
219  /* virtual */ double Container2D::getBinContent(HcalDetId const&
220  id, int x, double y)
221  {
222  return _mes[_hashmap.getHash(id)]->getBinContent(
223  _qx->getBin(x), _qy->getBin(y));
224  }
225 
226  /* virtual */ double Container2D::getBinContent(HcalDetId const&
227  id, double x, double y)
228  {
229  return _mes[_hashmap.getHash(id)]->getBinContent(
230  _qx->getBin(x), _qy->getBin(y));
231  }
232 
233  // setBinContent
234  /* virtual */ void Container2D::setBinContent(HcalDetId const& id, int x)
235  {
236  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
237  _qy->getBin(id), x);
238  }
239  /* virtual */ void Container2D::setBinContent(HcalDetId const& id, double x)
240  {
241  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
242  _qy->getBin(id), x);
243  }
244  /* virtual */ void Container2D::setBinContent(HcalDetId const& id,
245  int x, int y)
246  {
247  if (_qx->isCoordinate())
248  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
249  _qy->getBin(x), y);
250  else
251  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
252  _qy->getBin(id), y);
253  }
254 
255  /* virtual */ void Container2D::setBinContent(HcalDetId const& id,
256  int x, double y)
257  {
258  if (_qx->isCoordinate())
259  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
260  _qy->getBin(x), y);
261  else
262  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
263  _qy->getBin(id), y);
264  }
265  /* virtual */ void Container2D::setBinContent(HcalDetId const& id,
266  double x, int y)
267  {
268  if (_qx->isCoordinate())
269  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
270  _qy->getBin(x), y);
271  else
272  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
273  _qy->getBin(id), y);
274  }
275  /* virtual */ void Container2D::setBinContent(HcalDetId const& id,
276  double x, double y)
277  {
278  if (_qx->isCoordinate())
279  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
280  _qy->getBin(x), y);
281  else
282  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
283  _qy->getBin(id), y);
284  }
285 
286  /* virtual */ void Container2D::setBinContent(HcalDetId const& id,
287  int x, int y, int z)
288  {
289  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
290  _qy->getBin(y), z);
291  }
292  /* virtual */ void Container2D::setBinContent(HcalDetId const& id,
293  int x, double y, int z)
294  {
295  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
296  _qy->getBin(y), z);
297  }
298  /* virtual */ void Container2D::setBinContent(HcalDetId const& id,
299  double x, int y, int z)
300  {
301  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
302  _qy->getBin(y), z);
303  }
304  /* virtual */ void Container2D::setBinContent(HcalDetId const& id,
305  double x, double y, int z)
306  {
307  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
308  _qy->getBin(y), z);
309  }
310  /* virtual */ void Container2D::setBinContent(HcalDetId const& id,
311  int x, int y, double z)
312  {
313  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
314  _qy->getBin(y), z);
315  }
316  /* virtual */ void Container2D::setBinContent(HcalDetId const& id,
317  int x, double y, double z)
318  {
319  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
320  _qy->getBin(y), z);
321  }
322  /* virtual */ void Container2D::setBinContent(HcalDetId const& id,
323  double x, int y, double z)
324  {
325  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
326  _qy->getBin(y), z);
327  }
328  /* virtual */ void Container2D::setBinContent(HcalDetId const& id,
329  double x, double y, double z)
330  {
331  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
332  _qy->getBin(y), z);
333  }
334 
335  // by ElectronicsId
336  /* virtual */ void Container2D::fill(HcalElectronicsId const& did)
337  {
338  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
339  _qy->getValue(did));
340  }
341 
342  /* virtual */ void Container2D::fill(HcalElectronicsId const& did, int x)
343  {
344  if (_qx->isCoordinate() && _qy->isCoordinate())
345  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
346  _qy->getValue(did), x);
347  else if (_qx->isCoordinate())
348  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
349  _qy->getValue(x));
350  else if (_qy->isCoordinate())
351  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
352  _qy->getValue(did));
353  }
354 
355  /* virtual */ void Container2D::fill(HcalElectronicsId const& did, double x)
356  {
357  if (_qx->isCoordinate() && _qy->isCoordinate())
358  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
359  _qy->getValue(did), x);
360  else if (_qx->isCoordinate())
361  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
362  _qy->getValue(x));
363  else if (_qy->isCoordinate())
364  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
365  _qy->getValue(did));
366  }
367 
368  /* virtual */ void Container2D::fill(HcalElectronicsId const& did,
369  int x, double y)
370  {
371  if (_qx->isCoordinate() && !_qy->isCoordinate())
372  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
373  _qy->getValue(x), y);
374  else if (!_qx->isCoordinate() && _qy->isCoordinate())
375  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
376  _qy->getValue(did), y);
377  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
378  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
379  _qy->getValue(y));
380  }
381 
382  /* virtual */ void Container2D::fill(HcalElectronicsId const& did,
383  int x, int y)
384  {
385  if (_qx->isCoordinate() && !_qy->isCoordinate())
386  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
387  _qy->getValue(x), y);
388  else if (!_qx->isCoordinate() && _qy->isCoordinate())
389  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
390  _qy->getValue(did), y);
391  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
392  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
393  _qy->getValue(y));
394  }
395 
396  /* virtual */ void Container2D::fill(HcalElectronicsId const& did,
397  double x, double y)
398  {
399  if (_qx->isCoordinate() && !_qy->isCoordinate())
400  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
401  _qy->getValue(x), y);
402  else if (!_qx->isCoordinate() && _qy->isCoordinate())
403  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
404  _qy->getValue(did), y);
405  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
406  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
407  _qy->getValue(y));
408  }
409 
410  /* virtual */ double Container2D::getBinEntries(HcalElectronicsId const&
411  id)
412  {
413  return _mes[_hashmap.getHash(id)]->getBinEntries(
414  _qx->getBin(id)+_qy->getBin(id)*_qx->wofnbins());
415 
416  }
417 
418  /* virtual */ double Container2D::getBinEntries(HcalElectronicsId const&
419  id, int x)
420  {
421  if (_qx->isCoordinate())
422  return _mes[_hashmap.getHash(id)]->getBinEntries(
423  _qx->getBin(id)+_qy->getBin(x)*_qx->wofnbins());
424  else
425  return _mes[_hashmap.getHash(id)]->getBinEntries(
426  _qx->getBin(x)+_qy->getBin(id)*_qx->wofnbins());
427  }
428 
429  /* virtual */ double Container2D::getBinEntries(HcalElectronicsId const&
430  id, double x)
431  {
432  if (_qx->isCoordinate())
433  return _mes[_hashmap.getHash(id)]->getBinEntries(
434  _qx->getBin(id)+ _qy->getBin(x)*_qx->wofnbins());
435  else
436  return _mes[_hashmap.getHash(id)]->getBinEntries(
437  _qx->getBin(x)+_qy->getBin(id)*_qx->wofnbins());
438  }
439 
440  /* virtual */ double Container2D::getBinEntries(HcalElectronicsId const&
441  id, int x, int y)
442  {
443  return _mes[_hashmap.getHash(id)]->getBinEntries(
444  _qx->getBin(x)+ _qy->getBin(y)*_qx->wofnbins());
445  }
446 
447  /* virtual */ double Container2D::getBinEntries(HcalElectronicsId const&
448  id, int x, double y)
449  {
450  return _mes[_hashmap.getHash(id)]->getBinEntries(
451  _qx->getBin(x)+_qy->getBin(y)*_qx->wofnbins());
452  }
453 
454  /* virtual */ double Container2D::getBinEntries(HcalElectronicsId const&
455  id, double x, double y)
456  {
457  return _mes[_hashmap.getHash(id)]->getBinEntries(
458  _qx->getBin(x)+ _qy->getBin(y)*_qx->wofnbins());
459  }
460 
461  /* virtual */ double Container2D::getBinContent(HcalElectronicsId const&
462  id)
463  {
464  return _mes[_hashmap.getHash(id)]->getBinContent(
465  _qx->getBin(id), _qy->getBin(id));
466  }
467 
468  /* virtual */ double Container2D::getBinContent(HcalElectronicsId const&
469  id, int x)
470  {
471  if (_qx->isCoordinate())
472  return _mes[_hashmap.getHash(id)]->getBinContent(
473  _qx->getBin(id), _qy->getBin(x));
474  else
475  return _mes[_hashmap.getHash(id)]->getBinContent(
476  _qx->getBin(x), _qy->getBin(id));
477  }
478 
479  /* virtual */ double Container2D::getBinContent(HcalElectronicsId const&
480  id, double x)
481  {
482  if (_qx->isCoordinate())
483  return _mes[_hashmap.getHash(id)]->getBinContent(
484  _qx->getBin(id), _qy->getBin(x));
485  else
486  return _mes[_hashmap.getHash(id)]->getBinContent(
487  _qx->getBin(x), _qy->getBin(id));
488  }
489 
490  /* virtual */ double Container2D::getBinContent(HcalElectronicsId const&
491  id, int x, int y)
492  {
493  return _mes[_hashmap.getHash(id)]->getBinContent(
494  _qx->getBin(x), _qy->getBin(y));
495  }
496 
497  /* virtual */ double Container2D::getBinContent(HcalElectronicsId const&
498  id, int x, double y)
499  {
500  return _mes[_hashmap.getHash(id)]->getBinContent(
501  _qx->getBin(x), _qy->getBin(y));
502  }
503 
504  /* virtual */ double Container2D::getBinContent(HcalElectronicsId const&
505  id, double x, double y)
506  {
507  return _mes[_hashmap.getHash(id)]->getBinContent(
508  _qx->getBin(x), _qy->getBin(y));
509  }
510 
511  // setBinContent
512  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const& id,
513  int x)
514  {
515  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
516  _qy->getBin(id), x);
517  }
518  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const& id, double x)
519  {
520  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
521  _qy->getBin(id), x);
522  }
523  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const& id,
524  int x, int y)
525  {
526  if (_qx->isCoordinate())
527  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
528  _qy->getBin(x), y);
529  else
530  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
531  _qy->getBin(id), y);
532  }
533 
534  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const& id,
535  int x, double y)
536  {
537  if (_qx->isCoordinate())
538  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
539  _qy->getBin(x), y);
540  else
541  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
542  _qy->getBin(id), y);
543  }
544  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const& id,
545  double x, int y)
546  {
547  if (_qx->isCoordinate())
548  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
549  _qy->getBin(x), y);
550  else
551  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
552  _qy->getBin(id), y);
553  }
554  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const& id,
555  double x, double y)
556  {
557  if (_qx->isCoordinate())
558  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
559  _qy->getBin(x), y);
560  else
561  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
562  _qy->getBin(id), y);
563  }
564 
565  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const& id,
566  int x, int y, int z)
567  {
568  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
569  _qy->getBin(y), z);
570  }
571  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const& id,
572  int x, double y, int z)
573  {
574  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
575  _qy->getBin(y), z);
576  }
577  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const& id,
578  double x, int y, int z)
579  {
580  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
581  _qy->getBin(y), z);
582  }
583  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const& id,
584  double x, double y, int z)
585  {
586  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
587  _qy->getBin(y), z);
588  }
589  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const& id,
590  int x, int y, double z)
591  {
592  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
593  _qy->getBin(y), z);
594  }
595  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const& id,
596  int x, double y, double z)
597  {
598  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
599  _qy->getBin(y), z);
600  }
601  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const& id,
602  double x, int y, double z)
603  {
604  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
605  _qy->getBin(y), z);
606  }
607  /* virtual */ void Container2D::setBinContent(HcalElectronicsId const& id,
608  double x, double y, double z)
609  {
610  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
611  _qy->getBin(y), z);
612  }
613 
614  // by TrigTowerDetId
615  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const& did)
616  {
617  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
618  _qy->getValue(did));
619  }
620 
621  // HcalDetId based
622  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const& did, int x)
623  {
624  if (_qx->isCoordinate() && _qy->isCoordinate())
625  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
626  _qy->getValue(did), x);
627  else if (_qx->isCoordinate())
628  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
629  _qy->getValue(x));
630  else if (_qy->isCoordinate())
631  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
632  _qy->getValue(did));
633  }
634 
635  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const& did,
636  double x)
637  {
638  if (_qx->isCoordinate() && _qy->isCoordinate())
639  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
640  _qy->getValue(did), x);
641  else if (_qx->isCoordinate())
642  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
643  _qy->getValue(x));
644  else if (_qy->isCoordinate())
645  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
646  _qy->getValue(did));
647  }
648 
649  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const& did,
650  int x, double y)
651  {
652  if (_qx->isCoordinate() && !_qy->isCoordinate())
653  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
654  _qy->getValue(x), y);
655  else if (!_qx->isCoordinate() && _qy->isCoordinate())
656  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
657  _qy->getValue(did), y);
658  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
659  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
660  _qy->getValue(y));
661  }
662 
663  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const& did,
664  int x, int y)
665  {
666  if (_qx->isCoordinate() && !_qy->isCoordinate())
667  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
668  _qy->getValue(x), y);
669  else if (!_qx->isCoordinate() && _qy->isCoordinate())
670  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
671  _qy->getValue(did), y);
672  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
673  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
674  _qy->getValue(y));
675  }
676 
677  /* virtual */ void Container2D::fill(HcalTrigTowerDetId const& did,
678  double x, double y)
679  {
680  if (_qx->isCoordinate() && !_qy->isCoordinate())
681  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
682  _qy->getValue(x), y);
683  else if (!_qx->isCoordinate() && _qy->isCoordinate())
684  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
685  _qy->getValue(did), y);
686  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
687  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
688  _qy->getValue(y));
689  }
690 
691  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const&
692  id)
693  {
694  return _mes[_hashmap.getHash(id)]->getBinEntries(
695  _qx->getBin(id)+_qy->getBin(id)*_qx->wofnbins());
696  }
697 
698  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const&
699  id, int x)
700  {
701  if (_qx->isCoordinate())
702  return _mes[_hashmap.getHash(id)]->getBinEntries(
703  _qx->getBin(id)+_qy->getBin(x)*_qx->wofnbins());
704  else
705  return _mes[_hashmap.getHash(id)]->getBinEntries(
706  _qx->getBin(x)+_qy->getBin(id)*_qx->wofnbins());
707  }
708 
709  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const&
710  id, double x)
711  {
712  if (_qx->isCoordinate())
713  return _mes[_hashmap.getHash(id)]->getBinEntries(
714  _qx->getBin(id)+ _qy->getBin(x)*_qx->wofnbins());
715  else
716  return _mes[_hashmap.getHash(id)]->getBinEntries(
717  _qx->getBin(x)+_qy->getBin(id)*_qx->wofnbins());
718  }
719 
720  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const&
721  id, int x, int y)
722  {
723  return _mes[_hashmap.getHash(id)]->getBinEntries(
724  _qx->getBin(x)+ _qy->getBin(y)*_qx->wofnbins());
725  }
726 
727  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const&
728  id, int x, double y)
729  {
730  return _mes[_hashmap.getHash(id)]->getBinEntries(
731  _qx->getBin(x)+_qy->getBin(y)*_qx->wofnbins());
732  }
733 
734  /* virtual */ double Container2D::getBinEntries(HcalTrigTowerDetId const&
735  id, double x, double y)
736  {
737  return _mes[_hashmap.getHash(id)]->getBinEntries(
738  _qx->getBin(x)+ _qy->getBin(y)*_qx->wofnbins());
739  }
740 
741  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const&
742  id)
743  {
744  return _mes[_hashmap.getHash(id)]->getBinContent(
745  _qx->getBin(id), _qy->getBin(id));
746  }
747 
748  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const&
749  id, int x)
750  {
751  if (_qx->isCoordinate())
752  return _mes[_hashmap.getHash(id)]->getBinContent(
753  _qx->getBin(id), _qy->getBin(x));
754  else
755  return _mes[_hashmap.getHash(id)]->getBinContent(
756  _qx->getBin(x), _qy->getBin(id));
757  }
758 
759  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const&
760  id, double x)
761  {
762  if (_qx->isCoordinate())
763  return _mes[_hashmap.getHash(id)]->getBinContent(
764  _qx->getBin(id), _qy->getBin(x));
765  else
766  return _mes[_hashmap.getHash(id)]->getBinContent(
767  _qx->getBin(x), _qy->getBin(id));
768  }
769 
770  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const&
771  id, int x, int y)
772  {
773  return _mes[_hashmap.getHash(id)]->getBinContent(
774  _qx->getBin(x), _qy->getBin(y));
775  }
776 
777  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const&
778  id, int x, double y)
779  {
780  return _mes[_hashmap.getHash(id)]->getBinContent(
781  _qx->getBin(x), _qy->getBin(y));
782  }
783 
784  /* virtual */ double Container2D::getBinContent(HcalTrigTowerDetId const&
785  id, double x, double y)
786  {
787  return _mes[_hashmap.getHash(id)]->getBinContent(
788  _qx->getBin(x), _qy->getBin(y));
789  }
790 
791  // setBinContent
792  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const& id, int x)
793  {
794  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
795  _qy->getBin(id), x);
796  }
797  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const& id, double x)
798  {
799  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
800  _qy->getBin(id), x);
801  }
802  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const& id,
803  int x, int y)
804  {
805  if (_qx->isCoordinate())
806  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
807  _qy->getBin(x), y);
808  else
809  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
810  _qy->getBin(id), y);
811  }
812 
813  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const& id,
814  int x, double y)
815  {
816  if (_qx->isCoordinate())
817  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
818  _qy->getBin(x), y);
819  else
820  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
821  _qy->getBin(id), y);
822  }
823  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const& id,
824  double x, int y)
825  {
826  if (_qx->isCoordinate())
827  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
828  _qy->getBin(x), y);
829  else
830  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
831  _qy->getBin(id), y);
832  }
833  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const& id,
834  double x, double y)
835  {
836  if (_qx->isCoordinate())
837  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(id),
838  _qy->getBin(x), y);
839  else
840  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
841  _qy->getBin(id), y);
842  }
843 
844  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const& id,
845  int x, int y, int z)
846  {
847  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
848  _qy->getBin(y), z);
849  }
850  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const& id,
851  int x, double y, int z)
852  {
853  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
854  _qy->getBin(y), z);
855  }
856  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const& id,
857  double x, int y, int z)
858  {
859  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
860  _qy->getBin(y), z);
861  }
862  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const& id,
863  double x, double y, int z)
864  {
865  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
866  _qy->getBin(y), z);
867  }
868  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const& id,
869  int x, int y, double z)
870  {
871  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
872  _qy->getBin(y), z);
873  }
874  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const& id,
875  int x, double y, double z)
876  {
877  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
878  _qy->getBin(y), z);
879  }
880  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const& id,
881  double x, int y, double z)
882  {
883  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
884  _qy->getBin(y), z);
885  }
886  /* virtual */ void Container2D::setBinContent(HcalTrigTowerDetId const& id,
887  double x, double y, double z)
888  {
889  _mes[_hashmap.getHash(id)]->setBinContent(_qx->getBin(x),
890  _qy->getBin(y), z);
891  }
892 
893  // booking
895  HcalElectronicsMap const *emap,
896  std::string subsystem, std::string aux)
897  {
898 
899  // full path as in Container1D.cc
900  //
901  ib.setCurrentFolder(subsystem+"/"+_folder+"/"+_qname+
902  (aux.empty()?aux:"_"+aux)+"/"+_hashmap.getHashTypeName());
903  if (_hashmap.isDHash())
904  {
905  // for Detector Hashes
906  std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
907  for (std::vector<HcalGenericDetId>::const_iterator it=
908  dids.begin(); it!=dids.end(); ++it)
909  {
910  // skip trigger towers and calib
911  if (!it->isHcalDetId())
912  continue;
913 
914  HcalDetId did = HcalDetId(it->rawId());
915  uint32_t hash = _hashmap.getHash(did);
916  MEMap::iterator mit = _mes.find(hash);
917  if (mit!=_mes.end())
918  continue;
919 
921  _mes.insert(
922  std::make_pair(hash, ib.book2D(_hashmap.getName(did),
923  _hashmap.getName(did), _qx->nbins(), _qx->min(),
924  _qx->max(), _qy->nbins(), _qy->min(), _qy->max())));
925  customize(_mes[hash]);
926  }
927  }
928  else if (_hashmap.isEHash())
929  {
930  // for Electronics hashes
931  std::vector<HcalElectronicsId> eids =
933  for (std::vector<HcalElectronicsId>::const_iterator it=
934  eids.begin(); it!=eids.end(); ++it)
935  {
936  HcalElectronicsId eid = HcalElectronicsId(it->rawId());
937  uint32_t hash = _hashmap.getHash(eid);
938  MEMap::iterator mit = _mes.find(hash);
939  if (mit!=_mes.end())
940  continue;
941 
943  _mes.insert(
944  std::make_pair(hash, ib.book2D(_hashmap.getName(eid),
945  _hashmap.getName(eid), _qx->nbins(), _qx->min(),
946  _qx->max(), _qy->nbins(), _qy->min(), _qy->max())));
947  customize(_mes[hash]);
948  }
949  }
950  else if (_hashmap.isTHash())
951  {
952  // for TrigTower hashes
953  std::vector<HcalTrigTowerDetId> tids =
954  emap->allTriggerId();
955  for (std::vector<HcalTrigTowerDetId>::const_iterator it=
956  tids.begin(); it!=tids.end(); ++it)
957  {
958  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
960  uint32_t hash = _hashmap.getHash(tid);
961  MEMap::iterator mit = _mes.find(hash);
962  if (mit!=_mes.end())
963  continue;
964 
966  _mes.insert(
967  std::make_pair(hash, ib.book2D(_hashmap.getName(tid),
968  _hashmap.getName(tid), _qx->nbins(), _qx->min(),
969  _qx->max(), _qy->nbins(), _qy->min(), _qy->max())));
970 
971  customize(_mes[hash]);
972  }
973  }
974  }
975 
977  HcalElectronicsMap const *emap, filter::HashFilter const& filter,
978  std::string subsystem, std::string aux)
979  {
980 
981  // full path as in Container1D.cc
982  //
983  ib.setCurrentFolder(subsystem+"/"+_folder+"/"+_qname+
984  (aux.empty()?aux:"_"+aux)+"/"+_hashmap.getHashTypeName());
985  if (_hashmap.isDHash())
986  {
987  // for Detector Hashes
988  std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
989  for (std::vector<HcalGenericDetId>::const_iterator it=
990  dids.begin(); it!=dids.end(); ++it)
991  {
992  // skip trigger towers and calib
993  if (!it->isHcalDetId())
994  continue;
995 
996  HcalDetId did = HcalDetId(it->rawId());
997  uint32_t hash = _hashmap.getHash(did);
998  MEMap::iterator mit = _mes.find(hash);
999  if (mit!=_mes.end())
1000  continue;
1001  if (filter.filter(did))
1002  continue;
1003 
1004  _logger.debug(_hashmap.getName(did));
1005  _mes.insert(
1006  std::make_pair(hash, ib.book2D(_hashmap.getName(did),
1007  _hashmap.getName(did), _qx->nbins(), _qx->min(),
1008  _qx->max(), _qy->nbins(), _qy->min(), _qy->max())));
1009  customize(_mes[hash]);
1010  }
1011  }
1012  else if (_hashmap.isEHash())
1013  {
1014  // for Electronics hashes
1015  std::vector<HcalElectronicsId> eids =
1016  emap->allElectronicsIdPrecision();
1017  for (std::vector<HcalElectronicsId>::const_iterator it=
1018  eids.begin(); it!=eids.end(); ++it)
1019  {
1020  HcalElectronicsId eid = HcalElectronicsId(it->rawId());
1021  uint32_t hash = _hashmap.getHash(eid);
1022  MEMap::iterator mit = _mes.find(hash);
1023  if (mit!=_mes.end())
1024  continue;
1025  if (filter.filter(eid))
1026  continue;
1027 
1028  _logger.debug(_hashmap.getName(eid));
1029  _mes.insert(
1030  std::make_pair(hash, ib.book2D(_hashmap.getName(eid),
1031  _hashmap.getName(eid), _qx->nbins(), _qx->min(),
1032  _qx->max(), _qy->nbins(), _qy->min(), _qy->max())));
1033  customize(_mes[hash]);
1034  }
1035  }
1036  else if (_hashmap.isTHash())
1037  {
1038  // for TrigTower hashes
1039  std::vector<HcalTrigTowerDetId> tids =
1040  emap->allTriggerId();
1041  for (std::vector<HcalTrigTowerDetId>::const_iterator it=
1042  tids.begin(); it!=tids.end(); ++it)
1043  {
1044  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
1045  _logger.debug(_hashmap.getName(tid));
1046  uint32_t hash = _hashmap.getHash(tid);
1047  MEMap::iterator mit = _mes.find(hash);
1048  if (mit!=_mes.end())
1049  continue;
1050  if (filter.filter(tid))
1051  continue;
1052 
1053  _logger.debug(_hashmap.getName(tid));
1054  _mes.insert(
1055  std::make_pair(hash, ib.book2D(_hashmap.getName(tid),
1056  _hashmap.getName(tid), _qx->nbins(), _qx->min(),
1057  _qx->max(), _qy->nbins(), _qy->min(), _qy->max())));
1058 
1059  customize(_mes[hash]);
1060  }
1061  }
1062  }
1063 
1064  /* virtual */ void Container2D::customize(MonitorElement* me)
1065  {
1066  me->setAxisTitle(_qx->name(), 1);
1067  me->setAxisTitle(_qy->name(), 2);
1068  me->setAxisTitle(_qz->name(), 3);
1069 
1070  TH1 *h = me->getTH1();
1071  _qx->setBits(h);
1072  _qy->setBits(h);
1073  _qz->setBits(h);
1074 
1075  std::vector<std::string> xlabels = _qx->getLabels();
1076  std::vector<std::string> ylabels = _qy->getLabels();
1077  for (unsigned int i=0; i<xlabels.size(); i++) {
1078  me->setBinLabel(i+1, xlabels[i], 1);
1079  }
1080  for (unsigned int i=0; i<ylabels.size(); i++) {
1081  me->setBinLabel(i+1, ylabels[i], 2);
1082  }
1083  }
1084 
1085  void Container2D::showOverflowZ(bool showOverflow) {
1086  _qz->showOverflow(showOverflow);
1087  }
1088 }
void customize(MonitorElement *) override
virtual void setBits(TH1 *o)
Definition: Quantity.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:40
virtual std::string name()
Definition: Quantity.h:47
virtual void setAxisType(AxisType at)
Definition: Quantity.h:49
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
virtual int wofnbins()
Definition: Quantity.h:74
virtual std::vector< std::string > getLabels()
Definition: Quantity.h:78
virtual bool isTHash() const
Definition: HashMapper.h:63
virtual double max()
Definition: Quantity.h:76
void debug(STDTYPE const &msg) const
Definition: Logger.h:31
TH1 * getTH1() const
~Container2D() override
Definition: Container2D.cc:24
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)
#define nullptr
virtual std::string getHashTypeName() const
Definition: HashMapper.h:50
double getBinEntries(HcalDetId const &) override
Definition: Container2D.cc:133
quantity::Quantity * _qx
Definition: Container1D.h:310
virtual int getValue(HcalDetId const &)
Definition: Quantity.h:59
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
virtual uint32_t getBin(HcalDetId const &)
Definition: Quantity.h:53
std::vector< HcalGenericDetId > allPrecisionId() const
virtual void showOverflow(bool showOverflow)
Definition: Quantity.h:85
std::string _folder
Definition: Container.h:42
void showOverflowZ(bool showOverflow)
uint32_t getHash(HcalDetId const &did) const override
Definition: HashMapper.h:33
double getBinContent(HcalDetId const &) override
Definition: Container2D.cc:183
#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:31
mapper::HashMapper _hashmap
Definition: Container1D.h:309
virtual double min()
Definition: Quantity.h:75
virtual bool isCoordinate()
Definition: Quantity.h:77
virtual bool isDHash() const
Definition: HashMapper.h:56
void setBinContent(HcalDetId const &, int) override
Definition: Container2D.cc:234
std::string _qname
Definition: Container.h:43
void fill(HcalDetId const &) override
Definition: Container2D.cc:58
virtual bool filter(HcalDetId const &) const
Definition: HashFilter.cc:38
virtual bool isEHash() const
Definition: HashMapper.h:58
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:894
quantity::Quantity * _qz
Definition: Container2D.h:173
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:311
Readout chain identification for Hcal.
std::vector< HcalTrigTowerDetId > allTriggerId() const
std::string getName(HcalDetId const &did) const override
Definition: HashMapper.h:42
ib
Definition: cuy.py:662