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 <sstream>
9 #include <vector>
10 #include <string>
11 #include <cstdint>
12 
13 #define SISTRIPCABLING_USING_NEW_STRUCTURE
14 #define SISTRIPCABLING_USING_NEW_INTERFACE
15 
16 class TrackerTopology;
17 
18 class SiStripFedCabling;
19 
26 public:
27  // -------------------- Typedefs and structs --------------------
28 
29  typedef std::vector<uint16_t> Feds;
30 
31  typedef Feds::iterator FedsIter;
32 
33  typedef Feds::const_iterator FedsConstIter;
34 
35  typedef boost::iterator_range<FedsIter> FedsIterRange;
36 
37  typedef boost::iterator_range<FedsConstIter> FedsConstIterRange;
38 
39  typedef std::vector<FedChannelConnection> Conns;
40 
41  typedef Conns::iterator ConnsIter;
42 
43  typedef Conns::const_iterator ConnsConstIter;
44 
45  typedef boost::iterator_range<ConnsIter> ConnsIterRange;
46 
47  typedef boost::iterator_range<ConnsConstIter> ConnsConstIterRange;
48 
49  typedef std::pair<uint32_t, uint32_t> ConnsPair;
50 
51  typedef std::vector<ConnsPair> Registry;
52 
53  // -------------------- Constructors, destructors --------------------
54 
57 
60 
63 
66 
67  // -------------------- Methods to retrieve connections --------------------
68 
70  FedsConstIterRange fedIds() const;
71 
73  ConnsConstIterRange fedConnections(uint16_t fed_id) const;
74 
76  FedChannelConnection fedConnection(uint16_t fed_id, uint16_t fed_ch) const;
77 
80 
83 
84  // -------------------- Utility methods --------------------
85 
88 
90  void printDebug(std::stringstream&, const TrackerTopology* trackerTopo) const;
91 
93  void print(std::stringstream& ss, const TrackerTopology* trackerTopo) const { printDebug(ss, trackerTopo); }
94 
96  void terse(std::stringstream&) const;
97 
99  void printSummary(std::stringstream&, const TrackerTopology* trackerTopo) const;
101  void summary(std::stringstream& ss, const TrackerTopology* trackerTopo) const { printSummary(ss, trackerTopo); }
102 
104  class ConnsRange {
105  public:
106  ConnsRange(const Conns&, ConnsPair);
107  ConnsRange(const Conns&);
108  ConnsRange() { ; }
109 
110  ConnsConstIter begin() const;
111  ConnsConstIter end() const;
112  ConnsConstIterRange range() const;
114 
115  bool empty() const;
116  uint32_t size() const;
117 
118  ConnsPair connsPair() const;
119  static ConnsPair emptyPair();
120 
121  void print(std::stringstream&) const;
122 
123  private:
126  };
127 
129  ConnsRange range(ConnsPair) const;
130 
131  // -------------------- Private member data --------------------
132 
133 private:
136 
139 
142 
145 
148 
150 };
151 
152 std::ostream& operator<<(std::ostream&, const SiStripFedCabling::ConnsRange&);
153 
155  return FedsConstIterRange(feds_.begin(), feds_.end());
156 }
157 
159  return ConnsConstIterRange(detected_.begin(), detected_.end());
160 }
161 
163  return ConnsConstIterRange(undetected_.begin(), undetected_.end());
164 }
165 
167 
169 
171 
173  return ConnsConstIterRange(vector_.end(), vector_.end());
174 }
175 
176 inline bool SiStripFedCabling::ConnsRange::empty() const { return (range_.begin() == range_.end()); }
177 
178 inline uint32_t SiStripFedCabling::ConnsRange::size() const { return std::distance(range_.begin(), range_.end()); }
179 
181  return (
182  (range_.begin() == vector_.end() && range_.end() == vector_.end())
184  : ConnsPair(std::distance(vector_.begin(), range_.begin()), std::distance(vector_.begin(), range_.end())));
185 }
186 
189 }
190 
192  return ConnsRange(connections_, p);
193 }
194 
195 #endif // CondFormats_SiStripObjects_SiStripFedCabling_H
void summary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTSUMMARY.
boost::iterator_range< ConnsIter > ConnsIterRange
ConnsConstIter begin() const
Conns connections_
Container of connection objects.
Feds feds_
"Active" FEDs that have connected FE devices
static const uint32_t invalid32_
Definition: Constants.h:15
FedChannelConnection fedConnection(uint16_t fed_id, uint16_t fed_ch) 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
ConnsConstIter end() const
Conns undetected_
FE devices that are detected.
Feds::iterator FedsIter
list connections
Definition: shell.py:10
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.
boost::iterator_range< FedsIter > FedsIterRange
std::vector< uint16_t > Feds
std::ostream & operator<<(std::ostream &, const SiStripFedCabling::ConnsRange &)
Feds::const_iterator FedsConstIter
void printSummary(std::stringstream &, const TrackerTopology *trackerTopo) const
void buildFedCabling(ConnsConstIterRange connections)
ConnsRange range(ConnsPair) const
Builds range of iterators from pair of offsets.
std::vector< ConnsPair > Registry
void printDebug(std::stringstream &, const TrackerTopology *trackerTopo) const
ConnsConstIterRange undetectedDevices() const
void terse(std::stringstream &) const
#define COND_SERIALIZABLE
Definition: Serializable.h:39
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
std::vector< FedChannelConnection > Conns
std::pair< uint32_t, uint32_t > ConnsPair
ConnsConstIterRange invalid() const
Conns::const_iterator ConnsConstIter
void print(std::stringstream &) const
FedsConstIterRange fedIds() const
void print(std::stringstream &ss, const TrackerTopology *trackerTopo) const
LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTDEBUG.
ConnsConstIterRange detectedDevices() const
ConnsConstIterRange fedConnections(uint16_t fed_id) const
ConnsConstIterRange range() const