9 using namespace sistrip;
17 <<
"[SiStripFecCabling::" << __func__ <<
"]"
18 <<
" Constructing object...";
27 <<
"[SiStripFecCabling::" << __func__ <<
"]"
28 <<
" Building FEC cabling...";
31 auto feds = fed_cabling.
fedIds();
32 for (
auto ifed = feds.begin(); ifed != feds.end(); ifed++ ) {
36 for (
auto iconn = conns.begin(); iconn != conns.end(); iconn++ ) {
45 for ( std::vector<SiStripFecCrate>::const_iterator icrate = this->
crates().
begin(); icrate != this->
crates().end(); icrate++ ) {
46 for ( std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++ ) {
47 for ( std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end(); iring++ ) {
48 for ( std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end(); iccu++ ) {
49 for ( std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end(); imod++ ) {
57 <<
"[SiStripFecCabling::" << __func__ <<
"]"
58 <<
" Finished building FEC cabling";
64 std::vector<SiStripFecCrate>::const_iterator icrate =
crates().begin();
65 while ( icrate !=
crates().
end() && (*icrate).fecCrate() != conn.
fecCrate() ) { icrate++; }
66 if ( icrate ==
crates().end() ) {
77 <<
"[SiStripFecCabling::" << __func__ <<
"]"
78 <<
" Building vector of FedChannelConnection objects...";
80 for ( std::vector<SiStripFecCrate>::const_iterator icrate = this->
crates().
begin(); icrate != this->
crates().end(); icrate++ ) {
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(); iring++ ) {
83 for ( std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end(); iccu++ ) {
84 for ( std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end(); imod++ ) {
85 for ( uint16_t ipair = 0; ipair < imod->nApvPairs(); ipair++ ) {
91 imod->activeApvPair( imod->lldChannel(ipair) ).
first,
92 imod->activeApvPair( imod->lldChannel(ipair) ).
second,
96 imod->fedCh(ipair).fedId_,
97 imod->fedCh(ipair).fedCh_,
103 uint16_t fed_crate = imod->fedCh(ipair).fedCrate_;
104 uint16_t fed_slot = imod->fedCh(ipair).fedSlot_;
105 conns.back().fedCrate( fed_crate );
106 conns.back().fedSlot( fed_slot );
119 std::stringstream
ss;
120 std::vector<SiStripFecCrate>::const_iterator icrate =
crates().begin();
121 while ( icrate !=
crates().
end() && icrate->fecCrate() != conn.
fecCrate() ) { icrate++; }
122 if ( icrate !=
crates().end() ) {
123 std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin();
124 while ( ifec != icrate->fecs().end() && ifec->fecSlot() != conn.
fecSlot() ) { ifec++; }
125 if ( ifec != icrate->fecs().end() ) {
126 std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin();
127 while ( iring != ifec->rings().end() && iring->fecRing() != conn.
fecRing() ) { iring++; }
128 if ( iring != ifec->rings().end() ) {
129 std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin();
130 while ( iccu != iring->ccus().end() && iccu->ccuAddr() != conn.
ccuAddr() ) { iccu++; }
131 if ( iccu != iring->ccus().end() ) {
132 std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin();
133 while ( imod != iccu->modules().end() && imod->ccuChan() != conn.
ccuChan() ) { imod++; }
134 if ( imod != iccu->modules().end() ) {
137 ss <<
"[SiStripFecCabling::" << __func__ <<
"]"
138 <<
" CCU channel " << conn.
ccuChan()
141 ss <<
"[SiStripFecCabling::" << __func__ <<
"]"
142 <<
" CCU address " << conn.
ccuAddr()
145 ss <<
"[SiStripFecCabling::" << __func__ <<
"]"
146 <<
" FEC ring " << conn.
fecRing()
149 ss <<
"[SiStripFecCabling::" << __func__ <<
"]"
150 <<
" FEC slot " << conn.
fecSlot()
153 ss <<
"[SiStripFecCabling::" << __func__ <<
"]"
166 for ( std::vector<SiStripFecCrate>::const_iterator icrate = this->
crates().
begin(); icrate != this->
crates().end(); icrate++ ) {
167 for ( std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++ ) {
168 for ( std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end(); iring++ ) {
169 for ( std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end(); iccu++ ) {
170 for ( std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end(); imod++ ) {
171 if ( (*imod).dcuId() == dcu_id ) {
return *imod; }
187 std::vector<uint16_t> fed_crates;
188 std::vector<uint16_t> fed_slots;
189 std::vector<uint16_t> fed_ids;
190 for ( std::vector<SiStripFecCrate>::const_iterator icrate = this->
crates().
begin(); icrate != this->
crates().end(); icrate++ ) {
191 for ( std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++ ) {
192 for ( std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end(); iring++ ) {
193 for ( std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end(); iccu++ ) {
194 for ( std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end(); imod++ ) {
197 if ( imod->activeApv(32) ) { num_of_devices.
nApvs_++; }
198 if ( imod->activeApv(33) ) { num_of_devices.
nApvs_++; }
199 if ( imod->activeApv(34) ) { num_of_devices.
nApvs_++; }
200 if ( imod->activeApv(35) ) { num_of_devices.
nApvs_++; }
201 if ( imod->activeApv(36) ) { num_of_devices.
nApvs_++; }
202 if ( imod->activeApv(37) ) { num_of_devices.
nApvs_++; }
203 if ( imod->dcuId() ) { num_of_devices.
nDcuIds_++; }
204 if ( imod->detId() ) { num_of_devices.
nDetIds_++; }
207 num_of_devices.
nApvPairs_ += imod->nApvPairs();
208 if ( imod->nApvPairs() == 0 ) { num_of_devices.
nApvPairs0_++; }
209 else if ( imod->nApvPairs() == 1 ) { num_of_devices.
nApvPairs1_++; }
210 else if ( imod->nApvPairs() == 2 ) { num_of_devices.
nApvPairs2_++; }
211 else if ( imod->nApvPairs() == 3 ) { num_of_devices.
nApvPairs3_++; }
215 for ( uint16_t ipair = 0; ipair < imod->nApvPairs(); ipair++ ) {
217 uint16_t fed_crate = imod->fedCh(ipair).fedCrate_;
218 uint16_t fed_slot = imod->fedCh(ipair).fedSlot_;
219 uint16_t fed_id = imod->fedCh(ipair).fedId_;
225 std::vector<uint16_t>::iterator icrate =
find( fed_crates.begin(), fed_crates.end(), fed_crate );
226 if ( icrate == fed_crates.end() ) {
228 fed_crates.push_back(fed_crate);
231 std::vector<uint16_t>::iterator islot =
find( fed_slots.begin(), fed_slots.end(), fed_slot );
232 if ( islot == fed_slots.end() ) {
234 fed_slots.push_back(fed_slot);
237 std::vector<uint16_t>::iterator ifed =
find( fed_ids.begin(), fed_ids.end(), fed_id );
238 if ( ifed == fed_ids.end() ) {
240 fed_ids.push_back(fed_id);
248 if ( imod->dcu() ) { num_of_devices.
nDcus_++; }
249 if ( imod->mux() ) { num_of_devices.
nMuxes_++; }
250 if ( imod->pll() ) { num_of_devices.
nPlls_++; }
251 if ( imod->lld() ) { num_of_devices.
nLlds_++; }
265 return num_of_devices;
274 ss <<
"[SiStripFecCabling::" << __func__ <<
"] Printing FEC cabling:" << std::endl;
275 ss <<
"Printing cabling for " <<
crates().size() <<
" crates" << std::endl;
276 for ( std::vector<SiStripFecCrate>::const_iterator icrate =
crates().
begin(); icrate !=
crates().end(); icrate++ ) {
277 ss <<
"Printing cabling for " << icrate->fecs().size() <<
" FECs for crate " << icrate->fecCrate() << std::endl;
278 for ( std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++ ) {
279 ss <<
"Printing cabling for " << ifec->rings().size() <<
" rings for FEC " << ifec->fecSlot() << std::endl;
280 for ( std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end(); iring++ ) {
281 ss <<
"Printing cabling for " << iring->ccus().size() <<
" CCUs for ring " << iring->fecRing() << std::endl;
282 for ( std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end(); iccu++ ) {
283 ss <<
"Printing cabling for " << iccu->modules().size() <<
" modules for CCU " << iccu->ccuAddr() << std::endl;
284 for ( std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end(); imod++ ) {
287 SiStripModule::FedCabling::const_iterator
ii = conns.begin();
288 SiStripModule::FedCabling::const_iterator
jj = conns.end();
289 for ( ; ii !=
jj; ++
ii ) {
294 ss << *imod << std::endl;
300 ss <<
"Number of connected: " << valid << std::endl
301 <<
"Number of connections: " << total << std::endl;
307 ss <<
"[SiStripFecCabling::" << __func__ <<
"] Printing FEC cabling:" << std::endl;
308 for ( std::vector<SiStripFecCrate>::const_iterator icrate =
crates().
begin(); icrate !=
crates().end(); icrate++ ) {
309 for ( std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++ ) {
310 for ( std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end(); iring++ ) {
311 for ( std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end(); iccu++ ) {
312 for ( std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end(); imod++ ) {
325 std::stringstream
ss;
const uint16_t & fecSlot() const
Device and connection information at the level of a front-end module.
const uint16_t & fecCrate() const
const SiStripModule & module(const FedChannelConnection &conn) const
void addDevices(const FedChannelConnection &conn)
std::vector< SiStripFecCrate > crates_
void terse(std::stringstream &) const
const std::vector< SiStripFecCrate > & crates() const
std::ostream & operator<<(std::ostream &out, const ALILine &li)
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_[]
const uint16_t & fecRing() const
void connections(std::vector< FedChannelConnection > &) const
Class containning control, module, detector and connection information, at the level of a FED channel...
FedsConstIterRange fedIds() const
const uint16_t & ccuChan() const
void print(std::stringstream &) const
const uint16_t & ccuAddr() const
void buildFecCabling(const SiStripFedCabling &)
Simple container class for counting devices.
static const uint16_t invalid_
ConnsConstIterRange fedConnections(uint16_t fed_id) const
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
void addDevices(const FedChannelConnection &conn)
std::map< uint16_t, FedChannel > FedCabling
NumberOfDevices countDevices() const