CbmRoot
StsXyterMessage.h
Go to the documentation of this file.
1 /************************************************************
2  *
3  ************************************************************/
4 
5 #ifndef STSXYTERMESSAGE_H
6 #define STSXYTERMESSAGE_H
7 
8 // C/C++ headers
9 #include <iostream>
10 #include <stdint.h>
11 
12 namespace stsxyter {
13 
14 // tools: Use to this allow bitwise operations on C++11 enums
15 // This needs to be included in the same namespace to work...
16 #include "bitmask_operators.hpp"
17 
20  struct MessField {
21  uint16_t fusPos;
22  uint16_t fusLen;
23 
24  MessField(uint16_t usPos, uint16_t usLen) : fusPos(usPos), fusLen(usLen) {};
25  };
27  enum class MessType : uint16_t {
28  Dummy,
29  Hit,
30  TsMsb,
31  Epoch,
32  Status,
33  Empty,
34  EndOfMs
35  };
37  enum class MessSubType : uint16_t {
38  TsMsb = 0,
39  Epoch = 1,
40  Status = 2,
41  Empty = 3
42  };
44  enum class MessagePrintMask : uint16_t {
45  msg_print_Prefix = (0x1 << 0),
46  msg_print_Data = (0x1 << 1),
47  msg_print_Hex = (0x1 << 2),
48  msg_print_Human = (0x1 << 3)
49  };
50  ENABLE_BITMASK_OPERATORS(stsxyter::MessagePrintMask) // Preproc macro!
52  enum class MsErrorFlags : uint16_t {
53  MsErrOutFifoAlmostFull = (0x1 << 0),
54  MsErrOutFifoOverflow = (0x1 << 1),
55  MsErrTimeoutBinReadout = (0x1 << 2),
56  MsErrBinOverflow = (0x1 << 3)
57  };
58 
60  static const uint16_t kusPosNotHitFlag = 31;
61  static const uint16_t kusPosLinkIndex = 22;
62  // Hit message
63  static const uint16_t kusPosHitChannel = 15;
64  static const uint16_t kusPosHitAdc = 10;
65  static const uint16_t kusPosHitTsOver = 9;
66  static const uint16_t kusPosHitTs = 1;
67  static const uint16_t kusPosHitEmFlag = 0;
68  // Non-hit messages
69  static const uint16_t kusPosSubtype = 29;
70  // TS_MSB message
71  static const uint16_t kusPosTsMsbVal = 0;
72  // Epoch
73  static const uint16_t kusPosEpochVal = 0;
74  // Status
75  static const uint16_t kusPosStatLinkId = 20;
76  static const uint16_t kusPosStatSxTs = 14;
77  static const uint16_t kusPosStatStatus = 10;
78  static const uint16_t kusPosStatDpbTs = 1;
79  static const uint16_t kusPosStatCpFlag = 0;
80  // Empty/End of MS
81  static const uint16_t kusPosEmptyFlag = 28;
82  static const uint16_t kusPosMsErrType = 1;
83  static const uint16_t kusPosMsErrFlag = 0;
84 
86  static const uint16_t kusLenNotHitFlag = 1;
87  static const uint16_t kusLenLinkIndex = 9;
88  // Hit message
89  static const uint16_t kusLenHitChannel = 7;
90  static const uint16_t kusLenHitAdc = 5;
91  static const uint16_t kusLenHitTsFull =
92  9; // Includes 1 bit overlap with TS message ?
93  static const uint16_t kusLenHitTsOver = 0; // 0 bit overlap with TS message
94  static const uint16_t kusLenHitTs = 9; // No overlap in this version of FW
95  static const uint16_t kusLenHitEmFlag = 1;
96  // Other message
97  static const uint16_t kusLenSubtype = 2;
98  // TS_MSB message
99  static const uint16_t kusLenTsMsbVal = 22;
100  static const uint16_t kusLenTsMsbValBinning = 29;
101  // Epoch
102  static const uint16_t kusLenEpochVal = 29;
103  // Status
104  static const uint16_t kusLenStatLinkId = 9;
105  static const uint16_t kusLenStatSxTs = 6;
106  static const uint16_t kusLenStatStatus = 4;
107  static const uint16_t kusLenStatDpbTs = 9;
108  static const uint16_t kusLenStatCpFlag = 1;
109  // Empty/End of MS
110  static const uint16_t kusLenEmptyFlag = 1;
111  static const uint16_t kusLenMsErrType = 4;
112  static const uint16_t kusLenMsErrFlag = 1;
113 
117  // Hit message
124  // Non-hit messages
126  // TS_MSB message
130  // Epoch message
132  // Status
138  // Empty/End of MS
142 
144  static const uint32_t kuHitNbAdcBins =
145  (0 < kusLenHitAdc ? 1 << kusLenHitAdc : 0);
146  static const uint32_t kuHitNbTsBins =
147  (0 < kusLenHitTs ? 1 << kusLenHitTs : 0);
148  static const uint32_t kuHitNbOverBins =
149  (0 < kusLenHitTsOver ? 1 << kusLenHitTsOver : 0);
150  static const uint32_t kuTsMsbNbTsBins =
151  (0 < kusLenTsMsbVal ? 1 << kusLenTsMsbVal : 0);
152  static const uint64_t kulTsCycleNbBins =
153  static_cast<uint64_t>(kuTsMsbNbTsBins)
154  * static_cast<uint64_t>(kuHitNbTsBins);
155  static const uint16_t kusMaskTsMsbOver = (1 << kusLenHitTsOver) - 1;
156  static const double kdClockCycleNs =
157  3.125; // ns, equivalent to 2*160 MHz clock
160  static const uint32_t kuHitNbTsBinsBinning = 1 << 10;
161  static const uint64_t kulTsCycleNbBinsBinning =
162  static_cast<uint64_t>(1 << kusLenTsMsbValBinning)
163  * static_cast<uint64_t>(kuHitNbTsBinsBinning);
164 
165  class Message {
166  private:
167  protected:
168  uint32_t fuData; // main and only storage field for the message
169 
170  public:
171  Message() : fuData(0) {}
172 
173  Message(const Message& src) : fuData(src.fuData) {}
174 
175  Message(uint32_t uDataIn) : fuData(uDataIn) {}
176 
177  ~Message() {};
178 
179  void assign(const Message& src) { fuData = src.fuData; }
180 
181  Message& operator=(const Message& src) {
182  assign(src);
183  return *this;
184  }
185 
186  inline void reset() { fuData = 0; }
187 
188  // --------------------------- Accessors ---------------------------------
189  inline uint32_t GetData() const { return fuData; }
190  inline void SetData(uint32_t uValue) { fuData = uValue; }
191 
192  inline uint32_t GetField(uint32_t uShift, uint32_t uLen) const {
193  return (fuData >> uShift) & (((static_cast<uint32_t>(1)) << uLen) - 1);
194  }
195 
196  inline uint8_t GetBit(uint32_t uShift) const {
197  return (fuData >> uShift) & 1;
198  }
199 
200  inline uint32_t GetFieldBE(uint32_t uShift, uint32_t uLen) const {
201  return (DataBE() >> uShift) & (((static_cast<uint32_t>(1)) << uLen) - 1);
202  }
203  inline uint8_t GetBitBE(uint32_t uShift) const {
204  return (DataBE() >> uShift) & 1;
205  }
206  inline uint32_t DataBE() const {
207  return ((fuData & 0x000000FF) << 24) + ((fuData & 0x0000FF00) << 8)
208  + ((fuData >> 8) & 0x0000FF00) + ((fuData >> 24) & 0x000000FF);
209  }
210 
211  // --------------------------- Setters ---------------------------------------
212  inline void SetField(uint32_t uShift, uint32_t uLen, uint32_t uValue) {
213  fuData =
214  (fuData & ~((((static_cast<uint32_t>(1)) << uLen) - 1) << uShift))
215  | ((static_cast<uint64_t>(uValue)) << uShift);
216  }
217 
218  inline void SetBit(uint32_t uShift, uint8_t uValue) {
219  fuData = uValue ? (fuData | ((static_cast<uint32_t>(1)) << uShift))
220  : (fuData & ~((static_cast<uint32_t>(1)) << uShift));
221  }
222 
223  // --------------------------- Simplified Acc_or/Setters ---------------------
224  inline uint32_t GetField(MessField field) const {
225  return GetField(field.fusPos, field.fusLen);
226  }
227  inline uint8_t GetBit(MessField field) const {
228  return GetBit(field.fusPos);
229  }
230  inline bool GetFlag(MessField field) const {
231  return (1 == GetBit(field.fusPos));
232  }
233  inline uint32_t GetFieldBE(MessField field) const {
234  return GetFieldBE(field.fusPos, field.fusLen);
235  }
236  inline uint8_t GetBitBE(MessField field) const {
237  return GetBitBE(field.fusPos);
238  }
239 
240  inline void SetField(MessField field, uint32_t uValue) {
241  SetField(field.fusPos, field.fusLen, uValue);
242  }
243  inline void SetBit(MessField field, uint8_t ucValue) {
244  SetBit(field.fusPos, ucValue);
245  }
246 
247  // --------------------------- common fields ---------------------------------
249  inline uint16_t GetLinkIndex() const { return GetField(kFieldLinkIndex); }
251  inline bool IsHit() const { return !GetFlag(kFieldNotHitFlag); }
253  inline bool IsDummy() const { return IsHit() && (0 == GetHitAdc()); }
255  inline bool IsTsMsb() const {
256  return (!IsHit() && MessSubType::TsMsb == GetSubType());
257  }
259  inline MessType GetMessType() const {
260  return !GetFlag(kFieldNotHitFlag)
269  : MessType::EndOfMs))));
270  }
271 
272  // ------------------------ Hit message fields -------------------------------
274  inline uint16_t GetHitChannel() const { return GetField(kFieldHitChannel); }
275 
277  inline uint16_t GetHitAdc() const { return GetField(kFieldHitAdc); }
278 
280  inline uint16_t GetHitTimeFull() const { return GetField(kFieldHitTsFull); }
281 
283  inline uint16_t GetHitTimeOver() const { return GetField(kFieldHitTsOver); }
284 
286  inline uint16_t GetHitTime() const { return GetField(kFieldHitTs); }
287 
290  inline uint16_t GetHitTimeBinning() const {
291  return ((static_cast<uint16_t>(GetBit(30)) << 9) + GetField(kFieldHitTs));
292  }
293 
296  inline uint16_t GetLinkIndexHitBinning() const {
297  return GetField(kFieldLinkIndex) & 0x3F;
298  }
299 
301  inline bool IsHitMissedEvts() const { return GetFlag(kFieldHitEmFlag); }
302 
304  inline void SetHitChannel(uint16_t usVal) {
305  SetField(kFieldHitChannel, usVal);
306  }
307 
309  inline void SetHitAdc(uint16_t usVal) { SetField(kFieldHitAdc, usVal); }
310 
312  inline void SetHitTimeFull(uint16_t usVal) {
313  SetField(kFieldHitTsFull, usVal);
314  }
315 
317  inline void SetHitTimeOver(uint16_t usVal) {
318  SetField(kFieldHitTsOver, usVal);
319  }
320 
322  inline void SetHitTime(uint16_t usVal) { SetField(kFieldHitTs, usVal); }
323 
325  inline void SetHitMissEvtsFlag(bool bVal) { SetBit(kFieldHitEmFlag, bVal); }
326 
327  // ----------------------- Non-Hit message fields ----------------------------
329  // inline MessSubType GetSubType() const { return static_cast< uint16_t >( GetField( kFieldSubtype ) ); }
330  MessSubType GetSubType() const;
331 
332  // ------------------------ TS_MSB message fields ----------------------------
334  inline uint32_t GetTsMsbVal() const { return GetField(kFieldTsMsbVal); }
335 
337  inline uint32_t GetTsMsbValBinning() const {
339  }
340 
342  inline void SetTsMsbVal(uint32_t uVal) { SetField(kFieldTsMsbVal, uVal); }
343 
344  // ------------------------ Epoch message fields -----------------------------
346  inline uint32_t GetEpochVal() const { return GetField(kFieldEpochVal); }
347 
349  inline void SetEpochVal(uint32_t uVal) { SetField(kFieldEpochVal, uVal); }
350 
351  // ------------------------ Status message fields ----------------------------
353  inline uint16_t GetStatusLink() const { return GetField(kFieldStatLinkId); }
354 
356  inline uint16_t GetStatusSxTs() const { return GetField(kFieldStatSxTs); }
357 
359  inline uint16_t GetStatusStatus() const {
360  return GetField(kFieldStatStatus);
361  }
362 
364  inline uint16_t GetStatusDpbTs() const { return GetField(kFieldStatDpbTs); }
365 
367  inline bool IsCpFlagOn() const { return GetField(kFieldStatCpFlag); }
368 
370  inline void SetStatusLink(uint16_t usVal) {
371  SetField(kFieldStatLinkId, usVal);
372  }
373 
375  inline void SetStatusSxTs(uint16_t usVal) {
376  SetField(kFieldStatSxTs, usVal);
377  }
378 
380  inline void SetStatusStatus(uint16_t usVal) {
381  SetField(kFieldStatStatus, usVal);
382  }
383 
385  inline void SetStatusDpbTs(uint16_t usVal) {
386  SetField(kFieldStatDpbTs, usVal);
387  }
388 
390  inline void SetCpFlag(bool bVal) { SetField(kFieldStatCpFlag, bVal); }
391 
392  // -------------------- Empty/End of MS message fields -----------------------
394  inline bool IsEmptyMsg() const { return GetField(kFieldEmptyFlag); }
395 
397  inline bool IsMsErrorFlagOn() const { return GetField(kFieldMsErrFlag); }
398 
400  inline uint16_t GetMsErrorType() const { return GetField(kFieldMsErrType); }
401 
403  inline void SetEmptyMsgFlag(bool bVal) { SetField(kFieldEmptyFlag, bVal); }
404 
406  inline void SetMsErrorFlag(bool bVal) { SetField(kFieldMsErrFlag, bVal); }
407 
409  inline void SetMsErrorType(uint16_t usVal) {
410  SetField(kFieldMsErrType, usVal);
411  }
412 
413  // ------------------------ General OP ---------------------------------------
414  bool
415  PrintMess(std::ostream& os,
417  };
418 } // namespace stsxyter
419 #endif // STSXYTERMESSAGE_H
stsxyter::Message::IsTsMsb
bool IsTsMsb() const
Check if the message if a Ts_Msb.
Definition: StsXyterMessage.h:255
stsxyter::kFieldNotHitFlag
static const MessField kFieldNotHitFlag(kusPosNotHitFlag, kusLenNotHitFlag)
stsxyter::Message::SetTsMsbVal
void SetTsMsbVal(uint32_t uVal)
For TS MSB data: Sets the TS MSB (22 bit field)
Definition: StsXyterMessage.h:342
stsxyter::kusPosHitAdc
static const uint16_t kusPosHitAdc
Definition: StsXyterMessage.h:64
stsxyter::Message::SetData
void SetData(uint32_t uValue)
Definition: StsXyterMessage.h:190
stsxyter::kusPosTsMsbVal
static const uint16_t kusPosTsMsbVal
Definition: StsXyterMessage.h:71
stsxyter::MessagePrintMask::msg_print_Hex
@ msg_print_Hex
stsxyter::kusLenStatLinkId
static const uint16_t kusLenStatLinkId
Definition: StsXyterMessage.h:104
stsxyter::Message::GetBit
uint8_t GetBit(uint32_t uShift) const
Definition: StsXyterMessage.h:196
stsxyter::Message::GetStatusDpbTs
uint16_t GetStatusDpbTs() const
For Status data: Returns the DPB TS when frame received (9 bit field)
Definition: StsXyterMessage.h:364
stsxyter::kFieldHitAdc
static const MessField kFieldHitAdc(kusPosHitAdc, kusLenHitAdc)
stsxyter::kusPosHitTs
static const uint16_t kusPosHitTs
Definition: StsXyterMessage.h:66
stsxyter::Message::SetMsErrorFlag
void SetMsErrorFlag(bool bVal)
For End of MS data data: Sets the MS Error flag (1 bit field)
Definition: StsXyterMessage.h:406
stsxyter::Message::SetHitChannel
void SetHitChannel(uint16_t usVal)
For Hit data: Sets StsXYTER channel number (7 bit field)
Definition: StsXyterMessage.h:304
stsxyter::kFieldStatLinkId
static const MessField kFieldStatLinkId(kusPosStatLinkId, kusLenStatLinkId)
stsxyter::kFieldHitEmFlag
static const MessField kFieldHitEmFlag(kusPosHitEmFlag, kusLenHitEmFlag)
stsxyter::kusPosHitTsOver
static const uint16_t kusPosHitTsOver
Definition: StsXyterMessage.h:65
stsxyter::Message
Definition: StsXyterMessage.h:165
stsxyter::Message::fuData
uint32_t fuData
Definition: StsXyterMessage.h:168
stsxyter::kusPosStatCpFlag
static const uint16_t kusPosStatCpFlag
Definition: StsXyterMessage.h:79
stsxyter::kusLenStatCpFlag
static const uint16_t kusLenStatCpFlag
Definition: StsXyterMessage.h:108
stsxyter::MessType::Status
@ Status
stsxyter::kuTsMsbNbTsBins
static const uint32_t kuTsMsbNbTsBins
Definition: StsXyterMessage.h:150
stsxyter::kFieldHitTsFull
static const MessField kFieldHitTsFull(kusPosHitTs, kusLenHitTsFull)
stsxyter::Message::SetField
void SetField(MessField field, uint32_t uValue)
Definition: StsXyterMessage.h:240
stsxyter::Message::SetStatusSxTs
void SetStatusSxTs(uint16_t usVal)
For Status data: Sets the Status (6 bit field)
Definition: StsXyterMessage.h:375
stsxyter::kusPosMsErrFlag
static const uint16_t kusPosMsErrFlag
Definition: StsXyterMessage.h:83
stsxyter::kulTsCycleNbBinsBinning
static const uint64_t kulTsCycleNbBinsBinning
Definition: StsXyterMessage.h:161
stsxyter::kFieldEmptyFlag
static const MessField kFieldEmptyFlag(kusPosEmptyFlag, kusLenEmptyFlag)
stsxyter::kusLenHitTsOver
static const uint16_t kusLenHitTsOver
Definition: StsXyterMessage.h:93
stsxyter::Message::GetFlag
bool GetFlag(MessField field) const
Definition: StsXyterMessage.h:230
stsxyter::Message::GetLinkIndexHitBinning
uint16_t GetLinkIndexHitBinning() const
Definition: StsXyterMessage.h:296
stsxyter::MessSubType::Status
@ Status
stsxyter::Message::GetTsMsbVal
uint32_t GetTsMsbVal() const
For TS MSB data: Returns the TS MSB 22 bit field)
Definition: StsXyterMessage.h:334
stsxyter::Message::GetLinkIndex
uint16_t GetLinkIndex() const
For all data: Returns the (global) index of the eLink on which the message was received (n bit field)
Definition: StsXyterMessage.h:249
stsxyter::kusPosStatDpbTs
static const uint16_t kusPosStatDpbTs
Definition: StsXyterMessage.h:78
stsxyter::MessType
MessType
Message types.
Definition: StsXyterMessage.h:27
stsxyter::kulTsCycleNbBins
static const uint64_t kulTsCycleNbBins
Definition: StsXyterMessage.h:152
stsxyter::Message::GetHitTimeFull
uint16_t GetHitTimeFull() const
For Hit data: Returns Full timestamp (10 bit field including 2 bits overlap)
Definition: StsXyterMessage.h:280
stsxyter::Message::SetCpFlag
void SetCpFlag(bool bVal)
For Status data: Sets the Status (1 bit field)
Definition: StsXyterMessage.h:390
stsxyter::Message::SetHitMissEvtsFlag
void SetHitMissEvtsFlag(bool bVal)
For Hit data: Sets Missed event flag (1 bit field)
Definition: StsXyterMessage.h:325
stsxyter::kFieldTsMsbVal
static const MessField kFieldTsMsbVal(kusPosTsMsbVal, kusLenTsMsbVal)
stsxyter::MessField::fusLen
uint16_t fusLen
Start bit index.
Definition: StsXyterMessage.h:24
stsxyter::kFieldMsErrType
static const MessField kFieldMsErrType(kusPosMsErrType, kusLenMsErrType)
stsxyter::kusLenTsMsbVal
static const uint16_t kusLenTsMsbVal
Definition: StsXyterMessage.h:99
stsxyter::kusPosStatStatus
static const uint16_t kusPosStatStatus
Definition: StsXyterMessage.h:77
stsxyter::Message::IsHitMissedEvts
bool IsHitMissedEvts() const
For Hit data: Returns Missed event flag (1 bit field)
Definition: StsXyterMessage.h:301
stsxyter::Message::GetData
uint32_t GetData() const
Definition: StsXyterMessage.h:189
stsxyter::Message::SetHitAdc
void SetHitAdc(uint16_t usVal)
For Hit data: Sets ADC value (5 bit field)
Definition: StsXyterMessage.h:309
stsxyter::MessagePrintMask::msg_print_Data
@ msg_print_Data
stsxyter::Message::GetHitAdc
uint16_t GetHitAdc() const
For Hit data: Returns ADC value (5 bit field)
Definition: StsXyterMessage.h:277
stsxyter::kFieldHitChannel
static const MessField kFieldHitChannel(kusPosHitChannel, kusLenHitChannel)
stsxyter::Message::SetEpochVal
void SetEpochVal(uint32_t uVal)
For Epoch data: Sets the Epoch (29 bit field)
Definition: StsXyterMessage.h:349
stsxyter::Message::GetMsErrorType
uint16_t GetMsErrorType() const
For End of MS data: Returns the MS error type field (2 bit field)
Definition: StsXyterMessage.h:400
stsxyter::kFieldStatCpFlag
static const MessField kFieldStatCpFlag(kusPosStatCpFlag, kusLenStatCpFlag)
stsxyter::kusLenHitTsFull
static const uint16_t kusLenHitTsFull
Definition: StsXyterMessage.h:91
stsxyter::kusLenLinkIndex
static const uint16_t kusLenLinkIndex
Definition: StsXyterMessage.h:87
stsxyter::MessType::Empty
@ Empty
stsxyter::Message::GetEpochVal
uint32_t GetEpochVal() const
For Epoch data: Returns the Epoch (29 bit field)
Definition: StsXyterMessage.h:346
stsxyter::Message::SetStatusLink
void SetStatusLink(uint16_t usVal)
For Status data: Sets the Status (9 bit field)
Definition: StsXyterMessage.h:370
stsxyter::Message::GetStatusSxTs
uint16_t GetStatusSxTs() const
For Status data: Returns the SMX TS from ACK frame (6 bit field)
Definition: StsXyterMessage.h:356
stsxyter::kusPosEmptyFlag
static const uint16_t kusPosEmptyFlag
Definition: StsXyterMessage.h:81
stsxyter::kusPosHitChannel
static const uint16_t kusPosHitChannel
Definition: StsXyterMessage.h:63
stsxyter::kusLenHitChannel
static const uint16_t kusLenHitChannel
Definition: StsXyterMessage.h:89
stsxyter::Message::GetFieldBE
uint32_t GetFieldBE(uint32_t uShift, uint32_t uLen) const
Definition: StsXyterMessage.h:200
stsxyter::kuHitNbOverBins
static const uint32_t kuHitNbOverBins
Definition: StsXyterMessage.h:148
stsxyter::MessField
Definition: StsXyterMessage.h:20
stsxyter::kusLenMsErrFlag
static const uint16_t kusLenMsErrFlag
Definition: StsXyterMessage.h:112
stsxyter::MessType::Hit
@ Hit
stsxyter::Message::GetField
uint32_t GetField(MessField field) const
Definition: StsXyterMessage.h:224
stsxyter::kFieldMsErrFlag
static const MessField kFieldMsErrFlag(kusPosMsErrFlag, kusLenMsErrFlag)
stsxyter::Message::DataBE
uint32_t DataBE() const
Definition: StsXyterMessage.h:206
stsxyter::kusLenEmptyFlag
static const uint16_t kusLenEmptyFlag
Definition: StsXyterMessage.h:110
stsxyter::MessSubType::Epoch
@ Epoch
stsxyter::MessagePrintMask::msg_print_Prefix
@ msg_print_Prefix
stsxyter::kuHitNbTsBins
static const uint32_t kuHitNbTsBins
Definition: StsXyterMessage.h:146
stsxyter::Message::Message
Message(const Message &src)
Definition: StsXyterMessage.h:173
stsxyter::kusLenHitTs
static const uint16_t kusLenHitTs
Definition: StsXyterMessage.h:94
stsxyter::MessagePrintMask
MessagePrintMask
Printout control.
Definition: StsXyterMessage.h:44
stsxyter::Message::GetStatusStatus
uint16_t GetStatusStatus() const
For Status data: Returns the Status field from ACK frame (4 bit field)
Definition: StsXyterMessage.h:359
stsxyter::kusLenEpochVal
static const uint16_t kusLenEpochVal
Definition: StsXyterMessage.h:102
stsxyter::kusMaskTsMsbOver
static const uint16_t kusMaskTsMsbOver
Definition: StsXyterMessage.h:155
stsxyter::Message::GetFieldBE
uint32_t GetFieldBE(MessField field) const
Definition: StsXyterMessage.h:233
stsxyter::Message::SetField
void SetField(uint32_t uShift, uint32_t uLen, uint32_t uValue)
Definition: StsXyterMessage.h:212
stsxyter::kusPosHitEmFlag
static const uint16_t kusPosHitEmFlag
Definition: StsXyterMessage.h:67
stsxyter::Message::GetBitBE
uint8_t GetBitBE(MessField field) const
Definition: StsXyterMessage.h:236
stsxyter::Message::SetStatusDpbTs
void SetStatusDpbTs(uint16_t usVal)
For Status data: Sets the Status (9 bit field)
Definition: StsXyterMessage.h:385
stsxyter::kdClockCycleNs
static const double kdClockCycleNs
Definition: StsXyterMessage.h:156
stsxyter::MessField::fusPos
uint16_t fusPos
Definition: StsXyterMessage.h:23
stsxyter::kuHitNbTsBinsBinning
static const uint32_t kuHitNbTsBinsBinning
Definition: StsXyterMessage.h:160
stsxyter::Message::assign
void assign(const Message &src)
Definition: StsXyterMessage.h:179
stsxyter::Message::SetHitTime
void SetHitTime(uint16_t usVal)
For Hit data: Sets Full timestamp (8 bit field, 2 MSB bits overlap removed)
Definition: StsXyterMessage.h:322
stsxyter::Message::GetMessType
MessType GetMessType() const
Returns the message type, see enum MessType.
Definition: StsXyterMessage.h:259
stsxyter::kFieldLinkIndex
static const MessField kFieldLinkIndex(kusPosLinkIndex, kusLenLinkIndex)
Fields Info.
stsxyter::kusLenStatDpbTs
static const uint16_t kusLenStatDpbTs
Definition: StsXyterMessage.h:107
stsxyter::kFieldStatStatus
static const MessField kFieldStatStatus(kusPosStatStatus, kusLenStatStatus)
stsxyter::kusPosNotHitFlag
static ENABLE_BITMASK_OPERATORS(stsxyter::MessagePrintMask) enum class MsErrorFlags const uint16_t kusPosNotHitFlag
MS error flags.
Definition: StsXyterMessage.h:60
stsxyter::Message::Message
Message(uint32_t uDataIn)
Definition: StsXyterMessage.h:175
stsxyter::kFieldHitTs
static const MessField kFieldHitTs(kusPosHitTs, kusLenHitTs)
stsxyter::MessagePrintMask::msg_print_Human
@ msg_print_Human
stsxyter::kusLenHitEmFlag
static const uint16_t kusLenHitEmFlag
Definition: StsXyterMessage.h:95
stsxyter::MessSubType::Empty
@ Empty
stsxyter::Message::IsHit
bool IsHit() const
Check if the message if a Hit Message.
Definition: StsXyterMessage.h:251
stsxyter::MessSubType
MessSubType
Non-hit Message sub-types.
Definition: StsXyterMessage.h:37
stsxyter::Message::GetHitChannel
uint16_t GetHitChannel() const
For Hit data: Returns StsXYTER channel number (7 bit field)
Definition: StsXyterMessage.h:274
stsxyter::Message::GetStatusLink
uint16_t GetStatusLink() const
For Status data: Returns the Link Inedx (9 bit field)
Definition: StsXyterMessage.h:353
stsxyter::Message::PrintMess
bool PrintMess(std::ostream &os, MessagePrintMask ctrl=MessagePrintMask::msg_print_Human) const
Definition: StsXyterMessage.cxx:29
stsxyter::Message::IsDummy
bool IsDummy() const
Check if the message if a Dummy Hit Message.
Definition: StsXyterMessage.h:253
stsxyter::Message::GetField
uint32_t GetField(uint32_t uShift, uint32_t uLen) const
Definition: StsXyterMessage.h:192
stsxyter::Message::IsMsErrorFlagOn
bool IsMsErrorFlagOn() const
For End of MS data: Returns the MS error flag (1 bit field)
Definition: StsXyterMessage.h:397
stsxyter::kusPosEpochVal
static const uint16_t kusPosEpochVal
Definition: StsXyterMessage.h:73
stsxyter::MessSubType::TsMsb
@ TsMsb
stsxyter::kusLenNotHitFlag
static const uint16_t kusLenNotHitFlag
Fields length (bits)
Definition: StsXyterMessage.h:86
stsxyter::Message::GetHitTimeOver
uint16_t GetHitTimeOver() const
For Hit data: Returns timestamp overlap bits (2 bits field, overlap with 2 LSBs of TS_MSB message)
Definition: StsXyterMessage.h:283
stsxyter::Message::GetBitBE
uint8_t GetBitBE(uint32_t uShift) const
Definition: StsXyterMessage.h:203
stsxyter::Message::IsCpFlagOn
bool IsCpFlagOn() const
For Status data: Returns the CP flag from ACK frame (1 bit field)
Definition: StsXyterMessage.h:367
stsxyter::Message::GetBit
uint8_t GetBit(MessField field) const
Definition: StsXyterMessage.h:227
stsxyter::Message::SetStatusStatus
void SetStatusStatus(uint16_t usVal)
For Status data: Sets the Status (4 bit field)
Definition: StsXyterMessage.h:380
stsxyter::Message::GetSubType
MessSubType GetSubType() const
For non-Hit data: Returns subtype (2 bit field)
Definition: StsXyterMessage.cxx:20
stsxyter::MessType::TsMsb
@ TsMsb
stsxyter::kFieldEpochVal
static const MessField kFieldEpochVal(kusPosEpochVal, kusLenEpochVal)
stsxyter::Message::operator=
Message & operator=(const Message &src)
Definition: StsXyterMessage.h:181
stsxyter::kusLenHitAdc
static const uint16_t kusLenHitAdc
Definition: StsXyterMessage.h:90
stsxyter::Message::GetHitTime
uint16_t GetHitTime() const
For Hit data: Returns timestamp (8 bit field, 2 MSB bits overlap removed)
Definition: StsXyterMessage.h:286
stsxyter::MessType::Dummy
@ Dummy
stsxyter::kusLenSubtype
static const uint16_t kusLenSubtype
Definition: StsXyterMessage.h:97
stsxyter::Message::Message
Message()
Definition: StsXyterMessage.h:171
stsxyter::MessType::Epoch
@ Epoch
stsxyter::kFieldTsMsbValBinning
static const MessField kFieldTsMsbValBinning(kusPosTsMsbVal, kusLenTsMsbValBinning)
stsxyter::Message::SetBit
void SetBit(MessField field, uint8_t ucValue)
Definition: StsXyterMessage.h:243
stsxyter::Message::SetHitTimeOver
void SetHitTimeOver(uint16_t usVal)
For Hit data: Sets timestamp overlap bits (2 bits field, overlap with 2 LSBs of TS_MSB message)
Definition: StsXyterMessage.h:317
stsxyter::Message::reset
void reset()
Definition: StsXyterMessage.h:186
stsxyter::Message::GetTsMsbValBinning
uint32_t GetTsMsbValBinning() const
For TS MSB data: Returns the TS MSB 29 bit field)
Definition: StsXyterMessage.h:337
stsxyter::MessField::MessField
MessField(uint16_t usPos, uint16_t usLen)
Field length.
Definition: StsXyterMessage.h:26
stsxyter::kuHitNbAdcBins
static const uint32_t kuHitNbAdcBins
Status/properties constants.
Definition: StsXyterMessage.h:144
stsxyter::Message::SetEmptyMsgFlag
void SetEmptyMsgFlag(bool bVal)
For Empty/End of MS data data: Sets the Empty message flag (1 bit field)
Definition: StsXyterMessage.h:403
stsxyter::kusPosSubtype
static const uint16_t kusPosSubtype
Definition: StsXyterMessage.h:69
stsxyter::kusLenMsErrType
static const uint16_t kusLenMsErrType
Definition: StsXyterMessage.h:111
stsxyter::kFieldHitTsOver
static const MessField kFieldHitTsOver(kusPosHitTsOver, kusLenHitTsOver)
stsxyter::kusLenStatStatus
static const uint16_t kusLenStatStatus
Definition: StsXyterMessage.h:106
stsxyter
Definition: StsXyterFinalHit.h:12
stsxyter::Message::IsEmptyMsg
bool IsEmptyMsg() const
For Empty/End of MS data: Check if this is an empty message (1 bit field)
Definition: StsXyterMessage.h:394
stsxyter::kusPosStatLinkId
static const uint16_t kusPosStatLinkId
Definition: StsXyterMessage.h:75
stsxyter::kusLenTsMsbValBinning
static const uint16_t kusLenTsMsbValBinning
Definition: StsXyterMessage.h:100
stsxyter::kFieldStatDpbTs
static const MessField kFieldStatDpbTs(kusPosStatDpbTs, kusLenStatDpbTs)
stsxyter::Message::~Message
~Message()
Definition: StsXyterMessage.h:177
stsxyter::Message::SetMsErrorType
void SetMsErrorType(uint16_t usVal)
For End of MS data: Sets the MS error type field (2 bit field)
Definition: StsXyterMessage.h:409
stsxyter::kFieldStatSxTs
static const MessField kFieldStatSxTs(kusPosStatSxTs, kusLenStatSxTs)
stsxyter::MessType::EndOfMs
@ EndOfMs
stsxyter::kusPosMsErrType
static const uint16_t kusPosMsErrType
Definition: StsXyterMessage.h:82
stsxyter::kusPosLinkIndex
static const uint16_t kusPosLinkIndex
Definition: StsXyterMessage.h:61
stsxyter::kFieldSubtype
static const MessField kFieldSubtype(kusPosSubtype, kusLenSubtype)
stsxyter::kusLenStatSxTs
static const uint16_t kusLenStatSxTs
Definition: StsXyterMessage.h:105
stsxyter::Message::SetBit
void SetBit(uint32_t uShift, uint8_t uValue)
Definition: StsXyterMessage.h:218
stsxyter::kusPosStatSxTs
static const uint16_t kusPosStatSxTs
Definition: StsXyterMessage.h:76
stsxyter::Message::GetHitTimeBinning
uint16_t GetHitTimeBinning() const
Definition: StsXyterMessage.h:290
stsxyter::Message::SetHitTimeFull
void SetHitTimeFull(uint16_t usVal)
For Hit data: Sets Full timestamp (10 bit field including 2 bits overlap)
Definition: StsXyterMessage.h:312