CMS 3D CMS Logo

HashFilter.cc
Go to the documentation of this file.
2 
3 namespace hcaldqm {
4  using namespace mapper;
5  using namespace hashfunctions;
6  namespace filter {
7  HashFilter::HashFilter(FilterType ftype, HashType htype) : HashMapper(htype), _ftype(ftype) {}
8 
9  HashFilter::HashFilter(FilterType ftype, HashType htype, std::vector<uint32_t> const &v)
10  : HashMapper(htype), _ftype(ftype) {
11  for (std::vector<uint32_t>::const_iterator it = v.begin(); it != v.end(); ++it)
12  _ids.insert(*it);
13  }
14 
16 
17  /* virtual */ void HashFilter::initialize(FilterType ftype, HashType htype, std::vector<uint32_t> const &v) {
19  _ftype = ftype;
20  for (std::vector<uint32_t>::const_iterator it = v.begin(); it != v.end(); ++it)
21  _ids.insert(*it);
22  }
23 
24  /* virtual */ bool HashFilter::filter(HcalDetId const &did) const {
25  return _ftype == fFilter ? skip(getHash(did)) : preserve(getHash(did));
26  }
27 
28  /* virtual */ bool HashFilter::filter(HcalElectronicsId const &eid) const {
29  return _ftype == fFilter ? skip(getHash(eid)) : preserve(getHash(eid));
30  }
31 
32  /* virtual */ bool HashFilter::filter(HcalTrigTowerDetId const &tid) const {
33  return _ftype == fFilter ? skip(getHash(tid)) : preserve(getHash(tid));
34  }
35 
36  /* virtual */ bool HashFilter::skip(uint32_t id) const { return _ids.find(id) == _ids.end() ? false : true; }
37 
38  /* virtual */ bool HashFilter::preserve(uint32_t id) const { return _ids.find(id) == _ids.end() ? true : false; }
39 
40  /* virtual */ void HashFilter::print() {}
41  } // namespace filter
42 } // namespace hcaldqm
virtual bool skip(uint32_t) const
Definition: HashFilter.cc:36
virtual void initialize(hashfunctions::HashType htype)
Definition: HashMapper.h:25
virtual bool preserve(uint32_t) const
Definition: HashFilter.cc:38
hashfunctions::HashType _htype
Definition: HashMapper.h:73
uint32_t getHash(HcalDetId const &did) const override
Definition: HashMapper.h:29
virtual bool filter(HcalDetId const &) const
Definition: HashFilter.cc:24
virtual void initialize(FilterType ftype, hashfunctions::HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:17
Readout chain identification for Hcal.