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 
18 class BTLDetId : public MTDDetId {
19 public:
20  static constexpr uint32_t kBTLmoduleOffset = 10;
21  static constexpr uint32_t kBTLmoduleMask = 0x3F;
22  static constexpr uint32_t kBTLmodTypeOffset = 8;
23  static constexpr uint32_t kBTLmodTypeMask = 0x3;
24  static constexpr uint32_t kBTLCrystalOffset = 0;
25  static constexpr uint32_t kBTLCrystalMask = 0x3F;
26 
28  static constexpr int kModulesPerROD = 54;
29  static constexpr int kModulesPerRODBarZflat = 42;
30  static constexpr int kModulesPerRODBarPhiFlat = 48;
31  static constexpr std::array<int, 4> kTypeBoundariesReference{{0, 18, 36, 54}};
32  static constexpr std::array<int, 4> kTypeBoundariesBarZflat{{0, 14, 28, 42}};
33  static constexpr std::array<int, 4> kTypeBoundariesBarPhiFlat{{0, 16, 32, 48}};
34  static constexpr int kCrystalsInPhiTile = 16; // per module and ROD
35  static constexpr int kCrystalsInEtaTile = 4; // per module
36  static constexpr int kCrystalsInPhiBar = 4; // per module and ROD
37  static constexpr int kCrystalsInEtaBar = 16; // per module
38  static constexpr int kCrystalsInPhiBarZ = 64; // per module and ROD
39  static constexpr int kCrystalsInEtaBarZ = 1; // per module
40  static constexpr int kCrystalsInPhiBarPhi = 3; // per module and ROD
41  static constexpr int kCrystalsInEtaBarPhi = 16; // per module
42  static constexpr int kCrystalsPerROD =
44  kCrystalsInEtaTile; // 64 crystals per module x 54 modules per rod, independent on geometry scenario Tile or Bar
45  static constexpr int kCrystalsPerRODBarZflat =
47  kCrystalsInEtaBarZ; // 64 crystals per module x 42 modules per rod, independent on geometry scenario Tile or Bar
49  kCrystalsInEtaBarPhi; // 48 crystals per module x 48 modules per rod
50  static constexpr int MIN_ROD = 1;
51  static constexpr int MAX_ROD = 72;
52  static constexpr int HALF_ROD = 36;
53  static constexpr int MIN_IETA = 1;
54  static constexpr int MIN_IPHI = 1;
56  static constexpr int MAX_IPHI_TILE = kCrystalsInPhiTile * HALF_ROD;
57  static constexpr int MAX_IETA_BAR = kCrystalsInEtaBar * kModulesPerROD;
58  static constexpr int MAX_IPHI_BAR = kCrystalsInPhiBar * HALF_ROD;
60  static constexpr int MAX_IPHI_BARZ = kCrystalsInPhiBarZ * HALF_ROD;
62  static constexpr int MAX_IPHI_BARZFLAT = kCrystalsInPhiBarZ * HALF_ROD;
65  static constexpr int MIN_HASH = 0; // always 0 ...
66  static constexpr int MAX_HASH =
67  2 * MAX_IPHI_TILE * MAX_IETA_TILE - 1; // the total amount is invariant per tile or bar)
68  static constexpr int kSizeForDenseIndexing = MAX_HASH + 1;
69 
70  enum class CrysLayout { tile = 1, bar = 2, barzflat = 3, barphiflat = 4 };
71 
72  // ---------- Constructors, enumerated types ----------
73 
76  id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset;
77  }
78 
80  BTLDetId(const uint32_t& raw_id) : MTDDetId(raw_id) { ; }
81 
83  BTLDetId(const DetId& det_id) : MTDDetId(det_id.rawId()) { ; }
84 
86  BTLDetId(uint32_t zside, uint32_t rod, uint32_t module, uint32_t modtyp, uint32_t crystal)
88  id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset |
91  }
92 
93  // ---------- Common methods ----------
94 
96  inline int module() const { return (id_ >> kBTLmoduleOffset) & kBTLmoduleMask; }
97 
99  inline int modType() const { return (id_ >> kBTLmodTypeOffset) & kBTLmodTypeMask; }
100 
102  inline int crystal() const { return ((id_ >> kBTLCrystalOffset) & kBTLCrystalMask) + 1; }
103 
105  inline int row(unsigned nrows = 16) const {
106  return (crystal() - 1) % nrows; // anything else for now
107  }
108 
110  inline int column(unsigned nrows = 16) const { return (crystal() - 1) / nrows; }
111 
113  int iphi(CrysLayout lay) const;
114 
116  int ietaAbs(CrysLayout lay) const;
117 
118  int ieta(CrysLayout lay) const { return zside() * ietaAbs(lay); }
119 
121  int hashedIndex(CrysLayout lay) const;
122 
123  static bool validHashedIndex(uint32_t din) { return (din < kSizeForDenseIndexing); }
124 
126  BTLDetId getUnhashedIndex(int hi, CrysLayout lay) const;
127 
130 
132  int modulesPerType(CrysLayout lay) const;
133 };
134 
135 std::ostream& operator<<(std::ostream&, const BTLDetId&);
136 
137 #endif // DataFormats_BTLDetId_BTLDetId_h
static constexpr int MAX_IETA_BAR
Definition: BTLDetId.h:57
static const uint32_t kRodRingOffset
Definition: MTDDetId.h:33
CrysLayout
Definition: BTLDetId.h:70
int ietaAbs(CrysLayout lay) const
Definition: BTLDetId.cc:32
static constexpr int MIN_IPHI
Definition: BTLDetId.h:54
static constexpr int kCrystalsInPhiBarPhi
Definition: BTLDetId.h:40
static constexpr int kSizeForDenseIndexing
Definition: BTLDetId.h:68
static bool validHashedIndex(uint32_t din)
Definition: BTLDetId.h:123
static constexpr int MIN_ROD
Definition: BTLDetId.h:50
static constexpr int MIN_HASH
Definition: BTLDetId.h:65
static constexpr uint32_t kBTLmodTypeOffset
Definition: BTLDetId.h:22
int row(unsigned nrows=16) const
Definition: BTLDetId.h:105
static constexpr uint32_t kBTLmodTypeMask
Definition: BTLDetId.h:23
BTLDetId getUnhashedIndex(int hi, CrysLayout lay) const
Definition: BTLDetId.cc:101
static constexpr int MAX_IPHI_BARZ
Definition: BTLDetId.h:60
int modType() const
Definition: BTLDetId.h:99
ForwardSubdetector
static const uint32_t kZsideOffset
Definition: MTDDetId.h:31
static const uint32_t kMTDsubdOffset
Definition: MTDDetId.h:29
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
static constexpr int MAX_IPHI_BAR
Definition: BTLDetId.h:58
static constexpr std::array< int, 4 > kTypeBoundariesBarZflat
Definition: BTLDetId.h:32
int column(unsigned nrows=16) const
Definition: BTLDetId.h:110
BTLDetId()
Definition: BTLDetId.h:75
static constexpr int kCrystalsPerROD
Definition: BTLDetId.h:42
static constexpr int kModulesPerRODBarZflat
Definition: BTLDetId.h:29
static const uint32_t kRodRingMask
Definition: MTDDetId.h:34
static constexpr int HALF_ROD
Definition: BTLDetId.h:52
Definition: EPCuts.h:4
static constexpr int kModulesPerRODBarPhiFlat
Definition: BTLDetId.h:30
static constexpr std::array< int, 4 > kTypeBoundariesBarPhiFlat
Definition: BTLDetId.h:33
int hashedIndex(CrysLayout lay) const
Definition: BTLDetId.cc:69
static constexpr uint32_t kBTLmoduleOffset
Definition: BTLDetId.h:20
static constexpr int MAX_IETA_TILE
Definition: BTLDetId.h:55
static constexpr int MAX_IPHI_BARZFLAT
Definition: BTLDetId.h:62
static const uint32_t kMTDsubdMask
Definition: MTDDetId.h:30
static constexpr int kCrystalsPerRODBarZflat
Definition: BTLDetId.h:45
static const uint32_t kZsideMask
Definition: MTDDetId.h:32
static constexpr int MAX_IPHI_TILE
Definition: BTLDetId.h:56
static constexpr int MIN_IETA
Definition: BTLDetId.h:53
static constexpr int kCrystalsInPhiBar
Definition: BTLDetId.h:36
int module() const
Definition: BTLDetId.h:96
static constexpr int MAX_IETA_BARPHIFLAT
Definition: BTLDetId.h:63
static constexpr int MAX_IETA_BARZ
Definition: BTLDetId.h:59
static constexpr int kModulesPerROD
range constants, need two sets for the time being (one for tiles and one for bars) ...
Definition: BTLDetId.h:28
BTLDetId(const DetId &det_id)
Definition: BTLDetId.h:83
static constexpr int MAX_ROD
Definition: BTLDetId.h:51
BTLDetId(uint32_t zside, uint32_t rod, uint32_t module, uint32_t modtyp, uint32_t crystal)
Definition: BTLDetId.h:86
Definition: DetId.h:17
static constexpr int MAX_HASH
Definition: BTLDetId.h:66
static constexpr int kCrystalsInEtaBarPhi
Definition: BTLDetId.h:41
static constexpr int kCrystalsInPhiTile
Definition: BTLDetId.h:34
int modulesPerType(CrysLayout lay) const
Definition: BTLDetId.cc:161
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
uint32_t id_
Definition: DetId.h:69
int iphi(CrysLayout lay) const
Definition: BTLDetId.cc:4
static constexpr int kCrystalsInEtaBar
Definition: BTLDetId.h:37
int zside() const
Definition: MTDDetId.h:61
static constexpr std::array< int, 4 > kTypeBoundariesReference
Definition: BTLDetId.h:31
static constexpr int MAX_IETA_BARZFLAT
Definition: BTLDetId.h:61
int ieta(CrysLayout lay) const
Definition: BTLDetId.h:118
static constexpr int kCrystalsPerRODBarPhiFlat
Definition: BTLDetId.h:48
static constexpr int kCrystalsInEtaBarZ
Definition: BTLDetId.h:39
std::ostream & operator<<(std::ostream &, const BTLDetId &)
Definition: BTLDetId.cc:184
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:18
static constexpr int kCrystalsInEtaTile
Definition: BTLDetId.h:35
BTLDetId(const uint32_t &raw_id)
Definition: BTLDetId.h:80
static constexpr uint32_t kBTLCrystalOffset
Definition: BTLDetId.h:24
static constexpr int kCrystalsInPhiBarZ
Definition: BTLDetId.h:38
BTLDetId geographicalId(CrysLayout lay) const
Definition: BTLDetId.cc:171
static constexpr uint32_t kBTLmoduleMask
Definition: BTLDetId.h:21
int crystal() const
Definition: BTLDetId.h:102
static constexpr int MAX_IPHI_BARPHIFLAT
Definition: BTLDetId.h:64
static constexpr uint32_t kBTLCrystalMask
Definition: BTLDetId.h:25