Gaudi Framework, version v24r2

Home   Generated: Wed Dec 4 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TagCollectionStream Class Reference

Specialized output stream class for event tag collections, where the basic Event entry point should be placed as well into the collection itself. More...

#include <PersistencySvc/TagCollectionStream.h>

Inheritance diagram for TagCollectionStream:
Inheritance graph
[legend]
Collaboration diagram for TagCollectionStream:
Collaboration graph
[legend]

Public Member Functions

 TagCollectionStream (const std::string &name, ISvcLocator *pSvcLocator)
 Standard algorithm Constructor.
 
virtual ~TagCollectionStream ()
 Standard Destructor.
 
virtual StatusCode initialize ()
 Initialize TagCollectionStream.
 
virtual StatusCode finalize ()
 Terminate TagCollectionStream.
 
- Public Member Functions inherited from OutputStream
 OutputStream (const std::string &name, ISvcLocator *pSvcLocator)
 Standard algorithm Constructor.
 
virtual ~OutputStream ()
 Standard Destructor.
 
virtual StatusCode execute ()
 Working entry point.
 
virtual StatusCode connectConversionSvc ()
 
virtual bool collect (IRegistry *dir, int level)
 Store agent's classback.
 
virtual StatusCode collectObjects ()
 Collect all objects to be written to the output stream.
 
void clearItems (Items &itms)
 Clear item list.
 
void addItem (Items &itms, const std::string &descriptor)
 Add item to output streamer list.
 
void clearSelection ()
 Clear list of selected objects.
 
IDataSelectorselectedObjects ()
 Return the list of selected objects.
 
- Public Member Functions inherited from Algorithm
 Algorithm (const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
 Constructor.
 
virtual ~Algorithm ()
 Destructor.
 
virtual StatusCode sysStart ()
 Reinitialization method invoked by the framework.
 
virtual StatusCode sysInitialize ()
 Initialization method invoked by the framework.
 
virtual StatusCode sysReinitialize ()
 Reinitialization method invoked by the framework.
 
virtual StatusCode sysRestart ()
 Restart method invoked by the framework.
 
virtual StatusCode sysExecute ()
 The actions to be performed by the algorithm on an event.
 
virtual StatusCode sysStop ()
 System stop.
 
virtual StatusCode sysFinalize ()
 System finalization.
 
virtual StatusCode sysBeginRun ()
 beginRun method invoked by the framework.
 
virtual StatusCode sysEndRun ()
 endRun method invoked by the framework.
 
virtual const std::stringname () const
 The identifying name of the algorithm object.
 
virtual const std::stringversion () const
 
virtual StatusCode configure ()
 Dummy implementation of IStateful::configure() method.
 
virtual StatusCode terminate ()
 Dummy implementation of IStateful::terminate() method.
 
virtual StatusCode start ()
 the default (empty) implementation of IStateful::start() method
 
virtual StatusCode stop ()
 the default (empty) implementation of IStateful::stop() method
 
virtual StatusCode reinitialize ()
 the default (empty) implementation of IStateful::reinitialize() method
 
virtual StatusCode restart ()
 the default (empty) implementation of IStateful::restart() method
 
virtual bool isExecuted () const
 Has this algorithm been executed since the last reset?
 
virtual void setExecuted (bool state)
 Set the executed flag to the specified state.
 
virtual void resetExecuted ()
 Reset the executed state of the Algorithm for the duration of the current event.
 
virtual StatusCode beginRun ()
 Algorithm begin run.
 
virtual StatusCode endRun ()
 Algorithm end run. This method is called at the end of the event loop.
 
virtual Gaudi::StateMachine::State FSMState () const
 returns the current state of the algorithm
 
virtual Gaudi::StateMachine::State targetFSMState () const
 returns the state the algorithm will be in after the ongoing transition
 
virtual bool isEnabled () const
 Is this algorithm enabled or disabled?
 
virtual bool filterPassed () const
 Did this algorithm pass or fail its filter criterion for the last event?
 
virtual void setFilterPassed (bool state)
 Set the filter passed flag to the specified state.
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist.
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist.
 
SmartIF< IServiceservice (const std::string &name, const bool createIf=true, const bool quiet=false) const
 Return a pointer to the service identified by name (or "type/name")
 
void setOutputLevel (int level)
 Set the output level for current algorithm.
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
 
SmartIF< IChronoStatSvc > & chronoSvc () const
 The standard Chrono & Stat service, Return a pointer to the service if present.
 
SmartIF< IChronoStatSvc > & chronoStatService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IDataProviderSvc > & detSvc () const
 The standard detector data service.
 
SmartIF< IDataProviderSvc > & detDataService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IConversionSvc > & detCnvSvc () const
 The standard detector data persistency conversion service.
 
SmartIF< IConversionSvc > & detDataCnvService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IDataProviderSvc > & eventSvc () const
 The standard event data service.
 
SmartIF< IDataProviderSvc > & evtSvc () const
 shortcut for method eventSvc
 
SmartIF< IDataProviderSvc > & eventDataService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IConversionSvc > & eventCnvSvc () const
 The standard event data persistency conversion service.
 
SmartIF< IConversionSvc > & eventDataCnvService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IHistogramSvc > & histoSvc () const
 The standard histogram service.
 
SmartIF< IHistogramSvc > & histogramDataService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
SmartIF< IMessageSvc > & messageService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< INTupleSvc > & ntupleSvc () const
 The standard N tuple service.
 
SmartIF< INTupleSvc > & ntupleService () const
 Obsoleted name, kept due to the backwards compatibility.
 
SmartIF< IRndmGenSvc > & randSvc () const
 AIDA-based NTuple service Returns a pointer to the AIDATuple service if present.
 
SmartIF< IToolSvc > & toolSvc () const
 The standard ToolSvc service, Return a pointer to the service if present.
 
SmartIF< IExceptionSvc > & exceptionSvc () const
 Get the exception Service.
 
SmartIF< IAlgContextSvc > & contextSvc () const
 get Algorithm Context Service
 
SmartIF< ISvcLocator > & serviceLocator () const
 The standard service locator.
 
SmartIF< ISvcLocator > & svcLoc () const
 shortcut for method serviceLocator
 
bool registerContext () const
 register for Algorithm Context Service?
 
StatusCode createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg)
 Create a sub algorithm.
 
std::vector< Algorithm * > * subAlgorithms () const
 List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
 
virtual StatusCode setProperty (const Property &p)
 Implementation of IProperty::setProperty.
 
virtual StatusCode setProperty (const std::string &s)
 Implementation of IProperty::setProperty.
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Implementation of IProperty::setProperty.
 
virtual StatusCode getProperty (Property *p) const
 Implementation of IProperty::getProperty.
 
virtual const PropertygetProperty (const std::string &name) const
 Implementation of IProperty::getProperty.
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Implementation of IProperty::getProperty.
 
virtual const std::vector
< Property * > & 
getProperties () const
 Implementation of IProperty::getProperties.
 
StatusCode setProperties ()
 Set the algorithm's properties.
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property.
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties.
 
SmartIF< IMonitorSvc > & monitorSvc () const
 Access the monitor service.
 
template<class T >
void declareInfo (const std::string &name, const T &var, const std::string &desc) const
 Declare monitoring information.
 
void declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const
 Declare monitoring information (special case)
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 

Protected Member Functions

virtual StatusCode writeObjects ()
 OutputStream override: Select the different objects and write them to file.
 
virtual StatusCode connectAddress ()
 Connect address column, if not already connected.
 
StatusCode writeData ()
 Write data objects.
 
StatusCode writeTuple ()
 Write tuple data.
 
StatusCode writeRecord ()
 Write full event record.
 
- Protected Member Functions inherited from OutputStream
StatusCode decodeAcceptAlgs ()
 Decode list of Algorithms that this stream accepts.
 
void acceptAlgsHandler (Property &theProp)
 Handler for AcceptAlgs Property.
 
StatusCode decodeRequireAlgs ()
 Decode list of Algorithms that this stream requires.
 
void requireAlgsHandler (Property &theProp)
 Handler for RequireAlgs Property.
 
StatusCode decodeVetoAlgs ()
 Decode list of Algorithms that this stream is vetoed by.
 
void vetoAlgsHandler (Property &theProp)
 Handler for VetoAlgs Property.
 
StatusCode decodeAlgorithms (StringArrayProperty &theNames, std::vector< Algorithm * > *theAlgs)
 Decode specified list of Algorithms.
 
bool isEventAccepted () const
 Test whether this event should be output.
 
DataStoreItemfindItem (const std::string &path)
 Find single item identified by its path (exact match)
 
virtual bool hasInput () const
 Tell if the instance has been configured with input items or not.
 
- Protected Member Functions inherited from Algorithm
bool isInitialized () const
 Has the Algorithm already been initialized?
 
bool isFinalized () const
 Has the Algorithm already been finalized?
 
int outputLevel () const
 retrieve the Algorithm output level
 
IntegerPropertyoutputLevelProperty ()
 Accessor for the Message level property.
 
void initOutputLevel (Property &prop)
 callback for output level property
 

Protected Attributes

std::string m_addrLeaf
 Property: Name of the address leaf in the transient event store.
 
std::string m_addrColName
 Property: Name of the address column of the tag collection.
 
std::string m_tagName
 Property: Name of the tag collection in the transient store.
 
std::string m_collSvcName
 Property: Name of the collection service.
 
bool m_objectsFirst
 Property: Flag to indicate that the objects should be written first.
 
INTupleItemm_addrColumn
 NTuple column to hold the opaque address of the address leaf.
 
std::string m_topLeafName
 Name of the top leaf (performance cache)
 
bool m_isTopLeaf
 Short cut flag to indicate if the address leaf is the top leaf (performace cache)
 
INTupleSvcm_collectionSvc
 Keep reference to the tuple service.
 
GenericAddressm_addr
 Address buffer.
 
NTuple::Item< IOpaqueAddress * > m_item
 Address item buffer.
 
- Protected Attributes inherited from OutputStream
SmartIF< IIncidentSvcm_incidentSvc
 Reference to the indicent service.
 
bool m_doPreLoad
 Flag indicating wether data pre-loading should be performed.
 
bool m_doPreLoadOpt
 Flag indicating whether optional items should be preloaded.
 
bool m_verifyItems
 Flag to indicate that item consistency should be checked.
 
std::string m_storeName
 Name of the service managing the data store.
 
std::string m_persName
 Name of the persistency service capable to write data from the store.
 
std::string m_output
 Name of the output file specification.
 
std::string m_outputName
 Name of the output file.
 
std::string m_outputType
 Output type: NEW(NEW,CREATE,WRITE,RECREATE), UPDATE)
 
OutputStreamAgentm_agent
 Keep reference of agent.
 
SmartIF< IDataProviderSvcm_pDataProvider
 Keep reference to the data provider service.
 
SmartIF< IDataManagerSvcm_pDataManager
 Keep reference to the data manager service.
 
SmartIF< IConversionSvcm_pConversionSvc
 Keep reference to the data conversion service.
 
DataStoreItemm_currentItem
 Keep track of the current item.
 
ItemNames m_itemNames
 Vector of item names.
 
Items m_itemList
 Vector of items to be saved to this stream.
 
ItemNames m_optItemNames
 Vector of item names.
 
Items m_optItemList
 Vector of optional items to be saved to this stream.
 
IDataSelector m_objects
 Collection of objects being selected.
 
int m_events
 Number of events written to this output stream.
 
StringArrayProperty m_acceptNames
 Vector of names of Algorithms that this stream accepts.
 
StringArrayProperty m_requireNames
 Vector of names of Algorithms that this stream requires.
 
StringArrayProperty m_vetoNames
 Vector of names of Algorithms that this stream is vetoed by.
 
std::vector< Algorithm * > * m_acceptAlgs
 Vector of Algorithms that this stream accepts.
 
std::vector< Algorithm * > * m_requireAlgs
 Vector of Algorithms that this stream requires.
 
std::vector< Algorithm * > * m_vetoAlgs
 Vector of Algorithms that this stream is vetoed by.
 
bool m_fireIncidents
 should I fire incidents for writing opening/closing etc?
 

Additional Inherited Members

- Public Types inherited from OutputStream
typedef std::vector
< DataStoreItem * > 
Items
 
typedef std::vector< std::stringItemNames
 

Detailed Description

Specialized output stream class for event tag collections, where the basic Event entry point should be placed as well into the collection itself.

The TagCollectionStream is a rather specialized object combining features of NTuple I/O and object I/O. The main working points are:

1) Write a "normal" tag collection. The address column [property AddressColumn, default:"Address"] is added to the Ntuple identified by its name [mandatory property Collection]. The address column is set to the opaque address of the specified leaf [property "AddressLeaf", default:"/Event"]. The NTuple must be registered to the TES of the service [property: TagCollectionSvc, default:"NTupleSvc"]. This is the normal mode event tag collections work.

2) Write a tag collection with "REDIRECTED INPUT". Example: The collection is created from an intermediate file (MINI DST), but the Address column of the NTuple should point to the file e.g. containing the raw data.

Note: The actual address of "/Event" get changed. No other output should be created after writing such a tag collection.

3) Write an "EMBEDDED COLLECTION". In this mode the OutputStream and the NTuple stream are combined. depending on the property TagCollectionStream.ObjectsFirst the objects are written first and the the tags. The tag file and the file containing the objects may be identical.

Note:

Author: M.Frank Version: 1.0

Definition at line 63 of file TagCollectionStream.h.

Constructor & Destructor Documentation

TagCollectionStream::TagCollectionStream ( const std::string name,
ISvcLocator pSvcLocator 
)

Standard algorithm Constructor.

Definition at line 22 of file TagCollectionStream.cpp.

: OutputStream(nam, pSvc), m_addrColumn(0),
{
declareProperty("AddressLeaf", m_addrLeaf = "/Event" );
declareProperty("AddressColumn", m_addrColName = "Address");
declareProperty("TagCollectionSvc", m_collSvcName = "NTupleSvc");
declareProperty("ObjectsFirst", m_objectsFirst = true);
declareProperty("Collection", m_tagName );
}
TagCollectionStream::~TagCollectionStream ( )
virtual

Standard Destructor.

Definition at line 35 of file TagCollectionStream.cpp.

{
delete m_addr;
}

Member Function Documentation

StatusCode TagCollectionStream::connectAddress ( )
protectedvirtual

Connect address column, if not already connected.

Definition at line 40 of file TagCollectionStream.cpp.

{
if ( nt ) {
if ( 0 == m_addrColumn ) {
StatusCode sc = nt->addItem (m_addrColName,m_item);
if ( sc.isSuccess() ) {
m_addrColumn = m_item.operator->();
return sc;
}
log << MSG::ERROR << "Failed to add the address column:"
<< m_addrColName << " to the tag collection " << m_tagName
<< endmsg;
return sc;
}
}
log << MSG::ERROR << "Failed to connect to the tag collection "
}
StatusCode TagCollectionStream::finalize ( )
virtual

Terminate TagCollectionStream.

Reimplemented from OutputStream.

Definition at line 118 of file TagCollectionStream.cpp.

StatusCode TagCollectionStream::initialize ( )
virtual

Initialize TagCollectionStream.

Reimplemented from OutputStream.

Definition at line 64 of file TagCollectionStream.cpp.

{
std::string log_node, log_file, logical_name;
if ( sc.isSuccess() ) {
Tokenizer tok(true);
tok.analyse(m_output, " ", "", "", "=", "'", "'");
m_output = "";
for(Tokenizer::Items::iterator i = tok.items().begin(); i != tok.items().end(); ++i) {
const std::string& tag = (*i).tag();
const std::string& val = (*i).value();
switch( ::toupper(tag[0]) ) {
case 'C':
m_tagName = val;
break;
case 'A':
m_addrLeaf = val;
break;
default:
m_output += tag + "='" + val + "' ";
break;
}
}
log_node = m_tagName.substr(idx,m_tagName.find(SEPARATOR,idx+1));
log_file = log_node + " " + m_output + " SHARED='YES'";
}
m_addrColumn = 0; // reset pointer to item column
sc = OutputStream::initialize(); // Now initialize the base class
if ( sc.isSuccess() ) {
if ( src_mgr.isValid() ) {
if ( data_mgr.isValid() ) {
logical_name = data_mgr->rootName();
logical_name += SEPARATOR;
logical_name += log_node;
m_topLeafName = m_addrLeaf.substr(0,m_addrLeaf.find(SEPARATOR,m_addrLeaf[0]=='/' ? 1 : 0));
if ( src_mgr->isConnected(logical_name) ) {
return sc;
}
sc = src_mgr->connect(log_file);
if ( sc.isSuccess() ) {
return sc;
}
}
}
}
log << MSG::ERROR << "Failed to initialize TagCollection Stream." << endmsg;
}
StatusCode TagCollectionStream::writeData ( )
protected

Write data objects.

Definition at line 139 of file TagCollectionStream.cpp.

{
if ( !sc.isSuccess() ) {
log << MSG::ERROR << "Failed to write tag collection " << m_tagName << ". "
<< "[Object write error]" << endmsg;
}
return sc;
}
StatusCode TagCollectionStream::writeObjects ( )
protectedvirtual

OutputStream override: Select the different objects and write them to file.

Reimplemented from OutputStream.

Definition at line 158 of file TagCollectionStream.cpp.

{
if ( status.isSuccess() ) {
if ( status.isSuccess() ) {
if ( !m_addrColName.empty() ) {
if ( top != 0 ) {
IOpaqueAddress* pA = top->registry()->address();
if ( pA != 0 ) {
unsigned long* ipar = (unsigned long*)m_addr->ipar();
m_addr->setClID(pA->clID());
par[0] = pA->par()[0];
par[1] = pA->par()[1];
ipar[0] = pA->ipar()[0];
ipar[1] = pA->ipar()[1];
if ( m_isTopLeaf ) {
return writeRecord();
}
// Handle redirection mode. Normal tag collection mode
// is the same like leaving this out....
if ( 0 != leaf ) {
IOpaqueAddress* redir = leaf->registry()->address();
if ( redir ) {
par[0] = redir->par()[0];
ipar[0] = ~0x0;
ipar[1] = redir->ipar()[1];
return writeRecord();
}
MsgStream log3(msgSvc(), name());
log3 << MSG::ERROR << "Failed to write tag collection " << m_tagName << ". "
<< m_addrLeaf << "'s address not found." << endmsg;
}
log2 << MSG::ERROR << "Failed to write tag collection " << m_tagName << ". "
<< m_addrLeaf << " not found." << endmsg;
}
MsgStream log1(msgSvc(), name());
log1 << MSG::ERROR << "Failed to write tag collection " << m_tagName << ". "
<< m_topLeafName << "'s address not found." << endmsg;
}
MsgStream log0(msgSvc(), name());
log0 << MSG::ERROR << "Failed to write tag collection " << m_tagName << ". "
<< m_topLeafName << " not found." << endmsg;
}
}
}
return status;
}
StatusCode TagCollectionStream::writeRecord ( )
protected

Write full event record.

Definition at line 150 of file TagCollectionStream.cpp.

{
if ( writeTuple().isSuccess() ) {
}
}
StatusCode TagCollectionStream::writeTuple ( )
protected

Write tuple data.

Definition at line 128 of file TagCollectionStream.cpp.

{
if ( !sc.isSuccess() ) {
log << MSG::ERROR << "Failed to write tag collection " << m_tagName << ". "
<< "[Tuple write error]" << endmsg;
}
return sc;
}

Member Data Documentation

GenericAddress* TagCollectionStream::m_addr
protected

Address buffer.

Definition at line 85 of file TagCollectionStream.h.

std::string TagCollectionStream::m_addrColName
protected

Property: Name of the address column of the tag collection.

Definition at line 69 of file TagCollectionStream.h.

INTupleItem* TagCollectionStream::m_addrColumn
protected

NTuple column to hold the opaque address of the address leaf.

Definition at line 77 of file TagCollectionStream.h.

std::string TagCollectionStream::m_addrLeaf
protected

Property: Name of the address leaf in the transient event store.

Definition at line 67 of file TagCollectionStream.h.

INTupleSvc* TagCollectionStream::m_collectionSvc
protected

Keep reference to the tuple service.

Definition at line 83 of file TagCollectionStream.h.

std::string TagCollectionStream::m_collSvcName
protected

Property: Name of the collection service.

Definition at line 73 of file TagCollectionStream.h.

bool TagCollectionStream::m_isTopLeaf
protected

Short cut flag to indicate if the address leaf is the top leaf (performace cache)

Definition at line 81 of file TagCollectionStream.h.

NTuple::Item<IOpaqueAddress*> TagCollectionStream::m_item
protected

Address item buffer.

Definition at line 87 of file TagCollectionStream.h.

bool TagCollectionStream::m_objectsFirst
protected

Property: Flag to indicate that the objects should be written first.

Definition at line 75 of file TagCollectionStream.h.

std::string TagCollectionStream::m_tagName
protected

Property: Name of the tag collection in the transient store.

Definition at line 71 of file TagCollectionStream.h.

std::string TagCollectionStream::m_topLeafName
protected

Name of the top leaf (performance cache)

Definition at line 79 of file TagCollectionStream.h.


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

Generated at Wed Dec 4 2013 14:33:19 for Gaudi Framework, version v24r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004