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
BTLDetId::MAX_HASH
static constexpr int MAX_HASH
Definition: BTLDetId.h:66
BTLDetId::CrysLayout::barzflat
BTLDetId::HALF_ROD
static constexpr int HALF_ROD
Definition: BTLDetId.h:52
BTLDetId::MAX_IPHI_BARPHIFLAT
static constexpr int MAX_IPHI_BARPHIFLAT
Definition: BTLDetId.h:64
BTLDetId::MAX_IETA_BARPHIFLAT
static constexpr int MAX_IETA_BARPHIFLAT
Definition: BTLDetId.h:63
BTLDetId::kBTLmoduleMask
static constexpr uint32_t kBTLmoduleMask
Definition: BTLDetId.h:21
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
BTLDetId::kCrystalsInEtaBarZ
static constexpr int kCrystalsInEtaBarZ
Definition: BTLDetId.h:39
BTLDetId::kBTLCrystalOffset
static constexpr uint32_t kBTLCrystalOffset
Definition: BTLDetId.h:24
BTLDetId::MAX_IPHI_BARZ
static constexpr int MAX_IPHI_BARZ
Definition: BTLDetId.h:60
BTLDetId::kTypeBoundariesBarZflat
static constexpr std::array< int, 4 > kTypeBoundariesBarZflat
Definition: BTLDetId.h:32
BTLDetId::ietaAbs
int ietaAbs(CrysLayout lay) const
Definition: BTLDetId.cc:32
MTDDetId::kZsideMask
static const uint32_t kZsideMask
Definition: MTDDetId.h:32
MTDDetId::kMTDsubdMask
static const uint32_t kMTDsubdMask
Definition: MTDDetId.h:30
BTLDetId::kCrystalsInPhiTile
static constexpr int kCrystalsInPhiTile
Definition: BTLDetId.h:34
BTLDetId::kModulesPerROD
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::MIN_IETA
static constexpr int MIN_IETA
Definition: BTLDetId.h:53
BTLDetId::MAX_IPHI_TILE
static constexpr int MAX_IPHI_TILE
Definition: BTLDetId.h:56
BTLDetId::kTypeBoundariesReference
static constexpr std::array< int, 4 > kTypeBoundariesReference
Definition: BTLDetId.h:31
BTLDetId::kCrystalsInEtaBar
static constexpr int kCrystalsInEtaBar
Definition: BTLDetId.h:37
BTLDetId::kCrystalsInEtaBarPhi
static constexpr int kCrystalsInEtaBarPhi
Definition: BTLDetId.h:41
BTLDetId::crystal
int crystal() const
Definition: BTLDetId.h:102
BTLDetId::MAX_IETA_BAR
static constexpr int MAX_IETA_BAR
Definition: BTLDetId.h:57
operator<<
std::ostream & operator<<(std::ostream &, const BTLDetId &)
Definition: BTLDetId.cc:184
BTLDetId::getUnhashedIndex
BTLDetId getUnhashedIndex(int hi, CrysLayout lay) const
Definition: BTLDetId.cc:101
DetId
Definition: DetId.h:17
BTLDetId::module
int module() const
Definition: BTLDetId.h:96
BTLDetId::kCrystalsPerRODBarZflat
static constexpr int kCrystalsPerRODBarZflat
Definition: BTLDetId.h:45
BTLDetId
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0,...
Definition: BTLDetId.h:18
BTLDetId::MAX_IETA_TILE
static constexpr int MAX_IETA_TILE
Definition: BTLDetId.h:55
BTLDetId::kBTLmodTypeOffset
static constexpr uint32_t kBTLmodTypeOffset
Definition: BTLDetId.h:22
BTLDetId::MAX_IPHI_BARZFLAT
static constexpr int MAX_IPHI_BARZFLAT
Definition: BTLDetId.h:62
BTLDetId::modulesPerType
int modulesPerType(CrysLayout lay) const
Definition: BTLDetId.cc:161
BTLDetId::row
int row(unsigned nrows=16) const
Definition: BTLDetId.h:105
BTLDetId::MAX_ROD
static constexpr int MAX_ROD
Definition: BTLDetId.h:51
BTLDetId::MAX_IPHI_BAR
static constexpr int MAX_IPHI_BAR
Definition: BTLDetId.h:58
BTLDetId::CrysLayout
CrysLayout
Definition: BTLDetId.h:70
BTLDetId::CrysLayout::barphiflat
BTLDetId::MIN_IPHI
static constexpr int MIN_IPHI
Definition: BTLDetId.h:54
MTDDetId::zside
int zside() const
Definition: MTDDetId.h:61
BTLDetId::kTypeBoundariesBarPhiFlat
static constexpr std::array< int, 4 > kTypeBoundariesBarPhiFlat
Definition: BTLDetId.h:33
BTLDetId::kCrystalsInPhiBarPhi
static constexpr int kCrystalsInPhiBarPhi
Definition: BTLDetId.h:40
BTLDetId::kCrystalsPerROD
static constexpr int kCrystalsPerROD
Definition: BTLDetId.h:42
BTLDetId::modType
int modType() const
Definition: BTLDetId.h:99
BTLDetId::iphi
int iphi(CrysLayout lay) const
Definition: BTLDetId.cc:4
BTLDetId::hashedIndex
int hashedIndex(CrysLayout lay) const
Definition: BTLDetId.cc:69
cropTnPTrees.din
din
Definition: cropTnPTrees.py:30
DetId::id_
uint32_t id_
Definition: DetId.h:69
BTLDetId::kModulesPerRODBarPhiFlat
static constexpr int kModulesPerRODBarPhiFlat
Definition: BTLDetId.h:30
MTDDetId.h
BTLDetId::kSizeForDenseIndexing
static constexpr int kSizeForDenseIndexing
Definition: BTLDetId.h:68
MTDDetId::kRodRingMask
static const uint32_t kRodRingMask
Definition: MTDDetId.h:34
BTLDetId::CrysLayout::tile
BTLDetId::kCrystalsPerRODBarPhiFlat
static constexpr int kCrystalsPerRODBarPhiFlat
Definition: BTLDetId.h:48
BTLDetId::CrysLayout::bar
MTDDetId::FastTime
Definition: MTDDetId.h:24
MTDDetId::kZsideOffset
static const uint32_t kZsideOffset
Definition: MTDDetId.h:31
BTLDetId::validHashedIndex
static bool validHashedIndex(uint32_t din)
Definition: BTLDetId.h:123
BTLDetId::MIN_ROD
static constexpr int MIN_ROD
Definition: BTLDetId.h:50
BTLDetId::BTLDetId
BTLDetId(const DetId &det_id)
Definition: BTLDetId.h:83
MTDDetId::kMTDsubdOffset
static const uint32_t kMTDsubdOffset
Definition: MTDDetId.h:29
hi
Definition: EPCuts.h:4
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
BTLDetId::MAX_IETA_BARZ
static constexpr int MAX_IETA_BARZ
Definition: BTLDetId.h:59
BTLDetId::kCrystalsInPhiBar
static constexpr int kCrystalsInPhiBar
Definition: BTLDetId.h:36
MTDDetId::kRodRingOffset
static const uint32_t kRodRingOffset
Definition: MTDDetId.h:33
BTLDetId::MIN_HASH
static constexpr int MIN_HASH
Definition: BTLDetId.h:65
MTDDetId
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
BTLDetId::ieta
int ieta(CrysLayout lay) const
Definition: BTLDetId.h:118
BTLDetId::kBTLmodTypeMask
static constexpr uint32_t kBTLmodTypeMask
Definition: BTLDetId.h:23
BTLDetId::kBTLmoduleOffset
static constexpr uint32_t kBTLmoduleOffset
Definition: BTLDetId.h:20
BTLDetId::kCrystalsInPhiBarZ
static constexpr int kCrystalsInPhiBarZ
Definition: BTLDetId.h:38
BTLDetId::kCrystalsInEtaTile
static constexpr int kCrystalsInEtaTile
Definition: BTLDetId.h:35
BTLDetId::BTLDetId
BTLDetId(uint32_t zside, uint32_t rod, uint32_t module, uint32_t modtyp, uint32_t crystal)
Definition: BTLDetId.h:86
BTLDetId::BTLDetId
BTLDetId(const uint32_t &raw_id)
Definition: BTLDetId.h:80
BTLDetId::BTLDetId
BTLDetId()
Definition: BTLDetId.h:75
DetId::Forward
Definition: DetId.h:30
BTLDetId::geographicalId
BTLDetId geographicalId(CrysLayout lay) const
Definition: BTLDetId.cc:171
BTLDetId::kBTLCrystalMask
static constexpr uint32_t kBTLCrystalMask
Definition: BTLDetId.h:25
BTLDetId::MAX_IETA_BARZFLAT
static constexpr int MAX_IETA_BARZFLAT
Definition: BTLDetId.h:61
BTLDetId::column
int column(unsigned nrows=16) const
Definition: BTLDetId.h:110
BTLDetId::kModulesPerRODBarZflat
static constexpr int kModulesPerRODBarZflat
Definition: BTLDetId.h:29