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 
63 
66 
68  SiStripFecKey(const SiStripKey&);
69 
72 
74  SiStripFecKey();
75 
77  SiStripFecKey& operator=(const SiStripFecKey&) = default;
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, const bool& first_apv_of_pair);
118 
119  // ---------- Utility methods ----------
120 
122  bool isEqual(const SiStripKey&) const override;
123 
125  bool isConsistent(const SiStripKey&) const override;
126 
128  bool isValid() const override;
129 
132  bool isValid(const sistrip::Granularity&) const override;
133 
135  bool isInvalid() const override;
136 
139  bool isInvalid(const sistrip::Granularity&) const override;
140 
141  // ---------- Print methods ----------
142 
144  void print(std::stringstream& ss) const override;
145 
147  void terse(std::stringstream& ss) const override;
148 
149 private:
150  // ---------- Private methods ----------
151 
152  void initFromValue() override;
153  void initFromKey() override;
154  void initFromPath() override;
155  void initGranularity() override;
156 
157  // ---------- Private member data ----------
158 
160  uint16_t fecCrate_;
161 
163  uint16_t fecSlot_;
164 
166  uint16_t fecRing_;
167 
169  uint16_t ccuAddr_;
170 
172  uint16_t ccuChan_;
173 
175  uint16_t lldChan_;
176 
178  uint16_t i2cAddr_;
179 
180  // Definition of bit field positions for 32-bit key
181  static const uint16_t fecCrateOffset_ = 27;
182  static const uint16_t fecSlotOffset_ = 22;
183  static const uint16_t fecRingOffset_ = 18;
184  static const uint16_t ccuAddrOffset_ = 10;
185  static const uint16_t ccuChanOffset_ = 5;
186  static const uint16_t lldChanOffset_ = 2;
187  static const uint16_t i2cAddrOffset_ = 0;
188 
189  // Definition of bit field masks for 32-bit key
190  static const uint16_t fecCrateMask_ = 0x07; // (3 bits)
191  static const uint16_t fecSlotMask_ = 0x1F; // (5 bits)
192  static const uint16_t fecRingMask_ = 0x0F; // (4 bits)
193  static const uint16_t ccuAddrMask_ = 0xFF; // (8 bits)
194  static const uint16_t ccuChanMask_ = 0x1F; // (5 bits)
195  static const uint16_t lldChanMask_ = 0x07; // (3 bits)
196  static const uint16_t i2cAddrMask_ = 0x03; // (2 bits)
197 };
198 
199 // ---------- Inline methods ----------
200 
201 const uint16_t& SiStripFecKey::fecCrate() const { return fecCrate_; }
202 const uint16_t& SiStripFecKey::fecSlot() const { return fecSlot_; }
203 const uint16_t& SiStripFecKey::fecRing() const { return fecRing_; }
204 const uint16_t& SiStripFecKey::ccuAddr() const { return ccuAddr_; }
205 const uint16_t& SiStripFecKey::ccuChan() const { return ccuChan_; }
206 const uint16_t& SiStripFecKey::lldChan() const { return lldChan_; }
207 const uint16_t& SiStripFecKey::i2cAddr() const { return i2cAddr_; }
208 
209 /* const uint16_t& SiStripFecKey::fecCrate() const { */
210 /* return ( key()>>fecCrateOffset_ ) & fecCrateMask_ != fecCrateMask_ ? ( key()>>fecCrateOffset_ ) & fecCrateMask_ : sistrip::invalid_; */
211 /* } */
212 /* const uint16_t& SiStripFecKey::fecSlot() const { */
213 /* return ( key()>>fecSlotOffset_ ) & fecSlotMask_ != fecSlotMask_ ? ( key()>>fecSlotOffset_ ) & fecSlotMask_ : sistrip::invalid_; */
214 /* } */
215 /* const uint16_t& SiStripFecKey::fecRing() const { */
216 /* return ( key()>>fecRingOffset_ ) & fecRingMask_ != fecRingMask_ ? ( key()>>fecRingOffset_ ) & fecRingMask_ : sistrip::invalid_; */
217 /* } */
218 /* const uint16_t& SiStripFecKey::ccuAddr() const { */
219 /* return ( key()>>ccuAddrOffset_ ) & ccuAddrMask_ != ccuAddrMask_ ? ( key()>>ccuAddrOffset_ ) & ccuAddrMask_ : sistrip::invalid_; */
220 /* } */
221 /* const uint16_t& SiStripFecKey::ccuChan() const { */
222 /* return ( key()>>ccuChanOffset_ ) & ccuChanMask_ != ccuChanMask_ ? ( key()>>ccuChanOffset_ ) & ccuChanMask_ : sistrip::invalid_; */
223 /* } */
224 /* const uint16_t& SiStripFecKey::lldChan() const { */
225 /* return ( key()>>lldChanOffset_ ) & lldChanMask_ != lldChanMask_ ? ( key()>>lldChanOffset_ ) & lldChanMask_ : sistrip::invalid_; */
226 /* } */
227 /* const uint16_t& SiStripFecKey::i2cAddr() const { */
228 /* return ( key()>>i2cAddrOffset_ ) & i2cAddrMask_ != i2cAddrMask_ ? ( key()>>i2cAddrOffset_ ) & i2cAddrMask_ : sistrip::invalid_; */
229 /* } */
230 
231 std::ostream& operator<<(std::ostream&, const SiStripFecKey&);
232 
233 inline bool operator<(const SiStripFecKey& a, const SiStripFecKey& b) { return (a.key() < b.key()); }
234 
236 public:
237  explicit ConsistentWithKey(const SiStripFecKey& key);
238  bool operator()(const uint32_t&, const uint32_t&) const;
239 
240 private:
241  explicit ConsistentWithKey();
243 };
244 
245 #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 & ccuAddr() const
uint16_t fecSlot_
uint16_t ccuChan_
void initGranularity() override
static const uint16_t fecSlotMask_
uint16_t lldChan_
static const uint16_t fecRingOffset_
const uint16_t & ccuChan() const
uint16_t fecCrate_
bool isConsistent(const SiStripKey &) const override
uint16_t fecRing_
bool isEqual(const SiStripKey &) const override
const uint16_t & lldChan() const
static const uint16_t fecCrateMask_
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_
bool operator()(const uint32_t &, const uint32_t &) const
void print(std::stringstream &ss) const override
void initFromPath() override
static uint16_t hybridPos(const uint16_t &i2c_addr)
Constants and enumerated type for sistrip::Granularity.
const uint16_t & i2cAddr() const
void terse(std::stringstream &ss) const override
Base utility class that identifies a position within a logical structure of the strip tracker...
Definition: SiStripKey.h:23
key
prepare the HTCondor submission files and eventually submit them
SiStripFecKey & operator=(const SiStripFecKey &)=default
static const uint16_t lldChanMask_
bool isInvalid() const override
bool isValid() const override
static const uint16_t fecSlotOffset_
uint16_t i2cAddr_
double b
Definition: hdecay.h:120
std::ostream & operator<<(std::ostream &, const SiStripFecKey &)
static const uint16_t ccuAddrMask_
const uint16_t & fecSlot() const
bool operator<(const SiStripFecKey &a, const SiStripFecKey &b)
SiStripFecKey mask_
void initFromValue() override
double a
Definition: hdecay.h:121
void initFromKey() override
static const uint16_t i2cAddrMask_
static const uint16_t fecRingMask_
static const uint16_t fecCrateOffset_
const uint16_t & fecRing() const
const uint16_t & fecCrate() const
static const uint16_t ccuAddrOffset_