File indexing completed on 2021-02-14 12:54:48
0001 #ifndef TRACKERTOPOLOGY_H
0002 #define TRACKERTOPOLOGY_H
0003
0004 #include "DataFormats/DetId/interface/DetId.h"
0005 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
0006 #include "DataFormats/SiStripDetId/interface/SiStripEnums.h"
0007
0008 #include <vector>
0009 #include <string>
0010
0011
0012
0013
0014
0015
0016 class TrackerTopology {
0017 public:
0018 struct PixelBarrelValues {
0019 unsigned int layerStartBit_;
0020 unsigned int ladderStartBit_;
0021 unsigned int moduleStartBit_;
0022 unsigned int layerMask_;
0023 unsigned int ladderMask_;
0024 unsigned int moduleMask_;
0025 };
0026
0027 struct PixelEndcapValues {
0028 unsigned int sideStartBit_;
0029 unsigned int diskStartBit_;
0030 unsigned int bladeStartBit_;
0031 unsigned int panelStartBit_;
0032 unsigned int moduleStartBit_;
0033 unsigned int sideMask_;
0034 unsigned int diskMask_;
0035 unsigned int bladeMask_;
0036 unsigned int panelMask_;
0037 unsigned int moduleMask_;
0038 };
0039
0040 struct TECValues {
0041 unsigned int sideStartBit_;
0042 unsigned int wheelStartBit_;
0043 unsigned int petal_fw_bwStartBit_;
0044 unsigned int petalStartBit_;
0045 unsigned int ringStartBit_;
0046 unsigned int moduleStartBit_;
0047 unsigned int sterStartBit_;
0048 unsigned int sideMask_;
0049 unsigned int wheelMask_;
0050 unsigned int petal_fw_bwMask_;
0051 unsigned int petalMask_;
0052 unsigned int ringMask_;
0053 unsigned int moduleMask_;
0054 unsigned int sterMask_;
0055 };
0056
0057 struct TIBValues {
0058 unsigned int layerStartBit_;
0059 unsigned int str_fw_bwStartBit_;
0060 unsigned int str_int_extStartBit_;
0061 unsigned int strStartBit_;
0062 unsigned int moduleStartBit_;
0063 unsigned int sterStartBit_;
0064
0065 unsigned int layerMask_;
0066 unsigned int str_fw_bwMask_;
0067 unsigned int str_int_extMask_;
0068 unsigned int strMask_;
0069 unsigned int moduleMask_;
0070 unsigned int sterMask_;
0071 };
0072
0073 struct TIDValues {
0074 unsigned int sideStartBit_;
0075 unsigned int wheelStartBit_;
0076 unsigned int ringStartBit_;
0077 unsigned int module_fw_bwStartBit_;
0078 unsigned int moduleStartBit_;
0079 unsigned int sterStartBit_;
0080 unsigned int sideMask_;
0081 unsigned int wheelMask_;
0082 unsigned int ringMask_;
0083 unsigned int module_fw_bwMask_;
0084 unsigned int moduleMask_;
0085 unsigned int sterMask_;
0086 };
0087
0088 struct TOBValues {
0089 unsigned int layerStartBit_;
0090 unsigned int rod_fw_bwStartBit_;
0091 unsigned int rodStartBit_;
0092 unsigned int moduleStartBit_;
0093 unsigned int sterStartBit_;
0094 unsigned int layerMask_;
0095 unsigned int rod_fw_bwMask_;
0096 unsigned int rodMask_;
0097 unsigned int moduleMask_;
0098 unsigned int sterMask_;
0099 };
0100
0101 enum DetIdFields {
0102 PBModule,
0103 PBLadder,
0104 PBLayer,
0105 PFModule,
0106 PFPanel,
0107 PFBlade,
0108 PFDisk,
0109 PFSide,
0110
0111 DETID_FIELDS_MAX
0112 };
0113
0114 class SameLayerComparator {
0115 public:
0116 explicit SameLayerComparator(const TrackerTopology *topo) : topo_(topo) {}
0117
0118 bool operator()(DetId i1, DetId i2) const {
0119 if (i1.det() == i2.det() && i1.subdetId() == i2.subdetId() && topo_->side(i1) == topo_->side(i2) &&
0120 topo_->layer(i1) == topo_->layer(i2)) {
0121 return false;
0122 }
0123 return i1 < i2;
0124 }
0125
0126 bool operator()(uint32_t i1, uint32_t i2) const { return operator()(DetId(i1), DetId(i2)); }
0127
0128 private:
0129 const TrackerTopology *topo_;
0130 };
0131
0132 TrackerTopology(const PixelBarrelValues &pxb,
0133 const PixelEndcapValues &pxf,
0134 const TECValues &tecv,
0135 const TIBValues &tibv,
0136 const TIDValues &tidv,
0137 const TOBValues &tobv);
0138
0139 unsigned int side(const DetId &id) const;
0140 unsigned int layer(const DetId &id) const;
0141 unsigned int module(const DetId &id) const;
0142
0143
0144 unsigned int pxbLayer(const DetId &id) const {
0145 return int((id.rawId() >> pbVals_.layerStartBit_) & pbVals_.layerMask_);
0146 }
0147 unsigned int tobLayer(const DetId &id) const {
0148 return int((id.rawId() >> tobVals_.layerStartBit_) & tobVals_.layerMask_);
0149 }
0150 unsigned int tibLayer(const DetId &id) const {
0151 return int((id.rawId() >> tibVals_.layerStartBit_) & tibVals_.layerMask_);
0152 }
0153
0154
0155 unsigned int pxbLadder(const DetId &id) const {
0156 return ((id.rawId() >> pbVals_.ladderStartBit_) & pbVals_.ladderMask_);
0157 }
0158
0159
0160 unsigned int pxbModule(const DetId &id) const {
0161 return ((id.rawId() >> pbVals_.moduleStartBit_) & pbVals_.moduleMask_);
0162 }
0163 unsigned int pxfModule(const DetId &id) const {
0164 return int((id.rawId() >> pfVals_.moduleStartBit_) & pfVals_.moduleMask_);
0165 }
0166 unsigned int tobModule(const DetId &id) const {
0167 return ((id.rawId() >> tobVals_.moduleStartBit_) & tobVals_.moduleMask_);
0168 }
0169 unsigned int tecModule(const DetId &id) const {
0170 return ((id.rawId() >> tecVals_.moduleStartBit_) & tecVals_.moduleMask_);
0171 }
0172 unsigned int tibModule(const DetId &id) const {
0173 return ((id.rawId() >> tibVals_.moduleStartBit_) & tibVals_.moduleMask_);
0174 }
0175 unsigned int tidModule(const DetId &id) const {
0176 return ((id.rawId() >> tidVals_.moduleStartBit_) & tidVals_.moduleMask_);
0177 }
0178
0179
0180 unsigned int tobSide(const DetId &id) const {
0181 return ((id.rawId() >> tobVals_.rod_fw_bwStartBit_) & tobVals_.rod_fw_bwMask_);
0182 }
0183
0184 unsigned int tecSide(const DetId &id) const { return ((id.rawId() >> tecVals_.sideStartBit_) & tecVals_.sideMask_); }
0185
0186 unsigned int tibSide(const DetId &id) const {
0187 return ((id.rawId() >> tibVals_.str_fw_bwStartBit_) & tibVals_.str_fw_bwMask_);
0188 }
0189
0190 unsigned int tidSide(const DetId &id) const { return ((id.rawId() >> tidVals_.sideStartBit_) & tidVals_.sideMask_); }
0191
0192 unsigned int pxfSide(const DetId &id) const { return ((id.rawId() >> pfVals_.sideStartBit_) & pfVals_.sideMask_); }
0193
0194
0195 unsigned int tobRod(const DetId &id) const { return ((id.rawId() >> tobVals_.rodStartBit_) & tobVals_.rodMask_); }
0196
0197
0198 unsigned int tecWheel(const DetId &id) const {
0199 return ((id.rawId() >> tecVals_.wheelStartBit_) & tecVals_.wheelMask_);
0200 }
0201 unsigned int tidWheel(const DetId &id) const {
0202 return ((id.rawId() >> tidVals_.wheelStartBit_) & tidVals_.wheelMask_);
0203 }
0204
0205
0206 unsigned int tecOrder(const DetId &id) const {
0207 return ((id.rawId() >> tecVals_.petal_fw_bwStartBit_) & tecVals_.petal_fw_bwMask_);
0208 }
0209 unsigned int tibOrder(const DetId &id) const {
0210 return ((id.rawId() >> tibVals_.str_int_extStartBit_) & tibVals_.str_int_extMask_);
0211 }
0212 unsigned int tidOrder(const DetId &id) const {
0213 return ((id.rawId() >> tidVals_.module_fw_bwStartBit_) & tidVals_.module_fw_bwMask_);
0214 }
0215
0216
0217 unsigned int tecRing(const DetId &id) const { return ((id.rawId() >> tecVals_.ringStartBit_) & tecVals_.ringMask_); }
0218 unsigned int tidRing(const DetId &id) const { return ((id.rawId() >> tidVals_.ringStartBit_) & tidVals_.ringMask_); }
0219
0220
0221 unsigned int tecPetalNumber(const DetId &id) const {
0222 return ((id.rawId() >> tecVals_.petalStartBit_) & tecVals_.petalMask_);
0223 }
0224
0225
0226 std::vector<unsigned int> tobRodInfo(const DetId &id) const {
0227 std::vector<unsigned int> num;
0228 num.push_back(tobSide(id));
0229 num.push_back(tobRod(id));
0230 return num;
0231 }
0232
0233
0234 uint32_t glued(const DetId &id) const;
0235 uint32_t stack(const DetId &id) const;
0236 uint32_t lower(const DetId &id) const;
0237 uint32_t upper(const DetId &id) const;
0238
0239 bool isStereo(const DetId &id) const;
0240 bool isRPhi(const DetId &id) const;
0241 bool isLower(const DetId &id) const;
0242 bool isUpper(const DetId &id) const;
0243
0244
0245 bool tobIsDoubleSide(const DetId &id) const { return tobGlued(id) == 0 && (tobLayer(id) == 1 || tobLayer(id) == 2); }
0246 bool tecIsDoubleSide(const DetId &id) const {
0247 return tecGlued(id) == 0 && (tecRing(id) == 1 || tecRing(id) == 2 || tecRing(id) == 5);
0248 }
0249 bool tibIsDoubleSide(const DetId &id) const { return tibGlued(id) == 0 && (tibLayer(id) == 1 || tibLayer(id) == 2); }
0250 bool tidIsDoubleSide(const DetId &id) const { return tidGlued(id) == 0 && (tidRing(id) == 1 || tidRing(id) == 2); }
0251
0252 bool tobIsZPlusSide(const DetId &id) const { return !tobIsZMinusSide(id); }
0253 bool tobIsZMinusSide(const DetId &id) const { return tobSide(id) == 1; }
0254
0255 bool tibIsZPlusSide(const DetId &id) const { return !tibIsZMinusSide(id); }
0256 bool tibIsZMinusSide(const DetId &id) const { return tibSide(id) == 1; }
0257
0258 bool tidIsZPlusSide(const DetId &id) const { return !tidIsZMinusSide(id); }
0259 bool tidIsZMinusSide(const DetId &id) const { return tidSide(id) == 1; }
0260
0261 bool tecIsZPlusSide(const DetId &id) const { return !tecIsZMinusSide(id); }
0262 bool tecIsZMinusSide(const DetId &id) const { return tecSide(id) == 1; }
0263
0264 bool tobIsStereo(const DetId &id) const { return tobStereo(id) != 0 && !tobIsDoubleSide(id); }
0265 bool tecIsStereo(const DetId &id) const { return tecStereo(id) != 0 && !tecIsDoubleSide(id); }
0266 bool tibIsStereo(const DetId &id) const { return tibStereo(id) != 0 && !tibIsDoubleSide(id); }
0267 bool tidIsStereo(const DetId &id) const { return tidStereo(id) != 0 && !tidIsDoubleSide(id); }
0268
0269 bool tobIsRPhi(const DetId &id) const { return tobRPhi(id) != 0 && !tobIsDoubleSide(id); }
0270 bool tecIsRPhi(const DetId &id) const { return tecRPhi(id) != 0 && !tecIsDoubleSide(id); }
0271 bool tibIsRPhi(const DetId &id) const { return tibRPhi(id) != 0 && !tibIsDoubleSide(id); }
0272 bool tidIsRPhi(const DetId &id) const { return tidRPhi(id) != 0 && !tidIsDoubleSide(id); }
0273
0274
0275 uint32_t tobStereo(const DetId &id) const {
0276 return (((id.rawId() >> tobVals_.sterStartBit_) & tobVals_.sterMask_) == 1) ? 1 : 0;
0277 }
0278
0279 uint32_t tibStereo(const DetId &id) const {
0280 return (((id.rawId() >> tibVals_.sterStartBit_) & tibVals_.sterMask_) == 1) ? 1 : 0;
0281 }
0282
0283 uint32_t tidStereo(const DetId &id) const {
0284 return (((id.rawId() >> tidVals_.sterStartBit_) & tidVals_.sterMask_) == 1) ? 1 : 0;
0285 }
0286
0287 uint32_t tecStereo(const DetId &id) const {
0288 return (((id.rawId() >> tecVals_.sterStartBit_) & tecVals_.sterMask_) == 1) ? 1 : 0;
0289 }
0290
0291
0292 uint32_t tibLower(const DetId &id) const { return tibStereo(id); }
0293 uint32_t tidLower(const DetId &id) const { return tidStereo(id); }
0294 uint32_t tobLower(const DetId &id) const { return tobStereo(id); }
0295 uint32_t tecLower(const DetId &id) const { return tecStereo(id); }
0296
0297
0298 uint32_t tobRPhi(const DetId &id) const {
0299 if (((id.rawId() >> tobVals_.sterStartBit_) & tobVals_.sterMask_) == 2) {
0300 return ((id.rawId() >> tobVals_.sterStartBit_) & tobVals_.sterMask_);
0301 } else {
0302 return 0;
0303 }
0304 }
0305
0306 uint32_t tibRPhi(const DetId &id) const {
0307 if (((id.rawId() >> tibVals_.sterStartBit_) & tibVals_.sterMask_) == 2) {
0308 return ((id.rawId() >> tibVals_.sterStartBit_) & tibVals_.sterMask_);
0309 } else {
0310 return 0;
0311 }
0312 }
0313
0314 uint32_t tidRPhi(const DetId &id) const {
0315 if (((id.rawId() >> tidVals_.sterStartBit_) & tidVals_.sterMask_) == 2) {
0316 return ((id.rawId() >> tidVals_.sterStartBit_) & tidVals_.sterMask_);
0317 } else {
0318 return 0;
0319 }
0320 }
0321
0322 uint32_t tecRPhi(const DetId &id) const {
0323 if (((id.rawId() >> tecVals_.sterStartBit_) & tecVals_.sterMask_) == 2) {
0324 return ((id.rawId() >> tecVals_.sterStartBit_) & tecVals_.sterMask_);
0325 } else {
0326 return 0;
0327 }
0328 }
0329
0330
0331 uint32_t tibUpper(const DetId &id) const { return tibRPhi(id); }
0332 uint32_t tidUpper(const DetId &id) const { return tidRPhi(id); }
0333 uint32_t tobUpper(const DetId &id) const { return tobRPhi(id); }
0334 uint32_t tecUpper(const DetId &id) const { return tecRPhi(id); }
0335
0336
0337 uint32_t tibGlued(const DetId &id) const {
0338 uint32_t testId = (id.rawId() >> tibVals_.sterStartBit_) & tibVals_.sterMask_;
0339 return (testId == 0) ? 0 : (id.rawId() - testId);
0340 }
0341
0342 uint32_t tecGlued(const DetId &id) const {
0343 uint32_t testId = (id.rawId() >> tecVals_.sterStartBit_) & tecVals_.sterMask_;
0344 return (testId == 0) ? 0 : (id.rawId() - testId);
0345 }
0346
0347 uint32_t tobGlued(const DetId &id) const {
0348 uint32_t testId = (id.rawId() >> tobVals_.sterStartBit_) & tobVals_.sterMask_;
0349 return (testId == 0) ? 0 : (id.rawId() - testId);
0350 }
0351
0352 uint32_t tidGlued(const DetId &id) const {
0353 uint32_t testId = (id.rawId() >> tidVals_.sterStartBit_) & tidVals_.sterMask_;
0354 return (testId == 0) ? 0 : (id.rawId() - testId);
0355 }
0356
0357
0358 uint32_t tibStack(const DetId &id) const { return tibGlued(id); }
0359 uint32_t tidStack(const DetId &id) const { return tidGlued(id); }
0360 uint32_t tobStack(const DetId &id) const { return tobGlued(id); }
0361 uint32_t tecStack(const DetId &id) const { return tecGlued(id); }
0362
0363
0364 DetId partnerDetId(const DetId &id) const;
0365
0366 DetId tibPartnerDetId(const DetId &id) const {
0367 if (((id.rawId() >> tibVals_.sterStartBit_) & tibVals_.sterMask_) == 1) {
0368 return DetId(id.rawId() + 1);
0369 } else if (((id.rawId() >> tibVals_.sterStartBit_) & tibVals_.sterMask_) == 2) {
0370 return DetId(id.rawId() - 1);
0371 } else {
0372 return DetId();
0373 }
0374 }
0375
0376 DetId tobPartnerDetId(const DetId &id) const {
0377 if (((id.rawId() >> tobVals_.sterStartBit_) & tobVals_.sterMask_) == 1) {
0378 return DetId(id.rawId() + 1);
0379 } else if (((id.rawId() >> tobVals_.sterStartBit_) & tobVals_.sterMask_) == 2) {
0380 return DetId(id.rawId() - 1);
0381 } else {
0382 return DetId();
0383 }
0384 }
0385
0386 DetId tidPartnerDetId(const DetId &id) const {
0387 if (((id.rawId() >> tidVals_.sterStartBit_) & tidVals_.sterMask_) == 1) {
0388 return DetId(id.rawId() + 1);
0389 } else if (((id.rawId() >> tidVals_.sterStartBit_) & tidVals_.sterMask_) == 2) {
0390 return DetId(id.rawId() - 1);
0391 } else {
0392 return DetId();
0393 }
0394 }
0395
0396 uint32_t tecPartnerDetId(const DetId &id) const {
0397 if (((id.rawId() >> tecVals_.sterStartBit_) & tecVals_.sterMask_) == 1) {
0398 return DetId(id.rawId() + 1);
0399 } else if (((id.rawId() >> tecVals_.sterStartBit_) & tecVals_.sterMask_) == 2) {
0400 return DetId(id.rawId() - 1);
0401 } else {
0402 return DetId();
0403 }
0404 }
0405
0406
0407 std::vector<unsigned int> tecPetalInfo(const DetId &id) const {
0408 std::vector<unsigned int> num;
0409 num.push_back(tecOrder(id));
0410 num.push_back(tecPetalNumber(id));
0411 return num;
0412 }
0413
0414 bool tecIsBackPetal(const DetId &id) const { return (tecOrder(id) == 1); }
0415
0416 bool tecIsFrontPetal(const DetId &id) const { return !tecIsBackPetal(id); }
0417
0418
0419 unsigned int tibString(const DetId &id) const { return (id.rawId() >> tibVals_.strStartBit_) & tibVals_.strMask_; }
0420
0421 std::vector<unsigned int> tibStringInfo(const DetId &id) const {
0422 std::vector<unsigned int> num;
0423 num.push_back(tibSide(id));
0424 num.push_back(tibOrder(id));
0425 num.push_back(tibString(id));
0426 return num;
0427 }
0428
0429 bool tibIsInternalString(const DetId &id) const { return (tibOrder(id) == 1); }
0430
0431 bool tibIsExternalString(const DetId &id) const { return !tibIsInternalString(id); }
0432
0433
0434 std::vector<unsigned int> tidModuleInfo(const DetId &id) const {
0435 std::vector<unsigned int> num;
0436 num.push_back(tidOrder(id));
0437 num.push_back(tidModule(id));
0438 return num;
0439 }
0440
0441 bool tidIsBackRing(const DetId &id) const { return (tidOrder(id) == 1); }
0442
0443 bool tidIsFrontRing(const DetId &id) const { return !tidIsBackRing(id); }
0444
0445
0446 unsigned int pxfDisk(const DetId &id) const { return int((id.rawId() >> pfVals_.diskStartBit_) & pfVals_.diskMask_); }
0447 unsigned int pxfBlade(const DetId &id) const {
0448 return int((id.rawId() >> pfVals_.bladeStartBit_) & pfVals_.bladeMask_);
0449 }
0450 unsigned int pxfPanel(const DetId &id) const {
0451 return int((id.rawId() >> pfVals_.panelStartBit_) & pfVals_.panelMask_);
0452 }
0453
0454
0455 DetId pxbDetId(uint32_t layer, uint32_t ladder, uint32_t module) const {
0456
0457 DetId id(DetId::Tracker, PixelSubdetector::PixelBarrel);
0458 uint32_t rawid = id.rawId();
0459 rawid |= (layer & pbVals_.layerMask_) << pbVals_.layerStartBit_ |
0460 (ladder & pbVals_.ladderMask_) << pbVals_.ladderStartBit_ |
0461 (module & pbVals_.moduleMask_) << pbVals_.moduleStartBit_;
0462 return DetId(rawid);
0463 }
0464
0465 DetId pxfDetId(uint32_t side, uint32_t disk, uint32_t blade, uint32_t panel, uint32_t module) const {
0466 DetId id(DetId::Tracker, PixelSubdetector::PixelEndcap);
0467 uint32_t rawid = id.rawId();
0468 rawid |= (side & pfVals_.sideMask_) << pfVals_.sideStartBit_ | (disk & pfVals_.diskMask_) << pfVals_.diskStartBit_ |
0469 (blade & pfVals_.bladeMask_) << pfVals_.bladeStartBit_ |
0470 (panel & pfVals_.panelMask_) << pfVals_.panelStartBit_ |
0471 (module & pfVals_.moduleMask_) << pfVals_.moduleStartBit_;
0472 return DetId(rawid);
0473 }
0474
0475 DetId tecDetId(uint32_t side,
0476 uint32_t wheel,
0477 uint32_t petal_fw_bw,
0478 uint32_t petal,
0479 uint32_t ring,
0480 uint32_t module,
0481 uint32_t ster) const {
0482 DetId id = DetId(DetId::Tracker, SiStripSubdetector::TEC);
0483 uint32_t rawid = id.rawId();
0484
0485 rawid |= (side & tecVals_.sideMask_) << tecVals_.sideStartBit_ |
0486 (wheel & tecVals_.wheelMask_) << tecVals_.wheelStartBit_ |
0487 (petal_fw_bw & tecVals_.petal_fw_bwMask_) << tecVals_.petal_fw_bwStartBit_ |
0488 (petal & tecVals_.petalMask_) << tecVals_.petalStartBit_ |
0489 (ring & tecVals_.ringMask_) << tecVals_.ringStartBit_ |
0490 (module & tecVals_.moduleMask_) << tecVals_.moduleStartBit_ |
0491 (ster & tecVals_.sterMask_) << tecVals_.sterStartBit_;
0492 return DetId(rawid);
0493 }
0494
0495 DetId tibDetId(
0496 uint32_t layer, uint32_t str_fw_bw, uint32_t str_int_ext, uint32_t str, uint32_t module, uint32_t ster) const {
0497 DetId id = DetId(DetId::Tracker, SiStripSubdetector::TIB);
0498 uint32_t rawid = id.rawId();
0499 rawid |= (layer & tibVals_.layerMask_) << tibVals_.layerStartBit_ |
0500 (str_fw_bw & tibVals_.str_fw_bwMask_) << tibVals_.str_fw_bwStartBit_ |
0501 (str_int_ext & tibVals_.str_int_extMask_) << tibVals_.str_int_extStartBit_ |
0502 (str & tibVals_.strMask_) << tibVals_.strStartBit_ |
0503 (module & tibVals_.moduleMask_) << tibVals_.moduleStartBit_ |
0504 (ster & tibVals_.sterMask_) << tibVals_.sterStartBit_;
0505 return DetId(rawid);
0506 }
0507
0508 DetId tidDetId(
0509 uint32_t side, uint32_t wheel, uint32_t ring, uint32_t module_fw_bw, uint32_t module, uint32_t ster) const {
0510 DetId id = DetId(DetId::Tracker, SiStripSubdetector::TID);
0511 uint32_t rawid = id.rawId();
0512 rawid |= (side & tidVals_.sideMask_) << tidVals_.sideStartBit_ |
0513 (wheel & tidVals_.wheelMask_) << tidVals_.wheelStartBit_ |
0514 (ring & tidVals_.ringMask_) << tidVals_.ringStartBit_ |
0515 (module_fw_bw & tidVals_.module_fw_bwMask_) << tidVals_.module_fw_bwStartBit_ |
0516 (module & tidVals_.moduleMask_) << tidVals_.moduleStartBit_ |
0517 (ster & tidVals_.sterMask_) << tidVals_.sterStartBit_;
0518 return DetId(rawid);
0519 }
0520
0521 DetId tobDetId(uint32_t layer, uint32_t rod_fw_bw, uint32_t rod, uint32_t module, uint32_t ster) const {
0522 DetId id = DetId(DetId::Tracker, SiStripSubdetector::TOB);
0523 uint32_t rawid = id.rawId();
0524 rawid |= (layer & tobVals_.layerMask_) << tobVals_.layerStartBit_ |
0525 (rod_fw_bw & tobVals_.rod_fw_bwMask_) << tobVals_.rod_fw_bwStartBit_ |
0526 (rod & tobVals_.rodMask_) << tobVals_.rodStartBit_ |
0527 (module & tobVals_.moduleMask_) << tobVals_.moduleStartBit_ |
0528 (ster & tobVals_.sterMask_) << tobVals_.sterStartBit_;
0529 return DetId(rawid);
0530 }
0531
0532 std::pair<DetId, SameLayerComparator> pxbDetIdLayerComparator(uint32_t layer) const {
0533 return std::make_pair(pxbDetId(layer, 1, 1), SameLayerComparator(this));
0534 }
0535
0536 std::pair<DetId, SameLayerComparator> pxfDetIdDiskComparator(uint32_t side, uint32_t disk) const {
0537 return std::make_pair(pxfDetId(side, disk, 1, 1, 1), SameLayerComparator(this));
0538 }
0539
0540 std::pair<DetId, SameLayerComparator> tecDetIdWheelComparator(uint32_t side, uint32_t wheel) const {
0541 return std::make_pair(tecDetId(side, wheel, 1, 1, 1, 1, 1), SameLayerComparator(this));
0542 }
0543
0544 std::pair<DetId, SameLayerComparator> tibDetIdLayerComparator(uint32_t layer) const {
0545 return std::make_pair(tibDetId(layer, 1, 1, 1, 1, 1), SameLayerComparator(this));
0546 }
0547
0548 std::pair<DetId, SameLayerComparator> tidDetIdWheelComparator(uint32_t side, uint32_t wheel) const {
0549 return std::make_pair(tidDetId(side, wheel, 1, 1, 1, 1), SameLayerComparator(this));
0550 }
0551
0552 std::pair<DetId, SameLayerComparator> tobDetIdLayerComparator(uint32_t layer) const {
0553 return std::make_pair(tobDetId(layer, 1, 1, 1, 1), SameLayerComparator(this));
0554 }
0555
0556 std::string print(DetId detid) const;
0557
0558 SiStripModuleGeometry moduleGeometry(const DetId &id) const;
0559
0560 int getOTLayerNumber(const DetId &id) const;
0561 int getITPixelLayerNumber(const DetId &id) const;
0562
0563
0564
0565
0566
0567
0568 unsigned int getField(const DetId &id, DetIdFields idx) const {
0569 return ((id.rawId() >> bits_per_field[idx].startBit) & bits_per_field[idx].mask);
0570 }
0571
0572
0573 bool hasField(const DetId &id, DetIdFields idx) const { return id.subdetId() == bits_per_field[idx].subdet; }
0574
0575 private:
0576 const PixelBarrelValues pbVals_;
0577 const PixelEndcapValues pfVals_;
0578
0579 const TOBValues tobVals_;
0580 const TIBValues tibVals_;
0581 const TIDValues tidVals_;
0582 const TECValues tecVals_;
0583
0584 struct BitmaskAndSubdet {
0585 unsigned int startBit;
0586 unsigned int mask;
0587 int subdet;
0588 };
0589 const BitmaskAndSubdet bits_per_field[DETID_FIELDS_MAX];
0590 };
0591
0592 #endif