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
sistrip::Granularity
Granularity
Definition: ConstantsForGranularity.h:60
SiStripFecKey::i2cAddr_
uint16_t i2cAddr_
Definition: SiStripFecKey.h:175
ConsistentWithKey::ConsistentWithKey
ConsistentWithKey()
Definition: SiStripFecKey.cc:769
SiStripFecKey::initGranularity
void initGranularity() override
Definition: SiStripFecKey.cc:653
SiStripFecKey::fecSlotMask_
static const uint16_t fecSlotMask_
Definition: SiStripFecKey.h:188
SiStripKey.h
SiStripFecKey::lldChanOffset_
static const uint16_t lldChanOffset_
Definition: SiStripFecKey.h:183
SiStripFecKey::ccuAddrOffset_
static const uint16_t ccuAddrOffset_
Definition: SiStripFecKey.h:181
SiStripFecKey::print
void print(std::stringstream &ss) const override
Definition: SiStripFecKey.cc:729
SiStripFecKey::initFromValue
void initFromValue() override
Definition: SiStripFecKey.cc:346
SiStripFecKey::lldChan
const uint16_t & lldChan() const
Definition: SiStripFecKey.h:203
ConsistentWithKey::operator()
bool operator()(const uint32_t &, const uint32_t &) const
Definition: SiStripFecKey.cc:773
SiStripFecKey::fecCrate
const uint16_t & fecCrate() const
Definition: SiStripFecKey.h:198
SiStripFecKey::ccuAddrMask_
static const uint16_t ccuAddrMask_
Definition: SiStripFecKey.h:190
ConstantsForGranularity.h
Constants and enumerated type for sistrip::Granularity.
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
SiStripFecKey::ccuChanOffset_
static const uint16_t ccuChanOffset_
Definition: SiStripFecKey.h:182
SiStripFecKey::fecRingMask_
static const uint16_t fecRingMask_
Definition: SiStripFecKey.h:189
SiStripFecKey::terse
void terse(std::stringstream &ss) const override
Definition: SiStripFecKey.cc:709
SiStripFecKey::fecCrateOffset_
static const uint16_t fecCrateOffset_
Definition: SiStripFecKey.h:178
SiStripFecKey::fecRing
const uint16_t & fecRing() const
Definition: SiStripFecKey.h:200
SiStripFecKey::fecSlot_
uint16_t fecSlot_
Definition: SiStripFecKey.h:160
b
double b
Definition: hdecay.h:118
SiStripFecKey
Utility class that identifies a position within the strip tracker control structure,...
Definition: SiStripFecKey.h:45
SiStripFecKey::ccuChan
const uint16_t & ccuChan() const
Definition: SiStripFecKey.h:202
ConsistentWithKey::mask_
SiStripFecKey mask_
Definition: SiStripFecKey.h:239
a
double a
Definition: hdecay.h:119
SiStripFecKey::fecRing_
uint16_t fecRing_
Definition: SiStripFecKey.h:163
SiStripFecKey::SiStripFecKey
SiStripFecKey()
Definition: SiStripFecKey.cc:155
SiStripFecKey::isEqual
bool isEqual(const SiStripKey &) const override
Definition: SiStripFecKey.cc:216
SiStripFecKey::fecCrateMask_
static const uint16_t fecCrateMask_
Definition: SiStripFecKey.h:187
SiStripFecKey::ccuChan_
uint16_t ccuChan_
Definition: SiStripFecKey.h:169
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripFecKey::ccuAddr_
uint16_t ccuAddr_
Definition: SiStripFecKey.h:166
SiStripFecKey::isConsistent
bool isConsistent(const SiStripKey &) const override
Definition: SiStripFecKey.cc:229
SiStripFecKey::i2cAddrMask_
static const uint16_t i2cAddrMask_
Definition: SiStripFecKey.h:193
SiStripFecKey::hybridPos
static uint16_t hybridPos(const uint16_t &i2c_addr)
Definition: SiStripFecKey.cc:169
operator<
bool operator<(const SiStripFecKey &a, const SiStripFecKey &b)
Definition: SiStripFecKey.h:230
SiStripFecKey::i2cAddr
const uint16_t & i2cAddr() const
Definition: SiStripFecKey.h:204
SiStripFecKey::ccuChanMask_
static const uint16_t ccuChanMask_
Definition: SiStripFecKey.h:191
SiStripFecKey::ccuAddr
const uint16_t & ccuAddr() const
Definition: SiStripFecKey.h:201
SiStripFecKey::fecSlotOffset_
static const uint16_t fecSlotOffset_
Definition: SiStripFecKey.h:179
SiStripFecKey::lldChan_
uint16_t lldChan_
Definition: SiStripFecKey.h:172
SiStripFecKey::fecRingOffset_
static const uint16_t fecRingOffset_
Definition: SiStripFecKey.h:180
SiStripFecKey::fecCrate_
uint16_t fecCrate_
Definition: SiStripFecKey.h:157
SiStripFecKey::firstApvOfPair
static bool firstApvOfPair(const uint16_t &i2c_addr)
Definition: SiStripFecKey.cc:207
SiStripFecKey::initFromPath
void initFromPath() override
Definition: SiStripFecKey.cc:505
operator<<
std::ostream & operator<<(std::ostream &, const SiStripFecKey &)
Definition: SiStripFecKey.cc:747
ConsistentWithKey
Definition: SiStripFecKey.h:232
SiStripFecKey::fecSlot
const uint16_t & fecSlot() const
Definition: SiStripFecKey.h:199
crabWrapper.key
key
Definition: crabWrapper.py:19
SiStripKey
Base utility class that identifies a position within a logical structure of the strip tracker.
Definition: SiStripKey.h:23
SiStripFecKey::i2cAddrOffset_
static const uint16_t i2cAddrOffset_
Definition: SiStripFecKey.h:184
SiStripFecKey::lldChanMask_
static const uint16_t lldChanMask_
Definition: SiStripFecKey.h:192
SiStripFecKey::initFromKey
void initFromKey() override
Definition: SiStripFecKey.cc:390
SiStripFecKey::isInvalid
bool isInvalid() const override
Definition: SiStripFecKey.cc:295
SiStripFecKey::isValid
bool isValid() const override
Definition: SiStripFecKey.cc:244