CMS 3D CMS Logo

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