14#include <rawdata/switch_basf2_standalone.h>
160 MAGIC_WORD = 0x7F7F0000,
161 MAGIC_MASK = 0xFFFF0000,
163 FORMAT_VERSION__MASK = 0x0000FF00,
164 FORMAT_VERSION_SHIFT = 8
168 EXP_MASK = 0xFFC00000,
170 RUNNO_MASK = 0x003FFF00,
172 SUBRUNNO_MASK = 0x000000FF
176 RAWHEADER_NWORDS = 12
180 HDR_NWORDS_MASK = 0x000000FF
186 POS_VERSION_HDRNWORDS = 1,
189 POS_TTCTIME_TRGTYPE = 4,
192 POS_TRUNC_MASK_DATATYPE = 7,
193 POS_OFFSET_1ST_FINESSE = 8,
194 POS_OFFSET_2ND_FINESSE = 9,
195 POS_OFFSET_3RD_FINESSE = 10,
196 POS_OFFSET_4TH_FINESSE = 11,
212 TTCTIME_MASK = 0x7FFFFFF0,
230 B2FATAL(
"m_buffer is NULL. Exiting...");
238 B2FATAL(
"m_buffer is NULL. Data is corrupted or header info has not yet filled. Exiting...");
263 m_buffer[ POS_NODE_ID ] = (int)node_id;
269 m_buffer[ POS_TRUNC_MASK_DATATYPE ] =
270 (data_type & 0x7FFFFFFF) | (
m_buffer[ POS_TRUNC_MASK_DATATYPE ] & 0x80000000);
277 m_buffer[ POS_TRUNC_MASK_DATATYPE ] = (trunc_mask << 31) | (
m_buffer[ POS_TRUNC_MASK_DATATYPE ] & 0x7FFFFFFF);
290 m_buffer[ POS_OFFSET_1ST_FINESSE ] = offset_1st_FINESSE;
296 m_buffer[ POS_OFFSET_2ND_FINESSE ] = offset_2nd_FINESSE;
302 m_buffer[ POS_OFFSET_3RD_FINESSE ] = offset_3rd_FINESSE;
308 m_buffer[ POS_OFFSET_4TH_FINESSE ] = offset_4th_FINESSE;
322 m_buffer[ POS_TTCTIME_TRGTYPE ] = word1;
331 memcpy(&(
m_buffer[ POS_EXP_RUN_NO ]), (
char*)exprun_buf,
sizeof(
int) * 1);
351 return RAWHEADER_NWORDS;
357 return (((
unsigned int)(
m_buffer[ POS_EXP_RUN_NO ]) & EXP_MASK)
364 return (((
unsigned int)(
m_buffer[ POS_EXP_RUN_NO ]) & RUNNO_MASK)
371 return (
m_buffer[ POS_EXP_RUN_NO ] & SUBRUNNO_MASK);
377 return ((
unsigned int)(
m_buffer[ POS_EXP_RUN_NO ]));
390 return (
unsigned int)
m_buffer[ POS_NODE_ID ];
396 return (
m_buffer[ POS_TRUNC_MASK_DATATYPE ] & 0x7FFFFFFF);
402 return (
m_buffer[ POS_TRUNC_MASK_DATATYPE ] >> 23) & 0x1;
408 return (
unsigned int)(
m_buffer[ POS_TRUNC_MASK_DATATYPE ]);
414 m_buffer[ POS_TRUNC_MASK_DATATYPE ] |= (int)error_bit_flag;
421 return m_buffer[ POS_OFFSET_1ST_FINESSE ];
427 return m_buffer[ POS_OFFSET_2ND_FINESSE ];
433 return m_buffer[ POS_OFFSET_3RD_FINESSE ];
439 return m_buffer[ POS_OFFSET_4TH_FINESSE ];
451 return (
unsigned int)(
m_buffer[ POS_TTCTIME_TRGTYPE ]);
469 return (
unsigned int)(
m_buffer[ POS_TTUTIME ]);
475 tv->tv_usec = (int)(((
double)
GetTTCtime()) / 127.216);
int GetNwords()
set contents of header
void SetTruncMask(int trunc_mask)
set contents of header
unsigned int GetEveNo()
get restart #(8bit)
int GetOffset1stFINESSE()
get contents of header
void AddErrorBitFlag(unsigned int error_bit_flag)
Add Detected Error bitflag.
int GetTTCtime()
get contents of header
void SetOffset4thFINESSE(int offset_4th_FINESSE)
set contents of header
void GetTTTimeVal(struct timeval *tv)
get contents of header
void SetFTSW2Words(unsigned int word1, unsigned int word2)
Set values of FTSW info( trigger timing)
int GetSubRunNo()
get run # (14bit)
int GetHdrNwords()
get contents of header
void SetOffset2ndFINESSE(int offset_2nd_FINESSE)
set contents of header
int GetDataType()
get contents of header
void CheckSetBuffer()
initialize header
unsigned int GetTTUtime()
get contents of header
void CheckGetBuffer()
check if m_buffer exists
int GetTRGType()
get TRGType
void SetEveNo(unsigned int eve_no)
set contents of header
unsigned int GetNodeID()
get contents of header
void SetDataType(int data_type)
set contents of header
void SetNodeID(unsigned int node_id)
set contents of header
int GetRunNo()
get contents of header
void SetOffset1stFINESSE(int offset_1st_FINESSE)
set contents of header
void SetNwords(int nwords)
set contents of header
int GetTruncMask()
get contents of header
int GetOffset4thFINESSE()
get contents of header
unsigned int GetErrorBitFlag()
get contents of header
void SetOffset3rdFINESSE(int offset_3rd_FINESSE)
set contents of header
unsigned int GetTTCtimeTRGType()
get contents of header
unsigned int GetExpRunSubrun()
get contents of header
void SetExpRunNumber(int *exprun_buf)
Set a word consists of exp #, run # and subrun #.
int GetExpNo()
get a run/exp number combined word
int GetOffset2ndFINESSE()
get contents of header
int GetOffset3rdFINESSE()
get contents of header
Abstract base class for different kinds of events.