| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

# EvtCollectionStream Class Reference

A small to stream Data I/O. More...

`#include <EvtCollectionStream.h>`

Inheritance diagram for EvtCollectionStream:

[legend]
Collaboration diagram for EvtCollectionStream:

[legend]

List of all members.

## Public Member Functions
virtual StatusCode | initialize ()
| Initialize EvtCollectionStream.
virtual StatusCode | finalize ()
| Terminate EvtCollectionStream.
virtual StatusCode | execute ()
| Working entry point.
## Protected Member Functions
| EvtCollectionStream (const std::string &name, ISvcLocator *pSvcLocator)
| Standard algorithm Constructor.
virtual | ~EvtCollectionStream ()
| Standard Destructor.
void | clearItems ()
| Clear item list.
void | addItem (const std::string &descriptor)
| Add item to output stramer list.
## Protected Attributes
SmartIF< INTupleSvc > | m_pTupleSvc
| Reference to Tuple service for event collection (may or may not be NTuple service).
std::string | m_storeName
| Name of the service managing the data store.
ItemNames | m_itemNames
| Vector of item names.
Items | m_itemList
| Vector of items to be saved to this stream.
## Private Types
typedef std::vector< std::string > | ItemNames
typedef std::vector < DataStoreItem * > | Items
## Friends
class | AlgFactory< EvtCollectionStream >
class | Factory< EvtCollectionStream, IAlgorithm *(std::string, ISvcLocator *)>

## Detailed Description

A small to stream Data I/O.

Author: M.Frank Version: 1.0

Definition at line 29 of file EvtCollectionStream.h.

## Member Typedef Documentation

typedef std::vector<std::string> EvtCollectionStream::ItemNames`[private]`

Definition at line 33 of file EvtCollectionStream.h.

typedef std::vector<DataStoreItem*> EvtCollectionStream::Items`[private]`

Definition at line 34 of file EvtCollectionStream.h.

## Constructor & Destructor Documentation

EvtCollectionStream::EvtCollectionStream | ( | const std::string & | name,
|  | ISvcLocator * | pSvcLocator |
| ) |  |  | `[protected]`

Standard algorithm Constructor.

Definition at line 25 of file EvtCollectionStream.cpp.

    00026 : Algorithm(name, pSvcLocator)
    00027 {
    00028   m_storeName = "TagCollectionSvc";
    00029   declareProperty("ItemList",   m_itemNames);
    00030   declareProperty("EvtDataSvc", m_storeName);
    00031 }

EvtCollectionStream::~EvtCollectionStream | ( |  | ) | `[protected, virtual]`

Standard Destructor.

Definition at line 34 of file EvtCollectionStream.cpp.

    00034                                             {
    00035 }

## Member Function Documentation

void EvtCollectionStream::clearItems | ( |  | ) | `[protected]`

Clear item list.

Definition at line 80 of file EvtCollectionStream.cpp.

    00080                                          {
    00081   for ( Items::iterator i = m_itemList.begin(); i != m_itemList.end(); i++ )    {
    00082     delete (*i);
    00083   }
    00084   m_itemList.erase(m_itemList.begin(), m_itemList.end());
    00085 }

void EvtCollectionStream::addItem | ( | const std::string & | descriptor | ) | `[protected]`

Add item to output stramer list.

Definition at line 88 of file EvtCollectionStream.cpp.

    00088                                                                {
    00089   MsgStream log(msgSvc(), name());
    00090   int sep = descriptor.rfind("#");
    00091   int level = 0;
    00092   std::string obj_path (descriptor,0,sep);
    00093   std::string slevel   (descriptor,sep+1,descriptor.length());
    00094   if ( slevel == "*" )  {
    00095     level = 9999999;
    00096   }
    00097   else   {
    00098     level = ::atoi(slevel.c_str());
    00099   }
    00100   DataStoreItem* item = new DataStoreItem(obj_path, level);
    00101   log << MSG::INFO << "Adding OutputStream item " << item->path()
    00102       << " with " << item->depth()
    00103       << " level(s)." << endmsg;
    00104   m_itemList.push_back( item );
    00105 }

StatusCode EvtCollectionStream::initialize | ( |  | ) | `[virtual]`

Initialize EvtCollectionStream.

Reimplemented from Algorithm.

Definition at line 38 of file EvtCollectionStream.cpp.

    00038                                            {
    00039   MsgStream log(msgSvc(), name());
    00040   // Use the Job options service to set the Algorithm's parameters
    00041   setProperties();
    00042   // Get access to the DataManagerSvc
    00043   m_pTupleSvc = serviceLocator()->service(m_storeName);
    00044   if( !m_pTupleSvc.isValid() ) {
    00045     log << MSG::FATAL << "Unable to locate IDataManagerSvc interface" << endmsg;
    00046     return StatusCode::FAILURE;
    00047   }
    00048   // Clear the item list
    00049   clearItems();
    00050   // Take the new item list from the properties.
    00051   for(ItemNames::iterator i = m_itemNames.begin(); i != m_itemNames.end(); i++)   {
    00052     addItem( *i );
    00053   }
    00054   log << MSG::INFO << "Data source:             " << m_storeName  << endmsg;
    00055   return StatusCode::SUCCESS;
    00056 }

StatusCode EvtCollectionStream::finalize | ( |  | ) | `[virtual]`

Terminate EvtCollectionStream.

Reimplemented from Algorithm.

Definition at line 59 of file EvtCollectionStream.cpp.

    00059                                             {
    00060   m_pTupleSvc = 0; // release
    00061   clearItems();
    00062   return StatusCode::SUCCESS;
    00063 }

StatusCode EvtCollectionStream::execute | ( |  | ) | `[virtual]`

Working entry point.

Definition at line 66 of file EvtCollectionStream.cpp.

    00066                                         {
    00067   StatusCode status = (m_pTupleSvc) ? StatusCode::SUCCESS : StatusCode::FAILURE;
    00068   if ( status.isSuccess() )   {
    00069     for ( Items::iterator i = m_itemList.begin(); i != m_itemList.end(); i++ )    {
    00070       StatusCode iret = m_pTupleSvc->writeRecord((*i)->path());
    00071       if ( !iret.isSuccess() )    {
    00072         status = iret;
    00073       }
    00074     }
    00075   }
    00076   return status;
    00077 }

## Friends And Related Function Documentation

friend class AlgFactory< EvtCollectionStream >`[friend]`

Definition at line 30 of file EvtCollectionStream.h.

friend class Factory< EvtCollectionStream, IAlgorithm *(std::string, ISvcLocator *)>`[friend]`

Definition at line 31 of file EvtCollectionStream.h.

## Member Data Documentation

SmartIF<INTupleSvc> EvtCollectionStream::m_pTupleSvc`[protected]`

Reference to Tuple service for event collection (may or may not be NTuple service).

Definition at line 37 of file EvtCollectionStream.h.

std::string EvtCollectionStream::m_storeName`[protected]`

Name of the service managing the data store.

Definition at line 39 of file EvtCollectionStream.h.

ItemNames EvtCollectionStream::m_itemNames`[protected]`

Vector of item names.

Definition at line 41 of file EvtCollectionStream.h.

Items EvtCollectionStream::m_itemList`[protected]`

Vector of items to be saved to this stream.

Definition at line 43 of file EvtCollectionStream.h.

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/GaudiSvc/src/PersistencySvc/EvtCollectionStream.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/GaudiSvc/src/PersistencySvc/EvtCollectionStream.cpp