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 <map>
8 #include <ostream>
9 #include <sstream>
10 #include <vector>
11 #include <cstdint>
12 
13 class SiStripModule;
14 
16 std::ostream &operator<<(std::ostream &, const SiStripModule &);
17 
25 public:
26  // ---------- Constructors and adding devices ----------
27 
30 
33 
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 
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
SiStripModule::ccuAddr
const uint16_t & ccuAddr() const
Definition: SiStripModule.h:193
SiStripModule::SiStripModule
SiStripModule(const FedChannelConnection &conn)
Definition: SiStripModule.cc:12
SiStripModule::key_
SiStripFecKey key_
Definition: SiStripModule.h:162
SiStripModule::PairOfU16
std::pair< uint16_t, uint16_t > PairOfU16
Definition: SiStripModule.h:40
SiStripModule::FedChannel::fedId_
uint16_t fedId_
Definition: SiStripModule.h:48
SiStripModule::dcu0x00_
uint16_t dcu0x00_
Definition: SiStripModule.h:173
SiStripModule::apv35_
uint16_t apv35_
Definition: SiStripModule.h:168
SiStripModule::cabling_
FedCabling cabling_
Definition: SiStripModule.h:184
SiStripModule::activeApvs
std::vector< uint16_t > activeApvs() const
Definition: SiStripModule.cc:104
SiStripModule::apv36_
uint16_t apv36_
Definition: SiStripModule.h:169
SiStripModule::pll
const uint16_t & pll() const
Definition: SiStripModule.h:221
SiStripModule::fecRing
const uint16_t & fecRing() const
Definition: SiStripModule.h:192
SiStripModule::apv37_
uint16_t apv37_
Definition: SiStripModule.h:170
SiStripModule::fecSlot
const uint16_t & fecSlot() const
Definition: SiStripModule.h:191
SiStripModule::ccuChan
const uint16_t & ccuChan() const
Definition: SiStripModule.h:194
SiStripModule
Device and connection information at the level of a front-end module.
Definition: SiStripModule.h:24
SiStripCommissioningClient_cfg.conn
conn
Definition: SiStripCommissioningClient_cfg.py:5
SiStripModule::pll0x44_
uint16_t pll0x44_
Definition: SiStripModule.h:175
SiStripModule::mux
const uint16_t & mux() const
Definition: SiStripModule.h:220
SiStripFecKey::fecCrate
const uint16_t & fecCrate() const
Definition: SiStripFecKey.h:198
SiStripModule::terse
void terse(std::stringstream &) const
Definition: SiStripModule.cc:402
SiStripModule::FedChannel::fedSlot_
uint16_t fedSlot_
Definition: SiStripModule.h:47
SiStripModule::addDevices
void addDevices(const FedChannelConnection &conn)
Definition: SiStripModule.cc:34
SiStripModule::FedCabling
std::map< uint16_t, FedChannel > FedCabling
Definition: SiStripModule.h:58
SiStripModule::nApvPairs
const uint16_t & nApvPairs() const
Definition: SiStripModule.h:200
SiStripFecKey::fecRing
const uint16_t & fecRing() const
Definition: SiStripFecKey.h:200
SiStripModule::apv33_
uint16_t apv33_
Definition: SiStripModule.h:166
SiStripModule::fedChannels
const FedCabling & fedChannels() const
Definition: SiStripModule.h:214
SiStripFecKey
Utility class that identifies a position within the strip tracker control structure,...
Definition: SiStripFecKey.h:45
SiStripModule::~SiStripModule
~SiStripModule()
Definition: SiStripModule.h:32
SiStripFecKey.h
SiStripModule::FedChannel::fedCh_
uint16_t fedCh_
Definition: SiStripModule.h:49
SiStripFecKey::ccuChan
const uint16_t & ccuChan() const
Definition: SiStripFecKey.h:202
FedChannelConnection
Class containning control, module, detector and connection information, at the level of a FED channel...
Definition: FedChannelConnection.h:26
SiStripModule::fecCrate
const uint16_t & fecCrate() const
Definition: SiStripModule.h:190
SiStripModule::lld
const uint16_t & lld() const
Definition: SiStripModule.h:222
SiStripModule::apv32_
uint16_t apv32_
Definition: SiStripModule.h:165
SiStripModule::key
const SiStripFecKey & key() const
Definition: SiStripModule.h:196
SiStripModule::dcu
const uint16_t & dcu() const
Definition: SiStripModule.h:219
SiStripModule::FedChannel
Definition: SiStripModule.h:44
SiStripModule::detId
const uint32_t & detId() const
Definition: SiStripModule.h:199
SiStripModule::mux0x43_
uint16_t mux0x43_
Definition: SiStripModule.h:174
SiStripModule::fedCh
FedChannel fedCh(const uint16_t &apv_pair_num) const
Definition: SiStripModule.cc:288
SiStripModule::addApv
void addApv(const uint16_t &apv_address)
Definition: SiStripModule.cc:152
SiStripModule::detId_
uint32_t detId_
Definition: SiStripModule.h:180
SiStripModule::FedChannel::FedChannel
FedChannel()
Definition: SiStripModule.h:54
SiStripModule::lldChannel
uint16_t lldChannel(const uint16_t &apv_pair_num) const
Definition: SiStripModule.cc:238
SiStripModule::activeApvPair
PairOfU16 activeApvPair(const uint16_t &lld_channel) const
Definition: SiStripModule.cc:222
SiStripModule::nApvPairs_
uint16_t nApvPairs_
Definition: SiStripModule.h:181
SiStripModule::print
void print(std::stringstream &) const
Definition: SiStripModule.cc:367
FedChannelConnection.h
SiStripModule::length
const uint16_t & length() const
Definition: SiStripModule.h:216
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
SiStripFecKey::ccuAddr
const uint16_t & ccuAddr() const
Definition: SiStripFecKey.h:201
operator<<
std::ostream & operator<<(std::ostream &, const SiStripModule &)
Definition: SiStripModule.cc:437
SiStripModule::FedChannel::FedChannel
FedChannel(const uint16_t &crate, const uint16_t &slot, const uint16_t &id, const uint16_t &ch)
Definition: SiStripModule.h:50
SiStripModule::apvPairNumber
uint16_t apvPairNumber(const uint16_t &lld_channel) const
Definition: SiStripModule.cc:263
SiStripFecKey::fecSlot
const uint16_t & fecSlot() const
Definition: SiStripFecKey.h:199
SiStripModule::nDetStrips
uint16_t nDetStrips() const
Definition: SiStripModule.h:201
SiStripModule::activeApv
const uint16_t & activeApv(const uint16_t &apv_address) const
Definition: SiStripModule.cc:129
SiStripModule::FedChannel::fedCrate_
uint16_t fedCrate_
Definition: SiStripModule.h:46
SiStripModule::lld0x60_
uint16_t lld0x60_
Definition: SiStripModule.h:176
SiStripModule::length_
uint16_t length_
Definition: SiStripModule.h:185
SiStripModule::apv34_
uint16_t apv34_
Definition: SiStripModule.h:167
SiStripModule::dcuId_
uint32_t dcuId_
Definition: SiStripModule.h:179
SiStripModule::dcuId
const uint32_t & dcuId() const
Definition: SiStripModule.h:198