File indexing completed on 2024-04-06 12:07:30
0001 #include "DQM/HcalCommon/interface/HashFilter.h"
0002
0003 namespace hcaldqm {
0004 using namespace mapper;
0005 using namespace hashfunctions;
0006 namespace filter {
0007 HashFilter::HashFilter(FilterType ftype, HashType htype) : HashMapper(htype), _ftype(ftype) {}
0008
0009 HashFilter::HashFilter(FilterType ftype, HashType htype, std::vector<uint32_t> const &v)
0010 : HashMapper(htype), _ftype(ftype) {
0011 for (std::vector<uint32_t>::const_iterator it = v.begin(); it != v.end(); ++it)
0012 _ids.insert(*it);
0013 }
0014
0015 HashFilter::HashFilter(HashFilter const &hf) : HashMapper(hf._htype), _ftype(hf._ftype) { _ids = hf._ids; }
0016
0017 void HashFilter::initialize(FilterType ftype, HashType htype, std::vector<uint32_t> const &v) {
0018 HashMapper::initialize(htype);
0019 _ftype = ftype;
0020 for (std::vector<uint32_t>::const_iterator it = v.begin(); it != v.end(); ++it)
0021 _ids.insert(*it);
0022 }
0023
0024 bool HashFilter::filter(HcalDetId const &did) const {
0025 return _ftype == fFilter ? skip(getHash(did)) : preserve(getHash(did));
0026 }
0027
0028 bool HashFilter::filter(HcalElectronicsId const &eid) const {
0029 return _ftype == fFilter ? skip(getHash(eid)) : preserve(getHash(eid));
0030 }
0031
0032 bool HashFilter::filter(HcalTrigTowerDetId const &tid) const {
0033 return _ftype == fFilter ? skip(getHash(tid)) : preserve(getHash(tid));
0034 }
0035
0036 bool HashFilter::skip(uint32_t id) const { return _ids.find(id) == _ids.end() ? false : true; }
0037
0038 bool HashFilter::preserve(uint32_t id) const { return _ids.find(id) == _ids.end() ? true : false; }
0039
0040 void HashFilter::print() {}
0041 }
0042 }