CMS 3D CMS Logo

SiStripFedKey.h
Go to the documentation of this file.
1 
2 #ifndef DataFormats_SiStripCommon_SiStripFedKey_H
3 #define DataFormats_SiStripCommon_SiStripFedKey_H
4 
7 
8 class SiStripFedKey;
9 
11 std::ostream& operator<<(std::ostream&, const SiStripFedKey&);
12 
56 class SiStripFedKey : public SiStripKey {
57 public:
58  // ---------- Constructors ----------
59 
61  SiStripFedKey(const uint16_t& fed_id,
62  const uint16_t& fe_unit = 0,
63  const uint16_t& fe_chan = 0,
64  const uint16_t& fed_apv = 0);
65 
67  SiStripFedKey(const uint32_t& fed_key);
68 
71 
74 
76  SiStripFedKey(const SiStripKey&);
77 
79  SiStripFedKey();
80 
82  SiStripFedKey& operator=(const SiStripFedKey&) = default;
83 
84  // ---------- Public interface to member data ----------
85 
87  inline const uint16_t& fedId() const;
88 
90  inline const uint16_t& feUnit() const;
91 
93  inline const uint16_t& feChan() const;
94 
96  inline const uint16_t& fedApv() const;
97 
99  inline uint16_t fedChannel() const;
100 
101  // ---------- Numbering schemes ----------
102 
105  static uint16_t fedCh(const uint16_t& fe_unit, const uint16_t& fe_chan);
106 
109  static uint16_t feUnit(const uint16_t& fed_ch);
110 
113  static uint16_t feChan(const uint16_t& fed_ch);
114 
118  static uint32_t fedIndex(const uint16_t& fed_id, const uint16_t& fed_ch);
119 
120  // ---------- Utility methods ----------
121 
123  bool isEqual(const SiStripKey&) const override;
124 
126  bool isConsistent(const SiStripKey&) const override;
127 
129  bool isValid() const override;
130 
133  bool isValid(const sistrip::Granularity&) const override;
134 
136  bool isInvalid() const override;
137 
140  bool isInvalid(const sistrip::Granularity&) const override;
141 
142  // ---------- Print methods ----------
143 
145  void print(std::stringstream& ss) const override;
146 
148  void terse(std::stringstream& ss) const override;
149 
150 private:
151  // ---------- Private methods ----------
152 
153  void initFromValue() override;
154  void initFromKey() override;
155  void initFromPath() override;
156  void initGranularity() override;
157 
158  // ---------- Private member data ----------
159 
161  uint16_t fedId_;
162 
164  uint16_t feUnit_;
165 
167  uint16_t feChan_;
168 
170  uint16_t fedApv_;
171 
172  // Definition of bit field positions for 32-bit key
173  static const uint16_t fedCrateOffset_ = 24;
174  static const uint16_t fedSlotOffset_ = 19;
175  static const uint16_t fedIdOffset_ = 10;
176  static const uint16_t feUnitOffset_ = 6;
177  static const uint16_t feChanOffset_ = 2;
178  static const uint16_t fedApvOffset_ = 0;
179 
180  // Definition of bit field masks for 32-bit key
181  static const uint16_t fedCrateMask_ = 0x03F; // (6 bits)
182  static const uint16_t fedSlotMask_ = 0x01F; // (5 bits)
183  static const uint16_t fedIdMask_ = 0x1FF; // (9 bits)
184  static const uint16_t feUnitMask_ = 0x00F; // (4 bits)
185  static const uint16_t feChanMask_ = 0x00F; // (4 bits)
186  static const uint16_t fedApvMask_ = 0x003; // (2 bits)
187 };
188 
189 // ---------- Inline methods ----------
190 
191 const uint16_t& SiStripFedKey::fedId() const { return fedId_; }
192 const uint16_t& SiStripFedKey::feUnit() const { return feUnit_; }
193 const uint16_t& SiStripFedKey::feChan() const { return feChan_; }
194 const uint16_t& SiStripFedKey::fedApv() const { return fedApv_; }
195 uint16_t SiStripFedKey::fedChannel() const { return fedCh(feUnit_, feChan_); }
196 
197 #endif // DataFormats_SiStripCommon_SiStripFedKey_H
static const uint16_t feChanMask_
void print(std::stringstream &ss) const override
void initFromValue() override
const uint16_t & fedApv() const
const uint16_t & feChan() const
static const uint16_t feUnitOffset_
void initFromPath() override
const uint16_t & feUnit() const
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
bool isInvalid() const override
void initFromKey() override
static const uint16_t fedSlotMask_
static uint32_t fedIndex(const uint16_t &fed_id, const uint16_t &fed_ch)
void terse(std::stringstream &ss) const override
bool isConsistent(const SiStripKey &) const override
uint16_t fedApv_
uint16_t fedChannel() const
Constants and enumerated type for sistrip::Granularity.
SiStripFedKey & operator=(const SiStripFedKey &)=default
static const uint16_t fedCrateOffset_
bool isEqual(const SiStripKey &) const override
Base utility class that identifies a position within a logical structure of the strip tracker...
Definition: SiStripKey.h:23
static const uint16_t feUnitMask_
uint16_t feChan_
uint16_t fedId_
uint16_t feUnit_
static const uint16_t fedIdOffset_
void initGranularity() override
static const uint16_t feChanOffset_
const uint16_t & fedId() const
static const uint16_t fedCrateMask_
std::ostream & operator<<(std::ostream &, const SiStripFedKey &)
static const uint16_t fedSlotOffset_
static const uint16_t fedApvMask_
static uint16_t fedCh(const uint16_t &fe_unit, const uint16_t &fe_chan)
static const uint16_t fedIdMask_
static const uint16_t fedApvOffset_
bool isValid() const override