9#include <daq/rfarm/event/modules/FastRbuf2DsModule.h>
21void* RunRbufReader(
void*)
56 B2INFO(
"Rx: Constructor done.");
60FastRbuf2DsModule::~FastRbuf2DsModule()
66 gSystem->Load(
"libdataobjects");
82 char* evtbuf =
new char[MAXEVTSIZE];
83 while ((size = m_rbuf->
remq((
int*)evtbuf)) == 0) usleep(20);
90 B2FATAL(
"SeqRootInput : Error in reading first event");
96 pthread_attr_t thread_attr;
97 pthread_attr_init(&thread_attr);
101 pthread_create(&
m_thr_input, NULL, RunRbufReader, NULL);
120 B2INFO(
"Rx initialized.");
125 printf(
"ReadFileInThread started!!\n");
126 int rf_nevt [[maybe_unused]] = 0;
130 while ((size = m_rbuf->
remq((
int*)evtbuf)) == 0) usleep(20);
132 printf(
"ReadRbufInThread : ERROR! record with size=0 detected!!!!!\n");
136 }
else if (size > 0) {
139 B2FATAL(
"FastRbuf2Ds : Error in reading first event");
149 B2INFO(
"beginRun called.");
162 B2INFO(
"FastRbuf2Ds: DataStore Restored!!");
171 B2INFO(
"FastRbuf2Ds: endRun done.");
178 B2INFO(
"FastRbuf2Ds: terminate called");
Stream/restore DataStore objects to/from EvtMessage.
int queueEvtMessage(char *msg)
Queue EvtMessage for destreaming.
int restoreDataStoreAsync()
Restore objects in DataStore from temporary buffer.
int restoreDataStore(EvtMessage *msg)
Restore DataStore objects from EvtMessage.
Class to manage streamed object.
static const unsigned int c_MaxEventSize
maximal EvtMessage size, in bytes (200MB).
A class definition of an input module for Sequential ROOT I/O.
DataStoreStreamer * m_streamer
DataStore streamer.
void initialize() override
Module functions to be called from main process.
void event() override
This method is the core of the module.
void endRun() override
This method is called if the current run ends.
pthread_t m_thr_input
Input thread ID.
void terminate() override
This method is called at the end of the event processing.
void beginRun() override
Module functions to be called from event process.
int m_nrecv
No. of sent events.
int m_compressionLevel
Compression Level.
std::string m_rbufname
RingBuffer ID.
FastRbuf2DsModule()
Constructor / Destructor.
void ReadRbufInThread()
Function to read event from RB.
int m_numThread
Number of decoder threads.
void setDescription(const std::string &description)
Sets the description of the module.
Class to manage a Ring Buffer placed in an IPC shared memory.
int remq(int *buf)
Pick up a buffer from the RingBuffer.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.