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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
#ifndef L1GlobalTrigger_L1TcsWord_h
#define L1GlobalTrigger_L1TcsWord_h
/**
* \class L1TcsWord
*
*
* Description: L1 Global Trigger - TCS words in the readout record.
*
* Implementation:
* <TODO: enter implementation details>
*
* \author: Vasile Mihai Ghete - HEPHY Vienna
*
*
*/
// system include files
#include <iosfwd>
// user include files
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h"
#include "FWCore/Utilities/interface/typedefs.h"
// forward declarations
// class declaration
class L1TcsWord {
public:
/// constructors
L1TcsWord(); // empty constructor, all members set to zero;
/// constructor from unpacked values;
L1TcsWord(cms_uint16_t boardIdValue,
cms_uint16_t bxNrValue,
cms_uint16_t daqNrValue,
cms_uint16_t triggerTypeValue,
cms_uint16_t statusValue,
cms_uint16_t luminositySegmentNrValue,
cms_uint32_t partRunNrValue,
cms_uint32_t assignedPartitionsValue,
cms_uint32_t partTrigNrValue,
cms_uint32_t eventNrValue,
cms_uint64_t orbitNrValue);
/// destructor
virtual ~L1TcsWord();
/// equal operator
bool operator==(const L1TcsWord&) const;
/// unequal operator
bool operator!=(const L1TcsWord&) const;
public:
/// get/set board ID
/// get BoardId value
inline const cms_uint16_t boardId() const { return m_boardId; }
/// set BoardId from a BoardId value
void setBoardId(const cms_uint16_t boardIdValue) { m_boardId = boardIdValue; }
/// set the BoardId value from a 64-bits word
void setBoardId(const cms_uint64_t& word64);
/// set the BoardId value in a 64-bits word, having the index iWord
/// in the GTFE raw record
void setBoardIdWord64(cms_uint64_t& word64, int iWord);
/// get/set bunch cross number as counted in the TCS chip
inline const cms_uint16_t bxNr() const { return m_bxNr; }
void setBxNr(const cms_uint16_t bxNrValue) { m_bxNr = bxNrValue; }
/// set the BxNr value from a 64-bits word
void setBxNr(const cms_uint64_t& word64);
/// set the BxNr value in a 64-bits word, having the index iWord
/// in the GTFE EVM raw record
void setBxNrWord64(cms_uint64_t& word64, int iWord);
/// get/set number of DAQ partition to which the L1A has been sent
inline const cms_uint16_t daqNr() const { return m_daqNr; }
void setDaqNr(const cms_uint16_t daqNrValue) { m_daqNr = daqNrValue; }
/// set the DaqNr value from a 64-bits word
void setDaqNr(const cms_uint64_t& word64);
/// set the DaqNr value in a 64-bits word, having the index iWord
/// in the GTFE EVM raw record
void setDaqNrWord64(cms_uint64_t& word64, int iWord);
/// get/set trigger type, identical with event type in CMS header
inline const cms_uint16_t triggerType() const { return m_triggerType; }
void setTriggerType(const cms_uint16_t triggerTypeValue) { m_triggerType = triggerTypeValue; }
/// set the TriggerType value from a 64-bits word
void setTriggerType(const cms_uint64_t& word64);
/// set the TriggerType value in a 64-bits word, having the index iWord
/// in the GTFE EVM raw record
void setTriggerTypeWord64(cms_uint64_t& word64, int iWord);
/// get/set status: 0000 = normal rate; 1000 = low rate = warning
inline const cms_uint16_t status() const { return m_status; }
void setStatus(const cms_uint16_t statusValue) { m_status = statusValue; }
/// set the Status value from a 64-bits word
void setStatus(const cms_uint64_t& word64);
/// set the Status value in a 64-bits word, having the index iWord
/// in the GTFE EVM raw record
void setStatusWord64(cms_uint64_t& word64, int iWord);
/// get/set luminosity segment number
inline const cms_uint16_t luminositySegmentNr() const { return m_luminositySegmentNr; }
void setLuminositySegmentNr(const cms_uint16_t luminositySegmentNrValue) {
m_luminositySegmentNr = luminositySegmentNrValue;
}
/// set the luminosity segment number value from a 64-bits word
void setLuminositySegmentNr(const cms_uint64_t& word64);
/// set the luminosity segment number value in a 64-bits word,
/// having the index iWord in the GTFE EVM raw record
void setLuminositySegmentNrWord64(cms_uint64_t& word64, int iWord);
/// get/set partition run number
inline const cms_uint32_t partRunNr() const { return m_partRunNr; }
void setPartRunNr(const cms_uint32_t partRunNrValue) { m_partRunNr = partRunNrValue; }
/// set the PartRunNr value from a 64-bits word
void setPartRunNr(const cms_uint64_t& word64);
/// set the PartRunNr value in a 64-bits word, having the index iWord
/// in the GTFE EVM raw record
void setPartRunNrWord64(cms_uint64_t& word64, int iWord);
/// get/set assigned partition: bit "i" correspond to detector partition "i"
inline const cms_uint32_t assignedPartitions() const { return m_assignedPartitions; }
void setAssignedPartitions(const cms_uint32_t assignedPartitionsValue) {
m_assignedPartitions = assignedPartitionsValue;
}
/// set the AssignedPartitions value from a 64-bits word
void setAssignedPartitions(const cms_uint64_t& word64);
/// set the AssignedPartitions value in a 64-bits word, having the index iWord
/// in the GTFE EVM raw record
void setAssignedPartitionsWord64(cms_uint64_t& word64, int iWord);
/// get/set total number of L1A sent since start of the run to this DAQ partition
inline const cms_uint32_t partTrigNr() const { return m_partTrigNr; }
void setPartTrigNr(const cms_uint32_t partTrigNrValue) { m_partTrigNr = partTrigNrValue; }
/// set the PartTrigNr value from a 64-bits word
void setPartTrigNr(const cms_uint64_t& word64);
/// set the PartTrigNr value in a 64-bits word, having the index iWord
/// in the GTFE EVM raw record
void setPartTrigNrWord64(cms_uint64_t& word64, int iWord);
/// get/set event number since last L1 reset generated in TCS chip
inline const cms_uint32_t eventNr() const { return m_eventNr; }
void setEventNr(const cms_uint32_t eventNrValue) { m_eventNr = eventNrValue; }
/// set the EventNr value from a 64-bits word
void setEventNr(const cms_uint64_t& word64);
/// set the EventNr value in a 64-bits word, having the index iWord
/// in the GTFE EVM raw record
void setEventNrWord64(cms_uint64_t& word64, int iWord);
/// get/set orbit number since start of run
inline const cms_uint64_t orbitNr() const { return m_orbitNr; }
void setOrbitNr(const cms_uint64_t orbitNrValue) { m_orbitNr = orbitNrValue; }
/// set the OrbitNr value from a 64-bits word
void setOrbitNrFrom(const cms_uint64_t& word64);
/// set the OrbitNr value in a 64-bits word, having the index iWord
/// in the GTFE EVM raw record
void setOrbitNrWord64(cms_uint64_t& word64, int iWord);
/// get the size of the TCS block in GT EVM record (in multiple of 8 bits)
inline const unsigned int getSize() const {
int unitLengthBits = L1GlobalTriggerReadoutSetup::UnitLength;
return BlockSize * unitLengthBits;
}
public:
/// reset the content of a L1TcsWord
void reset();
/// pretty print the content of a L1TcsWord
void print(std::ostream& myCout) const;
/// unpack TCS
/// tcsPtr pointer to the beginning of the TCS block in the raw data
void unpack(const unsigned char* tcsPtr);
private:
// block description in the raw GT record
// block size in 64bits words (BlockSize * 64 bits)
static const int BlockSize;
// word 0
// index of the word in the TCS block containig the variable
static const int BoardIdWord;
static const int BxNrWord;
static const int DaqNrWord;
static const int TriggerTypeWord;
static const int StatusWord;
static const int LuminositySegmentNrWord;
// mask to get the 64-bit-value from the corresponding word in the TCS block
static const cms_uint64_t BoardIdMask;
static const cms_uint64_t BxNrMask;
static const cms_uint64_t DaqNrMask;
static const cms_uint64_t TriggerTypeMask;
static const cms_uint64_t StatusMask;
static const cms_uint64_t LuminositySegmentNrMask;
// shift to the right to get the value from the "64-bit-value"
static const int BoardIdShift;
static const int BxNrShift;
static const int DaqNrShift;
static const int TriggerTypeShift;
static const int StatusShift;
static const int LuminositySegmentNrShift;
// word 1
static const int PartRunNrWord;
static const int AssignedPartitionsWord;
static const cms_uint64_t PartRunNrMask;
static const cms_uint64_t AssignedPartitionsMask;
static const int PartRunNrShift;
static const int AssignedPartitionsShift;
// word 2
static const int PartTrigNrWord;
static const int EventNrWord;
static const cms_uint64_t PartTrigNrMask;
static const cms_uint64_t EventNrMask;
static const int PartTrigNrShift;
static const int EventNrShift;
// word 3
static const int OrbitNrWord;
static const cms_uint64_t OrbitNrMask;
static const int OrbitNrShift;
// word 4
// empty
private:
/// board identifier
cms_uint16_t m_boardId;
/// bunch cross number as counted in the TCS chip
cms_uint16_t m_bxNr;
/// number of DAQ partition to which the L1A has been sent
cms_uint16_t m_daqNr;
/// trigger type, identical with event type in CMS header (event type)
cms_uint16_t m_triggerType;
/// 0000 = normal rate; 1000 = low rate = warning
cms_uint16_t m_status;
/// luminosity segment number
cms_uint16_t m_luminositySegmentNr;
//
/// partition run number
cms_uint32_t m_partRunNr;
/// bit "i" correspond to detector partition "i"
/// if bit = 1, detection partition connected to actual
/// DAQ partition
cms_uint32_t m_assignedPartitions;
//
/// total number of L1A sent since start of the run
/// to this DAQ partition
cms_uint32_t m_partTrigNr;
/// event number since last L1 reset generated in TCS chip
cms_uint32_t m_eventNr;
//
/// orbit number since start of run (48 bits, in fact)
cms_uint64_t m_orbitNr;
//
// empty word
};
#endif /*L1GlobalTrigger_L1TcsWord_h*/
|