FilterType

HashFilter

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
#ifndef HashFilter_h
#define HashFilter_h

/**
 *	file:		HashFilter.h
 *	Author:		Viktor Khristenko
 *
 *	Description:
 *		Filters out hashes that we do not need
 */

#include "DQM/HcalCommon/interface/HashMapper.h"

#include <unordered_set>
#include <vector>

namespace hcaldqm {
  namespace filter {
    enum FilterType { fFilter = 0, fPreserver = 1, nFilterType = 2 };

    class HashFilter : public mapper::HashMapper {
    public:
      HashFilter() : _ftype(fFilter) {}
      //	empty hash
      HashFilter(FilterType ftype, hashfunctions::HashType htype);
      //	initialize with a vector of hashes
      HashFilter(FilterType, hashfunctions::HashType, std::vector<uint32_t> const &);
      //	copy constructor
      HashFilter(HashFilter const &hf);
      ~HashFilter() override {}
      virtual void initialize(FilterType ftype, hashfunctions::HashType htype, std::vector<uint32_t> const &);
      using mapper::HashMapper::initialize;

      //	true if should filter out and false if not
      //	true => should skip this hash
      //	false => should keep this hash
      virtual bool filter(HcalDetId const &) const;
      virtual bool filter(HcalElectronicsId const &) const;
      virtual bool filter(HcalTrigTowerDetId const &) const;

      virtual void print();

    protected:
      FilterType _ftype;
      typedef std::unordered_set<uint32_t> FilterMap;
      FilterMap _ids;

      virtual bool preserve(uint32_t) const;
      virtual bool skip(uint32_t) const;
    };
  }  // namespace filter
}  // namespace hcaldqm

#endif