Belle II Software  release-05-01-25
HLTDs2ZMQ.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2018 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun, Anselm Baur *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <framework/core/Module.h>
13 
14 #include <daq/hbasf2/utils/HLTStreamHelper.h>
15 #include <framework/pcore/zmq/connections/ZMQConfirmedConnection.h>
16 
17 #include <framework/pcore/zmq/utils/ZMQParent.h>
18 #include <framework/datastore/StoreObjPtr.h>
19 #include <framework/dataobjects/EventMetaData.h>
20 
21 #include <memory>
22 #include <zmq.hpp>
23 
24 namespace Belle2 {
47  class HLTDs2ZMQModule : public Module {
48  public:
51 
53  void event() override;
55  void endRun() override;
57  void terminate() override;
58 
59  private:
61  std::string m_param_output;
63  bool m_param_raw;
64 
66  std::shared_ptr<ZMQParent> m_parent;
68  std::unique_ptr<ZMQConfirmedOutput> m_output;
69 
73  bool m_firstEvent = true;
74  };
76 }
Belle2::HLTStreamHelper
Helper class for data store serialization.
Definition: HLTStreamHelper.h:52
Belle2::HLTDs2ZMQModule::HLTDs2ZMQModule
HLTDs2ZMQModule()
Register the module parameters.
Definition: HLTDs2ZMQ.cc:9
Belle2::HLTDs2ZMQModule::endRun
void endRun() override
Send out a run stop message.
Definition: HLTDs2ZMQ.cc:65
Belle2::HLTDs2ZMQModule::m_output
std::unique_ptr< ZMQConfirmedOutput > m_output
Confirmed connection to the ZMQ application.
Definition: HLTDs2ZMQ.h:76
Belle2::HLTDs2ZMQModule::terminate
void terminate() override
Send out a terminate message.
Definition: HLTDs2ZMQ.cc:82
Belle2::HLTDs2ZMQModule::event
void event() override
On the first event, initialize the streamer and the connection. Serializes and sends out the data sto...
Definition: HLTDs2ZMQ.cc:35
Belle2::HLTDs2ZMQModule::m_param_raw
bool m_param_raw
Module paremeter: send out raw data with send header and trailer around the evtmessage instead of jus...
Definition: HLTDs2ZMQ.h:71
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::HLTDs2ZMQModule::m_parent
std::shared_ptr< ZMQParent > m_parent
ZMQ Parent needed for the connections.
Definition: HLTDs2ZMQ.h:74
Belle2::HLTDs2ZMQModule::m_streamHelper
HLTStreamHelper m_streamHelper
Utility class used for serialization.
Definition: HLTDs2ZMQ.h:79
Belle2::HLTDs2ZMQModule::m_firstEvent
bool m_firstEvent
Are we still in the first event? Please note the special handling of the first event in the HLTEventP...
Definition: HLTDs2ZMQ.h:81
Belle2::HLTDs2ZMQModule::m_param_output
std::string m_param_output
Module parameter: the ZMQ address of the connected application (to receive the messages)
Definition: HLTDs2ZMQ.h:69