Go to the documentation of this file.
5 #ifndef STSXYTERMESSAGE_H
6 #define STSXYTERMESSAGE_H
16 #include "bitmask_operators.hpp"
52 enum class MsErrorFlags : uint16_t {
53 MsErrOutFifoAlmostFull = (0x1 << 0),
54 MsErrOutFifoOverflow = (0x1 << 1),
55 MsErrTimeoutBinReadout = (0x1 << 2),
56 MsErrBinOverflow = (0x1 << 3)
192 inline uint32_t
GetField(uint32_t uShift, uint32_t uLen)
const {
193 return (
fuData >> uShift) & (((
static_cast<uint32_t
>(1)) << uLen) - 1);
196 inline uint8_t
GetBit(uint32_t uShift)
const {
197 return (
fuData >> uShift) & 1;
200 inline uint32_t
GetFieldBE(uint32_t uShift, uint32_t uLen)
const {
201 return (
DataBE() >> uShift) & (((
static_cast<uint32_t
>(1)) << uLen) - 1);
204 return (
DataBE() >> uShift) & 1;
207 return ((
fuData & 0x000000FF) << 24) + ((
fuData & 0x0000FF00) << 8)
208 + ((
fuData >> 8) & 0x0000FF00) + ((
fuData >> 24) & 0x000000FF);
212 inline void SetField(uint32_t uShift, uint32_t uLen, uint32_t uValue) {
214 (
fuData & ~((((
static_cast<uint32_t
>(1)) << uLen) - 1) << uShift))
215 | ((
static_cast<uint64_t
>(uValue)) << uShift);
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));
419 #endif // STSXYTERMESSAGE_H
bool IsTsMsb() const
Check if the message if a Ts_Msb.
static const MessField kFieldNotHitFlag(kusPosNotHitFlag, kusLenNotHitFlag)
void SetTsMsbVal(uint32_t uVal)
For TS MSB data: Sets the TS MSB (22 bit field)
static const uint16_t kusPosHitAdc
void SetData(uint32_t uValue)
static const uint16_t kusPosTsMsbVal
static const uint16_t kusLenStatLinkId
uint8_t GetBit(uint32_t uShift) const
uint16_t GetStatusDpbTs() const
For Status data: Returns the DPB TS when frame received (9 bit field)
static const MessField kFieldHitAdc(kusPosHitAdc, kusLenHitAdc)
static const uint16_t kusPosHitTs
void SetMsErrorFlag(bool bVal)
For End of MS data data: Sets the MS Error flag (1 bit field)
void SetHitChannel(uint16_t usVal)
For Hit data: Sets StsXYTER channel number (7 bit field)
static const MessField kFieldStatLinkId(kusPosStatLinkId, kusLenStatLinkId)
static const MessField kFieldHitEmFlag(kusPosHitEmFlag, kusLenHitEmFlag)
static const uint16_t kusPosHitTsOver
static const uint16_t kusPosStatCpFlag
static const uint16_t kusLenStatCpFlag
static const uint32_t kuTsMsbNbTsBins
static const MessField kFieldHitTsFull(kusPosHitTs, kusLenHitTsFull)
void SetField(MessField field, uint32_t uValue)
void SetStatusSxTs(uint16_t usVal)
For Status data: Sets the Status (6 bit field)
static const uint16_t kusPosMsErrFlag
static const uint64_t kulTsCycleNbBinsBinning
static const MessField kFieldEmptyFlag(kusPosEmptyFlag, kusLenEmptyFlag)
static const uint16_t kusLenHitTsOver
bool GetFlag(MessField field) const
uint16_t GetLinkIndexHitBinning() const
uint32_t GetTsMsbVal() const
For TS MSB data: Returns the TS MSB 22 bit field)
uint16_t GetLinkIndex() const
For all data: Returns the (global) index of the eLink on which the message was received (n bit field)
static const uint16_t kusPosStatDpbTs
static const uint64_t kulTsCycleNbBins
uint16_t GetHitTimeFull() const
For Hit data: Returns Full timestamp (10 bit field including 2 bits overlap)
void SetCpFlag(bool bVal)
For Status data: Sets the Status (1 bit field)
void SetHitMissEvtsFlag(bool bVal)
For Hit data: Sets Missed event flag (1 bit field)
static const MessField kFieldTsMsbVal(kusPosTsMsbVal, kusLenTsMsbVal)
uint16_t fusLen
Start bit index.
static const MessField kFieldMsErrType(kusPosMsErrType, kusLenMsErrType)
static const uint16_t kusLenTsMsbVal
static const uint16_t kusPosStatStatus
bool IsHitMissedEvts() const
For Hit data: Returns Missed event flag (1 bit field)
void SetHitAdc(uint16_t usVal)
For Hit data: Sets ADC value (5 bit field)
uint16_t GetHitAdc() const
For Hit data: Returns ADC value (5 bit field)
static const MessField kFieldHitChannel(kusPosHitChannel, kusLenHitChannel)
void SetEpochVal(uint32_t uVal)
For Epoch data: Sets the Epoch (29 bit field)
uint16_t GetMsErrorType() const
For End of MS data: Returns the MS error type field (2 bit field)
static const MessField kFieldStatCpFlag(kusPosStatCpFlag, kusLenStatCpFlag)
static const uint16_t kusLenHitTsFull
static const uint16_t kusLenLinkIndex
uint32_t GetEpochVal() const
For Epoch data: Returns the Epoch (29 bit field)
void SetStatusLink(uint16_t usVal)
For Status data: Sets the Status (9 bit field)
uint16_t GetStatusSxTs() const
For Status data: Returns the SMX TS from ACK frame (6 bit field)
static const uint16_t kusPosEmptyFlag
static const uint16_t kusPosHitChannel
static const uint16_t kusLenHitChannel
uint32_t GetFieldBE(uint32_t uShift, uint32_t uLen) const
static const uint32_t kuHitNbOverBins
static const uint16_t kusLenMsErrFlag
uint32_t GetField(MessField field) const
static const MessField kFieldMsErrFlag(kusPosMsErrFlag, kusLenMsErrFlag)
static const uint16_t kusLenEmptyFlag
static const uint32_t kuHitNbTsBins
Message(const Message &src)
static const uint16_t kusLenHitTs
MessagePrintMask
Printout control.
uint16_t GetStatusStatus() const
For Status data: Returns the Status field from ACK frame (4 bit field)
static const uint16_t kusLenEpochVal
static const uint16_t kusMaskTsMsbOver
uint32_t GetFieldBE(MessField field) const
void SetField(uint32_t uShift, uint32_t uLen, uint32_t uValue)
static const uint16_t kusPosHitEmFlag
uint8_t GetBitBE(MessField field) const
void SetStatusDpbTs(uint16_t usVal)
For Status data: Sets the Status (9 bit field)
static const double kdClockCycleNs
static const uint32_t kuHitNbTsBinsBinning
void assign(const Message &src)
void SetHitTime(uint16_t usVal)
For Hit data: Sets Full timestamp (8 bit field, 2 MSB bits overlap removed)
MessType GetMessType() const
Returns the message type, see enum MessType.
static const MessField kFieldLinkIndex(kusPosLinkIndex, kusLenLinkIndex)
Fields Info.
static const uint16_t kusLenStatDpbTs
static const MessField kFieldStatStatus(kusPosStatStatus, kusLenStatStatus)
static ENABLE_BITMASK_OPERATORS(stsxyter::MessagePrintMask) enum class MsErrorFlags const uint16_t kusPosNotHitFlag
MS error flags.
Message(uint32_t uDataIn)
static const MessField kFieldHitTs(kusPosHitTs, kusLenHitTs)
static const uint16_t kusLenHitEmFlag
bool IsHit() const
Check if the message if a Hit Message.
MessSubType
Non-hit Message sub-types.
uint16_t GetHitChannel() const
For Hit data: Returns StsXYTER channel number (7 bit field)
uint16_t GetStatusLink() const
For Status data: Returns the Link Inedx (9 bit field)
bool PrintMess(std::ostream &os, MessagePrintMask ctrl=MessagePrintMask::msg_print_Human) const
bool IsDummy() const
Check if the message if a Dummy Hit Message.
uint32_t GetField(uint32_t uShift, uint32_t uLen) const
bool IsMsErrorFlagOn() const
For End of MS data: Returns the MS error flag (1 bit field)
static const uint16_t kusPosEpochVal
static const uint16_t kusLenNotHitFlag
Fields length (bits)
uint16_t GetHitTimeOver() const
For Hit data: Returns timestamp overlap bits (2 bits field, overlap with 2 LSBs of TS_MSB message)
uint8_t GetBitBE(uint32_t uShift) const
bool IsCpFlagOn() const
For Status data: Returns the CP flag from ACK frame (1 bit field)
uint8_t GetBit(MessField field) const
void SetStatusStatus(uint16_t usVal)
For Status data: Sets the Status (4 bit field)
MessSubType GetSubType() const
For non-Hit data: Returns subtype (2 bit field)
static const MessField kFieldEpochVal(kusPosEpochVal, kusLenEpochVal)
Message & operator=(const Message &src)
static const uint16_t kusLenHitAdc
uint16_t GetHitTime() const
For Hit data: Returns timestamp (8 bit field, 2 MSB bits overlap removed)
static const uint16_t kusLenSubtype
static const MessField kFieldTsMsbValBinning(kusPosTsMsbVal, kusLenTsMsbValBinning)
void SetBit(MessField field, uint8_t ucValue)
void SetHitTimeOver(uint16_t usVal)
For Hit data: Sets timestamp overlap bits (2 bits field, overlap with 2 LSBs of TS_MSB message)
uint32_t GetTsMsbValBinning() const
For TS MSB data: Returns the TS MSB 29 bit field)
MessField(uint16_t usPos, uint16_t usLen)
Field length.
static const uint32_t kuHitNbAdcBins
Status/properties constants.
void SetEmptyMsgFlag(bool bVal)
For Empty/End of MS data data: Sets the Empty message flag (1 bit field)
static const uint16_t kusPosSubtype
static const uint16_t kusLenMsErrType
static const MessField kFieldHitTsOver(kusPosHitTsOver, kusLenHitTsOver)
static const uint16_t kusLenStatStatus
bool IsEmptyMsg() const
For Empty/End of MS data: Check if this is an empty message (1 bit field)
static const uint16_t kusPosStatLinkId
static const uint16_t kusLenTsMsbValBinning
static const MessField kFieldStatDpbTs(kusPosStatDpbTs, kusLenStatDpbTs)
void SetMsErrorType(uint16_t usVal)
For End of MS data: Sets the MS error type field (2 bit field)
static const MessField kFieldStatSxTs(kusPosStatSxTs, kusLenStatSxTs)
static const uint16_t kusPosMsErrType
static const uint16_t kusPosLinkIndex
static const MessField kFieldSubtype(kusPosSubtype, kusLenSubtype)
static const uint16_t kusLenStatSxTs
void SetBit(uint32_t uShift, uint8_t uValue)
static const uint16_t kusPosStatSxTs
uint16_t GetHitTimeBinning() const
void SetHitTimeFull(uint16_t usVal)
For Hit data: Sets Full timestamp (10 bit field including 2 bits overlap)