test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackerTopology.cc
Go to the documentation of this file.
5 #include <sstream>
6 
8  const TECValues& tecv, const TIBValues& tibv,
9  const TIDValues& tidv, const TOBValues& tobv) {
10  pbVals_=pxb;
11  pfVals_=pxf;
12  tecVals_=tecv;
13  tibVals_=tibv;
14  tidVals_=tidv;
15  tobVals_=tobv;
16 }
17 
18 
19 
20 unsigned int TrackerTopology::side(const DetId &id) const {
21  uint32_t subdet=id.subdetId();
22  if ( subdet == PixelSubdetector::PixelBarrel )
23  return 0;
24  if ( subdet == PixelSubdetector::PixelEndcap )
25  return pxfSide(id);
26  if ( subdet == StripSubdetector::TIB )
27  return 0;
28  if ( subdet == StripSubdetector::TID )
29  return tidSide(id);
30  if ( subdet == StripSubdetector::TOB )
31  return 0;
32  if ( subdet == StripSubdetector::TEC )
33  return tecSide(id);
34 
35  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::side";
36  return 0;
37 }
38 
39 unsigned int TrackerTopology::layer(const DetId &id) const {
40  uint32_t subdet=id.subdetId();
41  if ( subdet == PixelSubdetector::PixelBarrel )
42  return pxbLayer(id);
43  if ( subdet == PixelSubdetector::PixelEndcap )
44  return pxfDisk(id);
45  if ( subdet == StripSubdetector::TIB )
46  return tibLayer(id);
47  if ( subdet == StripSubdetector::TID )
48  return tidWheel(id);
49  if ( subdet == StripSubdetector::TOB )
50  return tobLayer(id);
51  if ( subdet == StripSubdetector::TEC )
52  return tecWheel(id);
53 
54  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::layer";
55  return 0;
56 }
57 
58 unsigned int TrackerTopology::module(const DetId &id) const {
59  uint32_t subdet=id.subdetId();
60  if ( subdet == PixelSubdetector::PixelBarrel )
61  return pxbModule(id);
62  if ( subdet == PixelSubdetector::PixelEndcap )
63  return pxfModule(id);
64  if ( subdet == StripSubdetector::TIB )
65  return tibModule(id);
66  if ( subdet == StripSubdetector::TID )
67  return tidModule(id);
68  if ( subdet == StripSubdetector::TOB )
69  return tobModule(id);
70  if ( subdet == StripSubdetector::TEC )
71  return tecModule(id);
72 
73  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::module";
74  return 0;
75 }
76 
77 uint32_t TrackerTopology::glued(const DetId &id) const {
78 
79  uint32_t subdet=id.subdetId();
80  if ( subdet == PixelSubdetector::PixelBarrel )
81  return 0;
82  if ( subdet == PixelSubdetector::PixelEndcap )
83  return 0;
84  if ( subdet == StripSubdetector::TIB )
85  return tibGlued(id);
86  if ( subdet == StripSubdetector::TID )
87  return tidGlued(id);
88  if ( subdet == StripSubdetector::TOB )
89  return tobGlued(id);
90  if ( subdet == StripSubdetector::TEC )
91  return tecGlued(id);
92 
93  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::glued";
94  return 0;
95 }
96 
97 uint32_t TrackerTopology::stack(const DetId &id) const {
98 
99  uint32_t subdet=id.subdetId();
100  if ( subdet == PixelSubdetector::PixelBarrel )
101  return 0;
102  if ( subdet == PixelSubdetector::PixelEndcap )
103  return 0;
104  if ( subdet == StripSubdetector::TIB )
105  return tibStack(id);
106  if ( subdet == StripSubdetector::TID )
107  return tidStack(id);
108  if ( subdet == StripSubdetector::TOB )
109  return tobStack(id);
110  if ( subdet == StripSubdetector::TEC )
111  return tecStack(id);
112 
113  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::stack";
114 }
115 
116 uint32_t TrackerTopology::lower(const DetId &id) const {
117 
118  uint32_t subdet=id.subdetId();
119  if ( subdet == PixelSubdetector::PixelBarrel )
120  return 0;
121  if ( subdet == PixelSubdetector::PixelEndcap )
122  return 0;
123  if ( subdet == StripSubdetector::TIB )
124  return tibLower(id);
125  if ( subdet == StripSubdetector::TID )
126  return tidLower(id);
127  if ( subdet == StripSubdetector::TOB )
128  return tobLower(id);
129  if ( subdet == StripSubdetector::TEC )
130  return tecLower(id);
131 
132  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::lower";
133 }
134 
135 uint32_t TrackerTopology::upper(const DetId &id) const {
136 
137  uint32_t subdet=id.subdetId();
138  if ( subdet == PixelSubdetector::PixelBarrel )
139  return 0;
140  if ( subdet == PixelSubdetector::PixelEndcap )
141  return 0;
142  if ( subdet == StripSubdetector::TIB )
143  return tibUpper(id);
144  if ( subdet == StripSubdetector::TID )
145  return tidUpper(id);
146  if ( subdet == StripSubdetector::TOB )
147  return tobUpper(id);
148  if ( subdet == StripSubdetector::TEC )
149  return tecUpper(id);
150 
151  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::upper";
152 }
153 
154 
155 bool TrackerTopology::isStereo(const DetId &id) const {
156 
157  uint32_t subdet=id.subdetId();
158  if ( subdet == PixelSubdetector::PixelBarrel )
159  return false;
160  if ( subdet == PixelSubdetector::PixelEndcap )
161  return false;
162  if ( subdet == StripSubdetector::TIB )
163  return tibIsStereo(id);
164  if ( subdet == StripSubdetector::TID )
165  return tidIsStereo(id);
166  if ( subdet == StripSubdetector::TOB )
167  return tobIsStereo(id);
168  if ( subdet == StripSubdetector::TEC )
169  return tecIsStereo(id);
170 
171  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::isStereo";
172  return 0;
173 }
174 
175 bool TrackerTopology::isRPhi(const DetId &id) const {
176 
177  uint32_t subdet=id.subdetId();
178  if ( subdet == PixelSubdetector::PixelBarrel )
179  return false;
180  if ( subdet == PixelSubdetector::PixelEndcap )
181  return false;
182  if ( subdet == StripSubdetector::TIB )
183  return tibIsRPhi(id);
184  if ( subdet == StripSubdetector::TID )
185  return tidIsRPhi(id);
186  if ( subdet == StripSubdetector::TOB )
187  return tobIsRPhi(id);
188  if ( subdet == StripSubdetector::TEC )
189  return tecIsRPhi(id);
190 
191  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::isRPhi";
192  return 0;
193 }
194 bool TrackerTopology::isLower(const DetId &id) const {
195 
196  uint32_t subdet=id.subdetId();
197  if ( subdet == PixelSubdetector::PixelBarrel )
198  return false;
199  if ( subdet == PixelSubdetector::PixelEndcap )
200  return false;
201  if ( subdet == StripSubdetector::TIB )
202  return tibLower(id)!=0;
203  if ( subdet == StripSubdetector::TID )
204  return tidLower(id)!=0;
205  if ( subdet == StripSubdetector::TOB )
206  return tobLower(id)!=0;
207  if ( subdet == StripSubdetector::TEC )
208  return tecLower(id)!=0;
209 
210  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::isLower";
211  return 0;
212 
213 }
214 
215 bool TrackerTopology::isUpper(const DetId &id) const {
216 
217  uint32_t subdet=id.subdetId();
218  if ( subdet == PixelSubdetector::PixelBarrel )
219  return false;
220  if ( subdet == PixelSubdetector::PixelEndcap )
221  return false;
222  if ( subdet == StripSubdetector::TIB )
223  return tibUpper(id)!=0;
224  if ( subdet == StripSubdetector::TID )
225  return tidUpper(id)!=0;
226  if ( subdet == StripSubdetector::TOB )
227  return tobUpper(id)!=0;
228  if ( subdet == StripSubdetector::TEC )
229  return tecUpper(id)!=0;
230 
231  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::isUpper";
232  return 0;
233 }
234 
236 
237  uint32_t subdet=id.subdetId();
238  if ( subdet == PixelSubdetector::PixelBarrel )
239  return 0;
240  if ( subdet == PixelSubdetector::PixelEndcap )
241  return 0;
242  if ( subdet == StripSubdetector::TIB )
243  return tibPartnerDetId(id);
244  if ( subdet == StripSubdetector::TID )
245  return tidPartnerDetId(id);
246  if ( subdet == StripSubdetector::TOB )
247  return tobPartnerDetId(id);
248  if ( subdet == StripSubdetector::TEC )
249  return tecPartnerDetId(id);
250 
251  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::partnerDetId";
252  return 0;
253 }
254 
256  uint32_t subdet=id.subdetId();
257  std::stringstream strstr;
258 
259  if ( subdet == PixelSubdetector::PixelBarrel ) {
260  unsigned int theLayer = pxbLayer(id);
261  unsigned int theLadder = pxbLadder(id);
262  unsigned int theModule = pxbModule(id);
263  strstr << "PixelBarrel"
264  << " Layer " << theLayer
265  << " Ladder " << theLadder
266  << " Module " << theModule ;
267  strstr << " (" << id.rawId() << ")";
268  return strstr.str();
269  }
270 
271  if ( subdet == PixelSubdetector::PixelEndcap ) {
272  unsigned int theSide = pxfSide(id);
273  unsigned int theDisk = pxfDisk(id);
274  unsigned int theBlade = pxfBlade(id);
275  unsigned int thePanel = pxfPanel(id);
276  unsigned int theModule = pxfModule(id);
277  std::string side = (pxfSide(id) == 1 ) ? "-" : "+";
278  strstr << "PixelEndcap"
279  << " Side " << theSide << side
280  << " Disk " << theDisk
281  << " Blade " << theBlade
282  << " Panel " << thePanel
283  << " Module " << theModule ;
284  strstr << " (" << id.rawId() << ")";
285  return strstr.str();
286  }
287 
288  if ( subdet == StripSubdetector::TIB ) {
289  unsigned int theLayer = tibLayer(id);
290  std::vector<unsigned int> theString = tibStringInfo(id);
291  unsigned int theModule = tibModule(id);
294  side = (theString[0] == 1 ) ? "-" : "+";
295  part = (theString[1] == 1 ) ? "int" : "ext";
297  type = (isStereo(id)) ? "stereo" : type;
298  type = (isRPhi(id)) ? "r-phi" : type;
299  type = (isStereo(id) || isRPhi(id)) ? type+" glued": "module";
300  std::string typeUpgrade;
301  typeUpgrade = (isLower(id)) ? "lower" : typeUpgrade;
302  typeUpgrade = (isUpper(id)) ? "upper" : typeUpgrade;
303  typeUpgrade = (isUpper(id) || isLower(id)) ? typeUpgrade+" stack": "module";
304  strstr << "TIB" << side
305  << " Layer " << theLayer << " " << part
306  << " String " << theString[2];
307  strstr << " Module for phase0 " << theModule << " " << type;
308  strstr << " Module for phase2 " << theModule << " " << typeUpgrade;
309  strstr << " (" << id.rawId() << ")";
310  return strstr.str();
311  }
312 
313  if ( subdet == StripSubdetector::TID ) {
314  unsigned int theSide = tidSide(id);
315  unsigned int theWheel = tidWheel(id);
316  unsigned int theRing = tidRing(id);
317  std::vector<unsigned int> theModule = tidModuleInfo(id);
320  side = (tidSide(id) == 1 ) ? "-" : "+";
321  part = (theModule[0] == 1 ) ? "back" : "front";
323  type = (isStereo(id)) ? "stereo" : type;
324  type = (isRPhi(id)) ? "r-phi" : type;
325  type = (isStereo(id) || isRPhi(id)) ? type+" glued": "module";
326  std::string typeUpgrade;
327  typeUpgrade = (isLower(id)) ? "lower" : typeUpgrade;
328  typeUpgrade = (isUpper(id)) ? "upper" : typeUpgrade;
329  typeUpgrade = (isUpper(id) || isLower(id)) ? typeUpgrade+" stack": "module";
330  strstr << "TID"
331  << " Side " << theSide << side
332  << " Wheel " << theWheel
333  << " Ring " << theRing << " " << part;
334  strstr << " Module for phase0 " << theModule[1] << " " << type;
335  strstr << " Module for phase2 " << theModule[1] << " " << typeUpgrade;
336  strstr << " (" << id.rawId() << ")";
337  return strstr.str();
338  }
339 
340  if ( subdet == StripSubdetector::TOB ) {
341  unsigned int theLayer = tobLayer(id);
342  std::vector<unsigned int> theRod = tobRodInfo(id);
343  unsigned int theModule = tobModule(id);
346  side = (theRod[0] == 1 ) ? "-" : "+";
348  type = (isStereo(id)) ? "stereo" : type;
349  type = (isRPhi(id)) ? "r-phi" : type;
350  type = (isStereo(id) || isRPhi(id)) ? type+" glued": "module";
351  std::string typeUpgrade;
352  typeUpgrade = (isLower(id)) ? "lower" : typeUpgrade;
353  typeUpgrade = (isUpper(id)) ? "upper" : typeUpgrade;
354  typeUpgrade = (isUpper(id) || isLower(id)) ? typeUpgrade+" stack": "module";
355  strstr << "TOB" << side
356  << " Layer " << theLayer
357  << " Rod " << theRod[1];
358  strstr << " Module for phase0 " << theModule << " " << type;
359  strstr << " Module for phase2 " << theModule << " " << typeUpgrade;
360  strstr << " (" << id.rawId() << ")";
361  return strstr.str();
362  }
363 
364  if ( subdet == StripSubdetector::TEC ) {
365  unsigned int theSide = tecSide(id);
366  unsigned int theWheel = tecWheel(id);
367  unsigned int theModule = tecModule(id);
368  std::vector<unsigned int> thePetal = tecPetalInfo(id);
369  unsigned int theRing = tecRing(id);
371  std::string petal;
372  side = (tecSide(id) == 1 ) ? "-" : "+";
373  petal = (thePetal[0] == 1 ) ? "back" : "front";
375  type = (isStereo(id)) ? "stereo" : type;
376  type = (isRPhi(id)) ? "r-phi" : type;
377  type = (isStereo(id) || isRPhi(id)) ? type+" glued": "module";
378  std::string typeUpgrade;
379  typeUpgrade = (isLower(id)) ? "lower" : typeUpgrade;
380  typeUpgrade = (isUpper(id)) ? "upper" : typeUpgrade;
381  typeUpgrade = (isUpper(id) || isLower(id)) ? typeUpgrade+" stack": "module";
382  strstr << "TEC"
383  << " Side " << theSide << side
384  << " Wheel " << theWheel
385  << " Petal " << thePetal[1] << " " << petal
386  << " Ring " << theRing;
387  strstr << " Module for phase0 " << theModule << " " << type;
388  strstr << " Module for phase2 " << theModule << " " << typeUpgrade;
389  strstr << " (" << id.rawId() << ")";
390 
391  return strstr.str();
392  }
393 
394 
395  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::module";
396  return strstr.str();
397 }
398 
399 
401  switch(id.subdetId()) {
404  case StripSubdetector::TID: switch (tidRing(id)) {
405  case 1: return SiStripDetId::W1A;
406  case 2: return SiStripDetId::W2A;
407  case 3: return SiStripDetId::W3A;
408  }
409  case StripSubdetector::TEC: switch (tecRing(id)) {
410  case 1: return SiStripDetId::W1B;
411  case 2: return SiStripDetId::W2B;
412  case 3: return SiStripDetId::W3B;
413  case 4: return SiStripDetId::W4;
414  //generic function to return DetIds and boolean factors
415  case 5: return SiStripDetId::W5;
416  case 6: return SiStripDetId::W6;
417  case 7: return SiStripDetId::W7;
418  }
419  }
421 }
DetId tidPartnerDetId(const DetId &id) const
type
Definition: HCALResponse.h:21
uint32_t tibStack(const DetId &id) const
uint32_t tobGlued(const DetId &id) const
uint32_t upper(const DetId &id) const
unsigned int tibLayer(const DetId &id) const
unsigned int tidRing(const DetId &id) const
bool tobIsStereo(const DetId &id) const
uint32_t tobLower(const DetId &id) const
std::vector< unsigned int > tidModuleInfo(const DetId &id) const
unsigned int pxfDisk(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
unsigned int pxbLadder(const DetId &id) const
uint32_t tobStack(const DetId &id) const
unsigned int side(const DetId &id) const
uint32_t tecGlued(const DetId &id) const
bool isStereo(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
unsigned int pxbModule(const DetId &id) const
SiStripDetId::ModuleGeometry moduleGeometry(const DetId &id) const
std::vector< unsigned int > tibStringInfo(const DetId &id) const
bool tobIsRPhi(const DetId &id) const
std::string print(DetId detid) const
uint32_t tecPartnerDetId(const DetId &id) const
PixelEndcapValues pfVals_
DetId partnerDetId(const DetId &id) const
bool tidIsStereo(const DetId &id) const
DetId tibPartnerDetId(const DetId &id) const
DetId tobPartnerDetId(const DetId &id) const
bool isLower(const DetId &id) const
unsigned int module(const DetId &id) const
bool tecIsStereo(const DetId &id) const
std::vector< unsigned int > tecPetalInfo(const DetId &id) const
uint32_t tecUpper(const DetId &id) const
bool tibIsRPhi(const DetId &id) const
unsigned int tidSide(const DetId &id) const
PixelBarrelValues pbVals_
std::vector< unsigned int > tobRodInfo(const DetId &id) const
unsigned int tidModule(const DetId &id) const
uint32_t tidStack(const DetId &id) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
bool tecIsRPhi(const DetId &id) const
unsigned int tibModule(const DetId &id) const
unsigned int pxfModule(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
bool isUpper(const DetId &id) const
unsigned int tecModule(const DetId &id) const
Definition: DetId.h:18
bool tidIsRPhi(const DetId &id) const
uint32_t tibGlued(const DetId &id) const
uint32_t stack(const DetId &id) const
part
Definition: HCALResponse.h:20
uint32_t tidLower(const DetId &id) const
bool tibIsStereo(const DetId &id) const
uint32_t tecLower(const DetId &id) const
unsigned int tobModule(const DetId &id) const
unsigned int layer(const DetId &id) const
uint32_t lower(const DetId &id) const
uint32_t tibUpper(const DetId &id) const
uint32_t tecStack(const DetId &id) const
unsigned int pxfSide(const DetId &id) const
uint32_t tibLower(const DetId &id) const
uint32_t tobUpper(const DetId &id) const
bool isRPhi(const DetId &id) const
uint32_t glued(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
uint32_t tidUpper(const DetId &id) const
TrackerTopology(const PixelBarrelValues &pxb, const PixelEndcapValues &pxf, const TECValues &tecv, const TIBValues &tibv, const TIDValues &tidv, const TOBValues &tobv)
unsigned int pxfPanel(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const
uint32_t tidGlued(const DetId &id) const