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 
7 #include <boost/range/iterator_range.hpp>
8 #include <boost/cstdint.hpp>
9 #include <sstream>
10 #include <vector>
11 #include <string>
12 
13 #define SISTRIPCABLING_USING_NEW_STRUCTURE
14 #define SISTRIPCABLING_USING_NEW_INTERFACE
15 
16 
17 class SiStripFedCabling;
18 
20 std::ostream& operator<< ( std::ostream&, const SiStripFedCabling& );
21 
28 
29  public:
30 
31  // -------------------- Typedefs and structs --------------------
32 
33  typedef std::vector<uint16_t> Feds;
34 
35  typedef Feds::iterator FedsIter;
36 
37  typedef Feds::const_iterator FedsConstIter;
38 
39  typedef boost::iterator_range<FedsIter> FedsIterRange;
40 
41  typedef boost::iterator_range<FedsConstIter> FedsConstIterRange;
42 
43  typedef std::vector<FedChannelConnection> Conns;
44 
45  typedef Conns::iterator ConnsIter;
46 
47  typedef Conns::const_iterator ConnsConstIter;
48 
49  typedef boost::iterator_range<ConnsIter> ConnsIterRange;
50 
51  typedef boost::iterator_range<ConnsConstIter> ConnsConstIterRange;
52 
53  typedef std::pair<uint32_t,uint32_t> ConnsPair;
54 
55  typedef std::vector<ConnsPair> Registry;
56 
57  // -------------------- Constructors, destructors --------------------
58 
61 
64 
67 
70 
71  // -------------------- Methods to retrieve connections --------------------
72 
74  FedsConstIterRange fedIds() const;
75 
77  ConnsConstIterRange fedConnections( uint16_t fed_id ) const;
78 
80  FedChannelConnection fedConnection( uint16_t fed_id, uint16_t fed_ch ) const;
81 
84 
87 
88  // -------------------- Utility methods --------------------
89 
91  void buildFedCabling( ConnsConstIterRange connections );
92 
94  void printDebug( std::stringstream& ) const;
95 
97  void print( std::stringstream& ss ) const {
98  printDebug(ss);
99  }
100 
102  void terse( std::stringstream& ) const;
103 
105  void printSummary( std::stringstream& ) const;
107  void summary( std::stringstream& ss ) const {
108  printSummary(ss);
109  }
110 
112  class ConnsRange {
113 
114  public:
115 
116  ConnsRange( const Conns&, ConnsPair );
117  ConnsRange( const Conns& );
119 
120  ConnsConstIter begin() const;
121  ConnsConstIter end() const;
122  ConnsConstIterRange range() const;
124 
125  bool empty() const;
126  uint32_t size() const;
127 
128  ConnsPair connsPair() const;
129  static ConnsPair emptyPair();
130 
131  void print( std::stringstream& ) const;
132 
133  private:
134 
137 
138  };
139 
141  ConnsRange range( ConnsPair ) const;
142 
143  // -------------------- Private member data --------------------
144 
145  private:
146 
149 
152 
155 
158 
161 
162 
164 };
165 
166 std::ostream& operator<<( std::ostream&, const SiStripFedCabling::ConnsRange& );
167 
169  return FedsConstIterRange( feds_.begin(), feds_.end() );
170 }
171 
173  return ConnsConstIterRange( detected_.begin(), detected_.end() );
174 }
175 
177  return ConnsConstIterRange( undetected_.begin(), undetected_.end() );
178 }
179 
181  return range_.begin();
182 }
183 
185  return range_.end();
186 }
187 
189  return range_;
190 }
191 
193  return ConnsConstIterRange( vector_.end(), vector_.end() );
194 }
195 
197  return ( range_.begin() == range_.end() );
198 }
199 
200 inline uint32_t SiStripFedCabling::ConnsRange::size() const {
201  return std::distance( range_.begin(), range_.end() );
202 }
203 
205  return ( ( range_.begin() == vector_.end() &&
206  range_.end() == vector_.end() ) ?
208  ConnsPair( std::distance( vector_.begin(), range_.begin() ),
209  std::distance( vector_.begin(), range_.end() ) ) );
210 }
211 
214 }
215 
217  return ConnsRange( connections_, p );
218 }
219 
220 #endif // CondFormats_SiStripObjects_SiStripFedCabling_H
221 
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