CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/EventFilter/StorageManager/src/EventStreamHandler.cc

Go to the documentation of this file.
00001 // $Id: EventStreamHandler.cc,v 1.11 2012/04/20 10:48:02 mommsen Exp $
00003 
00004 #include "EventFilter/StorageManager/interface/Configuration.h"
00005 #include "EventFilter/StorageManager/interface/EventFileHandler.h"
00006 #include "EventFilter/StorageManager/interface/EventStreamConfigurationInfo.h"
00007 #include "EventFilter/StorageManager/interface/EventStreamHandler.h"
00008 
00009 
00010 namespace stor {
00011 
00012   EventStreamHandler::EventStreamHandler
00013   (
00014     const EventStreamConfigurationInfo& streamConfig,
00015     const SharedResourcesPtr sharedResources,
00016     const DbFileHandlerPtr dbFileHandler
00017   ):
00018   StreamHandler(sharedResources, dbFileHandler),
00019   streamConfig_(streamConfig),
00020   initMsgCollection_(sharedResources->initMsgCollection_)
00021   {
00022     streamRecord_->streamName = streamLabel();
00023     streamRecord_->outputModuleLabel = streamConfig_.outputModuleLabel();
00024     streamRecord_->fractionToDisk = fractionToDisk();
00025   }
00026   
00027   
00028   StreamHandler::FileHandlerPtr
00029   EventStreamHandler::newFileHandler(const I2OChain& event)
00030   {
00031     // the INIT message is not available when the EventStreamHandler is
00032     // constructed, so we need to fetch it when we first need a new file
00033     // handler (when the first event is received, which is after the 
00034     // INIT messages have been received)
00035     if (initMsgView_.get() == 0)
00036     {
00037       initMsgView_ = initMsgCollection_->getElementForOutputModuleId( event.outputModuleId() );
00038     }
00039     
00040     FilesMonitorCollection::FileRecordPtr fileRecord = getNewFileRecord(event);
00041     
00042     FileHandlerPtr newFileHandler(
00043       new EventFileHandler(initMsgView_, fileRecord, dbFileHandler_, getMaxFileSize())
00044     );
00045     fileHandlers_.push_back(newFileHandler);
00046     
00047     return newFileHandler;
00048   }
00049   
00050 } // namespace stor
00051