CMS 3D CMS Logo

FedChannelConnection.cc
Go to the documentation of this file.
4 #include <iomanip>
5 #include <string>
6 
7 using namespace sistrip;
8 
9 // -----------------------------------------------------------------------------
10 //
12  const uint16_t& fec_slot,
13  const uint16_t& fec_ring,
14  const uint16_t& ccu_addr,
15  const uint16_t& ccu_chan,
16  const uint16_t& apv0,
17  const uint16_t& apv1,
18  const uint32_t& dcu_id,
19  const uint32_t& det_id,
20  const uint16_t& pairs,
21  const uint16_t& fed_id,
22  const uint16_t& fed_ch,
23  const uint16_t& length,
24  const bool& dcu,
25  const bool& pll,
26  const bool& mux,
27  const bool& lld)
28  : fecCrate_(fec_crate),
29  fecSlot_(fec_slot),
30  fecRing_(fec_ring),
31  ccuAddr_(ccu_addr),
32  ccuChan_(ccu_chan),
33  apv0_(apv0),
34  apv1_(apv1),
35  dcuId_(dcu_id),
36  detId_(det_id),
37  nApvPairs_(pairs),
38  fedCrate_(sistrip::invalid_),
39  fedSlot_(sistrip::invalid_),
40  fedId_(fed_id),
41  fedCh_(fed_ch),
42  length_(length),
43  dcu0x00_(dcu),
44  mux0x43_(mux),
45  pll0x44_(pll),
46  lld0x60_(lld) {
47  ;
48 }
49 
50 // -----------------------------------------------------------------------------
51 //
58  apv0_(sistrip::invalid_),
59  apv1_(sistrip::invalid_),
60  dcuId_(sistrip::invalid32_),
61  detId_(sistrip::invalid32_),
62  nApvPairs_(sistrip::invalid_),
63  fedCrate_(sistrip::invalid_),
64  fedSlot_(sistrip::invalid_),
65  fedId_(sistrip::invalid_),
66  fedCh_(sistrip::invalid_),
67  length_(sistrip::invalid_),
68  dcu0x00_(false),
69  mux0x43_(false),
70  pll0x44_(false),
71  lld0x60_(false) {
72  ;
73 }
74 
75 // -----------------------------------------------------------------------------
76 //
77 bool operator<(const FedChannelConnection& conn1, const FedChannelConnection& conn2) {
78  if (conn1.fedId() < conn2.fedId()) {
79  return true;
80  } else if (conn1.fedId() == conn2.fedId()) {
81  return (conn1.fedCh() < conn2.fedCh() ? true : false);
82  } else {
83  return false;
84  }
85 }
86 
87 // -----------------------------------------------------------------------------
88 //
89 const uint16_t& FedChannelConnection::i2cAddr(const uint16_t& apv) const {
90  if (apv == 0) {
91  return apv0_;
92  } else if (apv == 1) {
93  return apv1_;
94  } else {
95  if (edm::isDebugEnabled()) {
96  edm::LogWarning(mlCabling_) << "[FedChannelConnection::" << __func__ << "]"
97  << " Unexpected APV I2C address!" << apv;
98  }
99  static const uint16_t i2c_addr = 0;
100  return i2c_addr;
101  }
102 }
103 
104 // -----------------------------------------------------------------------------
105 //
107  if (apv0_ == 32 || apv1_ == 33) {
108  return 1;
109  } else if (apv0_ == 34 || apv1_ == 35) {
110  return 2;
111  } else if (apv0_ == 36 || apv1_ == 37) {
112  return 3;
113  } else if (apv0_ != sistrip::invalid_ || apv1_ != sistrip::invalid_) {
114  if (edm::isDebugEnabled()) {
115  edm::LogWarning(mlCabling_) << "[FedChannelConnection::" << __func__ << "]"
116  << " Unexpected APV I2C addresses!"
117  << " Apv0: " << apv0_ << " Apv1: " << apv1_;
118  }
119  }
120  return sistrip::invalid_;
121 }
122 
123 // -----------------------------------------------------------------------------
126  if (nApvPairs_ == 2) {
127  if (apv0_ == 32 || apv1_ == 33) {
128  return 0;
129  } else if (apv0_ == 36 || apv1_ == 37) {
130  return 1;
131  } else {
132  if (edm::isDebugEnabled()) {
133  edm::LogWarning(mlCabling_) << "[FedChannelConnection::" << __func__ << "]"
134  << " APV I2C addresses (" << apv0_ << "/" << apv1_ << ") are incompatible with"
135  << " number of APV pairs (" << nApvPairs_ << ") found for this module!";
136  }
137  }
138  } else if (nApvPairs_ == 3) {
139  if (apv0_ == 32 || apv1_ == 33) {
140  return 0;
141  } else if (apv0_ == 34 || apv1_ == 35) {
142  return 1;
143  } else if (apv0_ == 36 || apv1_ == 37) {
144  return 2;
145  } else {
146  if (edm::isDebugEnabled()) {
147  edm::LogWarning(mlCabling_) << "[FedChannelConnection::" << __func__ << "]"
148  << " APV I2C addresses (" << apv0_ << "/" << apv1_ << ") are incompatible with"
149  << " number of APV pairs (" << nApvPairs_ << ") found for this module!";
150  }
151  }
152  } else {
153  if (edm::isDebugEnabled()) {
154  edm::LogWarning(mlCabling_) << "[FedChannelConnection::" << __func__ << "]"
155  << " Unexpected number of APV pairs: " << nApvPairs_;
156  }
157  }
158  return sistrip::invalid_;
159 }
160 
161 // -----------------------------------------------------------------------------
162 //
163 void FedChannelConnection::print(std::stringstream& ss) const {
164  ss << " [FedChannelConnection::" << __func__ << "]" << std::endl
165  << " FedCrate/FedSlot/FedId/FeUnit/FeChan/FedCh : " << fedCrate() << "/" << fedSlot() << "/" << fedId() << "/"
166  << SiStripFedKey::feUnit(fedCh()) << "/" << SiStripFedKey::feChan(fedCh()) << "/" << fedCh() << std::endl
167  << " FecCrate/FecSlot/FecRing/CcuAddr/CcuChan : " << fecCrate() << "/" << fecSlot() << "/" << fecRing() << "/"
168  << ccuAddr() << "/" << ccuChan() << std::endl
169  << " DcuId/DetId : " << std::hex << "0x" << std::setfill('0') << std::setw(8)
170  << dcuId() << "/"
171  << "0x" << std::setfill('0') << std::setw(8) << detId() << std::endl
172  << std::dec << " LldChan/APV0/APV1 : " << lldChannel() << "/" << i2cAddr(0) << "/"
173  << i2cAddr(1) << std::endl
174  << " pairNumber/nPairs/nStrips : " << apvPairNumber() << "/" << nApvPairs() << "/"
175  << 256 * nApvPairs() << std::endl
176  << " DCU/MUX/PLL/LLD found : " << std::boolalpha << dcu() << "/" << mux() << "/" << pll()
177  << "/" << lld() << std::noboolalpha;
178 }
179 
180 // -----------------------------------------------------------------------------
181 //
182 void FedChannelConnection::terse(std::stringstream& ss) const {
183  ss << " FED:cr/sl/id/fe/ch/chan=" << fedCrate() << "/" << fedSlot() << "/" << fedId() << "/"
184  << SiStripFedKey::feUnit(fedCh()) << "/" << SiStripFedKey::feChan(fedCh()) << "/" << fedCh() << ","
185  << " FEC:cr/sl/ring/ccu/mod=" << fecCrate() << "/" << fecSlot() << "/" << fecRing() << "/" << ccuAddr() << "/"
186  << ccuChan() << ","
187  << " apvs=" << i2cAddr(0) << "/" << i2cAddr(1) << ","
188  << " pair=" << apvPairNumber() + 1 << " (from " << nApvPairs() << "),"
189  << " dcu/detid=" << std::hex << "0x" << std::setfill('0') << std::setw(8) << dcuId() << "/"
190  << "0x" << std::setfill('0') << std::setw(8) << detId() << std::dec;
191 }
192 
193 // -----------------------------------------------------------------------------
194 //
195 std::ostream& operator<<(std::ostream& os, const FedChannelConnection& conn) {
196  std::stringstream ss;
197  conn.print(ss);
198  os << ss.str();
199  return os;
200 }
FedChannelConnection::nApvPairs
const uint16_t & nApvPairs() const
Definition: FedChannelConnection.h:215
FedChannelConnection::lldChannel
uint16_t lldChannel() const
Definition: FedChannelConnection.cc:106
FedChannelConnection::fecCrate
const uint16_t & fecCrate() const
Definition: FedChannelConnection.h:201
MessageLogger.h
funct::false
false
Definition: Factorize.h:29
stage2DemuxMP7BufferRaw_cfi.mux
mux
Definition: stage2DemuxMP7BufferRaw_cfi.py:26
sistrip::invalid32_
static const uint32_t invalid32_
Definition: Constants.h:15
operator<<
std::ostream & operator<<(std::ostream &os, const FedChannelConnection &conn)
Definition: FedChannelConnection.cc:195
FedChannelConnection::fedCh
const uint16_t & fedCh() const
Definition: FedChannelConnection.h:221
FedChannelConnection::apvPairNumberDebug
uint16_t apvPairNumberDebug() const
Definition: FedChannelConnection.cc:125
FedChannelConnection::i2cAddr
const uint16_t & i2cAddr(const uint16_t &apv0_or_1) const
Definition: FedChannelConnection.cc:89
SiStripCommissioningClient_cfg.conn
conn
Definition: SiStripCommissioningClient_cfg.py:5
FedChannelConnection::mux
const bool & mux() const
Definition: FedChannelConnection.h:208
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
FedChannelConnection::fecSlot
const uint16_t & fecSlot() const
Definition: FedChannelConnection.h:202
sistrip::ccuAddr_
static const char ccuAddr_[]
Definition: ConstantsForGranularity.h:55
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
sistrip::fecCrate_
static const char fecCrate_[]
Definition: ConstantsForGranularity.h:52
sistrip::fecSlot_
static const char fecSlot_[]
Definition: ConstantsForGranularity.h:53
FedChannelConnection
Class containning control, module, detector and connection information, at the level of a FED channel...
Definition: FedChannelConnection.h:26
funct::true
true
Definition: Factorize.h:173
sistrip::ccuChan_
static const char ccuChan_[]
Definition: ConstantsForGranularity.h:56
FedChannelConnection::detId
const uint32_t & detId() const
Definition: FedChannelConnection.h:213
FedChannelConnection::ccuAddr
const uint16_t & ccuAddr() const
Definition: FedChannelConnection.h:204
SiStripFedKey.h
sistrip::mlCabling_
static const char mlCabling_[]
Definition: ConstantsForLogger.h:14
FedChannelConnection::fedCrate
const uint16_t & fedCrate() const
Definition: FedChannelConnection.h:218
operator<
bool operator<(const FedChannelConnection &conn1, const FedChannelConnection &conn2)
Definition: FedChannelConnection.cc:77
SiStripFedKey::feUnit
const uint16_t & feUnit() const
Definition: SiStripFedKey.h:189
FedChannelConnection::print
void print(std::stringstream &) const
Definition: FedChannelConnection.cc:163
FedChannelConnection::pll
const bool & pll() const
Definition: FedChannelConnection.h:209
FedChannelConnection::terse
void terse(std::stringstream &) const
Definition: FedChannelConnection.cc:182
FedChannelConnection::fedSlot
const uint16_t & fedSlot() const
Definition: FedChannelConnection.h:219
sistrip::invalid_
static const uint16_t invalid_
Definition: Constants.h:16
FedChannelConnection::apv0_
uint16_t apv0_
Definition: FedChannelConnection.h:171
FedChannelConnection::fedId
const uint16_t & fedId() const
Definition: FedChannelConnection.h:220
FedChannelConnection::FedChannelConnection
FedChannelConnection()
Definition: FedChannelConnection.cc:52
FedChannelConnection::dcu
const bool & dcu() const
Definition: FedChannelConnection.h:207
FedChannelConnection.h
edm::isDebugEnabled
bool isDebugEnabled()
Definition: MessageLogger.cc:12
sistrip::fecRing_
static const char fecRing_[]
Definition: ConstantsForGranularity.h:54
FedChannelConnection::apvPairNumber
uint16_t apvPairNumber() const
Definition: FedChannelConnection.h:230
FedChannelConnection::lld
const bool & lld() const
Definition: FedChannelConnection.h:210
FedChannelConnection::dcuId
const uint32_t & dcuId() const
Definition: FedChannelConnection.h:212
FedChannelConnection::nApvPairs_
uint16_t nApvPairs_
Definition: FedChannelConnection.h:177
sistrip
sistrip classes
Definition: EnsembleCalibrationLA.cc:10
FedChannelConnection::ccuChan
const uint16_t & ccuChan() const
Definition: FedChannelConnection.h:205
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
FedChannelConnection::fecRing
const uint16_t & fecRing() const
Definition: FedChannelConnection.h:203
FedChannelConnection::apv1_
uint16_t apv1_
Definition: FedChannelConnection.h:172
SiStripFedKey::feChan
const uint16_t & feChan() const
Definition: SiStripFedKey.h:190