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 constexpr uint32_t kETLoldToNewShift = 2;
19  static constexpr uint32_t kETLoldFieldMask = 0x7FFF;
20  static constexpr uint32_t kETLformatV2 = 1;
21 
22 public:
23  static constexpr uint32_t kETLmoduleOffset = 5;
24  static constexpr uint32_t kETLmoduleMask = 0x7FF;
25  static constexpr uint32_t kETLmodTypeOffset = 3;
26  static constexpr 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 constexpr uint32_t kETLnDiscOffset = 3;
34  static constexpr uint32_t kETLnDiscMask = 0x1;
35  static constexpr uint32_t kETLdiscSideOffset = 2;
36  static constexpr uint32_t kETLdiscSideMask = 0x1;
37  static constexpr 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  enum class EtlLayout { tp = 1, v4 = 2, v5 = 3 };
52 
53  // ---------- Constructors, enumerated types ----------
54 
57  id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset;
58  id_ |= kETLformatV2;
59  }
60 
62  ETLDetId(const uint32_t& raw_id) {
63  uint32_t tmpId = raw_id;
64  if ((tmpId & kETLformatV2) == 0) {
65  tmpId = newForm(tmpId);
66  }
67  id_ = MTDDetId(tmpId).rawId();
68  }
69 
71  ETLDetId(const DetId& det_id) {
72  uint32_t tmpId = det_id.rawId();
73  if ((tmpId & kETLformatV2) == 0) {
74  tmpId = newForm(tmpId);
75  }
76  id_ = MTDDetId(tmpId).rawId();
77  }
78 
80  ETLDetId(uint32_t zside, uint32_t ring, uint32_t module, uint32_t modtyp)
82  id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset |
84  (modtyp & kETLmodTypeMask) << kETLmodTypeOffset;
85  id_ |= kETLformatV2;
86  }
87 
90  inline uint32_t encodeSector(uint32_t& disc, uint32_t& discside, uint32_t& sector) const {
91  return (sector + discside * kSoff + 2 * kSoff * disc);
92  }
93 
94  ETLDetId(uint32_t zside, uint32_t disc, uint32_t discside, uint32_t sector, uint32_t module, uint32_t modtyp)
96  id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset |
99  id_ |= kETLformatV2;
100  }
101 
102  // ---------- Common methods ----------
103 
105  inline int module() const { return (id_ >> kETLmoduleOffset) & kETLmoduleMask; }
106 
108  inline int modType() const { return (id_ >> kETLmodTypeOffset) & kETLmodTypeMask; }
109 
110  ETLDetId geographicalId() const { return id_; }
111 
112  // --------- Methods for the TDR ETL model only -----------
113  // meaningless for TP model
114 
115  // starting from 1
116  inline int sector() const { return ((((id_ >> kRodRingOffset) & kRodRingMask) - 1) & kETLsectorMask) + 1; }
117 
118  // 0 = front, 1 = back
119  inline int discSide() const {
121  }
122 
123  // starting from 1
124  inline int nDisc() const {
125  return (((((id_ >> kRodRingOffset) & kRodRingMask) - 1) >> kETLnDiscOffset) & kETLnDiscMask) + 1;
126  }
127 
128  uint32_t newForm(const uint32_t& rawid) {
129  uint32_t fixedP = rawid & (0xFFFFFFFF - kETLoldFieldMask); // unchanged part of id
130  uint32_t shiftP = (rawid & kETLoldFieldMask) >> kETLoldToNewShift; // shifted part
131  return ((fixedP | shiftP) | kETLformatV2);
132  }
133 };
134 
135 std::ostream& operator<<(std::ostream&, const ETLDetId&);
136 
137 #endif // DataFormats_ETLDetId_ETLDetId_h
static constexpr uint32_t kETLdiscSideMask
Definition: ETLDetId.h:36
static const uint32_t kRodRingOffset
Definition: MTDDetId.h:33
MTDDetId()
Definition: MTDDetId.h:39
static constexpr uint32_t kETLdiscSideOffset
Definition: ETLDetId.h:35
static constexpr uint32_t kETLmodTypeOffset
Definition: ETLDetId.h:25
ETLDetId(uint32_t zside, uint32_t disc, uint32_t discside, uint32_t sector, uint32_t module, uint32_t modtyp)
Definition: ETLDetId.h:94
int modType() const
Definition: ETLDetId.h:108
static constexpr int kETLv4maxModule
Definition: ETLDetId.h:41
ETLDetId(const uint32_t &raw_id)
Definition: ETLDetId.h:62
static constexpr int kETLv5maxRing
Definition: ETLDetId.h:44
ETLDetId geographicalId() const
Definition: ETLDetId.h:110
ForwardSubdetector
static constexpr uint32_t kETLsectorMask
Definition: ETLDetId.h:37
static const uint32_t kZsideOffset
Definition: MTDDetId.h:31
static constexpr uint32_t kETLmoduleOffset
Definition: ETLDetId.h:23
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:90
static constexpr uint32_t kETLformatV2
Definition: ETLDetId.h:20
static const uint32_t kRodRingMask
Definition: MTDDetId.h:34
int sector() const
Definition: ETLDetId.h:116
static constexpr uint32_t kETLoldFieldMask
Definition: ETLDetId.h:19
static constexpr int kETLv5nDisc
Definition: ETLDetId.h:47
ETLDetId(uint32_t zside, uint32_t ring, uint32_t module, uint32_t modtyp)
Definition: ETLDetId.h:80
int module() const
Definition: ETLDetId.h:105
static const uint32_t kMTDsubdMask
Definition: MTDDetId.h:30
static constexpr uint32_t kETLmodTypeMask
Definition: ETLDetId.h:26
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
static constexpr uint32_t kETLoldToNewShift
Definition: ETLDetId.h:18
Definition: DetId.h:17
int discSide() const
Definition: ETLDetId.h:119
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
uint32_t id_
Definition: DetId.h:69
static constexpr uint32_t kETLmoduleMask
Definition: ETLDetId.h:24
int zside() const
Definition: MTDDetId.h:61
static constexpr uint32_t kSoff
Definition: ETLDetId.h:49
ETLDetId(const DetId &det_id)
Definition: ETLDetId.h:71
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
int nDisc() const
Definition: ETLDetId.h:124
ETLDetId()
Definition: ETLDetId.h:56
static constexpr int kETLv4nDisc
Definition: ETLDetId.h:42
uint32_t newForm(const uint32_t &rawid)
Definition: ETLDetId.h:128
static constexpr uint32_t kETLnDiscOffset
constants for the TDR ETL model
Definition: ETLDetId.h:33
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 constexpr uint32_t kETLnDiscMask
Definition: ETLDetId.h:34