Belle II Software  release-08-01-10
Collaboration diagram for daq:

Modules

 daq data objects
 
 daq modules
 

Classes

class  EvtSocketSend
 
class  EvtSocketRecv
 
class  EvtSocketManager
 
class  REvtSocketRecv
 
class  REvtSocketSend
 
class  RSocketSend
 
class  RSocketRecv
 
class  SocketIO
 
class  SocketRecv
 
class  SocketSend
 
class  SocketManager
 
class  DqmMasterCallback
 
class  DqmMemFile
 
class  DqmSharedMem
 
class  HistoManager
 
class  HistoRelay
 
class  HistoServer
 
class  ERecoDistributor
 
class  ERecoEventProcessor
 
class  ERecoEventSampler
 
class  ERecoMaster
 
class  ERecoMasterCallback
 
class  ERecoRunControlCallback
 
class  EventSampler
 
class  EventServer
 
class  EventServerCallback
 
class  ZMQStandardApp< AInputConnection, AOutputConnection >
 Generic base class for all standalone ZMQ applications. More...
 
class  ZMQReadySender
 App to only send a ready on every incoming message - behaves the same as the input of a worker (but without an output). More...
 
class  ZMQAcceptor
 App to only send a confirmation on every incoming message - behaves the same as the input of a (final)collector (but without an output). More...
 
class  ZMQWorker
 App to mimick a basf2-worker by accepting an incoming message with a ready message and sending it out via the output - requiring a confirmation message from the next step. More...
 
class  ZMQCollector
 Normal collector app: receive messages on the input reacting with a confirmation message and sends them out via a load-balanced connection to ready workers. More...
 
class  ZMQOutputAdapter
 Special collector app for translating between ZMQ and raw connections: send ready messages (like a typical worker) on the input and send all received events to the raw connection at output. More...
 
class  ZMQProxyCollector
 Special collector app: receive messages on the input reacting with a confirmation message and sends them out via a confirmed connection to ready workers. More...
 
class  ZMQFinalCollector
 Final collector app: receive messages on the input reacting with a confirmation message and sends them out via a raw connection (e.g. More...
 
class  ZMQFinalCollectorWithROI
 Special form of the ZMQFinalCollector for sending out the additional data message to a ROI receiver. More...
 
class  ZMQDistributor
 Standard distributor app: receive data via a raw connection (e.g. More...
 
class  ZMQInputAdapter
 
class  ZMQHistogramToFileServer
 Final histogram app: receive histogram messages from all clients and react with a confirmation message. More...
 
class  ZMQHistogramToZMQServer
 Non-Final histogram app: receive histogram messages from all clients and react with a confirmation message. More...
 
class  ZMQHistogramToRawServer
 Non-Final histogram app: receive histogram messages from all clients and react with a confirmation message. More...
 
class  ZMQHistoServerToFileOutput
 Output histograms into a ROOT file and shared memory after merging. More...
 
class  ZMQHistoServerToZMQOutput
 Send the histograms as compressed byte stream via a ZMQConfirmedOutput connection after merging with all the properties of a normal confirmed output. More...
 
class  ZMQHistoServerToRawOutput
 Same as ZMQHistoServerToZMQOutput just send uncompressed to a raw output. More...
 
class  ZMQHistogramOutput< AConnectionClass >
 Add the common functionality to the histogram output classes. More...
 
class  ZMQROIOutput
 Dedicated output to send ROI messages to the PXD ONSEN system. More...
 
class  ZMQDataAndROIOutput
 Helper connection hosting both a normal raw and a ROI output and sending to both at the same time. More...
 
class  HistogramMapping
 Utility to store received histograms (hierarchical tree structures) from clients (as an event message), with a function to add multiple histogram trees together. More...
 
class  HLTEventProcessor
 EventProcessor to be used on the HLT with all specialities of the HLT processing: More...
 
class  HLTStreamHelper
 Helper class for data store serialization. More...
 
class  StorageStreamHelper
 Helper class for data store serialization. More...
 
class  CprErrorMessage
 
class  DesSer
 A class definition of an input module for Sequential ROOT I/O. More...
 
class  DesSerCOPPER
 A class definition of an input module for Sequential ROOT I/O. More...
 
class  DesSerPrePC
 A class definition of an input module for Sequential ROOT I/O. More...
 
class  HLTFile
 
class  HLTMainLoop
 
class  HLTSocket
 
class  RawRevRb2Sock
 
class  Rb2Sock
 
class  RevRb2Sock
 
class  RevSock2Rb
 
class  Sock2Rb
 
class  RFCommand
 
struct  RFConf_t
 
class  RFConf
 
class  RFDqmServer
 
class  RFEventProcessor
 
class  RFEventServer
 
class  RFFlowStat
 
class  RFLogManager
 
class  RFMaster
 
class  RFMasterCallback
 
struct  RfNodeInfo
 
class  RFNodeManager
 
class  RFNSM_Status
 
class  RFNSM
 
class  RFOutputServer
 
class  RFProcessManager
 
class  RFRoiSender
 
class  RFRunControlCallback
 
class  RFServerBase
 
struct  RfShm_Cell
 
struct  RfShm_Data
 
class  RFSharedMem
 
struct  RfUnitInfo
 
class  SharedMem
 
class  RoiSenderCallback
 
class  AbstractDBObject
 
class  ConfigFile
 
class  Connection
 
class  Date
 
class  Enum
 
class  ERRORNo
 
class  Exception
 
class  IOException
 
class  Reader
 
class  Serializable
 
struct  StringUtil
 
class  TimeoutException
 
class  Writer
 
class  DAQLogDB
 
class  DAQLogMessage
 
class  DBHandlerException
 
class  DBInterface
 
class  DBObject
 
class  DBObjectLoader
 
class  DBRecord
 
class  MonitorDB
 
class  RunNumber
 
class  RunNumberTable
 
class  AbstractNSMCallback
 
class  Callback
 
class  NSMCallback
 
class  NSMCommand
 
class  NSMCommunicator
 
class  NSMData
 
struct  NSMDataPaket
 
class  NSMDataStore
 
class  NSMHandlerException
 
class  NSMMessage
 
class  NSMNode
 
class  NSMNodeDaemon
 
class  NSMNotConnectedException
 
class  NSMState
 
class  NSMVar
 
class  NSMVHandler
 
class  NSMVHandlerInt
 
class  NSMVHandlerFloat
 
class  NSMVHandlerText
 
class  NSMVHandlerIntArray
 
class  NSMVHandlerFloatArray
 
class  NSMVHandlerRef
 
class  PostgreSQLInterface
 
class  FlowMonitor
 
class  IOInfo
 
class  LogListener
 
class  ProcessController
 
class  ProcessSubmitter
 
class  ProcessListener
 
struct  ro_summary
 
struct  event_header
 
struct  ronode_info
 
struct  ronode_status
 
class  RunInfoBuffer
 
class  RCCallback
 
class  RCCommand
 
class  RCConfig
 
class  RCHandlerException
 
class  RCHandlerFatalException
 
class  RCNode
 
class  RCNodeDaemon
 
class  RCState
 
class  RCConfigHandler
 
class  Buffer
 
class  BufferedReader
 
class  BufferedWriter
 
class  CommandLine
 
class  Cond
 
class  Daemon
 
class  DynamicLoader
 
class  DynamicLoadException
 
class  Executor
 
class  Fifo
 
class  File
 
class  FileDescriptor
 
class  FileReader< FD >
 
class  FileWriter< FD >
 
class  Fork
 
class  InotifyEvent
 
class  Inotify
 
class  GenericLockGuard< AMutex >
 Lock Guard for a Mutex instance. More...
 
struct  LogFile
 
class  MCond
 
class  MMutex
 
class  Mutex
 
class  Process
 
class  PThread
 
class  RWLock
 
class  SharedMemory
 
class  StreamSizeCounter
 
class  TCPServerSocket
 
class  TCPSocket
 
class  Time
 
class  UDPSocket
 
struct  BinTrailer
 
struct  BinHeader
 
class  BinData
 
class  EventBuffer
 
class  ONSENBinData
 
class  SharedEventBuffer
 
class  EvtBuffer
 
class  Sender
 

Typedefs

typedef unsigned short u_short
 
using ZMQHistoServerToFile = ZMQHistogramOutput< ZMQHistoServerToFileOutput >
 
using ZMQHistoServerToZMQ = ZMQHistogramOutput< ZMQHistoServerToZMQOutput >
 
using ZMQHistoServerToRaw = ZMQHistogramOutput< ZMQHistoServerToRawOutput >
 
typedef std::vector< std::string > StringList
 
typedef std::vector< DAQLogMessageDAQLogMessageList
 
typedef std::vector< DBRecordDBRecordList
 
typedef std::map< std::string, std::string > DBFieldTypeList
 
typedef std::vector< DBObjectDBObjectList
 
typedef std::map< std::string, std::string > DBFieldList
 
typedef std::vector< RunNumberRunNumberList
 
typedef std::map< std::string, NSMNodeNSMNodeMap
 
typedef std::map< std::string, NSMNodeMap > NSMNodeMapMap
 
typedef std::map< std::string, NSMDataNSMDataMap
 
typedef std::vector< NSMCommunicator * > NSMCommunicatorList
 
typedef std::vector< NSMDataNSMDataList
 
typedef std::map< std::string, NSMDataList > NSMDataListMap
 
typedef std::vector< NSMVarNSMVarList
 
typedef std::map< std::string, NSMVHandler * > NSMVHandlerList
 
typedef FileReader< FilePipeReader
 
typedef FileReader< FifoFifoReader
 
typedef FileWriter< FifoFifoWriter
 
typedef std::vector< InotifyEventInotifyEventList
 
typedef GenericLockGuard< MutexLockGuard
 
typedef GenericLockGuard< MMutexMLockGuard
 
typedef FileReader< TCPSocketTCPSocketReader
 
typedef FileWriter< TCPSocketTCPSocketWriter
 

Functions

int nsm_read_argv (int argc, const char **argv, int(*help)(const char **argv), char **argv_in, ConfigFile &config, std::string &name, std::string &username, int nargv)
 
void initFromConsole (const std::string &description, int argc, char *argv[])
 Should be called before the main() function to initialize the connections using the paremeters given on command line. More...
 
void main ()
 Start the main loop polling on the output and monitoring connections and eventually also on the input if the output is ready. More...
 
void pollEvent (bool pollOnInput)
 Poll until a single event is retreived.
 
virtual void initialize ()
 Override in a derived class to initialize the connections from the given command line arguments. Do not forget to call this base function also.
 
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 function also.
 
virtual void handleExternalSignal (EMessageTypes)
 Will get called for every signal message on the monitoring connection. Can be overridden in a derived class. Empty by default.
 
virtual void handleInput ()
 Will get called for every message on the input connection. Can be overridden in a derived class. Calls handleIncomingData by default.
 
virtual void handleOutput ()
 Will get called for every message on the output connection. Can be overridden in a derived class. Calls handleIncomingData by default.
 
virtual void handleTimeout ()
 Will get called on a timeout. Can be overridden in a derived class. Empty by default.
 
bool terminated () const
 Check if the main loop will be exited on next occasion. Can be set via the "m_terminate" flag.
 
bool checkTimer ()
 Helper function to check, if the timeout should happen.
 
void updateTimer ()
 Helper function to update the remaining time.
 
void resetTimer ()
 Helper function to reset the start time and the remaining time.
 
void handleMonitoring ()
 Handle an incoming message on the monitoring socket by either calling handleExternalSignal() or by passing on the monitor JSONs of the connections.
 
virtual void fillMonitoringJSON (std::stringstream &buffer) const
 Using the connections, fill up a buffer with the content to be monitored.
 
template<class... Args>
 ZMQHistogramOutput (unsigned int maximalUncompressedBufferSize, Args &&... args)
 Perfectly forward the given arguments to the base class initializer (and init the buffer size)
 
bool getBool (const std::string &name, int index=0) const
 
char getChar (const std::string &name, int index=0) const
 
short getShort (const std::string &name, int index=0) const
 
int getInt (const std::string &name, int index=0) const
 
long long getLong (const std::string &name, int index=0) const
 
float getFloat (const std::string &name, int index=0) const
 
double getDouble (const std::string &name, int index=0) const
 
void setBool (const std::string &name, bool value, int index=0)
 
void setChar (const std::string &name, int value, int index=0)
 
void setShort (const std::string &name, int value, int index=0)
 
void setInt (const std::string &name, int value, int index=0)
 
void setLong (const std::string &name, long long value, int index=0)
 
void setFloat (const std::string &name, float value, int index=0)
 
void setDouble (const std::string &name, double value, int index=0)
 
void addBool (const std::string &name, bool value)
 
void addChar (const std::string &name, char value)
 
void addShort (const std::string &name, short value)
 
void addInt (const std::string &name, int value)
 
void addLong (const std::string &name, long long value)
 
void addFloat (const std::string &name, float value)
 
void addDouble (const std::string &name, double value)
 
bool hasKey (const std::string &label)
 
bool operator== (const Connection &st) const
 
bool operator!= (const Connection &st) const
 
bool operator== (const Enum &e) const
 
bool operator!= (const Enum &e) const
 
bool operator== (const std::string &label) const
 
bool operator!= (const std::string &label) const
 
NSMDatagetData (const std::string &name)
 
void openData (const std::string &name, const std::string &format, int revision=-1)
 
void allocData (const std::string &name, const std::string &format, int revision)
 
template<typename T >
void addArgument (T arg)
 
void setDB (DBInterface *db, const std::string &table)
 

Variables

const int ro_summary_revision = 1
 
const int ronode_status_revision = 1
 
Mutex g_mutex
 
Cond g_cond
 

Detailed Description

Function Documentation

◆ initFromConsole()

void initFromConsole ( const std::string &  description,
int  argc,
char *  argv[] 
)

Should be called before the main() function to initialize the connections using the paremeters given on command line.

Custom implementations should implement the addOptions function to pass the command line arguments correctly. Calls the initialize function (which should also be overridden).

Definition at line 21 of file ZMQApp.details.h.

22  {
23 
24  po::options_description desc(description);
25  std::string connection_file;
26  int debugLevel(0);
27  desc.add_options()
28  ("connection-file", boost::program_options::value<std::string>(&connection_file),
29  "if given print the connection information for input/output and monitoring socket to the given filename "
30  "in json format")
31  ("debug", boost::program_options::value<int>(&debugLevel), "Enable debug logging");
32  addOptions(desc);
33 
34  po::positional_options_description p;
35 
36  po::variables_map vm;
37  try {
38  po::store(po::command_line_parser(argc, argv).options(desc).positional(p).run(), vm);
39  } catch (std::exception& e) {
40  B2FATAL(e.what());
41  }
42 
43  if (vm.count("help")) {
44  std::cout << desc << std::endl;
45  exit(1);
46  }
47 
48  try {
49  po::notify(vm);
50  } catch (std::exception& e) {
51  B2FATAL(e.what());
52  }
53 
54  if (debugLevel > 0) {
55  auto& logging = LogSystem::Instance();
56  logging.getLogConfig()->setLogLevel(LogConfig::c_Debug);
57  logging.getLogConfig()->setDebugLevel(debugLevel);
58  B2DEBUG(1, "Enabled debug logging");
59  }
60 
61  initialize();
62 
63  if (not connection_file.empty()) {
64  B2DEBUG(1, "Write connection file" << LogVar("connection_file", connection_file));
65  nlohmann::json json;
66  try {
67  json["input"] = m_input->getEndPoint();
68  } catch (zmq::error_t& e) {
69  B2WARNING(e.what());
70  }
71  try {
72  json["output"] = m_output->getEndPoint();
73  } catch (zmq::error_t& e) {
74  B2WARNING(e.what());
75  }
76  std::ofstream connections(connection_file, std::ofstream::trunc);
77  if (!connections) {
78  B2FATAL("Cannot write connection file" << LogVar("connection_file", connection_file));
79  }
80  connections << std::setw(4) << json << std::endl;
81  }
82  }
@ c_Debug
Debug: for code development.
Definition: LogConfig.h:26
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Definition: LogSystem.cc:31
std::unique_ptr< AOutputConnection > m_output
Pointer to the output connection. Should be set in initialize.
Definition: ZMQApp.h:69
std::unique_ptr< AInputConnection > m_input
Pointer to the input connection. Should be set in initialize.
Definition: ZMQApp.h:67
Class to store variables with their name which were sent to the logging service.
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...

◆ main()

void main

Start the main loop polling on the output and monitoring connections and eventually also on the input if the output is ready.

Calls the functions handleExternalSignal, handleInput, handleOutput and handleTimeout as described in the documentation of this class.

Definition at line 85 of file ZMQApp.details.h.