1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
#ifndef CondFormats_SiStripObjects_FedChannelConnection_H
#define CondFormats_SiStripObjects_FedChannelConnection_H
#include "CondFormats/Serialization/interface/Serializable.h"
#include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
#include <ostream>
#include <sstream>
#include <cstdint>
class FedChannelConnection;
/** Debug info for FedChannelConnection class. */
std::ostream& operator<<(std::ostream&, const FedChannelConnection&);
/** Overload less than operator. */
bool operator<(const FedChannelConnection&, const FedChannelConnection&);
/**
@class FedChannelConnection
@author R.Bainbridge
@brief Class containning control, module, detector and connection
information, at the level of a FED channel.
*/
class FedChannelConnection {
public:
// ---------- Constructor ----------
/** Constructor requires at least information to uniquely identify a
front-end module: ie, crate + FEC + ring + CCU + module. */
FedChannelConnection(const uint16_t& fec_crate,
const uint16_t& fec_slot,
const uint16_t& fec_ring,
const uint16_t& ccu_addr,
const uint16_t& ccu_chan,
const uint16_t& apv0 = 0,
const uint16_t& apv1 = 0,
const uint32_t& dcu_id = 0,
const uint32_t& det_id = 0,
const uint16_t& pairs = 0,
const uint16_t& fed_id = 0,
const uint16_t& fed_ch = 0,
const uint16_t& length = 0,
const bool& dcu = false,
const bool& pll = false,
const bool& mux = false,
const bool& lld = false);
/** Default constructor. */
FedChannelConnection();
/** Default destructor. */
~FedChannelConnection() { ; }
// ---------- Utility methods ----------
/** Identifies a valid connection. */
bool isConnected() const;
/** Performs consistency check for this connection object. */
void consistencyCheck() const { ; } //@@ TO BE IMPLEMENTED...
/** Prints all information for this connection object. */
void print(std::stringstream&) const;
/** Prints terse information for this connection object. */
void terse(std::stringstream&) const;
// -------------------- Module and detector information --------------------
/** Returns DCUid for this module. */
const uint32_t& dcuId() const;
/** Returns DetId for this module. */
const uint32_t& detId() const;
/** Returns number of detector strips for this module. */
uint16_t nDetStrips() const;
/** Returns number of APV pairs for this module. */
const uint16_t& nApvPairs() const;
/** Returns number of APVs for this module. */
uint16_t nApvs() const;
// -------------------- FED connection information --------------------
/** Returns APV pair number for this connection object. This can be
either 0->1 or 0->2, depending on number of detector strips. */
uint16_t apvPairNumber() const;
uint16_t apvPairNumberDebug() const;
/** Returns Laser Driver channel (1->3) for this channel. */
uint16_t lldChannel() const;
/** Returns FED crate for this channel. */
const uint16_t& fedCrate() const;
/** Returns FED slot for this channel. */
const uint16_t& fedSlot() const;
/** Returns FED id for this channel. */
const uint16_t& fedId() const;
/** Returns FED id for this channel. */
const uint16_t& fedCh() const;
/** Sets FED crate for this channel. */
void fedCrate(uint16_t& fed_crate);
/** Sets FED slot for this channel. */
void fedSlot(uint16_t& fed_slot);
/** Sets FED id for this channel. */
void fedId(uint16_t& fed_id);
/** Sets FED id for this channel. */
void fedCh(uint16_t& fed_ch);
// -------------------- Control structure information --------------------
/** Returns FEC crate number. */
const uint16_t& fecCrate() const;
/** Returns slot number of FEC. */
const uint16_t& fecSlot() const;
/** Returns FEC ring number. */
const uint16_t& fecRing() const;
/** Returns CCU address. */
const uint16_t& ccuAddr() const;
/** Returns CCU channel. */
const uint16_t& ccuChan() const;
// -------------------- Front-end ASICs --------------------
/** Indicates whether APV0 or APV1 of the pair has been found: a
non-zero value indicates the I2C address; a null value signifies
a problematic APV. */
const uint16_t& i2cAddr(const uint16_t& apv0_or_1) const;
/** Indicates whether DCU ASIC is found. */
const bool& dcu() const;
/** Indicates whether APV-MUX ASIC is found. */
const bool& mux() const;
/** Indicates whether PLL ASIC is found. */
const bool& pll() const;
/** Indicates whether Linear Laser Driver ASIC is found. */
const bool& lld() const;
/** Returns the length of the optical fiber */
const uint16_t& fiberLength() const;
private:
// ---------- Private member data ----------
// Control
uint16_t fecCrate_;
uint16_t fecSlot_;
uint16_t fecRing_;
uint16_t ccuAddr_;
uint16_t ccuChan_;
// I2C addresses
uint16_t apv0_;
uint16_t apv1_;
// Module / Detector
uint32_t dcuId_;
uint32_t detId_;
uint16_t nApvPairs_;
// FED
uint16_t fedCrate_;
uint16_t fedSlot_;
uint16_t fedId_;
uint16_t fedCh_;
uint16_t length_;
// Found devices
bool dcu0x00_;
bool mux0x43_;
bool pll0x44_;
bool lld0x60_;
COND_SERIALIZABLE;
};
// ---------- inline methods ----------
inline bool FedChannelConnection::isConnected() const {
return (fedId_ != sistrip::invalid_ && fedCh_ != sistrip::invalid_);
}
inline const uint16_t& FedChannelConnection::fecCrate() const { return fecCrate_; }
inline const uint16_t& FedChannelConnection::fecSlot() const { return fecSlot_; }
inline const uint16_t& FedChannelConnection::fecRing() const { return fecRing_; }
inline const uint16_t& FedChannelConnection::ccuAddr() const { return ccuAddr_; }
inline const uint16_t& FedChannelConnection::ccuChan() const { return ccuChan_; }
inline const bool& FedChannelConnection::dcu() const { return dcu0x00_; }
inline const bool& FedChannelConnection::mux() const { return mux0x43_; }
inline const bool& FedChannelConnection::pll() const { return pll0x44_; }
inline const bool& FedChannelConnection::lld() const { return lld0x60_; }
inline const uint32_t& FedChannelConnection::dcuId() const { return dcuId_; }
inline const uint32_t& FedChannelConnection::detId() const { return detId_; }
inline uint16_t FedChannelConnection::nDetStrips() const { return 256 * nApvPairs_; }
inline const uint16_t& FedChannelConnection::nApvPairs() const { return nApvPairs_; }
inline uint16_t FedChannelConnection::nApvs() const { return 2 * nApvPairs(); }
inline const uint16_t& FedChannelConnection::fedCrate() const { return fedCrate_; }
inline const uint16_t& FedChannelConnection::fedSlot() const { return fedSlot_; }
inline const uint16_t& FedChannelConnection::fedId() const { return fedId_; }
inline const uint16_t& FedChannelConnection::fedCh() const { return fedCh_; }
inline const uint16_t& FedChannelConnection::fiberLength() const { return length_; }
inline void FedChannelConnection::fedId(uint16_t& fed_id) { fedId_ = fed_id; }
inline void FedChannelConnection::fedCh(uint16_t& fed_ch) { fedCh_ = fed_ch; }
inline void FedChannelConnection::fedCrate(uint16_t& fed_crate) { fedCrate_ = fed_crate; }
inline void FedChannelConnection::fedSlot(uint16_t& fed_slot) { fedSlot_ = fed_slot; }
inline uint16_t FedChannelConnection::apvPairNumber() const {
if (apv0_ == 32 || apv1_ == 33) {
return 0;
} else if (apv0_ == 34 || apv1_ == 35) {
return 1;
} else { // if (apv0_ == 36 || apv1_ == 37) {
return nApvPairs_ - 1;
}
}
#endif // CondFormats_SiStripObjects_FedChannelConnection_H
|