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()
65 B2INFO(
"Ds2Raw initialized.");
71 B2INFO(
"Ds2Raw: beginRun called.");
88 int msgsize = (msg->
size() - 1) / 4 + 1;
89 int total_nwrds = msgsize + hdr.
GetHdrNwords() + trl.GetTrlNwords();
94 hdr.SetNumNodesinPacket(1);
95 hdr.SetEventNumber(evtmeta->getEvent());
97 hdr.SetSubRunNum(evtmeta->getSubrun());
98 hdr.SetRunNum(evtmeta->getRun());
99 hdr.SetExpNum(evtmeta->getExperiment());
100 hdr.SetNodeID(HLT_SUBSYS_ID);
104 int* buffer =
new int[total_nwrds];
113 memcpy(buffer + hdr.
GetHdrNwords() + msgsize, trl.GetBuffer(),
114 trl.GetTrlNwords()*
sizeof(
int));
120 int stat = m_rbuf->
insq(buffer, total_nwrds);
121 if (stat >= 0)
break;
129 B2INFO(
"Ds2Raw: objs sent in buffer. Size = " << msg->
size());
144 printf(
"Ds2Raw: endRun called.....\n");
145 B2INFO(
"Ds2Raw: endRun done.");
155 B2INFO(
"Ds2Raw: terminate called");
Stream/restore DataStore objects to/from EvtMessage.
EvtMessage * streamDataStore(bool addPersistentDurability, bool streamTransientObjects=false)
Store DataStore objects in 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.
int insq(const int *buf, int size, bool checkTx=false)
Append a buffer to the RingBuffer.
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.