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 class SiStripFedCabling;
16 
18 std::ostream& operator<< ( std::ostream&, const SiStripFedCabling& );
19 
26 
27  public:
28 
29  // -------------------- Typedefs and structs --------------------
30 
31  typedef std::vector<uint16_t> Feds;
32 
33  typedef Feds::iterator FedsIter;
34 
35  typedef Feds::const_iterator FedsConstIter;
36 
37  typedef boost::iterator_range<FedsIter> FedsIterRange;
38 
39  typedef boost::iterator_range<FedsConstIter> FedsConstIterRange;
40 
41  typedef std::vector<FedChannelConnection> Conns;
42 
43  typedef Conns::iterator ConnsIter;
44 
45  typedef Conns::const_iterator ConnsConstIter;
46 
47  typedef boost::iterator_range<ConnsIter> ConnsIterRange;
48 
49  typedef boost::iterator_range<ConnsConstIter> ConnsConstIterRange;
50 
51  typedef std::pair<uint32_t,uint32_t> ConnsPair;
52 
53  typedef std::vector<ConnsPair> Registry;
54 
55  // -------------------- Constructors, destructors --------------------
56 
59 
62 
65 
68 
69  // -------------------- Methods to retrieve connections --------------------
70 
72  FedsConstIterRange fedIds() const;
73 
75  ConnsConstIterRange fedConnections( uint16_t fed_id ) const;
76 
78  FedChannelConnection fedConnection( uint16_t fed_id, uint16_t fed_ch ) const;
79 
82 
85 
86  // -------------------- Utility methods --------------------
87 
89  void buildFedCabling( ConnsConstIterRange connections );
90 
92  void printDebug( std::stringstream& ) const;
93 
95  void print( std::stringstream& ss ) const {
96  printDebug(ss);
97  }
98 
100  void terse( std::stringstream& ) const;
101 
103  void printSummary( std::stringstream& ) const;
105  void summary( std::stringstream& ss ) const {
106  printSummary(ss);
107  }
108 
110  class ConnsRange {
111 
112  public:
113 
114  ConnsRange( const Conns&, ConnsPair );
115  ConnsRange( const Conns& );
117 
118  ConnsConstIter begin() const;
119  ConnsConstIter end() const;
120  ConnsConstIterRange range() const;
122 
123  bool empty() const;
124  uint32_t size() const;
125 
126  ConnsPair connsPair() const;
127  static ConnsPair emptyPair();
128 
129  void print( std::stringstream& ) const;
130 
131  private:
132 
135 
136  };
137 
139  ConnsRange range( ConnsPair ) const;
140 
141  // -------------------- Private member data --------------------
142 
143  private:
144 
147 
150 
153 
156 
159 
160 };
161 
162 std::ostream& operator<<( std::ostream&, const SiStripFedCabling::ConnsRange& );
163 
165  return FedsConstIterRange( feds_.begin(), feds_.end() );
166 }
167 
169  return ConnsConstIterRange( detected_.begin(), detected_.end() );
170 }
171 
173  return ConnsConstIterRange( undetected_.begin(), undetected_.end() );
174 }
175 
177  return range_.begin();
178 }
179 
181  return range_.end();
182 }
183 
185  return range_;
186 }
187 
189  return ConnsConstIterRange( vector_.end(), vector_.end() );
190 }
191 
193  return ( range_.begin() == range_.end() );
194 }
195 
196 inline uint32_t SiStripFedCabling::ConnsRange::size() const {
197  return std::distance( range_.begin(), range_.end() );
198 }
199 
201  return ( ( range_.begin() == vector_.end() &&
202  range_.end() == vector_.end() ) ?
204  ConnsPair( std::distance( vector_.begin(), range_.begin() ),
205  std::distance( vector_.begin(), range_.end() ) ) );
206 }
207 
210 }
211 
213  return ConnsRange( connections_, p );
214 }
215 
216 #endif // CondFormats_SiStripObjects_SiStripFedCabling_H
217 
ConnsConstIterRange detectedDevices() const
ConnsConstIter end() const
boost::iterator_range< ConnsIter > ConnsIterRange
void print(std::stringstream &) const
ConnsConstIterRange range() 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:15
void terse(std::stringstream &) const
ConnsConstIterRange undetectedDevices() const
void printSummary(std::stringstream &) const
Builds range of iterators from pair of offsets.
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
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
Feds::const_iterator FedsConstIter
void buildFedCabling(ConnsConstIterRange connections)
ConnsConstIter begin() const
ConnsRange range(ConnsPair) const
Builds range of iterators from pair of offsets.
std::vector< ConnsPair > Registry
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
Conns::const_iterator ConnsConstIter
void printDebug(std::stringstream &) const