File indexing completed on 2024-04-06 12:05:15
0001 #ifndef DataFormats_SiStripDetId_StripSubdetector_H
0002 #define DataFormats_SiStripDetId_StripSubdetector_H
0003
0004
0005
0006
0007
0008
0009 #include "DataFormats/DetId/interface/DetId.h"
0010 #include "DataFormats/SiStripDetId/interface/SiStripEnums.h"
0011
0012 class StripSubdetector : public DetId {
0013 public:
0014 using SubDetector = SiStripSubdetector::Subdetector;
0015 static constexpr auto UNKNOWN = SiStripSubdetector::UNKNOWN;
0016 static constexpr auto TIB = SiStripSubdetector::TIB;
0017 static constexpr auto TID = SiStripSubdetector::TID;
0018 static constexpr auto TOB = SiStripSubdetector::TOB;
0019 static constexpr auto TEC = SiStripSubdetector::TEC;
0020
0021
0022 StripSubdetector(uint32_t rawid) : DetId(rawid) {}
0023
0024 StripSubdetector(const DetId &id) : DetId(id) {}
0025
0026
0027
0028
0029
0030
0031 unsigned int glued() const {
0032 if (((id_ >> sterStartBit_) & sterMask_) == 1) {
0033 return (id_ - 1);
0034 } else if (((id_ >> sterStartBit_) & sterMask_) == 2) {
0035 return (id_ - 2);
0036 } else {
0037 return 0;
0038 }
0039 }
0040
0041
0042
0043
0044
0045
0046 unsigned int stereo() const {
0047 if (((id_ >> sterStartBit_) & sterMask_) == 1) {
0048 return ((id_ >> sterStartBit_) & sterMask_);
0049 } else {
0050 return 0;
0051 }
0052 }
0053
0054
0055
0056
0057
0058
0059 unsigned int partnerDetId() const {
0060 if (((id_ >> sterStartBit_) & sterMask_) == 1) {
0061 return (id_ + 1);
0062 } else if (((id_ >> sterStartBit_) & sterMask_) == 2) {
0063 return (id_ - 1);
0064 } else {
0065 return 0;
0066 }
0067 }
0068
0069 private:
0070 static const unsigned int detStartBit_ = 2;
0071 static const unsigned int sterStartBit_ = 0;
0072
0073 static const unsigned int detMask_ = 0x3;
0074 static const unsigned int sterMask_ = 0x3;
0075 };
0076
0077 #endif