9#include <rawdata/dataobjects/RawCOPPER.h>
11#include <framework/utilities/HTML.h>
39 sprintf(err_buf,
"m_buffer is NULL. Exiting...");
40 printf(
"%s", err_buf); fflush(stdout);
51 case LATEST_POSTREDUCTION_FORMAT_VER :
55 case (0x80 + LATEST_POSTREDUCTION_FORMAT_VER) :
81 sprintf(err_buf,
"[FATAL] ERROR_EVENT : Invalid version of a data format(0x%.8x = 0x7f7f**..). Exiting...\n %s %s %d\n",
82 m_buffer[ POS_FORMAT_VERSION ], __FILE__, __PRETTY_FUNCTION__, __LINE__);
83 printf(
"%s", err_buf); fflush(stdout);
101 if (class_name ==
"PostRawCOPPERFormat_latest") {
103 m_version = (0 << 7) | LATEST_POSTREDUCTION_FORMAT_VER;
104 }
else if (class_name ==
"PreRawCOPPERFormat_latest") {
106 m_version = (1 << 7) | LATEST_POSTREDUCTION_FORMAT_VER;
107 }
else if (class_name ==
"PostRawCOPPERFormat_v1") {
110 }
else if (class_name ==
"PreRawCOPPERFormat_v1") {
113 }
else if (class_name ==
"RawCOPPERFormat_v0") {
118 sprintf(err_buf,
"Invalid name of a data format class (%s). Exiting...\n %s %s %d\n",
119 class_name.c_str(), __FILE__, __PRETTY_FUNCTION__, __LINE__);
120 printf(
"%s", err_buf); fflush(stdout);
145 sprintf(err_buf,
"[DEBUG] bufin is NULL. Exting...\n");
146 printf(
"%s", err_buf); fflush(stdout);
152 if (delete_flag == 0) {
174 for (
int k = 0; k < 100; k++) {
176 if ((k + 1) % 10 == 0) printf(
"\n%.8x : ", k);
184 int* detector_buf_1st,
int nwords_1st,
185 int* detector_buf_2nd,
int nwords_2nd,
186 int* detector_buf_3rd,
int nwords_3rd,
187 int* detector_buf_4th,
int nwords_4th,
199 int* packed_buf = NULL;
201 detector_buf_1st, nwords_1st,
202 detector_buf_2nd, nwords_2nd,
203 detector_buf_3rd, nwords_3rd,
204 detector_buf_4th, nwords_4th,
217 int const(&nwords_ch)[MAX_PCIE40_CH],
220 if (LATEST_POSTREDUCTION_FORMAT_VER < 4) {
222 sprintf(err_buf,
"This function must be used for PCIe40 data(ver.4 or later). Exiting...");
223 printf(
"%s", err_buf); fflush(stdout);
232 m_version = LATEST_POSTREDUCTION_FORMAT_VER;
236 int* packed_buf = NULL;
238 detector_buf_ch, nwords_ch,
252 int* detector_buf_1st,
int nwords_1st,
253 int* detector_buf_2nd,
int nwords_2nd,
254 int* detector_buf_3rd,
int nwords_3rd,
255 int* detector_buf_4th,
int nwords_4th,
268 int* packed_buf = NULL;
270 detector_buf_1st, nwords_1st,
271 detector_buf_2nd, nwords_2nd,
272 detector_buf_3rd, nwords_3rd,
273 detector_buf_4th, nwords_4th,
293 s <<
"Entries: " << nEntries;
294 s <<
", Total size (32bit words): " <<
m_nwords <<
"<br>";
296 s <<
"COPPER format version: " <<
m_version;
299 for (
int iEntry = 0; iEntry < nEntries; ++iEntry) {
300 s <<
"<h4>Entry " << iEntry <<
"</h4>";
301 s <<
"Node ID: 0x" << std::hex << nonconst_this->
GetNodeID(iEntry) << std::dec;
302 for (
int iFinesse = 0; iFinesse < 4; iFinesse++) {
305 s <<
"<p>Finesse " << char(a + iFinesse) <<
" (Size: " << nWords <<
")</p>";
The Raw COPPER class ver.
The Raw COPPER class ver.1 ( the latest version since May, 2014 ) This class stores data received by ...
The Raw COPPER class ver.2 This class stores data received by COPPER via belle2link Data from all det...
struct to contain header information used by RawCOPPERFormat::Packer()
The Raw COPPER class This class stores data received by COPPER via belle2linkt Data from all detector...
void SetVersion()
read data, detect and set the version number of the data format
RawCOPPERFormat * m_access
class to access
void CompareHeaderValue(int n, const unsigned int(&input_val)[MAX_PCIE40_CH], std::vector< std::vector< unsigned int > > &result)
Compare value from different channels and make a statistics table.
void ShowBuffer()
show m_buffer
void PackDetectorBuf(int *detector_buf_1st, int nwords_1st, int *detector_buf_2nd, int nwords_2nd, int *detector_buf_3rd, int nwords_3rd, int *detector_buf_4th, int nwords_4th, RawCOPPERPackerInfo rawcprpacker_info)
Packer for RawCOPPER class Pack data (format ver.
virtual ~RawCOPPER()
Constructor using existing pointer to raw data buffer.
void PackDetectorBuf4DummyData(int *detector_buf_1st, int nwords_1st, int *detector_buf_2nd, int nwords_2nd, int *detector_buf_3rd, int nwords_3rd, int *detector_buf_4th, int nwords_4th, RawCOPPERPackerInfo rawcprpacker_info)
Pack dummy data (format ver. = -1 -> Select the latest format version)
int m_version
do not record
RawCOPPER()
Default constructor.
std::string getInfoHTML() const
Return a short summary of this object's contents in HTML format.
void SetBuffer(int *bufin, int nwords, int delete_flag, int num_events, int num_nodes) OVERRIDE_CPP17
set buffer ( delete_flag : m_buffer is freeed( = 0 )/ not freeed( = 1 ) in Destructer )
int m_num_events
number of events in this object
int m_num_nodes
number of nodes in this object
int m_use_prealloc_buf
flag for deleting m_buffer in destructer( 0:delete, 1: not delete) When using pre-allocated buffer,...
virtual int GetNumEntries()
get # of data blocks = (# of nodes)*(# of events)
int m_nwords
do not record
void CheckVersionSetBuffer()
Check the version number of data format.
int GetDetectorNwords(int n, int finesse_num)
get Detector buffer length
int * GetDetectorBuffer(int n, int finesse_num)
get Detector buffer
unsigned int GetNodeID(int n)
get node-ID from data
std::string getHexDump(const int *buf, int length)
Create hexdump of given buffer.
Abstract base class for different kinds of events.