Belle II Software  release-08-01-10
ZMQHistogramOutput< AConnectionClass > Class Template Reference

Add the common functionality to the histogram output classes. More...

#include <ZMQHistogramOutput.h>

Inheritance diagram for ZMQHistogramOutput< AConnectionClass >:
Collaboration diagram for ZMQHistogramOutput< AConnectionClass >:

Public Member Functions

template<class... Args>
 ZMQHistogramOutput (unsigned int maximalUncompressedBufferSize, Args &&... args)
 Perfectly forward the given arguments to the base class initializer (and init the buffer size)
 
void handleEvent (std::unique_ptr< ZMQIdMessage > message)
 Handle a new message to be "sent" (what this means is up to the base class) as described above.
 
void mergeAndSend (EMessageTypes messageType=EMessageTypes::c_eventMessage)
 Forward a merge call to the base class handing over the stored messages.
 
void clear ()
 Forward a clear call to the base class and clear the stored messages. Should be called on run start.
 

Private Attributes

unsigned int m_maximalUncompressedBufferSize
 Paramter for the buffer size (needed during decompression)
 
std::map< std::string, HistogramMappingm_storedMessages
 The stored histograms for each sender identity.
 
std::vector< char > m_uncompressedBuffer
 The buffer used during decompression.
 
std::optional< int > m_storedExperiment = {}
 If already received: the experiment number of the data (on mismatch, everything is cleared)
 
std::optional< int > m_storedRun = {}
 If already received: the run number of the data (on mismatch, everything is cleared)
 

Detailed Description

template<class AConnectionClass>
class Belle2::ZMQHistogramOutput< AConnectionClass >

Add the common functionality to the histogram output classes.

This histogram output connection itself does not know how to merge or send histograms, everything is implemented in the template class AConnectionClass.

This class just adds the common code on top of those to prevent code duplication. The mergeAndSend calls and the clear call are directly passed on to the parent class. On a message, different things happen depending on the message type:

  • on stop or terminate messages one last mergeAndSend is called from the base class. The base class needs to handle any needed sending etc.
  • If a compressed data message is retrieved it is decompressed.
  • After that (or for uncompressed messages) the received histograms in the message are stored in the message map with the identity as key. In this way only ever the latest message for each sender is stored (and used when merging).

Data messages are supposed to have the run and experiment number stored as JSON-transformed EventMetaData in the additional messages. This sent event meta data is compared with the already received data. On mismatch, all data is cleared.

Definition at line 55 of file ZMQHistogramOutput.h.


The documentation for this class was generated from the following files: