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 
16 class ETLDetId : public MTDDetId {
17 private:
18  // for conversion from old to new module bit field
19  static constexpr uint32_t kETLoldToNewShift = 2;
20  static constexpr uint32_t kETLoldFieldMask = 0x7FFF;
21  static constexpr uint32_t kETLformatV2 = 1;
22 
23 public:
24  static constexpr uint32_t kETLmoduleOffset = 5;
25  static constexpr uint32_t kETLmoduleMask = 0x7FF;
26  static constexpr uint32_t kETLmodTypeOffset = 3;
27  static constexpr uint32_t kETLmodTypeMask = 0x3;
28  static constexpr uint32_t kETLsensorOffset = 1;
29  static constexpr uint32_t kETLsensorMask = 0x3;
30 
31  static constexpr int kETLv1maxRing = 11;
32  static constexpr int kETLv1maxModule = 176;
33  static constexpr int kETLv1nDisc = 1;
34 
36  static constexpr uint32_t kETLnDiscOffset = 3;
37  static constexpr uint32_t kETLnDiscMask = 0x1;
38  static constexpr uint32_t kETLdiscSideOffset = 2;
39  static constexpr uint32_t kETLdiscSideMask = 0x1;
40  static constexpr uint32_t kETLsectorMask = 0x3;
41 
42  static constexpr int kETLv4maxRing = 16;
43  static constexpr int kETLv4maxSector = 4;
44  static constexpr int kETLv4maxModule = 248;
45  static constexpr int kETLv4nDisc = 2;
46 
47  static constexpr int kETLv5maxRing = 14;
48  static constexpr int kETLv5maxSector = 2;
49  static constexpr int kETLv5maxModule = 517;
51 
52  static constexpr uint32_t kSoff = 4;
53 
54  enum class EtlLayout { tp = 1, v4 = 2, v5 = 3, v8 = 4 };
55 
56  // ---------- Constructors, enumerated types ----------
57 
60  id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset;
61  id_ |= kETLformatV2;
62  }
63 
65  ETLDetId(const uint32_t& raw_id) {
66  uint32_t tmpId = raw_id;
67  if ((tmpId & kETLformatV2) == 0) {
68  tmpId = newForm(tmpId);
69  }
70  id_ = MTDDetId(tmpId).rawId();
71  }
72 
74  ETLDetId(const DetId& det_id) {
75  uint32_t tmpId = det_id.rawId();
76  if ((tmpId & kETLformatV2) == 0) {
77  tmpId = newForm(tmpId);
78  }
79  id_ = MTDDetId(tmpId).rawId();
80  }
81 
83  // pre v8
84  ETLDetId(uint32_t zside, uint32_t ring, uint32_t module, uint32_t modtyp)
86  id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset |
88  (modtyp & kETLmodTypeMask) << kETLmodTypeOffset;
89  id_ |= kETLformatV2;
90  }
91  // v8
92  ETLDetId(uint32_t zside, uint32_t ring, uint32_t module, uint32_t modtyp, uint32_t sensor)
94  id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset |
97  id_ |= kETLformatV2;
98  }
99 
102  inline uint32_t encodeSector(uint32_t& disc, uint32_t& discside, uint32_t& sector) const {
103  return (sector + discside * kSoff + 2 * kSoff * disc);
104  }
105 
106  // pre v8
107  ETLDetId(uint32_t zside, uint32_t disc, uint32_t discside, uint32_t sector, uint32_t module, uint32_t modtyp)
109  id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset |
110  (encodeSector(disc, discside, sector) & kRodRingMask) << kRodRingOffset |
112  id_ |= kETLformatV2;
113  }
114  // v8
115  ETLDetId(uint32_t zside,
116  uint32_t disc,
117  uint32_t discside,
118  uint32_t sector,
119  uint32_t module,
120  uint32_t modtyp,
121  uint32_t sensor)
123  id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset |
124  (encodeSector(disc, discside, sector) & kRodRingMask) << kRodRingOffset |
127  id_ |= kETLformatV2;
128  }
129 
130  // ---------- Common methods ----------
131 
133  inline int module() const { return (id_ >> kETLmoduleOffset) & kETLmoduleMask; }
134 
136  inline int modType() const { return (id_ >> kETLmodTypeOffset) & kETLmodTypeMask; }
137 
139  inline int sensor() const { return (id_ >> kETLsensorOffset) & kETLsensorMask; }
140 
141  ETLDetId geographicalId() const { return id_; }
142 
143  // --------- Methods for the TDR ETL model only -----------
144  // meaningless for TP model
145 
146  // starting from 1
147  inline int sector() const { return ((((id_ >> kRodRingOffset) & kRodRingMask) - 1) & kETLsectorMask) + 1; }
148 
149  // 0 = front, 1 = back
150  inline int discSide() const {
152  }
153 
154  // starting from 1
155  inline int nDisc() const {
156  return (((((id_ >> kRodRingOffset) & kRodRingMask) - 1) >> kETLnDiscOffset) & kETLnDiscMask) + 1;
157  }
158 
159  uint32_t newForm(const uint32_t& rawid) {
160  uint32_t fixedP = rawid & (0xFFFFFFFF - kETLoldFieldMask); // unchanged part of id
161  uint32_t shiftP = (rawid & kETLoldFieldMask) >> kETLoldToNewShift; // shifted part
162  return ((fixedP | shiftP) | kETLformatV2);
163  }
164 };
165 
166 std::ostream& operator<<(std::ostream&, const ETLDetId&);
167 
168 #endif // DataFormats_ETLDetId_ETLDetId_h
static constexpr uint32_t kETLdiscSideMask
Definition: ETLDetId.h:39
static const uint32_t kRodRingOffset
Definition: MTDDetId.h:33
MTDDetId()
Definition: MTDDetId.h:39
static constexpr uint32_t kETLdiscSideOffset
Definition: ETLDetId.h:38
static constexpr uint32_t kETLmodTypeOffset
Definition: ETLDetId.h:26
static constexpr uint32_t kETLsensorOffset
Definition: ETLDetId.h:28
ETLDetId(uint32_t zside, uint32_t disc, uint32_t discside, uint32_t sector, uint32_t module, uint32_t modtyp)
Definition: ETLDetId.h:107
static constexpr uint32_t kETLsensorMask
Definition: ETLDetId.h:29
int modType() const
Definition: ETLDetId.h:136
static constexpr int kETLv4maxModule
Definition: ETLDetId.h:44
ETLDetId(const uint32_t &raw_id)
Definition: ETLDetId.h:65
static constexpr int kETLv5maxRing
Definition: ETLDetId.h:47
ETLDetId geographicalId() const
Definition: ETLDetId.h:141
ForwardSubdetector
static constexpr uint32_t kETLsectorMask
Definition: ETLDetId.h:40
static const uint32_t kZsideOffset
Definition: MTDDetId.h:31
static constexpr uint32_t kETLmoduleOffset
Definition: ETLDetId.h:24
static const uint32_t kMTDsubdOffset
Definition: MTDDetId.h:29
static constexpr int kETLv1maxModule
Definition: ETLDetId.h:32
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:102
static constexpr uint32_t kETLformatV2
Definition: ETLDetId.h:21
static const uint32_t kRodRingMask
Definition: MTDDetId.h:34
int sector() const
Definition: ETLDetId.h:147
static constexpr uint32_t kETLoldFieldMask
Definition: ETLDetId.h:20
static constexpr int kETLv5nDisc
Definition: ETLDetId.h:50
ETLDetId(uint32_t zside, uint32_t ring, uint32_t module, uint32_t modtyp)
Definition: ETLDetId.h:84
int sensor() const
Definition: ETLDetId.h:139
int module() const
Definition: ETLDetId.h:133
static const uint32_t kMTDsubdMask
Definition: MTDDetId.h:30
ETLDetId(uint32_t zside, uint32_t disc, uint32_t discside, uint32_t sector, uint32_t module, uint32_t modtyp, uint32_t sensor)
Definition: ETLDetId.h:115
static constexpr uint32_t kETLmodTypeMask
Definition: ETLDetId.h:27
static constexpr int kETLv1maxRing
Definition: ETLDetId.h:31
static constexpr int kETLv5maxSector
Definition: ETLDetId.h:48
static const uint32_t kZsideMask
Definition: MTDDetId.h:32
static constexpr uint32_t kETLoldToNewShift
Definition: ETLDetId.h:19
ETLDetId(uint32_t zside, uint32_t ring, uint32_t module, uint32_t modtyp, uint32_t sensor)
Definition: ETLDetId.h:92
Definition: DetId.h:17
int discSide() const
Definition: ETLDetId.h:150
std::ostream & operator<<(std::ostream &, const ETLDetId &)
Definition: ETLDetId.cc:4
static constexpr int kETLv4maxSector
Definition: ETLDetId.h:43
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
uint32_t id_
Definition: DetId.h:69
static constexpr uint32_t kETLmoduleMask
Definition: ETLDetId.h:25
int zside() const
Definition: MTDDetId.h:61
static constexpr uint32_t kSoff
Definition: ETLDetId.h:52
ETLDetId(const DetId &det_id)
Definition: ETLDetId.h:74
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:16
int nDisc() const
Definition: ETLDetId.h:155
ETLDetId()
Definition: ETLDetId.h:59
static constexpr int kETLv4nDisc
Definition: ETLDetId.h:45
uint32_t newForm(const uint32_t &rawid)
Definition: ETLDetId.h:159
static constexpr uint32_t kETLnDiscOffset
constants for the TDR ETL model
Definition: ETLDetId.h:36
static constexpr int kETLv5maxModule
Definition: ETLDetId.h:49
static constexpr int kETLv4maxRing
Definition: ETLDetId.h:42
static constexpr int kETLv1nDisc
Definition: ETLDetId.h:33
static constexpr uint32_t kETLnDiscMask
Definition: ETLDetId.h:37