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 *)
 
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 63 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:65

◆ ContainerXXX() [3/3]

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

Definition at line 74 of file ContainerXXX.h.

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

◆ ~ContainerXXX()

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

Definition at line 25 of file ContainerXXX.h.

25 { _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 87 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(), hcaldqm::RecoRunSummary::endJob(), and hcaldqm::TPRunSummary::endJob().

87  {
88  if (_hashmap.isDHash()) {
89  std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
90  for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
91  if (!it->isHcalDetId())
92  continue;
93 
94  HcalDetId did = HcalDetId(it->rawId());
95  uint32_t hash = _hashmap.getHash(did);
97  typename CompactMap::iterator mit = _cmap.find(hash);
98  if (mit != _cmap.end())
99  continue;
100 
101  _cmap.insert(std::make_pair(hash, STDTYPE(0)));
102  }
103  } else if (_hashmap.isEHash()) {
104  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
105  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
106  HcalElectronicsId eid = HcalElectronicsId(it->rawId());
107  uint32_t hash = _hashmap.getHash(eid);
109  typename CompactMap::iterator mit = _cmap.find(hash);
110  if (mit != _cmap.end())
111  continue;
112 
113  _cmap.insert(std::make_pair(hash, STDTYPE(0)));
114  }
115  } else if (_hashmap.isTHash()) {
116  std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
117  for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
118  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
119  uint32_t hash = _hashmap.getHash(tid);
121  typename CompactMap::iterator mit = _cmap.find(hash);
122  if (mit != _cmap.end())
123  continue;
124 
125  _cmap.insert(std::make_pair(hash, STDTYPE(0)));
126  }
127  }
128  }
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:65
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 131 of file ContainerXXX.h.

131  {
132  if (_hashmap.isDHash()) {
133  std::vector<HcalGenericDetId> dids = emap->allPrecisionId();
134  for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
135  if (!it->isHcalDetId())
136  continue;
137 
138  HcalDetId did = HcalDetId(it->rawId());
139  uint32_t hash = _hashmap.getHash(did);
140  typename CompactMap::iterator mit = _cmap.find(hash);
141  if (mit != _cmap.end())
142  continue;
143  if (filter.filter(did))
144  continue;
145 
147 
148  _cmap.insert(std::make_pair(hash, STDTYPE(0)));
149  }
150  } else if (_hashmap.isEHash()) {
151  std::vector<HcalElectronicsId> eids = emap->allElectronicsIdPrecision();
152  for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
153  HcalElectronicsId eid = HcalElectronicsId(it->rawId());
154  uint32_t hash = _hashmap.getHash(eid);
155  typename CompactMap::iterator mit = _cmap.find(hash);
156  if (filter.filter(eid))
157  continue;
158  if (mit != _cmap.end())
159  continue;
160  _logger.debug(eid);
161 
162  _cmap.insert(std::make_pair(hash, STDTYPE(0)));
163  }
164  } else if (_hashmap.isTHash()) {
165  std::vector<HcalTrigTowerDetId> tids = emap->allTriggerId();
166  for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
167  HcalTrigTowerDetId tid = HcalTrigTowerDetId(it->rawId());
168  uint32_t hash = _hashmap.getHash(tid);
169  typename CompactMap::iterator mit = _cmap.find(hash);
170  if (mit != _cmap.end())
171  continue;
172  if (filter.filter(tid))
173  continue;
175 
176  _cmap.insert(std::make_pair(hash, STDTYPE(0)));
177  }
178  }
179  }
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:65
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 259 of file ContainerXXX.h.

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

◆ dump() [2/2]

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

Definition at line 268 of file ContainerXXX.h.

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

◆ 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

Definition at line 212 of file ContainerXXX.h.

Referenced by PedestalTask::_dump(), RawTask::_process(), DigiTask::_process(), UMNioTask::_process(), and DigiTask::bookHistograms().

212  {
213  return _cmap.find(id.rawId()) != _cmap.end();
214  }

◆ exists() [2/3]

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

Definition at line 217 of file ContainerXXX.h.

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

◆ exists() [3/3]

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

Definition at line 222 of file ContainerXXX.h.

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

◆ get() [1/3]

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

Definition at line 197 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(), 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(), util.rrapi.RRApi::report(), rrapi.RRApi::report(), rrapi.RRApi::reports(), util.rrapi.RRApi::reports(), rrapi.RRApi::tables(), util.rrapi.RRApi::tables(), rrapi.RRApi::tags(), util.rrapi.RRApi::tags(), rrapi.RRApi::templates(), util.rrapi.RRApi::templates(), util.rrapi.RRApi::workspaces(), and rrapi.RRApi::workspaces().

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

◆ 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 299 of file ContainerXXX.h.

299  {
300  for (auto &p : _cmap) {
301  STDTYPE &x = p.second;
302  uint32_t hash = p.first;
303 
304  if (_hashmap.isDHash())
305  x = cont->getBinContent(HcalDetId(hash));
306  else if (_hashmap.isEHash())
307  x = cont->getBinContent(HcalElectronicsId(hash));
308  else if (_hashmap.isTHash())
309  x = cont->getBinContent(HcalTrigTowerDetId(hash));
310  }
311  }
virtual bool isTHash() const
Definition: HashMapper.h:62
mapper::HashMapper _hashmap
Definition: ContainerXXX.h:65
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:628

◆ print()

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

Definition at line 279 of file ContainerXXX.h.

279  {
280  std::cout << "Container by " << _hashmap.getHashTypeName() << std::endl;
281  for (auto &p : _cmap) {
282  if (_hashmap.isDHash())
283  std::cout << HcalDetId(p.first) << p.second << std::endl;
284  else if (_hashmap.isEHash())
285  std::cout << HcalElectronicsId(p.first) << p.second << std::endl;
286  else if (_hashmap.isTHash())
287  std::cout << HcalTrigTowerDetId(p.first) << p.second << std::endl;
288  }
289  }
virtual bool isTHash() const
Definition: HashMapper.h:62
virtual std::string getHashTypeName() const
Definition: HashMapper.h:54
mapper::HashMapper _hashmap
Definition: ContainerXXX.h:65
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 227 of file ContainerXXX.h.

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

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

◆ push() [2/3]

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

Definition at line 236 of file ContainerXXX.h.

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

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

◆ push() [3/3]

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

Definition at line 245 of file ContainerXXX.h.

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

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

◆ 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 182 of file ContainerXXX.h.

Referenced by PedestalTask::bookHistograms().

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

◆ set() [2/3]

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

Definition at line 187 of file ContainerXXX.h.

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

◆ set() [3/3]

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

Definition at line 192 of file ContainerXXX.h.

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

◆ size()

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

Definition at line 254 of file ContainerXXX.h.

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

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

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 65 of file ContainerXXX.h.

◆ _logger

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

Definition at line 66 of file ContainerXXX.h.