Belle II Software  release-05-02-19
ZMQHistogramServer.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <daq/hbasf2/apps/ZMQApp.h>
13 #include <framework/pcore/zmq/connections/ZMQConfirmedConnection.h>
14 #include <daq/hbasf2/connections/ZMQHistogramOutput.h>
15 
16 namespace po = boost::program_options;
17 
18 namespace Belle2 {
32  class ZMQHistogramToFileServer : public ZMQStandardApp<ZMQConfirmedInput, ZMQHistoServerToFile> {
33  protected:
35  void initialize() final;
37  void addOptions(po::options_description& desc) final;
39  void handleExternalSignal(EMessageTypes type) final;
41  void handleInput() final;
43  void handleTimeout() final;
44 
45  private:
47  std::string m_inputAddress;
49  std::string m_sharedMemoryName = "";
51  std::string m_rootFileName;
53  unsigned int m_maximalUncompressedBufferSize = 128'000'000;
54  };
55 
67  public:
69  void initialize() final;
71  void addOptions(po::options_description& desc) final;
73  void handleExternalSignal(EMessageTypes type) final;
75  void handleInput() final;
77  void handleTimeout() final;
78 
79  private:
81  std::string m_inputAddress;
83  std::string m_outputAddress;
85  unsigned int m_maximalUncompressedBufferSize = 128'000'000;
86  };
87 
97  class ZMQHistogramToRawServer : public ZMQStandardApp<ZMQConfirmedInput, ZMQHistoServerToRaw> {
98  public:
100  void initialize() final;
102  void addOptions(po::options_description& desc) final;
104  void handleExternalSignal(EMessageTypes type) final;
106  void handleInput() final;
108  void handleTimeout() final;
109 
110  private:
112  std::string m_inputAddress;
114  std::string m_outputAddress;
116  unsigned int m_maximalUncompressedBufferSize = 128'000'000;
117  };
119 }
Belle2::ZMQHistogramToZMQServer
Non-Final histogram app: receive histogram messages from all clients and react with a confirmation me...
Definition: ZMQHistogramServer.h:74
Belle2::ZMQHistogramToFileServer::m_sharedMemoryName
std::string m_sharedMemoryName
Parameter: name of the shared memory (or empty)
Definition: ZMQHistogramServer.h:57
Belle2::ZMQHistogramToFileServer::m_inputAddress
std::string m_inputAddress
Parameter: input address.
Definition: ZMQHistogramServer.h:55
Belle2::ZMQHistogramToFileServer::handleExternalSignal
void handleExternalSignal(EMessageTypes type) final
Merge on stop (even if not all clients have stopped) or clear the counters on start from the monitori...
Definition: ZMQHistogramServer.cc:44
Belle2::EMessageTypes
EMessageTypes
Type the messages can have.
Definition: ZMQDefinitions.h:26
Belle2::ZMQHistogramToFileServer::m_rootFileName
std::string m_rootFileName
Parameter: name of the root file - can include {run_number} or {experiment_number}.
Definition: ZMQHistogramServer.h:59
Belle2::ZMQStandardApp
Generic base class for all standalone ZMQ applications.
Definition: ZMQApp.h:56
Belle2::ZMQHistogramToFileServer::initialize
void initialize() final
Initialize the two connections using the command line arguments.
Definition: ZMQHistogramServer.cc:16
Belle2::ZMQConfirmedInput
Input part of a confirmed connection.
Definition: ZMQConfirmedConnection.h:65
Belle2::ZMQHistogramToFileServer::handleTimeout
void handleTimeout() final
Call the mergeAndSend function on timeout.
Definition: ZMQHistogramServer.cc:71
Belle2::ZMQHistogramToRawServer
Non-Final histogram app: receive histogram messages from all clients and react with a confirmation me...
Definition: ZMQHistogramServer.h:105
Belle2::ZMQHistogramToFileServer::handleInput
void handleInput() final
Pass the message from the input connection to the histogram storage.
Definition: ZMQHistogramServer.cc:59
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ZMQHistogramToFileServer::m_maximalUncompressedBufferSize
unsigned int m_maximalUncompressedBufferSize
Parameter: size of the temporary internal compression buffer.
Definition: ZMQHistogramServer.h:61
Belle2::ZMQHistogramToFileServer::addOptions
void addOptions(po::options_description &desc) final
Add the parameters to the cmd line arguments.
Definition: ZMQHistogramServer.cc:24
Belle2::ZMQHistogramOutput
Add the common functionality to the histogram output classes.
Definition: ZMQHistogramOutput.h:66