ATLAS Offline Software
Loading...
Searching...
No Matches
ByteStreamEventStorageOutputSvc.h
Go to the documentation of this file.
1/* Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */
2
3#ifndef BYTESTREAMCNVSVC_BYTESTREAMEVENTSTORAGEOUTPUTSVC_H
4#define BYTESTREAMCNVSVC_BYTESTREAMEVENTSTORAGEOUTPUTSVC_H
5
16#include <memory>
17#include <mutex>
18#include <string>
19
22
27#include "EventStorage/EventStorageRecords.h"
31
32#include "GaudiKernel/extends.h"
33#include "GaudiKernel/IIoComponent.h"
34#include "GaudiKernel/IIoComponentMgr.h"
35#include "GaudiKernel/ServiceHandle.h"
37
38
39class EventInfo;
41
42
50 public extends< AthService, IByteStreamOutputSvc, IIoComponent > {
51 public:
52
55 const std::string& name, ISvcLocator* pSvcLocator);
56
59
61 StatusCode initialize() override;
62 StatusCode stop() override;
63 StatusCode finalize() override;
64
66 virtual bool putEvent(const RawEvent* re) override;
67 virtual bool putEvent(const RawEvent* re, const EventContext& ctx) override;
68
69 // Callback method to reinitialize the internal state of the component
70 // for I/O purposes (e.g. upon @c fork(2))
71 StatusCode io_reinit() override;
72
73 private: // properties
75 Gaudi::Property<std::string> m_inputDir{this, "OutputDirectory", "",
76 "directory for the data files"};
77
79 Gaudi::Property<std::string> m_projectTag{this, "ProjectTag", "",
80 "part of filename"};
81
83 Gaudi::Property<std::string> m_appName{this, "AppName", "",
84 "part of filename"};
85
87 Gaudi::Property<std::string> m_fileTag{this, "FileTag", "",
88 "part of filename"};
89
91 Gaudi::Property<std::string> m_streamType{this, "StreamType", "",
92 "part of filename"};
93
95 Gaudi::Property<std::string> m_streamName{this, "StreamName", "",
96 "part of filename"};
97
99 Gaudi::Property<std::string> m_eformatVersion{this, "EformatVersion",
100 "current", "Version of the event format data, use \"v40\" or \"run1\" "
101 "for run1, \"current\" for most current version (default)."};
102
104 Gaudi::Property<std::string> m_eventStorageVersion{this,
105 "EventStorageVersion", "current", "Version of the ByteStream file data, "
106 "use \"v5\" or \"run1\" for run1, \"current\" for most current version "
107 "(default)."};
108
110 Gaudi::Property<std::string> m_bsOutputStreamName{this, "BSOutputStreamName",
111 name(), "stream name for multiple output"};
112
114 Gaudi::Property<std::string> m_simpleFileName{this, "SimpleFileName", "",
115 "for filename not from AgreedFileName"};
116
118 Gaudi::Property<int> m_lumiBlockNumber{this, "LumiBlockNumber", 0,
119 "part of filename"};
120
122 Gaudi::Property<int> m_run{this, "RunNumber", 0, "part of filename"};
123
125 Gaudi::Property<bool> m_dump{this, "DumpFlag", false, "dump fragments"};
126
128 Gaudi::Property<bool> m_writeEventless{this, "WriteEventlessFiles", true,
129 ""};
130
132 Gaudi::Property<bool> m_compressEvents{this, "CompressEvents", false, ""};
133
135 Gaudi::Property<unsigned int> m_maxFileMB{this, "MaxFileMB", 10000,
136 "MB per file"};
137
139 Gaudi::Property<unsigned int> m_maxFileNE{this, "MaxFileNE", 100000,
140 "evens per file"};
141
143 "EventInfo", "Key for EventInfo object in event store"};
144
146 "ByteStreamMetadataKey", "MetaDataStore+ByteStreamMetadata",
147 "Key for bytestream metadata object in metadata store"};
148
149 ServiceHandle< IIoComponentMgr > m_ioMgr{"IoComponentMgr", name()};
151 ServiceHandle< StoreGateSvc > m_metaDataStore{"StoreGateSvc/MetaDataStore", name()};
152
153 private: // data
156
157 bool m_isRun1{false};
158
160 std::unique_ptr<ByteStreamDataWriter> m_dataWriter;
161
164
165 private: // internal helper functions
167 StatusCode reinit();
168
170 bool initDataWriter(const EventContext* ctx = nullptr);
172 const xAOD::EventInfo*, const ByteStreamMetadata*);
174 const ByteStreamMetadata * getByteStreamMetadata(const EventContext& ctx);
175
176 struct EventCache {
177 inline void releaseEvent() {
178 buffer.reset(nullptr);
179 size = 0;
180 }
181
183 std::unique_ptr< uint32_t[] > buffer{nullptr};
184
185 unsigned int size{0};
186 };
187
190
193
196 const xAOD::EventInfo& evtInfo) const;
197
200 const ByteStreamMetadata& metaData) const;
201
202};
203
204#endif // BYTESTREAMCNVSVC_BYTESTREAMEVENTSTORAGEOUTPUTSVC_H
const boost::regex re(r_e)
Maintain a set of objects, one per slot.
This file contains the class definition for the ByteStreamDataWriter class.
This file contains the class definition for the ByteStreamMetadataContainer class.
This file contains the interface for the ByteStreamOutputSvc classes.
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition RawEvent.h:37
Property holding a SG store/key/clid from which a ReadHandle is made.
Gaudi::Property< unsigned int > m_maxFileMB
number of events per file
virtual ~ByteStreamEventStorageOutputSvc()=default
Destructor.
StatusCode reinit()
reinitialize the service when a fork() occurred/was-issued
Gaudi::Property< std::string > m_projectTag
Application Name.
Gaudi::Property< bool > m_writeEventless
Compress events.
Gaudi::Property< std::string > m_streamType
stream name
StatusCode initialize() override
Required of all Gaudi Services.
Gaudi::Property< unsigned int > m_maxFileNE
Gaudi::Property< std::string > m_eventStorageVersion
stream name for multiple output
std::mutex m_dataWriterMutex
mutex to lock data writer during initialization or writing
Gaudi::Property< std::string > m_simpleFileName
use this string for filename, not from the "AgreedFileName"
bool initDataWriter(const EventContext *ctx=nullptr)
initialize EventStorage's DataWriter
Gaudi::Property< int > m_lumiBlockNumber
run number
virtual bool putEvent(const RawEvent *re) override
Implementation of the IByteStreamOutputSvc interface method putEvent.
Gaudi::Property< std::string > m_fileTag
stream type
SG::SlotSpecificObj< EventCache > m_eventCache
Cache of event data for each slot.
SG::ReadHandleKey< ByteStreamMetadataContainer > m_byteStreamMetadataKey
Gaudi::Property< std::string > m_eformatVersion
EventStorage BS version to produce, "v5" for run1, or "current".
ByteStreamEventStorageOutputSvc(const std::string &name, ISvcLocator *pSvcLocator)
Constructors:
Gaudi::Property< int > m_run
Dump fragments.
Gaudi::Property< std::string > m_appName
File Tag.
void updateDataWriterParameters(DataWriterParameters &) const
Create DataWriter parameters from job properties.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Gaudi::Property< std::string > m_streamName
eformat event version to produce, "v40" for run1, or "current"
Gaudi::Property< std::string > m_bsOutputStreamName
Gaudi::Property< bool > m_dump
Write eventless files.
Gaudi::Property< bool > m_compressEvents
number of MB per file
std::unique_ptr< ByteStreamDataWriter > m_dataWriter
pointer to DataWriter
Gaudi::Property< std::string > m_inputDir
< directory for the data files
bool initDataWriterContents(const xAOD::EventInfo *, const ByteStreamMetadata *)
This class is the StoreGate data object for bytestream metadata.
Property holding a SG store/key/clid from which a ReadHandle is made.
Maintain a set of objects, one per slot.
EventInfo_v1 EventInfo
Definition of the latest event info version.
std::unique_ptr< uint32_t[] > buffer
Underlying data structure.
Class containing parameters needed to initiate DataWriter.