9 using namespace sistrip;
14 : key_( conn.fecCrate(),
44 <<
"SiStripModule::" << __func__ <<
"]"
45 <<
" Unexpected FEC crate ("
46 << conn.
fecCrate() <<
") for this module ("
53 <<
"SiStripModule::" << __func__ <<
"]"
54 <<
" Unexpected FEC slot ("
55 << conn.
fecSlot() <<
") for this module ("
62 <<
"SiStripModule::" << __func__ <<
"]"
63 <<
" Unexpected FEC ring ("
64 << conn.
fecRing() <<
") for this module ("
71 <<
"SiStripModule::" << __func__ <<
"]"
72 <<
" Unexpected CCU addr ("
73 << conn.
ccuAddr() <<
") for this module ("
80 <<
"SiStripModule::" << __func__ <<
"]"
81 <<
" Unexpected CCU chan ("
82 << conn.
ccuChan() <<
") for this module ("
114 std::vector<uint16_t> apvs;
127 if ( apv_address == 0 || apv_address == 32 ) {
return apv32_; }
128 else if ( apv_address == 1 || apv_address == 33 ) {
return apv33_; }
129 else if ( apv_address == 2 || apv_address == 34 ) {
return apv34_; }
130 else if ( apv_address == 3 || apv_address == 35 ) {
return apv35_; }
131 else if ( apv_address == 4 || apv_address == 36 ) {
return apv36_; }
132 else if ( apv_address == 5 || apv_address == 37 ) {
return apv37_; }
135 <<
"SiStripModule::" << __func__ <<
"]"
136 <<
" Unexpected I2C address or number ("
137 << apv_address <<
") for this module!";
139 static const uint16_t
address = 0;
148 if ( apv_address == 0 ) {
150 <<
"SiStripModule::" << __func__ <<
"]"
151 <<
" Null APV I2C address!";
153 }
else if ( apv_address < 32 && apv_address > 37 ) {
155 <<
"SiStripModule::" << __func__ <<
"]"
156 <<
" Unexpected I2C address ("
157 << apv_address <<
") for APV!";
161 bool added_apv =
false;
162 if ( !
apv32_ && apv_address == 32 ) {
apv32_ = 32; added_apv =
true; }
163 else if ( !
apv33_ && apv_address == 33 ) {
apv33_ = 33; added_apv =
true; }
164 else if ( !
apv34_ && apv_address == 34 ) {
apv34_ = 34; added_apv =
true; }
165 else if ( !
apv35_ && apv_address == 35 ) {
apv35_ = 35; added_apv =
true; }
166 else if ( !
apv36_ && apv_address == 36 ) {
apv36_ = 36; added_apv =
true; }
167 else if ( !
apv37_ && apv_address == 37 ) {
apv37_ = 37; added_apv =
true; }
169 std::stringstream ss;
170 ss <<
"SiStripModule::" << __func__ <<
"]";
171 if ( added_apv ) { ss <<
" Added new APV for"; }
172 else { ss <<
" APV already exists for"; }
173 ss <<
" Crate/FEC/Ring/CCU/Module: "
188 if ( npairs == 2 || npairs == 3 ) {
nApvPairs_ = npairs; }
189 else if ( npairs == 0 ) {
196 <<
"SiStripModule::" << __func__ <<
"]"
197 <<
" Unexpected number of APV pairs: "
210 <<
"SiStripModule::" << __func__ <<
"]"
211 <<
" Unexpected LLD channel: " << lld_channel;
219 if ( apv_pair_num > 2 ) {
221 <<
"SiStripModule::" << __func__ <<
"]"
222 <<
" Unexpected APV pair number: " << apv_pair_num;
227 <<
"SiStripModule::" << __func__ <<
"]"
228 <<
" Unexpected number of APV pairs: " <<
nApvPairs_;
231 if (
nApvPairs_ == 2 && apv_pair_num == 1 ) {
return 3; }
232 else if (
nApvPairs_ == 2 && apv_pair_num == 2 ) {
234 <<
"[SiStripFecCabling::" << __func__ <<
"]"
235 <<
" APV pair number is incompatible with"
236 <<
" respect to number of !";
238 }
else {
return apv_pair_num + 1; }
244 if ( lld_channel < 1 || lld_channel > 3 ) {
246 <<
"SiStripModule::" << __func__ <<
"]"
247 <<
" Unexpected LLD channel: " << lld_channel;
252 <<
"SiStripModule::" << __func__ <<
"]"
253 <<
" Unexpected number of APV pairs: " <<
nApvPairs_;
256 if (
nApvPairs_ == 2 && lld_channel == 3 ) {
return 1; }
257 else if (
nApvPairs_ == 2 && lld_channel == 2 ) {
259 <<
"SiStripModule::" << __func__ <<
"]"
260 <<
" LLD channel is incompatible with"
261 <<
" respect to number of APV pairs!";
263 }
else {
return lld_channel - 1; }
275 <<
"SiStripModule::" << __func__ <<
"]"
276 <<
" No APV pairs exist!";
284 if ( apv_pair == 0 ) { lld_ch = 1; }
285 else if ( apv_pair == 1 ) { lld_ch = 3; }
288 <<
"SiStripModule::" << __func__ <<
"]"
289 <<
" Unexpected pair number! " << apv_pair;
294 if ( apv_pair == 0 ) { lld_ch = 1; }
295 else if ( apv_pair == 1 ) { lld_ch = 2; }
296 else if ( apv_pair == 2 ) { lld_ch = 3; }
299 <<
"SiStripModule::" << __func__ <<
"]"
300 <<
" Unexpected pair number! " << apv_pair;
306 <<
"SiStripModule::" << __func__ <<
"]"
307 <<
" Unexpected number of APV pairs: " <<
nApvPairs();
311 FedCabling::const_iterator ipair =
cabling_.find( lld_ch );
312 if ( ipair !=
cabling_.end() ) {
return (*ipair).second; }
313 else {
return fed_ch; }
325 if ( apv_address == 32 || apv_address == 33 ) { lld_ch = 1; }
326 else if ( apv_address == 34 || apv_address == 35 ) { lld_ch = 2; }
327 else if ( apv_address == 36 || apv_address == 37 ) { lld_ch = 3; }
328 else if ( apv_address == 0 ) { ; }
331 <<
" Unexpected I2C address ("
332 << apv_address <<
") for APV!";
338 FedCabling::iterator ipair =
cabling_.find( lld_ch );
340 else { ipair->second = fed_ch; }
348 ss <<
" [SiStripModule::" << __func__ <<
"]" << std::endl
349 <<
" Crate/FEC/Ring/CCU/Module : "
356 ss <<
" ActiveApvs : ";
358 if ( apvs.empty() ) { ss <<
"NONE!"; }
359 std::vector<uint16_t>::const_iterator iapv = apvs.begin();
360 for ( ; iapv != apvs.end(); iapv++ ) { ss << *iapv <<
", "; }
363 ss <<
" DcuId/DetId/nPairs : "
365 <<
"0x" << std::setfill(
'0') << std::setw(8) <<
dcuId() <<
"/"
366 <<
"0x" << std::setfill(
'0') << std::setw(8) <<
detId() <<
"/"
371 ss <<
" ApvPairNum/FedCrate/FedSlot/FedId/FedCh : ";
372 FedCabling::const_iterator ichan = channels.begin();
373 for ( ; ichan != channels.end(); ichan++ ) {
374 ss << ichan->first <<
"/"
375 << ichan->second.fedCrate_ <<
"/"
376 << ichan->second.fedSlot_ <<
"/"
377 << ichan->second.fedId_ <<
"/"
378 << ichan->second.fedCh_ <<
", ";
382 ss <<
" DCU/MUX/PLL/LLD found : "
394 ss <<
" [SiStripModule::" << __func__ <<
"]" << std::endl
395 <<
" Crate/FEC/Ring/CCU/Module : "
402 ss <<
" ActiveApvs : ";
404 if ( apvs.empty() ) { ss <<
"NONE!"; }
405 std::vector<uint16_t>::const_iterator iapv = apvs.begin();
406 for ( ; iapv != apvs.end(); iapv++ ) { ss << *iapv <<
", "; }
409 ss <<
" DcuId/DetId/nPairs : "
411 <<
"0x" << std::setfill(
'0') << std::setw(8) <<
dcuId() <<
"/"
412 <<
"0x" << std::setfill(
'0') << std::setw(8) <<
detId() <<
"/"
417 ss <<
" ApvPairNum/FedCrate/FedSlot/FedId/FedCh : ";
418 FedCabling::const_iterator ichan = channels.begin();
419 for ( ; ichan != channels.end(); ichan++ ) {
420 ss << ichan->first <<
"/"
421 << ichan->second.fedCrate_ <<
"/"
422 << ichan->second.fedSlot_ <<
"/"
423 << ichan->second.fedId_ <<
"/"
424 << ichan->second.fedCh_ <<
", ";
428 ss <<
" DCU/MUX/PLL/LLD found : "
439 std::stringstream ss;
const uint16_t & fecSlot() const
Device and connection information at the level of a front-end module.
void terse(std::stringstream &) const
const uint16_t & fecCrate() const
std::vector< uint16_t > activeApvs() const
const uint16_t & fecRing() const
const uint16_t & fedCh() const
void print(std::stringstream &) const
const SiStripFecKey & key() const
void addDevices(const FedChannelConnection &conn)
const uint16_t & fecSlot() const
std::ostream & operator<<(std::ostream &out, const ALILine &li)
const FedCabling & fedChannels() const
const uint16_t & fedId() const
uint16_t apvPairNumber(const uint16_t &lld_channel) const
static const char mlCabling_[]
const uint16_t & fecRing() const
const uint16_t & fedSlot() const
const uint32_t & detId() const
Class containning control, module, detector and connection information, at the level of a FED channel...
const uint16_t & ccuChan() const
uint16_t lldChannel(const uint16_t &apv_pair_num) const
void addApv(const uint16_t &apv_address)
const uint16_t & ccuAddr() const
const uint32_t & dcuId() const
const uint16_t & fecCrate() const
PairOfU16 activeApvPair(const uint16_t &lld_channel) const
const uint16_t & nApvPairs() const
const uint32_t & dcuId() const
const uint16_t & nApvPairs() const
const uint16_t & ccuAddr() const
std::pair< uint16_t, uint16_t > PairOfU16
const uint32_t & detId() const
const uint16_t & fedCrate() const
FedChannel fedCh(const uint16_t &apv_pair_num) const
const uint16_t & ccuChan() const
std::map< uint16_t, FedChannel > FedCabling
const uint16_t & i2cAddr(const uint16_t &apv0_or_1) const
const uint16_t & activeApv(const uint16_t &apv_address) const
SiStripModule(const FedChannelConnection &conn)