9 #include <rawdata/dataobjects/RawFTSW.h>
21 if (m_access != NULL)
delete m_access;
25 void RawFTSW::SetVersion()
27 if (m_buffer == NULL) {
29 sprintf(err_buf,
"m_buffer is NULL. Exiting...");
30 printf(
"%s", err_buf); fflush(stdout);
34 if (m_access != NULL) {
45 int temp_version = m_version;
46 if (m_buffer[ POS_HEADER_SIZE ] == VER_0_HEADER_SIZE) {
49 "[FATAL] Ver.0 of RawFTSW( so-called early DESYtest format ) is detected but not supported. (header size = 0x%.8x ) Exiting...\n %s %s %d\n",
50 m_buffer[ POS_HEADER_SIZE ], __FILE__, __PRETTY_FUNCTION__, __LINE__);
51 printf(
"%s", err_buf); fflush(stdout);
53 }
else if (m_buffer[ POS_NODE_FORMAT_ID ] == FORMAT_ID_VER_0TO2) {
54 if (m_buffer[ POS_HEADER_SIZE ] == VER_2_HEADER_SIZE) {
57 }
else if (m_buffer[ POS_HEADER_SIZE ] == VER_1_HEADER_SIZE) {
62 sprintf(err_buf,
"[FATAL] ERROR_EVENT : Invalid RawFTSW header size of FTSW data format(= 0x%.8x words). Exiting...\n %s %s %d\n",
63 m_buffer[ POS_HEADER_SIZE ], __FILE__, __PRETTY_FUNCTION__, __LINE__);
64 printf(
"%s", err_buf); fflush(stdout);
67 }
else if (m_buffer[ POS_NODE_FORMAT_ID ] == FORMAT_ID_VER_0TO3 ||
68 m_buffer[ POS_NODE_FORMAT_ID ] == 0x54544432 ||
69 m_buffer[ POS_NODE_FORMAT_ID ] == 0x54544433 ||
70 m_buffer[ POS_NODE_FORMAT_ID ] == 0x54544434 ||
71 m_buffer[ POS_NODE_FORMAT_ID ] == 0x54544435 ||
72 m_buffer[ POS_NODE_FORMAT_ID ] == 0x54544436 ||
73 m_buffer[ POS_NODE_FORMAT_ID ] == 0x54544437 ||
74 m_buffer[ POS_NODE_FORMAT_ID ] == 0x54544438 ||
75 m_buffer[ POS_NODE_FORMAT_ID ] == 0x54544439) {
86 "[FATAL] ERROR_EVENT : Invalid RawFTSW header size(= 0x%.8x words) or version number.(=0x%.8x) Exiting...\n %s %s %d\n",
87 m_buffer[ POS_HEADER_SIZE ], m_buffer[ POS_NODE_FORMAT_ID ], __FILE__, __PRETTY_FUNCTION__, __LINE__);
88 printf(
"%s", err_buf); fflush(stdout);
93 if (temp_version >= 0 && temp_version != m_version) {
96 "[FATAL] Already assigned RawFTSW format version (= %.8x) is different from the one (= 0x%.8x) from the current event. Exiting...\n %s %s %d\n",
97 temp_version, m_version, __FILE__, __PRETTY_FUNCTION__, __LINE__);
98 printf(
"%s", err_buf); fflush(stdout);
102 m_access->SetBuffer(m_buffer, m_nwords, 0, m_num_events, m_num_nodes);
107 void RawFTSW::SetBuffer(
int* bufin,
int nwords,
int delete_flag,
int num_events,
int num_nodes)
112 sprintf(err_buf,
"[FATAL] bufin is NULL. Exting...\n");
113 printf(
"%s", err_buf); fflush(stdout);
116 if (!m_use_prealloc_buf && m_buffer != NULL)
delete[] m_buffer;
118 if (delete_flag == 0) {
119 m_use_prealloc_buf =
true;
121 m_use_prealloc_buf =
false;
127 m_num_nodes = num_nodes;
128 m_num_events = num_events;
Abstract base class for different kinds of events.