CMS 3D CMS Logo

SiStripModule.h
Go to the documentation of this file.
1 
2 #ifndef CalibFormats_SiStripObjects_SiStripModule_H
3 #define CalibFormats_SiStripObjects_SiStripModule_H
4 
7 #include <boost/cstdint.hpp>
8 #include <map>
9 #include <ostream>
10 #include <sstream>
11 #include <vector>
12 
13 class SiStripModule;
14 
16 std::ostream &operator<<(std::ostream &, const SiStripModule &);
17 
25 public:
26  // ---------- Constructors and adding devices ----------
27 
30 
33 
35  void addDevices(const FedChannelConnection &conn);
36 
37  // ---------- Typedefs and enums ----------
38 
40  typedef std::pair<uint16_t, uint16_t> PairOfU16;
41 
43  // typedef PairOfU16 FedChannel;
44  class FedChannel {
45  public:
46  uint16_t fedCrate_;
47  uint16_t fedSlot_;
48  uint16_t fedId_;
49  uint16_t fedCh_;
50  FedChannel(const uint16_t &crate, const uint16_t &slot, const uint16_t &id, const uint16_t &ch)
51  : fedCrate_(crate), fedSlot_(slot), fedId_(id), fedCh_(ch) {
52  ;
53  }
54  FedChannel() : fedCrate_(0), fedSlot_(0), fedId_(0), fedCh_(0) { ; }
55  };
56 
58  typedef std::map<uint16_t, FedChannel> FedCabling;
59 
60  // ---------- Control structure ----------
61 
62  inline const uint16_t &fecCrate() const;
63  inline const uint16_t &fecSlot() const;
64  inline const uint16_t &fecRing() const;
65  inline const uint16_t &ccuAddr() const;
66  inline const uint16_t &ccuChan() const;
67 
70  inline const SiStripFecKey &key() const;
71 
72  // ---------- APV devices ----------
73 
75  std::vector<uint16_t> activeApvs() const;
76 
80  const uint16_t &activeApv(const uint16_t &apv_address) const;
81 
84  PairOfU16 activeApvPair(const uint16_t &lld_channel) const;
85 
87  void addApv(const uint16_t &apv_address);
88 
89  // ---------- Other hybrid devices ----------
90 
92  inline const uint16_t &dcu() const;
93 
95  inline const uint16_t &mux() const;
96 
98  inline const uint16_t &pll() const;
99 
101  inline const uint16_t &lld() const;
102 
103  // ---------- Module information ----------
104 
106  inline const uint32_t &dcuId() const;
107 
109  uint16_t lldChannel(const uint16_t &apv_pair_num) const;
110 
112  inline void dcuId(const uint32_t &dcu_id);
113 
114  // ---------- Detector information ----------
115 
117  inline const uint32_t &detId() const;
118 
120  uint16_t apvPairNumber(const uint16_t &lld_channel) const;
121 
123  inline const uint16_t &nApvPairs() const;
124 
126  inline uint16_t nDetStrips() const;
127 
129  inline void detId(const uint32_t &det_id);
130 
132  void nApvPairs(const uint16_t &npairs);
133 
134  // ---------- FED connection information ----------
135 
137  inline const FedCabling &fedChannels() const;
138 
140  FedChannel fedCh(const uint16_t &apv_pair_num) const;
141 
144  bool fedCh(const uint16_t &apv_address, const FedChannel &fed_ch);
145 
146  // ---------- Miscellaneous ----------
147 
149  void print(std::stringstream &) const;
150 
152  void terse(std::stringstream &) const;
153 
155  inline const uint16_t &length() const;
156 
158  inline void length(const uint16_t &length);
159 
160 private:
163 
164  // APVs found (identified by decimal I2C address)
165  uint16_t apv32_;
166  uint16_t apv33_;
167  uint16_t apv34_;
168  uint16_t apv35_;
169  uint16_t apv36_;
170  uint16_t apv37_;
171 
172  // Devices found (with hex addr)
173  uint16_t dcu0x00_;
174  uint16_t mux0x43_;
175  uint16_t pll0x44_;
176  uint16_t lld0x60_;
177 
178  // Detector
179  uint32_t dcuId_;
180  uint32_t detId_;
181  uint16_t nApvPairs_;
182 
184  FedCabling cabling_;
185  uint16_t length_;
186 };
187 
188 // --------------- inline methods ---------------
189 
190 const uint16_t &SiStripModule::fecCrate() const { return key_.fecCrate(); }
191 const uint16_t &SiStripModule::fecSlot() const { return key_.fecSlot(); }
192 const uint16_t &SiStripModule::fecRing() const { return key_.fecRing(); }
193 const uint16_t &SiStripModule::ccuAddr() const { return key_.ccuAddr(); }
194 const uint16_t &SiStripModule::ccuChan() const { return key_.ccuChan(); }
195 
196 const SiStripFecKey &SiStripModule::key() const { return key_; }
197 
198 const uint32_t &SiStripModule::dcuId() const { return dcuId_; }
199 const uint32_t &SiStripModule::detId() const { return detId_; }
200 const uint16_t &SiStripModule::nApvPairs() const { return nApvPairs_; }
201 uint16_t SiStripModule::nDetStrips() const { return 256 * nApvPairs_; }
202 
203 void SiStripModule::dcuId(const uint32_t &dcu_id) {
204  if (dcu_id) {
205  dcuId_ = dcu_id;
206  dcu0x00_ = true;
207  }
208 }
209 void SiStripModule::detId(const uint32_t &det_id) {
210  if (det_id) {
211  detId_ = det_id;
212  }
213 }
215 
216 const uint16_t &SiStripModule::length() const { return length_; }
217 void SiStripModule::length(const uint16_t &length) { length_ = length; }
218 
219 const uint16_t &SiStripModule::dcu() const { return dcu0x00_; }
220 const uint16_t &SiStripModule::mux() const { return mux0x43_; }
221 const uint16_t &SiStripModule::pll() const { return pll0x44_; }
222 const uint16_t &SiStripModule::lld() const { return lld0x60_; }
223 
224 #endif // CalibTracker_SiStripObjects_SiStripModule_H
Device and connection information at the level of a front-end module.
Definition: SiStripModule.h:24
uint16_t apv35_
void terse(std::stringstream &) const
uint16_t pll0x44_
std::vector< uint16_t > activeApvs() const
SiStripFecKey key_
const uint16_t & fecRing() const
uint32_t dcuId_
void print(std::stringstream &) const
const SiStripFecKey & key() const
uint16_t apv37_
void addDevices(const FedChannelConnection &conn)
const uint16_t & fecSlot() const
uint16_t apv33_
std::map< uint16_t, FedChannel > FedCabling
Definition: SiStripModule.h:58
const FedCabling & fedChannels() const
uint16_t apvPairNumber(const uint16_t &lld_channel) const
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
const uint16_t & length() const
const uint16_t & pll() const
Class containning control, module, detector and connection information, at the level of a FED channel...
uint16_t apv32_
uint16_t mux0x43_
const uint16_t & dcu() const
uint16_t nDetStrips() const
uint16_t lldChannel(const uint16_t &apv_pair_num) const
const uint16_t & ccuChan() const
uint32_t detId_
void addApv(const uint16_t &apv_address)
const uint16_t & fecSlot() const
const uint16_t & fecRing() const
const uint16_t & fecCrate() const
PairOfU16 activeApvPair(const uint16_t &lld_channel) const
const uint16_t & nApvPairs() const
const uint16_t & fecCrate() const
const uint32_t & dcuId() const
const uint16_t & mux() const
const uint16_t & ccuAddr() const
const uint32_t & detId() const
FedCabling cabling_
const uint16_t & lld() const
uint16_t lld0x60_
uint16_t length_
FedChannel fedCh(const uint16_t &apv_pair_num) const
const uint16_t & ccuChan() const
uint16_t apv34_
uint16_t nApvPairs_
const uint16_t & ccuAddr() const
std::ostream & operator<<(std::ostream &, const SiStripModule &)
std::pair< uint16_t, uint16_t > PairOfU16
Definition: SiStripModule.h:40
FedChannel(const uint16_t &crate, const uint16_t &slot, const uint16_t &id, const uint16_t &ch)
Definition: SiStripModule.h:50
const uint16_t & activeApv(const uint16_t &apv_address) const
SiStripModule(const FedChannelConnection &conn)
uint16_t apv36_
uint16_t dcu0x00_