CMS 3D CMS Logo

HashMapper.h
Go to the documentation of this file.
1 #ifndef HashMapper_h
2 #define HashMapper_h
3 
14 
15 namespace hcaldqm {
16  namespace mapper {
17  class HashMapper : public Mapper {
18  public:
19  // constructors/destructors
22  ~HashMapper() override {}
23 
24  // initialize
25  virtual void initialize(hashfunctions::HashType htype) { _htype = htype; }
26 
27  // get hash
28  using Mapper::getHash;
29  uint32_t getHash(HcalDetId const &did) const override { return hashfunctions::hash_did[_htype](did); }
30  uint32_t getHash(HcalElectronicsId const &eid) const override {
32  }
33  uint32_t getHash(HcalTrigTowerDetId const &tid) const override {
35  }
36 
37  // get name of the hashed element
38  using Mapper::getName;
39  std::string getName(HcalDetId const &did) const override { return hashfunctions::name_did[_htype](did); }
40  std::string getName(HcalElectronicsId const &eid) const override {
42  }
43  std::string getName(HcalTrigTowerDetId const &tid) const override {
45  }
46 
47  // get the Hash Type Name
49  virtual hashfunctions::HashType getHashType() const { return _htype; }
50 
51  // determine the type of the hash
52  virtual bool isDHash() const { return _htype < hashfunctions::nHashType_did ? true : false; }
53  virtual bool isEHash() const {
55  }
56  virtual bool isTHash() const {
58  }
59 
60  // get the Linear Hash Type
61  virtual int getLinearHashType(hashfunctions::HashType htype) const {
62  int l = 0;
63  if (htype < hashfunctions::nHashType_did)
64  l = htype;
65  else if (htype < hashfunctions::nHashType_eid)
66  l = htype - 1;
67  else
68  l = htype - 2;
69  return l;
70  }
71 
72  protected:
74  };
75  } // namespace mapper
76 } // namespace hcaldqm
77 
78 #endif
virtual int getLinearHashType(hashfunctions::HashType htype) const
Definition: HashMapper.h:61
virtual std::string getName(HcalDetId const &) const
Definition: Mapper.h:30
virtual bool isTHash() const
Definition: HashMapper.h:56
virtual void initialize(hashfunctions::HashType htype)
Definition: HashMapper.h:25
std::string const hash_names[nhashes]
hash_function_tid const hash_tid[nHashType_tid-nHashType_eid-1]
virtual std::string getHashTypeName() const
Definition: HashMapper.h:48
uint32_t getHash(HcalTrigTowerDetId const &tid) const override
Definition: HashMapper.h:33
std::string getName(HcalElectronicsId const &eid) const override
Definition: HashMapper.h:40
hash_function_did const hash_did[nHashType_did]
std::string getName(HcalTrigTowerDetId const &tid) const override
Definition: HashMapper.h:43
hashfunctions::HashType _htype
Definition: HashMapper.h:73
uint32_t getHash(HcalDetId const &did) const override
Definition: HashMapper.h:29
name_function_tid const name_tid[nHashType_tid-nHashType_eid-1]
uint32_t getHash(HcalElectronicsId const &eid) const override
Definition: HashMapper.h:30
hash_function_eid const hash_eid[nHashType_eid-nHashType_did-1]
virtual hashfunctions::HashType getHashType() const
Definition: HashMapper.h:49
virtual bool isDHash() const
Definition: HashMapper.h:52
virtual uint32_t getHash(HcalDetId const &) const
Definition: Mapper.h:26
name_function_did const name_did[nHashType_did]
virtual bool isEHash() const
Definition: HashMapper.h:53
name_function_eid const name_eid[nHashType_eid-nHashType_did-1]
Readout chain identification for Hcal.
std::string getName(HcalDetId const &did) const override
Definition: HashMapper.h:39
HashMapper(hashfunctions::HashType htype)
Definition: HashMapper.h:21