CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripFecKey.h
Go to the documentation of this file.
1 // Last commit: $Id: SiStripFecKey.h,v 1.16 2008/02/21 16:51:55 bainbrid Exp $
2 
3 #ifndef DataFormats_SiStripCommon_SiStripFecKey_H
4 #define DataFormats_SiStripCommon_SiStripFecKey_H
5 
8 
46 class SiStripFecKey : public SiStripKey {
47 
48  public:
49 
50  // ---------- Constructors ----------
51 
53  SiStripFecKey( const uint16_t& fec_crate,
54  const uint16_t& fec_slot = 0,
55  const uint16_t& fec_ring = 0,
56  const uint16_t& ccu_addr = 0,
57  const uint16_t& ccu_chan = 0,
58  const uint16_t& lld_chan = 0,
59  const uint16_t& i2c_addr = 0 );
60 
62  SiStripFecKey( const uint32_t& fec_key );
63 
65  SiStripFecKey( const std::string& directory_path );
66 
68  SiStripFecKey( const SiStripFecKey& );
69 
71  SiStripFecKey( const SiStripKey& );
72 
74  SiStripFecKey( const SiStripKey&,
75  const sistrip::Granularity& );
76 
78  SiStripFecKey();
79 
80  // ---------- Control structure ----------
81 
83  inline const uint16_t& fecCrate() const;
84 
86  inline const uint16_t& fecSlot() const;
87 
89  inline const uint16_t& fecRing() const;
90 
92  inline const uint16_t& ccuAddr() const;
93 
95  inline const uint16_t& ccuChan() const;
96 
98  inline const uint16_t& lldChan() const;
99 
101  inline const uint16_t& i2cAddr() const;
102 
103  // ---------- Hybrid APV/LLD numbering scheme ----------
104 
106  static uint16_t hybridPos( const uint16_t& i2c_addr );
107 
109  static uint16_t i2cAddr( const uint16_t& hybrid_pos );
110 
112  static uint16_t lldChan( const uint16_t& i2c_addr );
113 
115  static bool firstApvOfPair( const uint16_t& i2c_addr );
116 
118  static uint16_t i2cAddr( const uint16_t& lld_chan,
119  const bool& first_apv_of_pair );
120 
121  // ---------- Utility methods ----------
122 
124  bool isEqual( const SiStripKey& ) const;
125 
127  bool isConsistent( const SiStripKey& ) const;
128 
130  bool isValid() const;
131 
134  bool isValid( const sistrip::Granularity& ) const;
135 
137  bool isInvalid() const;
138 
141  bool isInvalid( const sistrip::Granularity& ) const;
142 
143  // ---------- Print methods ----------
144 
146  virtual void print( std::stringstream& ss ) const;
147 
149  virtual void terse( std::stringstream& ss ) const;
150 
151  private:
152 
153  // ---------- Private methods ----------
154 
155  void initFromValue();
156  void initFromKey();
157  void initFromPath();
158  void initGranularity();
159 
160  // ---------- Private member data ----------
161 
163  uint16_t fecCrate_;
164 
166  uint16_t fecSlot_;
167 
169  uint16_t fecRing_;
170 
172  uint16_t ccuAddr_;
173 
175  uint16_t ccuChan_;
176 
178  uint16_t lldChan_;
179 
181  uint16_t i2cAddr_;
182 
183  // Definition of bit field positions for 32-bit key
184  static const uint16_t fecCrateOffset_ = 27;
185  static const uint16_t fecSlotOffset_ = 22;
186  static const uint16_t fecRingOffset_ = 18;
187  static const uint16_t ccuAddrOffset_ = 10;
188  static const uint16_t ccuChanOffset_ = 5;
189  static const uint16_t lldChanOffset_ = 2;
190  static const uint16_t i2cAddrOffset_ = 0;
191 
192  // Definition of bit field masks for 32-bit key
193  static const uint16_t fecCrateMask_ = 0x07; // (3 bits)
194  static const uint16_t fecSlotMask_ = 0x1F; // (5 bits)
195  static const uint16_t fecRingMask_ = 0x0F; // (4 bits)
196  static const uint16_t ccuAddrMask_ = 0xFF; // (8 bits)
197  static const uint16_t ccuChanMask_ = 0x1F; // (5 bits)
198  static const uint16_t lldChanMask_ = 0x07; // (3 bits)
199  static const uint16_t i2cAddrMask_ = 0x03; // (2 bits)
200 
201 };
202 
203 // ---------- Inline methods ----------
204 
205 const uint16_t& SiStripFecKey::fecCrate() const { return fecCrate_; }
206 const uint16_t& SiStripFecKey::fecSlot() const { return fecSlot_; }
207 const uint16_t& SiStripFecKey::fecRing() const { return fecRing_; }
208 const uint16_t& SiStripFecKey::ccuAddr() const { return ccuAddr_; }
209 const uint16_t& SiStripFecKey::ccuChan() const { return ccuChan_; }
210 const uint16_t& SiStripFecKey::lldChan() const { return lldChan_; }
211 const uint16_t& SiStripFecKey::i2cAddr() const { return i2cAddr_; }
212 
213 /* const uint16_t& SiStripFecKey::fecCrate() const { */
214 /* return ( key()>>fecCrateOffset_ ) & fecCrateMask_ != fecCrateMask_ ? ( key()>>fecCrateOffset_ ) & fecCrateMask_ : sistrip::invalid_; */
215 /* } */
216 /* const uint16_t& SiStripFecKey::fecSlot() const { */
217 /* return ( key()>>fecSlotOffset_ ) & fecSlotMask_ != fecSlotMask_ ? ( key()>>fecSlotOffset_ ) & fecSlotMask_ : sistrip::invalid_; */
218 /* } */
219 /* const uint16_t& SiStripFecKey::fecRing() const { */
220 /* return ( key()>>fecRingOffset_ ) & fecRingMask_ != fecRingMask_ ? ( key()>>fecRingOffset_ ) & fecRingMask_ : sistrip::invalid_; */
221 /* } */
222 /* const uint16_t& SiStripFecKey::ccuAddr() const { */
223 /* return ( key()>>ccuAddrOffset_ ) & ccuAddrMask_ != ccuAddrMask_ ? ( key()>>ccuAddrOffset_ ) & ccuAddrMask_ : sistrip::invalid_; */
224 /* } */
225 /* const uint16_t& SiStripFecKey::ccuChan() const { */
226 /* return ( key()>>ccuChanOffset_ ) & ccuChanMask_ != ccuChanMask_ ? ( key()>>ccuChanOffset_ ) & ccuChanMask_ : sistrip::invalid_; */
227 /* } */
228 /* const uint16_t& SiStripFecKey::lldChan() const { */
229 /* return ( key()>>lldChanOffset_ ) & lldChanMask_ != lldChanMask_ ? ( key()>>lldChanOffset_ ) & lldChanMask_ : sistrip::invalid_; */
230 /* } */
231 /* const uint16_t& SiStripFecKey::i2cAddr() const { */
232 /* return ( key()>>i2cAddrOffset_ ) & i2cAddrMask_ != i2cAddrMask_ ? ( key()>>i2cAddrOffset_ ) & i2cAddrMask_ : sistrip::invalid_; */
233 /* } */
234 
235 std::ostream& operator<< ( std::ostream&, const SiStripFecKey& );
236 
237 inline bool operator< ( const SiStripFecKey& a, const SiStripFecKey& b ) { return ( a.key() < b.key() ); }
238 
240  public:
241  explicit ConsistentWithKey( const SiStripFecKey& key );
242  bool operator() ( const uint32_t&, const uint32_t& ) const;
243  private:
244  explicit ConsistentWithKey();
246 };
247 
248 #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
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
const uint16_t & i2cAddr() const
static const uint16_t fecCrateMask_
const uint32_t & key() const
Definition: SiStripKey.h:126
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:46
static bool firstApvOfPair(const uint16_t &i2c_addr)
static const uint16_t lldChanOffset_
static uint16_t hybridPos(const uint16_t &i2c_addr)
bool operator<(const FedChannelConnection &, const FedChannelConnection &)
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:24
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
bool operator()(const uint32_t &, const uint32_t &) const
static const uint16_t ccuAddrMask_
SiStripFecKey mask_
list key
Definition: combine.py:13
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