CMS 3D CMS Logo

ContainerProf2D.cc
Go to the documentation of this file.
2 
3 namespace hcaldqm
4 {
5  using namespace mapper;
6  using namespace quantity;
7  using namespace constants;
8 
10  {
11  _qx = nullptr;
12  _qy = nullptr;
13  _qz = nullptr;
14  }
15 
17  hashfunctions::HashType hashtype, Quantity *qx, Quantity *qy,
18  Quantity *qz) :
19  Container2D(folder, hashtype, qx, qy, qz)
20  {
24  }
25 
26  /* virtual */ void ContainerProf2D::initialize(std::string const& folder,
27  hashfunctions::HashType hashtype, Quantity *qx, Quantity *qy,
28  Quantity *qz,
29  int debug/*=0*/)
30  {
31  Container2D::initialize(folder, hashtype, qx, qy, qz,debug);
35  }
36 
37  /* virtual */ void ContainerProf2D::initialize(std::string const& folder,
38  std::string const& qname,
39  hashfunctions::HashType hashtype, Quantity *qx, Quantity *qy,
40  Quantity *qz,
41  int debug/*=0*/)
42  {
43  Container2D::initialize(folder, qname, hashtype, qx, qy, qz,
44  debug);
48  }
49 
51  HcalElectronicsMap const *emap,
52  std::string subsystem, std::string aux)
53  {
54  // full path as in Container1D.cc
55  //
56  ib.setCurrentFolder(subsystem+"/"+_folder+"/"+_qname
57  +(aux.empty()?aux:"_"+aux)+"/"+_hashmap.getHashTypeName());
58  if (_hashmap.isDHash())
59  {
60  // for Detector Hashes
61  std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
62  for (std::vector<HcalGenericDetId>::const_iterator it=
63  dids.begin(); it!=dids.end(); ++it)
64  {
65  // skip trigger towers and calibration
66  if (!it->isHcalDetId())
67  continue;
68 
69  HcalDetId did = HcalDetId(it->rawId());
70  uint32_t hash = _hashmap.getHash(did);
71  MEMap::iterator mit = _mes.find(hash);
72  if (mit!=_mes.end())
73  continue;
74 
76  _mes.insert(
77  std::make_pair(hash, ib.bookProfile2D(
78  _hashmap.getName(did), _hashmap.getName(did),
79  _qx->nbins(), _qx->min(), _qx->max(),
80  _qy->nbins(), _qy->min(), _qy->max(),
81  _qz->min(), _qz->max())));
82  customize(_mes[hash]);
83  }
84  }
85  else if (_hashmap.isEHash())
86  {
87  // for Electronics hashes
88  std::vector<HcalElectronicsId> eids =
90  for (std::vector<HcalElectronicsId>::const_iterator it=
91  eids.begin(); it!=eids.end(); ++it)
92  {
94  uint32_t hash = _hashmap.getHash(eid);
95  MEMap::iterator mit = _mes.find(hash);
96  if (mit!=_mes.end())
97  continue;
98 
100  _mes.insert(
101  std::make_pair(hash, ib.bookProfile2D(
102  _hashmap.getName(eid), _hashmap.getName(eid),
103  _qx->nbins(), _qx->min(), _qx->max(),
104  _qy->nbins(), _qy->min(), _qy->max(),
105  _qz->min(), _qz->max())));
106  customize(_mes[hash]);
107  }
108  }
109  else if (_hashmap.isTHash())
110  {
111  // for TrigTower hashes
112  std::vector<HcalTrigTowerDetId> tids =
113  emap->allTriggerId();
114  for (std::vector<HcalTrigTowerDetId>::const_iterator it=
115  tids.begin(); it!=tids.end(); ++it)
116  {
117  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
118  uint32_t hash = _hashmap.getHash(tid);
119  MEMap::iterator mit = _mes.find(hash);
120  if (mit!=_mes.end())
121  continue;
122 
124  _mes.insert(
125  std::make_pair(hash, ib.bookProfile2D(
126  _hashmap.getName(tid), _hashmap.getName(tid),
127  _qx->nbins(), _qx->min(), _qx->max(),
128  _qy->nbins(), _qy->min(), _qy->max(),
129  _qz->min(), _qz->max())));
130  customize(_mes[hash]);
131  }
132  }
133  }
134 
136  HcalElectronicsMap const *emap, filter::HashFilter const& filter,
137  std::string subsystem, std::string aux)
138  {
139  // full path as in Container1D.cc
140  //
141  ib.setCurrentFolder(subsystem+"/"+_folder+"/"+_qname
142  +(aux.empty()?aux:"_"+aux)+"/"+_hashmap.getHashTypeName());
143  if (_hashmap.isDHash())
144  {
145  // for Detector Hashes
146  std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
147  for (std::vector<HcalGenericDetId>::const_iterator it=
148  dids.begin(); it!=dids.end(); ++it)
149  {
150  // skip trigger towers and calibration
151  if (!it->isHcalDetId())
152  continue;
153 
154  HcalDetId did = HcalDetId(it->rawId());
155  uint32_t hash = _hashmap.getHash(did);
156  MEMap::iterator mit = _mes.find(hash);
157  if (mit!=_mes.end())
158  continue;
159  if (filter.filter(did))
160  continue;
161 
163  _mes.insert(
164  std::make_pair(hash, ib.bookProfile2D(
165  _hashmap.getName(did), _hashmap.getName(did),
166  _qx->nbins(), _qx->min(), _qx->max(),
167  _qy->nbins(), _qy->min(), _qy->max(),
168  _qz->min(), _qz->max())));
169  customize(_mes[hash]);
170  }
171  }
172  else if (_hashmap.isEHash())
173  {
174  // for Electronics hashes
175  std::vector<HcalElectronicsId> eids =
177  for (std::vector<HcalElectronicsId>::const_iterator it=
178  eids.begin(); it!=eids.end(); ++it)
179  {
180  HcalElectronicsId eid = HcalElectronicsId(it->rawId());
181  uint32_t hash = _hashmap.getHash(eid);
182  MEMap::iterator mit = _mes.find(hash);
183  if (mit!=_mes.end())
184  continue;
185  if (filter.filter(eid))
186  continue;
187 
189  _mes.insert(
190  std::make_pair(hash, ib.bookProfile2D(
191  _hashmap.getName(eid), _hashmap.getName(eid),
192  _qx->nbins(), _qx->min(), _qx->max(),
193  _qy->nbins(), _qy->min(), _qy->max(),
194  _qz->min(), _qz->max())));
195  customize(_mes[hash]);
196  }
197  }
198  else if (_hashmap.isTHash())
199  {
200  // for TrigTower hashes
201  std::vector<HcalTrigTowerDetId> tids =
202  emap->allTriggerId();
203  for (std::vector<HcalTrigTowerDetId>::const_iterator it=
204  tids.begin(); it!=tids.end(); ++it)
205  {
206  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
207  uint32_t hash = _hashmap.getHash(tid);
208  MEMap::iterator mit = _mes.find(hash);
209  if (mit!=_mes.end())
210  continue;
211  if (filter.filter(tid))
212  continue;
213 
215  _mes.insert(
216  std::make_pair(hash, ib.bookProfile2D(
217  _hashmap.getName(tid), _hashmap.getName(tid),
218  _qx->nbins(), _qx->min(), _qx->max(),
219  _qy->nbins(), _qy->min(), _qy->max(),
220  _qz->min(), _qz->max())));
221  customize(_mes[hash]);
222  }
223  }
224  }
225 
226  /* virtual */ void ContainerProf2D::fill(HcalDetId const& did)
227  {
228  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
229  _qy->getValue(did));
230  }
231 
232  // HcalDetId based
233  /* virtual */ void ContainerProf2D::fill(HcalDetId const& did, int x)
234  {
235  if (_qx->isCoordinate() && _qy->isCoordinate())
236  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
237  _qy->getValue(did), x);
238  else if (_qx->isCoordinate())
239  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
240  _qy->getValue(x));
241  else if (_qy->isCoordinate())
242  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
243  _qy->getValue(did));
244  }
245 
246  /* virtual */ void ContainerProf2D::fill(HcalDetId const& did, double x)
247  {
248  if (_qx->isCoordinate() && _qy->isCoordinate())
249  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
250  _qy->getValue(did), x);
251  else if (_qx->isCoordinate())
252  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
253  _qy->getValue(x));
254  else if (_qy->isCoordinate())
255  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
256  _qy->getValue(did));
257  }
258 
259  /* virtual */ void ContainerProf2D::fill(HcalDetId const& did,
260  int x, double y)
261  {
262  if (_qx->isCoordinate() && !_qy->isCoordinate())
263  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
264  _qy->getValue(x), y);
265  else if (!_qx->isCoordinate() && _qy->isCoordinate())
266  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
267  _qy->getValue(did), y);
268  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
269  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
270  _qy->getValue(y));
271  }
272 
273  /* virtual */ void ContainerProf2D::fill(HcalDetId const& did,
274  int x, int y)
275  {
276  if (_qx->isCoordinate() && !_qy->isCoordinate())
277  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
278  _qy->getValue(x), y);
279  else if (!_qx->isCoordinate() && _qy->isCoordinate())
280  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
281  _qy->getValue(did), y);
282  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
283  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
284  _qy->getValue(y));
285  }
286 
287  /* virtual */ void ContainerProf2D::fill(HcalDetId const& did,
288  double x, double y)
289  {
290  if (_qx->isCoordinate() && !_qy->isCoordinate())
291  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
292  _qy->getValue(x), y);
293  else if (!_qx->isCoordinate() && _qy->isCoordinate())
294  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
295  _qy->getValue(did), y);
296  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
297  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
298  _qy->getValue(y));
299  }
300 
301  /* virtual */ void ContainerProf2D::fill(HcalElectronicsId const& did)
302  {
303  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
304  _qy->getValue(did));
305  }
306 
307  /* virtual */ void ContainerProf2D::fill(HcalElectronicsId const& did, int x)
308  {
309  if (_qx->isCoordinate() && _qy->isCoordinate())
310  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
311  _qy->getValue(did), x);
312  else if (_qx->isCoordinate())
313  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
314  _qy->getValue(x));
315  else if (_qy->isCoordinate())
316  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
317  _qy->getValue(did));
318  }
319 
320  /* virtual */ void ContainerProf2D::fill(HcalElectronicsId const& did, double x)
321  {
322  if (_qx->isCoordinate() && _qy->isCoordinate())
323  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
324  _qy->getValue(did), x);
325  else if (_qx->isCoordinate())
326  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
327  _qy->getValue(x));
328  else if (_qy->isCoordinate())
329  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
330  _qy->getValue(did));
331  }
332 
333  /* virtual */ void ContainerProf2D::fill(HcalElectronicsId const& did,
334  int x, double y)
335  {
336  if (_qx->isCoordinate() && !_qy->isCoordinate())
337  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
338  _qy->getValue(x), y);
339  else if (!_qx->isCoordinate() && _qy->isCoordinate())
340  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
341  _qy->getValue(did), y);
342  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
343  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
344  _qy->getValue(y));
345  }
346 
347  /* virtual */ void ContainerProf2D::fill(HcalElectronicsId const& did,
348  int x, int y)
349  {
350  if (_qx->isCoordinate() && !_qy->isCoordinate())
351  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
352  _qy->getValue(x), y);
353  else if (!_qx->isCoordinate() && _qy->isCoordinate())
354  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
355  _qy->getValue(did), y);
356  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
357  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
358  _qy->getValue(y));
359  }
360 
361  /* virtual */ void ContainerProf2D::fill(HcalElectronicsId const& did,
362  double x, double y)
363  {
364  if (_qx->isCoordinate() && !_qy->isCoordinate())
365  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
366  _qy->getValue(x), y);
367  else if (!_qx->isCoordinate() && _qy->isCoordinate())
368  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
369  _qy->getValue(did), y);
370  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
371  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
372  _qy->getValue(y));
373  }
374 
375  /* virtual */ void ContainerProf2D::fill(HcalTrigTowerDetId const& did)
376  {
377  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
378  _qy->getValue(did));
379  }
380 
381  // HcalDetId based
382  /* virtual */ void ContainerProf2D::fill(HcalTrigTowerDetId const& did, int x)
383  {
384  if (_qx->isCoordinate() && _qy->isCoordinate())
385  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
386  _qy->getValue(did), x);
387  else if (_qx->isCoordinate())
388  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
389  _qy->getValue(x));
390  else if (_qy->isCoordinate())
391  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
392  _qy->getValue(did));
393  }
394 
395  /* virtual */ void ContainerProf2D::fill(HcalTrigTowerDetId const& did,
396  double x)
397  {
398  if (_qx->isCoordinate() && _qy->isCoordinate())
399  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
400  _qy->getValue(did), x);
401  else if (_qx->isCoordinate())
402  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
403  _qy->getValue(x));
404  else if (_qy->isCoordinate())
405  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
406  _qy->getValue(did));
407  }
408 
409  /* virtual */ void ContainerProf2D::fill(HcalTrigTowerDetId const& did,
410  int x, double y)
411  {
412  if (_qx->isCoordinate() && !_qy->isCoordinate())
413  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
414  _qy->getValue(x), y);
415  else if (!_qx->isCoordinate() && _qy->isCoordinate())
416  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
417  _qy->getValue(did), y);
418  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
419  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
420  _qy->getValue(y));
421  }
422 
423  /* virtual */ void ContainerProf2D::fill(HcalTrigTowerDetId const& did,
424  int x, int y)
425  {
426  if (_qx->isCoordinate() && !_qy->isCoordinate())
427  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
428  _qy->getValue(x), y);
429  else if (!_qx->isCoordinate() && _qy->isCoordinate())
430  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
431  _qy->getValue(did), y);
432  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
433  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
434  _qy->getValue(y));
435  }
436 
437  /* virtual */ void ContainerProf2D::fill(HcalTrigTowerDetId const& did,
438  double x, double y)
439  {
440  if (_qx->isCoordinate() && !_qy->isCoordinate())
441  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did),
442  _qy->getValue(x), y);
443  else if (!_qx->isCoordinate() && _qy->isCoordinate())
444  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
445  _qy->getValue(did), y);
446  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
447  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x),
448  _qy->getValue(y));
449  }
450 
451  /* virtual */ void ContainerProf2D::fill(HcalDetId const& did,
452  double x, double y, double z)
453  {
454  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y), _qz->getValue(z));
455  }
456 
457  /* virtual */ void ContainerProf2D::fill(HcalElectronicsId const& eid,
458  double x, double y, double z)
459  {
460  _mes[_hashmap.getHash(eid)]->Fill(_qx->getValue(x), _qy->getValue(y), _qz->getValue(z));
461  }
462 
463  /* virtual */ void ContainerProf2D::fill(HcalTrigTowerDetId const& tid,
464  double x, double y, double z)
465  {
466  _mes[_hashmap.getHash(tid)]->Fill(_qx->getValue(x), _qy->getValue(y), _qz->getValue(z));
467  }
468 
469 }
void customize(MonitorElement *) override
virtual void setAxisType(AxisType at)
Definition: Quantity.h:49
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
void fill(HcalDetId const &) override
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
virtual std::string getHashTypeName() const
Definition: HashMapper.h:50
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
MonitorElement * bookProfile2D(Args &&...args)
Definition: DQMStore.h:114
std::vector< HcalGenericDetId > allPrecisionId() const
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 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:310
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
virtual double min()
Definition: Quantity.h:75
virtual bool isCoordinate()
Definition: Quantity.h:77
virtual bool isDHash() const
Definition: HashMapper.h:56
void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fEnergy), int debug=0) override
std::string _qname
Definition: Container.h:43
virtual bool filter(HcalDetId const &) const
Definition: HashFilter.cc:38
virtual bool isEHash() const
Definition: HashMapper.h:58
quantity::Quantity * _qz
Definition: Container2D.h:173
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
ib
Definition: cuy.py:662