8#include <daq/hbasf2/apps/ZMQHistogramServer.h>
9#include <framework/pcore/zmq/connections/ZMQConfirmedConnection.h>
10#include <daq/hbasf2/connections/ZMQHistogramConnection.h>
27 (
"input", boost::program_options::value<std::string>(&
m_inputAddress)->required(),
28 "where to read the events from")
31 "name of the shared memory")
32 (
"rootFileName", boost::program_options::value<std::string>(&
m_rootFileName)->required(),
33 "name of the ROOT file - can include {run_number} or {experiment_number}")
34 (
"timeout", boost::program_options::value<unsigned int>(&
m_timeout)->default_value(
m_timeout),
35 "how many seconds to wait between histogram dumps")
36 (
"maximalUncompressedBufferSize",
39 "size of the uncompress buffer");
44 if (type == EMessageTypes::c_newRunMessage) {
48 }
else if (type == EMessageTypes::c_lastEventMessage) {
49 auto message =
m_input->overwriteStopMessage();
51 m_output->handleEvent(std::move(message));
59 auto message =
m_input->handleIncomingData();
61 if (message->isMessage(EMessageTypes::c_terminateMessage)) {
65 m_output->handleEvent(std::move(message));
85 (
"input", boost::program_options::value<std::string>(&
m_inputAddress)->required(),
86 "where to read the events from")
87 (
"output", boost::program_options::value<std::string>(&
m_outputAddress)->required(),
88 "where to send the events to")
89 (
"timeout", boost::program_options::value<unsigned int>(&
m_timeout)->default_value(30),
90 "how many seconds to wait between histogram dumps")
91 (
"maximalUncompressedBufferSize",
94 "size of the uncompress buffer");
99 if (type == EMessageTypes::c_newRunMessage) {
103 }
else if (type == EMessageTypes::c_lastEventMessage) {
104 auto message =
m_input->overwriteStopMessage();
106 m_output->handleEvent(std::move(message));
114 auto message =
m_input->handleIncomingData();
116 if (message->isMessage(EMessageTypes::c_terminateMessage)) {
120 m_output->handleEvent(std::move(message));
140 (
"input", boost::program_options::value<std::string>(&
m_inputAddress)->required(),
141 "where to read the events from")
142 (
"output", boost::program_options::value<std::string>(&
m_outputAddress)->required(),
143 "where to send the events to")
144 (
"timeout", boost::program_options::value<unsigned int>(&
m_timeout)->default_value(30),
145 "how many seconds to wait between histogram dumps")
146 (
"maximalUncompressedBufferSize",
149 "size of the uncompress buffer");
154 if (type == EMessageTypes::c_newRunMessage) {
158 }
else if (type == EMessageTypes::c_lastEventMessage) {
159 auto message =
m_input->overwriteStopMessage();
161 m_output->handleEvent(std::move(message));
169 auto message =
m_input->handleIncomingData();
171 if (message->isMessage(EMessageTypes::c_terminateMessage)) {
175 m_output->handleEvent(std::move(message));
Add the common functionality to the histogram output classes.
std::string m_rootFileName
Parameter: name of the root file - can include {run_number} or {experiment_number}.
std::string m_sharedMemoryName
Parameter: name of the shared memory (or empty)
std::string m_inputAddress
Parameter: input address.
void initialize() final
Initialize the two connections using the command line arguments.
void addOptions(po::options_description &desc) final
Add the parameters to the cmd line arguments.
unsigned int m_maximalUncompressedBufferSize
Parameter: size of the temporary internal compression buffer.
void handleExternalSignal(EMessageTypes type) final
Merge on stop (even if not all clients have stopped) or clear the counters on start from the monitori...
void handleTimeout() final
Call the mergeAndSend function on timeout.
void handleInput() final
Pass the message from the input connection to the histogram storage.
std::string m_inputAddress
Parameter: input address.
void initialize() final
Initialize the two connections using the command line arguments.
void addOptions(po::options_description &desc) final
Add the parameters to the cmd line arguments.
unsigned int m_maximalUncompressedBufferSize
Parameter: size of the temporary internal compression buffer.
std::string m_outputAddress
Parameter: output address.
void handleExternalSignal(EMessageTypes type) final
Merge on stop (even if not all clients have stopped) or clear the counters on start from the monitori...
void handleTimeout() final
Call the mergeAndSend function on timeout.
void handleInput() final
Pass the message from the input connection to the histogram storage.
std::string m_inputAddress
Parameter: input address.
void initialize() final
Initialize the two connections using the command line arguments.
void addOptions(po::options_description &desc) final
Add the parameters to the cmd line arguments.
unsigned int m_maximalUncompressedBufferSize
Parameter: size of the temporary internal compression buffer.
std::string m_outputAddress
Parameter: output address.
void handleExternalSignal(EMessageTypes type) final
Merge on stop (even if not all clients have stopped) or clear the counters on start from the monitori...
void handleTimeout() final
Call the mergeAndSend function on timeout.
void handleInput() final
Pass the message from the input connection to the histogram storage.
std::shared_ptr< ZMQParent > m_parent
Pointer to the ZMQParent to be used as base for all connections.
std::unique_ptr< ZMQHistoServerToFile > m_output
Pointer to the output connection. Should be set in initialize.
bool m_terminate
Can be set by functions to terminate the main loop at the next possibility.
std::unique_ptr< ZMQConfirmedInput > m_input
Pointer to the input connection. Should be set in initialize.
unsigned int m_timeout
If set to a value != 0, will call handleTimeout with this frequency (in seconds).
virtual void initialize()
Override in a derived class to initialize the connections from the given command line arguments....
virtual void addOptions(po::options_description &desc)
Override in a derived class to add the command line arguments. Do not forget to call this base functi...
EMessageTypes
Type the messages can have.
Abstract base class for different kinds of events.