Belle II Software  release-08-01-10
HLTStreamHelper.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 #include <framework/pcore/zmq/utils/StreamHelper.h>
10 #include <framework/pcore/zmq/messages/ZMQNoIdMessage.h>
11 #include <framework/datastore/StoreObjPtr.h>
12 #include <framework/datastore/StoreArray.h>
13 
14 #include <rawdata/dataobjects/RawFTSW.h>
15 #include <rawdata/dataobjects/RawTLU.h>
16 #include <rawdata/dataobjects/RawCDC.h>
17 #include <rawdata/dataobjects/RawSVD.h>
18 #include <rawdata/dataobjects/RawECL.h>
19 #include <rawdata/dataobjects/RawARICH.h>
20 #include <rawdata/dataobjects/RawTOP.h>
21 #include <rawdata/dataobjects/RawKLM.h>
22 #include <rawdata/dataobjects/RawTRG.h>
23 #include <rawdata/dataobjects/RawCOPPER.h>
24 #include <rawdata/dataobjects/RawPXD.h>
25 #include <tracking/dataobjects/ROIpayload.h>
26 #include <tracking/dataobjects/ROIid.h>
27 #include <framework/dataobjects/EventMetaData.h>
28 #include <mdst/dataobjects/SoftwareTriggerResult.h>
29 #include <hlt/softwaretrigger/dataobjects/SoftwareTriggerVariables.h>
30 #include <mdst/dataobjects/TRGSummary.h>
31 
32 #include <string>
33 #include <memory>
34 
35 namespace Belle2 {
43  public:
45  void initialize();
46 
48  std::unique_ptr<ZMQNoIdMessage> stream(bool addPersistentDurability, bool streamTransientObjects);
49 
51  std::unique_ptr<ZMQNoIdMessage> streamRaw();
52 
54  std::unique_ptr<ZMQNoIdMessage> streamHistograms(bool compressed = true);
55 
57  void read(std::unique_ptr<ZMQNoIdMessage> message);
58 
60  void registerStoreObjects(bool addExpressRecoObjects);
61 
62  private:
65 
86 
99 
101  std::vector<char> m_outputBuffer;
103  unsigned int m_maximalCompressedSize = 100'000'000;
104 
106  zmq::message_t getROIMessageIfViable() const;
107  };
109 }
Helper class for data store serialization.
StoreArray< RawCDC > m_rawCDCs
Store Objects for HLT use.
std::unique_ptr< ZMQNoIdMessage > streamHistograms(bool compressed=true)
Stream all objects derived from TH1 into a message. Only the last subfolder is streamed by prefixing ...
void initialize()
Initialize this class. Call this e.g. in the first event.
void read(std::unique_ptr< ZMQNoIdMessage > message)
Read in a ZMQ message and rebuilt the data store from it.
std::unique_ptr< ZMQNoIdMessage > streamRaw()
Stream the data store into an event message and add SendHeader and SendTrailer around the message....
StoreArray< RawTOP > m_rawTOPs
Store Objects for HLT use.
StoreArray< RawKLM > m_rawKLMs
Store Objects for HLT use.
StoreArray< ROIid > m_rois
Additional Store Objects for ExpressReco use.
std::vector< char > m_outputBuffer
Temporary buffer for storing the compressed result.
StoreArray< RawSVD > m_rawSVDs
Store Objects for HLT use.
StoreArray< RawPXD > m_rawPXDs
Additional Store Objects for ExpressReco use.
StoreObjPtr< EventMetaData > m_eventMetaData
Store Objects for HLT use.
StoreObjPtr< TRGSummary > m_triggerSummary
Additional Store Objects for ExpressReco use.
unsigned int m_maximalCompressedSize
Maximal size of the compression buffer.
StoreArray< RawFTSW > m_rawFTSWs
Store Objects for HLT use.
void registerStoreObjects(bool addExpressRecoObjects)
Register all needed store objects, either only the raw data, ROIs and event meta data (for HLT) or ad...
StreamHelper m_streamHelper
We use the framework stream helper.
StoreArray< RawECL > m_rawECLs
Store Objects for HLT use.
StoreArray< RawTRG > m_rawTRGs
Store Objects for HLT use.
zmq::message_t getROIMessageIfViable() const
If the ROI payload data storobject is filled, write out the roi message (otherwise an empty message)
StoreArray< RawARICH > m_rawARICHs
Store Objects for HLT use.
StoreObjPtr< SoftwareTriggerResult > m_softwareTriggerResult
Additional Store Objects for ExpressReco use.
StoreObjPtr< RandomGenerator > m_randomGenerator
Additional Store Objects for ExpressReco use.
StoreObjPtr< SoftwareTrigger::SoftwareTriggerVariables > m_softwareTriggerVariables
Additional Store Objects for ExpressReco use.
std::unique_ptr< ZMQNoIdMessage > stream(bool addPersistentDurability, bool streamTransientObjects)
Stream the data store into an event message. Add ROI as additional message (if valid).
StoreObjPtr< ROIpayload > m_roiPayload
Store Objects for HLT use.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Helper class for data store serialization.
Definition: StreamHelper.h:23
Abstract base class for different kinds of events.