19 template <
typename STDTYPE>
34 virtual void set(
HcalDetId const &, STDTYPE);
56 virtual void dump(std::vector<Container1D *>
const &);
60 virtual uint32_t
size();
64 typedef std::unordered_map<uint32_t, STDTYPE>
CompactMap;
70 virtual typename CompactMap::const_iterator
begin() {
return _cmap.begin(); }
71 virtual typename CompactMap::const_iterator
end() {
return _cmap.end(); }
74 template <
typename STDTYPE>
76 for (
auto &
p : _cmap) {
77 _cmap.insert(std::make_pair(
p.first,
p.second));
81 template <
typename STDTYPE>
83 _hashmap.initialize(ht);
84 _logger.set(
"XXX",
debug);
87 template <
typename STDTYPE>
89 if (_hashmap.isDHash()) {
91 for (std::vector<HcalGenericDetId>::const_iterator
it = dids.begin();
it != dids.end(); ++
it) {
92 if (!
it->isHcalDetId())
96 uint32_t
hash = _hashmap.getHash(did);
97 _logger.debug(_hashmap.getName(did));
98 typename CompactMap::iterator mit = _cmap.find(
hash);
99 if (mit != _cmap.end())
102 _cmap.insert(std::make_pair(
hash, STDTYPE(0)));
104 }
else if (_hashmap.isEHash()) {
106 for (std::vector<HcalElectronicsId>::const_iterator
it = eids.begin();
it != eids.end(); ++
it) {
108 uint32_t
hash = _hashmap.getHash(
eid);
109 _logger.debug(_hashmap.getName(
eid));
110 typename CompactMap::iterator mit = _cmap.find(
hash);
111 if (mit != _cmap.end())
114 _cmap.insert(std::make_pair(
hash, STDTYPE(0)));
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) {
120 uint32_t
hash = _hashmap.getHash(tid);
121 _logger.debug(_hashmap.getName(tid));
122 typename CompactMap::iterator mit = _cmap.find(
hash);
123 if (mit != _cmap.end())
126 _cmap.insert(std::make_pair(
hash, STDTYPE(0)));
131 template <
typename STDTYPE>
133 if (_hashmap.isDHash()) {
135 for (std::vector<HcalGenericDetId>::const_iterator
it = dids.begin();
it != dids.end(); ++
it) {
136 if (!
it->isHcalDetId())
140 uint32_t
hash = _hashmap.getHash(did);
141 typename CompactMap::iterator mit = _cmap.find(
hash);
142 if (mit != _cmap.end())
147 _logger.debug(_hashmap.getName(did));
149 _cmap.insert(std::make_pair(
hash, STDTYPE(0)));
151 }
else if (_hashmap.isEHash()) {
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);
159 if (mit != _cmap.end())
163 _cmap.insert(std::make_pair(
hash, STDTYPE(0)));
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) {
169 uint32_t
hash = _hashmap.getHash(tid);
170 typename CompactMap::iterator mit = _cmap.find(
hash);
171 if (mit != _cmap.end())
175 _logger.debug(_hashmap.getName(tid));
177 _cmap.insert(std::make_pair(
hash, STDTYPE(0)));
182 template <
typename STDTYPE>
184 _cmap[_hashmap.getHash(did)] =
x;
187 template <
typename STDTYPE>
189 _cmap[_hashmap.getHash(did)] =
x;
192 template <
typename STDTYPE>
194 _cmap[_hashmap.getHash(did)] =
x;
197 template <
typename STDTYPE>
199 return _cmap[_hashmap.getHash(did)];
202 template <
typename STDTYPE>
204 return _cmap[_hashmap.getHash(
eid)];
207 template <
typename STDTYPE>
209 return _cmap[_hashmap.getHash(tid)];
212 template <
typename STDTYPE>
214 return _cmap.find(
id.
rawId()) != _cmap.end();
217 template <
typename STDTYPE>
219 return _cmap.find(
id.
rawId()) != _cmap.end();
222 template <
typename STDTYPE>
224 return _cmap.find(
id.
rawId()) != _cmap.end();
227 template <
typename STDTYPE>
230 typename CompactMap::iterator mit = _cmap.find(
hash);
231 if (mit != _cmap.end())
233 _cmap.insert(std::make_pair(
hash,
x));
236 template <
typename STDTYPE>
239 typename CompactMap::iterator mit = _cmap.find(
hash);
240 if (mit != _cmap.end())
242 _cmap.insert(std::make_pair(
hash,
x));
245 template <
typename STDTYPE>
248 typename CompactMap::iterator mit = _cmap.find(
hash);
249 if (mit != _cmap.end())
251 _cmap.insert(std::make_pair(
hash,
x));
254 template <
typename STDTYPE>
256 return (uint32_t)(_cmap.size());
259 template <
typename STDTYPE>
261 for (
auto &
p : _cmap) {
262 STDTYPE &
x =
p.second;
263 uint32_t
hash =
p.first;
268 template <
typename STDTYPE>
270 for (
auto &
p : _cmap) {
271 STDTYPE &
x =
p.second;
272 uint32_t
hash =
p.first;
274 for (std::vector<Container1D *>::const_iterator
it = vc.begin();
it != vc.end(); ++
it)
275 (*it)->fill(
hash, (
double)
x);
279 template <
typename STDTYPE>
281 std::cout <<
"Container by " << _hashmap.getHashTypeName() << std::endl;
282 for (
auto &
p : _cmap) {
283 if (_hashmap.isDHash())
285 else if (_hashmap.isEHash())
287 else if (_hashmap.isTHash())
292 template <
typename STDTYPE>
294 for (
auto &
p : _cmap) {
299 template <
typename STDTYPE>
301 for (
auto &
p : _cmap) {
302 STDTYPE &
x =
p.second;
303 uint32_t
hash =
p.first;
305 if (_hashmap.isDHash())
307 else if (_hashmap.isEHash())
309 else if (_hashmap.isTHash())
ContainerXXX(hashfunctions::HashType ht)
std::unordered_map< uint32_t, uint32_t > uintCompactMap
virtual bool exists(HcalDetId const &)
std::unordered_map< uint32_t, int > intCompactMap
std::vector< HcalTrigTowerDetId > allTriggerId() const
virtual CompactMap::const_iterator begin()
virtual void dump(Container1D *)
virtual void push(HcalDetId const &, STDTYPE)
mapper::HashMapper _hashmap
virtual CompactMap::const_iterator end()
ContainerXXX & operator=(const ContainerXXX &other)=default
virtual void book(HcalElectronicsMap const *)
constexpr uint32_t rawId() const
get the raw id
std::unordered_map< uint32_t, STDTYPE > CompactMap
virtual void load(Container1D *)
virtual STDTYPE & get(HcalDetId const &)
std::vector< HcalGenericDetId > allPrecisionId() const
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
virtual void initialize(hashfunctions::HashType, int debug=0)
Readout chain identification for Hcal.
std::unordered_map< uint32_t, double > doubleCompactMap
virtual void set(HcalDetId const &, STDTYPE)
cont
load Luminosity info ##