CMS 3D CMS Logo

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