CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
const uint32_t rawId
Definition: HGCalTowerID.h:45
short zside() const
Definition: HGCalTowerID.h:23
short subdet() const
Definition: HGCalTowerID.h:21
static const int coord1Shift
Definition: HGCalTowerID.h:38
HGCalTowerID(short subdetIsNode, short zside, unsigned short coord1, unsigned short coord2)
Definition: HGCalTowerID.h:16
unsigned short iEta() const
Definition: HGCalTowerID.h:25
static const int subDetMask
Definition: HGCalTowerID.h:33
static const int zsideShift
Definition: HGCalTowerID.h:36
HGCalTowerID(uint32_t rawId)
Definition: HGCalTowerID.h:14
HGCalTowerCoord(uint32_t rawId, float eta, float phi)
Definition: HGCalTowerID.h:43
static const int zsideMask
Definition: HGCalTowerID.h:35
unsigned short rawId() const
Definition: HGCalTowerID.h:29
static const int coord2Shift
Definition: HGCalTowerID.h:39
static const int coordMask
Definition: HGCalTowerID.h:37
unsigned short iPhi() const
Definition: HGCalTowerID.h:27
static const int subDetShift
Definition: HGCalTowerID.h:34