test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TOBDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_SiStripDetId_TOBDetId_H
2 #define DataFormats_SiStripDetId_TOBDetId_H
3 
4 #include <ostream>
5 #include <vector>
8 
12 class TOBDetId;
13 
14 std::ostream& operator<<(std::ostream& os,const TOBDetId& id);
15 
16 class TOBDetId : public SiStripDetId {
17  public:
19  TOBDetId();
21  TOBDetId(uint32_t rawid);
23  TOBDetId(const DetId& id);
24 
25  TOBDetId(uint32_t layer,
26  uint32_t rod_fw_bw,
27  uint32_t rod,
28  uint32_t module,
29  uint32_t ster) : SiStripDetId(DetId::Tracker,StripSubdetector::TOB){
30  id_ |= (layer& layerMask_) << layerStartBit_ |
31  (rod_fw_bw& rod_fw_bwMask_) << rod_fw_bwStartBit_ |
32  (rod& rodMask_) << rodStartBit_ |
33  (module& moduleMask_) << moduleStartBit_ |
34  (ster& sterMask_) << sterStartBit_ ;
35  }
36 
37 
39  unsigned int layer() const{
40  return int((id_>>layerStartBit_) & layerMask_);
41  }
42 
44 
49  std::vector<unsigned int> rod() const
50  { std::vector<unsigned int> num;
51  num.push_back( side() );
52  num.push_back( rodNumber() );
53  return num ;}
54 
55  unsigned int side() const
56  { return ((id_>>rod_fw_bwStartBit_) & rod_fw_bwMask_);}
58  unsigned int module() const
59  { return ((id_>>moduleStartBit_)& moduleMask_) ;}
60 
62  bool isDoubleSide() const;
63 
65  bool isZPlusSide() const
66  { return (!isZMinusSide());}
67 
69  bool isZMinusSide() const
70  { return (side() == 1);}
71 
73  unsigned int layerNumber() const
74  { return layer();}
75 
77  unsigned int rodNumber() const
78  { return ((id_>>rodStartBit_) & rodMask_);}
79 
81  unsigned int moduleNumber() const
82  { return module();}
83 
85  bool isRPhi()
86  { return (stereo() == 0 && !isDoubleSide());}
87 
89  bool isStereo()
90  { return (stereo() != 0 && !isDoubleSide());}
91 
92 private:
94  static const unsigned int layerStartBit_= 14;
95  static const unsigned int rod_fw_bwStartBit_= 12;
96  static const unsigned int rodStartBit_= 5;
97  static const unsigned int moduleStartBit_= 2;
98  static const unsigned int sterStartBit_= 0;
100 
101  static const unsigned int layerMask_= 0x7;
102  static const unsigned int rod_fw_bwMask_= 0x3;
103  static const unsigned int rodMask_= 0x7F;
104  static const unsigned int moduleMask_= 0x7;
105  static const unsigned int sterMask_= 0x3;
106 };
107 
108 
109 inline
111 }
112 inline
113 TOBDetId::TOBDetId(uint32_t rawid) : SiStripDetId(rawid) {
114 }
115 inline
116 TOBDetId::TOBDetId(const DetId& id) : SiStripDetId(id.rawId()) {
117 }
118 inline
120  // Double Side: only layers 1 and 2
121  return this->glued() == 0 && ( this->layer() == 1 || this->layer() == 2 );
122 }
123 
124 
125 #endif
unsigned int rodNumber() const
Definition: TOBDetId.h:77
unsigned int layer() const
layer id
Definition: TOBDetId.h:39
uint32_t stereo() const
Definition: SiStripDetId.h:160
static const unsigned int rod_fw_bwStartBit_
Definition: TOBDetId.h:95
static const unsigned int layerMask_
two bits would be enough, but we could use the number &quot;0&quot; as a wildcard
Definition: TOBDetId.h:101
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
unsigned int side() const
Definition: TOBDetId.h:55
static const unsigned int layerStartBit_
two bits would be enough, but we could use the number &quot;0&quot; as a wildcard
Definition: TOBDetId.h:94
std::vector< unsigned int > rod() const
rod id
Definition: TOBDetId.h:49
bool isZMinusSide() const
Definition: TOBDetId.h:69
static const unsigned int rod_fw_bwMask_
Definition: TOBDetId.h:102
static const unsigned int moduleStartBit_
Definition: TOBDetId.h:97
unsigned int layerNumber() const
Definition: TOBDetId.h:73
static const unsigned int moduleMask_
Definition: TOBDetId.h:104
TOBDetId()
Definition: TOBDetId.h:110
static const unsigned int sterStartBit_
Definition: TOBDetId.h:98
bool isStereo()
Definition: TOBDetId.h:89
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
static const unsigned int rodMask_
Definition: TOBDetId.h:103
Definition: DetId.h:18
uint32_t glued() const
Definition: SiStripDetId.h:155
uint32_t id_
Definition: DetId.h:55
TOBDetId(uint32_t layer, uint32_t rod_fw_bw, uint32_t rod, uint32_t module, uint32_t ster)
Definition: TOBDetId.h:25
static const unsigned int sterMask_
Definition: TOBDetId.h:105
bool isDoubleSide() const
Definition: TOBDetId.h:119
unsigned int module() const
detector id
Definition: TOBDetId.h:58
bool isZPlusSide() const
Definition: TOBDetId.h:65
bool isRPhi()
Definition: TOBDetId.h:85
static const unsigned int rodStartBit_
Definition: TOBDetId.h:96
Definition: vlib.h:208
unsigned int moduleNumber() const
Definition: TOBDetId.h:81