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  uint32_t getHash(HcalTrigTowerDetId const &tid, HcalElectronicsId const &eid) const override {
38  }
39 
40  // get name of the hashed element
41  using Mapper::getName;
42  std::string getName(HcalDetId const &did) const override { return hashfunctions::name_did[_htype](did); }
43  std::string getName(HcalElectronicsId const &eid) const override {
45  }
46  std::string getName(HcalTrigTowerDetId const &tid) const override {
48  }
49  std::string getName(HcalTrigTowerDetId const &tid, HcalElectronicsId const &eid) const override {
51  }
52 
53  // get the Hash Type Name
55  virtual hashfunctions::HashType getHashType() const { return _htype; }
56 
57  // determine the type of the hash
58  virtual bool isDHash() const { return _htype < hashfunctions::nHashType_did ? true : false; }
59  virtual bool isEHash() const {
61  }
62  virtual bool isTHash() const {
64  }
65  virtual bool isMixHash() const {
67  }
68 
69  // get the Linear Hash Type
70  virtual int getLinearHashType(hashfunctions::HashType htype) const {
71  int l = 0;
72  if (htype < hashfunctions::nHashType_did)
73  l = htype;
74  else if (htype < hashfunctions::nHashType_eid)
75  l = htype - 1;
76  else if (htype < hashfunctions::nHashType_tid)
77  l = htype - 2;
78  else
79  l = htype - 3;
80  return l;
81  }
82 
83  protected:
85  };
86  } // namespace mapper
87 } // namespace hcaldqm
88 
89 #endif
virtual bool isMixHash() const
Definition: HashMapper.h:65
uint32_t getHash(HcalDetId const &did) const override
Definition: HashMapper.h:29
virtual bool isTHash() const
Definition: HashMapper.h:62
virtual void initialize(hashfunctions::HashType htype)
Definition: HashMapper.h:25
hash_function_tid const hash_tid[nHashType_tid - nHashType_eid - 1]
virtual hashfunctions::HashType getHashType() const
Definition: HashMapper.h:55
std::string const hash_names[nhashes]
virtual std::string getHashTypeName() const
Definition: HashMapper.h:54
hash_function_mixid const hash_mixid[nHashType_mixid - nHashType_tid - 1]
name_function_eid const name_eid[nHashType_eid - nHashType_did - 1]
uint32_t getHash(HcalTrigTowerDetId const &tid, HcalElectronicsId const &eid) const override
Definition: HashMapper.h:36
virtual std::string getName(HcalDetId const &) const
Definition: Mapper.h:31
std::string getName(HcalTrigTowerDetId const &tid) const override
Definition: HashMapper.h:46
name_function_mixid const name_mixid[nHashType_mixid - nHashType_tid - 1]
uint32_t getHash(HcalTrigTowerDetId const &tid) const override
Definition: HashMapper.h:33
name_function_tid const name_tid[nHashType_tid - nHashType_eid - 1]
hash_function_did const hash_did[nHashType_did]
virtual bool isEHash() const
Definition: HashMapper.h:59
hashfunctions::HashType _htype
Definition: HashMapper.h:84
virtual bool isDHash() const
Definition: HashMapper.h:58
std::string getName(HcalDetId const &did) const override
Definition: HashMapper.h:42
hash_function_eid const hash_eid[nHashType_eid - nHashType_did - 1]
std::string getName(HcalTrigTowerDetId const &tid, HcalElectronicsId const &eid) const override
Definition: HashMapper.h:49
name_function_did const name_did[nHashType_did]
std::string getName(HcalElectronicsId const &eid) const override
Definition: HashMapper.h:43
uint32_t getHash(HcalElectronicsId const &eid) const override
Definition: HashMapper.h:30
Readout chain identification for Hcal.
virtual uint32_t getHash(HcalDetId const &) const
Definition: Mapper.h:26
virtual int getLinearHashType(hashfunctions::HashType htype) const
Definition: HashMapper.h:70
HashMapper(hashfunctions::HashType htype)
Definition: HashMapper.h:21