Belle II Software development
ZMQHistogramServer.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <daq/hbasf2/apps/ZMQApp.h>
11#include <framework/pcore/zmq/connections/ZMQConfirmedConnection.h>
12#include <daq/hbasf2/connections/ZMQHistogramOutput.h>
13
14namespace po = boost::program_options;
15
16namespace Belle2 {
30 class ZMQHistogramToFileServer : public ZMQStandardApp<ZMQConfirmedInput, ZMQHistoServerToFile> {
31 protected:
33 void initialize() final;
35 void addOptions(po::options_description& desc) final;
37 void handleExternalSignal(EMessageTypes type) final;
39 void handleInput() final;
41 void handleTimeout() final;
42
43 private:
45 std::string m_inputAddress;
47 std::string m_sharedMemoryName = "";
49 std::string m_rootFileName;
51 unsigned int m_maximalUncompressedBufferSize = 128'000'000;
52 };
53
64 class ZMQHistogramToZMQServer : public ZMQStandardApp<ZMQConfirmedInput, ZMQHistoServerToZMQ> {
65 public:
67 void initialize() final;
69 void addOptions(po::options_description& desc) final;
71 void handleExternalSignal(EMessageTypes type) final;
73 void handleInput() final;
75 void handleTimeout() final;
76
77 private:
79 std::string m_inputAddress;
81 std::string m_outputAddress;
83 unsigned int m_maximalUncompressedBufferSize = 128'000'000;
84 };
85
95 class ZMQHistogramToRawServer : public ZMQStandardApp<ZMQConfirmedInput, ZMQHistoServerToRaw> {
96 public:
98 void initialize() final;
100 void addOptions(po::options_description& desc) final;
102 void handleExternalSignal(EMessageTypes type) final;
104 void handleInput() final;
106 void handleTimeout() final;
107
108 private:
110 std::string m_inputAddress;
112 std::string m_outputAddress;
114 unsigned int m_maximalUncompressedBufferSize = 128'000'000;
115 };
117}
Final histogram app: receive histogram messages from all clients and react with a confirmation messag...
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.
Non-Final histogram app: receive histogram messages from all clients and react with a confirmation me...
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.
Non-Final histogram app: receive histogram messages from all clients and react with a confirmation me...
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.
Generic base class for all standalone ZMQ applications.
Definition: ZMQApp.h:46
EMessageTypes
Type the messages can have.
Abstract base class for different kinds of events.