Belle II Software development
StorageStreamHelper Class Reference

Helper class for data store serialization. More...

#include <StorageStreamHelper.h>

Public Member Functions

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.
 
void registerStoreObjects (bool addExpressRecoObjects)
 Register all needed store objects, either only the raw data, ROIs and event meta data (for HLT) or additional objects (for express reco).
 

Private Attributes

StreamHelper m_streamHelper
 We use the framework stream helper.
 
DataStoreStreamerm_streamer
 
BinData m_data
 Decoding input.
 
BinData m_data_hlt
 
BinData m_data_pxd
 
int * m_buf
 
int m_eb2 = 1
 
StoreObjPtr< EventMetaDatam_eventMetaData
 Store Objects for HLT use.
 
StoreArray< RawSVDm_rawSVDs
 Store Objects for HLT use.
 
StoreArray< RawCDCm_rawCDCs
 Store Objects for HLT use.
 
StoreArray< RawTOPm_rawTOPs
 Store Objects for HLT use.
 
StoreArray< RawARICHm_rawARICHs
 Store Objects for HLT use.
 
StoreArray< RawECLm_rawECLs
 Store Objects for HLT use.
 
StoreArray< RawKLMm_rawKLMs
 Store Objects for HLT use.
 
StoreArray< RawTRGm_rawTRGs
 Store Objects for HLT use.
 
StoreArray< RawFTSWm_rawFTSWs
 Store Objects for HLT use.
 
StoreObjPtr< ROIpayloadm_roiPayload
 Store Objects for HLT use.
 
StoreArray< OnlineEventT0m_onlineEventT0
 StoreArray of OnlineEventT0.
 
StoreObjPtr< EventT0m_eventT0
 StoreArray of EventT0.
 
StoreObjPtr< RandomGeneratorm_randomGenerator
 Additional Store Objects for ExpressReco use.
 
StoreObjPtr< SoftwareTriggerResultm_softwareTriggerResult
 Additional Store Objects for ExpressReco use.
 
StoreObjPtr< SoftwareTrigger::SoftwareTriggerVariablesm_softwareTriggerVariables
 Additional Store Objects for ExpressReco use.
 
StoreObjPtr< TRGSummarym_triggerSummary
 Additional Store Objects for ExpressReco use.
 
StoreArray< RawPXDm_rawPXDs
 Additional Store Objects for ExpressReco use.
 
StoreArray< ROIidm_rois
 Additional Store Objects for ExpressReco use.
 
std::vector< char > m_outputBuffer
 Temporary buffer for storing the compressed result.
 
unsigned int m_maximalCompressedSize = 100'000'000
 Maximal size of the compression buffer.
 

Detailed Description

Helper class for data store serialization.

Definition at line 48 of file StorageStreamHelper.h.

Member Function Documentation

◆ initialize()

void initialize ( )

Initialize this class. Call this e.g. in the first event.

Definition at line 30 of file StorageStreamHelper.cc.

31{
32 //m_streamHelper.initialize(0, true);
33
34 m_buf = new int [10000000];
35 m_data.setBuffer(m_buf);
36 m_data_hlt.setBuffer(NULL);
37 m_data_pxd.setBuffer(NULL);
38}
BinData m_data
Decoding input.

◆ read()

void read ( std::unique_ptr< ZMQNoIdMessage message)

Read in a ZMQ message and rebuilt the data store from it.

Definition at line 69 of file StorageStreamHelper.cc.

70{
71 if (message->isMessage(EMessageTypes::c_eventMessage)) {
72 B2DEBUG(10, "EMessageTypes::c_eventMessage: begin");
73 m_streamHelper.read(std::move(message));
74 B2DEBUG(10, "EMessageTypes::c_eventMessage: end");
75 } else if (message->isMessage(EMessageTypes::c_rawDataMessage)) {
76 B2DEBUG(10, "EMessageTypes::c_rawDataMessage");
77 int* eventBuffer = message->getMessagePart<1>().data<int>();
78
79 m_data.setBuffer(eventBuffer);
80
81 int nboard = m_data.getNBoard();
82 /*
83 if (m_eb2 == 0 && nboard == 1) {
84 m_data_hlt.setBuffer(m_data.getBuffer());
85 } else if (m_eb2 > 0 || nboard > 1) {
86 m_data_hlt.setBuffer(m_data.getBody());
87 }
88 */
89
90 m_data_hlt.setBuffer(m_data.getBody());
91
92 EvtMessage* msg = new EvtMessage((char*)m_data_hlt.getBody());
93 if (msg->type() == MSG_TERMINATE) {
94 B2INFO("Got Termination message");
95 delete msg;
96 return;
97 }
98 m_streamer->restoreDataStore(msg);
99 delete msg;
100
101 if (nboard > 1) {
102 unsigned int offset = m_data_hlt.getWordSize() + m_data.getHeaderWordSize();
103 for (int i = 0; i < nboard - 1; i++) {
104 m_data_pxd.setBuffer(m_data.getBuffer() + offset);
105 offset += m_data_pxd.getWordSize();
106 if (m_data_pxd.getBody()[0] != ONSENBinData::MAGIC) {
107 B2FATAL("Bad ONSEN magic for PXD = " << m_data_pxd.getTrailerMagic());
108 return;
109 } else if (m_data_pxd.getTrailerMagic() != BinData::TRAILER_MAGIC) {
110 B2FATAL("Bad tarailer magic for PXD = " << m_data_pxd.getTrailerMagic());
111 return;
112 }
113 if (m_data_pxd.getBuffer() != NULL) {
114 m_rawPXDs.appendNew((int*)m_data_pxd.getBody(), m_data_pxd.getBodyByteSize());
115 }
116 }
117 } else {
118 m_data_pxd.setBuffer(NULL);
119 }
120
121 // m_eventMetaData.create();
122 m_eventMetaData->setExperiment(m_data_hlt.getExpNumber());
123 m_eventMetaData->setRun(m_data_hlt.getRunNumber());
124 m_eventMetaData->setSubrun(m_data_hlt.getSubNumber());
125 m_eventMetaData->setEvent(m_data_hlt.getEventNumber());
126 }
127}
int restoreDataStore(EvtMessage *msg)
Restore DataStore objects from EvtMessage.
Class to manage streamed object.
Definition: EvtMessage.h:59
ERecordType type() const
Get record type.
Definition: EvtMessage.cc:114
StoreArray< RawPXD > m_rawPXDs
Additional Store Objects for ExpressReco use.
StoreObjPtr< EventMetaData > m_eventMetaData
Store Objects for HLT use.
StreamHelper m_streamHelper
We use the framework stream helper.
void read(std::unique_ptr< ZMQNoIdMessage > message)
Read in a ZMQ message and rebuilt the data store from it.
Definition: StreamHelper.cc:41

◆ registerStoreObjects()

void registerStoreObjects ( bool  addExpressRecoObjects)

Register all needed store objects, either only the raw data, ROIs and event meta data (for HLT) or additional objects (for express reco).

Definition at line 40 of file StorageStreamHelper.cc.

41{
42 m_eventMetaData.registerInDataStore();
43 m_rawSVDs.registerInDataStore();
44 m_rawCDCs.registerInDataStore();
45 m_rawTOPs.registerInDataStore();
46 m_rawARICHs.registerInDataStore();
47 m_rawECLs.registerInDataStore();
48 m_rawKLMs.registerInDataStore();
49 m_rawTRGs.registerInDataStore();
50 m_rawFTSWs.registerInDataStore();
51
52 //m_eventT0.registerInDataStore();
53 m_onlineEventT0.registerInDataStore();
54 //m_eventT0.isRequired();
55
56 if (addExpressRecoObjects) {
58 m_softwareTriggerResult.registerInDataStore();
59 m_softwareTriggerVariables.registerInDataStore();
60 m_triggerSummary.registerInDataStore();
61 m_rawPXDs.registerInDataStore();
62 m_roiPayload.registerInDataStore();
63 m_rois.registerInDataStore("ROIs");
64 }
65
66 m_streamer = new DataStoreStreamer();
67}
Stream/restore DataStore objects to/from EvtMessage.
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
Definition: DataStore.h:71
StoreArray< RawCDC > m_rawCDCs
Store Objects for HLT use.
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.
StoreArray< RawSVD > m_rawSVDs
Store Objects for HLT use.
StoreObjPtr< TRGSummary > m_triggerSummary
Additional Store Objects for ExpressReco use.
StoreArray< RawFTSW > m_rawFTSWs
Store Objects for HLT use.
StoreArray< OnlineEventT0 > m_onlineEventT0
StoreArray of OnlineEventT0.
StoreArray< RawECL > m_rawECLs
Store Objects for HLT use.
StoreArray< RawTRG > m_rawTRGs
Store Objects for HLT use.
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.
StoreObjPtr< ROIpayload > m_roiPayload
Store Objects for HLT use.

Member Data Documentation

◆ m_buf

int* m_buf
private

Definition at line 79 of file StorageStreamHelper.h.

◆ m_data

BinData m_data
private

Decoding input.

Definition at line 76 of file StorageStreamHelper.h.

◆ m_data_hlt

BinData m_data_hlt
private

Definition at line 77 of file StorageStreamHelper.h.

◆ m_data_pxd

BinData m_data_pxd
private

Definition at line 78 of file StorageStreamHelper.h.

◆ m_eb2

int m_eb2 = 1
private

Definition at line 80 of file StorageStreamHelper.h.

◆ m_eventMetaData

StoreObjPtr<EventMetaData> m_eventMetaData
private

Store Objects for HLT use.

Definition at line 83 of file StorageStreamHelper.h.

◆ m_eventT0

StoreObjPtr<EventT0> m_eventT0
private

StoreArray of EventT0.

Definition at line 107 of file StorageStreamHelper.h.

◆ m_maximalCompressedSize

unsigned int m_maximalCompressedSize = 100'000'000
private

Maximal size of the compression buffer.

Definition at line 125 of file StorageStreamHelper.h.

◆ m_onlineEventT0

StoreArray<OnlineEventT0> m_onlineEventT0
private

StoreArray of OnlineEventT0.

Definition at line 104 of file StorageStreamHelper.h.

◆ m_outputBuffer

std::vector<char> m_outputBuffer
private

Temporary buffer for storing the compressed result.

Definition at line 123 of file StorageStreamHelper.h.

◆ m_randomGenerator

StoreObjPtr<RandomGenerator> m_randomGenerator
private

Additional Store Objects for ExpressReco use.

Definition at line 110 of file StorageStreamHelper.h.

◆ m_rawARICHs

StoreArray<RawARICH> m_rawARICHs
private

Store Objects for HLT use.

Definition at line 91 of file StorageStreamHelper.h.

◆ m_rawCDCs

StoreArray<RawCDC> m_rawCDCs
private

Store Objects for HLT use.

Definition at line 87 of file StorageStreamHelper.h.

◆ m_rawECLs

StoreArray<RawECL> m_rawECLs
private

Store Objects for HLT use.

Definition at line 93 of file StorageStreamHelper.h.

◆ m_rawFTSWs

StoreArray<RawFTSW> m_rawFTSWs
private

Store Objects for HLT use.

Definition at line 99 of file StorageStreamHelper.h.

◆ m_rawKLMs

StoreArray<RawKLM> m_rawKLMs
private

Store Objects for HLT use.

Definition at line 95 of file StorageStreamHelper.h.

◆ m_rawPXDs

StoreArray<RawPXD> m_rawPXDs
private

Additional Store Objects for ExpressReco use.

Definition at line 118 of file StorageStreamHelper.h.

◆ m_rawSVDs

StoreArray<RawSVD> m_rawSVDs
private

Store Objects for HLT use.

Definition at line 85 of file StorageStreamHelper.h.

◆ m_rawTOPs

StoreArray<RawTOP> m_rawTOPs
private

Store Objects for HLT use.

Definition at line 89 of file StorageStreamHelper.h.

◆ m_rawTRGs

StoreArray<RawTRG> m_rawTRGs
private

Store Objects for HLT use.

Definition at line 97 of file StorageStreamHelper.h.

◆ m_roiPayload

StoreObjPtr<ROIpayload> m_roiPayload
private

Store Objects for HLT use.

Definition at line 101 of file StorageStreamHelper.h.

◆ m_rois

StoreArray<ROIid> m_rois
private

Additional Store Objects for ExpressReco use.

Definition at line 120 of file StorageStreamHelper.h.

◆ m_softwareTriggerResult

StoreObjPtr<SoftwareTriggerResult> m_softwareTriggerResult
private

Additional Store Objects for ExpressReco use.

Definition at line 112 of file StorageStreamHelper.h.

◆ m_softwareTriggerVariables

StoreObjPtr<SoftwareTrigger::SoftwareTriggerVariables> m_softwareTriggerVariables
private

Additional Store Objects for ExpressReco use.

Definition at line 114 of file StorageStreamHelper.h.

◆ m_streamer

DataStoreStreamer* m_streamer
private

Definition at line 73 of file StorageStreamHelper.h.

◆ m_streamHelper

StreamHelper m_streamHelper
private

We use the framework stream helper.

Definition at line 72 of file StorageStreamHelper.h.

◆ m_triggerSummary

StoreObjPtr<TRGSummary> m_triggerSummary
private

Additional Store Objects for ExpressReco use.

Definition at line 116 of file StorageStreamHelper.h.


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