CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TIBDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_SiStripDetId_TIBDetId_H
2 #define DataFormats_SiStripDetId_TIBDetId_H
3 
4 #include <ostream>
5 #include <vector>
8 
12 class TIBDetId;
13 
14 std::ostream& operator<<(std::ostream& os,const TIBDetId& id);
15 
16 class TIBDetId : public SiStripDetId {
17  public:
19  TIBDetId();
21  TIBDetId(uint32_t rawid);
23  TIBDetId(const DetId& id);
24 
25  TIBDetId(uint32_t layer,
26  uint32_t str_fw_bw,
27  uint32_t str_int_ext,
28  uint32_t str,
29  uint32_t module,
30  uint32_t ster) : SiStripDetId(DetId::Tracker,StripSubdetector::TIB){
31  id_ |= (layer& layerMask_) << layerStartBit_ |
32  (str_fw_bw& str_fw_bwMask_) << str_fw_bwStartBit_ |
33  (str_int_ext& str_int_extMask_) << str_int_extStartBit_ |
34  (str& strMask_) << strStartBit_ |
35  (module& moduleMask_) << moduleStartBit_ |
36  (ster& sterMask_) << sterStartBit_ ;
37  }
38 
39 
41  unsigned int layer() const{
42  return int((id_>>layerStartBit_) & layerMask_);
43  }
44 
46 
53  std::vector<unsigned int> string() const
54  { std::vector<unsigned int> num;
55  num.push_back( side() );
56  num.push_back( order() );
57  num.push_back(stringNumber());
58  return num ;}
59 
61  unsigned int module() const
62  { return ((id_>>moduleStartBit_)& moduleMask_) ;}
63 
64  unsigned int order()const
65  { return ((id_>>str_int_extStartBit_) & str_int_extMask_);}
66 
67  unsigned int side() const
68  {return ((id_>>str_fw_bwStartBit_) & str_fw_bwMask_);}
69 
70 
72  bool isDoubleSide() const;
73 
75  bool isZPlusSide() const
76  { return (!isZMinusSide());}
77 
79  bool isZMinusSide() const
80  { return (side() == 1);}
81 
83  unsigned int layerNumber() const
84  { return layer();}
85 
87  unsigned int stringNumber() const
88  { return ((id_>>strStartBit_) & strMask_);}
89 
91  unsigned int moduleNumber() const
92  { return module();}
93 
95  bool isInternalString() const
96  { return (order() == 1);}
97 
99  bool isExternalString() const
100  { return (!isInternalString());}
101 
103  bool isRPhi()
104  { return (stereo() == 0 && !isDoubleSide());}
105 
107  bool isStereo()
108  { return (stereo() != 0 && !isDoubleSide());}
109 
110 
111 private:
113  static const unsigned int layerStartBit_= 14;
114  static const unsigned int str_fw_bwStartBit_= 12;
115  static const unsigned int str_int_extStartBit_= 10;
116  static const unsigned int strStartBit_= 4;
117  static const unsigned int moduleStartBit_= 2;
118  static const unsigned int sterStartBit_= 0;
120 
121  static const unsigned int layerMask_= 0x7;
122  static const unsigned int str_fw_bwMask_= 0x3;
123  static const unsigned int str_int_extMask_= 0x3;
124  static const unsigned int strMask_= 0x3F;
125  static const unsigned int moduleMask_= 0x3;
126  static const unsigned int sterMask_= 0x3;
127 };
128 
129 
130 inline
132 }
133 inline
134 TIBDetId::TIBDetId(uint32_t rawid) : SiStripDetId(rawid){
135 }
136 inline
137 TIBDetId::TIBDetId(const DetId& id) : SiStripDetId(id.rawId()){
138 }
139 inline
141  // Double Side: only layers 1 and 2
142  return this->glued() == 0 && ( this->layer() == 1 || this->layer() == 2 );
143 }
144 
145 
146 #endif
static const unsigned int str_int_extMask_
Definition: TIBDetId.h:123
bool isZMinusSide() const
Definition: TIBDetId.h:79
unsigned int side() const
Definition: TIBDetId.h:67
unsigned int stringNumber() const
Definition: TIBDetId.h:87
uint32_t stereo() const
Definition: SiStripDetId.h:160
static const unsigned int strMask_
Definition: TIBDetId.h:124
static const unsigned int moduleMask_
Definition: TIBDetId.h:125
bool isDoubleSide() const
Definition: TIBDetId.h:140
TIBDetId()
Definition: TIBDetId.h:131
static const unsigned int layerStartBit_
two bits would be enough, but we could use the number &quot;0&quot; as a wildcard
Definition: TIBDetId.h:113
static const unsigned int moduleStartBit_
Definition: TIBDetId.h:117
static const unsigned int layerMask_
two bits would be enough, but we could use the number &quot;0&quot; as a wildcard
Definition: TIBDetId.h:121
static const unsigned int str_fw_bwStartBit_
Definition: TIBDetId.h:114
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
std::vector< unsigned int > string() const
string id
Definition: TIBDetId.h:53
unsigned int layerNumber() const
Definition: TIBDetId.h:83
static const unsigned int sterStartBit_
Definition: TIBDetId.h:118
unsigned int order() const
Definition: TIBDetId.h:64
bool isExternalString() const
Definition: TIBDetId.h:99
TIBDetId(uint32_t layer, uint32_t str_fw_bw, uint32_t str_int_ext, uint32_t str, uint32_t module, uint32_t ster)
Definition: TIBDetId.h:25
bool isZPlusSide() const
Definition: TIBDetId.h:75
unsigned int moduleNumber() const
Definition: TIBDetId.h:91
static const unsigned int str_int_extStartBit_
Definition: TIBDetId.h:115
static const unsigned int sterMask_
Definition: TIBDetId.h:126
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
Definition: DetId.h:18
uint32_t glued() const
Definition: SiStripDetId.h:155
unsigned int module() const
detector id
Definition: TIBDetId.h:61
static const unsigned int str_fw_bwMask_
Definition: TIBDetId.h:122
uint32_t id_
Definition: DetId.h:55
bool isInternalString() const
Definition: TIBDetId.h:95
unsigned int layer() const
layer id
Definition: TIBDetId.h:41
static const unsigned int strStartBit_
Definition: TIBDetId.h:116
bool isStereo()
Definition: TIBDetId.h:107
bool isRPhi()
Definition: TIBDetId.h:103
Definition: vlib.h:208