9#include <tracking/modules/roiFinding/pxd/ROISenderModule.h>
10#include <framework/dataobjects/EventMetaData.h>
11#include <tracking/dataobjects/ROIpayload.h>
29 Module(), m_messageQueueNameCstring(nullptr)
32 setDescription(
"Send the ROI payload to the external ring buffer");
39 B2INFO(
"ROI Sender created");
55 B2FATAL(__FILE__ <<
":" << __LINE__ <<
71 const char* data = (
const char*)
m_roiPayload->getRootdata();
78 if (ret == (mqd_t) - 1) {
79 B2FATAL(std::string(__FILE__) <<
":" << __LINE__ <<
85 B2FATAL(std::string(__FILE__) <<
":" << __LINE__ <<
86 "ROI payload too long." << std::endl <<
87 "Payload length = " << length << std::endl <<
89 "We stop here, as this will result in event mismatch on EB! Please increase mqueue message length on HLT and/or check size limit in ROIPayload Assembler"
98 using namespace std::chrono;
99 nanoseconds ns = duration_cast< nanoseconds >(system_clock::now().time_since_epoch());
100 Float_t deltaT = (std::chrono::duration_cast<seconds> (ns - (nanoseconds)meta_time)).count();
103 }
else if (deltaT < 100) {
109 B2ERROR(
"Event took too long on HLT, PXD data for Event might be lost!" <<
LogVar(
"deltaT in s", deltaT));
110 }
else if (deltaT > 30) {
111 B2WARNING(
"Event took too long on HLT, PXD data for Event might be lost!" <<
LogVar(
"deltaT in s", deltaT));
123 std::string str =
"HLT Delay time distribution: ( ";
124 for (
auto& a :
m_histo) str += std::to_string(a) +
";";
137 int oflags = O_WRONLY ;
138 mode_t mode = S_IRUSR | S_IWUSR | S_IROTH | S_IRGRP ;
144 if (ret == (mqd_t) - 1)
145 B2FATAL(std::string(__FILE__) <<
":" <<
146 __LINE__ <<
": error: " <<
148 " on mq_open " << log_string);
160 if (ret == (mqd_t) - 1)
161 B2WARNING(std::string(__FILE__) <<
":" <<
162 __LINE__ <<
": error: " <<
164 " on mq_close " << log_string);
175 if (ret == (mqd_t) - 1)
176 B2WARNING(std::string(__FILE__) <<
":" <<
177 __LINE__ <<
": error: " <<
179 " on mq_unlink " << log_string);
void setDescription(const std::string &description)
Sets the description of the module.
void openMessageQueue(const char *log_string)
open message queue
void initialize() override final
Initializes the Module.
void unlinkMessageQueue(const char *log_string)
unlink message queue
std::string m_messageQueueName
message queue name
std::string m_ROIpayloadName
ROI payload name.
const char * m_messageQueueNameCstring
message queue name c string
ROISenderModule()
Constructor of the module.
int m_messageQueueMsgSize
message queue message size
int m_messageQueueDepth
message queue depth
mqd_t m_messageQueue
message queue
void terminate() override final
Termination action.
StoreObjPtr< EventMetaData > m_eventMetaData
Input ptr for EventMetaData.
void event() override final
This method is the core of the module.
void closeMessageQueue(const char *log_string)
close message queue
std::vector< int > m_histo
poor mans histogramming in a vector
StoreObjPtr< ROIpayload > m_roiPayload
Input ptr for RoiPayload.
Class to store variables with their name which were sent to the logging service.
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.