CMS 3D CMS Logo

L1GtPsbWord.h
Go to the documentation of this file.
1 #ifndef L1GlobalTrigger_L1GtPsbWord_h
2 #define L1GlobalTrigger_L1GtPsbWord_h
3 
18 // system include files
19 #include <iosfwd>
20 
21 // user include files
25 
26 // forward declarations
27 
28 // class declaration
29 class L1GtPsbWord {
30 public:
31  static const int NumberAData = 8;
32  static const int NumberBData = 8;
33 
34 public:
36  L1GtPsbWord(); // empty constructor, all members set to zero;
37 
39  L1GtPsbWord(cms_uint16_t boardIdValue,
40  int bxInEventValue,
41  cms_uint16_t bxNrValue,
42  cms_uint32_t eventNrValue,
43  cms_uint16_t aDataValue[NumberAData],
44  cms_uint16_t bDataValue[NumberBData],
45  cms_uint16_t localBxNrValue);
46 
48  virtual ~L1GtPsbWord();
49 
51  bool operator==(const L1GtPsbWord&) const;
52 
54  bool operator!=(const L1GtPsbWord&) const;
55 
56 public:
58  inline const cms_uint16_t boardId() const { return m_boardId; }
59 
60  void setBoardId(cms_uint16_t boardIdValue) { m_boardId = boardIdValue; }
61 
64  void setBoardId(const cms_uint64_t& word64, int iWord);
65 
68  void setBoardIdWord64(cms_uint64_t& word64, int iWord);
69 
71  inline const int bxInEvent() const { return m_bxInEvent; }
72 
73  void setBxInEvent(int bxInEventValue) { m_bxInEvent = bxInEventValue; }
74 
77  void setBxInEvent(const cms_uint64_t& word64, int iWord);
78 
81  void setBxInEventWord64(cms_uint64_t& word64, int iWord);
82 
84  inline const cms_uint16_t bxNr() const { return m_bxNr; }
85 
86  void setBxNr(cms_uint16_t bxNrValue) { m_bxNr = bxNrValue; }
87 
90  void setBxNr(const cms_uint64_t& word64, int iWord);
91 
94  void setBxNrWord64(cms_uint64_t& word64, int iWord);
95 
97  inline const cms_uint32_t eventNr() const { return m_eventNr; }
98 
99  void setEventNr(cms_uint32_t eventNrValue) { m_eventNr = eventNrValue; }
100 
103  void setEventNr(const cms_uint64_t& word64, int iWord);
104 
107  void setEventNrWord64(cms_uint64_t& word64, int iWord);
108 
110  const cms_uint16_t aData(int iA) const;
111  void setAData(cms_uint16_t aDataVal, int iA);
112 
115  void setAData(const cms_uint64_t& word64, int iWord);
116 
119  void setADataWord64(cms_uint64_t& word64, int iWord);
120 
122  const cms_uint16_t bData(int iB) const;
123  void setBData(cms_uint16_t bDataVal, int iB);
124 
127  void setBData(const cms_uint64_t& word64, int iWord);
128 
131  void setBDataWord64(cms_uint64_t& word64, int iWord);
132 
134  inline const cms_uint16_t localBxNr() const { return m_localBxNr; }
135 
136  void setLocalBxNr(cms_uint16_t localBxNrValue) { m_localBxNr = localBxNrValue; }
137 
140  void setLocalBxNr(const cms_uint64_t& word64, int iWord);
141 
144  void setLocalBxNrWord64(cms_uint64_t& word64, int iWord);
145 
147  inline const unsigned int getSize() const {
148  int unitLengthBits = L1GlobalTriggerReadoutSetup::UnitLength;
149 
150  return BlockSize * unitLengthBits;
151  }
152 
153 public:
155  void reset();
156 
158  void print(std::ostream& myCout) const;
159 
160 private:
161  // block description in the raw GT record
162 
163  // block size in 64bits words (BlockSize * 64 bits)
164  static const int BlockSize = 6;
165 
166  // word 0
167 
168  // index of the word in the PSB block containig the variable
169  static const int BoardIdWord = 0;
170  static const int BxInEventWord = 0;
171  static const int BxNrWord = 0;
172  static const int EventNrWord = 0;
173 
174  // mask to get the 64-bit-value from the corresponding word in the PSB block
175  static const cms_uint64_t BoardIdMask = 0xFFFF000000000000ULL;
176  static const cms_uint64_t BxInEventMask = 0x0000F00000000000ULL;
177  static const cms_uint64_t BxNrMask = 0x00000FFF00000000ULL;
178  static const cms_uint64_t EventNrMask = 0x0000000000FFFFFFULL;
179 
180  // shift to the right to get the value from the "64-bit-value"
181  static const int BoardIdShift = 48;
182  static const int BxInEventShift = 44;
183  static const int BxNrShift = 32;
184  static const int EventNrShift = 0;
185 
186  // assume uniform size od A_Data and B_Data
187  static const int DataCHSize = 16; // bits
188  static const cms_uint64_t DataCHMask = 0x000000000000FFFFULL;
189 
190  // word 1
191  static const int ADataCH0Word = 1;
192 
193  // word 2
194  static const int ADataCH4Word = 2;
195 
196  // word 3
197  static const int BDataCH0Word = 3;
198 
199  // word 4
200  static const int BDataCH4Word = 4;
201 
202  // word 5
203  static const int LocalBxNrWord = 5;
204  static const cms_uint64_t LocalBxNrMask = 0x0000000000000FFFULL;
205  static const int LocalBxNrShift = 0;
206 
207 private:
208  // first number in the comment represents number of bits
209 
210  cms_uint16_t m_boardId; // 16: board identifier
211  //
212  int m_bxInEvent; // 4: bunch cross in the GT event record
213  // one keeps 3 bx (F, 0, 1) for standard record,
214  // 5 bx (E, F, 0, 1) for debug record
215  //
216  cms_uint16_t m_bxNr; // 12: bunch cross number of the actual bx
217  cms_uint32_t m_eventNr; // 24: event number since last L1 reset generated in PSB
218  //
219  cms_uint16_t m_aData[NumberAData]; // 16: A_Data_ChX
220  //
221  cms_uint16_t m_bData[NumberBData]; // 16: B_Data_ChX
222  //
223  cms_uint16_t m_localBxNr; // 12: local bunch cross number of the actual bx
224  // bx number at which the data were written into the ringbuffer
225 };
226 
227 #endif /*L1GlobalTrigger_L1GtPsbWord_h*/
const cms_uint16_t bData(int iB) const
get/set B_DATA_CH_IB
Definition: L1GtPsbWord.cc:253
const cms_uint16_t bxNr() const
get/set bunch cross number of the actual bx
Definition: L1GtPsbWord.h:84
static const int LocalBxNrWord
Definition: L1GtPsbWord.h:203
static const int BlockSize
Definition: L1GtPsbWord.h:164
static const int BoardIdShift
Definition: L1GtPsbWord.h:181
void setEventNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtPsbWord.cc:173
void reset()
reset the content of a L1GtPsbWord
Definition: L1GtPsbWord.cc:330
const cms_uint16_t boardId() const
get/set board ID
Definition: L1GtPsbWord.h:58
static const int BDataCH0Word
Definition: L1GtPsbWord.h:197
static const cms_uint64_t BoardIdMask
Definition: L1GtPsbWord.h:175
static const int UnitLength
one unit in the word is UnitLength bits
cms_uint16_t m_localBxNr
Definition: L1GtPsbWord.h:223
static const int EventNrWord
Definition: L1GtPsbWord.h:172
void setBData(cms_uint16_t bDataVal, int iB)
Definition: L1GtPsbWord.cc:263
static const cms_uint64_t LocalBxNrMask
Definition: L1GtPsbWord.h:204
void setBxNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtPsbWord.cc:158
static const int BoardIdWord
Definition: L1GtPsbWord.h:169
static const cms_uint64_t BxInEventMask
Definition: L1GtPsbWord.h:176
cms_uint16_t m_bData[NumberBData]
Definition: L1GtPsbWord.h:221
static const int BxInEventShift
Definition: L1GtPsbWord.h:182
void setBxInEventWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtPsbWord.cc:141
void setEventNr(cms_uint32_t eventNrValue)
Definition: L1GtPsbWord.h:99
static const int DataCHSize
Definition: L1GtPsbWord.h:187
void setBxNr(cms_uint16_t bxNrValue)
Definition: L1GtPsbWord.h:86
void setADataWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtPsbWord.cc:233
const cms_uint16_t aData(int iA) const
get/set A_DATA_CH_IA
Definition: L1GtPsbWord.cc:181
void setBoardId(cms_uint16_t boardIdValue)
Definition: L1GtPsbWord.h:60
bool operator==(const L1GtPsbWord &) const
equal operator
Definition: L1GtPsbWord.cc:74
cms_uint32_t m_eventNr
Definition: L1GtPsbWord.h:217
void setLocalBxNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtPsbWord.cc:323
void setBxInEvent(int bxInEventValue)
Definition: L1GtPsbWord.h:73
virtual ~L1GtPsbWord()
destructor
Definition: L1GtPsbWord.cc:69
unsigned short cms_uint16_t
Definition: typedefs.h:13
cms_uint16_t m_bxNr
Definition: L1GtPsbWord.h:216
const cms_uint16_t localBxNr() const
get/set local bunch cross number of the actual bx
Definition: L1GtPsbWord.h:134
void setBDataWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtPsbWord.cc:295
unsigned int cms_uint32_t
Definition: typedefs.h:15
L1GtPsbWord()
constructors
Definition: L1GtPsbWord.cc:27
static const int LocalBxNrShift
Definition: L1GtPsbWord.h:205
void print(std::ostream &myCout) const
pretty print
Definition: L1GtPsbWord.cc:348
const cms_uint32_t eventNr() const
get/set event number since last L1 reset generated in PSB
Definition: L1GtPsbWord.h:97
static const cms_uint64_t DataCHMask
Definition: L1GtPsbWord.h:188
static const int BxInEventWord
Definition: L1GtPsbWord.h:170
static const int NumberBData
Definition: L1GtPsbWord.h:32
static const cms_uint64_t EventNrMask
Definition: L1GtPsbWord.h:178
const int bxInEvent() const
get/set bunch cross in the GT event record
Definition: L1GtPsbWord.h:71
static const int ADataCH0Word
Definition: L1GtPsbWord.h:191
static const int EventNrShift
Definition: L1GtPsbWord.h:184
static const int BDataCH4Word
Definition: L1GtPsbWord.h:200
static const int BxNrWord
Definition: L1GtPsbWord.h:171
static const int NumberAData
Definition: L1GtPsbWord.h:31
bool operator!=(const L1GtPsbWord &) const
unequal operator
Definition: L1GtPsbWord.cc:109
void setLocalBxNr(cms_uint16_t localBxNrValue)
Definition: L1GtPsbWord.h:136
static const cms_uint64_t BxNrMask
Definition: L1GtPsbWord.h:177
unsigned long long cms_uint64_t
Definition: typedefs.h:17
cms_uint16_t m_boardId
Definition: L1GtPsbWord.h:210
cms_uint16_t m_aData[NumberAData]
Definition: L1GtPsbWord.h:219
void setAData(cms_uint16_t aDataVal, int iA)
Definition: L1GtPsbWord.cc:191
void setBoardIdWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtPsbWord.cc:123
static const int ADataCH4Word
Definition: L1GtPsbWord.h:194
static const int BxNrShift
Definition: L1GtPsbWord.h:183
const unsigned int getSize() const
get the size of the PSB block in GT DAQ record (in multiple of 8 bits)
Definition: L1GtPsbWord.h:147