|
ATLAS Offline Software
|
This class provides the services for writing FullEventFragment into file. This class implements the interface IByteStreamOutputSvc for the conversion service to write the output to a file.
More...
#include <ByteStreamEventStorageOutputSvc.h>
|
Gaudi::Property< std::string > | m_inputDir |
| < directory for the data files More...
|
|
Gaudi::Property< std::string > | m_projectTag |
| Application Name. More...
|
|
Gaudi::Property< std::string > | m_appName |
| File Tag. More...
|
|
Gaudi::Property< std::string > | m_fileTag |
| stream type More...
|
|
Gaudi::Property< std::string > | m_streamType |
| stream name More...
|
|
Gaudi::Property< std::string > | m_streamName |
| eformat event version to produce, "v40" for run1, or "current" More...
|
|
Gaudi::Property< std::string > | m_eformatVersion |
| EventStorage BS version to produce, "v5" for run1, or "current". More...
|
|
Gaudi::Property< std::string > | m_eventStorageVersion |
| stream name for multiple output More...
|
|
Gaudi::Property< std::string > | m_bsOutputStreamName |
|
Gaudi::Property< std::string > | m_simpleFileName |
| use this string for filename, not from the "AgreedFileName" More...
|
|
Gaudi::Property< int > | m_lumiBlockNumber |
| run number More...
|
|
Gaudi::Property< int > | m_run {this, "RunNumber", 0, "part of filename"} |
| Dump fragments. More...
|
|
Gaudi::Property< bool > | m_dump {this, "DumpFlag", false, "dump fragments"} |
| Write eventless files. More...
|
|
Gaudi::Property< bool > | m_writeEventless |
| Compress events. More...
|
|
Gaudi::Property< bool > | m_compressEvents {this, "CompressEvents", false, ""} |
| number of MB per file More...
|
|
Gaudi::Property< unsigned int > | m_maxFileMB |
| number of events per file More...
|
|
Gaudi::Property< unsigned int > | m_maxFileNE |
|
SG::ReadHandleKey< xAOD::EventInfo > | m_eventInfoKey |
|
SG::ReadHandleKey< ByteStreamMetadataContainer > | m_byteStreamMetadataKey |
|
ServiceHandle< IIoComponentMgr > | m_ioMgr {"IoComponentMgr", name()} |
|
int | m_totalEventCounter {0} |
| number of event counter More...
|
|
bool | m_isRun1 {false} |
|
std::unique_ptr< ByteStreamDataWriter > | m_dataWriter |
| pointer to DataWriter More...
|
|
std::mutex | m_dataWriterMutex |
| mutex to lock data writer during initialization or writing More...
|
|
SG::SlotSpecificObj< EventCache > | m_eventCache |
| Cache of event data for each slot. More...
|
|
This class provides the services for writing FullEventFragment into file. This class implements the interface IByteStreamOutputSvc for the conversion service to write the output to a file.
Definition at line 47 of file ByteStreamEventStorageOutputSvc.h.
◆ ByteStreamEventStorageOutputSvc()
ByteStreamEventStorageOutputSvc::ByteStreamEventStorageOutputSvc |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
◆ ~ByteStreamEventStorageOutputSvc()
virtual ByteStreamEventStorageOutputSvc::~ByteStreamEventStorageOutputSvc |
( |
| ) |
|
|
inlinevirtual |
◆ finalize()
StatusCode ByteStreamEventStorageOutputSvc::finalize |
( |
| ) |
|
|
override |
◆ getByteStreamMetadata() [1/2]
Definition at line 289 of file ByteStreamEventStorageOutputSvc.cxx.
293 if (!metaDataCont.isValid())
return nullptr;
295 if (metaDataCont->size() > 1)
297 "Bytestream format only supports one. Arbitrarily "
300 return metaDataCont->front();
◆ getByteStreamMetadata() [2/2]
Definition at line 305 of file ByteStreamEventStorageOutputSvc.cxx.
310 if (!metaDataCont.isValid())
return nullptr;
312 if (metaDataCont->size() > 1)
314 "Bytestream format only supports one. Arbitrarily "
317 return metaDataCont->front();
◆ initDataWriter()
bool ByteStreamEventStorageOutputSvc::initDataWriter |
( |
const EventContext * |
ctx = nullptr | ) |
|
|
private |
◆ initDataWriterContents()
◆ initialize()
StatusCode ByteStreamEventStorageOutputSvc::initialize |
( |
| ) |
|
|
override |
Required of all Gaudi Services.
Definition at line 36 of file ByteStreamEventStorageOutputSvc.cxx.
55 const std::vector< std::string > choices_ef{
"current",
"v40",
"run1"};
57 == choices_ef.end()) {
58 ATH_MSG_FATAL(
"Unexpected value for EformatVersion property: "
60 return StatusCode::FAILURE;
65 const std::vector< std::string > choices_es{
"current",
"v5",
"run1"};
67 == choices_es.end()) {
68 ATH_MSG_FATAL(
"Unexpected value for EventStorageVersion property: "
70 return StatusCode::FAILURE;
79 return StatusCode::SUCCESS;
◆ io_reinit()
StatusCode ByteStreamEventStorageOutputSvc::io_reinit |
( |
| ) |
|
|
override |
Definition at line 251 of file ByteStreamEventStorageOutputSvc.cxx.
254 if (!
m_ioMgr->io_hasitem(
this)) {
255 ATH_MSG_FATAL(
"IoComponentMgr does not know about myself !");
256 return StatusCode::FAILURE;
265 return(StatusCode::FAILURE);
269 return(StatusCode::FAILURE);
284 return StatusCode::SUCCESS;
◆ putEvent() [1/2]
bool ByteStreamEventStorageOutputSvc::putEvent |
( |
const RawEvent * |
re | ) |
|
|
overridevirtual |
◆ putEvent() [2/2]
bool ByteStreamEventStorageOutputSvc::putEvent |
( |
const RawEvent * |
re, |
|
|
const EventContext & |
ctx |
|
) |
| |
|
overridevirtual |
Definition at line 177 of file ByteStreamEventStorageOutputSvc.cxx.
184 cache->releaseEvent();
187 cache->size =
re->fragment_size_word();
188 ATH_MSG_DEBUG(
"event size = " << cache->size <<
", start = " <<
re->start());
196 cache->buffer = std::make_unique< DataType[] >(cache->size);
198 << std::hex << cache->buffer.get() << std::dec);
203 re->start(), cache->buffer.get(), cache->size);
206 if (cache->size == 0) {
208 ATH_MSG_ERROR(
"Failed to convert event, buffer is too small");
212 ATH_MSG_DEBUG(
"event size after conversion = " << cache->size
213 <<
" version = " << cache->buffer.get()[3]);
216 cache->buffer = std::make_unique< DataType[] >(cache->size);
217 std::copy(
re->start(),
re->start() + cache->size, cache->buffer.get());
234 EventStorage::DWError write_result =
m_dataWriter->putData(
236 reinterpret_cast< void*
>(cache->buffer.get()));
239 if (write_result != EventStorage::DWOK) {
◆ reinit()
StatusCode ByteStreamEventStorageOutputSvc::reinit |
( |
| ) |
|
|
private |
◆ stop()
StatusCode ByteStreamEventStorageOutputSvc::stop |
( |
| ) |
|
|
override |
◆ updateDataWriterParameters() [1/3]
void ByteStreamEventStorageOutputSvc::updateDataWriterParameters |
( |
DataWriterParameters & |
params | ) |
const |
|
private |
Create DataWriter parameters from job properties.
Definition at line 322 of file ByteStreamEventStorageOutputSvc.cxx.
340 if (
params.streamType.empty())
params.streamType =
"Single";
341 if (
params.streamName.empty())
params.streamName =
"Stream";
351 boost::shared_ptr<EventStorage::SimpleFileName> simple_file_name(
353 params.theFNCB = simple_file_name;
356 daq::RawFileName fileNameObj(
363 params.fileNameCore = fileNameObj.fileNameCore();
368 : EventStorage::NONE;
◆ updateDataWriterParameters() [2/3]
◆ updateDataWriterParameters() [3/3]
Create DataWriter parameters from EventInfo.
Definition at line 376 of file ByteStreamEventStorageOutputSvc.cxx.
378 ATH_MSG_DEBUG(
"Parsing run parameters from EventInfo" << eventInfo);
380 params.rPar.run_number = eventInfo.runNumber();
381 params.lumiBlockNumber = eventInfo.lumiBlock();
384 if(!
tag.type().empty()) {
390 if (!
tag.name().empty()) {
395 for (
const auto&
tag : eventInfo.detDescrTags())
396 params.fmdStrings.push_back(
tag.first +
' ' +
tag.second);
398 params.rPar.trigger_type = eventInfo.level1TriggerType();
399 params.rPar.detector_mask_LS = eventInfo.detectorMask();
400 params.rPar.detector_mask_MS = eventInfo.detectorMaskExt();
402 std::string event_type =
"Event type: sim/data - ";
403 if (eventInfo.eventType(xAOD::EventInfo::EventType::IS_SIMULATION))
404 event_type +=
"is sim";
405 else event_type +=
"is data";
407 event_type +=
" , testbeam/atlas - ";
408 if (eventInfo.eventType(xAOD::EventInfo::EventType::IS_TESTBEAM))
409 event_type +=
"is testbeam";
410 else event_type +=
"is atlas";
412 event_type +=
" , calibration/physics - ";
413 if (eventInfo.eventType(xAOD::EventInfo::EventType::IS_CALIBRATION))
414 event_type +=
"is calibration";
415 else event_type +=
"is physics";
417 params.fmdStrings.push_back(event_type);
◆ m_appName
Gaudi::Property<std::string> ByteStreamEventStorageOutputSvc::m_appName |
|
private |
◆ m_bsOutputStreamName
Gaudi::Property<std::string> ByteStreamEventStorageOutputSvc::m_bsOutputStreamName |
|
private |
◆ m_byteStreamMetadataKey
Initial value:{this,
"ByteStreamMetadataKey", "MetaDataStore+ByteStreamMetadata",
"Key for bytestream metadata object in metadata store"}
Definition at line 143 of file ByteStreamEventStorageOutputSvc.h.
◆ m_compressEvents
Gaudi::Property<bool> ByteStreamEventStorageOutputSvc::m_compressEvents {this, "CompressEvents", false, ""} |
|
private |
◆ m_dataWriter
◆ m_dataWriterMutex
std::mutex ByteStreamEventStorageOutputSvc::m_dataWriterMutex |
|
private |
◆ m_dump
Gaudi::Property<bool> ByteStreamEventStorageOutputSvc::m_dump {this, "DumpFlag", false, "dump fragments"} |
|
private |
◆ m_eformatVersion
Gaudi::Property<std::string> ByteStreamEventStorageOutputSvc::m_eformatVersion |
|
private |
Initial value:{this, "EformatVersion",
"current", "Version of the event format data, use \"v40\" or \"run1\" "
"for run1, \"current\" for most current version (default)."}
EventStorage BS version to produce, "v5" for run1, or "current".
Definition at line 97 of file ByteStreamEventStorageOutputSvc.h.
◆ m_eventCache
◆ m_eventInfoKey
◆ m_eventStorageVersion
Gaudi::Property<std::string> ByteStreamEventStorageOutputSvc::m_eventStorageVersion |
|
private |
Initial value:{this,
"EventStorageVersion", "current", "Version of the ByteStream file data, "
"use \"v5\" or \"run1\" for run1, \"current\" for most current version "
"(default)."}
stream name for multiple output
Definition at line 102 of file ByteStreamEventStorageOutputSvc.h.
◆ m_fileTag
Gaudi::Property<std::string> ByteStreamEventStorageOutputSvc::m_fileTag |
|
private |
◆ m_inputDir
Gaudi::Property<std::string> ByteStreamEventStorageOutputSvc::m_inputDir |
|
private |
Initial value:{this, "OutputDirectory", "",
"directory for the data files"}
< directory for the data files
Project Tag
Definition at line 73 of file ByteStreamEventStorageOutputSvc.h.
◆ m_ioMgr
ServiceHandle< IIoComponentMgr > ByteStreamEventStorageOutputSvc::m_ioMgr {"IoComponentMgr", name()} |
|
private |
◆ m_isRun1
bool ByteStreamEventStorageOutputSvc::m_isRun1 {false} |
|
private |
◆ m_lumiBlockNumber
Gaudi::Property<int> ByteStreamEventStorageOutputSvc::m_lumiBlockNumber |
|
private |
◆ m_maxFileMB
Gaudi::Property<unsigned int> ByteStreamEventStorageOutputSvc::m_maxFileMB |
|
private |
◆ m_maxFileNE
Gaudi::Property<unsigned int> ByteStreamEventStorageOutputSvc::m_maxFileNE |
|
private |
◆ m_projectTag
Gaudi::Property<std::string> ByteStreamEventStorageOutputSvc::m_projectTag |
|
private |
◆ m_run
Gaudi::Property<int> ByteStreamEventStorageOutputSvc::m_run {this, "RunNumber", 0, "part of filename"} |
|
private |
◆ m_simpleFileName
Gaudi::Property<std::string> ByteStreamEventStorageOutputSvc::m_simpleFileName |
|
private |
Initial value:{this, "SimpleFileName", "",
"for filename not from AgreedFileName"}
use this string for filename, not from the "AgreedFileName"
luminosity block number
Definition at line 112 of file ByteStreamEventStorageOutputSvc.h.
◆ m_streamName
Gaudi::Property<std::string> ByteStreamEventStorageOutputSvc::m_streamName |
|
private |
Initial value:{this, "StreamName", "",
"part of filename"}
eformat event version to produce, "v40" for run1, or "current"
Definition at line 93 of file ByteStreamEventStorageOutputSvc.h.
◆ m_streamType
Gaudi::Property<std::string> ByteStreamEventStorageOutputSvc::m_streamType |
|
private |
◆ m_totalEventCounter
int ByteStreamEventStorageOutputSvc::m_totalEventCounter {0} |
|
private |
◆ m_writeEventless
Gaudi::Property<bool> ByteStreamEventStorageOutputSvc::m_writeEventless |
|
private |
The documentation for this class was generated from the following files:
bool initDataWriter(const EventContext *ctx=nullptr)
initialize EventStorage's DataWriter
SG::ReadHandleKey< ByteStreamMetadataContainer > m_byteStreamMetadataKey
Gaudi::Property< bool > m_writeEventless
Compress events.
std::string find(const std::string &s)
return a remapped string
SG::SlotSpecificObj< EventCache > m_eventCache
Cache of event data for each slot.
Gaudi::Property< std::string > m_streamType
stream name
int m_totalEventCounter
number of event counter
Gaudi::Property< int > m_lumiBlockNumber
run number
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Gaudi::Property< unsigned int > m_maxFileNE
#define ATH_MSG_VERBOSE(x)
Gaudi::Property< std::string > m_streamName
eformat event version to produce, "v40" for run1, or "current"
Gaudi::Property< std::string > m_inputDir
< directory for the data files
const ByteStreamMetadata * getByteStreamMetadata()
virtual bool putEvent(const RawEvent *re) override
Implementation of the IByteStreamOutputSvc interface method putEvent.
StatusCode reinit()
reinitialize the service when a fork() occurred/was-issued
Gaudi::Property< int > m_run
Dump fragments.
const DataType * PointerType
Gaudi::Property< std::string > m_eformatVersion
EventStorage BS version to produce, "v5" for run1, or "current".
std::unique_ptr< ByteStreamDataWriter > m_dataWriter
pointer to DataWriter
Gaudi::Property< std::string > m_simpleFileName
use this string for filename, not from the "AgreedFileName"
void updateDataWriterParameters(DataWriterParameters &) const
Create DataWriter parameters from job properties.
Gaudi::Property< std::string > m_appName
File Tag.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
std::mutex m_dataWriterMutex
mutex to lock data writer during initialization or writing
Class containing parameters needed to initiate DataWriter.
ServiceHandle< IIoComponentMgr > m_ioMgr
Gaudi::Property< std::string > m_eventStorageVersion
stream name for multiple output
bool initDataWriterContents(const xAOD::EventInfo *, const ByteStreamMetadata *)
static std::unique_ptr< ByteStreamDataWriter > makeWriter(int version, const std::string &writingPath, const std::string &fileNameCore, const EventStorage::run_parameters_record &rPar, const std::vector< std::string > &fmdStrings, unsigned int maxFileNE=0, unsigned int maxFileMB=0, unsigned int startIndex=1, EventStorage::CompressionType compression=EventStorage::NONE, unsigned int compLevel=1)
Factory method returning data writer instance for specified version.
Gaudi::Property< bool > m_compressEvents
number of MB per file
Class describing the basic event information.
#define ATH_MSG_WARNING(x)
const boost::regex re(r_e)
Gaudi::Property< unsigned int > m_maxFileMB
number of events per file
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Gaudi::Property< std::string > m_projectTag
Application Name.
const T * get(const ReadHandleKey< T > &key)
Convenience function to retrieve an object given a ReadHandleKey.
Class describing a stream tag on the event.