CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripFedCabling.h
Go to the documentation of this file.
1 #ifndef CondFormats_SiStripObjects_SiStripFedCabling_H
2 #define CondFormats_SiStripObjects_SiStripFedCabling_H
3 
5 #include <boost/range/iterator_range.hpp>
6 #include <boost/cstdint.hpp>
7 #include <sstream>
8 #include <vector>
9 #include <string>
10 
11 #define SISTRIPCABLING_USING_NEW_STRUCTURE
12 #define SISTRIPCABLING_USING_NEW_INTERFACE
13 
14 
15 // -------------------------------------------------------
16 #ifndef SISTRIPCABLING_USING_NEW_STRUCTURE // ------------
17 // -------------------------------------------------------
18 
19 
20 class SiStripFedCabling;
21 
23 std::ostream& operator<< ( std::ostream&, const SiStripFedCabling& );
24 
30 class SiStripFedCabling {
31 
32  public:
33 
34  // -------------------- Constructors, destructors --------------------
35 
37  SiStripFedCabling( const std::vector<FedChannelConnection>& );
38 
41 
44 
47 
48  // -------------------- Utility methods --------------------
49 
51  void buildFedCabling( const std::vector<FedChannelConnection>& connections );
52 
54  void print( std::stringstream& ) const;
55 
57  void terse( std::stringstream& ) const;
58 
60  void summary( std::stringstream& ) const;
61 
62  // -------------------- Methods to retrieve connections --------------------
63 
65  const std::vector<uint16_t>& feds() const;
66 
68  const std::vector<FedChannelConnection>& connections( uint16_t fed_id ) const;
69 
71  const FedChannelConnection& connection( uint16_t fed_id,
72  uint16_t fed_chan ) const;
73 
75  inline const std::vector<FedChannelConnection>& detected() const;
76 
78  inline const std::vector<FedChannelConnection>& undetected() const;
79 
80  // -------------------- Private member data --------------------
81 
82  private:
83 
85  std::vector<uint16_t> feds_;
86 
95  std::vector< std::vector<FedChannelConnection> > connected_;
96 
103  std::vector<FedChannelConnection> detected_;
104 
113  std::vector<FedChannelConnection> undetected_;
114 
115 };
116 
117 const std::vector<FedChannelConnection>& SiStripFedCabling::detected() const { return detected_; }
118 const std::vector<FedChannelConnection>& SiStripFedCabling::undetected() const{ return undetected_; }
119 
120 
121 // -------------------------------------------------------------
122 #else // SISTRIPCABLING_USING_NEW_STRUCTURE --------------------
123 #ifndef SISTRIPCABLING_USING_NEW_INTERFACE // ------------------
124 // -------------------------------------------------------------
125 
126 
127 class SiStripFedCabling;
128 
130 std::ostream& operator<< ( std::ostream&, const SiStripFedCabling& );
131 
137 class SiStripFedCabling {
138 
139  public:
140 
141  // -------------------- Typedefs and structs --------------------
142 
143  typedef std::vector<uint16_t> Feds;
144 
145  typedef Feds::iterator FedsIter;
146 
147  typedef Feds::const_iterator FedsConstIter;
148 
149  typedef boost::iterator_range<FedsIter> FedsIterRange;
150 
151  typedef boost::iterator_range<FedsConstIter> FedsConstIterRange;
152 
153  typedef std::vector<FedChannelConnection> Conns;
154 
155  typedef Conns::iterator ConnsIter;
156 
157  typedef Conns::const_iterator ConnsConstIter;
158 
159  typedef boost::iterator_range<ConnsIter> ConnsIterRange;
160 
161  typedef boost::iterator_range<ConnsConstIter> ConnsConstIterRange;
162 
163  typedef std::pair<uint32_t,uint32_t> ConnsPair;
164 
165  typedef std::vector<ConnsPair> Registry;
166 
167  // -------------------- Constructors, destructors --------------------
168 
170  SiStripFedCabling( const std::vector<FedChannelConnection>& );
171 
174 
177 
180 
181  // -------------------- Methods to retrieve connections --------------------
182 
184  const std::vector<uint16_t>& feds() const;
185 
187  const std::vector<FedChannelConnection>& connections( uint16_t fed_id ) const;
188 
190  const FedChannelConnection& connection( uint16_t fed_id,
191  uint16_t fed_chan ) const;
192 
194  inline const std::vector<FedChannelConnection>& detected() const;
195 
197  inline const std::vector<FedChannelConnection>& undetected() const;
198 
199  // -------------------- Utility methods --------------------
200 
202  void buildFedCabling( const std::vector<FedChannelConnection>& connections );
203 
205  void print( std::stringstream& ) const;
206 
208  void terse( std::stringstream& ) const;
209 
211  void summary( std::stringstream& ) const;
212 
214  class ConnsRange {
215 
216  public:
217 
218  ConnsRange( const Conns&, ConnsPair );
219  ConnsRange( const Conns& );
220  ConnsRange() {;}
221 
222  ConnsConstIter begin() const;
223  ConnsConstIter end() const;
224  ConnsConstIterRange range() const;
226 
227  bool empty() const;
228  uint32_t size() const;
229 
230  ConnsPair connsPair() const;
231  static ConnsPair emptyPair();
232 
233  void print( std::stringstream& ) const;
234 
235  private:
236 
239 
240  };
241 
243  ConnsRange range( ConnsPair ) const;
244 
245  // -------------------- Private member data --------------------
246 
247  private:
248 
250  Feds feds_;
251 
254 
257 
260 
263 
264 };
265 
266 std::ostream& operator<<( std::ostream&, const SiStripFedCabling::ConnsRange& );
267 
268 inline const std::vector<FedChannelConnection>& SiStripFedCabling::detected() const {
269  return detected_;
270 }
271 
272 inline const std::vector<FedChannelConnection>& SiStripFedCabling::undetected() const{
273  return undetected_;
274 }
275 
277  return range_.begin();
278 }
279 
281  return range_.end();
282 }
283 
285  return range_;
286 }
287 
289  return ConnsConstIterRange( vector_.end(), vector_.end() );
290 }
291 
292 inline bool SiStripFedCabling::ConnsRange::empty() const {
293  return ( range_.begin() == range_.end() );
294 }
295 
296 inline uint32_t SiStripFedCabling::ConnsRange::size() const {
297  return std::distance( range_.begin(), range_.end() );
298 }
299 
301  return ( ( range_.begin() == vector_.end() &&
302  range_.end() == vector_.end() ) ?
304  ConnsPair( std::distance( vector_.begin(), range_.begin() ),
305  std::distance( vector_.begin(), range_.end() ) ) );
306 }
307 
310 }
311 
313  return ConnsRange( connections_, p );
314 }
315 
316 
317 // -------------------------------------------------------------
318 #else // SISTRIPCABLING_USING_NEW_INTERFACE --------------------
319 // -------------------------------------------------------------
320 
321 
322 class SiStripFedCabling;
323 
325 std::ostream& operator<< ( std::ostream&, const SiStripFedCabling& );
326 
333 
334  public:
335 
336  // -------------------- Typedefs and structs --------------------
337 
338  typedef std::vector<uint16_t> Feds;
339 
340  typedef Feds::iterator FedsIter;
341 
342  typedef Feds::const_iterator FedsConstIter;
343 
344  typedef boost::iterator_range<FedsIter> FedsIterRange;
345 
346  typedef boost::iterator_range<FedsConstIter> FedsConstIterRange;
347 
348  typedef std::vector<FedChannelConnection> Conns;
349 
350  typedef Conns::iterator ConnsIter;
351 
352  typedef Conns::const_iterator ConnsConstIter;
353 
354  typedef boost::iterator_range<ConnsIter> ConnsIterRange;
355 
356  typedef boost::iterator_range<ConnsConstIter> ConnsConstIterRange;
357 
358  typedef std::pair<uint32_t,uint32_t> ConnsPair;
359 
360  typedef std::vector<ConnsPair> Registry;
361 
362  // -------------------- TO BE DEPRECATED! --------------------
363 
365  SiStripFedCabling( const std::vector<FedChannelConnection>& );
366 
368  void buildFedCabling( const std::vector<FedChannelConnection>& );
369 
371  const std::vector<FedChannelConnection>& connections( uint16_t fed_id ) const;
372 
374  const FedChannelConnection& connection( uint16_t fed_id, uint16_t fed_ch ) const;
375 
377  const std::vector<uint16_t>& feds() const;
378 
380  const std::vector<FedChannelConnection>& detected() const;
381 
383  const std::vector<FedChannelConnection>& undetected() const;
384 
385  // -------------------- Constructors, destructors --------------------
386 
389 
392 
395 
398 
399  // -------------------- Methods to retrieve connections --------------------
400 
402  FedsConstIterRange fedIds() const;
403 
405  ConnsConstIterRange fedConnections( uint16_t fed_id ) const;
406 
408  FedChannelConnection fedConnection( uint16_t fed_id, uint16_t fed_ch ) const;
409 
412 
415 
416  // -------------------- Utility methods --------------------
417 
420 
422  void printDebug( std::stringstream& ) const;
423 
425  void print( std::stringstream& ss ) const {
426  printDebug(ss);
427  }
428 
430  void terse( std::stringstream& ) const;
431 
433  void printSummary( std::stringstream& ) const;
435  void summary( std::stringstream& ss ) const {
436  printSummary(ss);
437  }
438 
440  class ConnsRange {
441 
442  public:
443 
444  ConnsRange( const Conns&, ConnsPair );
445  ConnsRange( const Conns& );
447 
448  ConnsConstIter begin() const;
449  ConnsConstIter end() const;
450  ConnsConstIterRange range() const;
452 
453  bool empty() const;
454  uint32_t size() const;
455 
456  ConnsPair connsPair() const;
457  static ConnsPair emptyPair();
458 
459  void print( std::stringstream& ) const;
460 
461  private:
462 
465 
466  };
467 
469  ConnsRange range( ConnsPair ) const;
470 
471  // -------------------- Private member data --------------------
472 
473  private:
474 
477 
480 
483 
486 
489 
490 };
491 
492 std::ostream& operator<<( std::ostream&, const SiStripFedCabling::ConnsRange& );
493 
495  return FedsConstIterRange( feds_.begin(), feds_.end() );
496 }
497 
499  return ConnsConstIterRange( detected_.begin(), detected_.end() );
500 }
501 
503  return ConnsConstIterRange( undetected_.begin(), undetected_.end() );
504 }
505 
507  return range_.begin();
508 }
509 
511  return range_.end();
512 }
513 
515  return range_;
516 }
517 
519  return ConnsConstIterRange( vector_.end(), vector_.end() );
520 }
521 
523  return ( range_.begin() == range_.end() );
524 }
525 
526 inline uint32_t SiStripFedCabling::ConnsRange::size() const {
527  return std::distance( range_.begin(), range_.end() );
528 }
529 
531  return ( ( range_.begin() == vector_.end() &&
532  range_.end() == vector_.end() ) ?
534  ConnsPair( std::distance( vector_.begin(), range_.begin() ),
535  std::distance( vector_.begin(), range_.end() ) ) );
536 }
537 
540 }
541 
543  return ConnsRange( connections_, p );
544 }
545 
546 
547 // -------------------------------------------------------------
548 #endif // SISTRIPCABLING_USING_NEW_INTERFACE -------------------
549 #endif // SISTRIPCABLING_USING_NEW_STRUCTURE -------------------
550 // -------------------------------------------------------------
551 
552 #endif // CondFormats_SiStripObjects_SiStripFedCabling_H
553 
ConnsConstIterRange detectedDevices() const
ConnsConstIter end() const
boost::iterator_range< ConnsIter > ConnsIterRange
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
ConnsConstIterRange undetectedDevices() const
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
boost::iterator_range< FedsConstIter > FedsConstIterRange
Registry registry_
Container of &quot;ranges&quot; indexed by FED id.
Conns::iterator ConnsIter
Conns undetected_
FE devices that are detected.
Feds::iterator FedsIter
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.
FedsConstIterRange fedIds() const
void print(std::stringstream &ss) const
LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTDEBUG.
boost::iterator_range< FedsIter > FedsIterRange
std::vector< uint16_t > Feds
void summary(std::stringstream &ss) const
LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTSUMMARY.
ConnsConstIterRange invalid() const
#define end
Definition: vmac.h:38
Feds::const_iterator FedsConstIter
const std::vector< FedChannelConnection > & undetected() const
ConnsConstIter begin() const
ConnsRange range(ConnsPair) const
Builds range of iterators from pair of offsets.
std::vector< ConnsPair > Registry
const std::vector< FedChannelConnection > & detected() const
ConnsConstIterRange fedConnections(uint16_t fed_id) const
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
std::vector< FedChannelConnection > Conns
#define begin
Definition: vmac.h:31
Conns::const_iterator ConnsConstIter
void printDebug(std::stringstream &) const
tuple size
Write out results.
const std::vector< FedChannelConnection > & connections(uint16_t fed_id) const