CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripFedCabling.cc
Go to the documentation of this file.
5 #include <iostream>
6 #include <iomanip>
7 
8 using namespace sistrip;
9 
10 
11 // -----------------------------------------------------------------------------
12 #ifndef SISTRIPCABLING_USING_NEW_STRUCTURE // ----------------------------------
13 // -----------------------------------------------------------------------------
14 
15 
16 // -----------------------------------------------------------------------------
17 //
18 SiStripFedCabling::SiStripFedCabling( const std::vector<FedChannelConnection>& input )
19  : feds_(),
20  connected_(),
21  detected_(),
22  undetected_()
23 {
25  << "[SiStripFedCabling::" << __func__ << "]"
26  << " Constructing object...";
27  buildFedCabling( input );
28 }
29 
30 // -----------------------------------------------------------------------------
31 //
33  : feds_(),
34  connected_(),
35  detected_(),
36  undetected_()
37 {
39  << "[SiStripFedCabling::" << __func__ << "]"
40  << " Constructing object...";
41 
42  std::vector<FedChannelConnection> v_fcc;
43 
44  // Retrieve FED ids from cabling map and iterate through
45  const std::vector<uint16_t>& fedids = input.feds();
46  std::vector<uint16_t>::const_iterator ifed=fedids.begin();
47  for ( ; ifed != fedids.end(); ++ifed ) {
48  //copy the vector of FedChannelConnection for the given ifed
49  v_fcc.insert(v_fcc.end(),input.connections(*ifed).begin(),input.connections(*ifed).end());
50  }
51 
52  buildFedCabling( v_fcc );
53 
54 }
55 
56 // -----------------------------------------------------------------------------
57 //
59  : feds_(),
60  connected_(),
61  detected_(),
62  undetected_()
63 {
65  << "[SiStripFedCabling::" << __func__ << "]"
66  << " Constructing object...";
67 }
68 
69 // -----------------------------------------------------------------------------
70 //
73  << "[SiStripFedCabling::" << __func__ << "]"
74  << " Destructing object...";
75 }
76 
77 // -----------------------------------------------------------------------------
78 //
79 void SiStripFedCabling::buildFedCabling( const std::vector<FedChannelConnection>& input ) {
80 
81  // Check input
82  if ( input.empty() ) {
84  << "[SiStripFedCabling::" << __func__ << "]"
85  << " Input vector of FedChannelConnections is of zero size!"
86  << " Unable to populate FED cabling object!";
87  return;
88  }
89 
90  std::stringstream ss;
91  ss << "[SiStripFedCabling::" << __func__ << "]"
92  << " Building FED cabling from "
93  << input.size()
94  << " connections...";
95  LogTrace(mlCabling_) << ss.str();
96 
97  // Clear containers
98  connected_.clear();
99  detected_.clear();
100  undetected_.clear();
101 
102  // Iterate through FEDs
103  for ( uint16_t iconn = 0; iconn < input.size(); iconn++ ) {
104 
105  if ( !input[iconn].isConnected() ) { continue; }
106 
107  uint16_t fed_id = input[iconn].fedId();
108  uint16_t fed_ch = input[iconn].fedCh();
109 
110  // Check on FED ids and channels
111  if ( fed_id > sistrip::CMS_FED_ID_MAX ) {
112  if ( edm::isDebugEnabled() ) {
114  << "[SiStripFedCabling::" << __func__ << "]"
115  << " Unexpected FED id! " << fed_id;
116  }
117  continue;
118  }
119  if ( fed_ch >= sistrip::FEDCH_PER_FED ) {
120  if ( edm::isDebugEnabled() ) {
122  << "[SiStripFedCabling::" << __func__ << "]"
123  << " Unexpected FED channel! " << fed_ch;
124  }
125  continue;
126  }
127 
128  // Resize container to accommodate all FED channels
129  if ( connected_.size() <= fed_id ) { connected_.resize(fed_id+1); }
130  if ( connected_[fed_id].size() != 96 ) { connected_[fed_id].resize(96); }
131 
132  // Fill appropriate container
133  bool detected = input[iconn].i2cAddr(0) || input[iconn].i2cAddr(1);
134  bool connected = input[iconn].fedId(); //@@ should check also FeUnit/FeChan are not invalid ???
135  if ( detected && connected ) {
136  connected_[fed_id][fed_ch] = input[iconn];
137  } else if ( detected && !connected ) {
138  detected_.push_back( input[iconn] );
139  } else if ( !detected && !connected ) {
140  undetected_.push_back( input[iconn] );
141  }
142 
143  if ( detected && connected ) {
144  std::vector<uint16_t>::iterator id = find( feds_.begin(), feds_.end(), fed_id );
145  if ( id == feds_.end() ) { feds_.push_back( fed_id ); }
146  }
147 
148  }
149 
150 }
151 
152 // -----------------------------------------------------------------------------
153 // Returns active FEDs
154 const std::vector<uint16_t>& SiStripFedCabling::feds() const {
155  return feds_;
156 }
157 
158 // -----------------------------------------------------------------------------
159 // Returns connection info for FE devices connected to given FED id and channel
161  uint16_t fed_chan ) const {
162 
163  //@@ should use connections(fed_id) method here!!!
164 
165  if ( !connected_.empty() ) {
166  if ( fed_id < connected_.size() ) {
167  if ( !connected_[fed_id].empty() ) {
168  if ( fed_chan < connected_[fed_id].size() ) {
169  return connected_[fed_id][fed_chan];
170  } else {
171  if ( edm::isDebugEnabled() ) {
173  << "[SiStripFedCabling::" << __func__ << "]"
174  << " FED channel (" << fed_chan
175  << ") is greater than or equal to vector size ("
176  << connected_[fed_chan].size() << ")!";
177  }
178  }
179  } else {
180  if ( edm::isDebugEnabled() ) {
182  << "[SiStripFedCabling::" << __func__ << "]"
183  << " Cabling map is empty for FED id "
184  << fed_id;
185  }
186  }
187  } else {
188  if ( edm::isDebugEnabled() ) {
190  << "[SiStripFedCabling::" << __func__ << "]"
191  << " FED id (" << fed_id
192  << ") is greater than or equal to vector size ("
193  << connected_.size() << ")!";
194  }
195  }
196  } else {
198  << "[SiStripFedCabling::" << __func__ << "]"
199  << " Cabling map is empty!";
200  }
201 
202  static FedChannelConnection conn;
203  return conn;
204 
205 }
206 
207 // -----------------------------------------------------------------------------
208 // Returns connection info for FE devices connected to given FED
209 const std::vector<FedChannelConnection>& SiStripFedCabling::connections( uint16_t fed_id ) const {
210 
211  if ( !connected_.empty() ) {
212  if ( fed_id < connected_.size() ) {
213  if ( !connected_[fed_id].empty() ) {
214  return connected_[fed_id];
215  } else {
216  if ( edm::isDebugEnabled() ) {
218  << "[SiStripFedCabling::" << __func__ << "]"
219  << " Cabling map is empty for FED id "
220  << fed_id;
221  }
222  }
223  } else {
224  if ( edm::isDebugEnabled() ) {
226  << "[SiStripFedCabling::" << __func__ << "]"
227  << " FED id (" << fed_id
228  << ") is greater than or equal to vector size ("
229  << connected_.size() << ")!";
230  }
231  }
232  } else {
234  << "[SiStripFedCabling::" << __func__ << "]"
235  << " Cabling map is empty!";
236  }
237 
238  static FedChannelConnection conn;
239  static std::vector<FedChannelConnection> connections(96,conn);
240  return connections;
241 
242 }
243 
244 // -----------------------------------------------------------------------------
245 //
246 void SiStripFedCabling::print( std::stringstream& ss ) const {
247 
248  const std::vector<uint16_t>& fed_ids = feds();
249  if ( feds().empty() ) {
250  ss << "[SiStripFedCabling::" << __func__ << "]"
251  << " No FEDs found! Unable to print cabling map!";
252  return;
253  } else {
254  ss << "[SiStripFedCabling::" << __func__ << "]"
255  << " Printing cabling map for " << fed_ids.size()
256  << " FEDs with following ids: ";
257  }
258 
259  std::vector<uint16_t>::const_iterator ii = fed_ids.begin();
260  for ( ; ii != fed_ids.end(); ii++ ) { ss << *ii << " "; }
261  ss << std::endl << std::endl;
262 
263  uint16_t total = 0;
264  uint16_t nfeds = 0;
265  uint16_t cntr = 0;
266 
267  std::vector<uint16_t>::const_iterator ifed = fed_ids.begin();
268  for ( ; ifed != fed_ids.end(); ifed++ ) {
269  const std::vector<FedChannelConnection>& conns = connections(*ifed);
270 
271  ss << " Printing cabling information for FED id " << *ifed
272  << " (found " << conns.size()
273  << " FedChannelConnection objects...)"
274  << std::endl;
275 
276  uint16_t ichan = 0;
277  uint16_t connected = 0;
278  std::vector<FedChannelConnection>::const_iterator iconn = conns.begin();
279  for ( ; iconn != conns.end(); iconn++ ) {
280  if ( iconn->fedId() != sistrip::invalid_ ) {
281  connected++;
282  ss << *iconn << std::endl;
283  } else {
284  ss << " (FedId/Ch " << *ifed << "/" << ichan
285  << ": unconnected channel...)" << std::endl;
286  cntr++;
287  }
288  ichan++;
289  }
290 
291  ss << " Found " << connected
292  << " connected channels for FED id " << *ifed << std::endl
293  << std::endl;
294  if ( connected ) { nfeds++; total += connected; }
295 
296  } // fed loop
297 
298  float percent = (100.*cntr) / (96.*nfeds);
299  percent = static_cast<uint16_t>( 10.*percent );
300  percent /= 10.;
301  ss << " Found " << total
302  << " APV pairs that are connected to a total of "
303  << nfeds << " FEDs" << std::endl
304  << " " << detected_.size()
305  << " APV pairs have been detected, but are not connected" << std::endl
306  << " " << undetected_.size()
307  << " APV pairs are undetected (wrt DCU-DetId map)" << std::endl
308  << " " << cntr
309  << " FED channels out of a possible " << (96*nfeds)
310  << " (" << nfeds << " FEDs) are unconnected ("
311  << percent << "%)" << std::endl
312  << std::endl;
313 
314 }
315 
316 // -----------------------------------------------------------------------------
317 //
318 void SiStripFedCabling::terse( std::stringstream& ss ) const {
319 
320  ss << "[SiStripFedCabling::" << __func__ << "]";
321 
322  const std::vector<uint16_t>& fed_ids = feds();
323  if ( feds().empty() ) {
324  ss << " No FEDs found! Unable to print cabling map!";
325  return;
326  }
327 
328  ss << " Printing cabling map for " << fed_ids.size()
329  << " FEDs: " << std::endl << std::endl;
330 
331  std::vector<uint16_t>::const_iterator ifed = fed_ids.begin();
332  for ( ; ifed != fed_ids.end(); ifed++ ) {
333 
334  const std::vector<FedChannelConnection>& conns = connections(*ifed);
335 
336  ss << " Printing cabling information for FED id " << *ifed
337  << " (found " << conns.size()
338  << " FedChannelConnection objects...)"
339  << std::endl;
340 
341  uint16_t connected = 0;
342  std::vector<FedChannelConnection>::const_iterator iconn = conns.begin();
343  for ( ; iconn != conns.end(); iconn++ ) {
344  if ( iconn->fedId() < sistrip::valid_ ) {
345  connected++;
346  iconn->terse(ss);
347  ss << std::endl;
348  }
349  }
350 
351  ss << " Found " << connected
352  << " connected channels for FED id " << *ifed << std::endl
353  << std::endl;
354 
355  }
356 
357 }
358 
359 // -----------------------------------------------------------------------------
360 //
361 void SiStripFedCabling::summary( std::stringstream& ss ) const {
362 
363  ss << "[SiStripFedCabling::" << __func__ << "]";
364 
365  const std::vector<uint16_t>& fed_ids = feds();
366  if ( feds().empty() ) {
367  ss << " No FEDs found!";
368  return;
369  }
370 
371  ss << " Found " << feds().size() << " FEDs"
372  << " with number of connected channels per front-end unit: "
373  << std::endl
374  << " FedId FeUnit1 FeUnit2 FeUnit3 FeUnit4 FeUnit5 FeUnit6 FeUnit7 FeUnit8 Total"
375  << std::endl;
376 
377  uint16_t total = 0;
378  uint16_t nfeds = 0;
379 
380  // iterate through fed ids
381  std::vector<uint16_t>::const_iterator ii = fed_ids.begin();
382  std::vector<uint16_t>::const_iterator jj = fed_ids.end();
383  for ( ; ii != jj; ++ii ) {
384 
385  // check number of connection objects
386  const std::vector<FedChannelConnection>& conns = connections(*ii);
387  if ( conns.size() < 96 ) {
389  << "[SiStripFedCabling::" << __func__ << "]"
390  << " Unexpected size for FedChannelConnection vector! "
391  << conns.size();
392  return;
393  }
394 
395  // count connected channels at level of fe unit
396  std::vector<uint16_t> connected;
397  connected.resize(8,0);
398  for ( uint16_t ichan = 0; ichan < 96; ++ichan ) {
399  if ( conns[ichan].fedId() < sistrip::valid_ ) {
400  uint16_t unit = SiStripFedKey::feUnit(ichan);
401  if ( unit > 8 ) { continue; }
402  connected[unit-1]++;
403  }
404  }
405 
406  // increment counters
407  uint16_t tot = 0 ;
408  ss << " " << std::setw(5) << *ii;
409  if ( !connected.empty() ) { nfeds++; }
410  for ( uint16_t unit = 0; unit < 8; ++unit ) {
411  ss << " " << std::setw(7) << connected[unit];
412  if ( !connected.empty() ) { tot += connected[unit]; }
413  }
414  ss << " " << std::setw(5) << tot << std::endl;
415  total += tot;
416 
417  }
418 
419  // print out
420  float percent = (100.*total) / (96.*nfeds);
421  percent = static_cast<uint16_t>( 10.*percent );
422  percent /= 10.;
423  ss << " Found: " << std::endl
424  << " " << nfeds << " out of " << feds().size() << " FEDs with at least one connected channel " << std::endl
425  << " " << feds().size() - nfeds << " out of " << feds().size() << " FEDs with no connected channels." << std::endl
426  << " " << total << " connected channels in total" << std::endl
427  << " " << detected_.size() << " APV pairs have been detected, but are not connected" << std::endl
428  << " " << undetected_.size() << " APV pairs are undetected (wrt DCU-DetId map)" << std::endl
429  << " " << percent << "% of FED channels are connected" << std::endl;
430 
431 }
432 
433 // -----------------------------------------------------------------------------
434 //
435 std::ostream& operator<< ( std::ostream& os, const SiStripFedCabling& cabling ) {
436  std::stringstream ss;
437  cabling.print(ss);
438  os << ss.str();
439  return os;
440 }
441 
442 
443 // -----------------------------------------------------------------------------
444 #else // SISTRIPCABLING_USING_NEW_STRUCTURE ------------------------------------
445 #ifndef SISTRIPCABLING_USING_NEW_INTERFACE // ----------------------------------
446 // -----------------------------------------------------------------------------
447 
448 
449 // -----------------------------------------------------------------------------
450 //
451 SiStripFedCabling::SiStripFedCabling( const std::vector<FedChannelConnection>& input )
452  : feds_(),
453  registry_(),
454  connections_(),
455  detected_(),
456  undetected_()
457 {
459  << "[SiStripFedCabling::" << __func__ << "]"
460  << " Constructing object...";
461  buildFedCabling( input );
462 }
463 
464 // -----------------------------------------------------------------------------
465 //
467  : feds_( input.feds_ ),
468  registry_( input.registry_ ),
469  connections_( input.connections_ ),
470  detected_( input.detected_ ),
471  undetected_( input.undetected_ )
472 {
474  << "[SiStripFedCabling::" << __func__ << "]"
475  << " Constructing object...";
476 }
477 
478 // -----------------------------------------------------------------------------
479 //
481  : feds_(),
482  registry_(),
483  connections_(),
484  detected_(),
485  undetected_()
486 {
488  << "[SiStripFedCabling::" << __func__ << "]"
489  << " Constructing object...";
490 }
491 
492 // -----------------------------------------------------------------------------
493 //
496  << "[SiStripFedCabling::" << __func__ << "]"
497  << " Destructing object...";
498 }
499 
500 // -----------------------------------------------------------------------------
501 //
502 void SiStripFedCabling::buildFedCabling( const std::vector<FedChannelConnection>& input ) {
503 
504  // Check input
505  if ( input.empty() ) {
507  << "[SiStripFedCabling::" << __func__ << "]"
508  << " Input vector of FedChannelConnections is of zero size!"
509  << " Unable to populate FED cabling object!";
510  return;
511  }
512 
513  std::stringstream ss;
514  ss << "[SiStripFedCabling::" << __func__ << "]"
515  << " Building FED cabling from "
516  << input.size()
517  << " connections...";
518  LogTrace(mlCabling_) << ss.str();
519 
520  // Sort input vector by FED id and channel
521  Conns temp(input);
522  std::sort( temp.begin(), temp.end() );
523 
524  // Strip FED ids
525  uint16_t min_id = static_cast<uint16_t>( FEDNumbering::getSiStripFEDIds().first );
526  uint16_t max_id = static_cast<uint16_t>( FEDNumbering::getSiStripFEDIds().second );
527  uint16_t nfeds = max_id - min_id + 1;
528 
529  // Initialise containers
530  connections_.clear();
531  connections_.reserve( 96 * nfeds );
532  registry_.clear();
533  feds_.clear();
534  registry_.resize( nfeds, ConnsRange::emptyPair() );
535 
536  // Populate container
537  ConnsIter ii = temp.begin();
538  ConnsIter jj = temp.end();
539  for ( ; ii != jj; ++ii ) {
540 
541  uint16_t fed_id = ii->fedId();
542  uint16_t fed_ch = ii->fedCh();
543  uint16_t index = fed_id - min_id;
544 
545  if ( fed_id < min_id || fed_id > max_id ) { continue; }
546  if ( index >= registry_.size() ) { continue; }
547  if ( !ii->isConnected() ) { continue; }
548 
549  FedsConstIter iter = find( feds_.begin(), feds_.end(), fed_id );
550  if ( iter == feds_.end() ) { feds_.push_back( fed_id ); }
551 
552  if ( registry_[index] == ConnsRange::emptyPair() ) {
553  ConnsPair conns_pair;
554  conns_pair.first = std::distance( connections_.begin(), connections_.end() );
555  connections_.insert( connections_.end(), 96, FedChannelConnection() );
556  conns_pair.second = std::distance( connections_.begin(), connections_.end() );
557  registry_[index] = conns_pair;
558  }
559 
560  ConnsRange conns = range( registry_[index] );
561  ConnsConstIter iconn = conns.begin() + fed_ch;
562  FedChannelConnection& conn = const_cast<FedChannelConnection&>(*iconn);
563  conn = *ii;
564 
565  }
566 
567 }
568 
569 // -----------------------------------------------------------------------------
570 //
571 SiStripFedCabling::ConnsRange::ConnsRange( const Conns& c, ConnsPair p ) :
572  vector_( c.begin(), c.end() ),
573  range_( c.begin()+p.first, c.begin()+p.second )
574 {
575  if ( p.first > p.second ||
576  p.first == sistrip::invalid32_ ||
577  p.second == sistrip::invalid32_ ||
578  p.first > c.size() ||
579  p.second > c.size() ) {
580  range_ = ConnsConstIterRange( c.end(), c.end() );
581  }
582 }
583 
584 // -----------------------------------------------------------------------------
585 //
587  vector_( c.begin(), c.end() ),
588  range_( c.end(), c.end() )
589 {;}
590 
591 // -----------------------------------------------------------------------------
592 //
593 void SiStripFedCabling::ConnsRange::print( std::stringstream& ss ) const {
594  ss << "[SiStripFedCabling::ConnsRange::" << __func__ << "] Debug info:" << std::endl
595  << " Vector : " << std::endl
596  << " size : " << vector_.size() << std::endl
597  << " begin : "
598  << std::hex << std::setfill('0') << std::setw(8)
599  << &*vector_.begin()
600  << std::dec << std::endl
601  << " end : "
602  << std::hex << std::setfill('0') << std::setw(8)
603  << &*vector_.end()
604  << std::dec << std::endl
605  << " Range : " << std::endl
606  << " size : " << range_.size() << std::endl
607  << " begin : "
608  << std::hex << std::setfill('0') << std::setw(8)
609  << &*range_.begin()
610  << std::dec
611  << " (dist=" << std::distance( vector_.begin(), range_.begin() ) << ")"
612  << std::endl
613  << " end : "
614  << std::hex << std::setfill('0') << std::setw(8)
615  << &*range_.end()
616  << std::dec
617  << " (dist=" << std::distance( vector_.begin(), range_.end() ) << ")"
618  << std::endl
619  << " Offsets : " << std::endl
620  << " first : " << connsPair().first << std::endl
621  << " second : " << connsPair().second << std::endl;
622 }
623 
624 // -----------------------------------------------------------------------------
625 //
626 std::ostream& operator<<( std::ostream& os, const SiStripFedCabling::ConnsRange& input ) {
627  std::stringstream ss;
628  input.print(ss);
629  os << ss.str();
630  return os;
631 }
632 
633 // -----------------------------------------------------------------------------
634 // Returns connection info for FE devices connected to given FED
635 const std::vector<FedChannelConnection>& SiStripFedCabling::connections( uint16_t fed_id ) const {
636 
637  // HORRIBLE!
638 
639  static FedChannelConnection conn;
640  static std::vector<FedChannelConnection> conns1(96,conn);
641  static std::vector<FedChannelConnection> conns2(96,conn);
642 
643  if ( fed_id < FEDNumbering::getSiStripFEDIds().first ||
644  fed_id > FEDNumbering::getSiStripFEDIds().second ) { return conns1; }
645 
646  uint16_t index = fed_id - FEDNumbering::getSiStripFEDIds().first;
647  if ( index < registry_.size() ) {
648  ConnsRange conns = range( registry_[ index ] );
649  conns2.resize( conns.size() );
650  std::copy( conns.begin(), conns.end(), conns2.begin() );
651  return conns2;
652  } else { return conns1; }
653 
654 }
655 
656 // -----------------------------------------------------------------------------
657 // Returns active FEDs
658 const std::vector<uint16_t>& SiStripFedCabling::feds() const {
659  return feds_;
660 }
661 
662 // -----------------------------------------------------------------------------
663 // Returns connection info for FE devices connected to given FED id and channel
664 const FedChannelConnection& SiStripFedCabling::connection( uint16_t fed_id,
665  uint16_t fed_ch ) const {
666 
667  // HORRIBLE!
668 
669  static FedChannelConnection conn;
670 
671  if ( fed_id < FEDNumbering::getSiStripFEDIds().first ||
672  fed_id > FEDNumbering::getSiStripFEDIds().second ) { return conn; }
673 
674  uint16_t index = fed_id - FEDNumbering::getSiStripFEDIds().first;
675  if ( index < registry_.size() ) {
676  ConnsRange conns = range( registry_[ index ] );
677  if ( conns.size() != 96 ) { return conn; }
678  else if ( fed_ch > 95 ) { return conn; }
679  else { return *( conns.begin() + fed_ch ); }
680  } else { return conn; }
681 
682 }
683 
684 // -----------------------------------------------------------------------------
685 //
686 void SiStripFedCabling::print( std::stringstream& ss ) const {
687 
688  uint16_t total = 0;
689  uint16_t nfeds = 0;
690  uint16_t cntr = 0;
691 
692  if ( feds_.empty() ) {
693  ss << "[SiStripFedCabling::" << __func__ << "]"
694  << " No FEDs found! Unable to print cabling map!";
695  return;
696  } else {
697  ss << "[SiStripFedCabling::" << __func__ << "]"
698  << " Printing cabling map for " << feds_.size()
699  << " FEDs with following ids: ";
700  }
701 
702  std::vector<uint16_t>::const_iterator ii = feds_.begin();
703  std::vector<uint16_t>::const_iterator jj = feds_.end();
704  for ( ; ii != jj; ++ii ) { ss << *ii << " "; }
705  ss << std::endl << std::endl;
706 
707  std::vector<uint16_t>::const_iterator ifed = feds_.begin();
708  std::vector<uint16_t>::const_iterator jfed = feds_.end();
709  for ( ; ifed != jfed; ++ifed ) {
710 
711  uint16_t index = *ifed - FEDNumbering::getSiStripFEDIds().first;
712  if ( index < registry_.size() ) {
713  ConnsRange conns = range( registry_[ index ] );
714 
715  ss << " Printing cabling information for FED id " << *ifed
716  << " (found " << conns.size()
717  << " FedChannelConnection objects...)"
718  << std::endl;
719 
720  uint16_t ichan = 0;
721  uint16_t connected = 0;
722  ConnsConstIter iconn = conns.begin();
723  ConnsConstIter jconn = conns.end();
724  for ( ; iconn != jconn; ++iconn ) {
725  if ( iconn->fedId() != sistrip::invalid_ ) {
726  connected++;
727  ss << *iconn << std::endl;
728  } else {
729  ss << " (FedId/Ch " << *ifed << "/" << ichan
730  << ": unconnected channel...)" << std::endl;
731  cntr++;
732  }
733  ichan++;
734  }
735 
736  ss << " Found " << connected
737  << " connected channels for FED id " << *ifed << std::endl
738  << std::endl;
739  if ( connected ) { nfeds++; total += connected; }
740 
741  }
742 
743  }
744 
745  float percent = (100.*cntr) / (96.*nfeds);
746  percent = static_cast<uint16_t>( 10.*percent );
747  percent /= 10.;
748  ss << " Found " << total
749  << " APV pairs that are connected to a total of "
750  << nfeds << " FEDs" << std::endl
751  << " " << detected_.size()
752  << " APV pairs have been detected, but are not connected" << std::endl
753  << " " << undetected_.size()
754  << " APV pairs are undetected (wrt DCU-DetId map)" << std::endl
755  << " " << cntr
756  << " FED channels out of a possible " << (96*nfeds)
757  << " (" << nfeds << " FEDs) are unconnected ("
758  << percent << "%)" << std::endl
759  << std::endl;
760 
761 }
762 
763 // -----------------------------------------------------------------------------
764 //
765 void SiStripFedCabling::terse( std::stringstream& ss ) const {
766 
767 
768  ss << "[SiStripFedCabling::" << __func__ << "]";
769 
770  if ( feds_.empty() ) {
771  ss << " No FEDs found! Unable to print cabling map!";
772  return;
773  }
774 
775  ss << " Printing cabling map for " << feds_.size()
776  << " FEDs: " << std::endl << std::endl;
777 
778  std::vector<uint16_t>::const_iterator ifed = feds_.begin();
779  std::vector<uint16_t>::const_iterator jfed = feds_.end();
780  for ( ; ifed != jfed; ++ifed ) {
781 
782  uint16_t index = *ifed - FEDNumbering::getSiStripFEDIds().first;
783  if ( index < registry_.size() ) {
784  ConnsRange conns = range( registry_[ index ] );
785 
786  ss << " Printing cabling information for FED id " << *ifed
787  << " (found " << conns.size()
788  << " FedChannelConnection objects...)"
789  << std::endl;
790 
791  uint16_t connected = 0;
792  ConnsConstIter iconn = conns.begin();
793  ConnsConstIter jconn = conns.end();
794  for ( ; iconn != jconn; ++iconn ) {
795  if ( iconn->fedId() != sistrip::invalid_ ) {
796  connected++;
797  iconn->terse(ss);
798  ss << std::endl;
799  }
800  }
801 
802  ss << " Found " << connected
803  << " connected channels for FED id " << *ifed << std::endl
804  << std::endl;
805 
806  }
807 
808  }
809 
810 }
811 
812 // -----------------------------------------------------------------------------
813 //
814 void SiStripFedCabling::summary( std::stringstream& ss ) const {
815 
816  ss << "[SiStripFedCabling::" << __func__ << "]";
817 
818  if ( feds_.empty() ) {
819  ss << " No FEDs found!";
820  return;
821  }
822 
823  ss << " Found " << feds_.size() << " FEDs"
824  << " with number of connected channels per front-end unit: "
825  << std::endl
826  << " FedId FeUnit1 FeUnit2 FeUnit3 FeUnit4 FeUnit5 FeUnit6 FeUnit7 FeUnit8 Total"
827  << std::endl;
828 
829  uint16_t total = 0;
830  uint16_t nfeds = 0;
831 
832  // iterate through fed ids
833  std::vector<uint16_t>::const_iterator ii = feds_.begin();
834  std::vector<uint16_t>::const_iterator jj = feds_.end();
835  for ( ; ii != jj; ++ii ) {
836 
837  // check number of connection objects
838  uint16_t index = *ii - FEDNumbering::getSiStripFEDIds().first;
839  if ( index < registry_.size() ) {
840  ConnsRange conns = range( registry_[ index ] );
841 
842  if ( conns.size() < 96 ) {
844  << "[SiStripFedCabling::" << __func__ << "]"
845  << " Unexpected size for FedChannelConnection vector! "
846  << conns.size();
847  return;
848  }
849 
850  // count connected channels at level of fe unit
851  std::vector<uint16_t> connected;
852  connected.resize(8,0);
853  for ( uint16_t ichan = 0; ichan < 96; ++ichan ) {
854  ConnsConstIter iconn = conns.begin() + ichan;
855  if ( iconn->fedId() < sistrip::valid_ ) {
856  uint16_t unit = SiStripFedKey::feUnit(ichan);
857  if ( unit > 8 ) { continue; }
858  connected[unit-1]++;
859  }
860  }
861 
862  // increment counters
863  uint16_t tot = 0 ;
864  ss << " " << std::setw(5) << *ii;
865  if ( !connected.empty() ) { nfeds++; }
866  for ( uint16_t unit = 0; unit < 8; ++unit ) {
867  ss << " " << std::setw(7) << connected[unit];
868  if ( !connected.empty() ) { tot += connected[unit]; }
869  }
870  ss << " " << std::setw(5) << tot << std::endl;
871  total += tot;
872 
873  }
874 
875  }
876 
877  // print out
878  float percent = (100.*total) / (96.*nfeds);
879  percent = static_cast<uint16_t>( 10.*percent );
880  percent /= 10.;
881  ss << " Found: " << std::endl
882  << " " << nfeds << " out of " << feds_.size()
883  << " FEDs with at least one connected channel " << std::endl
884  << " " << feds_.size() - nfeds << " out of " << feds_.size()
885  << " FEDs with no connected channels." << std::endl
886  << " " << total << " connected channels in total" << std::endl
887  << " " << detected_.size()
888  << " APV pairs have been detected, but are not connected" << std::endl
889  << " " << undetected_.size()
890  << " APV pairs are undetected (wrt DCU-DetId map)" << std::endl
891  << " " << percent
892  << "% of FED channels are connected" << std::endl;
893 
894 }
895 
896 // -----------------------------------------------------------------------------
897 //
898 std::ostream& operator<< ( std::ostream& os, const SiStripFedCabling& cabling ) {
899  std::stringstream ss;
900  cabling.print(ss);
901  os << ss.str();
902  return os;
903 }
904 
905 
906 // -----------------------------------------------------------------------------
907 #else // SISTRIPCABLING_USING_NEW_INTERFACE ------------------------------------
908 // -----------------------------------------------------------------------------
909 
910 
911 // -----------------------------------------------------------------------------
912 // TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED!
913 SiStripFedCabling::SiStripFedCabling( const std::vector<FedChannelConnection>& input )
914  : feds_(),
915  registry_(),
916  connections_(),
917  detected_(),
918  undetected_()
919 {
921  << "[SiStripFedCabling::" << __func__ << "]"
922  << " Constructing object for vector of connections...";
923  buildFedCabling( ConnsConstIterRange( input.begin(),
924  input.end() ) );
925 }
926 
927 // -----------------------------------------------------------------------------
928 // TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED!
929 void SiStripFedCabling::buildFedCabling( const std::vector<FedChannelConnection>& input ) {
930  buildFedCabling( ConnsConstIterRange( input.begin(),
931  input.end() ) );
932 }
933 
934 // -----------------------------------------------------------------------------
935 // TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED!
936 const std::vector<FedChannelConnection>& SiStripFedCabling::connections( uint16_t fed_id ) const {
937  static std::vector<FedChannelConnection> output;
938  output.clear();
939  ConnsConstIterRange input = fedConnections( fed_id );
940  if ( !input.empty() ) {
941  output.resize( input.size() );
942  std::copy( input.begin(), input.end(), output.begin() );
943  } else { output.resize( 96, FedChannelConnection() ); }
944  return output;
945 }
946 
947 // -----------------------------------------------------------------------------
948 // TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED!
949 const FedChannelConnection& SiStripFedCabling::connection( uint16_t fed_id,
950  uint16_t fed_ch ) const {
952  output = fedConnection( fed_id, fed_ch );
953  return output;
954 }
955 
956 // -----------------------------------------------------------------------------
957 // TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED!
958 const std::vector<uint16_t>& SiStripFedCabling::feds() const {
959  return feds_;
960 }
961 
962 // -----------------------------------------------------------------------------
963 // TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED!
964 const std::vector<FedChannelConnection>& SiStripFedCabling::detected() const {
965  return detected_;
966 }
967 
968 // -----------------------------------------------------------------------------
969 // TO BE DEPRECATED! TO BE DEPRECATED! TO BE DEPRECATED!
970 const std::vector<FedChannelConnection>& SiStripFedCabling::undetected() const{
971  return undetected_;
972 }
973 
974 // -----------------------------------------------------------------------------
975 //
976 SiStripFedCabling::SiStripFedCabling( ConnsConstIterRange input )
977  : feds_(),
978  registry_(),
979  connections_(),
980  detected_(),
981  undetected_()
982 {
984  << "[SiStripFedCabling::" << __func__ << "]"
985  << " Constructing object from connection range...";
986  buildFedCabling( input );
987 }
988 
989 // -----------------------------------------------------------------------------
990 //
992  : feds_( input.feds_ ),
993  registry_( input.registry_ ),
994  connections_( input.connections_ ),
995  detected_( input.detected_ ),
996  undetected_( input.undetected_ )
997 {
999  << "[SiStripFedCabling::" << __func__ << "]"
1000  << " Copy constructing object...";
1001 }
1002 
1003 // -----------------------------------------------------------------------------
1004 //
1006  : feds_(),
1007  registry_(),
1008  connections_(),
1009  detected_(),
1010  undetected_()
1011 {
1013  << "[SiStripFedCabling::" << __func__ << "]"
1014  << " Default constructing object...";
1015 }
1016 
1017 // -----------------------------------------------------------------------------
1018 //
1021  << "[SiStripFedCabling::" << __func__ << "]"
1022  << " Destructing object...";
1023 }
1024 
1025 // -----------------------------------------------------------------------------
1026 //
1027 void SiStripFedCabling::buildFedCabling( ConnsConstIterRange input ) {
1028 
1029  // Check input
1030  if ( input.empty() ) {
1032  << "[SiStripFedCabling::" << __func__ << "]"
1033  << " Input vector of FedChannelConnections is of zero size!"
1034  << " Unable to populate FED cabling object!";
1035  return;
1036  }
1037 
1038  std::stringstream ss;
1039  ss << "[SiStripFedCabling::" << __func__ << "]"
1040  << " Building FED cabling from "
1041  << input.size()
1042  << " connections...";
1043  LogTrace(mlCabling_) << ss.str();
1044 
1045  // Sort input vector by FED id and channel
1046  Conns temp( input.size() );
1047  std::copy( input.begin(), input.end(), temp.begin() );
1048  std::sort( temp.begin(), temp.end() );
1049 
1050  // Strip FED ids
1051  uint16_t min_id = static_cast<uint16_t>( FEDNumbering::MINSiStripFEDID );
1052  uint16_t max_id = static_cast<uint16_t>( FEDNumbering::MAXSiStripFEDID );
1053  uint16_t nfeds = max_id - min_id + 1;
1054 
1055  // Initialise containers
1056  connections_.clear();
1057  connections_.reserve( 96 * nfeds );
1058  registry_.clear();
1059  feds_.clear();
1060  registry_.resize( nfeds, ConnsRange::emptyPair() );
1061 
1062  // Populate container
1063  ConnsIter ii = temp.begin();
1064  ConnsIter jj = temp.end();
1065  for ( ; ii != jj; ++ii ) {
1066 
1067  uint16_t fed_id = ii->fedId();
1068  uint16_t fed_ch = ii->fedCh();
1069  uint16_t index = fed_id - min_id;
1070 
1071  if ( fed_id < min_id || fed_id > max_id ) { continue; }
1072  if ( index >= registry_.size() ) { continue; }
1073  if ( !ii->isConnected() ) { continue; }
1074 
1075  FedsConstIter iter = find( feds_.begin(), feds_.end(), fed_id );
1076  if ( iter == feds_.end() ) { feds_.push_back( fed_id ); }
1077 
1078  if ( registry_[index] == ConnsRange::emptyPair() ) {
1079  ConnsPair conns_pair;
1080  conns_pair.first = std::distance( connections_.begin(), connections_.end() );
1081  connections_.insert( connections_.end(), 96, FedChannelConnection() );
1082  conns_pair.second = std::distance( connections_.begin(), connections_.end() );
1083  registry_[index] = conns_pair;
1084  }
1085 
1086  ConnsRange conns = range( registry_[index] );
1087  ConnsConstIter iconn = conns.begin() + fed_ch;
1088  FedChannelConnection& conn = const_cast<FedChannelConnection&>(*iconn);
1089  conn = *ii;
1090 
1091  }
1092 
1093 }
1094 
1095 // -----------------------------------------------------------------------------
1096 //
1097 SiStripFedCabling::ConnsRange::ConnsRange( const Conns& c, ConnsPair p ) :
1098  vector_( c.begin(), c.end() ),
1099  range_( c.begin()+p.first, c.begin()+p.second )
1100 {
1101  if ( p.first > p.second ||
1102  p.first == sistrip::invalid32_ ||
1103  p.second == sistrip::invalid32_ ||
1104  p.first > c.size() ||
1105  p.second > c.size() ) {
1106  range_ = ConnsConstIterRange( c.end(), c.end() );
1107  }
1108 }
1109 
1110 // -----------------------------------------------------------------------------
1111 //
1113  vector_( c.begin(), c.end() ),
1114  range_( c.end(), c.end() )
1115 {;}
1116 
1117 // -----------------------------------------------------------------------------
1118 //
1119 void SiStripFedCabling::ConnsRange::print( std::stringstream& ss ) const {
1120  ss << "[SiStripFedCabling::ConnsRange::" << __func__ << "] Debug info:" << std::endl
1121  << " Vector : " << std::endl
1122  << " size : " << vector_.size() << std::endl
1123  << " begin : "
1124  << std::hex << std::setfill('0') << std::setw(8)
1125  << &*vector_.begin()
1126  << std::dec << std::endl
1127  << " end : "
1128  << std::hex << std::setfill('0') << std::setw(8)
1129  << &*vector_.end()
1130  << std::dec << std::endl
1131  << " Range : " << std::endl
1132  << " size : " << range_.size() << std::endl
1133  << " begin : "
1134  << std::hex << std::setfill('0') << std::setw(8)
1135  << &*range_.begin()
1136  << std::dec
1137  << " (dist=" << std::distance( vector_.begin(), range_.begin() ) << ")"
1138  << std::endl
1139  << " end : "
1140  << std::hex << std::setfill('0') << std::setw(8)
1141  << &*range_.end()
1142  << std::dec
1143  << " (dist=" << std::distance( vector_.begin(), range_.end() ) << ")"
1144  << std::endl
1145  << " Offsets : " << std::endl
1146  << " first : " << connsPair().first << std::endl
1147  << " second : " << connsPair().second << std::endl;
1148 }
1149 
1150 // -----------------------------------------------------------------------------
1151 //
1152 std::ostream& operator<<( std::ostream& os, const SiStripFedCabling::ConnsRange& input ) {
1153  std::stringstream ss;
1154  input.print(ss);
1155  os << ss.str();
1156  return os;
1157 }
1158 
1159 // -----------------------------------------------------------------------------
1160 // Returns connection info for FE devices connected to given FED
1162  uint16_t index = fed_id - FEDNumbering::MINSiStripFEDID;
1163  if ( index < registry_.size() ) {
1164  return range( registry_[ index ] ).range();
1165  } else { return range( registry_[ index ] ).invalid(); }
1166 }
1167 
1168 // -----------------------------------------------------------------------------
1169 // Returns connection info for FE devices connected to given FED id and channel
1171  uint16_t fed_ch ) const {
1172  ConnsConstIterRange conns = fedConnections( fed_id );
1173  if ( !conns.empty() && conns.size() == 96 && fed_ch < 96 ) {
1174  return *( conns.begin() + fed_ch );
1175  } else { return FedChannelConnection(); }
1176 }
1177 
1178 // -----------------------------------------------------------------------------
1179 //
1180 void SiStripFedCabling::printDebug( std::stringstream& ss ) const {
1181 
1182  uint16_t total = 0;
1183  uint16_t nfeds = 0;
1184  uint16_t cntr = 0;
1185 
1186  if ( feds_.empty() ) {
1187  ss << "[SiStripFedCabling::" << __func__ << "]"
1188  << " No FEDs found! Unable to print cabling map!";
1189  return;
1190  } else {
1191  ss << "[SiStripFedCabling::" << __func__ << "]"
1192  << " Printing cabling map for " << feds_.size()
1193  << " FEDs with following ids: ";
1194  }
1195 
1196  std::vector<uint16_t>::const_iterator ii = feds_.begin();
1197  std::vector<uint16_t>::const_iterator jj = feds_.end();
1198  for ( ; ii != jj; ++ii ) { ss << *ii << " "; }
1199  ss << std::endl << std::endl;
1200 
1201  std::vector<uint16_t>::const_iterator ifed = feds_.begin();
1202  std::vector<uint16_t>::const_iterator jfed = feds_.end();
1203  for ( ; ifed != jfed; ++ifed ) {
1204 
1205  uint16_t index = *ifed - FEDNumbering::MINSiStripFEDID;
1206  if ( index < registry_.size() ) {
1207  ConnsRange conns = range( registry_[ index ] );
1208 
1209  ss << " Printing cabling information for FED id " << *ifed
1210  << " (found " << conns.size()
1211  << " FedChannelConnection objects...)"
1212  << std::endl;
1213 
1214  uint16_t ichan = 0;
1215  uint16_t connected = 0;
1216  ConnsConstIter iconn = conns.begin();
1217  ConnsConstIter jconn = conns.end();
1218  for ( ; iconn != jconn; ++iconn ) {
1219  if ( iconn->fedId() != sistrip::invalid_ ) {
1220  connected++;
1221  ss << *iconn << std::endl;
1222  } else {
1223  ss << " (FedId/Ch " << *ifed << "/" << ichan
1224  << ": unconnected channel...)" << std::endl;
1225  cntr++;
1226  }
1227  ichan++;
1228  }
1229 
1230  ss << " Found " << connected
1231  << " connected channels for FED id " << *ifed << std::endl
1232  << std::endl;
1233  if ( connected ) { nfeds++; total += connected; }
1234 
1235  }
1236 
1237  }
1238 
1239  float percent = (100.*cntr) / (96.*nfeds);
1240  percent = static_cast<uint16_t>( 10.*percent );
1241  percent /= 10.;
1242  ss << " Found " << total
1243  << " APV pairs that are connected to a total of "
1244  << nfeds << " FEDs" << std::endl
1245  << " " << detected_.size()
1246  << " APV pairs have been detected, but are not connected" << std::endl
1247  << " " << undetected_.size()
1248  << " APV pairs are undetected (wrt DCU-DetId map)" << std::endl
1249  << " " << cntr
1250  << " FED channels out of a possible " << (96*nfeds)
1251  << " (" << nfeds << " FEDs) are unconnected ("
1252  << percent << "%)" << std::endl
1253  << std::endl;
1254 
1255 }
1256 
1257 // -----------------------------------------------------------------------------
1258 //
1259 void SiStripFedCabling::terse( std::stringstream& ss ) const {
1260 
1261 
1262  ss << "[SiStripFedCabling::" << __func__ << "]";
1263 
1264  if ( feds_.empty() ) {
1265  ss << " No FEDs found! Unable to print cabling map!";
1266  return;
1267  }
1268 
1269  ss << " Printing cabling map for " << feds_.size()
1270  << " FEDs: " << std::endl << std::endl;
1271 
1272  std::vector<uint16_t>::const_iterator ifed = feds_.begin();
1273  std::vector<uint16_t>::const_iterator jfed = feds_.end();
1274  for ( ; ifed != jfed; ++ifed ) {
1275 
1276  uint16_t index = *ifed - FEDNumbering::MINSiStripFEDID;
1277  if ( index < registry_.size() ) {
1278  ConnsRange conns = range( registry_[ index ] );
1279 
1280  ss << " Printing cabling information for FED id " << *ifed
1281  << " (found " << conns.size()
1282  << " FedChannelConnection objects...)"
1283  << std::endl;
1284 
1285  uint16_t connected = 0;
1286  ConnsConstIter iconn = conns.begin();
1287  ConnsConstIter jconn = conns.end();
1288  for ( ; iconn != jconn; ++iconn ) {
1289  if ( iconn->fedId() != sistrip::invalid_ ) {
1290  connected++;
1291  iconn->terse(ss);
1292  ss << std::endl;
1293  }
1294  }
1295 
1296  ss << " Found " << connected
1297  << " connected channels for FED id " << *ifed << std::endl
1298  << std::endl;
1299 
1300  }
1301 
1302  }
1303 
1304 }
1305 
1306 // -----------------------------------------------------------------------------
1307 //
1308 void SiStripFedCabling::printSummary( std::stringstream& ss ) const {
1309 
1310  ss << "[SiStripFedCabling::" << __func__ << "]";
1311 
1312  if ( feds_.empty() ) {
1313  ss << " No FEDs found!";
1314  return;
1315  }
1316 
1317  ss << " Found " << feds_.size() << " FEDs"
1318  << " with number of connected channels per front-end unit: "
1319  << std::endl
1320  << " FedId FeUnit1 FeUnit2 FeUnit3 FeUnit4 FeUnit5 FeUnit6 FeUnit7 FeUnit8 Total"
1321  << std::endl;
1322 
1323  uint16_t total = 0;
1324  uint16_t nfeds = 0;
1325 
1326  // iterate through fed ids
1327  std::vector<uint16_t>::const_iterator ii = feds_.begin();
1328  std::vector<uint16_t>::const_iterator jj = feds_.end();
1329  for ( ; ii != jj; ++ii ) {
1330 
1331  // check number of connection objects
1332  uint16_t index = *ii - FEDNumbering::MINSiStripFEDID;
1333  if ( index < registry_.size() ) {
1334  ConnsRange conns = range( registry_[ index ] );
1335 
1336  if ( conns.size() < 96 ) {
1338  << "[SiStripFedCabling::" << __func__ << "]"
1339  << " Unexpected size for FedChannelConnection vector! "
1340  << conns.size();
1341  return;
1342  }
1343 
1344  // count connected channels at level of fe unit
1345  std::vector<uint16_t> connected;
1346  connected.resize(8,0);
1347  for ( uint16_t ichan = 0; ichan < 96; ++ichan ) {
1348  ConnsConstIter iconn = conns.begin() + ichan;
1349  if ( iconn->fedId() < sistrip::valid_ ) {
1350  uint16_t unit = SiStripFedKey::feUnit(ichan);
1351  if ( unit > 8 ) { continue; }
1352  connected[unit-1]++;
1353  }
1354  }
1355 
1356  // increment counters
1357  uint16_t tot = 0 ;
1358  ss << " " << std::setw(5) << *ii;
1359  if ( !connected.empty() ) { nfeds++; }
1360  for ( uint16_t unit = 0; unit < 8; ++unit ) {
1361  ss << " " << std::setw(7) << connected[unit];
1362  if ( !connected.empty() ) { tot += connected[unit]; }
1363  }
1364  ss << " " << std::setw(5) << tot << std::endl;
1365  total += tot;
1366 
1367  }
1368 
1369  }
1370 
1371  // print out
1372  float percent = (100.*total) / (96.*nfeds);
1373  percent = static_cast<uint16_t>( 10.*percent );
1374  percent /= 10.;
1375  ss << " Found: " << std::endl
1376  << " " << nfeds << " out of " << feds_.size()
1377  << " FEDs with at least one connected channel " << std::endl
1378  << " " << feds_.size() - nfeds << " out of " << feds_.size()
1379  << " FEDs with no connected channels." << std::endl
1380  << " " << total << " connected channels in total" << std::endl
1381  << " " << detected_.size()
1382  << " APV pairs have been detected, but are not connected" << std::endl
1383  << " " << undetected_.size()
1384  << " APV pairs are undetected (wrt DCU-DetId map)" << std::endl
1385  << " " << percent
1386  << "% of FED channels are connected" << std::endl;
1387 
1388 }
1389 
1390 // -----------------------------------------------------------------------------
1391 //
1392 std::ostream& operator<< ( std::ostream& os, const SiStripFedCabling& cabling ) {
1393  std::stringstream ss;
1394  cabling.print(ss);
1395  os << ss.str();
1396  return os;
1397 }
1398 
1399 
1400 // -----------------------------------------------------------------------------
1401 #endif // SISTRIPCABLING_USING_NEW_INTERFACE -----------------------------------
1402 #endif // SISTRIPCABLING_USING_NEW_STRUCTURE -----------------------------------
1403 // -----------------------------------------------------------------------------
bool isDebugEnabled()
void print(std::stringstream &) const
ConnsConstIterRange range() const
const std::vector< uint16_t > & feds() const
Conns connections_
Container of connection objects.
Feds feds_
&quot;Active&quot; 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_
Definition: Constants.h:16
void terse(std::stringstream &) const
static const uint16_t CMS_FED_ID_MAX
void printSummary(std::stringstream &) const
Builds range of iterators from pair of offsets.
const FedChannelConnection & connection(uint16_t fed_id, uint16_t fed_ch) const
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
static const uint16_t valid_
Definition: Constants.h:18
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
Registry registry_
Container of &quot;ranges&quot; indexed by FED id.
Conns::iterator ConnsIter
Conns undetected_
FE devices that are detected.
U second(std::pair< T, U > const &p)
static const char mlCabling_[]
boost::iterator_range< ConnsConstIter > ConnsConstIterRange
void buildFedCabling(const std::vector< FedChannelConnection > &)
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.
string unit
Definition: csvLumiCalc.py:46
void print(std::stringstream &ss) const
LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTDEBUG.
void summary(std::stringstream &ss) const
LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTSUMMARY.
ConnsConstIterRange invalid() const
#define end
Definition: vmac.h:38
bool first
Definition: L1TdeRCT.cc:94
Feds::const_iterator FedsConstIter
const std::vector< FedChannelConnection > & undetected() const
#define LogTrace(id)
ConnsRange range(ConnsPair) const
Builds range of iterators from pair of offsets.
const uint16_t & feUnit() const
const std::vector< FedChannelConnection > & detected() const
ConnsConstIterRange fedConnections(uint16_t fed_id) const
static const uint16_t invalid_
Definition: Constants.h:17
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
std::vector< FedChannelConnection > Conns
#define begin
Definition: vmac.h:31
static const uint16_t FEDCH_PER_FED
Conns::const_iterator ConnsConstIter
void printDebug(std::stringstream &) const
tuple size
Write out results.
tuple conn
Definition: results_mgr.py:53
const std::vector< FedChannelConnection > & connections(uint16_t fed_id) const