| # Gaudi Framework, version v20r4
Generated: 8 Jan 2009

# OutputFSRStream.cpp

Go to the documentation of this file.

    00001 // $Id: OutputFSRStream.cpp,v 1.1 2008/11/04 22:49:25 marcocle Exp $
    00002 #define GAUDISVC_PERSISTENCYSVC_OUTPUTFSRSTREAM_CPP
    00003
    00004 // Framework include files
    00005 #include "GaudiKernel/AlgFactory.h"
    00006 #include "GaudiKernel/IRegistry.h"
    00007 #include "GaudiKernel/IDataManagerSvc.h"
    00008 #include "GaudiKernel/IDataProviderSvc.h"
    00009 #include "GaudiKernel/IOpaqueAddress.h"
    00010 #include "GaudiKernel/DataStoreItem.h"
    00011 #include "GaudiKernel/DataObject.h"
    00012 #include "GaudiKernel/MsgStream.h"
    00013 #include "OutputFSRStream.h"
    00014
    00015 // Define the algorithm factory for the standard output data writer
    00016 DECLARE_ALGORITHM_FACTORY(OutputFSRStream)
    00017
    00018 // Standard Constructor
    00019 OutputFSRStream::OutputFSRStream(const std::string& name, ISvcLocator* pSvcLocator)
    00020  : OutputStream(name, pSvcLocator)
    00021 {
    00022   m_FSRItemNames.clear();
    00023   m_FSROptItemNames.clear();
    00024
    00025   declareProperty( "FSRItemList",    m_FSRItemNames,    "Mandatory items to be written as FSRs" );
    00026   declareProperty( "FSROptItemList", m_FSROptItemNames, "Optional  items to be written as FSRs" );
    00027 }
    00028
    00029 // Standard Destructor
    00030 OutputFSRStream::~OutputFSRStream()   {
    00031 }
    00032
    00033 StatusCode OutputFSRStream::stop() {
    00034   MsgStream log(msgSvc(), name());
    00035   log << MSG::INFO << "Set up File Summary Record" << endmsg;
    00036
    00037   // Clear last real event from TES, and prepare it to receive FSR objects
    00038   StatusCode sc = m_pDataManager->setRoot ("/Event", new DataObject());
    00039   if( !sc.isSuccess() )  {
    00040     log << MSG::WARNING << "Error declaring event root DataObject" << endmsg;
    00041   }
    00042   return OutputStream::stop();
    00043 }
    00044
    00045 StatusCode OutputFSRStream::finalize() {
    00046
    00047   MsgStream log(msgSvc(), name());
    00048
    00049   // Clear any previously existing item list
    00050   clearSelection();
    00051
    00052   // Clear the list with optional items
    00053   clearItems(m_optItemList);
    00054   // Clear the item list
    00055   clearItems(m_itemList);
    00056
    00057   ItemNames::iterator i;
    00058   // Take the new item list from the FSRItemList properties
    00059   for(i = m_FSRItemNames.begin(); i != m_FSRItemNames.end(); i++)   {
    00060     addItem( m_itemList, *i );
    00061   }
    00062   for(i = m_FSROptItemNames.begin(); i != m_FSROptItemNames.end(); i++)   {
    00063     addItem( m_optItemList, *i );
    00064   }
    00065
    00066   // And write them out
    00067   log << MSG::INFO << "Write File Summary Record" << endmsg;
    00068   StatusCode sc = writeObjects();
    00069   if( sc.isFailure() ) {
    00070     // Log the error, but don't fail finalize!
    00071     log << MSG::ERROR << "Unable to write File Summary Record" << endmsg;
    00072   }
    00073
    00074   return OutputStream::finalize();
    00075 }