Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:10:07

0001 #ifndef HashFilter_h
0002 #define HashFilter_h
0003 
0004 /**
0005  *  file:       HashFilter.h
0006  *  Author:     Viktor Khristenko
0007  *
0008  *  Description:
0009  *      Filters out hashes that we do not need
0010  */
0011 
0012 #include "DQM/HcalCommon/interface/HashMapper.h"
0013 
0014 #include <unordered_set>
0015 #include <vector>
0016 
0017 namespace hcaldqm {
0018   namespace filter {
0019     enum FilterType { fFilter = 0, fPreserver = 1, nFilterType = 2 };
0020 
0021     class HashFilter : public mapper::HashMapper {
0022     public:
0023       HashFilter() : _ftype(fFilter) {}
0024       //    empty hash
0025       HashFilter(FilterType ftype, hashfunctions::HashType htype);
0026       //    initialize with a vector of hashes
0027       HashFilter(FilterType, hashfunctions::HashType, std::vector<uint32_t> const &);
0028       //    copy constructor
0029       HashFilter(HashFilter const &hf);
0030       ~HashFilter() override {}
0031       virtual void initialize(FilterType ftype, hashfunctions::HashType htype, std::vector<uint32_t> const &);
0032       using mapper::HashMapper::initialize;
0033 
0034       //    true if should filter out and false if not
0035       //    true => should skip this hash
0036       //    false => should keep this hash
0037       virtual bool filter(HcalDetId const &) const;
0038       virtual bool filter(HcalElectronicsId const &) const;
0039       virtual bool filter(HcalTrigTowerDetId const &) const;
0040 
0041       virtual void print();
0042 
0043     protected:
0044       FilterType _ftype;
0045       typedef std::unordered_set<uint32_t> FilterMap;
0046       FilterMap _ids;
0047 
0048       virtual bool preserve(uint32_t) const;
0049       virtual bool skip(uint32_t) const;
0050     };
0051   }  // namespace filter
0052 }  // namespace hcaldqm
0053 
0054 #endif