StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StETofMessageFormat.h
1 /***************************************************************************
2  *
3  * $Id: StETofMessageFormat.h,v 1.2 2019/02/19 20:18:24 fseck Exp $
4  *
5  * Author: Pierre-Alain Loizeau, January 2018
6  ***************************************************************************
7  *
8  * Description: DAQ stream eTOF message format
9  * for 2018 taken from
10  * https://lxcbmredmine01.gsi.de/projects/cbmroot/repository/entry/trunk/fles/star2018/unpacker/rocMess_wGet4v2.h
11  * message format is contained in the namespaces gdbp and get4v2x
12  *
13  * for 2019 (and later) taken from
14  * https://lxcbmredmine01.gsi.de/projects/cbmroot/repository/entry/trunk/fles/mcbm2018/dataformat/gDpbMessv100.h
15  * message format is contained in the namespace gdbpv100
16  *
17  ***************************************************************************
18  *
19  * $Log: StETofMessageFormat.h,v $
20  * Revision 1.2 2019/02/19 20:18:24 fseck
21  * update to include new message format for 2019+
22  *
23  * Revision 1.1 2018/07/25 14:34:40 jeromel
24  * First version, reviewed Raghav+Jerome
25  *
26  *
27  ***************************************************************************/
28 #ifndef STETOFMESSAGEFORMAT_H
29 #define STETOFMESSAGEFORMAT_H
30 
31 #include <stdint.h>
32 #include <iostream>
33 
34 
35 
36 //----------------------------------------------------------------------------
37 //
38 // ***** format for year 2019 and later: namespace gdpbv100 *****
39 //
40 //----------------------------------------------------------------------------
41 
42 namespace gdpbv100 {
43  // Size of one clock cycle (=1 coarse bin)
44  const double kdClockCycleSize = 6250.0; //[ps]
45  const double kdClockCycleSizeNs = kdClockCycleSize / 1000.0; //[ns]
46  // TODO:For now make 100ps default, maybe need later an option for it
47  const double kdTotBinSize = 50.0; //ps
48 
49  const uint32_t kuFineTime = 0x0000007F; // Fine Counter value
50  const uint32_t kuFtShift = 0; // Fine Counter offset
51  const uint32_t kuCoarseTime = 0x0007FF80; // Coarse Counter value
52  const uint32_t kuCtShift = 7; // Coarse Counter offset
53  const uint32_t kuCtSize = 12; // Coarse Counter size in bits
54 
55  const uint32_t kuFineCounterSize = ( (kuFineTime>>kuFtShift)+1 );
56  const uint32_t kuCoarseCounterSize = ( (kuCoarseTime>>kuCtShift)+1 );
57  const uint32_t kuCoarseOverflowTest = kuCoarseCounterSize / 2 ; // Limit for overflow check
58  const uint32_t kuTotCounterSize = 256;
59 
60  const double kdFtSize = kuFineCounterSize;
61  const double kdFtBinsNb = 112.;
62 
63  // Nominal bin size of NL are neglected
64  const double kdBinSize = kdClockCycleSize / static_cast<double>(kuFineCounterSize);
65  // Epoch Size in bins
66  const uint32_t kuEpochInBins = kuFineTime + kuCoarseTime + 1;
67  // Epoch Size in ps
68  // alternatively: (kiCoarseTime>>kiCtShift + 1)*kdClockCycleSize
69  const double kdEpochInPs = static_cast<double>(kuEpochInBins)*kdBinSize;
70  const double kdEpochInNs = kdEpochInPs / 1000.0;
71 
72  // Epoch counter size in epoch
73  const uint32_t kuEpochCounterSz = 0x7FFFFFFF;
74  // Epoch counter size in bin
75  const uint64_t kulEpochCycleBins = static_cast<uint64_t>(kuEpochCounterSz + 1)* kuEpochInBins;
76  // Epoch counter size in s
77  const double kdEpochCycleInS = static_cast<double>(kuEpochCounterSz + 1) * (kdEpochInNs/1e9);
78 
79  // Epoch Cycle MS start message size in bits
80  const uint64_t kulEpochCycleFieldSz = 0x1FFFFF; // 21 bits
81 
82  const uint32_t kuChipIdMergedEpoch = 255; // 0xFF
83 
84  const uint32_t kuFeePulserChannel = 3; // Channel where a pulser can be set ON at 20 ns 500 Hz
85  const uint32_t kuFeePulserChannelDiam = 0; // Channel where a pulser can be set ON at 20 ns 500 Hz
86 
87 
88  enum MessageTypes {
89  MSG_HIT = 0,
90  MSG_EPOCH = 1,
91  MSG_SLOWC = 2,
92  MSG_SYST = 3,
93  MSG_STAR_TRI_A = 4,
94  MSG_STAR_TRI_B = 5,
95  MSG_STAR_TRI_C = 6,
96  MSG_STAR_TRI_D = 7
97  };
98 
99  enum SysMessageTypes {
100  SYS_GET4_ERROR = 0, // GET4 error event
101  SYS_GDPB_UNKWN = 1, // Raw data from gDPB in case of unknown message type from GET4
102  SYS_GET4_SYNC_MISS = 2, // Added when GET4 is missing the SYNC flag when it is expected
103 // SYS_SYNC_ERROR = 3 // added to data stream when the closy-sync-strobe does not match the gDPB 160MHz timestamp counter
104  SYS_PATTERN = 3 // added to data stream when one of the ASIC patterns (missmatch, enable, resync) changed
105  };
106 
107  enum PattMessageTypes {
108  PATT_MISSMATCH = 0, // Missmatch pattern, 1 bit per ASIC
109  PATT_ENABLE = 1, // Enable pattern, 1 bit per ASIC
110  PATT_RESYNC = 2, // Resync request pattern, 1 bit per ASIC
111  PATT_STATUS = 3 // Status pattern, 1 bit per ASIC (SW only)
112  };
113 
114  enum MessagePrintMask {
115  msg_print_Prefix = 1,
116  msg_print_Data = 2,
117  msg_print_Hex = 4,
118  msg_print_Human = 8
119  };
120 
121  enum MessagePrintType {
122  msg_print_Cout = 1,
123  msg_print_FairLog = 2,
124  msg_print_File = 3
125  };
126 
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
132  };
133 
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, // Not there anymore in manual for Get4 v2.00?
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, // New in manual for Get4 v2.00, no description?
155  GET4_V2X_ERR_UNKNOWN = 0x7F
156  };
157 
158  class Message {
159 
160  protected:
161  uint64_t data; // main and only storage field for the message
162 
163  public:
164  Message() : data(0) {}
165 
166  Message(const Message& src) : data(src.data) {}
167 
168  Message( uint64_t dataIn ) : data(dataIn) {}
169 
170  virtual ~Message() {};
171 
172  void assign(const Message& src) { data = src.data; }
173 
174  Message& operator=(const Message& src) { assign(src); return *this; }
175 
176  inline void reset() { data = 0; }
177 
178  inline uint64_t getData() const { return data; }
179  inline void setData( uint64_t value) { data = value; }
180 
181  inline uint64_t getFieldLong(uint32_t shift, uint32_t len) const
182  { return (data >> shift) & (((static_cast<uint64_t>(1)) << len) - 1); }
183 
184  inline uint32_t getField(uint32_t shift, uint32_t len) const
185  { return (data >> shift) & (((static_cast<uint64_t>(1)) << len) - 1); } //used to be 32 bit. might need to replace getfield by getfieldlong in getter of pattern message
186 
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); }
190 
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); }
194 
195  inline uint8_t getBit(uint32_t shift) const
196  { return (data >> shift) & 1; }
197 
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)) ; }
200 
201 
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);
215  }
216 
217  // --------------------------- common fields ---------------------------------
218 
220  inline uint8_t getMessageType() const { return getField( 0, 3); }
221 
223  inline void setMessageType(uint8_t v) { setField(0, 3, v); }
224 
225  // ---------- Get4 gDPB 24b/32b ALL access methods ------------------------
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); }
230 
231  // ---------- Get4 gDPB 24b/32b Hit access methods ------------------------
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); }
237  // ---------- Get4 gDPB 24b Hit access methods ----------------------------
238  inline bool getGdpbHit24Edge() const { return getBit( 34 ); }
239  // ---------- Get4 gDPB 32b Hit access methods ----------------------------
240  inline bool getGdpbHit32DllLck() const { return getBit( 12 ); }
241  inline uint16_t getGdpbHit32Tot() const { return getField( 4, 8); }
242 
243  // ---------- Get4 gDPB 24b/32b Epoch access methods ----------------------
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 ); }
250 
251  // ---------- Get4 gDPB 24b/32b Slow cont. access methods -----------------
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); }
257 
258  // ---------- Get4 gDPB System Msg access methods -------------------------
259  inline uint16_t getGdpbSysSubType() const { return getField( 38, 2); }
260  inline bool getGdpbSysLinkId() const { return getBit( 37 ); }
261  // ---------- Get4 gDPB 24b/32b Errors access methods ---------------------
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); }
268  // ---------- Get4 gDPB unknown msg type access methods -------------------
269  inline uint32_t getGdpbSysUnkwData() const { return getField( 4, 32); }
270  // ---------- FW error msg type access methods ----------------------------
271  inline uint32_t getGdpbSysFwErrResync() const { return getBit( 36 ); }
272  // ---------- ASIC Pattern messages access methods ------------------------
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 ); }
276 
277  // ---------- STAR Trigger messages access methods ------------------------
278  inline uint16_t getStarTrigMsgIndex() const { return getField( 0, 2 ); }
279  //++++//
280  inline uint64_t getGdpbTsMsbStarA() const { return getFieldLong( 4, 40 ); }
281  //++++//
282  inline uint64_t getGdpbTsLsbStarB() const { return getFieldLong( 20, 24 ); }
283  inline uint64_t getStarTsMsbStarB() const { return getFieldLong( 4, 16 ); }
284  //++++//
285  inline uint64_t getStarTsMidStarC() const { return getFieldLong( 4, 40 ); }
286  //++++//
287  inline uint64_t getStarTsLsbStarD() const { return getFieldLong( 36, 8 ); }
289  inline uint32_t getStarFillerD() const { return getField( 24, 12 ); } // Should be always 0
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 ); }
293 
294  // ---------- Get4 gDPB 24b/32b Epoch setter methods ----------------------
295  inline void setGdpbEpEpochNb( uint32_t v ) { setField( 8, 31, v ); }
296 
297  // ---------- Get4 gDPB System Msg access methods -------------------------
298  inline void setGdpbSysSubType( uint16_t v ) { setField( 38, 2, v); }
299  // ---------- ASIC Pattern messages access methods ------------------------
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 ); }
303 
304  // ---------- STAR Trigger messages setter methods ------------------------
305  inline void setStarTrigMsgIndex( uint8_t v ) { setField( 0, 2, v ); }
306  //++++//
307  inline void setGdpbTsMsbStarA( uint64_t fullGdpbTs ) { setFieldLong( 4, 40, ( fullGdpbTs >> 24 ) ); }
308  //++++//
309  inline void setGdpbTsLsbStarB( uint64_t fullGdpbTs ) { setFieldLong( 20, 24, ( fullGdpbTs ) ); }
310  inline void setStarTsMsbStarB( uint64_t fullStarTs ) { setFieldLong( 4, 16, ( fullStarTs >> 48 ) ); }
311  //++++//
312  inline void setStarTsMidStarC( uint64_t fullStarTs ) { setFieldLong( 4, 40, ( fullStarTs >> 8 ) ); }
313  //++++//
314  inline void setStarTsLsbStarD( uint64_t fullStarTs ) { setFieldLong( 36, 8, ( fullStarTs ) ); }
316  inline void setStarFillerD() { setField( 24, 12, 0 ); } // Should be always 0
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 ); }
320 
321  // ---------- Common functions -----------------------
323  inline bool isHitMsg() const { return getMessageType() == MSG_HIT; }
325  inline bool isEpochMsg() const { return getMessageType() == MSG_EPOCH;}
327  inline bool isGet4SlCtrMsg() const { return getMessageType() == MSG_SLOWC; }
329  inline bool isSysMsg() const { return getMessageType() == MSG_SYST; }
331  inline bool isStarTrigger() const { return MSG_STAR_TRI_A <= getMessageType();}
332 
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;
335 
336  void printData(unsigned outType = msg_print_Cout, unsigned kind = msg_print_Human,
337  uint32_t epoch = 0, std::ostream& os = std::cout ) const;
338 
339  uint64_t getMsgFullTime(uint64_t epoch) const;
340 
341  double getMsgFullTimeD(uint64_t epoch) const;
342 
344  inline static uint64_t FullTimeStamp(uint64_t epoch, uint32_t ts)
345  { return ( epoch << 19) | (ts & 0x7ffff); }
346 
347 
348  static uint64_t CalcDistance(uint64_t start, uint64_t stop);
349 
350  static double CalcDistanceD(double start, double stop);
351 
352  bool operator<(const gdpbv100::Message& other) const;
353  bool operator==(const gdpbv100::Message& other) const;
354  bool operator!=(const gdpbv100::Message& other) const;
355  };
356 
357  class FullMessage : public Message {
358  protected:
359  uint64_t fulExtendedEpoch; // Epoch of the message, extended with 32b epoch cycle counter
360 
361  public:
362  FullMessage() : Message(), fulExtendedEpoch(0) {}
363 
364  FullMessage(const Message& src, uint64_t uEpIn = 0) : Message(src), fulExtendedEpoch(uEpIn) {}
365 
366  FullMessage(const FullMessage& src) : Message(src), fulExtendedEpoch(src.fulExtendedEpoch) {}
367 
368  void assign(const FullMessage& src) { Message::assign(src); fulExtendedEpoch = src.fulExtendedEpoch; }
369 
370  FullMessage& operator=(const FullMessage& src) { assign(src); return *this; }
371 
372  bool operator<(const FullMessage& other) const;
373 
374  inline void reset() { Message::reset(); fulExtendedEpoch = 0; }
375 
376  inline uint64_t getExtendedEpoch() const {return fulExtendedEpoch; }
377 
378  inline double GetFullTimeNs() { return getMsgFullTimeD( fulExtendedEpoch ); }
379 
380  void PrintMessage( unsigned outType = msg_print_Cout, unsigned kind = msg_print_Human ) const;
381  };
382 
383 } // gdpbv100
384 
385 
386 
387 
388 
389 
390 
391 
392 
393 //----------------------------------------------------------------------------
394 //
395 // ***** format for year 2018: namespace get4v2x and gdpb *****
396 //
397 //----------------------------------------------------------------------------
398 
399 
400 namespace get4v2x {
401  // Size of one clock cycle (=1 coarse bin)
402  const double kdClockCycleSize = 6250.0; //[ps]
403  const double kdClockCycleSizeNs = kdClockCycleSize / 1000.0; //[ns]
404  // TODO:For now make 100ps default, maybe need later an option for it
405  const double kdTotBinSize = 50.0; //ps
406 
407  const uint32_t kuFineTime = 0x0000007F; // Fine Counter value
408  const uint32_t kuFtShift = 0; // Fine Counter offset
409  const uint32_t kuCoarseTime = 0x0007FF80; // Coarse Counter value
410  const uint32_t kuCtShift = 7; // Coarse Counter offset
411  const uint32_t kuCtSize = 12; // Coarse Counter size in bits
412 
413  const uint32_t kuFineCounterSize = ( (kuFineTime>>kuFtShift)+1 );
414  const uint32_t kuCoarseCounterSize = ( (kuCoarseTime>>kuCtShift)+1 );
415  const uint32_t kuCoarseOverflowTest = kuCoarseCounterSize / 2 ; // Limit for overflow check
416  const uint32_t kuTotCounterSize = 256;
417 
418  // Nominal bin size of NL are neglected
419  const double kdBinSize = kdClockCycleSize / static_cast<double>(kuFineCounterSize);
420  // Epoch Size in bins
421  const uint32_t kuEpochInBins = kuFineTime + kuCoarseTime + 1;
422  // Epoch Size in ps
423  // alternatively: (kiCoarseTime>>kiCtShift + 1)*kdClockCycleSize
424  const double kdEpochInPs = static_cast<double>(kuEpochInBins)*kdBinSize;
425  const double kdEpochInNs = kdEpochInPs / 1000.0;
426 
427  // Epoch counter size in epoch
428  const uint32_t kuEpochCounterSz = 0x7FFFFFFF;
429  const double kdEpochCycleInS = static_cast<double>(kuEpochCounterSz) * (kdEpochInNs/1e9);
430 
431  const uint32_t kuChipIdMergedEpoch = 63; // 0x3F
432 
433  const uint32_t kuFeePulserChannel = 3; // Channel where a pulser can be set ON at 20 ns 500 Hz
434 } // get4v2x
435 
436 
437 namespace gdpb {
438 
439  enum MessageFormat {
440  formatNormal = 4 // new message format with little-endian coding, 16-bit roc number (default)
441  };
442 
443  enum MessageTypes {
444  MSG_NOP = 0,
445  MSG_HIT = 1,
446  MSG_EPOCH = 2,
447  MSG_SYNC = 3,
448  MSG_AUX = 4,
449  MSG_EPOCH2 = 5,
450  MSG_GET4 = 6,
451  MSG_SYS = 7,
452  MSG_GET4_SLC = 8,
453  MSG_GET4_32B = 9,
454  MSG_GET4_SYS = 10,
455  MSG_STAR_TRI = 0xD
456  };
457 
458  enum SysMessageTypes {
459  SYSMSG_DAQ_START = 1, // indicates start daq in data stream
460  SYSMSG_DAQ_FINISH = 2, // stop daq
461  SYSMSG_NX_PARITY = 3, // nx_parity error
462  SYSMSG_SYNC_PARITY = 4, // sync parity error
463  SYSMSG_DAQ_RESUME = 5, // daq resume due to low/high water marker, only in udp case
464  SYSMSG_FIFO_RESET = 6, // FPGA fifo reset
465  SYSMSG_USER = 7, // user define message, generated by writing into ROC_ADDSYSMSG register
466  SYSMSG_PCTIME = 8, // contains value of time() function, indicates when message was created on PC
467  SYSMSG_ADC = 9, // contains feb1d (1 bit), channel id (7 bit) and adc value (24 bit), measured on PC
468  SYSMSG_PACKETLOST = 10, // inserted by udp transport when packet was lost at this place
469  SYSMSG_GET4_EVENT = 11, // GET4 event
470  SYSMSG_CLOSYSYNC_ERROR = 12, // added to data stream when the closy-sync-strobe does not match the rocs 156MHz timestamp counter
471  SYSMSG_TS156_SYNC = 13, // added when 156MHz timestamp counter is reset by a DLM
472  SYSMSG_GDPB_UNKWN = 15, // Raw data from gDPB in case of unknown message type from GET4
473  SYSMSG_GET4V1_32BIT_0 = 240, // Get4 V1.0, 32bit mode, Raw messages
474  SYSMSG_GET4V1_32BIT_1 = 241, // Get4 V1.0, 32bit mode, Raw messages
475  SYSMSG_GET4V1_32BIT_2 = 242, // Get4 V1.0, 32bit mode, Raw messages
476  SYSMSG_GET4V1_32BIT_3 = 243, // Get4 V1.0, 32bit mode, Raw messages
477  SYSMSG_GET4V1_32BIT_4 = 244, // Get4 V1.0, 32bit mode, Raw messages
478  SYSMSG_GET4V1_32BIT_5 = 245, // Get4 V1.0, 32bit mode, Raw messages
479  SYSMSG_GET4V1_32BIT_6 = 246, // Get4 V1.0, 32bit mode, Raw messages
480  SYSMSG_GET4V1_32BIT_7 = 247, // Get4 V1.0, 32bit mode, Raw messages
481  SYSMSG_GET4V1_32BIT_8 = 248, // Get4 V1.0, 32bit mode, Raw messages
482  SYSMSG_GET4V1_32BIT_9 = 249, // Get4 V1.0, 32bit mode, Raw messages
483  SYSMSG_GET4V1_32BIT_10 = 250, // Get4 V1.0, 32bit mode, Raw messages
484  SYSMSG_GET4V1_32BIT_11 = 251, // Get4 V1.0, 32bit mode, Raw messages
485  SYSMSG_GET4V1_32BIT_12 = 252, // Get4 V1.0, 32bit mode, Raw messages
486  SYSMSG_GET4V1_32BIT_13 = 253, // Get4 V1.0, 32bit mode, Raw messages
487  SYSMSG_GET4V1_32BIT_14 = 254, // Get4 V1.0, 32bit mode, Raw messages
488  SYSMSG_GET4V1_32BIT_15 = 255, // Get4 V1.0, 32bit mode, Raw messages
489  };
490 
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
496  };
497 
498  enum MessagePrintMask {
499  msg_print_Prefix = 1,
500  msg_print_Data = 2,
501  msg_print_Hex = 4,
502  msg_print_Human = 8
503  };
504 
505  enum MessagePrintType {
506  msg_print_Cout = 1,
507  msg_print_FairLog = 2,
508  msg_print_File = 3
509  };
510 
511  enum Get4Message32bTypes {
512  GET4_32B_EPOCH = 0,
513  GET4_32B_SLCM = 1,
514  GET4_32B_ERROR = 2,
515  GET4_32B_DATA = 3
516  };
517 
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
523  };
524 
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
546  };
547 
548  // Max nb of each external trigger signal type
549  const uint32_t kuMaxSync = 2; // <- MAX_SYNC
550  const uint32_t kuMaxAux = 4; // <- MAX_AUX
551 
552  class Message {
553 
554  protected:
555  uint64_t data; // main and only storage field for the message
556 
557  public:
558  Message() : data(0) {}
559 
560  Message(const Message& src) : data(src.data) {}
561 
562  Message( uint64_t dataIn ) : data(dataIn) {}
563 
564  virtual ~Message() {};
565 
566  void assign(const Message& src) { data = src.data; }
567 
568  Message& operator=(const Message& src) { assign(src); return *this; }
569 
570  inline void reset() { data = 0; }
571 
572  inline uint64_t getData() const { return data; }
573  inline void setData( uint64_t value) { data = value; }
574 
575  inline uint64_t getFieldLong(uint32_t shift, uint32_t len) const
576  { return (data >> shift) & (((static_cast<uint64_t>(1)) << len) - 1); }
577 
578  inline uint32_t getField(uint32_t shift, uint32_t len) const
579  { return (data >> shift) & (((static_cast<uint32_t>(1)) << len) - 1); }
580 
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); }
584 
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); }
588 
589  inline uint8_t getBit(uint32_t shift) const
590  { return (data >> shift) & 1; }
591 
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)) ; }
594 
595 
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);
609  }
610 
611  // --------------------------- common fields ---------------------------------
612 
614  inline uint8_t getMessageType() const { return getField(0, 4); }
615 
617 
621  inline uint16_t getRocNumber() const { return getField(48, 16); }
622 
624  inline void setMessageType(uint8_t v) { setField(0, 4, v); }
625 
627  inline void setRocNumber(uint16_t v) { setField(48, 16, v); }
628 
629  // ---------- Epoch2 marker access methods ------------
630 
633  inline uint32_t getEpoch2EpochMissmatch() const { return getBit(4); }
634 
636  inline uint32_t getEpoch2EpochLost() const { return getBit(5); }
637 
639  inline uint32_t getEpoch2DataLost() const { return getBit(6); }
640 
642  inline uint32_t getEpoch2Sync() const { return getBit(7); }
643 
647  inline uint32_t getEpoch2StampTime() const { return getField(8, 2); }
648 
650  // on some machines 32-bit field is not working
651  inline uint32_t getEpoch2Number() const { return (data >> 10) & 0xFFFFFFFF; }
652 
655  inline uint32_t getEpoch2ChipNumber() const { return getField(42, 6); }
656 
658  inline void setEpoch2EpochMissmatch(uint32_t v) { setBit(4, v); }
659 
661  inline void setEpoch2EpochLost(uint32_t v) { setBit(5, v); }
662 
664  inline void setEpoch2DataLost(uint32_t v) { setBit(6, v); }
665 
667  inline void setEpoch2Sync(uint32_t v) { setBit(7, v); }
668 
672  inline void setEpoch2StampTime(uint32_t v) { setField(8, 2, v); }
673 
675  inline void setEpoch2Number(uint32_t v) { setField(10, 32, v); }
676 
679  inline void setEpoch2ChipNumber(uint32_t v) { setField(42, 6, v); }
680 
681  // ---------- Get4 24b Hit data access methods ----------------
682 
684  inline uint8_t getGet4Number() const { return getField(38, 6); }
685 
687  inline uint8_t getGet4ChNum() const { return getField(36, 2); }
688 
690  inline uint32_t getGet4Ts() const { return getField(17, 19); }
691 
693  inline uint32_t getGet4FineTs() const { return getField(17, 7); }
694 
696  inline uint32_t getGet4CoarseTs() const { return getField(24, 12); }
697 
699  inline uint32_t getGet4Edge() const { return getBit(16); }
700 
703  inline uint32_t getGet4CRC() const { return getField(0, 8); }
704 
705 
707  inline void setGet4Number(uint8_t v) { setField(38, 6, v); }
708 
710  inline void setGet4ChNum(uint8_t v) { setField(36, 2, v); }
711 
713  inline void setGet4Ts(uint32_t v) { setField(17, 19, v); }
714 
716  inline void setGet4Edge(uint32_t v) { setBit(16, v); }
717 
720  inline void setGet4CRC(uint32_t v) { setField(0, 8, v); }
721 
722  // ---------- System message access methods ----------
723 
724  // 2 bit unused
725 
727  inline uint8_t getSysMesType() const { return getField(8, 8); }
728 
730  // inline uint32_t getSysMesData() const { return getField(16, 32); }
731  // on some machine 32-bit field not working
732  inline uint32_t getSysMesData() const { return data >> 16; }
733 
735  inline void setSysMesType(uint8_t v) { setField(8, 8, v); }
736 
738  inline void setSysMesData(uint32_t v) { setField(16, 32, v); }
739 
740  // ---------- Get4 gDPB 24b/32b ALL access methods ------------------------
741  inline uint16_t getGdpbGenChipId() const { return getField( 42, 6); }
742  inline void setGdpbGenChipId(uint32_t v) { setField(42, 6, v); }
743 
744  // ---------- Get4 gDPB 24b/32b Hit access methods ------------------------
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); }
750  // ---------- Get4 gDPB 24b Hit access methods ----------------------------
751  inline bool getGdpbHit24Edge() const { return getBit( 20 ); }
752  // ---------- Get4 gDPB 32b Hit access methods ----------------------------
753  inline bool getGdpbHit32DllLck() const { return getBit( 20 ); }
754  inline uint16_t getGdpbHit32Tot() const { return getField( 12, 8); }
755 
756  // ---------- Get4 gDPB 24b/32b Epoch access methods ----------------------
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 ); }
764 
765  // ---------- Get4 gDPB 24b/32b Slow cont. access methods -----------------
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); }
772 
773  // ---------- Get4 gDPB System Msg access methods -------------------------
774  inline bool getGdpbSysLinkId() const { return getBit( 41 ); }
775  inline uint16_t getGdpbSysSubType() const { return getField( 37, 4); }
776  // ---------- Get4 gDPB 24b/32b Errors access methods ---------------------
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); }
782  // ---------- Get4 gDPB unknown msg type access methods -------------------
783  inline uint32_t getGdpbSysUnkwData() const { return getField( 4, 32); }
784 
785  // ---------- STAR Trigger messages access methods ------------------------
786  inline uint16_t getStarTrigMsgIndex() const { return getField( 4, 4 ); }
787  //++++//
788  inline uint64_t getGdpbTsMsbStarA() const { return getFieldLong( 8, 40 ); }
789  //++++//
790  inline uint64_t getGdpbTsLsbStarB() const { return getFieldLong( 24, 24 ); }
791  inline uint64_t getStarTsMsbStarB() const { return getFieldLong( 8, 16 ); }
792  //++++//
793  inline uint64_t getStarTsMidStarC() const { return getFieldLong( 8, 40 ); }
794  //++++//
795  inline uint64_t getStarTsLsbStarD() const { return getFieldLong( 40, 8 ); }
797  inline uint32_t getStarFillerD() const { return getField( 28, 12 ); } // Should be always 0
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 ); }
801 
802  // ---------- STAR Trigger messages setter methods ------------------------
803  inline void setStarTrigMsgIndex( uint8_t v ) { setField( 4, 4, v ); }
804  //++++//
805  inline void setGdpbTsMsbStarA( uint64_t fullGdpbTs ) { setFieldLong( 8, 40, ( fullGdpbTs >> 24 ) ); }
806  //++++//
807  inline void setGdpbTsLsbStarB( uint64_t fullGdpbTs ) { setFieldLong( 24, 24, ( fullGdpbTs ) ); }
808  inline void setStarTsMsbStarB( uint64_t fullStarTs ) { setFieldLong( 8, 16, ( fullStarTs >> 48 ) ); }
809  //++++//
810  inline void setStarTsMidStarC( uint64_t fullStarTs ) { setFieldLong( 8, 40, ( fullStarTs >> 8 ) ); }
811  //++++//
812  inline void setStarTsLsbStarD( uint64_t fullStarTs ) { setFieldLong( 40, 8, ( fullStarTs ) ); }
814  inline void setStarFillerD() { setField( 28, 12, 0 ); } // Should be always 0
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 ); }
818 
819  // ---------- Common functions -----------------------
820 
822  inline bool isNopMsg() const { return getMessageType() == MSG_NOP; }
824  inline bool isEpoch2Msg() const { return getMessageType() == MSG_EPOCH2;}
826  inline bool isGet4Msg() const { return getMessageType() == MSG_GET4; }
828  inline bool isSysMsg() const { return getMessageType() == MSG_SYS; }
830  inline bool isGet4SlCtrMsg() const { return getMessageType() == MSG_GET4_SLC; }
832  inline bool isGet4Hit32Msg() const { return getMessageType() == MSG_GET4_32B; }
834  inline bool isGet4SysMsg() const { return getMessageType() == MSG_GET4_SYS; }
836  inline bool isStarTrigger() const { return getMessageType() == MSG_STAR_TRI;}
838  inline bool isGet4Hack32Msg() const { return
839  ( (getMessageType() == MSG_SYS) &&
840  (SYSMSG_GET4V1_32BIT_0 <= getSysMesType()) ); }
841 
843  inline bool isStartDaqMsg() const
844  { return isSysMsg() && (getSysMesType() == SYSMSG_DAQ_START); }
846  inline bool isStopDaqMsg() const
847  { return isSysMsg() && (getSysMesType() == SYSMSG_DAQ_FINISH); }
848 
849 
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;
852 
853  void printData(unsigned outType = msg_print_Cout, unsigned kind = msg_print_Human,
854  uint32_t epoch = 0, std::ostream& os = std::cout ) const;
855 
856  uint64_t getMsgFullTime(uint64_t epoch) const;
857 
858  double getMsgFullTimeD(uint64_t epoch) const;
859 
861  inline static uint64_t FullTimeStamp2(uint64_t epoch, uint32_t stamp)
862  { return ( epoch << 19) | (stamp & 0x7ffff); }
863 
864 
865  static uint64_t CalcDistance(uint64_t start, uint64_t stop);
866 
867  static double CalcDistanceD(double start, double stop);
868 
869  bool operator<(const gdpb::Message& other) const;
870 
871  // -------------------- methods for working with different formats
872 
873  static uint32_t RawSize(int fmt);
874 
875  bool assign(void* src, int fmt = formatNormal);
876 
877  bool copyto(void* tgt, int fmt = formatNormal);
878  };
879 
880  class FullMessage : public Message {
881  protected:
882  uint64_t fulExtendedEpoch; // Epoch of the message, extended with 32b epoch cycle counter
883 
884  public:
885  FullMessage() : Message(), fulExtendedEpoch(0) {}
886 
887  FullMessage(const Message& src, uint64_t uEpIn = 0) : Message(src), fulExtendedEpoch(uEpIn) {}
888 
889  FullMessage(const FullMessage& src) : Message(src), fulExtendedEpoch(src.fulExtendedEpoch) {}
890 
891  void assign(const FullMessage& src) { Message::assign(src); fulExtendedEpoch = src.fulExtendedEpoch; }
892 
893  FullMessage& operator=(const FullMessage& src) { assign(src); return *this; }
894 
895  bool operator<(const FullMessage& other) const;
896 
897  inline void reset() { Message::reset(); fulExtendedEpoch = 0; }
898 
899  inline uint64_t getExtendedEpoch() const {return fulExtendedEpoch; }
900 
901  // Works only for GET4 v2.XXX !!!!!!
902  inline double GetFullTimeNs() { return getMsgFullTimeD( fulExtendedEpoch ); }
903 
904  void PrintMessage( unsigned outType = msg_print_Cout, unsigned kind = msg_print_Human ) const;
905  };
906 
907 } // gdpb
908 
909 
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)