9 #include <rawdata/dataobjects/RawCOPPERFormat_latest.h>
21 RawCOPPERFormat_latest::RawCOPPERFormat_latest()
25 RawCOPPERFormat_latest::~RawCOPPERFormat_latest()
29 int RawCOPPERFormat_latest::GetNumFINESSEBlock(
int n)
32 for (
int i = 0; i < 4; i++) {
33 if (GetFINESSENwords(n, i) > 0) {
41 #ifdef USE_B2LFEE_FORMAT_BOTH_VER1_AND_2
42 void RawCOPPERFormat_latest::CheckB2LFEEHeaderVersion(
int n)
47 for (
int i = 0; i < 4; i++) {
48 if (GetFINESSENwords(n, i) > 0) {
49 temp_buf = GetFINESSEBuffer(n, i);
50 if ((temp_buf[ 3 ] & 0x40000000) == 0) {
54 printf(
"[DEBUG] \033[31m");
55 printf(
"[DEBUG] ===Firmware ver. ERROR===\n ");
56 printf(
"[DEBUG] FTSW and b2tt firmwares was updated on Nov.22, 2013 and the header format attached by B2link was changed in the new firmwares.\n");
57 printf(
"[DEBUG] If you are going to take data now, Please update the firmware.\n");
58 printf(
"[DEBUG] For details, please see Nakao-san's e-mail [b2link_ml:0111] Re: [daq2ml:0159] beta version of trigger timing receiver firmware (b2tt) on bdaq SVN\n");
59 printf(
"[DEBUG] Or if you are going to read data taken before the update, please use basf2 software before svn rev. 7419\n");
60 printf(
"[DEBUG] About the format please see Nakao-san's B2GM slides(p. 13 and 15) http://kds.kek.jp/getFile.py/access?contribId=143&sessionId=38&resId=0&materialId=slides&confId=13911.\n");
61 printf(
"[DEBUG] Sorry for inconvenience.\n");
62 printf(
"[DEBUG] \033[0m");
65 sprintf(err_buf,
"FTSW and b2tt firmwares are old. Exiting...\n %s %s %d\n",
66 __FILE__, __PRETTY_FUNCTION__, __LINE__);
67 printf(
"%s\n", err_buf); fflush(stdout);
80 sprintf(err_buf,
"RawCOPPERFormat_latest contains no FINESSE data. Exiting...\n %s %s %d\n",
81 __FILE__, __PRETTY_FUNCTION__, __LINE__);
82 printf(
"%s\n", err_buf); fflush(stdout);
91 int RawCOPPERFormat_latest::Get1stDetectorNwords(
int n)
94 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
95 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
96 printf(
"[DEBUG] %s\n", err_buf);
101 int RawCOPPERFormat_latest::Get2ndDetectorNwords(
int n)
104 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
105 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
106 printf(
"[DEBUG] %s\n", err_buf);
111 int RawCOPPERFormat_latest::Get3rdDetectorNwords(
int n)
114 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
115 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
116 printf(
"[DEBUG] %s\n", err_buf);
121 int RawCOPPERFormat_latest::Get4thDetectorNwords(
int n)
124 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
125 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
126 printf(
"[DEBUG] %s\n", err_buf);
132 int RawCOPPERFormat_latest::Get1stFINESSENwords(
int n)
135 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
136 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
137 printf(
"[DEBUG] %s\n", err_buf);
142 int RawCOPPERFormat_latest::Get2ndFINESSENwords(
int n)
145 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
146 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
147 printf(
"[DEBUG] %s\n", err_buf);
152 int RawCOPPERFormat_latest::Get3rdFINESSENwords(
int n)
155 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
156 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
157 printf(
"[DEBUG] %s\n", err_buf);
162 int RawCOPPERFormat_latest::Get4thFINESSENwords(
int n)
165 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
166 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
167 printf(
"[DEBUG] %s\n", err_buf);
173 int* RawCOPPERFormat_latest::Get1stDetectorBuffer(
int n)
176 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
177 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
178 printf(
"[DEBUG] %s\n", err_buf);
183 int* RawCOPPERFormat_latest::Get2ndDetectorBuffer(
int n)
186 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
187 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
188 printf(
"[DEBUG] %s\n", err_buf);
193 int* RawCOPPERFormat_latest::Get3rdDetectorBuffer(
int n)
196 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
197 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
198 printf(
"[DEBUG] %s\n", err_buf);
203 int* RawCOPPERFormat_latest::Get4thDetectorBuffer(
int n)
206 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
207 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
208 printf(
"[DEBUG] %s\n", err_buf);
213 int RawCOPPERFormat_latest::GetOffset1stFINESSE(
int n)
216 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
217 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
218 printf(
"[DEBUG] %s\n", err_buf);
224 int RawCOPPERFormat_latest::GetOffset2ndFINESSE(
int n)
227 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
228 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
229 printf(
"[DEBUG] %s\n", err_buf);
235 int RawCOPPERFormat_latest::GetOffset3rdFINESSE(
int n)
238 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
239 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
240 printf(
"[DEBUG] %s\n", err_buf);
245 int RawCOPPERFormat_latest::GetOffset4thFINESSE(
int n)
248 sprintf(err_buf,
"[FATAL] This function is not supported.(block %d) Exiting...: \n%s %s %d\n",
249 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
250 printf(
"[DEBUG] %s\n", err_buf);
255 void RawCOPPERFormat_latest::CompareHeaderValue(
int n,
const unsigned int (&input_val)[MAX_PCIE40_CH],
256 std::vector<std::vector<unsigned int>>& summary_table)
263 std::vector<std::vector<unsigned int>> temp;
264 for (
int i = 0; i < MAX_PCIE40_CH; i++) {
265 if (GetFINESSENwords(n, i) > 0) {
268 for (
unsigned j = 0; j < summary_table.size(); ++j) {
269 if (input_val[i] == summary_table.at(j).at(2)) {
270 summary_table.at(j).at(1)++;
275 if (same_flag == 0) {
276 summary_table.push_back({
static_cast<unsigned int>(i), 1, input_val[i] });
280 sort(summary_table.begin(), summary_table.end(), [](
const std::vector<unsigned int>& alpha,
281 const std::vector<unsigned int>& beta) {return alpha.at(1) < beta.at(1);});
Abstract base class for different kinds of events.