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 DiskWritingParams &, const uint64_t &maxFileSize)
 
- Public Member Functions inherited from stor::FileHandler
uint32_t events () const
 
 FileHandler (FilesMonitorCollection::FileRecordPtr, const DbFileHandlerPtr, const DiskWritingParams &, 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 setAdler (uint32_t s)
 
void updateDatabase () const
 
void writeToSummaryCatalog () 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.13.4.1
Date:
2011/03/07 11:33:04

Definition at line 29 of file EventFileHandler.h.

Constructor & Destructor Documentation

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().

21  :
22  FileHandler(fileRecord, dbFileHandler, dwParams, maxFileSize),
23  writer_(new edm::StreamerFileWriter(fileRecord->completeFileName()))
24  {
25  writeHeader(view);
26  }
FileHandler(FilesMonitorCollection::FileRecordPtr, const DbFileHandlerPtr, const DiskWritingParams &, const uint64_t &maxFileSize)
Definition: FileHandler.cc:23
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 60 of file EventFileHandler.cc.

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

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

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

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_.

39  {
41 
42  event.hltTriggerBits(evtParams.hltBits);
43  evtParams.headerPtr = (char*) event.headerLocation();
44  evtParams.headerSize = event.headerSize();
45 
46  unsigned int fragCount = event.fragmentCount();
47  evtParams.fragmentCount = fragCount;
48 
49  for (unsigned int idx = 0; idx < fragCount; ++idx)
50  {
51  evtParams.fragmentIndex = idx;
52  evtParams.dataPtr = (char*) event.dataLocation(idx);
53  evtParams.dataSize = event.dataSize(idx);
54 
55  writer_->doOutputEventFragment(evtParams);
56  }
57  }
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 29 of file EventFileHandler.cc.

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

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

Member Data Documentation

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

Definition at line 59 of file EventFileHandler.h.

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