CMS 3D CMS Logo

PXBDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_SiStripDetId_PXBDetId_H
2 #define DataFormats_SiStripDetId_PXBDetId_H
3 
4 #include <ostream>
7 
12 class PXBDetId;
13 
14 std::ostream& operator<<(std::ostream& os, const PXBDetId& id);
15 
16 class PXBDetId : public DetId {
17 public:
19  PXBDetId();
21  PXBDetId(uint32_t rawid);
23  PXBDetId(const DetId& id);
24 
25  PXBDetId(uint32_t layer, uint32_t ladder, uint32_t module) : DetId(DetId::Tracker, PixelSubdetector::PixelBarrel) {
28  }
29 
31  unsigned int layer() const { return int((id_ >> layerStartBit_) & layerMask_); }
32 
34  unsigned int ladder() const { return ((id_ >> ladderStartBit_) & ladderMask_); }
35 
37  unsigned int module() const { return ((id_ >> moduleStartBit_) & moduleMask_); }
38 
39 private:
41  static const unsigned int layerStartBit_ = 16;
42  static const unsigned int ladderStartBit_ = 8;
43  static const unsigned int moduleStartBit_ = 2;
45  static const unsigned int layerMask_ = 0xF;
46  static const unsigned int ladderMask_ = 0xFF;
47  static const unsigned int moduleMask_ = 0x3F;
48 };
49 
50 #endif
unsigned int module() const
det id
Definition: PXBDetId.h:37
static const unsigned int layerMask_
two bits would be enough, but we could use the number "0" as a wildcard
Definition: PXBDetId.h:45
unsigned int layer() const
layer id
Definition: PXBDetId.h:31
std::ostream & operator<<(std::ostream &os, const PXBDetId &id)
Definition: PXBDetId.cc:8
static const unsigned int moduleMask_
Definition: PXBDetId.h:47
static const unsigned int moduleStartBit_
Definition: PXBDetId.h:43
PXBDetId()
Definition: PXBDetId.cc:3
static const unsigned int layerStartBit_
two bits would be enough, but we could use the number "0" as a wildcard
Definition: PXBDetId.h:41
Definition: DetId.h:17
static const unsigned int ladderStartBit_
Definition: PXBDetId.h:42
static const unsigned int ladderMask_
Definition: PXBDetId.h:46
uint32_t id_
Definition: DetId.h:69
unsigned int ladder() const
ladder id
Definition: PXBDetId.h:34
PXBDetId(uint32_t layer, uint32_t ladder, uint32_t module)
Definition: PXBDetId.h:25