9 #include <rawdata/dataobjects/RawTLUFormat.h>
13 RawTLUFormat::RawTLUFormat()
17 RawTLUFormat::~RawTLUFormat()
26 int RawTLUFormat::GetNwordsHeader(
int n)
28 return m_buffer[ GetBufferPos(n) + POS_HDR_NWORDS ];
32 unsigned int RawTLUFormat::GetNodeID(
int n)
34 return (
unsigned int)(m_buffer[ GetBufferPos(n) + POS_NODE_ID ]);
37 unsigned int RawTLUFormat::GetEveNo(
int n)
39 return m_buffer[ GetBufferPos(n) + POS_EVE_NO ];
43 int RawTLUFormat::GetRunNo(
int n)
45 return m_buffer[ GetBufferPos(n) + POS_RUN_NO ];
49 unsigned int RawTLUFormat::GetMagicTrailer(
int n)
51 return m_buffer[ GetBufferPos(n) + POS_MAGIC_1 ];
54 unsigned int RawTLUFormat::GetTLUEventTag(
int n)
56 return m_buffer[ GetBufferPos(n) + POS_TLU_EVENTTAG ];
60 void RawTLUFormat::CheckData(
int n,
61 unsigned int prev_evenum,
unsigned int* cur_evenum)
65 *cur_evenum = GetEveNo(n);
68 if (prev_evenum != 0xFFFFFFFF && *cur_evenum != 0) {
69 if ((
unsigned int)(prev_evenum + 1) != *cur_evenum) {
70 sprintf(err_buf,
"Event # jump : i %d prev 0x%x cur 0x%x : Exiting...\n %s %s %d\n",
71 n, prev_evenum, *cur_evenum, __FILE__, __PRETTY_FUNCTION__, __LINE__);
77 if (GetEveNo(n) != GetTLUEventTag(n)) {
78 sprintf(err_buf,
"invalid TLU event tag : blodk %d header eve # %u TLU tag %u. Exiting...\n %s %s %d\n",
79 n, GetEveNo(n), GetTLUEventTag(n), __FILE__, __PRETTY_FUNCTION__, __LINE__);
84 if (GetBlockNwords(n) != SIZE_TLU_PACKET) {
85 sprintf(err_buf,
"invalid TLU packet length : block %d nwords %d must be %d : Exiting...\n %s %s %d\n",
86 n, GetBlockNwords(n), SIZE_TLU_PACKET, __FILE__, __PRETTY_FUNCTION__, __LINE__);
90 if (GetMagicTrailer(n) != TLU_MAGIC_TRAILER) {
91 sprintf(err_buf,
"invalid magic word : block %d magic word 0x%x must be 0x%x : Exiting...\n %s %s %d\n",
92 n, GetMagicTrailer(n), TLU_MAGIC_TRAILER, __FILE__, __PRETTY_FUNCTION__, __LINE__);
97 printf(
"[DEBUG] ========== dump a data block : block # %d==========\n", n);
99 for (
int k = 0 ; k < GetBlockNwords(n); k++) {
100 printf(
"0x%.8x ", (GetBuffer(n))[k]);
101 if (k % 10 == 9) printf(
"\n[DEBUG] ");
Abstract base class for different kinds of events.