28 #ifndef STETOFMESSAGEFORMAT_H
29 #define STETOFMESSAGEFORMAT_H
44 const double kdClockCycleSize = 6250.0;
45 const double kdClockCycleSizeNs = kdClockCycleSize / 1000.0;
47 const double kdTotBinSize = 50.0;
49 const uint32_t kuFineTime = 0x0000007F;
50 const uint32_t kuFtShift = 0;
51 const uint32_t kuCoarseTime = 0x0007FF80;
52 const uint32_t kuCtShift = 7;
53 const uint32_t kuCtSize = 12;
55 const uint32_t kuFineCounterSize = ( (kuFineTime>>kuFtShift)+1 );
56 const uint32_t kuCoarseCounterSize = ( (kuCoarseTime>>kuCtShift)+1 );
57 const uint32_t kuCoarseOverflowTest = kuCoarseCounterSize / 2 ;
58 const uint32_t kuTotCounterSize = 256;
60 const double kdFtSize = kuFineCounterSize;
61 const double kdFtBinsNb = 112.;
64 const double kdBinSize = kdClockCycleSize /
static_cast<double>(kuFineCounterSize);
66 const uint32_t kuEpochInBins = kuFineTime + kuCoarseTime + 1;
69 const double kdEpochInPs =
static_cast<double>(kuEpochInBins)*kdBinSize;
70 const double kdEpochInNs = kdEpochInPs / 1000.0;
73 const uint32_t kuEpochCounterSz = 0x7FFFFFFF;
75 const uint64_t kulEpochCycleBins =
static_cast<uint64_t
>(kuEpochCounterSz + 1)* kuEpochInBins;
77 const double kdEpochCycleInS =
static_cast<double>(kuEpochCounterSz + 1) * (kdEpochInNs/1e9);
80 const uint64_t kulEpochCycleFieldSz = 0x1FFFFF;
82 const uint32_t kuChipIdMergedEpoch = 255;
84 const uint32_t kuFeePulserChannel = 3;
85 const uint32_t kuFeePulserChannelDiam = 0;
99 enum SysMessageTypes {
102 SYS_GET4_SYNC_MISS = 2,
107 enum PattMessageTypes {
114 enum MessagePrintMask {
115 msg_print_Prefix = 1,
121 enum MessagePrintType {
123 msg_print_FairLog = 2,
127 enum Get4Message32bSlC {
128 GET4_32B_SLC_SCALER = 0,
129 GET4_32B_SLC_DEADT = 1,
130 GET4_32B_SLC_SPIREAD = 2,
131 GET4_32B_SLC_START_SEU = 3
134 enum Get4Message32bErrors {
135 GET4_V2X_ERR_READ_INIT = 0x00,
136 GET4_V2X_ERR_SYNC = 0x01,
137 GET4_V2X_ERR_EP_CNT_SYNC = 0x02,
138 GET4_V2X_ERR_EP = 0x03,
139 GET4_V2X_ERR_FIFO_WRITE = 0x04,
140 GET4_V2X_ERR_LOST_EVT = 0x05,
141 GET4_V2X_ERR_CHAN_STATE = 0x06,
142 GET4_V2X_ERR_TOK_RING_ST = 0x07,
143 GET4_V2X_ERR_TOKEN = 0x08,
144 GET4_V2X_ERR_READOUT_ERR = 0x09,
145 GET4_V2X_ERR_SPI = 0x0A,
146 GET4_V2X_ERR_DLL_LOCK = 0x0B,
147 GET4_V2X_ERR_DLL_RESET = 0x0C,
148 GET4_V2X_ERR_TOT_OVERWRT = 0x11,
149 GET4_V2X_ERR_TOT_RANGE = 0x12,
150 GET4_V2X_ERR_EVT_DISCARD = 0x13,
151 GET4_V2X_ERR_ADD_RIS_EDG = 0x14,
152 GET4_V2X_ERR_UNPAIR_FALL = 0x15,
153 GET4_V2X_ERR_SEQUENCE_ER = 0x16,
154 GET4_V2X_ERR_EPOCH_OVERF = 0x17,
155 GET4_V2X_ERR_UNKNOWN = 0x7F
172 void assign(
const Message& src) {
data = src.data; }
174 Message& operator=(
const Message& src) { assign(src);
return *
this; }
176 inline void reset() {
data = 0; }
178 inline uint64_t getData()
const {
return data; }
179 inline void setData( uint64_t value) {
data = value; }
181 inline uint64_t getFieldLong(uint32_t shift, uint32_t len)
const
182 {
return (
data >> shift) & (((
static_cast<uint64_t
>(1)) << len) - 1); }
184 inline uint32_t getField(uint32_t shift, uint32_t len)
const
185 {
return (
data >> shift) & (((
static_cast<uint64_t
>(1)) << len) - 1); }
187 inline void setField(uint32_t shift, uint32_t len, uint32_t value)
188 { uint64_t mask = (((
static_cast<uint64_t
>(1)) << len) - 1);
189 data = (
data & ~(mask << shift)) | ((static_cast<uint64_t>(value) & mask) << shift); }
191 inline void setFieldLong(uint32_t shift, uint32_t len, uint64_t value)
192 { uint64_t mask = (((
static_cast<uint64_t
>(1)) << len) - 1);
193 data = (
data & ~(mask << shift)) | ((value & mask ) << shift); }
195 inline uint8_t getBit(uint32_t shift)
const
196 {
return (
data >> shift) & 1; }
198 inline void setBit(uint32_t shift, uint8_t value)
199 {
data = value ? (
data | ((
static_cast<uint64_t
>(1)) << shift)) : (
data & ~((
static_cast<uint64_t
>(1)) << shift)) ; }
202 inline uint32_t getFieldBE(uint32_t shift, uint32_t len)
const
203 {
return (dataBE() >> shift) & (((
static_cast<uint32_t
>(1)) << len) - 1); }
204 inline uint8_t getBitBE(uint32_t shift)
const
205 {
return (dataBE() >> shift) & 1; }
206 inline uint64_t dataBE()
const
207 {
return ((
data&0x00000000000000FF)<<56)+
208 ((
data&0x000000000000FF00)<<40)+
209 ((
data&0x0000000000FF0000)<<24)+
210 ((
data&0x00000000FF000000)<< 8)+
211 ((
data>> 8)&0x00000000FF000000)+
212 ((
data>>24)&0x0000000000FF0000)+
213 ((
data>>40)&0x000000000000FF00)+
214 ((
data>>56)&0x00000000000000FF);
226 inline uint16_t getGdpbGenGdpbId()
const {
return getField( 48, 16); }
227 inline void setGdpbGenGdpbId(uint32_t v) { setField(48, 16, v); }
228 inline uint16_t getGdpbGenChipId()
const {
return getField( 40, 8); }
229 inline void setGdpbGenChipId(uint32_t v) { setField(40, 8, v); }
232 inline uint16_t getGdpbHitIs24b()
const {
return getBit( 39 ); }
233 inline uint16_t getGdpbHitChanId()
const {
return getField( 32, 2); }
234 inline uint32_t getGdpbHitFullTs()
const {
return getField( 13, 19); }
235 inline uint16_t getGdpbHitCoarse()
const {
return getField( 20, 12); }
236 inline uint16_t getGdpbHitFineTs()
const {
return getField( 13, 7); }
238 inline bool getGdpbHit24Edge()
const {
return getBit( 34 ); }
240 inline bool getGdpbHit32DllLck()
const {
return getBit( 12 ); }
241 inline uint16_t getGdpbHit32Tot()
const {
return getField( 4, 8); }
244 inline bool getGdpbEpLinkId()
const {
return getBit( 39 ); }
245 inline uint32_t getGdpbEpEpochNb()
const {
return getField( 8, 31); }
246 inline bool getGdpbEpSync()
const {
return getBit( 7 ); }
247 inline bool getGdpbEpDataLoss()
const {
return getBit( 6 ); }
248 inline bool getGdpbEpEpochLoss()
const {
return getBit( 5 ); }
249 inline bool getGdpbEpMissmatch()
const {
return getBit( 4 ); }
252 inline uint32_t getGdpbSlcMess()
const {
return getField( 4, 29); }
253 inline uint32_t getGdpbSlcChan()
const {
return getField( 31, 2); }
254 inline uint32_t getGdpbSlcEdge()
const {
return getBit( 30 ); }
255 inline uint32_t getGdpbSlcType()
const {
return getField( 28, 2); }
256 inline uint32_t getGdpbSlcData()
const {
return getField( 4, 24); }
259 inline uint16_t getGdpbSysSubType()
const {
return getField( 38, 2); }
260 inline bool getGdpbSysLinkId()
const {
return getBit( 37 ); }
262 inline bool getGdpbSysErrRoType()
const {
return getBit( 36 ); }
263 inline uint16_t getGdpbSysErrUnused()
const {
return getField( 32, 4); }
264 inline uint16_t getGdpbSysErrInfo()
const {
return getField( 11, 21); }
265 inline uint16_t getGdpbSysErrChanId()
const {
return getField( 12, 2); }
266 inline bool getGdpbSysErrEdge()
const {
return getBit( 11 ); }
267 inline uint16_t getGdpbSysErrData()
const {
return getField( 4, 7); }
269 inline uint32_t getGdpbSysUnkwData()
const {
return getField( 4, 32); }
271 inline uint32_t getGdpbSysFwErrResync()
const {
return getBit( 36 ); }
273 inline uint16_t getGdpbSysPattType()
const {
return getField( 46, 2 ); }
274 inline uint16_t getGdpbSysPattIndex()
const {
return getField( 40, 4 ); }
275 inline uint32_t getGdpbSysPattPattern()
const {
return getField( 4, 32 ); }
278 inline uint16_t getStarTrigMsgIndex()
const {
return getField( 0, 2 ); }
280 inline uint64_t getGdpbTsMsbStarA()
const {
return getFieldLong( 4, 40 ); }
282 inline uint64_t getGdpbTsLsbStarB()
const {
return getFieldLong( 20, 24 ); }
283 inline uint64_t getStarTsMsbStarB()
const {
return getFieldLong( 4, 16 ); }
285 inline uint64_t getStarTsMidStarC()
const {
return getFieldLong( 4, 40 ); }
287 inline uint64_t getStarTsLsbStarD()
const {
return getFieldLong( 36, 8 ); }
290 inline uint32_t getStarTrigCmdStarD()
const {
return getField( 20, 4 ); }
291 inline uint32_t getStarDaqCmdStarD()
const {
return getField( 16, 4 ); }
292 inline uint32_t getStarTokenStarD()
const {
return getField( 4, 12 ); }
295 inline void setGdpbEpEpochNb( uint32_t v ) { setField( 8, 31, v ); }
298 inline void setGdpbSysSubType( uint16_t v ) { setField( 38, 2, v); }
300 inline void setGdpbSysPattType( uint16_t v ) { setField( 46, 2, v ); }
301 inline void setGdpbSysPattIndex( uint16_t v ) { setField( 40, 4, v ); }
302 inline void setGdpbSysPattPattern( uint32_t v ) { setField( 4, 32, v ); }
305 inline void setStarTrigMsgIndex( uint8_t v ) { setField( 0, 2, v ); }
307 inline void setGdpbTsMsbStarA( uint64_t fullGdpbTs ) { setFieldLong( 4, 40, ( fullGdpbTs >> 24 ) ); }
309 inline void setGdpbTsLsbStarB( uint64_t fullGdpbTs ) { setFieldLong( 20, 24, ( fullGdpbTs ) ); }
310 inline void setStarTsMsbStarB( uint64_t fullStarTs ) { setFieldLong( 4, 16, ( fullStarTs >> 48 ) ); }
312 inline void setStarTsMidStarC( uint64_t fullStarTs ) { setFieldLong( 4, 40, ( fullStarTs >> 8 ) ); }
314 inline void setStarTsLsbStarD( uint64_t fullStarTs ) { setFieldLong( 36, 8, ( fullStarTs ) ); }
317 inline void setStarTrigCmdStarD( uint8_t v ) { setField( 20, 4, v ); }
318 inline void setStarDaqCmdStarD( uint8_t v ) { setField( 16, 4, v ); }
319 inline void setStarTokenStarD( uint16_t v ) { setField( 4, 12, v ); }
333 void printDataCout(
unsigned kind = msg_print_Prefix | msg_print_Data, uint32_t epoch = 0)
const;
334 void printDataLog(
unsigned kind = msg_print_Prefix | msg_print_Data, uint32_t epoch = 0)
const;
336 void printData(
unsigned outType = msg_print_Cout,
unsigned kind = msg_print_Human,
337 uint32_t epoch = 0, std::ostream& os = std::cout )
const;
345 {
return ( epoch << 19) | (ts & 0x7ffff); }
348 static uint64_t
CalcDistance(uint64_t start, uint64_t stop);
359 uint64_t fulExtendedEpoch;
368 void assign(
const FullMessage& src) { Message::assign(src); fulExtendedEpoch = src.fulExtendedEpoch; }
374 inline void reset() { Message::reset(); fulExtendedEpoch = 0; }
376 inline uint64_t getExtendedEpoch()
const {
return fulExtendedEpoch; }
378 inline double GetFullTimeNs() {
return getMsgFullTimeD( fulExtendedEpoch ); }
380 void PrintMessage(
unsigned outType = msg_print_Cout,
unsigned kind = msg_print_Human )
const;
402 const double kdClockCycleSize = 6250.0;
403 const double kdClockCycleSizeNs = kdClockCycleSize / 1000.0;
405 const double kdTotBinSize = 50.0;
407 const uint32_t kuFineTime = 0x0000007F;
408 const uint32_t kuFtShift = 0;
409 const uint32_t kuCoarseTime = 0x0007FF80;
410 const uint32_t kuCtShift = 7;
411 const uint32_t kuCtSize = 12;
413 const uint32_t kuFineCounterSize = ( (kuFineTime>>kuFtShift)+1 );
414 const uint32_t kuCoarseCounterSize = ( (kuCoarseTime>>kuCtShift)+1 );
415 const uint32_t kuCoarseOverflowTest = kuCoarseCounterSize / 2 ;
416 const uint32_t kuTotCounterSize = 256;
419 const double kdBinSize = kdClockCycleSize /
static_cast<double>(kuFineCounterSize);
421 const uint32_t kuEpochInBins = kuFineTime + kuCoarseTime + 1;
424 const double kdEpochInPs =
static_cast<double>(kuEpochInBins)*kdBinSize;
425 const double kdEpochInNs = kdEpochInPs / 1000.0;
428 const uint32_t kuEpochCounterSz = 0x7FFFFFFF;
429 const double kdEpochCycleInS =
static_cast<double>(kuEpochCounterSz) * (kdEpochInNs/1e9);
431 const uint32_t kuChipIdMergedEpoch = 63;
433 const uint32_t kuFeePulserChannel = 3;
458 enum SysMessageTypes {
459 SYSMSG_DAQ_START = 1,
460 SYSMSG_DAQ_FINISH = 2,
461 SYSMSG_NX_PARITY = 3,
462 SYSMSG_SYNC_PARITY = 4,
463 SYSMSG_DAQ_RESUME = 5,
464 SYSMSG_FIFO_RESET = 6,
468 SYSMSG_PACKETLOST = 10,
469 SYSMSG_GET4_EVENT = 11,
470 SYSMSG_CLOSYSYNC_ERROR = 12,
471 SYSMSG_TS156_SYNC = 13,
472 SYSMSG_GDPB_UNKWN = 15,
473 SYSMSG_GET4V1_32BIT_0 = 240,
474 SYSMSG_GET4V1_32BIT_1 = 241,
475 SYSMSG_GET4V1_32BIT_2 = 242,
476 SYSMSG_GET4V1_32BIT_3 = 243,
477 SYSMSG_GET4V1_32BIT_4 = 244,
478 SYSMSG_GET4V1_32BIT_5 = 245,
479 SYSMSG_GET4V1_32BIT_6 = 246,
480 SYSMSG_GET4V1_32BIT_7 = 247,
481 SYSMSG_GET4V1_32BIT_8 = 248,
482 SYSMSG_GET4V1_32BIT_9 = 249,
483 SYSMSG_GET4V1_32BIT_10 = 250,
484 SYSMSG_GET4V1_32BIT_11 = 251,
485 SYSMSG_GET4V1_32BIT_12 = 252,
486 SYSMSG_GET4V1_32BIT_13 = 253,
487 SYSMSG_GET4V1_32BIT_14 = 254,
488 SYSMSG_GET4V1_32BIT_15 = 255,
491 enum SysMessageUserTypes {
492 SYSMSG_USER_CALIBR_ON = 7,
493 SYSMSG_USER_CALIBR_OFF = 8,
494 SYSMSG_USER_RECONFIGURE = 9,
495 SYSMSG_USER_ROCFEET_SYNC = 16
498 enum MessagePrintMask {
499 msg_print_Prefix = 1,
505 enum MessagePrintType {
507 msg_print_FairLog = 2,
511 enum Get4Message32bTypes {
518 enum Get4Message32bSlC {
519 GET4_32B_SLC_SCALER = 0,
520 GET4_32B_SLC_DEADT = 1,
521 GET4_32B_SLC_SPIREAD = 2,
522 GET4_32B_SLC_START_SEU = 3
525 enum Get4Message32bErrors {
526 GET4_V2X_ERR_READ_INIT = 0x00,
527 GET4_V2X_ERR_SYNC = 0x01,
528 GET4_V2X_ERR_EP_CNT_SYNC = 0x02,
529 GET4_V2X_ERR_EP = 0x03,
530 GET4_V2X_ERR_FIFO_WRITE = 0x04,
531 GET4_V2X_ERR_LOST_EVT = 0x05,
532 GET4_V2X_ERR_CHAN_STATE = 0x06,
533 GET4_V2X_ERR_TOK_RING_ST = 0x07,
534 GET4_V2X_ERR_TOKEN = 0x08,
535 GET4_V2X_ERR_READOUT_ERR = 0x09,
536 GET4_V2X_ERR_SPI = 0x0A,
537 GET4_V2X_ERR_DLL_LOCK = 0x0B,
538 GET4_V2X_ERR_DLL_RESET = 0x0C,
539 GET4_V2X_ERR_TOT_OVERWRT = 0x11,
540 GET4_V2X_ERR_TOT_RANGE = 0x12,
541 GET4_V2X_ERR_EVT_DISCARD = 0x13,
542 GET4_V2X_ERR_ADD_RIS_EDG = 0x14,
543 GET4_V2X_ERR_UNPAIR_FALL = 0x15,
544 GET4_V2X_ERR_SEQUENCE_ER = 0x16,
545 GET4_V2X_ERR_UNKNOWN = 0x7F
549 const uint32_t kuMaxSync = 2;
550 const uint32_t kuMaxAux = 4;
566 void assign(
const Message& src) {
data = src.data; }
568 Message& operator=(
const Message& src) { assign(src);
return *
this; }
570 inline void reset() {
data = 0; }
572 inline uint64_t getData()
const {
return data; }
573 inline void setData( uint64_t value) {
data = value; }
575 inline uint64_t getFieldLong(uint32_t shift, uint32_t len)
const
576 {
return (
data >> shift) & (((
static_cast<uint64_t
>(1)) << len) - 1); }
578 inline uint32_t getField(uint32_t shift, uint32_t len)
const
579 {
return (
data >> shift) & (((
static_cast<uint32_t
>(1)) << len) - 1); }
581 inline void setField(uint32_t shift, uint32_t len, uint32_t value)
582 { uint64_t mask = (((
static_cast<uint64_t
>(1)) << len) - 1);
583 data = (
data & ~(mask << shift)) | ((static_cast<uint64_t>(value) & mask) << shift); }
585 inline void setFieldLong(uint32_t shift, uint32_t len, uint64_t value)
586 { uint64_t mask = (((
static_cast<uint64_t
>(1)) << len) - 1);
587 data = (
data & ~(mask << shift)) | ((value & mask ) << shift); }
589 inline uint8_t getBit(uint32_t shift)
const
590 {
return (
data >> shift) & 1; }
592 inline void setBit(uint32_t shift, uint8_t value)
593 {
data = value ? (
data | ((
static_cast<uint64_t
>(1)) << shift)) : (
data & ~((
static_cast<uint64_t
>(1)) << shift)) ; }
596 inline uint32_t getFieldBE(uint32_t shift, uint32_t len)
const
597 {
return (dataBE() >> shift) & (((
static_cast<uint32_t
>(1)) << len) - 1); }
598 inline uint8_t getBitBE(uint32_t shift)
const
599 {
return (dataBE() >> shift) & 1; }
600 inline uint64_t dataBE()
const
601 {
return ((
data&0x00000000000000FF)<<56)+
602 ((
data&0x000000000000FF00)<<40)+
603 ((
data&0x0000000000FF0000)<<24)+
604 ((
data&0x00000000FF000000)<< 8)+
605 ((
data>> 8)&0x00000000FF000000)+
606 ((
data>>24)&0x0000000000FF0000)+
607 ((
data>>40)&0x000000000000FF00)+
608 ((
data>>56)&0x00000000000000FF);
690 inline uint32_t
getGet4Ts()
const {
return getField(17, 19); }
703 inline uint32_t
getGet4CRC()
const {
return getField(0, 8); }
713 inline void setGet4Ts(uint32_t v) { setField(17, 19, v); }
741 inline uint16_t getGdpbGenChipId()
const {
return getField( 42, 6); }
742 inline void setGdpbGenChipId(uint32_t v) { setField(42, 6, v); }
745 inline uint16_t getGdpbHitChanId()
const {
return getField( 40, 2); }
746 inline uint32_t getGdpbHitFullTs()
const {
return getField( 21, 19); }
747 inline uint16_t getGdpbHitCrc()
const {
return getField( 4, 8); }
748 inline uint16_t getGdpbHitCoarse()
const {
return getField( 28, 12); }
749 inline uint16_t getGdpbHitFineTs()
const {
return getField( 21, 7); }
751 inline bool getGdpbHit24Edge()
const {
return getBit( 20 ); }
753 inline bool getGdpbHit32DllLck()
const {
return getBit( 20 ); }
754 inline uint16_t getGdpbHit32Tot()
const {
return getField( 12, 8); }
757 inline bool getGdpbEpLinkId()
const {
return getBit( 41 ); }
758 inline uint32_t getGdpbEpEpochNb()
const {
return getField( 10, 31); }
759 inline uint16_t getGdpbEpStampTs()
const {
return getField( 8, 2); }
760 inline bool getGdpbEpSync()
const {
return getBit( 7 ); }
761 inline bool getGdpbEpDataLoss()
const {
return getBit( 6 ); }
762 inline bool getGdpbEpEpochLoss()
const {
return getBit( 5 ); }
763 inline bool getGdpbEpMissmatch()
const {
return getBit( 4 ); }
766 inline uint32_t getGdpbSlcMess()
const {
return getField( 12, 29); }
767 inline uint32_t getGdpbSlcData()
const {
return getField( 12, 24); }
768 inline uint32_t getGdpbSlcType()
const {
return getField( 36, 2); }
769 inline uint32_t getGdpbSlcEdge()
const {
return getBit( 38 ); }
770 inline uint32_t getGdpbSlcChan()
const {
return getField( 39, 2); }
771 inline uint16_t getGdpbSlcCrc()
const {
return getField( 4, 8); }
774 inline bool getGdpbSysLinkId()
const {
return getBit( 41 ); }
775 inline uint16_t getGdpbSysSubType()
const {
return getField( 37, 4); }
777 inline bool getGdpbSysErrRoType()
const {
return getBit( 36 ); }
778 inline uint16_t getGdpbSysErrUnused()
const {
return getField( 14, 22); }
779 inline uint16_t getGdpbSysErrChanId()
const {
return getField( 12, 2); }
780 inline bool getGdpbSysErrEdge()
const {
return getBit( 11 ); }
781 inline uint16_t getGdpbSysErrData()
const {
return getField( 4, 7); }
783 inline uint32_t getGdpbSysUnkwData()
const {
return getField( 4, 32); }
786 inline uint16_t getStarTrigMsgIndex()
const {
return getField( 4, 4 ); }
788 inline uint64_t getGdpbTsMsbStarA()
const {
return getFieldLong( 8, 40 ); }
790 inline uint64_t getGdpbTsLsbStarB()
const {
return getFieldLong( 24, 24 ); }
791 inline uint64_t getStarTsMsbStarB()
const {
return getFieldLong( 8, 16 ); }
793 inline uint64_t getStarTsMidStarC()
const {
return getFieldLong( 8, 40 ); }
795 inline uint64_t getStarTsLsbStarD()
const {
return getFieldLong( 40, 8 ); }
798 inline uint32_t getStarTokenStarD()
const {
return getField( 8, 12 ); }
799 inline uint32_t getStarDaqCmdStarD()
const {
return getField( 20, 4 ); }
800 inline uint32_t getStarTrigCmdStarD()
const {
return getField( 24, 4 ); }
803 inline void setStarTrigMsgIndex( uint8_t v ) { setField( 4, 4, v ); }
805 inline void setGdpbTsMsbStarA( uint64_t fullGdpbTs ) { setFieldLong( 8, 40, ( fullGdpbTs >> 24 ) ); }
807 inline void setGdpbTsLsbStarB( uint64_t fullGdpbTs ) { setFieldLong( 24, 24, ( fullGdpbTs ) ); }
808 inline void setStarTsMsbStarB( uint64_t fullStarTs ) { setFieldLong( 8, 16, ( fullStarTs >> 48 ) ); }
810 inline void setStarTsMidStarC( uint64_t fullStarTs ) { setFieldLong( 8, 40, ( fullStarTs >> 8 ) ); }
812 inline void setStarTsLsbStarD( uint64_t fullStarTs ) { setFieldLong( 40, 8, ( fullStarTs ) ); }
815 inline void setStarTokenStarD( uint16_t v ) { setField( 8, 12, v ); }
816 inline void setStarDaqCmdStarD( uint8_t v ) { setField( 20, 4, v ); }
817 inline void setStarTrigCmdStarD( uint8_t v ) { setField( 24, 4, v ); }
850 void printDataCout(
unsigned kind = msg_print_Prefix | msg_print_Data, uint32_t epoch = 0)
const;
851 void printDataLog(
unsigned kind = msg_print_Prefix | msg_print_Data, uint32_t epoch = 0)
const;
853 void printData(
unsigned outType = msg_print_Cout,
unsigned kind = msg_print_Human,
854 uint32_t epoch = 0, std::ostream& os = std::cout )
const;
862 {
return ( epoch << 19) | (stamp & 0x7ffff); }
865 static uint64_t
CalcDistance(uint64_t start, uint64_t stop);
873 static uint32_t RawSize(
int fmt);
875 bool assign(
void* src,
int fmt = formatNormal);
877 bool copyto(
void* tgt,
int fmt = formatNormal);
882 uint64_t fulExtendedEpoch;
891 void assign(
const FullMessage& src) { Message::assign(src); fulExtendedEpoch = src.fulExtendedEpoch; }
897 inline void reset() { Message::reset(); fulExtendedEpoch = 0; }
899 inline uint64_t getExtendedEpoch()
const {
return fulExtendedEpoch; }
902 inline double GetFullTimeNs() {
return getMsgFullTimeD( fulExtendedEpoch ); }
904 void PrintMessage(
unsigned outType = msg_print_Cout,
unsigned kind = msg_print_Human )
const;
910 #endif // STETOFMESSAGEFORMAT_H
void printDataCout(unsigned kind=msg_print_Prefix|msg_print_Data, uint32_t epoch=0) const
Print message in human readable format to cout.
uint32_t getGet4CoarseTs() const
For Get4 data: Returns Get4 coarse time stamp, 6.4 ns binning (12 bit field)
void setEpoch2ChipNumber(uint32_t v)
bool isNopMsg() const
Returns true is message type is #MSG_NOP (filler message)
bool isSysMsg() const
Returns true is message type is #MSG_SYST (system message)
bool operator<(const FullMessage &other) const
strict weak ordering operator, including epoch for both messages
bool isStarTrigger() const
Returns true is message type is #MSG_STAR_TRI_A, _B, _C, _D (STAR Trigger message) ...
uint32_t getEpoch2ChipNumber() const
uint32_t getEpoch2StampTime() const
uint32_t getGet4FineTs() const
For Get4 data: Returns Get4 fine time stamp, 50 ps binning (7 bit field)
bool isStartDaqMsg() const
Returns true if system message and subtype #ROC_SYSMSG_DAQ_START.
uint64_t getMsgFullTime(uint64_t epoch) const
void setStarFillerD()
12 bits in between are set to 0
void setSysMesType(uint8_t v)
For SysMes data: Set system message type (8 bit field)
bool isStopDaqMsg() const
Returns true if system message and subtype #ROC_SYSMSG_DAQ_FINISH.
bool operator<(const FullMessage &other) const
strict weak ordering operator, including epoch for both messages
uint32_t getGet4Ts() const
For Get4 data: Returns Get4 time stamp, 50 ps binning (19 bit field)
uint32_t getSysMesData() const
For SysMes data: Returns system message data (32 bit field)
static double CalcDistanceD(double start, double stop)
Returns the time difference between two expanded time stamps.
uint32_t getEpoch2Number() const
For Epoch2 data: Returns the epoch number (32 bit field)
bool operator==(const gdpbv100::Message &other) const
equality operator, assumes same epoch for both messages
static double CalcDistanceD(double start, double stop)
Returns the time difference between two expanded time stamps.
bool isEpochMsg() const
Returns true is message type is #MSG_EPOCH (epoch2 marker)
void setMessageType(uint8_t v)
Sets the message type field in the current message.
uint64_t getMsgFullTime(uint64_t epoch) const
Returns expanded and adjusted time of message (in ns)
bool isSysMsg() const
Returns true is message type is #MSG_SYS (system message)
void printDataCout(unsigned kind=msg_print_Prefix|msg_print_Data, uint32_t epoch=0) const
Print message in human readable format to cout.
void setSysMesData(uint32_t v)
For SysMes data: Set system message data (32 bit field)
uint8_t getMessageType() const
Returns the message type. Valid for all message types. 4 bit.
void printDataLog(unsigned kind=msg_print_Prefix|msg_print_Data, uint32_t epoch=0) const
Print message in human readable format to the Fairroot logger.
bool operator<(const gdpb::Message &other) const
strict weak ordering operator, assumes same epoch for both messages
uint8_t getMessageType() const
Returns the message type. Valid for all message types. 4 bit.
void printData(unsigned outType=msg_print_Cout, unsigned kind=msg_print_Human, uint32_t epoch=0, std::ostream &os=std::cout) const
Print message in binary or human readable format to a stream.
uint16_t getRocNumber() const
Returns the number of the sending ROC. Valid for all message types.
double getMsgFullTimeD(uint64_t epoch) const
Returns expanded and adjusted time of message in double (in ns)
static uint64_t FullTimeStamp2(uint64_t epoch, uint32_t stamp)
Expanded timestamp for 160 MHz * 19 bit (12 + 7) epochs.
double getMsgFullTimeD(uint64_t epoch) const
void setMessageType(uint8_t v)
Sets the message type field in the current message.
void setEpoch2Sync(uint32_t v)
For Epoch2 data: Set sync flag (1 bit field)
void setRocNumber(uint16_t v)
Sets the ROC number field in the current message.
bool isGet4Hit32Msg() const
Returns true is message type is #MSG_GET4_32B (GET4 Hit Data in 32b mode)
uint8_t getSysMesType() const
For SysMes data: Returns system message subtype (8 bit field)
uint32_t getStarFillerD() const
12 bits in between are set to 0
uint32_t getStarFillerD() const
12 bits in between are set to 0
void printData(unsigned outType=msg_print_Cout, unsigned kind=msg_print_Human, uint32_t epoch=0, std::ostream &os=std::cout) const
Print message in binary or human readable format to a stream.
void setEpoch2Number(uint32_t v)
For Epoch2 data: Set the epoch number (32 bit field)
void printDataLog(unsigned kind=msg_print_Prefix|msg_print_Data, uint32_t epoch=0) const
Print message in human readable format to the Fairroot logger.
uint32_t getEpoch2EpochLost() const
For Epoch2 data: Returns epoch-lost flag (1 bit field)
static uint64_t CalcDistance(uint64_t start, uint64_t stop)
Returns the time difference between two expanded time stamps.
bool isEpoch2Msg() const
Returns true is message type is #MSG_EPOCH2 (epoch2 marker)
static uint64_t FullTimeStamp(uint64_t epoch, uint32_t ts)
Expanded timestamp for 160 MHz * 19 bit (12 + 7) epochs.
uint32_t getEpoch2Sync() const
For Epoch2 data: Returns sync flag (1 bit field)
void setGet4CRC(uint32_t v)
uint32_t getGet4CRC() const
uint32_t getEpoch2EpochMissmatch() const
uint8_t getGet4Number() const
For Get4 data: Returns Get4 chip number (6 bit field)
void setEpoch2DataLost(uint32_t v)
For Epoch2 data: Set data-lost flag (1 bit field)
void setEpoch2EpochMissmatch(uint32_t v)
For Epoch2 data: Set epoch missmatch flag (1 bit field)
void setGet4Edge(uint32_t v)
For Get4 data: Sets Get4 rising or falling edge (1 bit field)
bool isStarTrigger() const
Returns true is message type is #MSG_STAR_TRI (STAR Trigger message)
bool isGet4Hack32Msg() const
Returns true is message type is #MSG_SYS (system message) and subtype is 32bHack. ...
void setStarFillerD()
12 bits in between are set to 0
static uint64_t CalcDistance(uint64_t start, uint64_t stop)
Returns the time difference between two expanded time stamps.
uint8_t getGet4ChNum() const
For Get4 data: Returns Get4 channel number (2 bit field)
uint32_t getGet4Edge() const
For Get4 data: Returns Get4 rising or falling edge (1 bit field)
bool isGet4SlCtrMsg() const
Returns true is message type is #MSG_GET4_SLC (GET4 Slow Control)
void setEpoch2EpochLost(uint32_t v)
For Epoch2 data: Set epoch-lost flag (1 bit field)
void setEpoch2StampTime(uint32_t v)
uint32_t getEpoch2DataLost() const
For Epoch2 data: Returns data-lost flag (1 bit field)
void setGet4ChNum(uint8_t v)
For Get4 data: Sets Get4 channel number (2 bit field)
bool isHitMsg() const
Returns true is message type is #MSG_HIT (Get4 hit data)
bool isGet4Msg() const
Returns true is message type is #MSG_GET4 (Get4 hit data)
bool isGet4SysMsg() const
Returns true is message type is #MSG_GET4_SYS (GET4 system message)
void setGet4Ts(uint32_t v)
For Get4 data: Sets Get4 time stamp, 50 ps binning (19 bit field)
void setGet4Number(uint8_t v)
For Get4 data: Sets Get4 chip number (6 bit field)
bool operator<(const gdpbv100::Message &other) const
strict weak ordering operator, assumes same epoch for both messages
bool operator!=(const gdpbv100::Message &other) const
inequality operator, assumes same epoch for both messages
bool isGet4SlCtrMsg() const
Returns true is message type is #MSG_SLOWC (GET4 Slow Control)