CMS 3D CMS Logo

ETLDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_ETLDetId_ETLDetId_h
2 #define DataFormats_ETLDetId_ETLDetId_h
3 
5 #include <ostream>
6 
15 class ETLDetId : public MTDDetId {
16 private:
17  // for conversion from old to new module bit field
18  static const uint32_t kETLoldToNewShift = 2;
19  static const uint32_t kETLoldFieldMask = 0x7FFF;
20  static const uint32_t kETLformatV2 = 1;
21 
22 public:
23  static const uint32_t kETLmoduleOffset = 5;
24  static const uint32_t kETLmoduleMask = 0x7FF;
25  static const uint32_t kETLmodTypeOffset = 3;
26  static const uint32_t kETLmodTypeMask = 0x3;
27 
28  static constexpr int kETLv1maxRing = 11;
29  static constexpr int kETLv1maxModule = 176;
30  static constexpr int kETLv1nDisc = 1;
31 
33  static const uint32_t kETLnDiscOffset = 3;
34  static const uint32_t kETLnDiscMask = 0x1;
35  static const uint32_t kETLdiscSideOffset = 2;
36  static const uint32_t kETLdiscSideMask = 0x1;
37  static const uint32_t kETLsectorMask = 0x3;
38 
39  static constexpr int kETLv4maxRing = 16;
40  static constexpr int kETLv4maxSector = 4;
41  static constexpr int kETLv4maxModule = 248;
42  static constexpr int kETLv4nDisc = 2;
43 
44  static constexpr int kETLv5maxRing = 14;
45  static constexpr int kETLv5maxSector = 2;
46  static constexpr int kETLv5maxModule = 517;
47  static constexpr int kETLv5nDisc = kETLv4nDisc;
48 
49  static constexpr uint32_t kSoff = 4;
50 
51  // ---------- Constructors, enumerated types ----------
52 
55  id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset;
56  id_ |= kETLformatV2;
57  }
58 
60  ETLDetId(const uint32_t& raw_id) {
61  uint32_t tmpId = raw_id;
62  if ((tmpId & kETLformatV2) == 0) {
63  tmpId = newForm(tmpId);
64  }
65  id_ = MTDDetId(tmpId).rawId();
66  }
67 
69  ETLDetId(const DetId& det_id) {
70  uint32_t tmpId = det_id.rawId();
71  if ((tmpId & kETLformatV2) == 0) {
72  tmpId = newForm(tmpId);
73  }
74  id_ = MTDDetId(tmpId).rawId();
75  }
76 
78  ETLDetId(uint32_t zside, uint32_t ring, uint32_t module, uint32_t modtyp)
80  id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset |
82  (modtyp & kETLmodTypeMask) << kETLmodTypeOffset;
83  id_ |= kETLformatV2;
84  }
85 
88  inline uint32_t encodeSector(uint32_t& disc, uint32_t& discside, uint32_t& sector) const {
89  return (sector + discside * kSoff + 2 * kSoff * disc);
90  }
91 
92  ETLDetId(uint32_t zside, uint32_t disc, uint32_t discside, uint32_t sector, uint32_t module, uint32_t modtyp)
94  id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset |
97  id_ |= kETLformatV2;
98  }
99 
100  // ---------- Common methods ----------
101 
103  inline int module() const { return (id_ >> kETLmoduleOffset) & kETLmoduleMask; }
104 
106  inline int modType() const { return (id_ >> kETLmodTypeOffset) & kETLmodTypeMask; }
107 
108  ETLDetId geographicalId() const { return id_; }
109 
110  // --------- Methods for the TDR ETL model only -----------
111  // meaningless for TP model
112 
113  // starting from 1
114  inline int sector() const { return ((((id_ >> kRodRingOffset) & kRodRingMask) - 1) & kETLsectorMask) + 1; }
115 
116  // 0 = front, 1 = back
117  inline int discSide() const {
119  }
120 
121  // starting from 1
122  inline int nDisc() const {
123  return (((((id_ >> kRodRingOffset) & kRodRingMask) - 1) >> kETLnDiscOffset) & kETLnDiscMask) + 1;
124  }
125 
126  uint32_t newForm(const uint32_t& rawid) {
127  uint32_t fixedP = rawid & (0xFFFFFFFF - kETLoldFieldMask); // unchanged part of id
128  uint32_t shiftP = (rawid & kETLoldFieldMask) >> kETLoldToNewShift; // shifted part
129  return ((fixedP | shiftP) | kETLformatV2);
130  }
131 };
132 
133 std::ostream& operator<<(std::ostream&, const ETLDetId&);
134 
135 #endif // DataFormats_ETLDetId_ETLDetId_h
static const uint32_t kETLnDiscMask
Definition: ETLDetId.h:34
static const uint32_t kRodRingOffset
Definition: MTDDetId.h:33
MTDDetId()
Definition: MTDDetId.h:39
static const uint32_t kETLsectorMask
Definition: ETLDetId.h:37
static const uint32_t kETLdiscSideMask
Definition: ETLDetId.h:36
ETLDetId(uint32_t zside, uint32_t disc, uint32_t discside, uint32_t sector, uint32_t module, uint32_t modtyp)
Definition: ETLDetId.h:92
static const uint32_t kETLoldToNewShift
Definition: ETLDetId.h:18
int modType() const
Definition: ETLDetId.h:106
static constexpr int kETLv4maxModule
Definition: ETLDetId.h:41
ETLDetId(const uint32_t &raw_id)
Definition: ETLDetId.h:60
static constexpr int kETLv5maxRing
Definition: ETLDetId.h:44
ETLDetId geographicalId() const
Definition: ETLDetId.h:108
ForwardSubdetector
static const uint32_t kZsideOffset
Definition: MTDDetId.h:31
static const uint32_t kMTDsubdOffset
Definition: MTDDetId.h:29
static constexpr int kETLv1maxModule
Definition: ETLDetId.h:29
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
uint32_t encodeSector(uint32_t &disc, uint32_t &discside, uint32_t &sector) const
Definition: ETLDetId.h:88
static const uint32_t kETLmodTypeMask
Definition: ETLDetId.h:26
static const uint32_t kETLdiscSideOffset
Definition: ETLDetId.h:35
static const uint32_t kRodRingMask
Definition: MTDDetId.h:34
int sector() const
Definition: ETLDetId.h:114
static constexpr int kETLv5nDisc
Definition: ETLDetId.h:47
ETLDetId(uint32_t zside, uint32_t ring, uint32_t module, uint32_t modtyp)
Definition: ETLDetId.h:78
int module() const
Definition: ETLDetId.h:103
static const uint32_t kMTDsubdMask
Definition: MTDDetId.h:30
static constexpr int kETLv1maxRing
Definition: ETLDetId.h:28
static constexpr int kETLv5maxSector
Definition: ETLDetId.h:45
static const uint32_t kZsideMask
Definition: MTDDetId.h:32
Definition: DetId.h:17
int discSide() const
Definition: ETLDetId.h:117
std::ostream & operator<<(std::ostream &, const ETLDetId &)
Definition: ETLDetId.cc:4
static constexpr int kETLv4maxSector
Definition: ETLDetId.h:40
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static const uint32_t kETLoldFieldMask
Definition: ETLDetId.h:19
uint32_t id_
Definition: DetId.h:69
static const uint32_t kETLmodTypeOffset
Definition: ETLDetId.h:25
static const uint32_t kETLmoduleMask
Definition: ETLDetId.h:24
int zside() const
Definition: MTDDetId.h:61
static constexpr uint32_t kSoff
Definition: ETLDetId.h:49
static const uint32_t kETLformatV2
Definition: ETLDetId.h:20
ETLDetId(const DetId &det_id)
Definition: ETLDetId.h:69
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
int nDisc() const
Definition: ETLDetId.h:122
ETLDetId()
Definition: ETLDetId.h:54
static constexpr int kETLv4nDisc
Definition: ETLDetId.h:42
uint32_t newForm(const uint32_t &rawid)
Definition: ETLDetId.h:126
static const uint32_t kETLmoduleOffset
Definition: ETLDetId.h:23
static constexpr int kETLv5maxModule
Definition: ETLDetId.h:46
static constexpr int kETLv4maxRing
Definition: ETLDetId.h:39
static constexpr int kETLv1nDisc
Definition: ETLDetId.h:30
static const uint32_t kETLnDiscOffset
constants for the TDR ETL model
Definition: ETLDetId.h:33