Belle II Software development
RawFTSWFormat_latest Class Reference

The Raw FTSW class 3 ( 2019.8.20 ) More...

#include <RawFTSWFormat_latest.h>

Inheritance diagram for RawFTSWFormat_latest:
RawFTSWFormat RawDataBlockFormat

Public Types

enum  {
  POS_NWORDS = 0 ,
  POS_HDR_NWORDS = 1 ,
  POS_NUMEVE_NUMNODES = 2 ,
  POS_EXP_RUN_NO = 3 ,
  POS_EVE_NO_1 = 4 ,
  POS_NA_1 = 5 ,
  POS_NODE_ID = 6 ,
  POS_NA_2 = 7
}
 header format More...
 
enum  {
  POS_TT_CTIME_TRGTYPE = 8 ,
  POS_TT_UTIME = 9 ,
  POS_EVE_NO_2 = 10 ,
  POS_FRAME_COUNT = 11 ,
  POS_TIME_SINCE_PREV_TRG = 12 ,
  POS_INJECTION_INFO = 13 ,
  POS_BUNCH_NUM = 14 ,
  POS_TVSEC_FROM_PC = 15 ,
  POS_TVUSEC_FROM_PC = 16
}
 data format More...
 
enum  {
  POS_RSVD_1 = 20 ,
  POS_MAGIC_1 = 21
}
 trailer format More...
 
enum  {
  INJ_HER_LER_MASK = 0x80000000 ,
  INJ_HER_LER_SHIFT = 31 ,
  INJ_TIME_MASK = 0x7FFFFFFF ,
  INJ_TIME_SHIFT = 0 ,
  INJ_BUNCH_MASK = 0x000007FF ,
  INJ_BUNCH_SHIFT = 0 ,
  EXP_MASK = 0xFFC00000 ,
  EXP_SHIFT = 22 ,
  RUNNO_MASK = 0x003FFF00 ,
  RUNNO_SHIFT = 8 ,
  SUBRUNNO_MASK = 0x000000FF ,
  TTCTIME_MASK = 0x7FFFFFF0 ,
  TTCTIME_SHIFT = 4 ,
  TRGTYPE_MASK = 0xF
}
 
enum  { SIZE_FTSW_PACKET = 22 }
 
enum  { FTSW_MAGIC_TRAILER = 0x7FFF0000 }
 
enum  {
  POS_NWORDS = 0 ,
  POS_NODE_ID = 6
}
 
enum  {
  POS_FTSW_ID_OLD = 5 ,
  TEMP_POS_NWORDS_HEADER = 1 ,
  OLD_FTSW_NWORDS_HEADER = 6
}
 

Public Member Functions

 RawFTSWFormat_latest ()
 Default constructor.
 
virtual ~RawFTSWFormat_latest ()
 Constructor using existing pointer to raw data buffer.
 
int GetNwordsHeader (int n) OVERRIDE_CPP17
 Get # of words of header.
 
unsigned int GetFTSWNodeID (int n) OVERRIDE_CPP17
 Get Node # ( should be "TTD " )
 
unsigned int GetEveNo (int n) OVERRIDE_CPP17
 Get event #.
 
unsigned int GetTTCtimeTRGType (int n) OVERRIDE_CPP17
 Get a word containing ctime and trigger type info.
 
unsigned int GetTTUtime (int n) OVERRIDE_CPP17
 get unixtime of the trigger
 
int GetTTCtime (int n) OVERRIDE_CPP17
 Get ctime of the trigger.
 
int GetTRGType (int n) OVERRIDE_CPP17
 Get trgtype.
 
void GetTTTimeVal (int n, struct timeval *tv) OVERRIDE_CPP17
 Get timeval from ctime and utime.
 
void GetTTTimeSpec (int n, struct timespec *ts) OVERRIDE_CPP17
 Get timespec from ctime and utime.
 
unsigned long long int GetTTTimeNs (int n) OVERRIDE_CPP17
 Get time in ns since epoch from ctime and utime.
 
unsigned int GetMagicTrailer (int n) OVERRIDE_CPP17
 Get magic number for data corruption check.
 
void GetPCTimeVal (int n, struct timeval *tv) OVERRIDE_CPP17
 Get stored information of getimeofday in a PC.
 
void CheckData (int n, unsigned int prev_evenum, unsigned int *cur_evenum, unsigned int prev_exprunsubrun_no, unsigned int *cur_exprunsubrun_no) OVERRIDE_CPP17
 check the data contents
 
unsigned int GetExpRunSubrun (int n) OVERRIDE_CPP17
 Exp# (10bit) run# (14bit) restart # (8bit)
 
int GetRunNo (int n) OVERRIDE_CPP17
 Get run #.
 
int GetSubRunNo (int n) OVERRIDE_CPP17
 Get subrun #.
 
int GetRunNoSubRunNo (int n) OVERRIDE_CPP17
 get a word cotaining run # and subrun #
 
int GetExpNo (int n) OVERRIDE_CPP17
 Get Exp #.
 
int GetIsHER (int n) OVERRIDE_CPP17
 HER injection = 1 or LER injection = 0.
 
unsigned int GetTimeSinceLastInjection (int n) OVERRIDE_CPP17
 Get time since the last injection.
 
unsigned int GetTimeSincePrevTrigger (int n) OVERRIDE_CPP17
 Get time since the previous trigger.
 
unsigned int GetBunchNumber (int n) OVERRIDE_CPP17
 Get a bunch number.
 
unsigned int GetFrameCount (int n) OVERRIDE_CPP17
 Get a frame count.
 
virtual int Get15bitTLUTag (int n)
 DESY test only (ver.1)
 
virtual void SetBuffer (int *bufin, int nwords, int delete_flag, int num_events, int num_nodes)
 set buffer ( delete_flag : m_buffer is freeed( = 0 )/ not freeed( = 1 ) in Destructer )
 
virtual int TotalBufNwords ()
 Get total length of m_buffer.
 
virtual int GetBufferPos (int n)
 get position of data block in word
 
virtual int * GetBuffer (int n)
 get nth buffer pointer
 
virtual int * GetWholeBuffer ()
 get pointer to buffer(m_buffer)
 
virtual int GetNumEntries ()
 get # of data blocks = (# of nodes)*(# of events)
 
virtual int GetNumNodes ()
 get # of data sources(e.g. # of COPPER boards) in m_buffer
 
virtual int GetNumEvents ()
 get # of events in m_buffer
 
virtual int GetPreAllocFlag ()
 get malloc_flag
 
virtual int GetBlockNwords (int n)
 get size of a data block
 
virtual int CheckFTSWID (int n)
 get FTSW ID to check whether this data block is FTSW data or not
 
virtual int CheckTLUID (int n)
 get FTSW ID to check whether this data block is FTSW data or not
 
virtual void CopyBlock (int n, int *buf_to)
 Copy one datablock to buffer.
 
virtual void PrintData (int *buf, int nwords)
 print data
 

Protected Attributes

int m_nwords
 number of words of buffer
 
int m_num_nodes
 number of nodes in this object
 
int m_num_events
 number of events in this object
 
int * m_buffer
 Buffer.
 
int m_use_prealloc_buf
 not recorded
 

Detailed Description

The Raw FTSW class 3 ( 2019.8.20 )

This class stores the RAW data containing FTSW data(event #, trg time ).

Definition at line 24 of file RawFTSWFormat_latest.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited

Definition at line 75 of file RawDataBlockFormat.h.

75 {
76 POS_NWORDS = 0,
77 POS_NODE_ID = 6
78 };

◆ anonymous enum

anonymous enum
inherited

Definition at line 80 of file RawDataBlockFormat.h.

80 {
81 // Tentatively needed to distinguish new and old FTSW format, which will be changed in Nov. 2013
82 POS_FTSW_ID_OLD = 5,
83 TEMP_POS_NWORDS_HEADER = 1,
84 OLD_FTSW_NWORDS_HEADER = 6
85 };

◆ anonymous enum

anonymous enum

header format

Definition at line 133 of file RawFTSWFormat_latest.h.

133 {
134 POS_NWORDS = 0, // same as v.1( late-DESY ver.)
135 POS_HDR_NWORDS = 1, // same as v.1
136 POS_NUMEVE_NUMNODES = 2, // same as v.1
137 POS_EXP_RUN_NO = 3, // same as v.1
138 POS_EVE_NO_1 = 4, // same as v.1
139 POS_NA_1 = 5, // same as v.1
140 POS_NODE_ID = 6, // same as v.1
141 POS_NA_2 = 7 // same as v.1
142 };

◆ anonymous enum

anonymous enum

data format

Definition at line 145 of file RawFTSWFormat_latest.h.

145 {
146 POS_TT_CTIME_TRGTYPE = 8, // same as v.1
147 POS_TT_UTIME = 9, // same as v.1
148 POS_EVE_NO_2 = 10,
149 POS_FRAME_COUNT = 11,
150 POS_TIME_SINCE_PREV_TRG = 12,
151 POS_INJECTION_INFO = 13,
152 POS_BUNCH_NUM = 14,
153 POS_TVSEC_FROM_PC = 15,
154 POS_TVUSEC_FROM_PC = 16
155 };

◆ anonymous enum

anonymous enum

trailer format

Definition at line 158 of file RawFTSWFormat_latest.h.

158 {
159 POS_RSVD_1 = 20, // same as v.1 but position is shifted
160 POS_MAGIC_1 = 21 // same as v.1 but position is shifted
161 };

◆ anonymous enum

anonymous enum

Definition at line 163 of file RawFTSWFormat_latest.h.

163 {
164 INJ_HER_LER_MASK = 0x80000000,
165 INJ_HER_LER_SHIFT = 31,
166 INJ_TIME_MASK = 0x7FFFFFFF,
167 INJ_TIME_SHIFT = 0,
168 INJ_BUNCH_MASK = 0x000007FF,
169 INJ_BUNCH_SHIFT = 0,
170 EXP_MASK = 0xFFC00000,
171 EXP_SHIFT = 22,
172 RUNNO_MASK = 0x003FFF00,
173 RUNNO_SHIFT = 8,
174 SUBRUNNO_MASK = 0x000000FF,
175 TTCTIME_MASK = 0x7FFFFFF0,
176 TTCTIME_SHIFT = 4,
177 TRGTYPE_MASK = 0xF
178 };

◆ anonymous enum

anonymous enum

Definition at line 180 of file RawFTSWFormat_latest.h.

180 {
181 SIZE_FTSW_PACKET = 22
182 };

◆ anonymous enum

anonymous enum

Definition at line 185 of file RawFTSWFormat_latest.h.

185 {
186 FTSW_MAGIC_TRAILER = 0x7FFF0000
187 };

Constructor & Destructor Documentation

◆ RawFTSWFormat_latest()

Default constructor.

Definition at line 15 of file RawFTSWFormat_latest.cc.

16{
17}

◆ ~RawFTSWFormat_latest()

~RawFTSWFormat_latest ( )
virtual

Constructor using existing pointer to raw data buffer.

Destructor

Definition at line 19 of file RawFTSWFormat_latest.cc.

20{
21}

Member Function Documentation

◆ CheckData()

void CheckData ( int  n,
unsigned int  prev_evenum,
unsigned int *  cur_evenum,
unsigned int  prev_exprunsubrun_no,
unsigned int *  cur_exprunsubrun_no 
)
virtual

check the data contents

Implements RawFTSWFormat.

Definition at line 133 of file RawFTSWFormat_latest.cc.

136{
137 int err_flag = 0;
138 char err_buf[500];
139 *cur_evenum = GetEveNo(n);
140 *cur_exprunsubrun_no = GetExpRunSubrun(n);
141
142
143#ifndef NO_DATA_CHECK
144 if (prev_exprunsubrun_no == *cur_exprunsubrun_no) {
145 if ((unsigned int)(prev_evenum + 1) != *cur_evenum) {
146 sprintf(err_buf, "[FATAL] ERROR_EVENT : Event # jump : i %d prev 0x%x cur 0x%x : Exiting...\n %s %s %d\n",
147 n, prev_evenum, *cur_evenum, __FILE__, __PRETTY_FUNCTION__, __LINE__);
148 printf("%s", err_buf);
149 err_flag = 1;
150 }
151 }
152#endif
153
154 if (GetBlockNwords(n) != SIZE_FTSW_PACKET) {
155 sprintf(err_buf, "[FATAL] ERROR_EVENT : invalid FTSW packet length : block %d nwords %d must be %d : Exiting...\n %s %s %d\n",
156 n, GetBlockNwords(n), SIZE_FTSW_PACKET, __FILE__, __PRETTY_FUNCTION__, __LINE__);
157 printf("%s", err_buf);
158 err_flag = 1;
159 }
160
161 if (GetMagicTrailer(n) != FTSW_MAGIC_TRAILER) {
162 sprintf(err_buf, "[FATAL] ERROR_EVENT : invalid magic word : block %d magic word 0x%x must be 0x%x : Exiting...\n %s %s %d\n",
163 n, GetMagicTrailer(n), FTSW_MAGIC_TRAILER, __FILE__, __PRETTY_FUNCTION__, __LINE__);
164 printf("%s", err_buf); fflush(stdout);
165 err_flag = 1;
166 }
167
168 if (err_flag == 1) {
169 printf("[DEBUG] ========== dump a data block : block # %d==========\n", n);
170 printf("[DEBUG] ");
171 for (int k = 0 ; k < GetBlockNwords(n); k++) {
172 printf("0x%.8x ", (GetBuffer(n))[k]);
173 if (k % 10 == 9) printf("\n[DEBUG] ");
174 }
175 fflush(stderr);
176 B2FATAL(err_buf);
177 }
178
179 return;
180}
virtual int GetBlockNwords(int n)
get size of a data block
virtual int * GetBuffer(int n)
get nth buffer pointer
unsigned int GetEveNo(int n) OVERRIDE_CPP17
Get event #.
unsigned int GetMagicTrailer(int n) OVERRIDE_CPP17
Get magic number for data corruption check.
unsigned int GetExpRunSubrun(int n) OVERRIDE_CPP17
Exp# (10bit) run# (14bit) restart # (8bit)

◆ CheckFTSWID()

int CheckFTSWID ( int  n)
virtualinherited

get FTSW ID to check whether this data block is FTSW data or not

Definition at line 73 of file RawDataBlockFormat.cc.

74{
75 int pos = POS_NODE_ID;
76 if (m_buffer[ GetBufferPos(n) + TEMP_POS_NWORDS_HEADER ] == OLD_FTSW_NWORDS_HEADER) {
77 pos = POS_FTSW_ID_OLD;
78 }
79
80 if ((m_buffer[ GetBufferPos(n) + pos ] & 0xffffff00) == 0x54544400) { // "TTD" + format version ( 0x20=DESY, 0x31=2018/7/11)
81 return 1;
82 } else {
83 return 0;
84 }
85}
virtual int GetBufferPos(int n)
get position of data block in word

◆ CheckTLUID()

int CheckTLUID ( int  n)
virtualinherited

get FTSW ID to check whether this data block is FTSW data or not

Definition at line 88 of file RawDataBlockFormat.cc.

89{
90 int pos = POS_NODE_ID;
91 if (m_buffer[ GetBufferPos(n) + TEMP_POS_NWORDS_HEADER ] == OLD_FTSW_NWORDS_HEADER) {
92 pos = POS_FTSW_ID_OLD;
93 }
94 if (m_buffer[ GetBufferPos(n) + pos ] == 0x544c5520) { // "TLU "
95 return 1;
96 } else {
97 return 0;
98 }
99}

◆ CopyBlock()

void CopyBlock ( int  n,
int *  buf_to 
)
virtualinherited

Copy one datablock to buffer.

Definition at line 173 of file RawDataBlockFormat.cc.

174{
175 memcpy(buf_to, GetBuffer(n), GetBlockNwords(n) * sizeof(int));
176 return;
177}

◆ Get15bitTLUTag()

int Get15bitTLUTag ( int  n)
virtualinherited

DESY test only (ver.1)

Reimplemented in RawFTSWFormat_v1.

Definition at line 24 of file RawFTSWFormat.cc.

25{
26 char err_buf[500];
27 sprintf(err_buf,
28 "[FATAL] This function is not supported in the version of RawFTSW format that you're using. n=%d : %s %s %d: Exiting...\n",
29 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
30 printf("%s\n", err_buf); fflush(stdout);
31 B2FATAL(err_buf);
32 return -1;
33}

◆ GetBlockNwords()

int GetBlockNwords ( int  n)
virtualinherited

get size of a data block

Definition at line 107 of file RawDataBlockFormat.cc.

108{
109 int size;
110 if (n == (m_num_events * m_num_nodes) - 1) {
111 size = m_nwords - GetBufferPos(n);
112 } else {
113 size = GetBufferPos(n + 1) - GetBufferPos(n);
114 }
115 return size;
116}
int m_num_events
number of events in this object
int m_num_nodes
number of nodes in this object
int m_nwords
number of words of buffer

◆ GetBuffer()

int * GetBuffer ( int  n)
virtualinherited

get nth buffer pointer

Definition at line 124 of file RawDataBlockFormat.cc.

125{
126 int pos_nwords = GetBufferPos(n);
127 return &(m_buffer[ pos_nwords ]);
128}

◆ GetBufferPos()

int GetBufferPos ( int  n)
virtualinherited

get position of data block in word

Definition at line 30 of file RawDataBlockFormat.cc.

31{
32 if (m_buffer == NULL || m_nwords <= 0) {
33 char err_buf[500];
34 sprintf(err_buf, "[FATAL] RawPacket buffer(%p) is not available or length(%d) is not set.\n %s %s %d\n",
35 m_buffer, m_nwords, __FILE__, __PRETTY_FUNCTION__, __LINE__);
36 printf("%s", err_buf); fflush(stdout);
37 B2FATAL(err_buf);
38 }
39
40 if (n >= (m_num_events * m_num_nodes)) {
41 char err_buf[500];
42 sprintf(err_buf, "[FATAL] Invalid COPPER block No. (%d : max %d ) is specified. Exiting... \n %s %s %d\n",
43 n, (m_num_events * m_num_nodes), __FILE__, __PRETTY_FUNCTION__, __LINE__);
44 printf("%s", err_buf); fflush(stdout);
45 B2FATAL(err_buf);
46 }
47
48 int pos_nwords = 0;
49 for (int i = 1; i <= n ; i++) {
50 if (m_buffer[ pos_nwords ] <= 0) {
51 char err_buf[500];
52 sprintf(err_buf,
53 "[FATAL] ERROR_EVENT : length of this data block is strange ( %d words ). Maybe data is corrupted or RawHeader info has not been filled yet. Exiting...",
54 m_buffer[ pos_nwords ]);
55 printf("%s", err_buf);
56 B2FATAL(err_buf);
57 } else {
58 pos_nwords += m_buffer[ pos_nwords ];
59 }
60 if (pos_nwords >= m_nwords) {
61 char err_buf[500];
62 sprintf(err_buf, "[FATAL] ERROR_EVENT : value of pos_nwords(%d) is larger than m_nwords(%d). Exiting...\n %s %s %d\n",
63 pos_nwords, m_nwords, __FILE__, __PRETTY_FUNCTION__, __LINE__);
64 printf("%s", err_buf); fflush(stdout);
65 B2FATAL(err_buf); // to reduce multiple error messages
66 }
67 }
68 return pos_nwords;
69
70}

◆ GetBunchNumber()

unsigned int GetBunchNumber ( int  n)
virtual

Get a bunch number.

Reimplemented from RawFTSWFormat.

Definition at line 118 of file RawFTSWFormat_latest.cc.

119{
120 unsigned int* buffer = (unsigned int*) GetBuffer(n);
121 unsigned int ret = (buffer[ POS_BUNCH_NUM ] & INJ_BUNCH_MASK) >> INJ_BUNCH_SHIFT;
122 return ret;
123}

◆ GetEveNo()

unsigned int GetEveNo ( int  n)
virtual

Get event #.

Implements RawFTSWFormat.

Definition at line 86 of file RawFTSWFormat_latest.cc.

87{
88 return m_buffer[ GetBufferPos(n) + POS_EVE_NO_1 ];
89}

◆ GetFrameCount()

unsigned int GetFrameCount ( int  n)
virtual

Get a frame count.

Reimplemented from RawFTSWFormat.

Definition at line 125 of file RawFTSWFormat_latest.cc.

126{
127 unsigned int* buffer = (unsigned int*) GetBuffer(n);
128 unsigned int ret = buffer[ POS_FRAME_COUNT ];
129 return ret;
130}

◆ GetFTSWNodeID()

unsigned int GetFTSWNodeID ( int  n)
virtual

Get Node # ( should be "TTD " )

Implements RawFTSWFormat.

Definition at line 81 of file RawFTSWFormat_latest.cc.

82{
83 return (unsigned int)(m_buffer[ GetBufferPos(n) + POS_NODE_ID ]);
84}

◆ GetIsHER()

int GetIsHER ( int  n)
virtual

HER injection = 1 or LER injection = 0.

Reimplemented from RawFTSWFormat.

Definition at line 96 of file RawFTSWFormat_latest.cc.

97{
98 int* buffer = GetBuffer(n);
99 int ret = (buffer[ POS_INJECTION_INFO ] & INJ_HER_LER_MASK) >> INJ_HER_LER_SHIFT;
100 return ret; // 1 -> HER, 0 -> LER
101}

◆ GetMagicTrailer()

unsigned int GetMagicTrailer ( int  n)
virtual

Get magic number for data corruption check.

Implements RawFTSWFormat.

Definition at line 91 of file RawFTSWFormat_latest.cc.

92{
93 return m_buffer[ GetBufferPos(n) + POS_MAGIC_1 ];
94}

◆ GetNumEntries()

virtual int GetNumEntries ( )
inlinevirtualinherited

get # of data blocks = (# of nodes)*(# of events)

Definition at line 49 of file RawDataBlockFormat.h.

49{ return m_num_events * m_num_nodes; }

◆ GetNumEvents()

virtual int GetNumEvents ( )
inlinevirtualinherited

get # of events in m_buffer

Definition at line 55 of file RawDataBlockFormat.h.

55{ return m_num_events; }

◆ GetNumNodes()

virtual int GetNumNodes ( )
inlinevirtualinherited

get # of data sources(e.g. # of COPPER boards) in m_buffer

Definition at line 52 of file RawDataBlockFormat.h.

52{ return m_num_nodes; }

◆ GetNwordsHeader()

int GetNwordsHeader ( int  n)
virtual

Get # of words of header.

Implements RawFTSWFormat.

Definition at line 75 of file RawFTSWFormat_latest.cc.

76{
77 return m_buffer[ GetBufferPos(n) + POS_HDR_NWORDS ];
78}

◆ GetPCTimeVal()

void GetPCTimeVal ( int  n,
struct timeval *  tv 
)
virtual

Get stored information of getimeofday in a PC.

Reimplemented from RawFTSWFormat.

Definition at line 62 of file RawFTSWFormat_latest.cc.

63{
64 tv->tv_sec = (unsigned int)(m_buffer[ GetBufferPos(n) + POS_TVSEC_FROM_PC ]);
65 tv->tv_usec = (unsigned int)(m_buffer[ GetBufferPos(n) + POS_TVUSEC_FROM_PC ]);
66 return ;
67}

◆ GetPreAllocFlag()

virtual int GetPreAllocFlag ( )
inlinevirtualinherited

get malloc_flag

Definition at line 58 of file RawDataBlockFormat.h.

58{ return m_use_prealloc_buf; }

◆ GetTimeSinceLastInjection()

unsigned int GetTimeSinceLastInjection ( int  n)
virtual

Get time since the last injection.

Reimplemented from RawFTSWFormat.

Definition at line 104 of file RawFTSWFormat_latest.cc.

105{
106 unsigned int* buffer = (unsigned int*) GetBuffer(n);
107 unsigned int ret = (buffer[ POS_INJECTION_INFO ] & INJ_TIME_MASK) >> INJ_TIME_SHIFT;
108 return ret;
109}

◆ GetTimeSincePrevTrigger()

unsigned int GetTimeSincePrevTrigger ( int  n)
virtual

Get time since the previous trigger.

Reimplemented from RawFTSWFormat.

Definition at line 111 of file RawFTSWFormat_latest.cc.

112{
113 unsigned int* buffer = (unsigned int*) GetBuffer(n);
114 unsigned int ret = buffer[ POS_TIME_SINCE_PREV_TRG ];
115 return ret;
116}

◆ GetTRGType()

int GetTRGType ( int  n)
virtual

Get trgtype.

Implements RawFTSWFormat.

Definition at line 36 of file RawFTSWFormat_latest.cc.

37{
38 return (int)(GetTTCtimeTRGType(n) & TRGTYPE_MASK);
39}
unsigned int GetTTCtimeTRGType(int n) OVERRIDE_CPP17
Get a word containing ctime and trigger type info.

◆ GetTTCtime()

int GetTTCtime ( int  n)
virtual

Get ctime of the trigger.

Implements RawFTSWFormat.

Definition at line 31 of file RawFTSWFormat_latest.cc.

32{
33 return (int)((GetTTCtimeTRGType(n) & TTCTIME_MASK) >> TTCTIME_SHIFT);
34}

◆ GetTTCtimeTRGType()

unsigned int GetTTCtimeTRGType ( int  n)
virtual

Get a word containing ctime and trigger type info.

Implements RawFTSWFormat.

Definition at line 24 of file RawFTSWFormat_latest.cc.

25{
26 return (unsigned int)(m_buffer[ GetBufferPos(n) + POS_TT_CTIME_TRGTYPE ]);
27}

◆ GetTTTimeNs()

unsigned long long int GetTTTimeNs ( int  n)
virtual

Get time in ns since epoch from ctime and utime.

Implements RawFTSWFormat.

Definition at line 70 of file RawFTSWFormat_latest.cc.

71{
72 return (unsigned long long int)GetTTUtime(n) * 1e9 + (long)((double)GetTTCtime(n) / 0.127216);
73}
int GetTTCtime(int n) OVERRIDE_CPP17
Get ctime of the trigger.
unsigned int GetTTUtime(int n) OVERRIDE_CPP17
get unixtime of the trigger

◆ GetTTTimeSpec()

void GetTTTimeSpec ( int  n,
struct timespec *  ts 
)
virtual

Get timespec from ctime and utime.

Implements RawFTSWFormat.

Definition at line 54 of file RawFTSWFormat_latest.cc.

55{
56 ts->tv_sec = GetTTUtime(n);
57 ts->tv_nsec = (long)(((double)GetTTCtime(n)) / 0.127216);
58
59 return ;
60}

◆ GetTTTimeVal()

void GetTTTimeVal ( int  n,
struct timeval *  tv 
)
virtual

Get timeval from ctime and utime.

Implements RawFTSWFormat.

Definition at line 46 of file RawFTSWFormat_latest.cc.

47{
48 tv->tv_sec = GetTTUtime(n);
49 tv->tv_usec = (int)(((double)GetTTCtime(n)) / 127.216);
50
51 return ;
52}

◆ GetTTUtime()

unsigned int GetTTUtime ( int  n)
virtual

get unixtime of the trigger

Implements RawFTSWFormat.

Definition at line 41 of file RawFTSWFormat_latest.cc.

42{
43 return (unsigned int)(m_buffer[ GetBufferPos(n) + POS_TT_UTIME ]);
44}

◆ GetWholeBuffer()

int * GetWholeBuffer ( )
virtualinherited

get pointer to buffer(m_buffer)

Definition at line 119 of file RawDataBlockFormat.cc.

120{
121 return m_buffer;
122}

◆ PrintData()

void PrintData ( int *  buf,
int  nwords 
)
virtualinherited

print data

Definition at line 161 of file RawDataBlockFormat.cc.

162{
163 printf("[DEBUG] ");
164 for (int i = 0; i < nwords; i++) {
165 printf("%.8x ", buf[ i ]);
166 if (i % 10 == 9) printf("\n[DEBUG] ");
167 }
168 printf("\n[DEBUG] ");
169 printf("\n");
170 return;
171}

◆ SetBuffer()

void SetBuffer ( int *  bufin,
int  nwords,
int  delete_flag,
int  num_events,
int  num_nodes 
)
virtualinherited

set buffer ( delete_flag : m_buffer is freeed( = 0 )/ not freeed( = 1 ) in Destructer )

Definition at line 131 of file RawDataBlockFormat.cc.

132{
133
134 if (bufin == NULL) {
135 char err_buf[500];
136 sprintf(err_buf, "[DEBUG] bufin is NULL. Exting...\n");
137 printf("%s", err_buf); fflush(stdout);
138 B2FATAL(err_buf);
139 }
140
141 if (!m_use_prealloc_buf && m_buffer != NULL) delete[] m_buffer;
142
143 if (delete_flag == 0) {
144 m_use_prealloc_buf = true;
145 } else {
146 m_use_prealloc_buf = false;
147 }
148
149 m_nwords = nwords;
150 m_buffer = bufin;
151
152 m_num_nodes = num_nodes;
153 m_num_events = num_events;
154
155 return;
156
157}

◆ TotalBufNwords()

int TotalBufNwords ( )
virtualinherited

Get total length of m_buffer.

Definition at line 101 of file RawDataBlockFormat.cc.

102{
103 return m_nwords;
104}

Member Data Documentation

◆ m_buffer

int* m_buffer
protectedinherited

Buffer.

Definition at line 98 of file RawDataBlockFormat.h.

◆ m_num_events

int m_num_events
protectedinherited

number of events in this object

Definition at line 95 of file RawDataBlockFormat.h.

◆ m_num_nodes

int m_num_nodes
protectedinherited

number of nodes in this object

Definition at line 92 of file RawDataBlockFormat.h.

◆ m_nwords

int m_nwords
protectedinherited

number of words of buffer

Definition at line 89 of file RawDataBlockFormat.h.

◆ m_use_prealloc_buf

int m_use_prealloc_buf
protectedinherited

not recorded

flag for deleting m_buffer in destructer( 0:delete, 1: not delete) When using pre-allocated buffer, the buffer should be reused and not deleted in the destructer

Definition at line 102 of file RawDataBlockFormat.h.


The documentation for this class was generated from the following files: