CMS 3D CMS Logo

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