CMS 3D CMS Logo

BTLDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_BTLDetId_BTLDetId_h
2 #define DataFormats_BTLDetId_BTLDetId_h
3 
5 #include <ostream>
6 #include <array>
7 
19 class BTLDetId : public MTDDetId {
20 public:
21  static constexpr uint32_t kBTLmoduleOffset = 10;
22  static constexpr uint32_t kBTLmoduleMask = 0x3F;
23  static constexpr uint32_t kBTLmodTypeOffset = 8;
24  static constexpr uint32_t kBTLmodTypeMask = 0x3;
25  static constexpr uint32_t kBTLRUOffset = 6;
26  static constexpr uint32_t kBTLRUMask = 0x3;
27  static constexpr uint32_t kBTLCrystalOffset = 0;
28  static constexpr uint32_t kBTLCrystalMask = 0x3F;
29 
31  static constexpr uint32_t HALF_ROD = 36;
32  static constexpr uint32_t kModulesPerRODBarPhiFlat = 48;
33  static constexpr uint32_t kModulePerTypeBarPhiFlat = 48 / 3;
34  static constexpr uint32_t kRUPerTypeV2 = 2;
35  static constexpr uint32_t kModulesPerRUV2 = 24;
36  static constexpr uint32_t kCrystalsPerModuleV2 = 16;
37  static constexpr uint32_t kModulesPerTrkV2 = 3;
38  static constexpr uint32_t kCrystalTypes = 3;
39 
40  // Number of crystals in BTL according to TDR design, valid also for barphiflat scenario:
41  // 16 crystals x 24 modules x 2 readout units/type x 3 types x 36 rods/side x 2 sides
42  //
43  static constexpr uint32_t kCrystalsBTL =
45 
46  enum class CrysLayout { tile = 1, bar = 2, barzflat = 3, barphiflat = 4, v2 = 5, v3 = 6 };
47 
48  // ---------- Constructors, enumerated types ----------
49 
52  id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset;
53  }
54 
56  BTLDetId(const uint32_t& raw_id) : MTDDetId(raw_id) { ; }
57 
59  BTLDetId(const DetId& det_id) : MTDDetId(det_id.rawId()) { ; }
60 
62  BTLDetId(uint32_t zside, uint32_t rod, uint32_t module, uint32_t modtyp, uint32_t crystal)
64  id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset |
67  }
68 
70  BTLDetId(uint32_t zside, uint32_t rod, uint32_t runit, uint32_t module, uint32_t modtyp, uint32_t crystal)
72  id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset |
76  }
77 
78  // ---------- Common methods ----------
79 
81  inline int module() const { return (id_ >> kBTLmoduleOffset) & kBTLmoduleMask; }
82 
84  inline int modType() const { return (id_ >> kBTLmodTypeOffset) & kBTLmodTypeMask; }
85 
87  inline int crystal() const { return ((id_ >> kBTLCrystalOffset) & kBTLCrystalMask) + 1; }
88 
90  inline int runit() const { return (id_ >> kBTLRUOffset) & kBTLRUMask; }
91 
93  inline int globalRunit() const {
94  if (runit() == 0) {
95  // pre-V2: build a RU identifier from available information
96  return (module() - 1) / kModulePerTypeBarPhiFlat / kRUPerTypeV2 + 1;
97  } else if (runit() > 0 && modType() > 0) {
98  // V2/V3: build global RU identifier from RU per type and type
99  return (modType() - 1) * kRUPerTypeV2 + runit();
100  }
101  return 0;
102  }
103 
105  inline int row(unsigned nrows = kCrystalsPerModuleV2) const {
106  return (crystal() - 1) % nrows; // anything else for now
107  }
108 
110  inline int column(unsigned nrows = kCrystalsPerModuleV2) const { return (crystal() - 1) / nrows; }
111 
114 };
115 
116 std::ostream& operator<<(std::ostream&, const BTLDetId&);
117 
118 #endif // DataFormats_BTLDetId_BTLDetId_h
static constexpr uint32_t kCrystalsBTL
Definition: BTLDetId.h:43
static constexpr uint32_t kModulePerTypeBarPhiFlat
Definition: BTLDetId.h:33
static const uint32_t kRodRingOffset
Definition: MTDDetId.h:33
int row(unsigned nrows=kCrystalsPerModuleV2) const
Definition: BTLDetId.h:105
CrysLayout
Definition: BTLDetId.h:46
static constexpr uint32_t kCrystalTypes
Definition: BTLDetId.h:38
static constexpr uint32_t kBTLmodTypeOffset
Definition: BTLDetId.h:23
static constexpr uint32_t kBTLmodTypeMask
Definition: BTLDetId.h:24
int modType() const
Definition: BTLDetId.h:84
ForwardSubdetector
static const uint32_t kZsideOffset
Definition: MTDDetId.h:31
int globalRunit() const
Definition: BTLDetId.h:93
static const uint32_t kMTDsubdOffset
Definition: MTDDetId.h:29
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
BTLDetId()
Definition: BTLDetId.h:51
static constexpr uint32_t kBTLRUOffset
Definition: BTLDetId.h:25
static const uint32_t kRodRingMask
Definition: MTDDetId.h:34
static constexpr uint32_t HALF_ROD
range constants, need two sets for the time being (one for tiles and one for bars) ...
Definition: BTLDetId.h:31
static constexpr uint32_t kModulesPerRODBarPhiFlat
Definition: BTLDetId.h:32
static constexpr uint32_t kBTLRUMask
Definition: BTLDetId.h:26
static constexpr uint32_t kModulesPerTrkV2
Definition: BTLDetId.h:37
static constexpr uint32_t kBTLmoduleOffset
Definition: BTLDetId.h:21
static const uint32_t kMTDsubdMask
Definition: MTDDetId.h:30
static const uint32_t kZsideMask
Definition: MTDDetId.h:32
int module() const
Definition: BTLDetId.h:81
int column(unsigned nrows=kCrystalsPerModuleV2) const
Definition: BTLDetId.h:110
BTLDetId(const DetId &det_id)
Definition: BTLDetId.h:59
BTLDetId(uint32_t zside, uint32_t rod, uint32_t module, uint32_t modtyp, uint32_t crystal)
Definition: BTLDetId.h:62
static constexpr uint32_t kModulesPerRUV2
Definition: BTLDetId.h:35
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
uint32_t id_
Definition: DetId.h:69
int runit() const
Definition: BTLDetId.h:90
int zside() const
Definition: MTDDetId.h:61
BTLDetId(uint32_t zside, uint32_t rod, uint32_t runit, uint32_t module, uint32_t modtyp, uint32_t crystal)
Definition: BTLDetId.h:70
static constexpr uint32_t kRUPerTypeV2
Definition: BTLDetId.h:34
std::ostream & operator<<(std::ostream &, const BTLDetId &)
Definition: BTLDetId.cc:20
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:19
BTLDetId(const uint32_t &raw_id)
Definition: BTLDetId.h:56
static constexpr uint32_t kCrystalsPerModuleV2
Definition: BTLDetId.h:36
static constexpr uint32_t kBTLCrystalOffset
Definition: BTLDetId.h:27
BTLDetId geographicalId(CrysLayout lay) const
Definition: BTLDetId.cc:3
static constexpr uint32_t kBTLmoduleMask
Definition: BTLDetId.h:22
int crystal() const
Definition: BTLDetId.h:87
static constexpr uint32_t kBTLCrystalMask
Definition: BTLDetId.h:28