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
HGCTriggerDetId::layer_shift
const static uint32_t layer_shift
Definition: HGCTriggerDetId.h:20
HGCTriggerDetId::layer
int layer() const
get the layer #
Definition: HGCTriggerDetId.h:65
HGCTriggerDetId::isEE
bool isEE() const
consistency check : no bits left => no overhead
Definition: HGCTriggerDetId.h:71
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
HGCTriggerDetId::module_shift
const static uint32_t module_shift
Definition: HGCTriggerDetId.h:17
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
HGCTriggerDetId::cell_mask
const static uint32_t cell_mask
Definition: HGCTriggerDetId.h:15
HGCTriggerDetId::HGCTriggerDetId
HGCTriggerDetId()
Definition: HGCTriggerDetId.cc:19
HGCTriggerDetId::getMaskedId
const int getMaskedId(const uint32_t &shift, const uint32_t &mask) const
Definition: HGCTriggerDetId.h:25
HGCTriggerDetId::sector
int sector() const
get the sector #
Definition: HGCTriggerDetId.h:59
HGCTriggerDetId::~HGCTriggerDetId
virtual ~HGCTriggerDetId()
Definition: HGCTriggerDetId.h:37
ForwardSubdetector.h
HGCTriggerDetId
Definition: HGCTriggerDetId.h:8
DetId
Definition: DetId.h:17
HGCTriggerDetId::module
int module() const
get the degree module
Definition: HGCTriggerDetId.h:62
HGCTriggerDetId::module_mask
const static uint32_t module_mask
Definition: HGCTriggerDetId.h:16
HGCTriggerDetId::setMaskedId
void setMaskedId(const uint32_t value, const uint32_t &shift, const uint32_t &mask)
Definition: HGCTriggerDetId.h:26
HGCTriggerDetId::Subdet
Definition: HGCTriggerDetId.h:34
HGCTriggerDetId::zside_shift
const static uint32_t zside_shift
Definition: HGCTriggerDetId.h:22
HGCTriggerDetId::Undefined
static const HGCTriggerDetId Undefined
Definition: HGCTriggerDetId.h:74
HGCTriggerDetId::cell
int cell() const
get the absolute value of the cell #'s in x and y
Definition: HGCTriggerDetId.h:56
operator<<
std::ostream & operator<<(std::ostream &, const HGCTriggerDetId &id)
Definition: HGCTriggerDetId.cc:58
DetId::id_
uint32_t id_
Definition: DetId.h:69
HGCTriggerDetId::UndefinedCell
const static uint32_t UndefinedCell()
Definition: HGCTriggerDetId.h:32
value
Definition: value.py:1
HGCTriggerDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCTriggerDetId.h:68
HGCTriggerDetId::isForward
bool isForward() const
Definition: HGCTriggerDetId.h:72
HGCTrigger
Definition: ForwardSubdetector.h:12
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
DetId.h
HGCTriggerDetId::subdet
ForwardSubdetector subdet() const
get the subdetector
Definition: HGCTriggerDetId.h:53
HGCTriggerDetId::operator=
HGCTriggerDetId & operator=(const DetId &id)
Definition: HGCTriggerDetId.cc:46
HGCTriggerDetId::zside_mask
const static uint32_t zside_mask
Definition: HGCTriggerDetId.h:23
HGCTriggerDetId::sector_shift
const static uint32_t sector_shift
Definition: HGCTriggerDetId.h:18
HGCTriggerDetId::layer_mask
const static uint32_t layer_mask
Definition: HGCTriggerDetId.h:21
HGCTriggerDetId::sector_mask
const static uint32_t sector_mask
Definition: HGCTriggerDetId.h:19
HGCTriggerDetId::cell_shift
const static uint32_t cell_shift
Definition: HGCTriggerDetId.h:14