CMS 3D CMS Logo

SiStripFecKey.h
Go to the documentation of this file.
1 
2 #ifndef DataFormats_SiStripCommon_SiStripFecKey_H
3 #define DataFormats_SiStripCommon_SiStripFecKey_H
4 
7 
45 class SiStripFecKey : public SiStripKey {
46 
47  public:
48 
49  // ---------- Constructors ----------
50 
52  SiStripFecKey( const uint16_t& fec_crate,
53  const uint16_t& fec_slot = 0,
54  const uint16_t& fec_ring = 0,
55  const uint16_t& ccu_addr = 0,
56  const uint16_t& ccu_chan = 0,
57  const uint16_t& lld_chan = 0,
58  const uint16_t& i2c_addr = 0 );
59 
61  SiStripFecKey( const uint32_t& fec_key );
62 
64  SiStripFecKey( const std::string& directory_path );
65 
67  SiStripFecKey( const SiStripFecKey& );
68 
70  SiStripFecKey( const SiStripKey& );
71 
73  SiStripFecKey( const SiStripKey&,
74  const sistrip::Granularity& );
75 
77  SiStripFecKey();
78 
79  // ---------- Control structure ----------
80 
82  inline const uint16_t& fecCrate() const;
83 
85  inline const uint16_t& fecSlot() const;
86 
88  inline const uint16_t& fecRing() const;
89 
91  inline const uint16_t& ccuAddr() const;
92 
94  inline const uint16_t& ccuChan() const;
95 
97  inline const uint16_t& lldChan() const;
98 
100  inline const uint16_t& i2cAddr() const;
101 
102  // ---------- Hybrid APV/LLD numbering scheme ----------
103 
105  static uint16_t hybridPos( const uint16_t& i2c_addr );
106 
108  static uint16_t i2cAddr( const uint16_t& hybrid_pos );
109 
111  static uint16_t lldChan( const uint16_t& i2c_addr );
112 
114  static bool firstApvOfPair( const uint16_t& i2c_addr );
115 
117  static uint16_t i2cAddr( const uint16_t& lld_chan,
118  const bool& first_apv_of_pair );
119 
120  // ---------- Utility methods ----------
121 
123  bool isEqual( const SiStripKey& ) const;
124 
126  bool isConsistent( const SiStripKey& ) const;
127 
129  bool isValid() const;
130 
133  bool isValid( const sistrip::Granularity& ) const;
134 
136  bool isInvalid() const;
137 
140  bool isInvalid( const sistrip::Granularity& ) const;
141 
142  // ---------- Print methods ----------
143 
145  virtual void print( std::stringstream& ss ) const;
146 
148  virtual void terse( std::stringstream& ss ) const;
149 
150  private:
151 
152  // ---------- Private methods ----------
153 
154  void initFromValue();
155  void initFromKey();
156  void initFromPath();
157  void initGranularity();
158 
159  // ---------- Private member data ----------
160 
162  uint16_t fecCrate_;
163 
165  uint16_t fecSlot_;
166 
168  uint16_t fecRing_;
169 
171  uint16_t ccuAddr_;
172 
174  uint16_t ccuChan_;
175 
177  uint16_t lldChan_;
178 
180  uint16_t i2cAddr_;
181 
182  // Definition of bit field positions for 32-bit key
183  static const uint16_t fecCrateOffset_ = 27;
184  static const uint16_t fecSlotOffset_ = 22;
185  static const uint16_t fecRingOffset_ = 18;
186  static const uint16_t ccuAddrOffset_ = 10;
187  static const uint16_t ccuChanOffset_ = 5;
188  static const uint16_t lldChanOffset_ = 2;
189  static const uint16_t i2cAddrOffset_ = 0;
190 
191  // Definition of bit field masks for 32-bit key
192  static const uint16_t fecCrateMask_ = 0x07; // (3 bits)
193  static const uint16_t fecSlotMask_ = 0x1F; // (5 bits)
194  static const uint16_t fecRingMask_ = 0x0F; // (4 bits)
195  static const uint16_t ccuAddrMask_ = 0xFF; // (8 bits)
196  static const uint16_t ccuChanMask_ = 0x1F; // (5 bits)
197  static const uint16_t lldChanMask_ = 0x07; // (3 bits)
198  static const uint16_t i2cAddrMask_ = 0x03; // (2 bits)
199 
200 };
201 
202 // ---------- Inline methods ----------
203 
204 const uint16_t& SiStripFecKey::fecCrate() const { return fecCrate_; }
205 const uint16_t& SiStripFecKey::fecSlot() const { return fecSlot_; }
206 const uint16_t& SiStripFecKey::fecRing() const { return fecRing_; }
207 const uint16_t& SiStripFecKey::ccuAddr() const { return ccuAddr_; }
208 const uint16_t& SiStripFecKey::ccuChan() const { return ccuChan_; }
209 const uint16_t& SiStripFecKey::lldChan() const { return lldChan_; }
210 const uint16_t& SiStripFecKey::i2cAddr() const { return i2cAddr_; }
211 
212 /* const uint16_t& SiStripFecKey::fecCrate() const { */
213 /* return ( key()>>fecCrateOffset_ ) & fecCrateMask_ != fecCrateMask_ ? ( key()>>fecCrateOffset_ ) & fecCrateMask_ : sistrip::invalid_; */
214 /* } */
215 /* const uint16_t& SiStripFecKey::fecSlot() const { */
216 /* return ( key()>>fecSlotOffset_ ) & fecSlotMask_ != fecSlotMask_ ? ( key()>>fecSlotOffset_ ) & fecSlotMask_ : sistrip::invalid_; */
217 /* } */
218 /* const uint16_t& SiStripFecKey::fecRing() const { */
219 /* return ( key()>>fecRingOffset_ ) & fecRingMask_ != fecRingMask_ ? ( key()>>fecRingOffset_ ) & fecRingMask_ : sistrip::invalid_; */
220 /* } */
221 /* const uint16_t& SiStripFecKey::ccuAddr() const { */
222 /* return ( key()>>ccuAddrOffset_ ) & ccuAddrMask_ != ccuAddrMask_ ? ( key()>>ccuAddrOffset_ ) & ccuAddrMask_ : sistrip::invalid_; */
223 /* } */
224 /* const uint16_t& SiStripFecKey::ccuChan() const { */
225 /* return ( key()>>ccuChanOffset_ ) & ccuChanMask_ != ccuChanMask_ ? ( key()>>ccuChanOffset_ ) & ccuChanMask_ : sistrip::invalid_; */
226 /* } */
227 /* const uint16_t& SiStripFecKey::lldChan() const { */
228 /* return ( key()>>lldChanOffset_ ) & lldChanMask_ != lldChanMask_ ? ( key()>>lldChanOffset_ ) & lldChanMask_ : sistrip::invalid_; */
229 /* } */
230 /* const uint16_t& SiStripFecKey::i2cAddr() const { */
231 /* return ( key()>>i2cAddrOffset_ ) & i2cAddrMask_ != i2cAddrMask_ ? ( key()>>i2cAddrOffset_ ) & i2cAddrMask_ : sistrip::invalid_; */
232 /* } */
233 
234 std::ostream& operator<< ( std::ostream&, const SiStripFecKey& );
235 
236 inline bool operator< ( const SiStripFecKey& a, const SiStripFecKey& b ) { return ( a.key() < b.key() ); }
237 
239  public:
240  explicit ConsistentWithKey( const SiStripFecKey& key );
241  bool operator() ( const uint32_t&, const uint32_t& ) const;
242  private:
243  explicit ConsistentWithKey();
245 };
246 
247 #endif // DataFormats_SiStripCommon_SiStripFecKey_H
uint16_t ccuAddr_
static const uint16_t ccuChanOffset_
static const uint16_t ccuChanMask_
static const uint16_t i2cAddrOffset_
const uint16_t & fecRing() const
uint16_t fecSlot_
uint16_t ccuChan_
static const uint16_t fecSlotMask_
uint16_t lldChan_
static const uint16_t fecRingOffset_
uint16_t fecCrate_
virtual void print(std::stringstream &ss) const
uint16_t fecRing_
const uint16_t & lldChan() const
const uint16_t & fecSlot() const
const uint16_t & i2cAddr() const
static const uint16_t fecCrateMask_
const uint32_t & key() const
Definition: SiStripKey.h:125
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
static bool firstApvOfPair(const uint16_t &i2c_addr)
static const uint16_t lldChanOffset_
static uint16_t hybridPos(const uint16_t &i2c_addr)
void initFromValue()
Constants and enumerated type for sistrip::Granularity.
bool isInvalid() const
Base utility class that identifies a position within a logical structure of the strip tracker...
Definition: SiStripKey.h:23
const uint16_t & fecCrate() const
static const uint16_t lldChanMask_
bool isEqual(const SiStripKey &) const
static const uint16_t fecSlotOffset_
uint16_t i2cAddr_
const uint16_t & ccuAddr() const
double b
Definition: hdecay.h:120
std::ostream & operator<<(std::ostream &, const SiStripFecKey &)
static const uint16_t ccuAddrMask_
bool operator<(const SiStripFecKey &a, const SiStripFecKey &b)
SiStripFecKey mask_
bool isValid() const
double a
Definition: hdecay.h:121
static const uint16_t i2cAddrMask_
const uint16_t & ccuChan() const
static const uint16_t fecRingMask_
static const uint16_t fecCrateOffset_
void initGranularity()
bool isConsistent(const SiStripKey &) const
static const uint16_t ccuAddrOffset_
virtual void terse(std::stringstream &ss) const