CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
stor::EventFileHandler Class Reference

#include <EventFileHandler.h>

Inheritance diagram for stor::EventFileHandler:
stor::FileHandler

Public Member Functions

virtual void closeFile (const FilesMonitorCollection::FileRecord::ClosingReason &)
 
 EventFileHandler (InitMsgSharedPtr, FilesMonitorCollection::FileRecordPtr, const DbFileHandlerPtr, const uint64_t &maxFileSize)
 
- Public Member Functions inherited from stor::FileHandler
uint32_t events () const
 
 FileHandler (FilesMonitorCollection::FileRecordPtr, const DbFileHandlerPtr, const uint64_t &maxFileSize)
 
uint64_t fileSize () const
 
bool isFromLumiSection (const uint32_t lumiSection)
 
uint32_t lumiSection () const
 
bool tooLarge (const uint64_t &dataSize)
 
bool tooOld (const utils::TimePoint_t currentTime=utils::getCurrentTime())
 
void writeEvent (const I2OChain &)
 
virtual ~FileHandler ()
 

Private Member Functions

virtual void do_writeEvent (const I2OChain &)
 
void writeHeader (InitMsgSharedPtr)
 

Private Attributes

boost::scoped_ptr
< edm::StreamerFileWriter
writer_
 

Additional Inherited Members

- Protected Member Functions inherited from stor::FileHandler
void insertFileInDatabase () const
 
void moveFileToClosed (const FilesMonitorCollection::FileRecord::ClosingReason &)
 
void updateDatabase () const
 
- Protected Attributes inherited from stor::FileHandler
const DbFileHandlerPtr dbFileHandler_
 
const DiskWritingParamsdiskWritingParams_
 
FilesMonitorCollection::FileRecordPtr fileRecord_
 
utils::TimePoint_t firstEntry_
 
utils::TimePoint_t lastEntry_
 

Detailed Description

Represents a file holding event data

Author:
mommsen
Revision:
1.15
Date:
2012/04/04 12:16:56

Definition at line 29 of file EventFileHandler.h.

Constructor & Destructor Documentation

stor::EventFileHandler::EventFileHandler ( InitMsgSharedPtr  view,
FilesMonitorCollection::FileRecordPtr  fileRecord,
const DbFileHandlerPtr  dbFileHandler,
const uint64_t &  maxFileSize 
)

Definition at line 15 of file EventFileHandler.cc.

References xuti::writeHeader().

20  :
21  FileHandler(fileRecord, dbFileHandler, maxFileSize),
22  writer_(new edm::StreamerFileWriter(fileRecord->completeFileName()))
23  {
24  writeHeader(view);
25  }
FileHandler(FilesMonitorCollection::FileRecordPtr, const DbFileHandlerPtr, const uint64_t &maxFileSize)
Definition: FileHandler.cc:26
void writeHeader(InitMsgSharedPtr)
boost::scoped_ptr< edm::StreamerFileWriter > writer_

Member Function Documentation

void stor::EventFileHandler::closeFile ( const FilesMonitorCollection::FileRecord::ClosingReason reason)
virtual

Close the file

Implements stor::FileHandler.

Definition at line 59 of file EventFileHandler.cc.

References stor::FileHandler::fileRecord_, stor::FileHandler::moveFileToClosed(), stor::FileHandler::updateDatabase(), and writer_.

Referenced by Vispa.Main.Application.Application::tabCloseRequest().

60  {
61  if ( ! fileRecord_->isOpen ) return;
62 
63  if (writer_)
64  {
65  // if writer was reset, we already closed the stream but failed to move the file to the closed position
66  writer_->stop();
67  fileRecord_->fileSize += writer_->getStreamEOFSize();
68  fileRecord_->adler32 = writer_->get_adler32();
69  writer_.reset(); // Destruct the writer to flush the file stream
70  }
71  moveFileToClosed(reason);
73  }
void moveFileToClosed(const FilesMonitorCollection::FileRecord::ClosingReason &)
Definition: FileHandler.cc:190
void updateDatabase() const
Definition: FileHandler.cc:70
FilesMonitorCollection::FileRecordPtr fileRecord_
Definition: FileHandler.h:181
boost::scoped_ptr< edm::StreamerFileWriter > writer_
void stor::EventFileHandler::do_writeEvent ( const I2OChain event)
privatevirtual

Write the I2OChain to the file

Implements stor::FileHandler.

Definition at line 37 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_.

38  {
40 
41  event.hltTriggerBits(evtParams.hltBits);
42  evtParams.headerPtr = (char*) event.headerLocation();
43  evtParams.headerSize = event.headerSize();
44 
45  unsigned int fragCount = event.fragmentCount();
46  evtParams.fragmentCount = fragCount;
47 
48  for (unsigned int idx = 0; idx < fragCount; ++idx)
49  {
50  evtParams.fragmentIndex = idx;
51  evtParams.dataPtr = (char*) event.dataLocation(idx);
52  evtParams.dataSize = event.dataSize(idx);
53 
54  writer_->doOutputEventFragment(evtParams);
55  }
56  }
std::vector< unsigned char > hltBits
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
boost::scoped_ptr< edm::StreamerFileWriter > writer_
void stor::EventFileHandler::writeHeader ( InitMsgSharedPtr  view)
private

Write the init message to the head of the file

Definition at line 28 of file EventFileHandler.cc.

References stor::FileHandler::fileRecord_, stor::utils::getCurrentTime(), stor::FileHandler::lastEntry_, and writer_.

29  {
30  InitMsgView initView(&(*view)[0]);
31  writer_->doOutputHeader(initView);
32  fileRecord_->fileSize += view->size();
34  }
TimePoint_t getCurrentTime()
Definition: Utils.h:158
utils::TimePoint_t lastEntry_
Definition: FileHandler.h:185
FilesMonitorCollection::FileRecordPtr fileRecord_
Definition: FileHandler.h:181
boost::scoped_ptr< edm::StreamerFileWriter > writer_

Member Data Documentation

boost::scoped_ptr<edm::StreamerFileWriter> stor::EventFileHandler::writer_
private

Definition at line 58 of file EventFileHandler.h.

Referenced by closeFile(), do_writeEvent(), and writeHeader().