8 using namespace sistrip;
13 : key_( conn.fecCrate(),
43 <<
"SiStripModule::" << __func__ <<
"]"
44 <<
" Unexpected FEC crate ("
45 << conn.
fecCrate() <<
") for this module ("
52 <<
"SiStripModule::" << __func__ <<
"]"
53 <<
" Unexpected FEC slot ("
54 << conn.
fecSlot() <<
") for this module ("
61 <<
"SiStripModule::" << __func__ <<
"]"
62 <<
" Unexpected FEC ring ("
63 << conn.
fecRing() <<
") for this module ("
70 <<
"SiStripModule::" << __func__ <<
"]"
71 <<
" Unexpected CCU addr ("
72 << conn.
ccuAddr() <<
") for this module ("
79 <<
"SiStripModule::" << __func__ <<
"]"
80 <<
" Unexpected CCU chan ("
81 << conn.
ccuChan() <<
") for this module ("
113 std::vector<uint16_t> apvs;
126 if ( apv_address == 0 || apv_address == 32 ) {
return apv32_; }
127 else if ( apv_address == 1 || apv_address == 33 ) {
return apv33_; }
128 else if ( apv_address == 2 || apv_address == 34 ) {
return apv34_; }
129 else if ( apv_address == 3 || apv_address == 35 ) {
return apv35_; }
130 else if ( apv_address == 4 || apv_address == 36 ) {
return apv36_; }
131 else if ( apv_address == 5 || apv_address == 37 ) {
return apv37_; }
134 <<
"SiStripModule::" << __func__ <<
"]"
135 <<
" Unexpected I2C address or number ("
136 << apv_address <<
") for this module!";
138 static const uint16_t address = 0;
147 if ( apv_address == 0 ) {
149 <<
"SiStripModule::" << __func__ <<
"]"
150 <<
" Null APV I2C address!";
152 }
else if ( apv_address < 32 && apv_address > 37 ) {
154 <<
"SiStripModule::" << __func__ <<
"]"
155 <<
" Unexpected I2C address ("
156 << apv_address <<
") for APV!";
160 bool added_apv =
false;
161 if ( !
apv32_ && apv_address == 32 ) {
apv32_ = 32; added_apv =
true; }
162 else if ( !
apv33_ && apv_address == 33 ) {
apv33_ = 33; added_apv =
true; }
163 else if ( !
apv34_ && apv_address == 34 ) {
apv34_ = 34; added_apv =
true; }
164 else if ( !
apv35_ && apv_address == 35 ) {
apv35_ = 35; added_apv =
true; }
165 else if ( !
apv36_ && apv_address == 36 ) {
apv36_ = 36; added_apv =
true; }
166 else if ( !
apv37_ && apv_address == 37 ) {
apv37_ = 37; added_apv =
true; }
168 std::stringstream ss;
169 ss <<
"SiStripModule::" << __func__ <<
"]";
170 if ( added_apv ) { ss <<
" Added new APV for"; }
171 else { ss <<
" APV already exists for"; }
172 ss <<
" Crate/FEC/Ring/CCU/Module: "
187 if ( npairs == 2 || npairs == 3 ) {
nApvPairs_ = npairs; }
188 else if ( npairs == 0 ) {
195 <<
"SiStripModule::" << __func__ <<
"]"
196 <<
" Unexpected number of APV pairs: "
209 <<
"SiStripModule::" << __func__ <<
"]"
210 <<
" Unexpected LLD channel: " << lld_channel;
218 if ( apv_pair_num > 2 ) {
220 <<
"SiStripModule::" << __func__ <<
"]"
221 <<
" Unexpected APV pair number: " << apv_pair_num;
226 <<
"SiStripModule::" << __func__ <<
"]"
227 <<
" Unexpected number of APV pairs: " <<
nApvPairs_;
230 if (
nApvPairs_ == 2 && apv_pair_num == 1 ) {
return 3; }
231 else if (
nApvPairs_ == 2 && apv_pair_num == 2 ) {
233 <<
"[SiStripFecCabling::" << __func__ <<
"]"
234 <<
" APV pair number is incompatible with"
235 <<
" respect to number of !";
237 }
else {
return apv_pair_num + 1; }
243 if ( lld_channel < 1 || lld_channel > 3 ) {
245 <<
"SiStripModule::" << __func__ <<
"]"
246 <<
" Unexpected LLD channel: " << lld_channel;
251 <<
"SiStripModule::" << __func__ <<
"]"
252 <<
" Unexpected number of APV pairs: " <<
nApvPairs_;
255 if (
nApvPairs_ == 2 && lld_channel == 3 ) {
return 1; }
256 else if (
nApvPairs_ == 2 && lld_channel == 2 ) {
258 <<
"SiStripModule::" << __func__ <<
"]"
259 <<
" LLD channel is incompatible with"
260 <<
" respect to number of APV pairs!";
262 }
else {
return lld_channel - 1; }
274 <<
"SiStripModule::" << __func__ <<
"]"
275 <<
" No APV pairs exist!";
283 if ( apv_pair == 0 ) { lld_ch = 1; }
284 else if ( apv_pair == 1 ) { lld_ch = 3; }
287 <<
"SiStripModule::" << __func__ <<
"]"
288 <<
" Unexpected pair number! " << apv_pair;
293 if ( apv_pair == 0 ) { lld_ch = 1; }
294 else if ( apv_pair == 1 ) { lld_ch = 2; }
295 else if ( apv_pair == 2 ) { lld_ch = 3; }
298 <<
"SiStripModule::" << __func__ <<
"]"
299 <<
" Unexpected pair number! " << apv_pair;
305 <<
"SiStripModule::" << __func__ <<
"]"
306 <<
" Unexpected number of APV pairs: " <<
nApvPairs();
310 FedCabling::const_iterator ipair =
cabling_.find( lld_ch );
311 if ( ipair !=
cabling_.end() ) {
return (*ipair).second; }
312 else {
return fed_ch; }
324 if ( apv_address == 32 || apv_address == 33 ) { lld_ch = 1; }
325 else if ( apv_address == 34 || apv_address == 35 ) { lld_ch = 2; }
326 else if ( apv_address == 36 || apv_address == 37 ) { lld_ch = 3; }
327 else if ( apv_address == 0 ) { ; }
330 <<
" Unexpected I2C address ("
331 << apv_address <<
") for APV!";
337 FedCabling::iterator ipair =
cabling_.find( lld_ch );
339 else { ipair->second = fed_ch; }
347 ss <<
" [SiStripModule::" << __func__ <<
"]" << std::endl
348 <<
" Crate/FEC/Ring/CCU/Module : "
355 ss <<
" ActiveApvs : ";
357 if ( apvs.empty() ) { ss <<
"NONE!"; }
358 std::vector<uint16_t>::const_iterator iapv = apvs.begin();
359 for ( ; iapv != apvs.end(); iapv++ ) { ss << *iapv <<
", "; }
362 ss <<
" DcuId/DetId/nPairs : "
364 <<
"0x" << std::setfill(
'0') << std::setw(8) <<
dcuId() <<
"/"
365 <<
"0x" << std::setfill(
'0') << std::setw(8) <<
detId() <<
"/"
370 ss <<
" ApvPairNum/FedCrate/FedSlot/FedId/FedCh : ";
371 FedCabling::const_iterator ichan = channels.begin();
372 for ( ; ichan != channels.end(); ichan++ ) {
373 ss << ichan->first <<
"/"
374 << ichan->second.fedCrate_ <<
"/"
375 << ichan->second.fedSlot_ <<
"/"
376 << ichan->second.fedId_ <<
"/"
377 << ichan->second.fedCh_ <<
", ";
381 ss <<
" DCU/MUX/PLL/LLD found : "
393 ss <<
" [SiStripModule::" << __func__ <<
"]" << std::endl
394 <<
" Crate/FEC/Ring/CCU/Module : "
401 ss <<
" ActiveApvs : ";
403 if ( apvs.empty() ) { ss <<
"NONE!"; }
404 std::vector<uint16_t>::const_iterator iapv = apvs.begin();
405 for ( ; iapv != apvs.end(); iapv++ ) { ss << *iapv <<
", "; }
408 ss <<
" DcuId/DetId/nPairs : "
410 <<
"0x" << std::setfill(
'0') << std::setw(8) <<
dcuId() <<
"/"
411 <<
"0x" << std::setfill(
'0') << std::setw(8) <<
detId() <<
"/"
416 ss <<
" ApvPairNum/FedCrate/FedSlot/FedId/FedCh : ";
417 FedCabling::const_iterator ichan = channels.begin();
418 for ( ; ichan != channels.end(); ichan++ ) {
419 ss << ichan->first <<
"/"
420 << ichan->second.fedCrate_ <<
"/"
421 << ichan->second.fedSlot_ <<
"/"
422 << ichan->second.fedId_ <<
"/"
423 << ichan->second.fedCh_ <<
", ";
427 ss <<
" DCU/MUX/PLL/LLD found : "
438 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)