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; //7
24  static const uint32_t kETLmoduleMask = 0x7FF; //0x1FF
25  static const uint32_t kETLmodTypeOffset = 3; //5
26  static const uint32_t kETLmodTypeMask = 0x3; //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
ETLDetId::ETLDetId
ETLDetId(uint32_t zside, uint32_t ring, uint32_t module, uint32_t modtyp)
Definition: ETLDetId.h:78
ETLDetId::kETLv4maxSector
static constexpr int kETLv4maxSector
Definition: ETLDetId.h:40
ETLDetId::kETLnDiscOffset
static const uint32_t kETLnDiscOffset
constants for the TDR ETL model
Definition: ETLDetId.h:33
ETLDetId::kETLnDiscMask
static const uint32_t kETLnDiscMask
Definition: ETLDetId.h:34
ETLDetId::kETLmodTypeMask
static const uint32_t kETLmodTypeMask
Definition: ETLDetId.h:26
ETLDetId::newForm
uint32_t newForm(const uint32_t &rawid)
Definition: ETLDetId.h:126
ETLDetId::modType
int modType() const
Definition: ETLDetId.h:106
ETLDetId::ETLDetId
ETLDetId(const uint32_t &raw_id)
Definition: ETLDetId.h:60
ETLDetId::kETLv4maxRing
static constexpr int kETLv4maxRing
Definition: ETLDetId.h:39
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
ETLDetId::kETLdiscSideMask
static const uint32_t kETLdiscSideMask
Definition: ETLDetId.h:36
ETLDetId::kETLv1maxModule
static constexpr int kETLv1maxModule
Definition: ETLDetId.h:29
ETLDetId::kETLoldToNewShift
static const uint32_t kETLoldToNewShift
Definition: ETLDetId.h:18
MTDDetId::kZsideMask
static const uint32_t kZsideMask
Definition: MTDDetId.h:32
MTDDetId::kMTDsubdMask
static const uint32_t kMTDsubdMask
Definition: MTDDetId.h:30
ETLDetId::encodeSector
uint32_t encodeSector(uint32_t &disc, uint32_t &discside, uint32_t &sector) const
Definition: ETLDetId.h:88
ETLDetId
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
operator<<
std::ostream & operator<<(std::ostream &, const ETLDetId &)
Definition: ETLDetId.cc:4
ETLDetId::kETLv4nDisc
static constexpr int kETLv4nDisc
Definition: ETLDetId.h:42
ETLDetId::kETLmodTypeOffset
static const uint32_t kETLmodTypeOffset
Definition: ETLDetId.h:25
TtSemiLepEvtBuilder_cfi.disc
disc
Definition: TtSemiLepEvtBuilder_cfi.py:60
ETLDetId::module
int module() const
Definition: ETLDetId.h:103
ETLDetId::kETLdiscSideOffset
static const uint32_t kETLdiscSideOffset
Definition: ETLDetId.h:35
DetId
Definition: DetId.h:17
ETLDetId::kETLv5nDisc
static constexpr int kETLv5nDisc
Definition: ETLDetId.h:47
ETLDetId::kETLformatV2
static const uint32_t kETLformatV2
Definition: ETLDetId.h:20
ETLDetId::discSide
int discSide() const
Definition: ETLDetId.h:117
ETLDetId::kETLv5maxSector
static constexpr int kETLv5maxSector
Definition: ETLDetId.h:45
ETLDetId::nDisc
int nDisc() const
Definition: ETLDetId.h:122
MTDDetId::zside
int zside() const
Definition: MTDDetId.h:61
ETLDetId::kETLv5maxRing
static constexpr int kETLv5maxRing
Definition: ETLDetId.h:44
ETLDetId::geographicalId
ETLDetId geographicalId() const
Definition: ETLDetId.h:108
ETLDetId::sector
int sector() const
Definition: ETLDetId.h:114
ETLDetId::ETLDetId
ETLDetId(uint32_t zside, uint32_t disc, uint32_t discside, uint32_t sector, uint32_t module, uint32_t modtyp)
Definition: ETLDetId.h:92
ETLDetId::ETLDetId
ETLDetId(const DetId &det_id)
Definition: ETLDetId.h:69
ETLDetId::kETLv5maxModule
static constexpr int kETLv5maxModule
Definition: ETLDetId.h:46
DetId::id_
uint32_t id_
Definition: DetId.h:69
MTDDetId.h
MTDDetId::kRodRingMask
static const uint32_t kRodRingMask
Definition: MTDDetId.h:34
MTDDetId::MTDDetId
MTDDetId()
Definition: MTDDetId.h:39
MTDDetId::FastTime
Definition: MTDDetId.h:24
MTDDetId::kZsideOffset
static const uint32_t kZsideOffset
Definition: MTDDetId.h:31
ETLDetId::kETLv4maxModule
static constexpr int kETLv4maxModule
Definition: ETLDetId.h:41
MTDDetId::kMTDsubdOffset
static const uint32_t kMTDsubdOffset
Definition: MTDDetId.h:29
ETLDetId::kETLmoduleOffset
static const uint32_t kETLmoduleOffset
Definition: ETLDetId.h:23
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
ETLDetId::kETLmoduleMask
static const uint32_t kETLmoduleMask
Definition: ETLDetId.h:24
MTDDetId::kRodRingOffset
static const uint32_t kRodRingOffset
Definition: MTDDetId.h:33
MTDDetId
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
ETLDetId::kSoff
static constexpr uint32_t kSoff
Definition: ETLDetId.h:49
ETLDetId::kETLv1maxRing
static constexpr int kETLv1maxRing
Definition: ETLDetId.h:28
ETLDetId::ETLDetId
ETLDetId()
Definition: ETLDetId.h:54
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
ETLDetId::kETLoldFieldMask
static const uint32_t kETLoldFieldMask
Definition: ETLDetId.h:19
ETLDetId::kETLsectorMask
static const uint32_t kETLsectorMask
Definition: ETLDetId.h:37
DetId::Forward
Definition: DetId.h:30
ETLDetId::kETLv1nDisc
static constexpr int kETLv1nDisc
Definition: ETLDetId.h:30