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 
9 class HGCTriggerDetId : public DetId {
10 
11  // | DetId | HGCTriggerDetId
12  // | 1111 | 111 | 1 | 11111 | 111111 | 111111 | 1111111
13  // | detector | subdet | zside | layer | sector | mod | cell
14  // | 15 | 7 | 2 | 31 | 64 | 64 | 127
15 
16  const static uint32_t cell_shift = 0;
17  const static uint32_t cell_mask = 0x7F;
18  const static uint32_t module_mask = 0x3F;
19  const static uint32_t module_shift = 7;
20  const static uint32_t sector_shift = 13;
21  const static uint32_t sector_mask = 0x3F;
22  const static uint32_t layer_shift = 19;
23  const static uint32_t layer_mask = 0x1F;
24  const static uint32_t zside_shift = 24;
25  const static uint32_t zside_mask = 0x1;
26 
27  const inline int getMaskedId(const uint32_t &shift, const uint32_t &mask) const { return (id_ >> shift) & mask ; }
28  inline void setMaskedId( const uint32_t value, const uint32_t &shift, const uint32_t &mask ){ id_|= ((value & mask ) <<shift ); }
29 
30 public:
31  // undefined cell, for module det id
32  const static uint32_t UndefinedCell() { return cell_mask ; }
33 
34 
35  enum { Subdet=HGCTrigger};
38  virtual ~HGCTriggerDetId(){}
40  HGCTriggerDetId(uint32_t rawid);
42  HGCTriggerDetId(ForwardSubdetector subdet, int zp, int lay, int sector, int mod, int cell);
44  HGCTriggerDetId(const DetId& id);
46  HGCTriggerDetId& operator=(const DetId& id);
47 
51  //HGCTriggerDetId geometryCell () const {return HGCTriggerDetId (subdet(), zside(), layer(), sector(), 0, 0);}
52 
54  ForwardSubdetector subdet() const { return HGCTrigger; }
55 
57  int cell() const { return getMaskedId(cell_shift,cell_mask); }
58 
60  int sector() const { return getMaskedId(sector_shift,sector_mask); }
61 
63  int module() const { return getMaskedId(module_shift,module_mask); }
64 
66  int layer() const { return getMaskedId(layer_shift,layer_mask); }
67 
69  int zside() const { return ( getMaskedId(zside_shift,zside_mask) ? 1 : -1); }
70 
72  bool isEE() const { return true; }
73  bool isForward() const { return true; }
74 
75  static const HGCTriggerDetId Undefined;
76 
77 };
78 
79 std::ostream& operator<<(std::ostream&,const HGCTriggerDetId& id);
80 
81 
82 #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:18
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:56
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