9#include <daq/rfarm/event/modules/Ds2RawModule.h>
10#include <framework/datastore/StoreObjPtr.h>
11#include <framework/dataobjects/EventMetaData.h>
12#include <daq/dataobjects/SendHeader.h>
13#include <daq/dataobjects/SendTrailer.h>
38 string(
"OutputRbuf"));
47 B2INFO(
"Ds2Raw: Constructor done.");
51Ds2RawModule::~Ds2RawModule()
66 B2INFO(
"Ds2Raw initialized.");
72 B2INFO(
"Ds2Raw: beginRun called.");
89 int msgsize = (msg->
size() - 1) / 4 + 1;
90 int total_nwrds = msgsize + hdr.
GetHdrNwords() + trl.GetTrlNwords();
95 hdr.SetNumNodesinPacket(1);
96 hdr.SetEventNumber(evtmeta->getEvent());
98 hdr.SetSubRunNum(evtmeta->getSubrun());
99 hdr.SetRunNum(evtmeta->getRun());
100 hdr.SetExpNum(evtmeta->getExperiment());
101 hdr.SetNodeID(HLT_SUBSYS_ID);
105 int* buffer =
new int[total_nwrds];
114 memcpy(buffer + hdr.
GetHdrNwords() + msgsize, trl.GetBuffer(),
115 trl.GetTrlNwords()*
sizeof(
int));
121 int stat = m_rbuf->insq(buffer, total_nwrds);
122 if (stat >= 0)
break;
130 B2INFO(
"Ds2Raw: objs sent in buffer. Size = " << msg->
size());
145 printf(
"Ds2Raw: endRun called.....\n");
146 B2INFO(
"Ds2Raw: endRun done.");
156 B2INFO(
"Ds2Raw: terminate called");
Stream/restore DataStore objects to/from EvtMessage.
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
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.
Ds2RawModule()
Constructor / Destructor.
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_nsent
No. of sent events.
int m_compressionLevel
Compression parameter.
std::string m_rbufname
RingBuffer ID.
Class to manage streamed object.
char * buffer()
Get buffer address.
int size() const
Get size of message including headers.
void setDescription(const std::string &description)
Sets the description of the module.
Class to manage a Ring Buffer placed in an IPC shared memory.
Type-safe access to single objects in the data store.
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.