CMS 3D CMS Logo

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