Belle II Software development
RawHeader_latest.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <rawdata/dataobjects/RawHeader_latest.h>
10
11
12using namespace Belle2;
13
14//ClassImp(RawHeader_latest);
15
17{
18 m_buffer = NULL;
19 // initialize();
20 // cout << "RawHeader_latest NULL constructor" << endl;
21}
22
24{
25 m_buffer = buffer;
26}
27
29{
30}
31
32
33// int RawHeader_latest::AddNodeInfo(int node_id)
34// {
35// CheckSetBuffer();
36// // When the number of total nodes exceeds NUM_MAX_NODES
37// if (GetNumNodes() >= NUM_MAX_NODES) {
38// m_buffer[ POS_NUM_NODES ]++;
39// return -1;
40// }
41
42// m_buffer[ POS_NODES_1 + m_buffer[ POS_NUM_NODES ] ] = node_id;
43// m_buffer[ POS_NUM_NODES ]++;
44// return 0;
45// }
46
47// int RawHeader_latest::GetNodeInfo(int node_no, int* node_id)
48// {
49// CheckGetBuffer();
50// if (node_no >= GetNumNodes()) {
51// return -1;
52// }
53// *node_id = m_buffer[ POS_NODES_1 + node_no ];
54
55// return 0;
56// }
57
59{
60
61 // # of words
62 if (buf[ POS_NWORDS ] > 2.5e7 || buf[ POS_NWORDS ] < RAWHEADER_NWORDS) {
63 char err_buf[500];
64 sprintf(err_buf, "data size error %d words. Exiting... : %s %s %d\n",
65 buf[ POS_NWORDS ], __FILE__, __PRETTY_FUNCTION__, __LINE__);
66 printf("%s", err_buf); fflush(stdout);
67 B2FATAL(err_buf);
68 }
69
70 // # of words in this block
71 if ((buf[ POS_VERSION_HDRNWORDS ] & HDR_NWORDS_MASK) != RAWHEADER_NWORDS) {
72 char err_buf[500];
73 sprintf(err_buf, "Invalid header size %d words should be %d. Exiting... : %s %s %d\n",
74 buf[ buf[ POS_VERSION_HDRNWORDS ] & HDR_NWORDS_MASK ],
75 RAWHEADER_NWORDS, __FILE__, __PRETTY_FUNCTION__, __LINE__);
76 printf("%s", err_buf); fflush(stdout);
77 B2FATAL(err_buf);
78 }
79
80 // exp. run #
81
82 // utime( 2010 1/1 - 2050 1/1 )
83 if ((unsigned int)(buf[ POS_TTUTIME ]) < (unsigned int)0x4b3cbc70 ||
84 (unsigned int)0x9679f770 < (unsigned int)(buf[ POS_TTUTIME ])) {
85 char err_buf[500];
86 sprintf(err_buf, "Invalid utime %d . Exiting...: %s %s %d\n",
87 buf[ POS_TTUTIME ], __FILE__, __PRETTY_FUNCTION__, __LINE__);
88 printf("%s", err_buf); fflush(stdout);
89 B2FATAL(err_buf);
90 }
91
92 // truncation mask
93
94 int ch = 0;
95 // offset
96 if (buf[ POS_CH_POS_TABLE + ch ] < RAWHEADER_NWORDS) {
97 char err_buf[500];
98 sprintf(err_buf, "Invalid data offset for ch(=%d) finesse buffer(%d). Exiting...: %s %s %d\n",
99 ch, buf[ POS_CH_POS_TABLE + ch ], __FILE__, __PRETTY_FUNCTION__, __LINE__);
100 printf("%s", err_buf); fflush(stdout);
101 B2FATAL(err_buf);
102 }
103
104 for (int i = 1; i < (MAX_PCIE40_CH - 1); i++) {
105 ch = i;
106 if (buf[ POS_CH_POS_TABLE + ch ] < buf[ POS_CH_POS_TABLE + (ch - 1) ]) {
107 char err_buf[500];
108 sprintf(err_buf, "Invalid data offset for ch(=%d) finesse buffer(%d). Exiting...: %s %s %d\n",
109 ch, buf[ POS_CH_POS_TABLE + ch ], __FILE__, __PRETTY_FUNCTION__, __LINE__);
110 printf("%s", err_buf); fflush(stdout);
111 B2FATAL(err_buf);
112 }
113 }
114 ch = MAX_PCIE40_CH - 1;
115
116 if (buf[ POS_CH_POS_TABLE + ch ] < buf[ POS_CH_POS_TABLE + (ch - 1) ] ||
117 buf[ POS_CH_POS_TABLE + ch ] > buf[ POS_NWORDS ]) {
118 char err_buf[500];
119 sprintf(err_buf, "Invalid data offset for ch(=%d) finesse buffer(%d). Exiting...: %s %s %d\n",
120 ch, buf[ POS_CH_POS_TABLE + ch ], __FILE__, __PRETTY_FUNCTION__, __LINE__);
121 printf("%s", err_buf); fflush(stdout);
122 B2FATAL(err_buf);
123 }
124 return;
125}
126
127void RawHeader_latest::SetOffset1stFINESSE(int /*offset_1st_FINESSE*/)
128{
129 char err_buf[500];
130 sprintf(err_buf, "[FATAL] This function is not supported. Exiting...: \n%s %s %d\n",
131 __FILE__, __PRETTY_FUNCTION__, __LINE__);
132 printf("[DEBUG] %s\n", err_buf);
133 B2FATAL(err_buf);
134}
135
136void RawHeader_latest::SetOffset2ndFINESSE(int /*offset_2nd_FINESSE*/)
137{
138 char err_buf[500];
139 sprintf(err_buf, "[FATAL] This function is not supported. Exiting...: \n%s %s %d\n",
140 __FILE__, __PRETTY_FUNCTION__, __LINE__);
141 printf("[DEBUG] %s\n", err_buf);
142 B2FATAL(err_buf);
143}
144
145void RawHeader_latest::SetOffset3rdFINESSE(int /*offset_3rd_FINESSE*/)
146{
147 char err_buf[500];
148 sprintf(err_buf, "[FATAL] This function is not supported. Exiting...: \n%s %s %d\n",
149 __FILE__, __PRETTY_FUNCTION__, __LINE__);
150 printf("[DEBUG] %s\n", err_buf);
151 B2FATAL(err_buf);
152}
153
154void RawHeader_latest::SetOffset4thFINESSE(int /*offset_4th_FINESSE*/)
155{
156 char err_buf[500];
157 sprintf(err_buf, "[FATAL] This function is not supported. Exiting...: \n%s %s %d\n",
158 __FILE__, __PRETTY_FUNCTION__, __LINE__);
159 printf("[DEBUG] %s\n", err_buf);
160 B2FATAL(err_buf);
161}
162
164{
165 char err_buf[500];
166 sprintf(err_buf, "[FATAL] This function is not supported. Exiting...: \n%s %s %d\n",
167 __FILE__, __PRETTY_FUNCTION__, __LINE__);
168 printf("[DEBUG] %s\n", err_buf);
169 B2FATAL(err_buf);
170 return 0;
171}
172
174{
175 char err_buf[500];
176 sprintf(err_buf, "[FATAL] This function is not supported. Exiting...: \n%s %s %d\n",
177 __FILE__, __PRETTY_FUNCTION__, __LINE__);
178 printf("[DEBUG] %s\n", err_buf);
179 B2FATAL(err_buf);
180 return 0;
181}
182
184{
185 char err_buf[500];
186 sprintf(err_buf, "[FATAL] This function is not supported. Exiting...: \n%s %s %d\n",
187 __FILE__, __PRETTY_FUNCTION__, __LINE__);
188 printf("[DEBUG] %s\n", err_buf);
189 B2FATAL(err_buf);
190 return 0;
191}
192
194{
195 char err_buf[500];
196 sprintf(err_buf, "[FATAL] This function is not supported. Exiting...: \n%s %s %d\n",
197 __FILE__, __PRETTY_FUNCTION__, __LINE__);
198 printf("[DEBUG] %s\n", err_buf);
199 B2FATAL(err_buf);
200 return 0;
201}
int GetOffset1stFINESSE()
get contents of header
void SetOffset4thFINESSE(int offset_4th_FINESSE)
set contents of header
int * m_buffer
do not record buffer ( RawCOPPER includes buffer of RawHeader_latest and RawTrailer )
void SetOffset2ndFINESSE(int offset_2nd_FINESSE)
set contents of header
void CheckHeader(int *buf)
Get magic word to check the data corruption.
RawHeader_latest()
Default constructor.
void SetOffset1stFINESSE(int offset_1st_FINESSE)
set contents of header
int GetOffset4thFINESSE()
get contents of header
void SetOffset3rdFINESSE(int offset_3rd_FINESSE)
set contents of header
int GetOffset2ndFINESSE()
get contents of header
int GetOffset3rdFINESSE()
get contents of header
Abstract base class for different kinds of events.