CMS 3D CMS Logo

ContainerProf2D.cc
Go to the documentation of this file.
2 
3 namespace hcaldqm {
4  using namespace mapper;
5  using namespace quantity;
6  using namespace constants;
7 
9  _qx = nullptr;
10  _qy = nullptr;
11  _qz = nullptr;
12  }
13 
15  std::string const &folder, hashfunctions::HashType hashtype, Quantity *qx, Quantity *qy, Quantity *qz)
16  : Container2D(folder, hashtype, qx, qy, qz) {
20  }
21 
22  /* virtual */ void ContainerProf2D::initialize(std::string const &folder,
23  hashfunctions::HashType hashtype,
24  Quantity *qx,
25  Quantity *qy,
26  Quantity *qz,
27  int debug /*=0*/) {
28  Container2D::initialize(folder, hashtype, qx, qy, qz, debug);
32  }
33 
34  /* virtual */ void ContainerProf2D::initialize(std::string const &folder,
35  std::string const &qname,
36  hashfunctions::HashType hashtype,
37  Quantity *qx,
38  Quantity *qy,
39  Quantity *qz,
40  int debug /*=0*/) {
41  Container2D::initialize(folder, qname, hashtype, qx, qy, qz, debug);
45  }
46 
48  HcalElectronicsMap const *emap,
50  std::string aux) {
51  // full path as in Container1D.cc
52  //
53  ib.setCurrentFolder(subsystem + "/" + _folder + "/" + _qname + (aux.empty() ? aux : "_" + aux) + "/" +
55  if (_hashmap.isDHash()) {
56  // for Detector Hashes
57  std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
58  for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
59  // skip trigger towers and calibration
60  if (!it->isHcalDetId())
61  continue;
62 
63  HcalDetId did = HcalDetId(it->rawId());
64  uint32_t hash = _hashmap.getHash(did);
65  MEMap::iterator mit = _mes.find(hash);
66  if (mit != _mes.end())
67  continue;
68 
70  _mes.insert(std::make_pair(hash,
72  _hashmap.getName(did),
73  _qx->nbins(),
74  _qx->min(),
75  _qx->max(),
76  _qy->nbins(),
77  _qy->min(),
78  _qy->max(),
79  _qz->min(),
80  _qz->max())));
81  customize(_mes[hash]);
82  }
83  } else if (_hashmap.isEHash()) {
84  // for Electronics hashes
85  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
86  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
88  uint32_t hash = _hashmap.getHash(eid);
89  MEMap::iterator mit = _mes.find(hash);
90  if (mit != _mes.end())
91  continue;
92 
94  _mes.insert(std::make_pair(hash,
96  _hashmap.getName(eid),
97  _qx->nbins(),
98  _qx->min(),
99  _qx->max(),
100  _qy->nbins(),
101  _qy->min(),
102  _qy->max(),
103  _qz->min(),
104  _qz->max())));
105  customize(_mes[hash]);
106  }
107  } else if (_hashmap.isTHash()) {
108  // for TrigTower hashes
109  std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
110  for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
111  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
112  uint32_t hash = _hashmap.getHash(tid);
113  MEMap::iterator mit = _mes.find(hash);
114  if (mit != _mes.end())
115  continue;
116 
118  _mes.insert(std::make_pair(hash,
120  _hashmap.getName(tid),
121  _qx->nbins(),
122  _qx->min(),
123  _qx->max(),
124  _qy->nbins(),
125  _qy->min(),
126  _qy->max(),
127  _qz->min(),
128  _qz->max())));
129  customize(_mes[hash]);
130  }
131  }
132  }
133 
135  HcalElectronicsMap const *emap,
136  filter::HashFilter const &filter,
138  std::string aux) {
139  // full path as in Container1D.cc
140  //
141  ib.setCurrentFolder(subsystem + "/" + _folder + "/" + _qname + (aux.empty() ? aux : "_" + aux) + "/" +
143  if (_hashmap.isDHash()) {
144  // for Detector Hashes
145  std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
146  for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
147  // skip trigger towers and calibration
148  if (!it->isHcalDetId())
149  continue;
150 
151  HcalDetId did = HcalDetId(it->rawId());
152  uint32_t hash = _hashmap.getHash(did);
153  MEMap::iterator mit = _mes.find(hash);
154  if (mit != _mes.end())
155  continue;
156  if (filter.filter(did))
157  continue;
158 
160  _mes.insert(std::make_pair(hash,
162  _hashmap.getName(did),
163  _qx->nbins(),
164  _qx->min(),
165  _qx->max(),
166  _qy->nbins(),
167  _qy->min(),
168  _qy->max(),
169  _qz->min(),
170  _qz->max())));
171  customize(_mes[hash]);
172  }
173  } else if (_hashmap.isEHash()) {
174  // for Electronics hashes
175  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
176  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
177  HcalElectronicsId eid = HcalElectronicsId(it->rawId());
178  uint32_t hash = _hashmap.getHash(eid);
179  MEMap::iterator mit = _mes.find(hash);
180  if (mit != _mes.end())
181  continue;
182  if (filter.filter(eid))
183  continue;
184 
186  _mes.insert(std::make_pair(hash,
188  _hashmap.getName(eid),
189  _qx->nbins(),
190  _qx->min(),
191  _qx->max(),
192  _qy->nbins(),
193  _qy->min(),
194  _qy->max(),
195  _qz->min(),
196  _qz->max())));
197  customize(_mes[hash]);
198  }
199  } else if (_hashmap.isTHash()) {
200  // for TrigTower hashes
201  std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
202  for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
203  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
204  uint32_t hash = _hashmap.getHash(tid);
205  MEMap::iterator mit = _mes.find(hash);
206  if (mit != _mes.end())
207  continue;
208  if (filter.filter(tid))
209  continue;
210 
212  _mes.insert(std::make_pair(hash,
214  _hashmap.getName(tid),
215  _qx->nbins(),
216  _qx->min(),
217  _qx->max(),
218  _qy->nbins(),
219  _qy->min(),
220  _qy->max(),
221  _qz->min(),
222  _qz->max())));
223  customize(_mes[hash]);
224  }
225  }
226  }
227 
228  /* virtual */ void ContainerProf2D::fill(HcalDetId const &did) {
229  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did));
230  }
231 
232  // HcalDetId based
233  /* virtual */ void ContainerProf2D::fill(HcalDetId const &did, int x) {
234  if (_qx->isCoordinate() && _qy->isCoordinate())
235  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did), x);
236  else if (_qx->isCoordinate())
237  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
238  else if (_qy->isCoordinate())
239  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did));
240  }
241 
242  /* virtual */ void ContainerProf2D::fill(HcalDetId const &did, double x) {
243  if (_qx->isCoordinate() && _qy->isCoordinate())
244  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did), x);
245  else if (_qx->isCoordinate())
246  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
247  else if (_qy->isCoordinate())
248  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did));
249  }
250 
251  /* virtual */ void ContainerProf2D::fill(HcalDetId const &did, int x, double y) {
252  if (_qx->isCoordinate() && !_qy->isCoordinate())
253  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
254  else if (!_qx->isCoordinate() && _qy->isCoordinate())
255  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
256  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
257  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
258  }
259 
260  /* virtual */ void ContainerProf2D::fill(HcalDetId const &did, int x, int y) {
261  if (_qx->isCoordinate() && !_qy->isCoordinate())
262  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
263  else if (!_qx->isCoordinate() && _qy->isCoordinate())
264  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
265  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
266  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
267  }
268 
269  /* virtual */ void ContainerProf2D::fill(HcalDetId const &did, double x, double y) {
270  if (_qx->isCoordinate() && !_qy->isCoordinate())
271  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
272  else if (!_qx->isCoordinate() && _qy->isCoordinate())
273  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
274  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
275  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
276  }
277 
278  /* virtual */ void ContainerProf2D::fill(HcalElectronicsId const &did) {
279  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did));
280  }
281 
282  /* virtual */ void ContainerProf2D::fill(HcalElectronicsId const &did, int x) {
283  if (_qx->isCoordinate() && _qy->isCoordinate())
284  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did), x);
285  else if (_qx->isCoordinate())
286  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
287  else if (_qy->isCoordinate())
288  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did));
289  }
290 
291  /* virtual */ void ContainerProf2D::fill(HcalElectronicsId const &did, double x) {
292  if (_qx->isCoordinate() && _qy->isCoordinate())
293  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did), x);
294  else if (_qx->isCoordinate())
295  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
296  else if (_qy->isCoordinate())
297  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did));
298  }
299 
300  /* virtual */ void ContainerProf2D::fill(HcalElectronicsId const &did, int x, double y) {
301  if (_qx->isCoordinate() && !_qy->isCoordinate())
302  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
303  else if (!_qx->isCoordinate() && _qy->isCoordinate())
304  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
305  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
306  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
307  }
308 
309  /* virtual */ void ContainerProf2D::fill(HcalElectronicsId const &did, int x, int y) {
310  if (_qx->isCoordinate() && !_qy->isCoordinate())
311  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
312  else if (!_qx->isCoordinate() && _qy->isCoordinate())
313  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
314  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
315  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
316  }
317 
318  /* virtual */ void ContainerProf2D::fill(HcalElectronicsId const &did, double x, double y) {
319  if (_qx->isCoordinate() && !_qy->isCoordinate())
320  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
321  else if (!_qx->isCoordinate() && _qy->isCoordinate())
322  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
323  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
324  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
325  }
326 
327  /* virtual */ void ContainerProf2D::fill(HcalTrigTowerDetId const &did) {
328  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did));
329  }
330 
331  // HcalDetId based
332  /* virtual */ void ContainerProf2D::fill(HcalTrigTowerDetId const &did, int x) {
333  if (_qx->isCoordinate() && _qy->isCoordinate())
334  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did), x);
335  else if (_qx->isCoordinate())
336  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
337  else if (_qy->isCoordinate())
338  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did));
339  }
340 
341  /* virtual */ void ContainerProf2D::fill(HcalTrigTowerDetId const &did, double x) {
342  if (_qx->isCoordinate() && _qy->isCoordinate())
343  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(did), x);
344  else if (_qx->isCoordinate())
345  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x));
346  else if (_qy->isCoordinate())
347  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did));
348  }
349 
350  /* virtual */ void ContainerProf2D::fill(HcalTrigTowerDetId const &did, int x, double y) {
351  if (_qx->isCoordinate() && !_qy->isCoordinate())
352  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
353  else if (!_qx->isCoordinate() && _qy->isCoordinate())
354  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
355  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
356  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
357  }
358 
359  /* virtual */ void ContainerProf2D::fill(HcalTrigTowerDetId const &did, int x, int y) {
360  if (_qx->isCoordinate() && !_qy->isCoordinate())
361  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
362  else if (!_qx->isCoordinate() && _qy->isCoordinate())
363  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
364  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
365  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
366  }
367 
368  /* virtual */ void ContainerProf2D::fill(HcalTrigTowerDetId const &did, double x, double y) {
369  if (_qx->isCoordinate() && !_qy->isCoordinate())
370  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(did), _qy->getValue(x), y);
371  else if (!_qx->isCoordinate() && _qy->isCoordinate())
372  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(did), y);
373  else if (!_qx->isCoordinate() && !_qy->isCoordinate())
374  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y));
375  }
376 
377  /* virtual */ void ContainerProf2D::fill(HcalDetId const &did, double x, double y, double z) {
378  _mes[_hashmap.getHash(did)]->Fill(_qx->getValue(x), _qy->getValue(y), _qz->getValue(z));
379  }
380 
381  /* virtual */ void ContainerProf2D::fill(HcalElectronicsId const &eid, double x, double y, double z) {
382  _mes[_hashmap.getHash(eid)]->Fill(_qx->getValue(x), _qy->getValue(y), _qz->getValue(z));
383  }
384 
385  /* virtual */ void ContainerProf2D::fill(HcalTrigTowerDetId const &tid, double x, double y, double z) {
386  _mes[_hashmap.getHash(tid)]->Fill(_qx->getValue(x), _qy->getValue(y), _qz->getValue(z));
387  }
388 
389 } // namespace hcaldqm
void customize(MonitorElement *) override
Definition: Container2D.cc:731
virtual void setAxisType(AxisType at)
Definition: Quantity.h:36
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
void fill(HcalDetId const &) override
virtual bool isTHash() const
Definition: HashMapper.h:56
virtual double max()
Definition: Quantity.h:60
void debug(STDTYPE const &msg) const
Definition: Logger.h:20
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
virtual std::string getHashTypeName() const
Definition: HashMapper.h:48
quantity::Quantity * _qx
Definition: Container1D.h:237
virtual int getValue(HcalDetId const &)
Definition: Quantity.h:45
std::vector< HcalGenericDetId > allPrecisionId() const
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s")
Definition: DQMStore.cc:381
std::string _folder
Definition: Container.h:37
uint32_t getHash(HcalDetId const &did) const override
Definition: HashMapper.h:29
#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:25
mapper::HashMapper _hashmap
Definition: Container1D.h:236
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
virtual double min()
Definition: Quantity.h:59
virtual bool isCoordinate()
Definition: Quantity.h:61
virtual bool isDHash() const
Definition: HashMapper.h:52
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:38
virtual bool filter(HcalDetId const &) const
Definition: HashFilter.cc:24
virtual bool isEHash() const
Definition: HashMapper.h:53
quantity::Quantity * _qz
Definition: Container2D.h:172
quantity::Quantity * _qy
Definition: Container1D.h:238
Readout chain identification for Hcal.
std::vector< HcalTrigTowerDetId > allTriggerId() const
std::string getName(HcalDetId const &did) const override
Definition: HashMapper.h:39
ib
Definition: cuy.py:662