CMS 3D CMS Logo

HGCalTowerID.h
Go to the documentation of this file.
1 #ifndef DataFormats_L1THGCal_HGCalTowerID_h
2 #define DataFormats_L1THGCal_HGCalTowerID_h
3 
4 #include <cstdint>
5 
6 // NOTE: in the current implementation HGCalTowerID can only
7 // accomodate 127 bins per coordinate x2 zsides
8 
9 namespace l1t {
10  class HGCalTowerID {
11  public:
13 
14  HGCalTowerID(uint32_t rawId) : rawId_(rawId) {}
15 
16  HGCalTowerID(short subdetIsNode, short zside, unsigned short coord1, unsigned short coord2) {
17  rawId_ = (((subdetIsNode & subDetMask) << subDetShift) | ((coord1 & coordMask) << coord1Shift) |
18  ((coord2 & coordMask) << coord2Shift) | ((zside > 0) & zsideMask) << zsideShift);
19  }
20 
21  short subdet() const { return (rawId_ >> subDetShift) & subDetMask; }
22 
23  short zside() const { return ((rawId_ >> zsideShift) & zsideMask) ? 1 : -1; }
24 
25  unsigned short iEta() const { return (rawId_ >> coord1Shift) & coordMask; }
26 
27  unsigned short iPhi() const { return (rawId_ >> coord2Shift) & coordMask; }
28 
29  unsigned short rawId() const { return rawId_; }
30 
31  private:
32  uint32_t rawId_;
33  static const int subDetMask = 0x1; // two for now 0 is HGC and 1 is HFNose
34  static const int subDetShift = 16;
35  static const int zsideMask = 0x1;
36  static const int zsideShift = 15;
37  static const int coordMask = 0x007F;
38  static const int coord1Shift = 7;
39  static const int coord2Shift = 0;
40  };
41 
42  struct HGCalTowerCoord {
43  HGCalTowerCoord(uint32_t rawId, float eta, float phi) : rawId(rawId), eta(eta), phi(phi) {}
44 
45  const uint32_t rawId;
46  const float eta;
47  const float phi;
48  };
49 } // namespace l1t
50 
51 #endif
l1t::HGCalTowerID::subDetMask
static const int subDetMask
Definition: HGCalTowerID.h:33
l1t::HGCalTowerID::coord2Shift
static const int coord2Shift
Definition: HGCalTowerID.h:39
l1t::HGCalTowerID::zsideShift
static const int zsideShift
Definition: HGCalTowerID.h:36
l1t::HGCalTowerID::subDetShift
static const int subDetShift
Definition: HGCalTowerID.h:34
l1t::HGCalTowerCoord::phi
const float phi
Definition: HGCalTowerID.h:47
l1t::HGCalTowerID::zsideMask
static const int zsideMask
Definition: HGCalTowerID.h:35
l1t::HGCalTowerCoord::rawId
const uint32_t rawId
Definition: HGCalTowerID.h:45
l1t::HGCalTowerCoord
Definition: HGCalTowerID.h:42
l1t::HGCalTowerID::rawId_
uint32_t rawId_
Definition: HGCalTowerID.h:32
l1t::HGCalTowerID::iEta
unsigned short iEta() const
Definition: HGCalTowerID.h:25
l1t::HGCalTowerID::zside
short zside() const
Definition: HGCalTowerID.h:23
l1t::HGCalTowerID::coord1Shift
static const int coord1Shift
Definition: HGCalTowerID.h:38
l1t::HGCalTowerCoord::eta
const float eta
Definition: HGCalTowerID.h:46
l1t::HGCalTowerID
Definition: HGCalTowerID.h:10
l1t
delete x;
Definition: CaloConfig.h:22
l1t::HGCalTowerID::subdet
short subdet() const
Definition: HGCalTowerID.h:21
l1t::HGCalTowerID::HGCalTowerID
HGCalTowerID(uint32_t rawId)
Definition: HGCalTowerID.h:14
l1t::HGCalTowerCoord::HGCalTowerCoord
HGCalTowerCoord(uint32_t rawId, float eta, float phi)
Definition: HGCalTowerID.h:43
l1t::HGCalTowerID::HGCalTowerID
HGCalTowerID()
Definition: HGCalTowerID.h:12
l1t::HGCalTowerID::coordMask
static const int coordMask
Definition: HGCalTowerID.h:37
l1t::HGCalTowerID::iPhi
unsigned short iPhi() const
Definition: HGCalTowerID.h:27
l1t::HGCalTowerID::rawId
unsigned short rawId() const
Definition: HGCalTowerID.h:29
l1t::HGCalTowerID::HGCalTowerID
HGCalTowerID(short subdetIsNode, short zside, unsigned short coord1, unsigned short coord2)
Definition: HGCalTowerID.h:16