CMS 3D CMS Logo

TrackerTopology.cc
Go to the documentation of this file.
5 #include <sstream>
6 
8  const PixelEndcapValues &pxf,
9  const TECValues &tecv,
10  const TIBValues &tibv,
11  const TIDValues &tidv,
12  const TOBValues &tobv)
13  : pbVals_(pxb),
14  pfVals_(pxf),
15  tobVals_(tobv),
16  tibVals_(tibv),
17  tidVals_(tidv),
18  tecVals_(tecv),
27 
28 unsigned int TrackerTopology::side(const DetId &id) const {
29  uint32_t subdet = id.subdetId();
30  if (subdet == PixelSubdetector::PixelBarrel)
31  return 0;
32  if (subdet == PixelSubdetector::PixelEndcap)
33  return pxfSide(id);
34  if (subdet == SiStripSubdetector::TIB)
35  return 0;
36  if (subdet == SiStripSubdetector::TID)
37  return tidSide(id);
38  if (subdet == SiStripSubdetector::TOB)
39  return 0;
40  if (subdet == SiStripSubdetector::TEC)
41  return tecSide(id);
42 
43  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::side";
44  return 0;
45 }
46 
47 unsigned int TrackerTopology::layer(const DetId &id) const {
48  uint32_t subdet = id.subdetId();
49  if (subdet == PixelSubdetector::PixelBarrel)
50  return pxbLayer(id);
51  if (subdet == PixelSubdetector::PixelEndcap)
52  return pxfDisk(id);
53  if (subdet == SiStripSubdetector::TIB)
54  return tibLayer(id);
55  if (subdet == SiStripSubdetector::TID)
56  return tidWheel(id);
57  if (subdet == SiStripSubdetector::TOB)
58  return tobLayer(id);
59  if (subdet == SiStripSubdetector::TEC)
60  return tecWheel(id);
61 
62  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::layer";
63  return 0;
64 }
65 
66 unsigned int TrackerTopology::module(const DetId &id) const {
67  uint32_t subdet = id.subdetId();
68  if (subdet == PixelSubdetector::PixelBarrel)
69  return pxbModule(id);
70  if (subdet == PixelSubdetector::PixelEndcap)
71  return pxfModule(id);
72  if (subdet == SiStripSubdetector::TIB)
73  return tibModule(id);
74  if (subdet == SiStripSubdetector::TID)
75  return tidModule(id);
76  if (subdet == SiStripSubdetector::TOB)
77  return tobModule(id);
78  if (subdet == SiStripSubdetector::TEC)
79  return tecModule(id);
80 
81  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::module";
82  return 0;
83 }
84 
85 uint32_t TrackerTopology::glued(const DetId &id) const {
86  uint32_t subdet = id.subdetId();
87  if (subdet == PixelSubdetector::PixelBarrel)
88  return 0;
89  if (subdet == PixelSubdetector::PixelEndcap)
90  return 0;
91  if (subdet == SiStripSubdetector::TIB)
92  return tibGlued(id);
93  if (subdet == SiStripSubdetector::TID)
94  return tidGlued(id);
95  if (subdet == SiStripSubdetector::TOB)
96  return tobGlued(id);
97  if (subdet == SiStripSubdetector::TEC)
98  return tecGlued(id);
99 
100  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::glued";
101  return 0;
102 }
103 
104 uint32_t TrackerTopology::stack(const DetId &id) const {
105  uint32_t subdet = id.subdetId();
106  if (subdet == PixelSubdetector::PixelBarrel)
107  return 0;
108  if (subdet == PixelSubdetector::PixelEndcap)
109  return 0;
110  if (subdet == SiStripSubdetector::TIB)
111  return tibStack(id);
112  if (subdet == SiStripSubdetector::TID)
113  return tidStack(id);
114  if (subdet == SiStripSubdetector::TOB)
115  return tobStack(id);
116  if (subdet == SiStripSubdetector::TEC)
117  return tecStack(id);
118 
119  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::stack";
120 }
121 
122 uint32_t TrackerTopology::lower(const DetId &id) const {
123  uint32_t subdet = id.subdetId();
124  if (subdet == PixelSubdetector::PixelBarrel)
125  return 0;
126  if (subdet == PixelSubdetector::PixelEndcap)
127  return 0;
128  if (subdet == SiStripSubdetector::TIB)
129  return tibLower(id);
130  if (subdet == SiStripSubdetector::TID)
131  return tidLower(id);
132  if (subdet == SiStripSubdetector::TOB)
133  return tobLower(id);
134  if (subdet == SiStripSubdetector::TEC)
135  return tecLower(id);
136 
137  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::lower";
138 }
139 
140 uint32_t TrackerTopology::upper(const DetId &id) const {
141  uint32_t subdet = id.subdetId();
142  if (subdet == PixelSubdetector::PixelBarrel)
143  return 0;
144  if (subdet == PixelSubdetector::PixelEndcap)
145  return 0;
146  if (subdet == SiStripSubdetector::TIB)
147  return tibUpper(id);
148  if (subdet == SiStripSubdetector::TID)
149  return tidUpper(id);
150  if (subdet == SiStripSubdetector::TOB)
151  return tobUpper(id);
152  if (subdet == SiStripSubdetector::TEC)
153  return tecUpper(id);
154 
155  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::upper";
156 }
157 
158 bool TrackerTopology::isStereo(const DetId &id) const {
159  uint32_t subdet = id.subdetId();
160  if (subdet == PixelSubdetector::PixelBarrel)
161  return false;
162  if (subdet == PixelSubdetector::PixelEndcap)
163  return false;
164  if (subdet == SiStripSubdetector::TIB)
165  return tibStereo(id) != 0;
166  if (subdet == SiStripSubdetector::TID)
167  return tidStereo(id) != 0;
168  if (subdet == SiStripSubdetector::TOB)
169  return tobStereo(id) != 0;
170  if (subdet == SiStripSubdetector::TEC)
171  return tecStereo(id) != 0;
172 
173  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::isStereo";
174  return false;
175 }
176 
177 bool TrackerTopology::isRPhi(const DetId &id) const {
178  uint32_t subdet = id.subdetId();
179  if (subdet == PixelSubdetector::PixelBarrel)
180  return false;
181  if (subdet == PixelSubdetector::PixelEndcap)
182  return false;
183  if (subdet == SiStripSubdetector::TIB)
184  return tibRPhi(id) != 0;
185  if (subdet == SiStripSubdetector::TID)
186  return tidRPhi(id) != 0;
187  if (subdet == SiStripSubdetector::TOB)
188  return tobRPhi(id) != 0;
189  if (subdet == SiStripSubdetector::TEC)
190  return tecRPhi(id) != 0;
191 
192  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::isRPhi";
193  return false;
194 }
195 bool TrackerTopology::isLower(const DetId &id) const {
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 == SiStripSubdetector::TIB)
202  return tibLower(id) != 0;
203  if (subdet == SiStripSubdetector::TID)
204  return tidLower(id) != 0;
205  if (subdet == SiStripSubdetector::TOB)
206  return tobLower(id) != 0;
207  if (subdet == SiStripSubdetector::TEC)
208  return tecLower(id) != 0;
209 
210  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::isLower";
211  return false;
212 }
213 
214 bool TrackerTopology::isUpper(const DetId &id) const {
215  uint32_t subdet = id.subdetId();
216  if (subdet == PixelSubdetector::PixelBarrel)
217  return false;
218  if (subdet == PixelSubdetector::PixelEndcap)
219  return false;
220  if (subdet == SiStripSubdetector::TIB)
221  return tibUpper(id) != 0;
222  if (subdet == SiStripSubdetector::TID)
223  return tidUpper(id) != 0;
224  if (subdet == SiStripSubdetector::TOB)
225  return tobUpper(id) != 0;
226  if (subdet == SiStripSubdetector::TEC)
227  return tecUpper(id) != 0;
228 
229  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::isUpper";
230  return false;
231 }
232 
234  uint32_t subdet = id.subdetId();
235  if (subdet == PixelSubdetector::PixelBarrel)
236  return 0;
237  if (subdet == PixelSubdetector::PixelEndcap)
238  return 0;
239  if (subdet == SiStripSubdetector::TIB)
240  return tibPartnerDetId(id);
241  if (subdet == SiStripSubdetector::TID)
242  return tidPartnerDetId(id);
243  if (subdet == SiStripSubdetector::TOB)
244  return tobPartnerDetId(id);
245  if (subdet == SiStripSubdetector::TEC)
246  return tecPartnerDetId(id);
247 
248  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::partnerDetId";
249  return 0;
250 }
251 
253  uint32_t subdet = id.subdetId();
254  std::stringstream strstr;
255 
256  if (subdet == PixelSubdetector::PixelBarrel) {
257  unsigned int theLayer = pxbLayer(id);
258  unsigned int theLadder = pxbLadder(id);
259  unsigned int theModule = pxbModule(id);
260  strstr << "PixelBarrel"
261  << " Layer " << theLayer << " Ladder " << theLadder << " Module " << theModule;
262  strstr << " (" << id.rawId() << ")";
263  return strstr.str();
264  }
265 
266  if (subdet == PixelSubdetector::PixelEndcap) {
267  unsigned int theSide = pxfSide(id);
268  unsigned int theDisk = pxfDisk(id);
269  unsigned int theBlade = pxfBlade(id);
270  unsigned int thePanel = pxfPanel(id);
271  unsigned int theModule = pxfModule(id);
272  std::string side = (pxfSide(id) == 1) ? "-" : "+";
273  strstr << "PixelEndcap"
274  << " Side " << theSide << side << " Disk " << theDisk << " Blade " << theBlade << " Panel " << thePanel
275  << " Module " << theModule;
276  strstr << " (" << id.rawId() << ")";
277  return strstr.str();
278  }
279 
280  if (subdet == SiStripSubdetector::TIB) {
281  unsigned int theLayer = tibLayer(id);
282  std::vector<unsigned int> theString = tibStringInfo(id);
283  unsigned int theModule = tibModule(id);
286  side = (theString[0] == 1) ? "-" : "+";
287  part = (theString[1] == 1) ? "int" : "ext";
289  type = (isStereo(id)) ? "stereo" : type;
290  type = (isRPhi(id)) ? "r-phi" : type;
291  type = (isStereo(id) || isRPhi(id)) ? type + " glued" : "module";
292  std::string typeUpgrade;
293  typeUpgrade = (isLower(id)) ? "lower" : typeUpgrade;
294  typeUpgrade = (isUpper(id)) ? "upper" : typeUpgrade;
295  typeUpgrade = (isUpper(id) || isLower(id)) ? typeUpgrade + " stack" : "module";
296  strstr << "TIB" << side << " Layer " << theLayer << " " << part << " String " << theString[2];
297  strstr << " Module for phase0 " << theModule << " " << type;
298  strstr << " Module for phase2 " << theModule << " " << typeUpgrade;
299  strstr << " (" << id.rawId() << ")";
300  return strstr.str();
301  }
302 
303  if (subdet == SiStripSubdetector::TID) {
304  unsigned int theSide = tidSide(id);
305  unsigned int theWheel = tidWheel(id);
306  unsigned int theRing = tidRing(id);
307  std::vector<unsigned int> theModule = tidModuleInfo(id);
310  side = (tidSide(id) == 1) ? "-" : "+";
311  part = (theModule[0] == 1) ? "back" : "front";
313  type = (isStereo(id)) ? "stereo" : type;
314  type = (isRPhi(id)) ? "r-phi" : type;
315  type = (isStereo(id) || isRPhi(id)) ? type + " glued" : "module";
316  std::string typeUpgrade;
317  typeUpgrade = (isLower(id)) ? "lower" : typeUpgrade;
318  typeUpgrade = (isUpper(id)) ? "upper" : typeUpgrade;
319  typeUpgrade = (isUpper(id) || isLower(id)) ? typeUpgrade + " stack" : "module";
320  strstr << "TID"
321  << " Side " << theSide << side << " Wheel " << theWheel << " Ring " << theRing << " " << part;
322  strstr << " Module for phase0 " << theModule[1] << " " << type;
323  strstr << " Module for phase2 " << theModule[1] << " " << typeUpgrade;
324  strstr << " (" << id.rawId() << ")";
325  return strstr.str();
326  }
327 
328  if (subdet == SiStripSubdetector::TOB) {
329  unsigned int theLayer = tobLayer(id);
330  std::vector<unsigned int> theRod = tobRodInfo(id);
331  unsigned int theModule = tobModule(id);
334  side = (((theRod[0] == 1) ? "-" : ((theRod[0] == 2) ? "+" : (theRod[0] == 3) ? "0" : "")));
335  // side = (theRod[0] == 2 ) ? "+" : "";
336  // side = (theRod[0] == 3 ) ? "0" : "";
338  type = (isStereo(id)) ? "stereo" : type;
339  type = (isRPhi(id)) ? "r-phi" : type;
340  type = (isStereo(id) || isRPhi(id)) ? type + " glued" : "module";
341  std::string typeUpgrade;
342  typeUpgrade = (isLower(id)) ? "lower" : typeUpgrade;
343  typeUpgrade = (isUpper(id)) ? "upper" : typeUpgrade;
344  typeUpgrade = (isUpper(id) || isLower(id)) ? typeUpgrade + " stack" : "module";
345  strstr << "TOB" << side << " Layer " << theLayer << " Rod " << theRod[1];
346  strstr << " Module for phase0 " << theModule << " " << type;
347  strstr << " Module for phase2 " << theModule << " " << typeUpgrade;
348  strstr << " (" << id.rawId() << ")";
349  return strstr.str();
350  }
351 
352  if (subdet == SiStripSubdetector::TEC) {
353  unsigned int theSide = tecSide(id);
354  unsigned int theWheel = tecWheel(id);
355  unsigned int theModule = tecModule(id);
356  std::vector<unsigned int> thePetal = tecPetalInfo(id);
357  unsigned int theRing = tecRing(id);
359  std::string petal;
360  side = (tecSide(id) == 1) ? "-" : "+";
361  petal = (thePetal[0] == 1) ? "back" : "front";
363  type = (isStereo(id)) ? "stereo" : type;
364  type = (isRPhi(id)) ? "r-phi" : type;
365  type = (isStereo(id) || isRPhi(id)) ? type + " glued" : "module";
366  std::string typeUpgrade;
367  typeUpgrade = (isLower(id)) ? "lower" : typeUpgrade;
368  typeUpgrade = (isUpper(id)) ? "upper" : typeUpgrade;
369  typeUpgrade = (isUpper(id) || isLower(id)) ? typeUpgrade + " stack" : "module";
370  strstr << "TEC"
371  << " Side " << theSide << side << " Wheel " << theWheel << " Petal " << thePetal[1] << " " << petal
372  << " Ring " << theRing;
373  strstr << " Module for phase0 " << theModule << " " << type;
374  strstr << " Module for phase2 " << theModule << " " << typeUpgrade;
375  strstr << " (" << id.rawId() << ")";
376 
377  return strstr.str();
378  }
379 
380  throw cms::Exception("Invalid DetId") << "Unsupported DetId in TrackerTopology::module";
381  return strstr.str();
382 }
383 
385  switch (id.subdetId()) {
391  switch (tidRing(id)) {
392  case 1:
394  case 2:
396  case 3:
398  }
401  switch (tecRing(id)) {
402  case 1:
404  case 2:
406  case 3:
408  case 4:
410  //generic function to return DetIds and boolean factors
411  case 5:
413  case 6:
415  case 7:
417  }
418  }
420 }
422  int layer = -1;
423 
424  if (id.det() == DetId::Tracker) {
425  if (id.subdetId() == SiStripSubdetector::TOB) {
426  layer = tobLayer(id);
427  } else if (id.subdetId() == SiStripSubdetector::TID) {
428  layer = 100 * tidSide(id) + tidWheel(id);
429  } else {
430  edm::LogInfo("TrackerTopology") << ">>> Invalid subdetId() ";
431  }
432  }
433  return layer;
434 }
435 
437  int layer = -1;
438 
439  if (id.det() == DetId::Tracker) {
440  if (id.subdetId() == PixelSubdetector::PixelBarrel) {
441  layer = pxbLayer(id);
442  } else if (id.subdetId() == PixelSubdetector::PixelEndcap) {
443  layer = 100 * pxfSide(id) + pxfDisk(id);
444  } else {
445  edm::LogInfo("TrackerTopology") << ">>> Invalid subdetId() ";
446  }
447  }
448  return layer;
449 }
bool isUpper(const DetId &id) const
uint32_t tidLower(const DetId &id) const
unsigned int tobLayer(const DetId &id) const
DetId tibPartnerDetId(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
std::vector< unsigned int > tidModuleInfo(const DetId &id) const
uint32_t tibRPhi(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
const PixelEndcapValues pfVals_
uint32_t tidStereo(const DetId &id) const
unsigned int tibModule(const DetId &id) const
unsigned int tidSide(const DetId &id) const
std::string print(DetId detid) const
unsigned int pxfModule(const DetId &id) const
std::vector< unsigned int > tecPetalInfo(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
uint32_t tibGlued(const DetId &id) const
DetId tidPartnerDetId(const DetId &id) const
bool isStereo(const DetId &id) const
bool isRPhi(const DetId &id) const
unsigned int pxbLadder(const DetId &id) const
unsigned int side(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
unsigned int layer(const DetId &id) const
const PixelBarrelValues pbVals_
unsigned int module(const DetId &id) const
int getITPixelLayerNumber(const DetId &id) const
unsigned int tidModule(const DetId &id) const
unsigned int tecModule(const DetId &id) const
uint32_t tobGlued(const DetId &id) const
uint32_t tobStereo(const DetId &id) const
uint32_t tidUpper(const DetId &id) const
int getOTLayerNumber(const DetId &id) const
unsigned int tecSide(const DetId &id) const
uint32_t tidGlued(const DetId &id) const
uint32_t tidStack(const DetId &id) const
uint32_t tobUpper(const DetId &id) const
uint32_t tecPartnerDetId(const DetId &id) const
unsigned int pxfDisk(const DetId &id) const
SiStripModuleGeometry
Definition: SiStripEnums.h:8
uint32_t stack(const DetId &id) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
DetId partnerDetId(const DetId &id) const
uint32_t tecRPhi(const DetId &id) const
uint32_t tecLower(const DetId &id) const
uint32_t glued(const DetId &id) const
unsigned int pxfPanel(const DetId &id) const
Log< level::Info, false > LogInfo
SiStripModuleGeometry moduleGeometry(const DetId &id) const
Definition: DetId.h:17
DetId tobPartnerDetId(const DetId &id) const
bool isLower(const DetId &id) const
unsigned int pxfSide(const DetId &id) const
std::vector< unsigned int > tibStringInfo(const DetId &id) const
uint32_t lower(const DetId &id) const
part
Definition: HCALResponse.h:20
uint32_t tecUpper(const DetId &id) const
std::vector< unsigned int > tobRodInfo(const DetId &id) const
uint32_t tobLower(const DetId &id) const
unsigned int tidRing(const DetId &id) const
uint32_t tibStack(const DetId &id) const
uint32_t tecStereo(const DetId &id) const
uint32_t tidRPhi(const DetId &id) const
uint32_t tibLower(const DetId &id) const
uint32_t tibUpper(const DetId &id) const
unsigned int tibLayer(const DetId &id) const
unsigned int tobModule(const DetId &id) const
unsigned int pxbModule(const DetId &id) const
uint32_t tobStack(const DetId &id) const
uint32_t tecStack(const DetId &id) const
uint32_t tecGlued(const DetId &id) const
uint32_t tobRPhi(const DetId &id) const
TrackerTopology(const PixelBarrelValues &pxb, const PixelEndcapValues &pxf, const TECValues &tecv, const TIBValues &tibv, const TIDValues &tidv, const TOBValues &tobv)
uint32_t tibStereo(const DetId &id) const
uint32_t upper(const DetId &id) const