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