ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
ByteStreamDataWriterV5 Class Reference

Implementation of ByteStreamDataWriter for version 5 (run1) of EventStorage. More...

#include <ByteStreamDataWriterV5.h>

Inheritance diagram for ByteStreamDataWriterV5:
Collaboration diagram for ByteStreamDataWriterV5:

Public Member Functions

 ByteStreamDataWriterV5 (const std::string &writingPath, const std::string &fileNameCore, const EventStorage::run_parameters_record &rPar, const std::vector< std::string > &fmdStrings, unsigned int maxFileNE, unsigned int maxFileMB, unsigned int startIndex, EventStorage::CompressionType compression, unsigned int compLevel)
 
 ByteStreamDataWriterV5 (const std::string &writingPath, boost::shared_ptr< EventStorage::FileNameCallback > theFNCB, const EventStorage::run_parameters_record &rPar, const std::string &project, const std::string &streamType, const std::string &streamName, const std::string &stream, unsigned int lumiBlockNumber, const std::string &applicationName, const std::vector< std::string > &fmdStrings, unsigned int maxFileNE, unsigned int maxFileMB, EventStorage::CompressionType compression, unsigned int compLevel)
 
virtual ~ByteStreamDataWriterV5 ()
 
 ByteStreamDataWriterV5 (const ByteStreamDataWriterV5 &)=delete
 
ByteStreamDataWriterV5operator= (const ByteStreamDataWriterV5 &)=delete
 
virtual EventStorage::DWError putData (unsigned int dataSize, const void *data) override
 Write a single block of data. More...
 
virtual bool good () const override
 Feedback to user, check if open and last write went OK. More...
 

Static Public Member Functions

static std::unique_ptr< ByteStreamDataWritermakeWriter (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. More...
 
static std::unique_ptr< ByteStreamDataWritermakeWriter (int version, const std::string &writingPath, boost::shared_ptr< EventStorage::FileNameCallback > theFNCB, const EventStorage::run_parameters_record &rPar, const std::string &project, const std::string &streamType, const std::string &streamName, const std::string &stream, unsigned int lumiBlockNumber, const std::string &applicationName, const std::vector< std::string > &fmdStrings, unsigned int maxFileNE=0, unsigned int maxFileMB=0, EventStorage::CompressionType compression=EventStorage::NONE, unsigned int compLevel=1)
 Factory method returning data writer instance for specified version. More...
 
static std::unique_ptr< ByteStreamDataWritermakeWriter (const DataWriterParameters &parameters)
 Factory method returning data writer instance for specified version. More...
 

Private Attributes

std::unique_ptr< offline_EventStorage_v5::DataWriterm_writer
 

Detailed Description

Implementation of ByteStreamDataWriter for version 5 (run1) of EventStorage.

Definition at line 24 of file ByteStreamDataWriterV5.h.

Constructor & Destructor Documentation

◆ ByteStreamDataWriterV5() [1/3]

ByteStreamDataWriterV5::ByteStreamDataWriterV5 ( const std::string &  writingPath,
const std::string &  fileNameCore,
const EventStorage::run_parameters_record &  rPar,
const std::vector< std::string > &  fmdStrings,
unsigned int  maxFileNE,
unsigned int  maxFileMB,
unsigned int  startIndex,
EventStorage::CompressionType  compression,
unsigned int  compLevel 
)

Definition at line 34 of file ByteStreamDataWriterV5.cxx.

43 {
44  // convert current run_parameters_record to v5
45  offline_EventStorage_v5::run_parameters_record rPar_v5 = ::runPram_to_v5(rPar);
46 
47  // convert compression type
50 
51  m_writer.reset(new offline_EventStorage_v5::DataWriter(writingPath,
52  fileNameCore,
53  rPar_v5,
54  fmdStrings,
55  startIndex,
56  compression_v5,
57  compLevel));
58  m_writer->setMaxFileNE(maxFileNE);
59  m_writer->setMaxFileMB(maxFileMB);
60 }

◆ ByteStreamDataWriterV5() [2/3]

ByteStreamDataWriterV5::ByteStreamDataWriterV5 ( const std::string &  writingPath,
boost::shared_ptr< EventStorage::FileNameCallback >  theFNCB,
const EventStorage::run_parameters_record &  rPar,
const std::string &  project,
const std::string &  streamType,
const std::string &  streamName,
const std::string &  stream,
unsigned int  lumiBlockNumber,
const std::string &  applicationName,
const std::vector< std::string > &  fmdStrings,
unsigned int  maxFileNE,
unsigned int  maxFileMB,
EventStorage::CompressionType  compression,
unsigned int  compLevel 
)

Definition at line 62 of file ByteStreamDataWriterV5.cxx.

76 {
77  // convert current run_parameters_record to v5
78  offline_EventStorage_v5::run_parameters_record rPar_v5 = ::runPram_to_v5(rPar);
79 
80  // convert compression type
83 
84  m_writer.reset(new offline_EventStorage_v5::DataWriter(writingPath,
85  theFNCB,
86  rPar_v5,
87  project,
88  streamType,
89  streamName,
90  stream,
91  lumiBlockNumber,
92  applicationName,
93  fmdStrings,
94  compression_v5,
95  compLevel));
96  m_writer->setMaxFileNE(maxFileNE);
97  m_writer->setMaxFileMB(maxFileMB);
98 }

◆ ~ByteStreamDataWriterV5()

ByteStreamDataWriterV5::~ByteStreamDataWriterV5 ( )
virtual

Definition at line 100 of file ByteStreamDataWriterV5.cxx.

101 {
102 }

◆ ByteStreamDataWriterV5() [3/3]

ByteStreamDataWriterV5::ByteStreamDataWriterV5 ( const ByteStreamDataWriterV5 )
delete

Member Function Documentation

◆ good()

bool ByteStreamDataWriterV5::good ( ) const
overridevirtual

Feedback to user, check if open and last write went OK.

Implements ByteStreamDataWriter.

Definition at line 111 of file ByteStreamDataWriterV5.cxx.

112 {
113  return m_writer->good();
114 }

◆ makeWriter() [1/3]

std::unique_ptr< ByteStreamDataWriter > ByteStreamDataWriter::makeWriter ( const DataWriterParameters parameters)
staticinherited

Factory method returning data writer instance for specified version.

Throws exception in case of problems, never returns zero pointer.

Parameters
parametersset of parameters needed to initiate DataWriter
Exceptions
std::exception(or sub-class) is thrown in case of problems.

Definition at line 170 of file ByteStreamDataWriter.cxx.

170  {
171  // initiate with production file name
172  if (parameters.theFNCB == nullptr)
173  return makeWriter(
174  parameters.version,
175  parameters.writingPath,
176  parameters.fileNameCore,
177  parameters.rPar,
178  parameters.fmdStrings,
179  parameters.maxFileNE,
180  parameters.maxFileMB,
181  parameters.startIndex,
182  parameters.compression,
183  parameters.compLevel);
184 
185  // initiate for user-defined file name
186  return makeWriter(
187  parameters.version,
188  parameters.writingPath,
189  parameters.theFNCB,
190  parameters.rPar,
191  parameters.project,
192  parameters.streamType,
193  parameters.streamName,
194  parameters.stream,
195  parameters.lumiBlockNumber,
196  parameters.applicationName,
197  parameters.fmdStrings,
198  parameters.maxFileNE,
199  parameters.maxFileMB,
200  parameters.compression,
201  parameters.compLevel);
202 }

◆ makeWriter() [2/3]

std::unique_ptr< ByteStreamDataWriter > ByteStreamDataWriter::makeWriter ( int  version,
const std::string &  writingPath,
boost::shared_ptr< EventStorage::FileNameCallback >  theFNCB,
const EventStorage::run_parameters_record &  rPar,
const std::string &  project,
const std::string &  streamType,
const std::string &  streamName,
const std::string &  stream,
unsigned int  lumiBlockNumber,
const std::string &  applicationName,
const std::vector< std::string > &  fmdStrings,
unsigned int  maxFileNE = 0,
unsigned int  maxFileMB = 0,
EventStorage::CompressionType  compression = EventStorage::NONE,
unsigned int  compLevel = 1 
)
staticinherited

Factory method returning data writer instance for specified version.

Throws exception in case of problems, never returns zero pointer.

Parameters
versionwriter version to instantiate, 0 for most current version, other supported values: 5 for run1-compatible output. Exception is thrown is version is not supported.
writingPathdirectory where to write data
theFNCBcallback method for generating file names
rParother parameters from IS including the run number
fmdStringsoptional vector of strings containing metadata
maxFileNEmax size of a file in number of data blocks (or events)
maxFileMBmax size of a file in MB. The file is closed before this limit is overrun.
startIndexinitial file sequence index
compressionCompression type
compLevelCompression level
Exceptions
std::exception(or sub-class) is thrown in case of problems.

Definition at line 112 of file ByteStreamDataWriter.cxx.

127 {
128  ByteStreamDataWriter* res = nullptr;
129  if (version == 0 or version == FILE_FORMAT_VERSION) {
130  // Use current version
131  res = new ByteStreamDataWriterCurrent(writingPath,
132  theFNCB,
133  rPar,
134  project,
135  streamType,
136  streamName,
137  stream,
138  lumiBlockNumber,
139  applicationName,
140  fmdStrings,
141  maxFileNE,
142  maxFileMB,
143  compression,
144  compLevel);
145  } else if (version == 5) {
146  // Run1 version
147  res = new ByteStreamDataWriterV5(writingPath,
148  theFNCB,
149  rPar,
150  project,
151  streamType,
152  streamName,
153  stream,
154  lumiBlockNumber,
155  applicationName,
156  fmdStrings,
157  maxFileNE,
158  maxFileMB,
159  compression,
160  compLevel);
161  } else {
162  // Unexpected something
163  versionException(version);
164  }
165 
166  return std::unique_ptr<ByteStreamDataWriter>(res);
167 }

◆ makeWriter() [3/3]

std::unique_ptr< ByteStreamDataWriter > 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 
)
staticinherited

Factory method returning data writer instance for specified version.

Throws exception in case of problems, never returns zero pointer.

Parameters
versionwriter version to instantiate, 0 for most current version, other supported values: 5 for run1-compatible output. Exception is thrown if version is not supported.
writingPathdirectory where to write data
fileNameCorefile name not including the ending "._NNNN.data"
rParother parameters from IS including the run number
fmdStringsoptional vector of strings containing metadata
maxFileNEmax size of a file in number of data blocks (or events)
maxFileMBmax size of a file in MB. The file is closed before this limit is overrun.
startIndexinitial file sequence index
compressionCompression type
compLevelCompression level
Exceptions
std::exception(or sub-class) is thrown in case of problems.

Definition at line 69 of file ByteStreamDataWriter.cxx.

79 {
80  ByteStreamDataWriter* res = nullptr;
81  if (version == 0 or version == FILE_FORMAT_VERSION) {
82  // Use current version
83  res = new ByteStreamDataWriterCurrent(writingPath,
84  fileNameCore,
85  rPar,
86  fmdStrings,
87  maxFileNE,
88  maxFileMB,
89  startIndex,
91  compLevel);
92  } else if (version == 5) {
93  // Run1 version
94  res = new ByteStreamDataWriterV5(writingPath,
95  fileNameCore,
96  rPar,
97  fmdStrings,
98  maxFileNE,
99  maxFileMB,
100  startIndex,
101  compression,
102  compLevel);
103  } else {
104  // Unexpected something
105  versionException(version);
106  }
107 
108  return std::unique_ptr<ByteStreamDataWriter>(res);
109 }

◆ operator=()

ByteStreamDataWriterV5& ByteStreamDataWriterV5::operator= ( const ByteStreamDataWriterV5 )
delete

◆ putData()

EventStorage::DWError ByteStreamDataWriterV5::putData ( unsigned int  dataSize,
const void *  data 
)
overridevirtual

Write a single block of data.

If one of the size limits would be exceeded, the current file will be closed and another one will be opened automatically.

Parameters
dataSizesize of the data block in bytes
datastart of the event data in memory

Implements ByteStreamDataWriter.

Definition at line 105 of file ByteStreamDataWriterV5.cxx.

106 {
107  return m_writer->putData(dataSize, data);
108 }

Member Data Documentation

◆ m_writer

std::unique_ptr<offline_EventStorage_v5::DataWriter> ByteStreamDataWriterV5::m_writer
private

Definition at line 64 of file ByteStreamDataWriterV5.h.


The documentation for this class was generated from the following files:
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
offline_EventStorage_v5::DataWriter
Definition: v5_DataWriter.h:45
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
ByteStreamDataWriterV5::m_writer
std::unique_ptr< offline_EventStorage_v5::DataWriter > m_writer
Definition: ByteStreamDataWriterV5.h:64
PayloadHelpers::dataSize
size_t dataSize(TDA::PayloadIterator start)
Size in bytes of the buffer that is needed to decode next fragment data content.
Definition: TriggerEDMDeserialiserAlg.cxx:188
ByteStreamDataWriter::makeWriter
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.
Definition: ByteStreamDataWriter.cxx:69
ByteStreamDataWriterV5
Implementation of ByteStreamDataWriter for version 5 (run1) of EventStorage.
Definition: ByteStreamDataWriterV5.h:24
project
T_ResultType project(ParameterMapping::type< N > parameter_map, const T_Matrix &matrix)
Definition: MeasurementSelector.h:142
get_generator_info.version
version
Definition: get_generator_info.py:33
AthenaPoolExample_Copy.streamName
string streamName
Definition: AthenaPoolExample_Copy.py:39
RunTileMonitoring.streamType
streamType
Definition: RunTileMonitoring.py:158
offline_EventStorage_v5::CompressionType
CompressionType
Definition: v5_EventStorageRecords.h:41
offline_EventStorage_v5::run_parameters_record
Definition: v5_EventStorageRecords.h:62
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
python.BeamSpotUpdate.compression
compression
Definition: BeamSpotUpdate.py:188
ByteStreamDataWriter
This class defines abstract interface for data writing.
Definition: ByteStreamDataWriter.h:41