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_eventStorageVersion{this,
100 "EventStorageVersion", "current", "Version of the ByteStream file data, "
101 "use \"v5\" or \"run1\" for run1, \"current\" for most current version "
102 "(default)."};
103
105 Gaudi::Property<std::string> m_bsOutputStreamName{this, "BSOutputStreamName",
106 name(), "stream name for multiple output"};
107
109 Gaudi::Property<std::string> m_simpleFileName{this, "SimpleFileName", "",
110 "for filename not from AgreedFileName"};
111
113 Gaudi::Property<int> m_lumiBlockNumber{this, "LumiBlockNumber", 0,
114 "part of filename"};
115
117 Gaudi::Property<int> m_run{this, "RunNumber", 0, "part of filename"};
118
120 Gaudi::Property<bool> m_dump{this, "DumpFlag", false, "dump fragments"};
121
123 Gaudi::Property<bool> m_writeEventless{this, "WriteEventlessFiles", true,
124 ""};
125
127 Gaudi::Property<bool> m_compressEvents{this, "CompressEvents", false, ""};
128
130 Gaudi::Property<unsigned int> m_maxFileMB{this, "MaxFileMB", 10000,
131 "MB per file"};
132
134 Gaudi::Property<unsigned int> m_maxFileNE{this, "MaxFileNE", 100000,
135 "evens per file"};
136
138 "EventInfo", "Key for EventInfo object in event store"};
139
141 "ByteStreamMetadataKey", "MetaDataStore+ByteStreamMetadata",
142 "Key for bytestream metadata object in metadata store"};
143
144 ServiceHandle< IIoComponentMgr > m_ioMgr{"IoComponentMgr", name()};
146 ServiceHandle< StoreGateSvc > m_metaDataStore{"StoreGateSvc/MetaDataStore", name()};
147
148 private: // data
151
153 std::unique_ptr<ByteStreamDataWriter> m_dataWriter;
154
157
158 private: // internal helper functions
160 StatusCode reinit();
161
163 bool initDataWriter(const EventContext* ctx = nullptr);
165 const xAOD::EventInfo*, const ByteStreamMetadata*);
167 const ByteStreamMetadata * getByteStreamMetadata(const EventContext& ctx);
168
169 struct EventCache {
170 inline void releaseEvent() {
171 buffer.reset(nullptr);
172 size = 0;
173 }
174
176 std::unique_ptr< uint32_t[] > buffer{nullptr};
177
178 unsigned int size{0};
179 };
180
183
186
189 const xAOD::EventInfo& evtInfo) const;
190
193 const ByteStreamMetadata& metaData) const;
194
195};
196
197#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
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
EventStorage BS version to produce, "v5" 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.