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 {
17  namespace mapper
18  {
19  class HashMapper : public Mapper
20  {
21  public:
22  // constructors/destructors
25  {}
26  ~HashMapper() override {}
27 
28  // initialize
29  virtual void initialize(hashfunctions::HashType htype) {_htype = htype;}
30 
31  // get hash
32  using Mapper::getHash;
33  uint32_t getHash(HcalDetId const& did) const override
34  {return hashfunctions::hash_did[_htype](did);}
35  uint32_t getHash(HcalElectronicsId const& eid) const override
37  uint32_t getHash(HcalTrigTowerDetId const& tid) const override
39 
40  // get name of the hashed element
41  using Mapper::getName;
42  std::string getName(HcalDetId const &did) const override
43  {return hashfunctions::name_did[_htype](did);}
44  std::string getName(HcalElectronicsId const& eid) const override
46  std::string getName(HcalTrigTowerDetId const& tid) const override
48 
49  // get the Hash Type Name
50  virtual std::string getHashTypeName() const
53  {return _htype;}
54 
55  // determine the type of the hash
56  virtual bool isDHash() const
57  {return _htype<hashfunctions::nHashType_did ? true : false;}
58  virtual bool isEHash() const
59  {
61  true : false;
62  }
63  virtual bool isTHash() const
64  {
66  true : false;
67  }
68 
69  // get the Linear Hash Type
70  virtual int getLinearHashType(hashfunctions::HashType htype) const
71  {
72  int l = 0;
74  l = htype;
75  else if (htype<hashfunctions::nHashType_eid)
76  l = htype - 1;
77  else
78  l = htype - 2;
79  return l;
80  }
81 
82  protected:
84  };
85  }
86 }
87 
88 #endif
virtual int getLinearHashType(hashfunctions::HashType htype) const
Definition: HashMapper.h:70
virtual std::string getName(HcalDetId const &) const
Definition: Mapper.h:34
virtual bool isTHash() const
Definition: HashMapper.h:63
virtual void initialize(hashfunctions::HashType htype)
Definition: HashMapper.h:29
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:50
uint32_t getHash(HcalTrigTowerDetId const &tid) const override
Definition: HashMapper.h:37
std::string getName(HcalElectronicsId const &eid) const override
Definition: HashMapper.h:44
hash_function_did const hash_did[nHashType_did]
std::string getName(HcalTrigTowerDetId const &tid) const override
Definition: HashMapper.h:46
hashfunctions::HashType _htype
Definition: HashMapper.h:83
uint32_t getHash(HcalDetId const &did) const override
Definition: HashMapper.h:33
name_function_tid const name_tid[nHashType_tid-nHashType_eid-1]
uint32_t getHash(HcalElectronicsId const &eid) const override
Definition: HashMapper.h:35
hash_function_eid const hash_eid[nHashType_eid-nHashType_did-1]
virtual hashfunctions::HashType getHashType() const
Definition: HashMapper.h:52
virtual bool isDHash() const
Definition: HashMapper.h:56
virtual uint32_t getHash(HcalDetId const &) const
Definition: Mapper.h:30
name_function_did const name_did[nHashType_did]
virtual bool isEHash() const
Definition: HashMapper.h:58
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:42
HashMapper(hashfunctions::HashType htype)
Definition: HashMapper.h:24