19 template <
typename STDTYPE>
33 virtual void set(
HcalDetId const &, STDTYPE);
55 virtual void dump(std::vector<Container1D *>
const &);
59 virtual uint32_t
size();
63 typedef std::unordered_map<uint32_t, STDTYPE>
CompactMap;
69 virtual typename CompactMap::const_iterator
begin() {
return _cmap.begin(); }
70 virtual typename CompactMap::const_iterator
end() {
return _cmap.end(); }
73 template <
typename STDTYPE>
75 for (
auto &
p : _cmap) {
76 _cmap.insert(std::make_pair(
p.first,
p.second));
80 template <
typename STDTYPE>
82 _hashmap.initialize(ht);
83 _logger.set(
"XXX",
debug);
86 template <
typename STDTYPE>
88 if (_hashmap.isDHash()) {
90 for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
91 if (!it->isHcalDetId())
95 uint32_t
hash = _hashmap.getHash(did);
96 _logger.debug(_hashmap.getName(did));
97 typename CompactMap::iterator mit = _cmap.find(
hash);
98 if (mit != _cmap.end())
101 _cmap.insert(std::make_pair(
hash, STDTYPE(0)));
103 }
else if (_hashmap.isEHash()) {
105 for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
107 uint32_t
hash = _hashmap.getHash(
eid);
108 _logger.debug(_hashmap.getName(
eid));
109 typename CompactMap::iterator mit = _cmap.find(
hash);
110 if (mit != _cmap.end())
113 _cmap.insert(std::make_pair(
hash, STDTYPE(0)));
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) {
119 uint32_t
hash = _hashmap.getHash(tid);
120 _logger.debug(_hashmap.getName(tid));
121 typename CompactMap::iterator mit = _cmap.find(
hash);
122 if (mit != _cmap.end())
125 _cmap.insert(std::make_pair(
hash, STDTYPE(0)));
130 template <
typename STDTYPE>
132 if (_hashmap.isDHash()) {
134 for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
135 if (!it->isHcalDetId())
139 uint32_t
hash = _hashmap.getHash(did);
140 typename CompactMap::iterator mit = _cmap.find(
hash);
141 if (mit != _cmap.end())
146 _logger.debug(_hashmap.getName(did));
148 _cmap.insert(std::make_pair(
hash, STDTYPE(0)));
150 }
else if (_hashmap.isEHash()) {
152 for (std::vector<HcalElectronicsId>::const_iterator it = eids.begin(); it != eids.end(); ++it) {
154 uint32_t
hash = _hashmap.getHash(
eid);
155 typename CompactMap::iterator mit = _cmap.find(
hash);
158 if (mit != _cmap.end())
162 _cmap.insert(std::make_pair(
hash, STDTYPE(0)));
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) {
168 uint32_t
hash = _hashmap.getHash(tid);
169 typename CompactMap::iterator mit = _cmap.find(
hash);
170 if (mit != _cmap.end())
174 _logger.debug(_hashmap.getName(tid));
176 _cmap.insert(std::make_pair(
hash, STDTYPE(0)));
181 template <
typename STDTYPE>
183 _cmap[_hashmap.getHash(did)] =
x;
186 template <
typename STDTYPE>
188 _cmap[_hashmap.getHash(did)] =
x;
191 template <
typename STDTYPE>
193 _cmap[_hashmap.getHash(did)] =
x;
196 template <
typename STDTYPE>
198 return _cmap[_hashmap.getHash(did)];
201 template <
typename STDTYPE>
203 return _cmap[_hashmap.getHash(
eid)];
206 template <
typename STDTYPE>
208 return _cmap[_hashmap.getHash(tid)];
211 template <
typename STDTYPE>
213 return _cmap.find(
id.
rawId()) != _cmap.end();
216 template <
typename STDTYPE>
218 return _cmap.find(
id.
rawId()) != _cmap.end();
221 template <
typename STDTYPE>
223 return _cmap.find(
id.
rawId()) != _cmap.end();
226 template <
typename STDTYPE>
229 typename CompactMap::iterator mit = _cmap.find(
hash);
230 if (mit != _cmap.end())
232 _cmap.insert(std::make_pair(
hash,
x));
235 template <
typename STDTYPE>
238 typename CompactMap::iterator mit = _cmap.find(
hash);
239 if (mit != _cmap.end())
241 _cmap.insert(std::make_pair(
hash,
x));
244 template <
typename STDTYPE>
247 typename CompactMap::iterator mit = _cmap.find(
hash);
248 if (mit != _cmap.end())
250 _cmap.insert(std::make_pair(
hash,
x));
253 template <
typename STDTYPE>
255 return (uint32_t)(_cmap.size());
258 template <
typename STDTYPE>
260 for (
auto &
p : _cmap) {
261 STDTYPE &
x =
p.second;
262 uint32_t
hash =
p.first;
267 template <
typename STDTYPE>
269 for (
auto &
p : _cmap) {
270 STDTYPE &
x =
p.second;
271 uint32_t
hash =
p.first;
273 for (std::vector<Container1D *>::const_iterator it = vc.begin(); it != vc.end(); ++it)
274 (*it)->fill(
hash, (
double)
x);
278 template <
typename STDTYPE>
280 std::cout <<
"Container by " << _hashmap.getHashTypeName() << std::endl;
281 for (
auto &
p : _cmap) {
282 if (_hashmap.isDHash())
284 else if (_hashmap.isEHash())
286 else if (_hashmap.isTHash())
291 template <
typename STDTYPE>
293 for (
auto &
p : _cmap) {
298 template <
typename STDTYPE>
300 for (
auto &
p : _cmap) {
301 STDTYPE &
x =
p.second;
302 uint32_t
hash =
p.first;
304 if (_hashmap.isDHash())
306 else if (_hashmap.isEHash())
308 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()
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 ##