CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
StreamerOutputFile Class Reference

#include <StreamerOutputFile.h>

Public Member Functions

uint32 adler32 () const
 
void close ()
 
 StreamerOutputFile (const std::string &name)
 
uint64 write (const EventMsgBuilder &)
 
uint64 write (const EventMsgView &)
 
void write (const InitMsgBuilder &)
 
void write (const InitMsgView &)
 
uint64 writeEventFragment (uint32 fragIndex, uint32 fragCount, const char *dataPtr, uint32 dataSize)
 
void writeInitFragment (uint32 fragIndex, uint32 fragCount, const char *dataPtr, uint32 dataSize)
 
 ~StreamerOutputFile ()
 

Private Member Functions

void writeEventHeader (const EventMsgView &ineview)
 
void writeStart (const InitMsgView &inview)
 

Private Attributes

edm::propagate_const< std::shared_ptr< OutputFile > > streamerfile_
 

Detailed Description

StreamerOutputFile: Class for doing Streamer Write operations Class for doing Streamer Write operations

Definition at line 23 of file StreamerOutputFile.h.

Constructor & Destructor Documentation

◆ StreamerOutputFile()

StreamerOutputFile::StreamerOutputFile ( const std::string &  name)
explicit

Definition at line 6 of file StreamerOutputFile.cc.

7  streamerfile_->set_do_adler(true);
8 }

References streamerfile_.

◆ ~StreamerOutputFile()

StreamerOutputFile::~StreamerOutputFile ( )

CTOR, takes file path name as argument

Definition at line 4 of file StreamerOutputFile.cc.

4 {}

Member Function Documentation

◆ adler32()

uint32 StreamerOutputFile::adler32 ( ) const
inline

Definition at line 55 of file StreamerOutputFile.h.

55 { return streamerfile_->adler32(); }

References streamerfile_.

Referenced by evf::EvFOutputModule::beginRun().

◆ close()

void StreamerOutputFile::close ( void  )
inline

◆ write() [1/4]

uint64 StreamerOutputFile::write ( const EventMsgBuilder ineview)

Definition at line 10 of file StreamerOutputFile.cc.

10  {
11  EventMsgView tmpView(ineview.startAddress());
12  return write(tmpView);
13 }

References EventMsgBuilder::startAddress(), and write().

◆ write() [2/4]

uint64 StreamerOutputFile::write ( const EventMsgView ineview)

Performs write on EventMsgBuilder type, Header + Blob, both are written out. RETURNS the Offset in Stream while at which EventForOutputwas written.

Offset where current event starts

Definition at line 15 of file StreamerOutputFile.cc.

15  {
17  uint64 offset_to_return = streamerfile_->current_offset();
18 
19  writeEventHeader(ineview);
20  bool ret = streamerfile_->write((const char*)ineview.eventData(), ineview.size() - ineview.headerSize());
21  if (ret) {
22  throw cms::Exception("OutputFile", "write(EventMsgView)")
23  << "Error writing streamer event data to " << streamerfile_->fileName() << ". Possibly the output disk "
24  << "is full?" << std::endl;
25  }
26  return offset_to_return;
27 }

References EventMsgView::eventData(), Exception, EventMsgView::headerSize(), runTheMatrix::ret, EventMsgView::size(), streamerfile_, and writeEventHeader().

◆ write() [3/4]

void StreamerOutputFile::write ( const InitMsgBuilder inview)

Definition at line 51 of file StreamerOutputFile.cc.

51  {
52  InitMsgView tmpView(inview.startAddress());
53  return write(tmpView);
54 }

References InitMsgBuilder::startAddress().

Referenced by evf::EvFOutputModule::beginRun(), and write().

◆ write() [4/4]

void StreamerOutputFile::write ( const InitMsgView inview)

Performs write on InitMsgBuilder type, Header + Blob, both are written out.

Definition at line 56 of file StreamerOutputFile.cc.

56  {
57  writeStart(inview);
58  bool ret = streamerfile_->write((const char*)inview.descData(), inview.size() - inview.headerSize());
59  if (ret) {
60  throw cms::Exception("OutputFile", "write(InitMsgView)")
61  << "Error writing streamer header data to " << streamerfile_->fileName() << ". Possibly the output disk "
62  << "is full?" << std::endl;
63  }
64 }

References InitMsgView::descData(), Exception, InitMsgView::headerSize(), runTheMatrix::ret, InitMsgView::size(), streamerfile_, and writeStart().

◆ writeEventFragment()

uint64 StreamerOutputFile::writeEventFragment ( uint32  fragIndex,
uint32  fragCount,
const char *  dataPtr,
uint32  dataSize 
)

Offset where current event starts

Definition at line 29 of file StreamerOutputFile.cc.

29  {
31  uint64 offset_to_return = streamerfile_->current_offset();
32 
33  bool ret = streamerfile_->write(dataPtr, dataSize);
34  if (ret) {
35  throw cms::Exception("OutputFile", "writeEventFragment()")
36  << "Error writing streamer event data to " << streamerfile_->fileName() << ". Possibly the output disk "
37  << "is full?" << std::endl;
38  }
39  return offset_to_return;
40 }

References Exception, runTheMatrix::ret, and streamerfile_.

◆ writeEventHeader()

void StreamerOutputFile::writeEventHeader ( const EventMsgView ineview)
private

Definition at line 42 of file StreamerOutputFile.cc.

42  {
43  bool ret = streamerfile_->write((const char*)ineview.startAddress(), ineview.headerSize());
44  if (ret) {
45  throw cms::Exception("OutputFile", "writeEventHeader")
46  << "Error writing streamer event data to " << streamerfile_->fileName() << ". Possibly the output disk "
47  << "is full?" << std::endl;
48  }
49 }

References Exception, EventMsgView::headerSize(), runTheMatrix::ret, EventMsgView::startAddress(), and streamerfile_.

Referenced by write().

◆ writeInitFragment()

void StreamerOutputFile::writeInitFragment ( uint32  fragIndex,
uint32  fragCount,
const char *  dataPtr,
uint32  dataSize 
)

Definition at line 66 of file StreamerOutputFile.cc.

66  {
67  bool ret = streamerfile_->write((const char*)dataPtr, dataSize);
68  if (ret) {
69  throw cms::Exception("OutputFile", "writeInitFragment()")
70  << "Error writing streamer header data to " << streamerfile_->fileName() << ". Possibly the output disk "
71  << "is full?" << std::endl;
72  }
73 }

References Exception, runTheMatrix::ret, and streamerfile_.

◆ writeStart()

void StreamerOutputFile::writeStart ( const InitMsgView inview)
private

Definition at line 75 of file StreamerOutputFile.cc.

75  {
76  bool ret = streamerfile_->write((const char*)inview.startAddress(), inview.headerSize());
77  if (ret) {
78  throw cms::Exception("OutputFile", "writeStart")
79  << "Error writing streamer header data to " << streamerfile_->fileName() << ". Possibly the output disk "
80  << "is full?" << std::endl;
81  }
82 }

References Exception, InitMsgView::headerSize(), runTheMatrix::ret, InitMsgView::startAddress(), and streamerfile_.

Referenced by write().

Member Data Documentation

◆ streamerfile_

edm::propagate_const<std::shared_ptr<OutputFile> > StreamerOutputFile::streamerfile_
private
InitMsgView::headerSize
uint32 headerSize() const
Definition: InitMessage.h:87
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
InitMsgBuilder::startAddress
uint8 * startAddress() const
Definition: InitMsgBuilder.h:24
StreamerOutputFile::streamerfile_
edm::propagate_const< std::shared_ptr< OutputFile > > streamerfile_
Definition: StreamerOutputFile.h:64
EventMsgView::startAddress
uint8 * startAddress() const
Definition: EventMessage.h:80
InitMsgView::size
uint32 size() const
Definition: InitMessage.h:66
EventMsgView
Definition: EventMessage.h:72
StreamerOutputFile::write
void write(const InitMsgBuilder &)
Definition: StreamerOutputFile.cc:51
StreamerOutputFile::writeStart
void writeStart(const InitMsgView &inview)
Definition: StreamerOutputFile.cc:75
InitMsgView::startAddress
uint8 * startAddress() const
Definition: InitMessage.h:67
TkAlCaSkimTreeMerger_cff.OutputFile
OutputFile
Definition: TkAlCaSkimTreeMerger_cff.py:6
EventMsgView::size
uint32 size() const
Definition: EventMessage.h:77
EventMsgView::headerSize
uint32 headerSize() const
Definition: EventMessage.h:82
Exception
Definition: hltDiff.cc:246
uint64
unsigned long long uint64
Definition: MsgTools.h:14
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EventMsgBuilder::startAddress
uint8 * startAddress() const
Definition: EventMsgBuilder.h:24
StreamerOutputFile::writeEventHeader
void writeEventHeader(const EventMsgView &ineview)
Definition: StreamerOutputFile.cc:42
InitMsgView::descData
const uint8 * descData() const
Definition: InitMessage.h:86
EventMsgView::eventData
const uint8 * eventData() const
Definition: EventMessage.h:79
InitMsgView
Definition: InitMessage.h:61