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,
26  uint32_t ladder,
28  id_ |= (layer& layerMask_) << layerStartBit_ |
29  (ladder& ladderMask_) << ladderStartBit_ |
30  (module& moduleMask_) << moduleStartBit_;
31  }
32 
33 
35  unsigned int layer() const{
36  return int((id_>>layerStartBit_) & layerMask_);}
37 
39  unsigned int ladder() const
40  { return ((id_>>ladderStartBit_) & ladderMask_) ;}
41 
43  unsigned int module() const
44  { return ((id_>>moduleStartBit_)& moduleMask_) ;}
45 
46  private:
48  static const unsigned int layerStartBit_= 16;
49  static const unsigned int ladderStartBit_= 8;
50  static const unsigned int moduleStartBit_= 2;
52  static const unsigned int layerMask_= 0xF;
53  static const unsigned int ladderMask_= 0xFF;
54  static const unsigned int moduleMask_= 0x3F;
55 };
56 
57 
58 #endif
static const unsigned int layerMask_
two bits would be enough, but we could use the number "0" as a wildcard
Definition: PXBDetId.h:52
unsigned int ladder() const
ladder id
Definition: PXBDetId.h:39
unsigned int layer() const
layer id
Definition: PXBDetId.h:35
std::ostream & operator<<(std::ostream &os, const PXBDetId &id)
Definition: PXBDetId.cc:12
static const unsigned int moduleMask_
Definition: PXBDetId.h:54
static const unsigned int moduleStartBit_
Definition: PXBDetId.h:50
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:48
unsigned int module() const
det id
Definition: PXBDetId.h:43
Definition: DetId.h:18
static const unsigned int ladderStartBit_
Definition: PXBDetId.h:49
static const unsigned int ladderMask_
Definition: PXBDetId.h:53
uint32_t id_
Definition: DetId.h:55
Definition: vlib.h:208
PXBDetId(uint32_t layer, uint32_t ladder, uint32_t module)
Definition: PXBDetId.h:25