9 #include <rawdata/dataobjects/RawCOPPERFormat.h>
16 RawCOPPERFormat::RawCOPPERFormat()
24 unsigned int RawCOPPERFormat::CalcXORChecksum(
int* buf,
int nwords)
26 unsigned int checksum = 0;
27 for (
int i = 0; i < nwords; i++) {
28 checksum = checksum ^ buf[ i ];
36 int RawCOPPERFormat::GetOffsetFINESSE(
int n,
int finesse_num)
38 switch (finesse_num) {
40 return GetOffset1stFINESSE(n);
43 return GetOffset2ndFINESSE(n);
46 return GetOffset3rdFINESSE(n);
49 return GetOffset4thFINESSE(n);
56 sprintf(err_buf,
"[FATAL] Specifined FINESSE number( = %d ) is invalid. Exiting...\n%s %s %d\n", finesse_num,
57 __FILE__, __PRETTY_FUNCTION__, __LINE__);
58 printf(
"%s", err_buf); fflush(stdout);
65 int* RawCOPPERFormat::GetFINESSEBuffer(
int n,
int finesse_num)
67 switch (finesse_num) {
69 return Get1stFINESSEBuffer(n);
72 return Get2ndFINESSEBuffer(n);
75 return Get3rdFINESSEBuffer(n);
78 return Get4thFINESSEBuffer(n);
85 sprintf(err_buf,
"[FATAL] Specifined FINESSE number( = %d ) is invalid. Exiting...\n%s %s %d\n", finesse_num,
86 __FILE__, __PRETTY_FUNCTION__, __LINE__);
87 printf(
"%s", err_buf); fflush(stdout);
94 int* RawCOPPERFormat::GetDetectorBuffer(
int n,
int finesse_num)
96 switch (finesse_num) {
98 return Get1stDetectorBuffer(n);
101 return Get2ndDetectorBuffer(n);
104 return Get3rdDetectorBuffer(n);
107 return Get4thDetectorBuffer(n);
114 sprintf(err_buf,
"[FATAL] Specifined FINESSE number( = %d ) is invalid. Exiting...\n%s %s %d\n", finesse_num,
115 __FILE__, __PRETTY_FUNCTION__, __LINE__);
116 printf(
"%s", err_buf); fflush(stdout);
122 unsigned int RawCOPPERFormat::GetB2LHeaderWord(
int n,
int finesse_buffer_pos)
124 unsigned int word[4];
125 unsigned int ret_word = 0;
126 int flag = 0, err_flag = 0;
128 for (
int i = 0; i < 4; i++) {
129 if (GetFINESSENwords(n, i) > 0) {
130 word[ i ] = m_buffer[ GetOffsetFINESSE(n, i) + finesse_buffer_pos ];
131 if (flag != 0 && (ret_word != word[ i ])) {
134 ret_word = word[ i ];
141 sprintf(err_buf,
"[FATAL] ERROR_EVENT : No HSLB data in COPPER data. Exiting...\n %s %s %d\n",
142 __FILE__, __PRETTY_FUNCTION__, __LINE__);
143 printf(
"%s", err_buf); fflush(stdout);
149 sprintf(err_buf,
"[FATAL] ERROR_EVENT : Different event number over HSLBs : slot A 0x%x : B 0x%x :C 0x%x : D 0x%x\n %s %s %d\n",
150 word[ 0 ], word[ 1 ], word[ 2 ], word[ 3 ],
151 __FILE__, __PRETTY_FUNCTION__, __LINE__);
152 printf(
"[DEBUG] %s\n", err_buf);
153 #ifndef NO_DATA_CHECK
162 int RawCOPPERFormat::GetPacketCRCError(
int n)
166 "[FATAL] This function is not supported in the version of RawCOPPER format that you're using. n=%d : %s %s %d: Exiting...\n",
167 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
168 printf(
"%s\n", err_buf); fflush(stdout);
174 int RawCOPPERFormat::GetEventCRCError(
int n)
178 "[FATAL] This function is not supported in the version of RawCOPPER format that you're using. n=%d : %s %s %d: Exiting...\n",
179 n, __FILE__, __PRETTY_FUNCTION__, __LINE__);
180 printf(
"%s\n", err_buf); fflush(stdout);
185 int RawCOPPERFormat::GetEventCRC16Value(
int n,
int finesse_num)
189 "[FATAL] This function is not supported in the version of RawCOPPER format that you're using. n=%d fin=%d : %s %s %d: Exiting...\n",
190 n, finesse_num, __FILE__, __PRETTY_FUNCTION__, __LINE__);
191 printf(
"%s\n", err_buf); fflush(stdout);