CMS 3D CMS Logo

HGCTriggerDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_ForwardDetId_HGCTriggerDetId_H
2 #define DataFormats_ForwardDetId_HGCTriggerDetId_H 1
3 
4 #include <iosfwd>
7 
8 class HGCTriggerDetId : public DetId {
9  // | DetId | HGCTriggerDetId
10  // | 1111 | 111 | 1 | 11111 | 111111 | 111111 | 1111111
11  // | detector | subdet | zside | layer | sector | mod | cell
12  // | 15 | 7 | 2 | 31 | 64 | 64 | 127
13 
14  const static uint32_t cell_shift = 0;
15  const static uint32_t cell_mask = 0x7F;
16  const static uint32_t module_mask = 0x3F;
17  const static uint32_t module_shift = 7;
18  const static uint32_t sector_shift = 13;
19  const static uint32_t sector_mask = 0x3F;
20  const static uint32_t layer_shift = 19;
21  const static uint32_t layer_mask = 0x1F;
22  const static uint32_t zside_shift = 24;
23  const static uint32_t zside_mask = 0x1;
24 
25  const inline int getMaskedId(const uint32_t& shift, const uint32_t& mask) const { return (id_ >> shift) & mask; }
26  inline void setMaskedId(const uint32_t value, const uint32_t& shift, const uint32_t& mask) {
27  id_ |= ((value & mask) << shift);
28  }
29 
30 public:
31  // undefined cell, for module det id
32  const static uint32_t UndefinedCell() { return cell_mask; }
33 
34  enum { Subdet = HGCTrigger };
37  virtual ~HGCTriggerDetId() {}
39  HGCTriggerDetId(uint32_t rawid);
41  HGCTriggerDetId(ForwardSubdetector subdet, int zp, int lay, int sector, int mod, int cell);
43  HGCTriggerDetId(const DetId& id);
45  HGCTriggerDetId& operator=(const DetId& id);
46 
50  //HGCTriggerDetId geometryCell () const {return HGCTriggerDetId (subdet(), zside(), layer(), sector(), 0, 0);}
51 
53  ForwardSubdetector subdet() const { return HGCTrigger; }
54 
56  int cell() const { return getMaskedId(cell_shift, cell_mask); }
57 
59  int sector() const { return getMaskedId(sector_shift, sector_mask); }
60 
62  int module() const { return getMaskedId(module_shift, module_mask); }
63 
65  int layer() const { return getMaskedId(layer_shift, layer_mask); }
66 
68  int zside() const { return (getMaskedId(zside_shift, zside_mask) ? 1 : -1); }
69 
71  bool isEE() const { return true; }
72  bool isForward() const { return true; }
73 
74  static const HGCTriggerDetId Undefined;
75 };
76 
77 std::ostream& operator<<(std::ostream&, const HGCTriggerDetId& id);
78 
79 #endif
int zside() const
get the z-side of the cell (1/-1)
const int getMaskedId(const uint32_t &shift, const uint32_t &mask) const
bool isEE() const
consistency check : no bits left => no overhead
static const uint32_t cell_shift
static const uint32_t cell_mask
ForwardSubdetector
int module() const
get the degree module
static const uint32_t layer_shift
static const uint32_t zside_mask
static const uint32_t sector_mask
std::ostream & operator<<(std::ostream &, const HGCTriggerDetId &id)
static const uint32_t layer_mask
static const uint32_t zside_shift
int cell() const
get the absolute value of the cell #&#39;s in x and y
int sector() const
get the sector #
ForwardSubdetector subdet() const
get the subdetector
Definition: value.py:1
void setMaskedId(const uint32_t value, const uint32_t &shift, const uint32_t &mask)
static const uint32_t sector_shift
Definition: DetId.h:17
bool isForward() const
static const uint32_t module_shift
static const uint32_t UndefinedCell()
int layer() const
get the layer #
uint32_t id_
Definition: DetId.h:69
HGCTriggerDetId & operator=(const DetId &id)
virtual ~HGCTriggerDetId()
static unsigned int const shift
static const HGCTriggerDetId Undefined
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
static const uint32_t module_mask