ATLAS Offline Software
ByteStreamDataWriterV5.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <stdexcept>
8 
10 
11 namespace {
12 
14 runPram_to_v5(const EventStorage::run_parameters_record& rPar)
15 {
16  // convert current run_parameters_record to v5
18  rPar.marker,
19  rPar.record_size,
20  rPar.run_number,
21  rPar.max_events,
22  rPar.rec_enable,
23  rPar.trigger_type,
24  rPar.detector_mask_LS, /* v5 detector_mask = v6 detector_mask_LS, detector_mask_MS is lost */
25  rPar.beam_type,
26  rPar.beam_energy
27  };
28  return rPar_v5;
29 }
30 
31 }
32 
33 
34 ByteStreamDataWriterV5::ByteStreamDataWriterV5(const std::string& writingPath,
35  const std::string& fileNameCore,
36  const EventStorage::run_parameters_record& rPar,
37  const std::vector<std::string>& fmdStrings,
38  unsigned int maxFileNE,
39  unsigned int maxFileMB,
40  unsigned int startIndex,
42  unsigned int compLevel)
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 }
61 
62 ByteStreamDataWriterV5::ByteStreamDataWriterV5(const std::string& writingPath,
63  boost::shared_ptr<EventStorage::FileNameCallback> theFNCB,
64  const EventStorage::run_parameters_record& rPar,
65  const std::string& project,
66  const std::string& streamType,
67  const std::string& streamName,
68  const std::string& stream,
69  unsigned int lumiBlockNumber,
70  const std::string& applicationName,
71  const std::vector<std::string>& fmdStrings,
72  unsigned int maxFileNE,
73  unsigned int maxFileMB,
75  unsigned int compLevel)
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 }
99 
101 {
102 }
103 
104 EventStorage::DWError
106 {
107  return m_writer->putData(dataSize, data);
108 }
109 
110 bool
112 {
113  return m_writer->good();
114 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
ByteStreamDataWriterV5::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: ByteStreamDataWriterV5.cxx:34
ByteStreamDataWriterV5::~ByteStreamDataWriterV5
virtual ~ByteStreamDataWriterV5()
Definition: ByteStreamDataWriterV5.cxx:100
offline_EventStorage_v5::DataWriter
Definition: v5_DataWriter.h:45
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
offline_EventStorage_v5::run_parameters_record::marker
uint32_t marker
Definition: v5_EventStorageRecords.h:63
ByteStreamDataWriterV5::putData
virtual EventStorage::DWError putData(unsigned int dataSize, const void *data) override
Write a single block of data.
Definition: ByteStreamDataWriterV5.cxx:105
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
project
T_ResultType project(ParameterMapping::type< N > parameter_map, const T_Matrix &matrix)
Definition: MeasurementSelector.h:142
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
ByteStreamDataWriterV5::good
virtual bool good() const override
Feedback to user, check if open and last write went OK.
Definition: ByteStreamDataWriterV5.cxx:111
ByteStreamDataWriterV5.h
This file contains the class definition for the ByteStreamDataWriterV5 class.
offline_EventStorage_v5::run_parameters_record
Definition: v5_EventStorageRecords.h:62
v5_DataWriter.h
python.BeamSpotUpdate.compression
compression
Definition: BeamSpotUpdate.py:188