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  static const int subDetMask = 0x1; // two for now 0 is HGC and 1 is HFNose
32  static const int subDetShift = 16;
33  static const int zsideMask = 0x1;
34  static const int zsideShift = 15;
35  static const int coordMask = 0x007F;
36  static const int coord1Shift = 7;
37  static const int coord2Shift = 0;
38 
39  private:
40  uint32_t rawId_;
41  };
42 
43  struct HGCalTowerCoord {
44  HGCalTowerCoord(uint32_t rawId, float eta, float phi) : rawId(rawId), eta(eta), phi(phi) {}
45 
46  const uint32_t rawId;
47  const float eta;
48  const float phi;
49  };
50 } // namespace l1t
51 
52 #endif
const uint32_t rawId
Definition: HGCalTowerID.h:46
short zside() const
Definition: HGCalTowerID.h:23
static const int coord1Shift
Definition: HGCalTowerID.h:36
HGCalTowerID(short subdetIsNode, short zside, unsigned short coord1, unsigned short coord2)
Definition: HGCalTowerID.h:16
delete x;
Definition: CaloConfig.h:22
static const int subDetMask
Definition: HGCalTowerID.h:31
static const int zsideShift
Definition: HGCalTowerID.h:34
unsigned short iEta() const
Definition: HGCalTowerID.h:25
HGCalTowerID(uint32_t rawId)
Definition: HGCalTowerID.h:14
HGCalTowerCoord(uint32_t rawId, float eta, float phi)
Definition: HGCalTowerID.h:44
unsigned short iPhi() const
Definition: HGCalTowerID.h:27
static const int zsideMask
Definition: HGCalTowerID.h:33
short subdet() const
Definition: HGCalTowerID.h:21
static const int coord2Shift
Definition: HGCalTowerID.h:37
static const int coordMask
Definition: HGCalTowerID.h:35
unsigned short rawId() const
Definition: HGCalTowerID.h:29
static const int subDetShift
Definition: HGCalTowerID.h:32