15 <<
" Constructing object...";
24 <<
" Building FEC cabling...";
28 for (
auto ifed =
feds.begin(); ifed !=
feds.end(); ifed++) {
31 for (
auto iconn = conns.begin(); iconn != conns.end(); iconn++) {
40 for (std::vector<SiStripFecCrate>::const_iterator icrate = this->
crates().begin(); icrate != this->
crates().end();
42 for (std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ++ifec) {
43 for (std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end();
45 for (std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end();
47 for (std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end();
56 <<
" Finished building FEC cabling";
63 while (icrate !=
crates_.end() && (*icrate).fecCrate() !=
conn.fecCrate()) {
69 icrate->addDevices(
conn);
77 <<
" Building vector of FedChannelConnection objects...";
79 for (std::vector<SiStripFecCrate>::const_iterator icrate = this->
crates().begin(); icrate != this->
crates().end();
81 for (std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ++ifec) {
82 for (std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end();
84 for (std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end();
86 for (std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end();
88 for (uint16_t ipair = 0; ipair < imod->nApvPairs(); ipair++) {
94 imod->activeApvPair(imod->lldChannel(ipair)).
first,
95 imod->activeApvPair(imod->lldChannel(ipair)).
second,
99 imod->fedCh(ipair).fedId_,
100 imod->fedCh(ipair).fedCh_,
106 uint16_t fed_crate = imod->fedCh(ipair).fedCrate_;
107 uint16_t fed_slot = imod->fedCh(ipair).fedSlot_;
108 conns.back().fedCrate(fed_crate);
109 conns.back().fedSlot(fed_slot);
123 template <
typename T>
125 -> decltype(&(crates[0].fecs()[0].rings()[0].ccus()[0].
modules()[0])) {
126 std::stringstream
ss;
127 auto icrate = crates.begin();
128 while (icrate != crates.end() && icrate->fecCrate() !=
conn.fecCrate()) {
131 if (icrate != crates.end()) {
132 auto ifec = icrate->fecs().begin();
133 while (ifec != icrate->fecs().end() && ifec->fecSlot() !=
conn.fecSlot()) {
136 if (ifec != icrate->fecs().end()) {
137 auto iring = ifec->rings().begin();
138 while (iring != ifec->rings().end() && iring->fecRing() !=
conn.fecRing()) {
141 if (iring != ifec->rings().end()) {
142 auto iccu = iring->ccus().begin();
143 while (iccu != iring->ccus().end() && iccu->ccuAddr() !=
conn.ccuAddr()) {
146 if (iccu != iring->ccus().end()) {
147 auto imod = iccu->modules().begin();
148 while (imod != iccu->modules().end() && imod->ccuChan() !=
conn.ccuChan()) {
151 if (imod != iccu->modules().end()) {
154 ss <<
"[SiStripFecCabling::" << __func__ <<
"]" 155 <<
" CCU channel " <<
conn.ccuChan() <<
" not found!";
158 ss <<
"[SiStripFecCabling::" << __func__ <<
"]" 159 <<
" CCU address " <<
conn.ccuAddr() <<
" not found!";
162 ss <<
"[SiStripFecCabling::" << __func__ <<
"]" 163 <<
" FEC ring " <<
conn.fecRing() <<
" not found!";
166 ss <<
"[SiStripFecCabling::" << __func__ <<
"]" 167 <<
" FEC slot " <<
conn.fecSlot() <<
" not found!";
170 ss <<
"[SiStripFecCabling::" << __func__ <<
"]" 171 <<
" FEC crate " <<
conn.fecCrate() <<
" not found!";
174 if (!
ss.str().empty()) {
196 for (std::vector<SiStripFecCrate>::const_iterator icrate = this->
crates().begin(); icrate != this->
crates().end();
198 for (std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ++ifec) {
199 for (std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end();
201 for (std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end();
203 for (std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end();
205 if ((*imod).dcuId() == dcu_id) {
222 std::vector<uint16_t> fed_crates;
223 std::vector<uint16_t> fed_slots;
224 std::vector<uint16_t> fed_ids;
225 for (std::vector<SiStripFecCrate>::const_iterator icrate = this->
crates().begin(); icrate != this->
crates().end();
227 for (std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ++ifec) {
228 for (std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end();
230 for (std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end();
232 for (std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end();
235 if (imod->activeApv(32)) {
238 if (imod->activeApv(33)) {
241 if (imod->activeApv(34)) {
244 if (imod->activeApv(35)) {
247 if (imod->activeApv(36)) {
250 if (imod->activeApv(37)) {
261 num_of_devices.
nApvPairs_ += imod->nApvPairs();
262 if (imod->nApvPairs() == 0) {
264 }
else if (imod->nApvPairs() == 1) {
266 }
else if (imod->nApvPairs() == 2) {
268 }
else if (imod->nApvPairs() == 3) {
275 for (uint16_t ipair = 0; ipair < imod->nApvPairs(); ipair++) {
276 uint16_t fed_crate = imod->fedCh(ipair).fedCrate_;
277 uint16_t fed_slot = imod->fedCh(ipair).fedSlot_;
278 uint16_t fed_id = imod->fedCh(ipair).fedId_;
283 std::vector<uint16_t>::iterator icrate =
find(fed_crates.begin(), fed_crates.end(), fed_crate);
284 if (icrate == fed_crates.end()) {
286 fed_crates.push_back(fed_crate);
289 std::vector<uint16_t>::iterator islot =
find(fed_slots.begin(), fed_slots.end(), fed_slot);
290 if (islot == fed_slots.end()) {
292 fed_slots.push_back(fed_slot);
295 std::vector<uint16_t>::iterator ifed =
find(fed_ids.begin(), fed_ids.end(), fed_id);
296 if (ifed == fed_ids.end()) {
298 fed_ids.push_back(fed_id);
329 return num_of_devices;
337 ss <<
"[SiStripFecCabling::" << __func__ <<
"] Printing FEC cabling:" << std::endl;
338 ss <<
"Printing cabling for " <<
crates().size() <<
" crates" << std::endl;
339 for (std::vector<SiStripFecCrate>::const_iterator icrate =
crates().begin(); icrate !=
crates().end(); ++icrate) {
340 ss <<
"Printing cabling for " << icrate->fecs().size() <<
" FECs for crate " << icrate->fecCrate() << std::endl;
341 for (std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ++ifec) {
342 ss <<
"Printing cabling for " << ifec->rings().size() <<
" rings for FEC " << ifec->fecSlot() << std::endl;
343 for (std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end();
345 ss <<
"Printing cabling for " << iring->ccus().size() <<
" CCUs for ring " << iring->fecRing() << std::endl;
346 for (std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end();
348 ss <<
"Printing cabling for " << iccu->modules().size() <<
" modules for CCU " << iccu->ccuAddr()
350 for (std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end();
353 SiStripModule::FedCabling::const_iterator
ii = conns.begin();
354 SiStripModule::FedCabling::const_iterator
jj = conns.end();
361 ss << *imod << std::endl;
367 ss <<
"Number of connected: " <<
valid << std::endl <<
"Number of connections: " <<
total << std::endl;
373 ss <<
"[SiStripFecCabling::" << __func__ <<
"] Printing FEC cabling:" << std::endl;
374 for (std::vector<SiStripFecCrate>::const_iterator icrate =
crates().begin(); icrate !=
crates().end(); ++icrate) {
375 for (std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ++ifec) {
376 for (std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end();
378 for (std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end();
380 for (std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end();
394 std::stringstream
ss;
Device and connection information at the level of a front-end module.
void terse(std::stringstream &) const
const SiStripModule & module(const FedChannelConnection &conn) const
void addDevices(const FedChannelConnection &conn)
std::vector< SiStripFecCrate > crates_
void print(std::stringstream &) const
NumberOfDevices countDevices() const
std::ostream & operator<<(std::ostream &os, const SiStripFecCabling &cabling)
std::map< uint16_t, FedChannel > FedCabling
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
U second(std::pair< T, U > const &p)
static const char mlCabling_[]
Class containning control, module, detector and connection information, at the level of a FED channel...
void connections(std::vector< FedChannelConnection > &) const
const std::vector< SiStripFecCrate > & crates() const
void buildFecCabling(const SiStripFedCabling &)
Simple container class for counting devices.
static const uint16_t invalid_
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
Log< level::Warning, false > LogWarning
FedsConstIterRange fedIds() const
ConnsConstIterRange fedConnections(uint16_t fed_id) const