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;
33  static constexpr std::array<int,4> kTypeBoundariesReference{ { 0, 18, 36, 54 } };
34  static constexpr std::array<int,4> kTypeBoundariesBarZflat{ { 0, 14, 28, 42 } };
35  static constexpr std::array<int,4> kTypeBoundariesBarPhiFlat{ { 0, 16, 32, 48 } };
36  static constexpr int kCrystalsInPhiTile = 16; // per module and ROD
37  static constexpr int kCrystalsInEtaTile = 4; // per module
38  static constexpr int kCrystalsInPhiBar = 4; // per module and ROD
39  static constexpr int kCrystalsInEtaBar = 16; // per module
40  static constexpr int kCrystalsInPhiBarZ = 64; // per module and ROD
41  static constexpr int kCrystalsInEtaBarZ = 1; // per module
42  static constexpr int kCrystalsInPhiBarPhi = 3; // per module and ROD
43  static constexpr int kCrystalsInEtaBarPhi = 16; // per module
44  static constexpr int kCrystalsPerROD = kModulesPerROD*kCrystalsInPhiTile*kCrystalsInEtaTile; // 64 crystals per module x 54 modules per rod, independent on geometry scenario Tile or Bar
45  static constexpr int kCrystalsPerRODBarZflat = kModulesPerRODBarZflat*kCrystalsInPhiBarZ*kCrystalsInEtaBarZ; // 64 crystals per module x 42 modules per rod, independent on geometry scenario Tile or Bar
46  static constexpr int kCrystalsPerRODBarPhiFlat = kModulesPerRODBarPhiFlat*kCrystalsInPhiBarPhi*kCrystalsInEtaBarPhi; // 48 crystals per module x 48 modules per rod
47  static constexpr int MIN_ROD = 1;
48  static constexpr int MAX_ROD = 72;
49  static constexpr int HALF_ROD = 36;
50  static constexpr int MIN_IETA = 1;
51  static constexpr int MIN_IPHI = 1;
52  static constexpr int MAX_IETA_TILE = kCrystalsInEtaTile*kModulesPerROD;
53  static constexpr int MAX_IPHI_TILE = kCrystalsInPhiTile*HALF_ROD;
54  static constexpr int MAX_IETA_BAR = kCrystalsInEtaBar*kModulesPerROD;
55  static constexpr int MAX_IPHI_BAR = kCrystalsInPhiBar*HALF_ROD;
56  static constexpr int MAX_IETA_BARZ = kCrystalsInEtaBarZ*kModulesPerROD;
57  static constexpr int MAX_IPHI_BARZ = kCrystalsInPhiBarZ*HALF_ROD;
58  static constexpr int MAX_IETA_BARZFLAT = kCrystalsInEtaBarZ*kModulesPerRODBarZflat;
59  static constexpr int MAX_IPHI_BARZFLAT = kCrystalsInPhiBarZ*HALF_ROD;
60  static constexpr int MAX_IETA_BARPHIFLAT = kCrystalsInEtaBarPhi*kModulesPerRODBarPhiFlat;
61  static constexpr int MAX_IPHI_BARPHIFLAT = kCrystalsInPhiBarPhi*HALF_ROD;
62  static constexpr int MIN_HASH = 0; // always 0 ...
63  static constexpr int MAX_HASH = 2*MAX_IPHI_TILE*MAX_IETA_TILE-1; // the total amount is invariant per tile or bar)
64  static constexpr int kSizeForDenseIndexing = MAX_HASH + 1 ;
65 
66  enum class CrysLayout { tile = 1 , bar = 2 , barzflat = 3 , barphiflat = 4 } ;
67 
68  // ---------- Constructors, enumerated types ----------
69 
72 
74  BTLDetId( const uint32_t& raw_id ) : MTDDetId( raw_id ) {;}
75 
77  BTLDetId( const DetId& det_id ) : MTDDetId( det_id.rawId() ) {;}
78 
80  BTLDetId( uint32_t zside,
81  uint32_t rod,
82  uint32_t module,
83  uint32_t modtyp,
85  id_ |= ( MTDType::BTL& kMTDsubdMask ) << kMTDsubdOffset |
86  ( zside& kZsideMask ) << kZsideOffset |
87  ( rod& kRodRingMask ) << kRodRingOffset |
88  ( module& kBTLmoduleMask ) << kBTLmoduleOffset |
89  ( modtyp& kBTLmodTypeMask ) << kBTLmodTypeOffset |
90  ( (crystal-1)& kBTLCrystalMask ) << kBTLCrystalOffset ;
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 {
111  return (crystal()-1)/nrows;
112  }
113 
115  int iphi( CrysLayout lay ) const ;
116 
118  int ietaAbs( CrysLayout lay ) const ;
119 
120  int ieta( CrysLayout lay ) const { return zside()*ietaAbs( lay ); }
121 
123  int hashedIndex( CrysLayout lay ) const ;
124 
125  static bool validHashedIndex( uint32_t din ) { return ( din < kSizeForDenseIndexing ) ; }
126 
128  BTLDetId getUnhashedIndex( int hi, CrysLayout lay ) const ;
129 
131  BTLDetId geographicalId( CrysLayout lay ) const;
132 
134  int modulesPerType( CrysLayout lay ) const ;
135 
136 };
137 
138 std::ostream& operator<< ( std::ostream&, const BTLDetId& );
139 
140 #endif // DataFormats_BTLDetId_BTLDetId_h
141 
static constexpr int MAX_IETA_BAR
Definition: BTLDetId.h:54
int ieta(CrysLayout lay) const
Definition: BTLDetId.h:120
static const uint32_t kRodRingOffset
Definition: MTDDetId.h:35
int modulesPerType(CrysLayout lay) const
Definition: BTLDetId.cc:155
CrysLayout
Definition: BTLDetId.h:66
static constexpr int MIN_IPHI
Definition: BTLDetId.h:51
static constexpr int kCrystalsInPhiBarPhi
Definition: BTLDetId.h:42
static constexpr int kSizeForDenseIndexing
Definition: BTLDetId.h:64
static bool validHashedIndex(uint32_t din)
Definition: BTLDetId.h:125
static constexpr int MIN_ROD
Definition: BTLDetId.h:47
int ietaAbs(CrysLayout lay) const
Definition: BTLDetId.cc:32
static constexpr int MIN_HASH
Definition: BTLDetId.h:62
static constexpr uint32_t kBTLmodTypeOffset
Definition: BTLDetId.h:24
static constexpr std::array< int, 4 > kTypeBoundariesReference
Definition: BTLDetId.h:33
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:57
ForwardSubdetector
static const uint32_t kZsideOffset
Definition: MTDDetId.h:33
static const uint32_t kMTDsubdOffset
Definition: MTDDetId.h:31
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
static constexpr int MAX_IPHI_BAR
Definition: BTLDetId.h:55
BTLDetId()
Definition: BTLDetId.h:71
static constexpr int kCrystalsPerROD
Definition: BTLDetId.h:44
static constexpr int kModulesPerRODBarZflat
Definition: BTLDetId.h:31
BTLDetId geographicalId(CrysLayout lay) const
Definition: BTLDetId.cc:162
static const uint32_t kRodRingMask
Definition: MTDDetId.h:36
static constexpr int HALF_ROD
Definition: BTLDetId.h:49
static constexpr int kModulesPerRODBarPhiFlat
Definition: BTLDetId.h:32
static constexpr uint32_t kBTLmoduleOffset
Definition: BTLDetId.h:22
static constexpr int MAX_IETA_TILE
Definition: BTLDetId.h:52
static constexpr int MAX_IPHI_BARZFLAT
Definition: BTLDetId.h:59
static const uint32_t kMTDsubdMask
Definition: MTDDetId.h:32
static constexpr int kCrystalsPerRODBarZflat
Definition: BTLDetId.h:45
static const uint32_t kZsideMask
Definition: MTDDetId.h:34
static constexpr int MAX_IPHI_TILE
Definition: BTLDetId.h:53
static constexpr int MIN_IETA
Definition: BTLDetId.h:50
static constexpr int kCrystalsInPhiBar
Definition: BTLDetId.h:38
static constexpr int MAX_IETA_BARPHIFLAT
Definition: BTLDetId.h:60
static constexpr int MAX_IETA_BARZ
Definition: BTLDetId.h:56
static constexpr std::array< int, 4 > kTypeBoundariesBarZflat
Definition: BTLDetId.h:34
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:77
static constexpr std::array< int, 4 > kTypeBoundariesBarPhiFlat
Definition: BTLDetId.h:35
int hashedIndex(CrysLayout lay) const
Definition: BTLDetId.cc:70
static constexpr int MAX_ROD
Definition: BTLDetId.h:48
BTLDetId(uint32_t zside, uint32_t rod, uint32_t module, uint32_t modtyp, uint32_t crystal)
Definition: BTLDetId.h:80
Definition: DetId.h:18
static constexpr int MAX_HASH
Definition: BTLDetId.h:63
static constexpr int kCrystalsInEtaBarPhi
Definition: BTLDetId.h:43
static constexpr int kCrystalsInPhiTile
Definition: BTLDetId.h:36
int iphi(CrysLayout lay) const
Definition: BTLDetId.cc:4
BTLDetId getUnhashedIndex(int hi, CrysLayout lay) const
Definition: BTLDetId.cc:102
uint32_t id_
Definition: DetId.h:62
static constexpr int kCrystalsInEtaBar
Definition: BTLDetId.h:39
static constexpr int MAX_IETA_BARZFLAT
Definition: BTLDetId.h:58
int module() const
Definition: BTLDetId.h:96
static constexpr int kCrystalsPerRODBarPhiFlat
Definition: BTLDetId.h:46
static constexpr int kCrystalsInEtaBarZ
Definition: BTLDetId.h:41
std::ostream & operator<<(std::ostream &, const BTLDetId &)
Definition: BTLDetId.cc:175
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:37
int column(unsigned nrows=16) const
Definition: BTLDetId.h:110
BTLDetId(const uint32_t &raw_id)
Definition: BTLDetId.h:74
static constexpr uint32_t kBTLCrystalOffset
Definition: BTLDetId.h:26
static constexpr int kCrystalsInPhiBarZ
Definition: BTLDetId.h:40
Definition: vlib.h:208
int modType() const
Definition: BTLDetId.h:99
static constexpr uint32_t kBTLmoduleMask
Definition: BTLDetId.h:23
#define constexpr
static constexpr int MAX_IPHI_BARPHIFLAT
Definition: BTLDetId.h:61
int crystal() const
Definition: BTLDetId.h:102
static constexpr uint32_t kBTLCrystalMask
Definition: BTLDetId.h:27
int row(unsigned nrows=16) const
Definition: BTLDetId.h:105