CMS 3D CMS Logo

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