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