#include <EventFileHandler.h>
Public Member Functions | |
virtual void | closeFile (const FilesMonitorCollection::FileRecord::ClosingReason &) |
EventFileHandler (InitMsgSharedPtr, FilesMonitorCollection::FileRecordPtr, const DbFileHandlerPtr, const DiskWritingParams &, const uint64_t &maxFileSize) | |
Private Member Functions | |
virtual void | do_writeEvent (const I2OChain &) |
void | writeHeader (InitMsgSharedPtr) |
Private Attributes | |
boost::scoped_ptr < edm::StreamerFileWriter > | writer_ |
Represents a file holding event data
Definition at line 29 of file EventFileHandler.h.
stor::EventFileHandler::EventFileHandler | ( | InitMsgSharedPtr | view, |
FilesMonitorCollection::FileRecordPtr | fileRecord, | ||
const DbFileHandlerPtr | dbFileHandler, | ||
const DiskWritingParams & | dwParams, | ||
const uint64_t & | maxFileSize | ||
) |
Definition at line 15 of file EventFileHandler.cc.
References xuti::writeHeader().
: FileHandler(fileRecord, dbFileHandler, dwParams, maxFileSize), writer_(new edm::StreamerFileWriter(fileRecord->completeFileName())) { writeHeader(view); }
void stor::EventFileHandler::closeFile | ( | const FilesMonitorCollection::FileRecord::ClosingReason & | reason | ) | [virtual] |
Close the file
Implements stor::FileHandler.
Definition at line 60 of file EventFileHandler.cc.
References stor::FileHandler::fileRecord_, stor::FileHandler::moveFileToClosed(), stor::FileHandler::updateDatabase(), and writer_.
{ if ( ! fileRecord_->isOpen ) return; if (writer_) { // if writer was reset, we already closed the stream but failed to move the file to the closed position writer_->stop(); fileRecord_->fileSize += writer_->getStreamEOFSize(); fileRecord_->adler32 = writer_->get_adler32(); writer_.reset(); // Destruct the writer to flush the file stream } moveFileToClosed(reason); updateDatabase(); }
void stor::EventFileHandler::do_writeEvent | ( | const I2OChain & | event | ) | [private, virtual] |
Write the I2OChain to the file
Implements stor::FileHandler.
Definition at line 38 of file EventFileHandler.cc.
References stor::I2OChain::dataLocation(), edm::StreamerFileWriterEventParams::dataPtr, edm::StreamerFileWriterEventParams::dataSize, edm::StreamerFileWriterEventParams::fragmentCount, edm::StreamerFileWriterEventParams::fragmentIndex, stor::I2OChain::headerLocation(), edm::StreamerFileWriterEventParams::headerPtr, edm::StreamerFileWriterEventParams::headerSize, edm::StreamerFileWriterEventParams::hltBits, and writer_.
{ edm::StreamerFileWriterEventParams evtParams; event.hltTriggerBits(evtParams.hltBits); evtParams.headerPtr = (char*) event.headerLocation(); evtParams.headerSize = event.headerSize(); unsigned int fragCount = event.fragmentCount(); evtParams.fragmentCount = fragCount; for (unsigned int idx = 0; idx < fragCount; ++idx) { evtParams.fragmentIndex = idx; evtParams.dataPtr = (char*) event.dataLocation(idx); evtParams.dataSize = event.dataSize(idx); writer_->doOutputEventFragment(evtParams); } }
void stor::EventFileHandler::writeHeader | ( | InitMsgSharedPtr | view | ) | [private] |
Write the init message to the head of the file
Definition at line 29 of file EventFileHandler.cc.
References stor::FileHandler::fileRecord_, stor::utils::getCurrentTime(), stor::FileHandler::lastEntry_, and writer_.
{ InitMsgView initView(&(*view)[0]); writer_->doOutputHeader(initView); fileRecord_->fileSize += view->size(); lastEntry_ = utils::getCurrentTime(); }
boost::scoped_ptr<edm::StreamerFileWriter> stor::EventFileHandler::writer_ [private] |
Definition at line 59 of file EventFileHandler.h.
Referenced by closeFile(), do_writeEvent(), and writeHeader().