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
l1t::HGCalTowerID::coord2Shift
static const int coord2Shift
Definition: HGCalTowerID.h:33
l1t::HGCalTowerID::zsideShift
static const int zsideShift
Definition: HGCalTowerID.h:30
l1t::HGCalTowerID::rawId_
unsigned short rawId_
Definition: HGCalTowerID.h:28
l1t::HGCalTowerCoord::phi
const float phi
Definition: HGCalTowerID.h:41
l1t::HGCalTowerID::zsideMask
static const int zsideMask
Definition: HGCalTowerID.h:29
l1t::HGCalTowerCoord::rawId
const unsigned short rawId
Definition: HGCalTowerID.h:39
l1t::HGCalTowerCoord
Definition: HGCalTowerID.h:36
l1t::HGCalTowerID::HGCalTowerID
HGCalTowerID(unsigned short rawId)
Definition: HGCalTowerID.h:12
l1t::HGCalTowerID::iEta
unsigned short iEta() const
Definition: HGCalTowerID.h:21
l1t::HGCalTowerID::zside
short zside() const
Definition: HGCalTowerID.h:19
l1t::HGCalTowerID::coord1Shift
static const int coord1Shift
Definition: HGCalTowerID.h:32
l1t::HGCalTowerCoord::eta
const float eta
Definition: HGCalTowerID.h:40
l1t::HGCalTowerID
Definition: HGCalTowerID.h:8
l1t
delete x;
Definition: CaloConfig.h:22
l1t::HGCalTowerID::HGCalTowerID
HGCalTowerID()
Definition: HGCalTowerID.h:10
l1t::HGCalTowerCoord::HGCalTowerCoord
HGCalTowerCoord(unsigned short rawId, float eta, float phi)
Definition: HGCalTowerID.h:37
l1t::HGCalTowerID::coordMask
static const int coordMask
Definition: HGCalTowerID.h:31
l1t::HGCalTowerID::iPhi
unsigned short iPhi() const
Definition: HGCalTowerID.h:23
l1t::HGCalTowerID::HGCalTowerID
HGCalTowerID(short zside, unsigned short coord1, unsigned short coord2)
Definition: HGCalTowerID.h:14
l1t::HGCalTowerID::rawId
unsigned short rawId() const
Definition: HGCalTowerID.h:25