CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
CmsTrackerDetIdBuilder Class Reference

#include <CmsTrackerDetIdBuilder.h>

Public Member Functions

GeometricDetbuildId (GeometricDet *det)
 
 CmsTrackerDetIdBuilder (unsigned int layerNumberPXB)
 

Protected Member Functions

void iterate (GeometricDet const *det, int level, unsigned int ID)
 

Private Attributes

unsigned int m_layerNumberPXB
 
std::map< std::string, uint32_t > m_mapNavTypeToDetId
 

Detailed Description

Class to build a geographicalId.

Definition at line 13 of file CmsTrackerDetIdBuilder.h.

Constructor & Destructor Documentation

CmsTrackerDetIdBuilder::CmsTrackerDetIdBuilder ( unsigned int  layerNumberPXB)

Definition at line 12 of file CmsTrackerDetIdBuilder.cc.

13  : m_layerNumberPXB( layerNumberPXB )
14 {}

Member Function Documentation

GeometricDet * CmsTrackerDetIdBuilder::buildId ( GeometricDet det)

Definition at line 17 of file CmsTrackerDetIdBuilder.cc.

References GeometricDet::geographicalID(), iterate(), DetId::rawId(), GeometricDet::setGeographicalID(), lumiQTWidget::t, DetId::Tracker, and patCandidatesForDimuonsSequences_cff::tracker.

Referenced by DDDCmsTrackerContruction::construct().

18 {
19  DetId t( DetId::Tracker, 0 );
20  tracker->setGeographicalID( t );
21  iterate( tracker, 0, tracker->geographicalID().rawId() );
22 
23  return tracker;
24 }
void iterate(GeometricDet const *det, int level, unsigned int ID)
Definition: DetId.h:18
void CmsTrackerDetIdBuilder::iterate ( GeometricDet const *  det,
int  level,
unsigned int  ID 
)
protected

Definition at line 27 of file CmsTrackerDetIdBuilder.cc.

References makeMuonMisalignmentScenario::components, edm::hlt::Exception, i, recoMuon::in, testEve_cfg::level, m_layerNumberPXB, and groupFilesInBlocks::temp.

Referenced by buildId().

28 {
29  std::bitset<32> binary_ID(ID);
30 
31  // SubDetector (useful to know fron now on, valid only after level 0, where SubDetector is assigned)
32  uint32_t mask = (7<<25);
33  uint32_t iSubDet = ID & mask;
34  iSubDet = iSubDet >> 25;
35  //
36 
37  switch( level )
38  {
39  // level 0
40  case 0:
41  {
42  for( uint32_t i = 0; i<(in)->components().size(); i++ )
43  {
44  uint32_t jSubDet = ((in)->components())[i]->geographicalID().rawId();
45  uint32_t temp = ID;
46  temp |= (jSubDet<<25);
47  ((in)->components())[i]->setGeographicalID(temp);
48 
49  switch( jSubDet )
50  {
51  // PXF
52  case 2:
53  {
54  // SubDetector Side start bit is 23 [3 unused and Side length is 2 bit]
55  if(((in)->components())[i]->translation().z()<0. )
56  {
57  temp |= (1<<23); // PXF-
58  }
59  else
60  {
61  temp |= (2<<23); // PXF+
62  }
63  break;
64  }
65  // TID
66  case 4:
67  {
68  temp|= (0<<15); // SubDetector Side start bit is 13 [10 unused and Side length is 2 bit]
69  if((((in)->components())[i])->components()[0]->translation().z()<0. )
70  {
71  temp |= (1<<13); // TIDB = TID-
72  }
73  else
74  {
75  temp |= (2<<13); // TIDF = TID+
76  }
77  break;
78  }
79  // TEC
80  case 6:
81  {
82  temp |= (0<<20); // SubDetector Side start bit is 18 [5 unused and Side length is 2 bit]
83  if(((in)->components())[i]->translation().z()<0. )
84  {
85  temp |= (1<<18); // TEC-
86  }
87  else
88  {
89  temp |= (2<<18); // TEC+
90  }
91  break;
92  }
93  // PXB, TIB, TOB (barrel)
94  default:
95  {
96  // do nothing
97  }
98  // SubDetector switch ends
99  }
100 
101  ((in)->components())[i]->setGeographicalID(DetId(temp));
102 
103  // next level
104  iterate(((in)->components())[i],level+1,((in)->components())[i]->geographicalID().rawId());
105  }
106  break;
107  }
108  // level 1
109  case 1:
110  {
111  for( uint32_t i = 0; i < (in)->components().size(); i++ )
112  {
113  uint32_t temp = ID;
114 
115  switch( iSubDet )
116  {
117  // PXB
118  case 1:
119  {
120  temp |= (((in)->components())[i]->geographicalID().rawId() << m_layerNumberPXB ); // Layer Number start bit is 16 [5 unused]
121  break;
122  }
123  // PXF
124  case 2:
125  {
126  temp |= (((in)->components())[i]->geographicalID().rawId() << 16 ); // Disk Number start bit is 16
127  break;
128  }
129  // TIB
130  case 3:
131  {
132  temp |= (((in)->components())[i]->geographicalID().rawId() << 14); // Layer Number start bit is 14 [8 unused]
133  break;
134  }
135 
136  // TID
137  case 4:
138  {
139  temp |= (((in)->components())[i]->geographicalID().rawId() << 11); // Disk (Wheel) Number start bit is 11
140  break;
141  }
142 
143  // TOB
144  case 5:
145  {
146  temp |= (((in)->components())[i]->geographicalID().rawId() << 14); // Layer Number start bit is 14 [8 unused]
147  break;
148  }
149 
150  // TEC
151  case 6:
152  {
153  temp |= (((in)->components())[i]->geographicalID().rawId() << 14); // Wheel Number start bit is 14
154  break;
155  }
156 
157  // the rest
158  default:
159  {
160  // do nothing
161  }
162 
163  // SubDetector switch ends
164  }
165 
166  ((in)->components())[i]->setGeographicalID( temp );
167 
168  // next level
169  iterate(((in)->components())[i],level+1,((in)->components())[i]->geographicalID().rawId());
170  }
171 
172  break;
173  }
174  // level 2
175  case 2: {
176 
177  for (uint32_t i=0;i<(in)->components().size();i++) {
178 
179  switch (iSubDet) {
180 
181  // PXB
182  case 1:
183  {
184  uint32_t temp = ID;
185  // Ladder Starting bit = 2 (last unused) + 6 (Module Number) = 8
186  temp |= (((in)->components())[i]->geographicalID().rawId()<<8);
187  ((in)->components())[i]->setGeographicalID(temp);
188  break;
189  }
190 
191  // PXF
192  case 2:
193  {
194  uint32_t temp = ID;
195  // Blade Starting bit = 1 (last unused) + 5 (Module Number) + 2 (Plaquette part) = 8
196  temp |= (((in)->components())[i]->geographicalID().rawId()<<8);
197  ((in)->components())[i]->setGeographicalID(temp);
198  break;
199  }
200 
201  // TIB
202  case 3:
203  {
204  uint32_t temp = ID;
205  // Side+Part+String Starting bit = 2 (Module Type) + 2 (Module Number) = 4
206  temp |= (((in)->components())[i]->geographicalID().rawId()<<4);
207  ((in)->components())[i]->setGeographicalID(temp);
208  break;
209  }
210 
211  // TID
212  case 4:
213  {
214  uint32_t temp = ID;
215  // Ring+Part Starting bit = 2 (Module Type) + 5 (Module Number) + 2 (Disk Part)= 9
216  temp |= (((in)->components())[i]->geographicalID().rawId()<<9);
217  ((in)->components())[i]->setGeographicalID(DetId(temp));
218  break;
219  }
220 
221  // TOB
222  case 5:
223  {
224  uint32_t temp = ID;
225  // Side+Rod Starting bit = 2 (Module Type) + 3 (Module Number) = 5
226  temp |= (((in)->components())[i]->geographicalID().rawId()<<5);
227  ((in)->components())[i]->setGeographicalID(temp);
228  break;
229  }
230 
231  // TEC
232  case 6:
233  {
234  uint32_t temp = ID;
235  // Petal+Part Starting bit = 2 (Module Type) + 3 (Module Number) + 3 (Ring Number) = 8
236  temp |= (((in)->components())[i]->geographicalID().rawId()<<8);
237  ((in)->components())[i]->setGeographicalID(temp);
238  break;
239  }
240 
241  // the rest
242  default:
243  {
244  // do nothing
245  }
246 
247  // SubDetector switch ends
248  }
249 
250  // next level
251  iterate(((in)->components())[i],level+1,((in)->components())[i]->geographicalID().rawId());
252  }
253 
254  break;
255  }
256 
257  // level 3
258  case 3:
259  {
260  for (uint32_t i=0;i<(in)->components().size();i++) {
261 
262  switch (iSubDet) {
263 
264  // TEC
265  case 6:
266  {
267  // Ring Starting bit = 2 (Module Type) + 3 (Module Number)
268  uint32_t temp = ID;
269  temp |= (((in)->components())[i]->geographicalID().rawId()<<5);
270  ((in)->components())[i]->setGeographicalID(temp);
271  break;
272  }
273 
274  // the others but TEC
275  default:
276  {
277  uint32_t temp = ID;
278  temp |= (((in)->components())[i]->geographicalID().rawId()<<2); // Starting bit = 2 (Module Type)
279  ((in)->components())[i]->setGeographicalID(temp);
280  }
281 
282  // SubDetector switch ends
283  }
284 
285  // next level
286  iterate(((in)->components())[i],level+1,((in)->components())[i]->geographicalID().rawId());
287 
288  }
289 
290  break;
291  }
292 
293  // level 4
294  case 4:
295  {
296 
297  for (uint32_t i=0;i<(in)->components().size();i++) {
298 
299  switch (iSubDet) {
300 
301  // TEC
302  case 6:
303  {
304  // Module Number bit = 2 (Module Type)
305  uint32_t temp = ID;
306  temp |= (((in)->components())[i]->geographicalID().rawId()<<2);
307  ((in)->components())[i]->setGeographicalID(temp);
308  // next level
309  iterate(((in)->components())[i],level+1,((in)->components())[i]->geographicalID().rawId());
310  break;
311  }
312 
313  // the others stop here!
314  default:
315  {
316  for (uint32_t i=0;i<(in)->components().size();i++) {
317  uint32_t temp = ID;
318  temp |= (((in)->components())[i]->geographicalID().rawId());
319  ((in)->components())[i]->setGeographicalID(temp);
320  }
321  }
322 
323  // SubDetector switch ends
324  }
325 
326  }
327 
328  break;
329  }
330 
331  // level 5
332  case 5:
333  {
334  // TEC Module Type (only TEC arrives here)
335  for (uint32_t i=0;i<(in)->components().size();i++) {
336  uint32_t temp = ID;
337  temp |= (((in)->components())[i]->geographicalID().rawId());
338  ((in)->components())[i]->setGeographicalID(temp);
339  }
340  break;
341  }
342 
343  // throw exception
344  default:
345  {
346  cms::Exception("LogicError") <<" CmsTrackerDetIdBuilder invalid level "<< level;
347  }
348 
349  // level switch ends
350  }
351 
352  return;
353 
354 }
int i
Definition: DBlmapReader.cc:9
void iterate(GeometricDet const *det, int level, unsigned int ID)
uint32_t ID
Definition: Definitions.h:26
Definition: DetId.h:18
tuple level
Definition: testEve_cfg.py:34

Member Data Documentation

unsigned int CmsTrackerDetIdBuilder::m_layerNumberPXB
private

Definition at line 24 of file CmsTrackerDetIdBuilder.h.

Referenced by iterate().

std::map< std::string , uint32_t > CmsTrackerDetIdBuilder::m_mapNavTypeToDetId
private

Definition at line 23 of file CmsTrackerDetIdBuilder.h.