CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Types | Protected Attributes
hcaldqm::ContainerXXX< STDTYPE > Class Template Reference

#include <ContainerXXX.h>

Public Member Functions

virtual CompactMap::const_iterator begin ()
 
virtual void book (HcalElectronicsMap const *)
 
virtual void book (HcalElectronicsMap const *, filter::HashFilter const &)
 
 ContainerXXX ()
 
 ContainerXXX (hashfunctions::HashType ht)
 
 ContainerXXX (ContainerXXX const &x)
 
virtual void dump (Container1D *)
 
virtual void dump (std::vector< Container1D *> const &)
 
virtual CompactMap::const_iterator end ()
 
virtual bool exists (HcalDetId const &)
 
virtual bool exists (HcalElectronicsId const &)
 
virtual bool exists (HcalTrigTowerDetId const &)
 
virtual STDTYPE & get (HcalDetId const &)
 
virtual STDTYPE & get (HcalElectronicsId const &)
 
virtual STDTYPE & get (HcalTrigTowerDetId const &)
 
virtual void initialize (hashfunctions::HashType, int debug=0)
 
virtual void load (Container1D *)
 
ContainerXXXoperator= (const ContainerXXX &other)=default
 
virtual void print ()
 
virtual void push (HcalDetId const &, STDTYPE)
 
virtual void push (HcalElectronicsId const &, STDTYPE)
 
virtual void push (HcalTrigTowerDetId const &, STDTYPE)
 
virtual void reset ()
 
virtual void set (HcalDetId const &, STDTYPE)
 
virtual void set (HcalElectronicsId const &, STDTYPE)
 
virtual void set (HcalTrigTowerDetId const &, STDTYPE)
 
virtual uint32_t size ()
 
virtual ~ContainerXXX ()
 

Protected Types

typedef std::unordered_map< uint32_t, STDTYPE > CompactMap
 

Protected Attributes

CompactMap _cmap
 
mapper::HashMapper _hashmap
 
Logger _logger
 

Detailed Description

template<typename STDTYPE>
class hcaldqm::ContainerXXX< STDTYPE >

Definition at line 20 of file ContainerXXX.h.

Member Typedef Documentation

◆ CompactMap

template<typename STDTYPE>
typedef std::unordered_map<uint32_t, STDTYPE> hcaldqm::ContainerXXX< STDTYPE >::CompactMap
protected

Definition at line 64 of file ContainerXXX.h.

Constructor & Destructor Documentation

◆ ContainerXXX() [1/3]

template<typename STDTYPE>
hcaldqm::ContainerXXX< STDTYPE >::ContainerXXX ( )
inline

Definition at line 22 of file ContainerXXX.h.

22 {}

◆ ContainerXXX() [2/3]

template<typename STDTYPE>
hcaldqm::ContainerXXX< STDTYPE >::ContainerXXX ( hashfunctions::HashType  ht)
inline

Definition at line 23 of file ContainerXXX.h.

23 : _hashmap(ht) {}
mapper::HashMapper _hashmap
Definition: ContainerXXX.h:66

◆ ContainerXXX() [3/3]

template<typename STDTYPE >
hcaldqm::ContainerXXX< STDTYPE >::ContainerXXX ( ContainerXXX< STDTYPE > const &  x)

Definition at line 75 of file ContainerXXX.h.

75  {
76  for (auto &p : _cmap) {
77  _cmap.insert(std::make_pair(p.first, p.second));
78  }
79  }

◆ ~ContainerXXX()

template<typename STDTYPE>
virtual hcaldqm::ContainerXXX< STDTYPE >::~ContainerXXX ( )
inlinevirtual

Definition at line 26 of file ContainerXXX.h.

26 { _cmap.clear(); }

Member Function Documentation

◆ begin()

template<typename STDTYPE>
virtual CompactMap::const_iterator hcaldqm::ContainerXXX< STDTYPE >::begin ( void  )
inlinevirtual

◆ book() [1/2]

template<typename STDTYPE >
void hcaldqm::ContainerXXX< STDTYPE >::book ( HcalElectronicsMap const *  emap)
virtual

Definition at line 88 of file ContainerXXX.h.

Referenced by hcaldqm::RawRunSummary::beginRun(), hcaldqm::DigiRunSummary::beginRun(), PedestalTask::bookHistograms(), LEDTask::bookHistograms(), TPTask::bookHistograms(), LaserTask::bookHistograms(), RawTask::bookHistograms(), RecHitTask::bookHistograms(), DigiTask::bookHistograms(), HcalMLTask::bookHistograms(), hcaldqm::RecoRunSummary::endJob(), and hcaldqm::TPRunSummary::endJob().

88  {
89  if (_hashmap.isDHash()) {
90  std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
91  for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
92  if (!it->isHcalDetId())
93  continue;
94 
95  HcalDetId did = HcalDetId(it->rawId());
96  uint32_t hash = _hashmap.getHash(did);
98  typename CompactMap::iterator mit = _cmap.find(hash);
99  if (mit != _cmap.end())
100  continue;
101 
102  _cmap.insert(std::make_pair(hash, STDTYPE(0)));
103  }
104  } else if (_hashmap.isEHash()) {
105  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
106  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
108  uint32_t hash = _hashmap.getHash(eid);
110  typename CompactMap::iterator mit = _cmap.find(hash);
111  if (mit != _cmap.end())
112  continue;
113 
114  _cmap.insert(std::make_pair(hash, STDTYPE(0)));
115  }
116  } else if (_hashmap.isTHash()) {
117  std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
118  for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
119  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
120  uint32_t hash = _hashmap.getHash(tid);
122  typename CompactMap::iterator mit = _cmap.find(hash);
123  if (mit != _cmap.end())
124  continue;
125 
126  _cmap.insert(std::make_pair(hash, STDTYPE(0)));
127  }
128  }
129  }
uint32_t getHash(HcalDetId const &did) const override
Definition: HashMapper.h:29
virtual bool isTHash() const
Definition: HashMapper.h:62
mapper::HashMapper _hashmap
Definition: ContainerXXX.h:66
void debug(STDTYPE const &msg) const
Definition: Logger.h:20
virtual bool isEHash() const
Definition: HashMapper.h:59
virtual bool isDHash() const
Definition: HashMapper.h:58
std::string getName(HcalDetId const &did) const override
Definition: HashMapper.h:42
Readout chain identification for Hcal.

◆ book() [2/2]

template<typename STDTYPE >
void hcaldqm::ContainerXXX< STDTYPE >::book ( HcalElectronicsMap const *  emap,
filter::HashFilter const &  filter 
)
virtual

Definition at line 132 of file ContainerXXX.h.

132  {
133  if (_hashmap.isDHash()) {
134  std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
135  for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
136  if (!it->isHcalDetId())
137  continue;
138 
139  HcalDetId did = HcalDetId(it->rawId());
140  uint32_t hash = _hashmap.getHash(did);
141  typename CompactMap::iterator mit = _cmap.find(hash);
142  if (mit != _cmap.end())
143  continue;
144  if (filter.filter(did))
145  continue;
146 
148 
149  _cmap.insert(std::make_pair(hash, STDTYPE(0)));
150  }
151  } else if (_hashmap.isEHash()) {
152  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
153  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
155  uint32_t hash = _hashmap.getHash(eid);
156  typename CompactMap::iterator mit = _cmap.find(hash);
157  if (filter.filter(eid))
158  continue;
159  if (mit != _cmap.end())
160  continue;
161  _logger.debug(eid);
162 
163  _cmap.insert(std::make_pair(hash, STDTYPE(0)));
164  }
165  } else if (_hashmap.isTHash()) {
166  std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
167  for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
168  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
169  uint32_t hash = _hashmap.getHash(tid);
170  typename CompactMap::iterator mit = _cmap.find(hash);
171  if (mit != _cmap.end())
172  continue;
173  if (filter.filter(tid))
174  continue;
176 
177  _cmap.insert(std::make_pair(hash, STDTYPE(0)));
178  }
179  }
180  }
uint32_t getHash(HcalDetId const &did) const override
Definition: HashMapper.h:29
virtual bool isTHash() const
Definition: HashMapper.h:62
mapper::HashMapper _hashmap
Definition: ContainerXXX.h:66
void debug(STDTYPE const &msg) const
Definition: Logger.h:20
virtual bool isEHash() const
Definition: HashMapper.h:59
virtual bool isDHash() const
Definition: HashMapper.h:58
std::string getName(HcalDetId const &did) const override
Definition: HashMapper.h:42
Readout chain identification for Hcal.

◆ dump() [1/2]

template<typename STDTYPE >
void hcaldqm::ContainerXXX< STDTYPE >::dump ( Container1D c)
virtual

Definition at line 260 of file ContainerXXX.h.

260  {
261  for (auto &p : _cmap) {
262  STDTYPE &x = p.second;
263  uint32_t hash = p.first;
264  c->fill(hash, (double)x);
265  }
266  }

◆ dump() [2/2]

template<typename STDTYPE >
void hcaldqm::ContainerXXX< STDTYPE >::dump ( std::vector< Container1D *> const &  vc)
virtual

Definition at line 269 of file ContainerXXX.h.

269  {
270  for (auto &p : _cmap) {
271  STDTYPE &x = p.second;
272  uint32_t hash = p.first;
273 
274  for (std::vector<Container1D *>::const_iterator it = vc.begin(); it != vc.end(); ++it)
275  (*it)->fill(hash, (double)x);
276  }
277  }

◆ end()

template<typename STDTYPE>
virtual CompactMap::const_iterator hcaldqm::ContainerXXX< STDTYPE >::end ( void  )
inlinevirtual

◆ exists() [1/3]

template<typename STDTYPE >
bool hcaldqm::ContainerXXX< STDTYPE >::exists ( HcalDetId const &  id)
virtual

◆ exists() [2/3]

template<typename STDTYPE >
bool hcaldqm::ContainerXXX< STDTYPE >::exists ( HcalElectronicsId const &  id)
virtual

Definition at line 218 of file ContainerXXX.h.

218  {
219  return _cmap.find(id.rawId()) != _cmap.end();
220  }

◆ exists() [3/3]

template<typename STDTYPE >
bool hcaldqm::ContainerXXX< STDTYPE >::exists ( HcalTrigTowerDetId const &  id)
virtual

Definition at line 223 of file ContainerXXX.h.

223  {
224  return _cmap.find(id.rawId()) != _cmap.end();
225  }

◆ get() [1/3]

template<typename STDTYPE >
STDTYPE & hcaldqm::ContainerXXX< STDTYPE >::get ( HcalDetId const &  did)
virtual

Definition at line 198 of file ContainerXXX.h.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), submitPVValidationJobs.BetterConfigParser::__updateDict(), PedestalTask::_dump(), LEDTask::_dump(), LaserTask::_dump(), TPTask::_process(), PedestalTask::_process(), RawTask::_process(), LEDTask::_process(), RecHitTask::_process(), DigiTask::_process(), UMNioTask::_process(), LaserTask::_process(), HcalMLTask::_process(), hcaldqm::DigiRunSummary::beginRun(), DigiTask::bookHistograms(), util.rrapi.RRApi::columns(), rrapi.RRApi::columns(), util.rrapi.RRApi::count(), rrapi.RRApi::count(), rrapi.RRApi::data(), util.rrapi.RRApi::data(), hcaldqm::RecoRunSummary::endJob(), hcaldqm::TPRunSummary::endJob(), hcaldqm::DigiRunSummary::endJob(), hcaldqm::RawRunSummary::endLuminosityBlock(), hcaldqm::DigiRunSummary::endLuminosityBlock(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), submitPVValidationJobs.BetterConfigParser::getResultingSection(), TPTask::globalEndLuminosityBlock(), RawTask::globalEndLuminosityBlock(), RecHitTask::globalEndLuminosityBlock(), DigiTask::globalEndLuminosityBlock(), HcalMLTask::globalEndLuminosityBlock(), rrapi.RRApi::report(), util.rrapi.RRApi::report(), rrapi.RRApi::reports(), util.rrapi.RRApi::reports(), rrapi.RRApi::tables(), util.rrapi.RRApi::tables(), rrapi.RRApi::tags(), util.rrapi.RRApi::tags(), util.rrapi.RRApi::templates(), rrapi.RRApi::templates(), rrapi.RRApi::workspaces(), and util.rrapi.RRApi::workspaces().

198  {
199  return _cmap[_hashmap.getHash(did)];
200  }
uint32_t getHash(HcalDetId const &did) const override
Definition: HashMapper.h:29
mapper::HashMapper _hashmap
Definition: ContainerXXX.h:66

◆ get() [2/3]

template<typename STDTYPE >
STDTYPE & hcaldqm::ContainerXXX< STDTYPE >::get ( HcalElectronicsId const &  eid)
virtual

◆ get() [3/3]

template<typename STDTYPE >
STDTYPE & hcaldqm::ContainerXXX< STDTYPE >::get ( HcalTrigTowerDetId const &  tid)
virtual

◆ initialize()

template<typename STDTYPE >
void hcaldqm::ContainerXXX< STDTYPE >::initialize ( hashfunctions::HashType  ht,
int  debug = 0 
)
virtual

◆ load()

template<typename STDTYPE >
void hcaldqm::ContainerXXX< STDTYPE >::load ( Container1D cont)
virtual

Definition at line 300 of file ContainerXXX.h.

300  {
301  for (auto &p : _cmap) {
302  STDTYPE &x = p.second;
303  uint32_t hash = p.first;
304 
305  if (_hashmap.isDHash())
306  x = cont->getBinContent(HcalDetId(hash));
307  else if (_hashmap.isEHash())
308  x = cont->getBinContent(HcalElectronicsId(hash));
309  else if (_hashmap.isTHash())
310  x = cont->getBinContent(HcalTrigTowerDetId(hash));
311  }
312  }
virtual bool isTHash() const
Definition: HashMapper.h:62
mapper::HashMapper _hashmap
Definition: ContainerXXX.h:66
virtual bool isEHash() const
Definition: HashMapper.h:59
virtual bool isDHash() const
Definition: HashMapper.h:58
Readout chain identification for Hcal.
cont
load Luminosity info ##
Definition: generateEDF.py:620

◆ operator=()

template<typename STDTYPE>
ContainerXXX& hcaldqm::ContainerXXX< STDTYPE >::operator= ( const ContainerXXX< STDTYPE > &  other)
default

◆ print()

template<typename STDTYPE >
void hcaldqm::ContainerXXX< STDTYPE >::print ( void  )
virtual

Definition at line 280 of file ContainerXXX.h.

280  {
281  std::cout << "Container by " << _hashmap.getHashTypeName() << std::endl;
282  for (auto &p : _cmap) {
283  if (_hashmap.isDHash())
284  std::cout << HcalDetId(p.first) << p.second << std::endl;
285  else if (_hashmap.isEHash())
286  std::cout << HcalElectronicsId(p.first) << p.second << std::endl;
287  else if (_hashmap.isTHash())
288  std::cout << HcalTrigTowerDetId(p.first) << p.second << std::endl;
289  }
290  }
virtual bool isTHash() const
Definition: HashMapper.h:62
virtual std::string getHashTypeName() const
Definition: HashMapper.h:54
mapper::HashMapper _hashmap
Definition: ContainerXXX.h:66
virtual bool isEHash() const
Definition: HashMapper.h:59
virtual bool isDHash() const
Definition: HashMapper.h:58
Readout chain identification for Hcal.

◆ push() [1/3]

template<typename STDTYPE>
void hcaldqm::ContainerXXX< STDTYPE >::push ( HcalDetId const &  did,
STDTYPE  x 
)
virtual

Definition at line 228 of file ContainerXXX.h.

Referenced by hcaldqm::DQClient::beginLuminosityBlock(), hcaldqm::DQHarvester::dqmBeginLuminosityBlock(), esMonitoring.LineHistoryEnd::write(), and esMonitoring.LineHistoryStart::write().

228  {
229  uint32_t hash = did.rawId();
230  typename CompactMap::iterator mit = _cmap.find(hash);
231  if (mit != _cmap.end())
232  return;
233  _cmap.insert(std::make_pair(hash, x));
234  }

◆ push() [2/3]

template<typename STDTYPE>
void hcaldqm::ContainerXXX< STDTYPE >::push ( HcalElectronicsId const &  eid,
STDTYPE  x 
)
virtual

Definition at line 237 of file ContainerXXX.h.

Referenced by esMonitoring.LineHistoryEnd::write(), and esMonitoring.LineHistoryStart::write().

237  {
238  uint32_t hash = eid.rawId();
239  typename CompactMap::iterator mit = _cmap.find(hash);
240  if (mit != _cmap.end())
241  return;
242  _cmap.insert(std::make_pair(hash, x));
243  }

◆ push() [3/3]

template<typename STDTYPE>
void hcaldqm::ContainerXXX< STDTYPE >::push ( HcalTrigTowerDetId const &  tid,
STDTYPE  x 
)
virtual

Definition at line 246 of file ContainerXXX.h.

Referenced by esMonitoring.LineHistoryEnd::write(), and esMonitoring.LineHistoryStart::write().

246  {
247  uint32_t hash = tid.rawId();
248  typename CompactMap::iterator mit = _cmap.find(hash);
249  if (mit != _cmap.end())
250  return;
251  _cmap.insert(std::make_pair(hash, x));
252  }

◆ reset()

template<typename STDTYPE >
void hcaldqm::ContainerXXX< STDTYPE >::reset ( void  )
virtual

◆ set() [1/3]

template<typename STDTYPE>
void hcaldqm::ContainerXXX< STDTYPE >::set ( HcalDetId const &  did,
STDTYPE  x 
)
virtual

Definition at line 183 of file ContainerXXX.h.

Referenced by PedestalTask::bookHistograms().

183  {
184  _cmap[_hashmap.getHash(did)] = x;
185  }
uint32_t getHash(HcalDetId const &did) const override
Definition: HashMapper.h:29
mapper::HashMapper _hashmap
Definition: ContainerXXX.h:66

◆ set() [2/3]

template<typename STDTYPE>
void hcaldqm::ContainerXXX< STDTYPE >::set ( HcalElectronicsId const &  did,
STDTYPE  x 
)
virtual

Definition at line 188 of file ContainerXXX.h.

188  {
189  _cmap[_hashmap.getHash(did)] = x;
190  }
uint32_t getHash(HcalDetId const &did) const override
Definition: HashMapper.h:29
mapper::HashMapper _hashmap
Definition: ContainerXXX.h:66

◆ set() [3/3]

template<typename STDTYPE>
void hcaldqm::ContainerXXX< STDTYPE >::set ( HcalTrigTowerDetId const &  did,
STDTYPE  x 
)
virtual

Definition at line 193 of file ContainerXXX.h.

193  {
194  _cmap[_hashmap.getHash(did)] = x;
195  }
uint32_t getHash(HcalDetId const &did) const override
Definition: HashMapper.h:29
mapper::HashMapper _hashmap
Definition: ContainerXXX.h:66

◆ size()

template<typename STDTYPE >
uint32_t hcaldqm::ContainerXXX< STDTYPE >::size ( void  )
virtual

Definition at line 255 of file ContainerXXX.h.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

255  {
256  return (uint32_t)(_cmap.size());
257  }

Member Data Documentation

◆ _cmap

template<typename STDTYPE>
CompactMap hcaldqm::ContainerXXX< STDTYPE >::_cmap
protected

◆ _hashmap

template<typename STDTYPE>
mapper::HashMapper hcaldqm::ContainerXXX< STDTYPE >::_hashmap
protected

Definition at line 66 of file ContainerXXX.h.

◆ _logger

template<typename STDTYPE>
Logger hcaldqm::ContainerXXX< STDTYPE >::_logger
protected

Definition at line 67 of file ContainerXXX.h.