CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

stor::FaultyEventStreamHandler Class Reference

#include <FaultyEventStreamHandler.h>

Inheritance diagram for stor::FaultyEventStreamHandler:
stor::StreamHandler

List of all members.

Public Member Functions

 FaultyEventStreamHandler (const SharedResourcesPtr, const DbFileHandlerPtr, const std::string &streamName)

Private Member Functions

virtual double fractionToDisk () const
virtual FileHandlerPtr getFileHandler (const I2OChain &event)
virtual int getStreamMaxFileSize () const
virtual FileHandlerPtr newFileHandler (const I2OChain &event)
virtual std::string streamLabel () const

Private Attributes

InitMsgCollectionPtr initMsgCollection_

Detailed Description

Handle the faulty event stream written to disk.

Author:
mommsen
Revision:
1.2
Date:
2011/03/07 15:31:31

Definition at line 26 of file FaultyEventStreamHandler.h.


Constructor & Destructor Documentation

stor::FaultyEventStreamHandler::FaultyEventStreamHandler ( const SharedResourcesPtr  sharedResources,
const DbFileHandlerPtr  dbFileHandler,
const std::string &  streamName 
)

Definition at line 16 of file FaultyEventStreamHandler.cc.

References stor::StreamHandler::fractionToDisk().

   :
  StreamHandler(sharedResources, dbFileHandler),
  initMsgCollection_(sharedResources->initMsgCollection_)
  {
    streamRecord_->streamName = streamName;
    streamRecord_->fractionToDisk = 1;
  }

Member Function Documentation

virtual double stor::FaultyEventStreamHandler::fractionToDisk ( ) const [inline, private, virtual]

Return the fraction-to-disk parameter

Implements stor::StreamHandler.

Definition at line 49 of file FaultyEventStreamHandler.h.

References stor::StreamHandler::streamRecord_.

    { return streamRecord_->fractionToDisk; }
StreamHandler::FileHandlerPtr stor::FaultyEventStreamHandler::getFileHandler ( const I2OChain event) [private, virtual]

Get the file handler responsible for the event

Reimplemented from stor::StreamHandler.

Definition at line 30 of file FaultyEventStreamHandler.cc.

References stor::StreamHandler::closeAllFiles(), and newFileHandler().

  {
    // In the faulty event stream a new file is opened for each event.
    closeAllFiles();
    return newFileHandler(event);
  }
virtual int stor::FaultyEventStreamHandler::getStreamMaxFileSize ( ) const [inline, private, virtual]

Return the maximum file size for the stream in MB

Implements stor::StreamHandler.

Definition at line 65 of file FaultyEventStreamHandler.h.

    { return 0; }
StreamHandler::FileHandlerPtr stor::FaultyEventStreamHandler::newFileHandler ( const I2OChain event) [private, virtual]

Return a new file handler for the provided event

Implements stor::StreamHandler.

Definition at line 39 of file FaultyEventStreamHandler.cc.

References stor::StreamHandler::dbFileHandler_, stor::StreamHandler::diskWritingParams_, ExpressReco_HICollisions_FallBack::e, stor::StreamHandler::fileHandlers_, stor::StreamHandler::getNewFileRecord(), initMsgCollection_, and stor::I2OChain::outputModuleId().

Referenced by getFileHandler().

  {
    FileHandlerPtr newFileHandler;
    FilesMonitorCollection::FileRecordPtr fileRecord = getNewFileRecord(event);
    
    // As each event can have a different outputModuleId, we need to 
    // determine the init msg for each event.
    // If this is not possible, use the FRD data format.
    try
    {
      InitMsgSharedPtr initMsgView =
        initMsgCollection_->getElementForOutputModule(
          initMsgCollection_->getOutputModuleName( event.outputModuleId() )
        );
      
      newFileHandler.reset(
        new EventFileHandler(initMsgView, fileRecord, dbFileHandler_,
          diskWritingParams_, 0)
      );
    }
    catch (stor::exception::IncompleteEventMessage& e) //faulty data event
    {
      newFileHandler.reset(
        new FRDFileHandler(fileRecord, dbFileHandler_, diskWritingParams_, 0)
      );
    }
    catch (stor::exception::WrongI2OMessageType& e) //faulty error event
    {
      newFileHandler.reset(
        new FRDFileHandler(fileRecord, dbFileHandler_, diskWritingParams_, 0)
      );
    }
    
    fileHandlers_.push_back(newFileHandler);
    
    return newFileHandler;
  }
virtual std::string stor::FaultyEventStreamHandler::streamLabel ( ) const [inline, private, virtual]

Return the stream label

Implements stor::StreamHandler.

Definition at line 43 of file FaultyEventStreamHandler.h.

References stor::StreamHandler::streamRecord_.

    { return streamRecord_->streamName; }

Member Data Documentation

Definition at line 69 of file FaultyEventStreamHandler.h.

Referenced by newFileHandler().