9#include <rawdata/dataobjects/RawCOPPERFormat_v0.h>
33 -
tmp_trailer.RAWTRAILER_NWORDS - SIZE_COPPER_DRIVER_TRAILER;
34 unsigned int chksum = 0;
35 for (
int i = min; i < max; i++) {
47 if (
m_buffer[ pos_nwords ] > 0) cnt++;
49 if (
m_buffer[ pos_nwords ] > 0) cnt++;
51 if (
m_buffer[ pos_nwords ] > 0) cnt++;
53 if (
m_buffer[ pos_nwords ] > 0) cnt++;
59 switch (finesse_num) {
77 sprintf(err_buf,
"Specifined FINESSE number( = %d ) is invalid. Exiting...\n %s %s %d\n", finesse_num,
78 __FILE__, __PRETTY_FUNCTION__, __LINE__);
79 printf(
"%s\n", err_buf); fflush(stdout);
86 switch (finesse_num) {
104 sprintf(err_buf,
"Specifined FINESSE number( = %d ) is invalid. Exiting...\n %s %s %d\n",
105 finesse_num, __FILE__, __PRETTY_FUNCTION__, __LINE__);
106 printf(
"%s\n", err_buf); fflush(stdout);
120#ifndef READ_OLD_B2LFEE_FORMAT_FILE
123 unsigned int eve_num = 0;
126 for (
int i = 0; i < 4 ; i++) {
131 if (flag != 1) eve_num = eve[ i ];
132 if (eve_num != eve[ i ]) err_flag = 1;
139 sprintf(err_buf,
"No HSLB data in COPPER data. Exiting...\n%s %s %d\n",
140 __FILE__, __PRETTY_FUNCTION__, __LINE__);
141 printf(
"%s\n", err_buf); fflush(stdout);
148 sprintf(err_buf,
"CORRUPTED DATA: Different event number over HSLBs : slot A 0x%x : B 0x%x :C 0x%x : D 0x%x\n%s %s %d\n",
149 eve[ 0 ], eve[ 1 ], eve[ 2 ], eve[ 3 ],
150 __FILE__, __PRETTY_FUNCTION__, __LINE__);
151 printf(
"[DEBUG] [ERROR] %s\n", err_buf);
161 sprintf(err_buf,
"You need comment out READ_OLD_B2LFEE_FORMAT_FILE if you are handling a new data format\n%s %s %d\n",
162 __FILE__, __PRETTY_FUNCTION__, __LINE__);
163 printf(
"%s", err_buf); fflush(stdout);
173 unsigned int prev_evenum,
unsigned int* cur_evenum_rawcprhdr,
174 unsigned int prev_copper_ctr,
unsigned int* cur_copper_ctr,
175 unsigned int prev_exprunsubrun_no,
unsigned int* cur_exprunsubrun_no)
180 "This function for format ver.0 is not supported. (n %d preveve %u eve %u prectr %u ctr %u prevrun %u run %u) Exiting...\n %s %s %d\n",
181 n, prev_evenum, *cur_evenum_rawcprhdr, prev_copper_ctr, *cur_copper_ctr,
182 prev_exprunsubrun_no, *cur_exprunsubrun_no,
183 __FILE__, __PRETTY_FUNCTION__, __LINE__);
184 printf(
"%s", err_buf); fflush(stdout);
352#ifdef USE_B2LFEE_FORMAT_BOTH_VER1_AND_2
353 CheckB2LFEEHeaderVersion(n);
357 unsigned int temp_utime = 0, temp_ctime_trgtype = 0;
358 unsigned int utime[4], ctime_trgtype[4];
359 memset(utime, 0,
sizeof(utime));
360 memset(ctime_trgtype, 0,
sizeof(ctime_trgtype));
362 for (
int i = 0; i < 4; i++) {
365 SIZE_B2LHSLB_HEADER + POS_TT_CTIME_TYPE ];
367 SIZE_B2LHSLB_HEADER + POS_TT_UTIME ];
369 temp_ctime_trgtype = ctime_trgtype[ i ];
370 temp_utime = utime[ i ];
373 if (temp_ctime_trgtype != ctime_trgtype[ i ]
374 || temp_utime != utime[ i ]) {
382 for (
int i = 0; i < 4; i++) {
383 printf(
"[DEBUG] FINESSE #=%d buffsize %d ctimeTRGtype 0x%.8x utime 0x%.8x\n",
387 sprintf(err_buf,
"CORRUPTED DATA: mismatch over FINESSEs. Exiting...\n %s %s %d\n",
388 __FILE__, __PRETTY_FUNCTION__, __LINE__);
389 printf(
"%s", err_buf); fflush(stdout);
397 unsigned int prev_exprunsubrun_no,
unsigned int* cur_exprunsubrun_no)
402 "This function for format ver.0 is not supported. (node %.8x preveve %u prevrun %u currun %u ) Exiting...\n %s %s %d\n",
403 m_node_id, prev_eve32, prev_exprunsubrun_no, *cur_exprunsubrun_no,
404 __FILE__, __PRETTY_FUNCTION__, __LINE__);
405 printf(
"%s", err_buf); fflush(stdout);
653#ifdef USE_B2LFEE_FORMAT_BOTH_VER1_AND_2
654void RawCOPPERFormat_v0::CheckB2LFEEHeaderVersion(
int n)
659 for (
int i = 0; i < 4; i++) {
662 if ((temp_buf[ 3 ] & 0x40000000) == 0) {
666 printf(
"[DEBUG] \033[31m");
667 printf(
"[DEBUG] ===Firmware ver. ERROR===\n ");
668 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");
669 printf(
"[DEBUG] If you are going to take data now, Please update the firmware.\n");
670 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");
671 printf(
"[DEBUG] Or if you are going to read data taken before the update, please use basf2 software before rev. 7419\n");
672 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");
673 printf(
"[DEBUG] Sorry for inconvenience.\n");
674 printf(
"[DEBUG] \033[0m");
677 sprintf(err_buf,
"FTSW and b2tt firmwares are old. Exiting...\n %s %s %d\n",
678 __FILE__, __PRETTY_FUNCTION__, __LINE__);
679 printf(
"%s", err_buf); fflush(stdout);
692 sprintf(err_buf,
"RawCOPPERFormat_v0 contains no FINESSE data. Exiting...\n %s %s %d\n",
693 __FILE__, __PRETTY_FUNCTION__, __LINE__);
694 printf(
"%s", err_buf); fflush(stdout);
704 int* detector_buf_1st,
int nwords_1st,
705 int* detector_buf_2nd,
int nwords_2nd,
706 int* detector_buf_3rd,
int nwords_3rd,
707 int* detector_buf_4th,
int nwords_4th,
711 sprintf(err_buf,
"This function is not supported (%p %p %d %p %d %p %d %p %d %p ) Exiting...\n%s %s %d\n"
712 , packed_buf_nwords, detector_buf_1st, nwords_1st, detector_buf_2nd, nwords_2nd, detector_buf_3rd,
713 nwords_3rd, detector_buf_4th, nwords_4th, &rawcprpacker_info, __FILE__, __PRETTY_FUNCTION__, __LINE__);
714 printf(
"%s", err_buf); fflush(stdout);
struct to contain header information used by RawCOPPERFormat::Packer()
int Get3rdFINESSENwords(int n) OVERRIDE_CPP17
get data size of FINESSE slot C buffer
unsigned int GetMagicFPGATrailer(int n) OVERRIDE_CPP17
get magic word of COPPER FPGA trailer
int Get1stFINESSENwords(int n) OVERRIDE_CPP17
get data size of FINESSE slot A buffer
int Get3rdDetectorNwords(int n) OVERRIDE_CPP17
get Detector buffer length of slot C
unsigned int GetMagicDriverTrailer(int n) OVERRIDE_CPP17
get magic word of COPPER driver trailer
unsigned int GetMagicFPGAHeader(int n) OVERRIDE_CPP17
get magic word of COPPER FPGA header
int Get4thFINESSENwords(int n) OVERRIDE_CPP17
get data size of FINESSE slot D buffer
int Get4thDetectorNwords(int n) OVERRIDE_CPP17
get Detector buffer length of slot D
int Get2ndDetectorNwords(int n) OVERRIDE_CPP17
get Detector buffer length of slot B
unsigned int GetMagicDriverHeader(int n) OVERRIDE_CPP17
get magic word of COPPER driver header
int Get1stDetectorNwords(int n) OVERRIDE_CPP17
get Detector buffer length of slot A
int Get2ndFINESSENwords(int n) OVERRIDE_CPP17
get data size of FINESSE slot B buffer
Abstract base class for different kinds of events.