Belle II Software  release-05-01-25
HLTZMQ2DsDirect.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/ZMQLoadBalancedConnection.h>
16 
17 #include <framework/pcore/zmq/utils/ZMQParent.h>
18 
19 #include <memory>
20 #include <string>
21 
22 namespace Belle2 {
32  class HLTZMQ2DsDirectModule : public Module {
33  public:
36 
38  void initialize() override;
40  void event() override;
41 
42  private:
44  std::shared_ptr<ZMQParent> m_parent;
46  std::unique_ptr<ZMQLoadBalancedInput> m_input;
47 
50 
52  bool m_firstEvent = true;
53 
55  std::string m_param_input;
57  unsigned int m_param_bufferSize = 20;
58 
59  void readEvent();
60  };
62 }
Belle2::HLTStreamHelper
Helper class for data store serialization.
Definition: HLTStreamHelper.h:52
Belle2::HLTZMQ2DsDirectModule::m_param_input
std::string m_param_input
Module parameter: ZMQ address of the input ZMQ application.
Definition: HLTZMQ2DsDirect.h:63
Belle2::HLTZMQ2DsDirectModule::initialize
void initialize() override
Receive the first event and initialize the data store with it.
Definition: HLTZMQ2DsDirect.cc:62
Belle2::HLTZMQ2DsDirectModule::HLTZMQ2DsDirectModule
HLTZMQ2DsDirectModule()
Register the module parameters.
Definition: HLTZMQ2DsDirect.cc:11
Belle2::HLTZMQ2DsDirectModule::m_parent
std::shared_ptr< ZMQParent > m_parent
ZMQ Parent needed for the connections.
Definition: HLTZMQ2DsDirect.h:52
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::HLTZMQ2DsDirectModule::m_firstEvent
bool m_firstEvent
Are we still in the first real event?
Definition: HLTZMQ2DsDirect.h:60
Belle2::HLTZMQ2DsDirectModule::m_param_bufferSize
unsigned int m_param_bufferSize
Module parameter: how many events should be kept in flight. Has an impact on the stopping time as wel...
Definition: HLTZMQ2DsDirect.h:65
Belle2::HLTZMQ2DsDirectModule::event
void event() override
If not in the first event, receive an event and store in the DS.
Definition: HLTZMQ2DsDirect.cc:72
Belle2::HLTZMQ2DsDirectModule::m_input
std::unique_ptr< ZMQLoadBalancedInput > m_input
Load balanced connection to the previous ZMQ application.
Definition: HLTZMQ2DsDirect.h:54
Belle2::HLTZMQ2DsDirectModule::m_streamHelper
HLTStreamHelper m_streamHelper
Utility class for deserialization.
Definition: HLTZMQ2DsDirect.h:57