8 using namespace sistrip;
21 <<
"[SiStripFedCabling::" << __func__ <<
"]"
22 <<
" Constructing object from connection range...";
29 : feds_( input.feds_ ),
30 registry_( input.registry_ ),
31 connections_( input.connections_ ),
32 detected_( input.detected_ ),
33 undetected_( input.undetected_ )
36 <<
"[SiStripFedCabling::" << __func__ <<
"]"
37 <<
" Copy constructing object...";
50 <<
"[SiStripFedCabling::" << __func__ <<
"]"
51 <<
" Default constructing object...";
58 <<
"[SiStripFedCabling::" << __func__ <<
"]"
59 <<
" Destructing object...";
67 if ( input.empty() ) {
69 <<
"[SiStripFedCabling::" << __func__ <<
"]"
70 <<
" Input vector of FedChannelConnections is of zero size!"
71 <<
" Unable to populate FED cabling object!";
76 ss <<
"[SiStripFedCabling::" << __func__ <<
"]"
77 <<
" Building FED cabling from "
85 std::sort(
temp.begin(),
temp.end() );
90 uint16_t nfeds = max_id - min_id + 1;
102 for ( ; ii !=
jj; ++
ii ) {
104 uint16_t fed_id = ii->fedId();
105 uint16_t fed_ch = ii->fedCh();
106 uint16_t
index = fed_id - min_id;
108 if ( fed_id < min_id || fed_id > max_id ) {
continue; }
109 if ( index >=
registry_.size() ) {
continue; }
110 if ( !ii->isConnected() ) {
continue; }
113 if ( iter ==
feds_.end() ) {
feds_.push_back( fed_id ); }
138 if ( p.first > p.second ||
141 p.first > c.size() ||
142 p.second > c.size() ) {
151 range_( c.
end(), c.
end() )
157 ss <<
"[SiStripFedCabling::ConnsRange::" << __func__ <<
"] Debug info:" << std::endl
158 <<
" Vector : " << std::endl
159 <<
" size : " << vector_.size() << std::endl
161 << std::hex << std::setfill(
'0') << std::setw(8)
165 << std::hex << std::setfill(
'0') << std::setw(8)
168 <<
" Range : " << std::endl
169 <<
" size : " << range_.size() << std::endl
171 << std::hex << std::setfill(
'0') << std::setw(8)
174 <<
" (dist=" <<
std::distance( vector_.begin(), range_.begin() ) <<
")"
177 << std::hex << std::setfill(
'0') << std::setw(8)
180 <<
" (dist=" <<
std::distance( vector_.begin(), range_.end() ) <<
")"
182 <<
" Offsets : " << std::endl
183 <<
" first : " << connsPair().first << std::endl
184 <<
" second : " << connsPair().second << std::endl;
190 std::stringstream
ss;
208 uint16_t fed_ch )
const {
210 if ( !conns.empty() && conns.size() == 96 && fed_ch < 96 ) {
211 return *( conns.begin() + fed_ch );
223 if (
feds_.empty() ) {
224 ss <<
"[SiStripFedCabling::" << __func__ <<
"]"
225 <<
" No FEDs found! Unable to print cabling map!";
228 ss <<
"[SiStripFedCabling::" << __func__ <<
"]"
229 <<
" Printing cabling map for " <<
feds_.size()
230 <<
" FEDs with following ids: ";
233 std::vector<uint16_t>::const_iterator
ii =
feds_.begin();
234 std::vector<uint16_t>::const_iterator
jj =
feds_.end();
235 for ( ; ii !=
jj; ++
ii ) { ss << *ii <<
" "; }
236 ss << std::endl << std::endl;
238 std::vector<uint16_t>::const_iterator ifed =
feds_.begin();
239 std::vector<uint16_t>::const_iterator jfed =
feds_.end();
240 for ( ; ifed != jfed; ++ifed ) {
246 ss <<
" Printing cabling information for FED id " << *ifed
247 <<
" (found " << conns.
size()
248 <<
" FedChannelConnection objects...)"
252 uint16_t connected = 0;
255 for ( ; iconn != jconn; ++iconn ) {
258 ss << *iconn << std::endl;
260 ss <<
" (FedId/Ch " << *ifed <<
"/" << ichan
261 <<
": unconnected channel...)" << std::endl;
267 ss <<
" Found " << connected
268 <<
" connected channels for FED id " << *ifed << std::endl
270 if ( connected ) { nfeds++; total += connected; }
276 float percent = (100.*cntr) / (96.*nfeds);
277 percent =
static_cast<uint16_t
>( 10.*percent );
279 ss <<
" Found " << total
280 <<
" APV pairs that are connected to a total of "
281 << nfeds <<
" FEDs" << std::endl
283 <<
" APV pairs have been detected, but are not connected" << std::endl
285 <<
" APV pairs are undetected (wrt DCU-DetId map)" << std::endl
287 <<
" FED channels out of a possible " << (96*nfeds)
288 <<
" (" << nfeds <<
" FEDs) are unconnected ("
289 << percent <<
"%)" << std::endl
299 ss <<
"[SiStripFedCabling::" << __func__ <<
"]";
301 if (
feds_.empty() ) {
302 ss <<
" No FEDs found! Unable to print cabling map!";
306 ss <<
" Printing cabling map for " <<
feds_.size()
307 <<
" FEDs: " << std::endl << std::endl;
309 std::vector<uint16_t>::const_iterator ifed =
feds_.begin();
310 std::vector<uint16_t>::const_iterator jfed =
feds_.end();
311 for ( ; ifed != jfed; ++ifed ) {
317 ss <<
" Printing cabling information for FED id " << *ifed
318 <<
" (found " << conns.
size()
319 <<
" FedChannelConnection objects...)"
322 uint16_t connected = 0;
325 for ( ; iconn != jconn; ++iconn ) {
333 ss <<
" Found " << connected
334 <<
" connected channels for FED id " << *ifed << std::endl
347 ss <<
"[SiStripFedCabling::" << __func__ <<
"]";
349 if (
feds_.empty() ) {
350 ss <<
" No FEDs found!";
354 ss <<
" Found " <<
feds_.size() <<
" FEDs"
355 <<
" with number of connected channels per front-end unit: "
357 <<
" FedId FeUnit1 FeUnit2 FeUnit3 FeUnit4 FeUnit5 FeUnit6 FeUnit7 FeUnit8 Total"
364 std::vector<uint16_t>::const_iterator
ii =
feds_.begin();
365 std::vector<uint16_t>::const_iterator
jj =
feds_.end();
366 for ( ; ii !=
jj; ++
ii ) {
373 if ( conns.
size() < 96 ) {
375 <<
"[SiStripFedCabling::" << __func__ <<
"]"
376 <<
" Unexpected size for FedChannelConnection vector! "
382 std::vector<uint16_t> connected;
383 connected.resize(8,0);
384 for ( uint16_t ichan = 0; ichan < 96; ++ichan ) {
388 if ( unit > 8 ) {
continue; }
395 ss <<
" " << std::setw(5) << *
ii;
396 if ( !connected.empty() ) { nfeds++; }
398 ss <<
" " << std::setw(7) << connected[
unit];
399 if ( !connected.empty() ) { tot += connected[
unit]; }
401 ss <<
" " << std::setw(5) << tot << std::endl;
409 float percent = (100.*
total) / (96.*nfeds);
410 percent =
static_cast<uint16_t
>( 10.*percent );
412 ss <<
" Found: " << std::endl
413 <<
" " << nfeds <<
" out of " <<
feds_.size()
414 <<
" FEDs with at least one connected channel " << std::endl
415 <<
" " <<
feds_.size() - nfeds <<
" out of " <<
feds_.size()
416 <<
" FEDs with no connected channels." << std::endl
417 <<
" " << total <<
" connected channels in total" << std::endl
419 <<
" APV pairs have been detected, but are not connected" << std::endl
421 <<
" APV pairs are undetected (wrt DCU-DetId map)" << std::endl
423 <<
"% of FED channels are connected" << std::endl;
430 std::stringstream
ss;
ConnsConstIter end() const
void print(std::stringstream &) const
ConnsConstIterRange range() const
Conns connections_
Container of connection objects.
Feds feds_
"Active" FEDs that have connected FE devices
std::pair< uint32_t, uint32_t > ConnsPair
FedChannelConnection fedConnection(uint16_t fed_id, uint16_t fed_ch) const
static const uint32_t invalid32_
void terse(std::stringstream &) const
void printSummary(std::stringstream &) const
Builds range of iterators from pair of offsets.
std::ostream & operator<<(std::ostream &out, const ALILine &li)
static const uint16_t valid_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Registry registry_
Container of "ranges" indexed by FED id.
Conns::iterator ConnsIter
Conns undetected_
FE devices that are detected.
static std::string const input
U second(std::pair< T, U > const &p)
static const char mlCabling_[]
boost::iterator_range< ConnsConstIter > ConnsConstIterRange
static ConnsPair emptyPair()
Class containning control, module, detector and connection information, at the level of a FED channel...
Conns detected_
Connections to FE devices that are not detected.
void print(std::stringstream &ss) const
LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTDEBUG.
ConnsConstIterRange invalid() const
Feds::const_iterator FedsConstIter
void buildFedCabling(ConnsConstIterRange connections)
ConnsConstIter begin() const
ConnsRange range(ConnsPair) const
Builds range of iterators from pair of offsets.
const uint16_t & feUnit() const
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...
ConnsConstIterRange range_
std::vector< FedChannelConnection > Conns
Conns::const_iterator ConnsConstIter
void printDebug(std::stringstream &) const