9 #include <tracking/modules/pxdDataReduction/ROISenderModule.h>
26 Module(), m_messageQueueNameCstring(nullptr)
29 setDescription(
"Send the ROI payload to the external ring buffer");
36 B2INFO(
"ROI Sender created");
52 B2FATAL(__FILE__ <<
":" << __LINE__ <<
68 const char* data = (
const char*)
m_roiPayload->getRootdata();
75 if (ret == (mqd_t) - 1) {
76 B2FATAL(std::string(__FILE__) <<
":" << __LINE__ <<
82 B2FATAL(std::string(__FILE__) <<
":" << __LINE__ <<
83 "ROI payload too long." << std::endl <<
84 "Payload length = " << length << std::endl <<
86 "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"
95 using namespace std::chrono;
96 nanoseconds ns = duration_cast< nanoseconds >(system_clock::now().time_since_epoch());
97 Float_t deltaT = (std::chrono::duration_cast<seconds> (ns - (nanoseconds)meta_time)).count();
100 }
else if (deltaT < 100) {
106 B2ERROR(
"Event took too long on HLT, PXD data for Event might be lost!" <<
LogVar(
"deltaT in s", deltaT));
107 }
else if (deltaT > 30) {
108 B2WARNING(
"Event took too long on HLT, PXD data for Event might be lost!" <<
LogVar(
"deltaT in s", deltaT));
120 std::string str =
"HLT Delay time distribution: ( ";
121 for (
auto& a :
m_histo) str += std::to_string(a) +
";";
134 int oflags = O_WRONLY ;
135 mode_t mode = S_IRUSR | S_IWUSR | S_IROTH | S_IRGRP ;
141 if (ret == (mqd_t) - 1)
142 B2FATAL(std::string(__FILE__) <<
":" <<
143 __LINE__ <<
": error: " <<
145 " on mq_open " << log_string);
157 if (ret == (mqd_t) - 1)
158 B2WARNING(std::string(__FILE__) <<
":" <<
159 __LINE__ <<
": error: " <<
161 " on mq_close " << log_string);
172 if (ret == (mqd_t) - 1)
173 B2WARNING(std::string(__FILE__) <<
":" <<
174 __LINE__ <<
": error: " <<
176 " 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.
REG_MODULE(arichBtest)
Register the Module.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Abstract base class for different kinds of events.