9#include <daq/rawdata/modules/DeSerializerHLT.h>
18#define NOT_USE_SOCKETLIB
39 B2INFO(
"DeSerializerHLT: Constructor done.");
43DeSerializerHLTModule::~DeSerializerHLTModule()
51 B2INFO(
"DeSerializerHLT: initialize() started.");
57 for (
int i = 0 ; i < NUM_PREALLOC_BUF; i++) {
64 for (
int i = 0 ; i < NUM_PREALLOC_BUF; i++) {
69 m_eventMetaDataPtr.registerInDataStore();
72 raw_datablkarray.registerInDataStore();
73 rawcprarray.registerInDataStore();
74 raw_cdcarray.registerInDataStore();
75 raw_svdarray.registerInDataStore();
76 raw_bpidarray.registerInDataStore();
77 raw_epidarray.registerInDataStore();
78 raw_eclarray.registerInDataStore();
79 raw_klmarray.registerInDataStore();
80 raw_ftswarray.registerInDataStore();
90 memset(time_array0, 0,
sizeof(time_array0));
91 memset(time_array1, 0,
sizeof(time_array1));
92 memset(time_array2, 0,
sizeof(time_array2));
97 B2INFO(
"DeSerializerHLT: initialize() done.");
108 B2INFO(
"DeSerializerHLT: event() started.");
116 for (
int j = 0; j < NUM_EVT_PER_BASF2LOOP_PC; j++) {
118 int total_buf_nwords = 0 ;
120 int num_events_in_sendblock = 0;
121 int num_nodes_in_sendblock = 0;
124 int* temp_buf =
recvData(&delete_flag, &total_buf_nwords,
125 &num_events_in_sendblock, &num_nodes_in_sendblock);
127 temp_rawcopper.
SetBuffer(temp_buf, total_buf_nwords, delete_flag, num_events_in_sendblock, num_nodes_in_sendblock);
131 for (
int k = 0; k < temp_rawcopper.
GetNumEvents(); k++) {
132 for (
int l = 0; l < temp_rawcopper.
GetNumNodes(); l++) {
136 int* temp_buf2 = NULL;
137 int delete_flag2 = 0;
139 memcpy(temp_buf2, temp_rawcopper.
GetBuffer(index),
sizeof(
int)*buf_nwords);
140 const int temp_num_events = 1;
141 const int temp_num_nodes = 1;
146 switch (temp_rawcopper.
GetNodeID(k * num_nodes_in_sendblock + l) & DETECTOR_MASK) {
149 rawcdc = raw_cdcarray.appendNew();
150 rawcdc->
SetBuffer(temp_buf2, buf_nwords, delete_flag2, temp_num_events, temp_num_nodes);
154 rawsvd = raw_svdarray.appendNew();
155 rawsvd->
SetBuffer(temp_buf2, buf_nwords, delete_flag2, temp_num_events, temp_num_nodes);
159 rawecl = raw_eclarray.appendNew();
160 rawecl->
SetBuffer(temp_buf2, buf_nwords, delete_flag2, temp_num_events, temp_num_nodes);
164 rawbpid = raw_bpidarray.appendNew();
165 rawbpid->
SetBuffer(temp_buf2, buf_nwords, delete_flag2, temp_num_events, temp_num_nodes);
169 rawepid = raw_epidarray.appendNew();
170 rawepid->
SetBuffer(temp_buf2, buf_nwords, delete_flag2, temp_num_events, temp_num_nodes);
174 rawklm = raw_klmarray.appendNew();
175 rawklm->
SetBuffer(temp_buf2, buf_nwords, delete_flag2, temp_num_events, temp_num_nodes);
179 rawcopper = rawcprarray.appendNew();
180 rawcopper->
SetBuffer(temp_buf2, buf_nwords, delete_flag2, temp_num_events, temp_num_nodes);
187 m_totbytes += total_buf_nwords *
sizeof(int);
189 if (delete_flag == 1)
delete temp_buf;
195 m_eventMetaDataPtr.create();
196 m_eventMetaDataPtr->setExperiment(1);
197 m_eventMetaDataPtr->setRun(1);
206 m_eventMetaDataPtr->setEndOfData();
void initialize() override
initialize functions
void event() override
Module functions to be called from event process.
DeSerializerHLTModule()
Constructor / Destructor.
int m_start_flag
start flag
int BUF_SIZE_WORD
size of buffer for one event (word)
int n_basf2evt
No. of sent events.
virtual int * getNewBuffer(int nwords, int *delete_flag)
Getbuffer.
std::string m_dump_fname
dump filename
int * m_bufary[NUM_PREALLOC_BUF]
buffer
virtual void openOutputFile()
Module functions to be called from event process.
double max_seconds
time to stop a run
double getTimeSec()
store time info.
A class definition of an input module for Sequential ROOT I/O.
virtual int * recvData(int *delete_flag, int *total_m_size_word, int *num_events_in_sendblock, int *num_nodes_in_sendblock)
receive data
virtual int Connect()
Accept connection.
The Raw ARICH class Class for RawCOPPER class data taken by ARICH Currently, this class is almost sam...
The Raw CDC class Class for RawCOPPER class data taken by CDC Currently, this class is almost same as...
The Raw COPPER class This class stores data received by COPPER via belle2linkt Data from all detector...
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 )
virtual int * GetBuffer(int n)
get nth buffer pointer
virtual int GetNumNodes()
get # of data sources(e.g. # of COPPER boards) in m_buffer
virtual int GetBlockNwords(int n)
get size of a data block
virtual int GetNumEvents()
get # of events in m_buffer
The Raw ECL class Class for RawCOPPER class data taken by ECL Currently, this class is almost same as...
The Raw KLM class Class for RawCOPPER class data taken by KLM.
The Raw SVD class Class for RawCOPPER class data taken by SVD Currently, this class is almost same as...
The Raw TOP class Class for RawCOPPER class data taken by TOP Currently, this class is almost same as...
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
unsigned int GetNodeID(int n)
get node-ID from data
Abstract base class for different kinds of events.