| # Gaudi Framework, version v23r1 |

Home |  | Generated: Wed Feb 29 2012

Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Friends

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

    : Algorithm(name, pSvcLocator)
    {
      m_storeName = "TagCollectionSvc";
      declareProperty("ItemList",   m_itemNames);
      declareProperty("EvtDataSvc", m_storeName);
    }

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

Standard Destructor.

Definition at line 34 of file EvtCollectionStream.cpp.

                                                {
    }

## Member Function Documentation

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

Add item to output stramer list.

Definition at line 88 of file EvtCollectionStream.cpp.

                                                                   {
      MsgStream log(msgSvc(), name());
      int sep = descriptor.rfind("#");
      int level = 0;
      std::string obj_path (descriptor,0,sep);
      std::string slevel   (descriptor,sep+1,descriptor.length());
      if ( slevel == "*" )  {
        level = 9999999;
      }
      else   {
        level = ::atoi(slevel.c_str());
      }
      DataStoreItem* item = new DataStoreItem(obj_path, level);
      log << MSG::INFO << "Adding OutputStream item " << item->path()
          << " with " << item->depth()
          << " level(s)." << endmsg;
      m_itemList.push_back( item );
    }

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

Clear item list.

Definition at line 80 of file EvtCollectionStream.cpp.

                                             {
      for ( Items::iterator i = m_itemList.begin(); i != m_itemList.end(); i++ )    {
        delete (*i);
      }
      m_itemList.erase(m_itemList.begin(), m_itemList.end());
    }

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

Working entry point.

Definition at line 66 of file EvtCollectionStream.cpp.

                                            {
      StatusCode status = (m_pTupleSvc) ? StatusCode::SUCCESS : StatusCode::FAILURE;
      if ( status.isSuccess() )   {
        for ( Items::iterator i = m_itemList.begin(); i != m_itemList.end(); i++ )    {
          StatusCode iret = m_pTupleSvc->writeRecord((*i)->path());
          if ( !iret.isSuccess() )    {
            status = iret;
          }
        }
      }
      return status;
    }

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

Terminate EvtCollectionStream.

Reimplemented from Algorithm.

Definition at line 59 of file EvtCollectionStream.cpp.

                                                {
      m_pTupleSvc = 0; // release
      clearItems();
      return StatusCode::SUCCESS;
    }

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

Initialize EvtCollectionStream.

Reimplemented from Algorithm.

Definition at line 38 of file EvtCollectionStream.cpp.

                                               {
      MsgStream log(msgSvc(), name());
      // Use the Job options service to set the Algorithm's parameters
      setProperties();
      // Get access to the DataManagerSvc
      m_pTupleSvc = serviceLocator()->service(m_storeName);
      if( !m_pTupleSvc.isValid() ) {
        log << MSG::FATAL << "Unable to locate IDataManagerSvc interface" << endmsg;
        return StatusCode::FAILURE;
      }
      // Clear the item list
      clearItems();
      // Take the new item list from the properties.
      for(ItemNames::iterator i = m_itemNames.begin(); i != m_itemNames.end(); i++)   {
        addItem( *i );
      }
      log << MSG::INFO << "Data source:             " << m_storeName  << endmsg;
      return StatusCode::SUCCESS;
    }

## 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

Items EvtCollectionStream::m_itemList`[protected]`

Vector of items to be saved to this stream.

Definition at line 43 of file EvtCollectionStream.h.

ItemNames EvtCollectionStream::m_itemNames`[protected]`

Vector of item names.

Definition at line 41 of file EvtCollectionStream.h.

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.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r1/GaudiCommonSvc/src/PersistencySvc/EvtCollectionStream.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r1/GaudiCommonSvc/src/PersistencySvc/EvtCollectionStream.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines