CMS 3D CMS Logo

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 class TrackerTopology;
17 
18 class 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 
58  SiStripFedCabling( ConnsConstIterRange );
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 
81  ConnsConstIterRange detectedDevices() const;
82 
84  ConnsConstIterRange undetectedDevices() const;
85 
86  // -------------------- Utility methods --------------------
87 
89  void buildFedCabling( ConnsConstIterRange connections );
90 
92  void printDebug( std::stringstream&, const TrackerTopology* trackerTopo ) const;
93 
95  void print( std::stringstream& ss, const TrackerTopology* trackerTopo ) const {
96  printDebug(ss, trackerTopo);
97  }
98 
100  void terse( std::stringstream& ) const;
101 
103  void printSummary( std::stringstream&, const TrackerTopology* trackerTopo ) const;
105  void summary( std::stringstream& ss, const TrackerTopology* trackerTopo ) const {
106  printSummary(ss, trackerTopo);
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;
121  ConnsConstIterRange invalid() 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 
133  ConnsConstIterRange vector_;
134  ConnsConstIterRange range_;
135 
136  };
137 
139  ConnsRange range( ConnsPair ) const;
140 
141  // -------------------- Private member data --------------------
142 
143  private:
144 
146  Feds feds_;
147 
149  Registry registry_;
150 
153 
155  Conns detected_;
156 
158  Conns undetected_;
159 
160 
162 };
163 
164 std::ostream& operator<<( std::ostream&, const SiStripFedCabling::ConnsRange& );
165 
167  return FedsConstIterRange( feds_.begin(), feds_.end() );
168 }
169 
171  return ConnsConstIterRange( detected_.begin(), detected_.end() );
172 }
173 
175  return ConnsConstIterRange( undetected_.begin(), undetected_.end() );
176 }
177 
179  return range_.begin();
180 }
181 
183  return range_.end();
184 }
185 
187  return range_;
188 }
189 
191  return ConnsConstIterRange( vector_.end(), vector_.end() );
192 }
193 
195  return ( range_.begin() == range_.end() );
196 }
197 
198 inline uint32_t SiStripFedCabling::ConnsRange::size() const {
199  return std::distance( range_.begin(), range_.end() );
200 }
201 
203  return ( ( range_.begin() == vector_.end() &&
204  range_.end() == vector_.end() ) ?
206  ConnsPair( std::distance( vector_.begin(), range_.begin() ),
207  std::distance( vector_.begin(), range_.end() ) ) );
208 }
209 
212 }
213 
215  return ConnsRange( connections_, p );
216 }
217 
218 #endif // CondFormats_SiStripObjects_SiStripFedCabling_H
219 
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_
"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_
Definition: Constants.h:15
void terse(std::stringstream &) const
ConnsConstIterRange undetectedDevices() const
Builds range of iterators from pair of offsets.
boost::iterator_range< FedsConstIter > FedsConstIterRange
Registry registry_
Container of "ranges" indexed by FED id.
Conns::iterator ConnsIter
void print(std::stringstream &ss, const TrackerTopology *trackerTopo) const
LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTDEBUG.
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 printDebug(std::stringstream &, const TrackerTopology *trackerTopo) const
boost::iterator_range< FedsIter > FedsIterRange
std::vector< uint16_t > Feds
std::ostream & operator<<(std::ostream &, const SiStripFedCabling::ConnsRange &)
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
#define COND_SERIALIZABLE
Definition: Serializable.h:38
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
void summary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTSUMMARY.
void printSummary(std::stringstream &, const TrackerTopology *trackerTopo) const
Conns::const_iterator ConnsConstIter