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) | (((zside > 0) & zsideMask) << zsideShift);
16  }
17 
18  short zside() const { return ((rawId_ >> zsideShift) & zsideMask) ? 1 : -1;}
19 
20  unsigned short iEta() const { return (rawId_ >> coord1Shift) & coordMask; }
21 
22  unsigned short iPhi() const { return (rawId_ >> coord2Shift) & coordMask;}
23 
24  unsigned short rawId() const {return rawId_;}
25 
26 
27  private:
28 
29  unsigned short rawId_;
30  static const int zsideMask = 0x1;
31  static const int zsideShift = 15;
32  static const int coordMask = 0x007F;
33  static const int coord1Shift = 7;
34  static const int coord2Shift = 0;
35  };
36 
37 
38  struct HGCalTowerCoord {
39  HGCalTowerCoord(unsigned short rawId, float eta, float phi): rawId(rawId),
40  eta(eta),
41  phi(phi) {}
42 
43  const unsigned short rawId;
44  const float eta;
45  const float phi;
46 
47  };
48 }
49 
50 
51 
52 
53 #endif
short zside() const
Definition: HGCalTowerID.h:18
const unsigned short rawId
Definition: HGCalTowerID.h:43
static const int coord1Shift
Definition: HGCalTowerID.h:33
delete x;
Definition: CaloConfig.h:22
unsigned short iEta() const
Definition: HGCalTowerID.h:20
HGCalTowerID(short zside, unsigned short coord1, unsigned short coord2)
Definition: HGCalTowerID.h:14
static const int zsideShift
Definition: HGCalTowerID.h:31
HGCalTowerID(unsigned short rawId)
Definition: HGCalTowerID.h:12
HGCalTowerCoord(unsigned short rawId, float eta, float phi)
Definition: HGCalTowerID.h:39
static const int zsideMask
Definition: HGCalTowerID.h:30
unsigned short rawId() const
Definition: HGCalTowerID.h:24
static const int coord2Shift
Definition: HGCalTowerID.h:34
unsigned short rawId_
Definition: HGCalTowerID.h:29
static const int coordMask
Definition: HGCalTowerID.h:32
unsigned short iPhi() const
Definition: HGCalTowerID.h:22