Gaudi Framework, version v25r2

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

NTuple service. More...

#include <NTupleSvc.h>

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

Classes

struct  Connection
 

Public Member Functions

virtual StatusCode initialize ()
 DataSvc overrides: Initialize the service.
 
virtual StatusCode reinitialize ()
 DataSvc overrides: reinitialize service.
 
virtual StatusCode finalize ()
 DataSvc overrides: stop the service.
 
virtual IConversionSvcgetDataLoader (IRegistry *pReg)
 DataSvc overrides: Retrieve data loader.
 
virtual NTuple::DirectorycreateDirectory (DataObject *pParent, const std::string &title)
 Create Ntuple directory and register it with the data store.
 
virtual NTuple::DirectorycreateDirectory (DataObject *pParent, long id)
 Create Ntuple directory and register it with the data store.
 
virtual NTuple::DirectorycreateDirectory (const std::string &dirPath, long id)
 Create Ntuple directory and register it with the data store.
 
virtual NTuple::DirectorycreateDirectory (const std::string &dirPath, const std::string &title)
 Create Ntuple directory and register it with the data store.
 
virtual NTuple::DirectorycreateDirectory (const std::string &fullPath)
 Create Ntuple directory and register it with the data store.
 
virtual StatusCode create (const CLID &typ, const std::string &title, NTuple::Tuple *&refpTuple)
 Create requested N tuple (Hide constructor)
 
virtual NTuple::Tuplebook (const std::string &fullPath, const CLID &type, const std::string &title)
 Book Ntuple and register it with the data store.
 
virtual NTuple::Tuplebook (const std::string &dirPath, const std::string &relPath, const CLID &type, const std::string &title)
 Book Ntuple and register it with the data store.
 
virtual NTuple::Tuplebook (const std::string &dirPath, long id, const CLID &type, const std::string &title)
 Book Ntuple and register it with the data store.
 
virtual NTuple::Tuplebook (DataObject *pParent, const std::string &relPath, const CLID &type, const std::string &title)
 Book Ntuple and register it with the data store.
 
virtual NTuple::Tuplebook (DataObject *pParent, long id, const CLID &type, const std::string &title)
 Book Ntuple and register it with the data store.
 
virtual NTuple::Tupleaccess (const std::string &fullPath, const std::string &filename)
 Access N tuple on disk.
 
virtual StatusCode save (const std::string &fullPath)
 Save N tuple to disk. Must be called in order to close the ntuple file properly.
 
virtual StatusCode save (NTuple::Tuple *tuple)
 Save N tuple to disk. Must be called in order to close the ntuple file properly.
 
virtual StatusCode save (DataObject *pParent, const std::string &relPath)
 Save N tuple to disk. Must be called in order to close the ntuple file properly.
 
virtual StatusCode writeRecord (NTuple::Tuple *tuple)
 Write single record to N tuple.
 
virtual StatusCode writeRecord (const std::string &fullPath)
 Write single record to N tuple.
 
virtual StatusCode writeRecord (DataObject *pParent, const std::string &relPath)
 Write single record to N tuple.
 
virtual StatusCode readRecord (NTuple::Tuple *tuple)
 Read single record from N tuple.
 
virtual StatusCode readRecord (const std::string &fullPath)
 Read single record from N tuple.
 
virtual StatusCode readRecord (DataObject *pParent, const std::string &relPath)
 Read single record from N tuple.
 
virtual bool isConnected (const std::string &identifier) const
 Check if a datasource is connected.
 
virtual StatusCode connect (const std::string &ident)
 Add file to list I/O list.
 
virtual StatusCode connect (const std::string &ident, std::string &logname)
 Add file to list I/O list.
 
virtual StatusCode disconnect (const std::string &nam)
 Close open connection.
 
virtual StatusCode disconnectAll ()
 Close all open connections.
 
 NTupleSvc (const std::string &name, ISvcLocator *svc)
 Standard Constructor.
 
virtual ~NTupleSvc ()
 Standard Destructor.
 
- Public Member Functions inherited from extends2< DataSvc, INTupleSvc, IDataSourceMgr >
 extends2 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments.
 
 extends2 (A1 a1, A2 a2)
 Templated constructor with 2 arguments.
 
 extends2 (A1 a1)
 Templated constructor with 1 argument.
 
 extends2 ()
 Default constructor.
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast.
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface.
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames.
 
virtual ~extends2 ()
 Virtual destructor.
 
- Public Member Functions inherited from DataSvc
virtual CLID rootCLID () const
 IDataManagerSvc: Accessor for root event CLID.
 
virtual std::string rootName () const
 IDataManagerSvc: Accessor for root event name.
 
virtual StatusCode registerAddress (const std::string &fullPath, IOpaqueAddress *pAddress)
 IDataManagerSvc: Register object address with the data store.
 
virtual StatusCode registerAddress (DataObject *parentObj, const std::string &objectPath, IOpaqueAddress *pAddress)
 IDataManagerSvc: Register object address with the data store.
 
virtual StatusCode registerAddress (IRegistry *parentObj, const std::string &objectPath, IOpaqueAddress *pAddress)
 IDataManagerSvc: Register object address with the data store.
 
virtual StatusCode unregisterAddress (const std::string &fullPath)
 IDataManagerSvc: Unregister object address from the data store.
 
virtual StatusCode unregisterAddress (DataObject *pParent, const std::string &objPath)
 IDataManagerSvc: Unregister object address from the data store.
 
virtual StatusCode unregisterAddress (IRegistry *pParent, const std::string &objPath)
 IDataManagerSvc: Unregister object address from the data store.
 
virtual StatusCode objectLeaves (const DataObject *pObject, std::vector< IRegistry * > &refLeaves)
 IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
 
virtual StatusCode objectLeaves (const IRegistry *pRegistry, std::vector< IRegistry * > &refLeaves)
 IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
 
virtual StatusCode objectParent (const DataObject *pObject, IRegistry *&refpParent)
 IDataManagerSvc: Explore the object store: retrieve the object's parent.
 
virtual StatusCode objectParent (const IRegistry *pRegistry, IRegistry *&refpParent)
 IDataManagerSvc: Explore the object store: retrieve the object's parent.
 
virtual StatusCode clearSubTree (const std::string &sub_tree_path)
 IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name.
 
virtual StatusCode clearSubTree (DataObject *pObject)
 IDataManagerSvc: Remove all data objects below the sub tree identified by the object.
 
virtual StatusCode clearStore ()
 IDataManagerSvc: Remove all data objects in the data store.
 
virtual StatusCode traverseSubTree (const std::string &sub_tree_path, IDataStoreAgent *pAgent)
 IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full path name.
 
virtual StatusCode traverseSubTree (DataObject *pObject, IDataStoreAgent *pAgent)
 IDataManagerSvc: Analyze by traversing all data objects below the sub tree.
 
virtual StatusCode traverseTree (IDataStoreAgent *pAgent)
 IDataManagerSvc: Analyze by traversing all data objects in the data store.
 
virtual StatusCode setRoot (const std::string &root_name, DataObject *pRootObj)
 Initialize data store for new event by giving new event path and root object.
 
virtual StatusCode i_setRoot (const std::string &root_name, DataObject *pRootObj)
 Initialize data store for new event by giving new event path and root object.
 
virtual StatusCode setRoot (const std::string &root_path, IOpaqueAddress *pRootAddr)
 Initialize data store for new event by giving new event path and address of root object.
 
virtual StatusCode i_setRoot (const std::string &root_path, IOpaqueAddress *pRootAddr)
 Initialize data store for new event by giving new event path and address of root object.
 
virtual StatusCode setDataLoader (IConversionSvc *svc)
 IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service.
 
virtual StatusCode addPreLoadItem (const DataStoreItem &item)
 Add an item to the preload list.
 
virtual StatusCode addPreLoadItem (const std::string &itemPath)
 Add an item to the preload list.
 
virtual StatusCode removePreLoadItem (const DataStoreItem &item)
 Remove an item from the preload list.
 
virtual StatusCode removePreLoadItem (const std::string &itemPath)
 Add an item to the preload list.
 
virtual StatusCode resetPreLoad ()
 Clear the preload list.
 
virtual StatusCode preLoad (int depth, int load_depth, DataObject *pObject)
 Execute one level of preloading and recursively load until the final level is reached.
 
virtual StatusCode preLoad ()
 load all preload items of the list
 
virtual StatusCode registerObject (const std::string &fullPath, DataObject *pObject)
 Register object with the data store.
 
virtual StatusCode registerObject (const std::string &parentPath, const std::string &objPath, DataObject *pObject)
 Register object with the data store.
 
virtual StatusCode registerObject (const std::string &parentPath, int item, DataObject *pObject)
 Register object with the data store.
 
virtual StatusCode registerObject (DataObject *parentObj, const std::string &objPath, DataObject *pObject)
 Register object with the data store.
 
virtual StatusCode registerObject (DataObject *parentObj, int item, DataObject *pObject)
 Register object with the data store.
 
virtual StatusCode unregisterObject (const std::string &fullPath)
 Unregister object from the data store.
 
virtual StatusCode unregisterObject (const std::string &parentPath, const std::string &objectPath)
 Unregister object from the data store.
 
virtual StatusCode unregisterObject (const std::string &parentPath, int item)
 Unregister object from the data store.
 
virtual StatusCode unregisterObject (DataObject *pObject)
 Unregister object from the data store.
 
virtual StatusCode unregisterObject (DataObject *pObject, const std::string &objectPath)
 Unregister object from the data store.
 
virtual StatusCode unregisterObject (DataObject *pObject, int item)
 Unregister object from the data store.
 
virtual StatusCode retrieveObject (IRegistry *pDirectory, const std::string &path, DataObject *&pObject)
 Retrieve object from data store.
 
virtual StatusCode retrieveObject (const std::string &fullPath, DataObject *&pObject)
 Retrieve object identified by its full path from the data store.
 
virtual StatusCode retrieveObject (const std::string &parentPath, const std::string &objPath, DataObject *&pObject)
 Retrieve object from data store.
 
virtual StatusCode retrieveObject (const std::string &parentPath, int item, DataObject *&pObject)
 Retrieve object from data store.
 
virtual StatusCode retrieveObject (DataObject *parentObj, const std::string &objPath, DataObject *&pObject)
 Retrieve object from data store.
 
virtual StatusCode retrieveObject (DataObject *parentObj, int item, DataObject *&pObject)
 Retrieve object from data store.
 
virtual StatusCode findObject (const std::string &fullPath, DataObject *&pObject)
 Find object identified by its full path in the data store.
 
virtual StatusCode findObject (IRegistry *pDirectory, const std::string &path, DataObject *&pObject)
 Find object identified by its full path in the data store.
 
virtual StatusCode findObject (const std::string &parentPath, const std::string &objPath, DataObject *&pObject)
 Find object in the data store.
 
virtual StatusCode findObject (const std::string &parentPath, int item, DataObject *&pObject)
 Find object in the data store.
 
virtual StatusCode findObject (DataObject *parentObj, const std::string &objPath, DataObject *&pObject)
 Find object in the data store.
 
virtual StatusCode findObject (DataObject *parentObj, int item, DataObject *&pObject)
 Find object in the data store.
 
virtual StatusCode linkObject (IRegistry *from, const std::string &objPath, DataObject *to)
 Add a link to another object.
 
virtual StatusCode linkObject (const std::string &fromPath, const std::string &objPath, DataObject *to)
 Add a link to another object.
 
virtual StatusCode linkObject (DataObject *from, const std::string &objPath, DataObject *to)
 Add a link to another object.
 
virtual StatusCode linkObject (const std::string &fullPath, DataObject *to)
 Add a link to another object.
 
virtual StatusCode unlinkObject (IRegistry *from, const std::string &objPath)
 Remove a link to another object.
 
virtual StatusCode unlinkObject (const std::string &fromPath, const std::string &objPath)
 Remove a link to another object.
 
virtual StatusCode unlinkObject (DataObject *fromObj, const std::string &objPath)
 Remove a link to another object.
 
virtual StatusCode unlinkObject (const std::string &fullPath)
 Remove a link to another object.
 
virtual StatusCode updateObject (IRegistry *pDirectory)
 Update object identified by its directory entry.
 
virtual StatusCode updateObject (const std::string &updatePath)
 Update object.
 
virtual StatusCode updateObject (DataObject *toUpdate)
 Update object.
 
virtual StatusCode updateObject (const std::string &parentPath, const std::string &updatePath)
 Update object.
 
virtual StatusCode updateObject (DataObject *pParent, const std::string &updatePath)
 Update object.
 
 DataSvc (const std::string &name, ISvcLocator *svc)
 Standard Constructor.
 
virtual ~DataSvc ()
 Standard Destructor.
 
- Public Member Functions inherited from extends2< Service, IDataProviderSvc, IDataManagerSvc >
 extends2 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments.
 
 extends2 (A1 a1, A2 a2)
 Templated constructor with 2 arguments.
 
 extends2 (A1 a1)
 Templated constructor with 1 argument.
 
 extends2 ()
 Default constructor.
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance.
 
virtual const std::string & name () const
 Retrieve name of the service.
 
virtual StatusCode configure ()
 
virtual StatusCode start ()
 
virtual StatusCode stop ()
 
virtual StatusCode terminate ()
 
virtual Gaudi::StateMachine::State FSMState () const
 
virtual Gaudi::StateMachine::State targetFSMState () const
 
virtual StatusCode restart ()
 
virtual StatusCode sysInitialize ()
 Initialize Service.
 
virtual StatusCode sysStart ()
 Initialize Service.
 
virtual StatusCode sysStop ()
 Initialize Service.
 
virtual StatusCode sysFinalize ()
 Finalize Service.
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service.
 
virtual StatusCode sysRestart ()
 Re-initialize the Service.
 
virtual StatusCode setProperty (const Property &p)
 
virtual StatusCode setProperty (const std::string &s)
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 
virtual StatusCode getProperty (Property *p) const
 
virtual const PropertygetProperty (const std::string &name) const
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 
virtual const std::vector
< Property * > & 
getProperties () const
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor.
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator.
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job.
 
template<class T >
StatusCode service (const std::string &name, const 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 &name, T *&psvc, bool createIf=true) const
 
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.
 
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< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
 
- Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments.
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments.
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument.
 
 CommonMessaging ()
 Default constructor.
 
virtual ~CommonMessaging ()
 Virtual destructor.
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream.
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS)
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL)
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING)
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO)
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG)
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE)
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO)
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream
 
- Public Member Functions inherited from extend_interfaces2< I1, I2 >
virtual ~extend_interfaces2 ()
 Virtual destructor.
 

Protected Types

typedef std::vector< std::string > DBaseEntries
 
typedef std::map< std::string,
Connection
Connections
 
typedef std::pair< std::string,
std::string > 
Prop
 

Protected Member Functions

StatusCode createService (const std::string &nam, const std::string &typ, const std::vector< Prop > &props, IConversionSvc *&pSvc)
 Create conversion service.
 
void releaseConnection (Connection &c)
 Finalize single service.
 
StatusCode attachTuple (const std::string &filename, const std::string &logname, const char typ, const long t)
 Attach output/input file.
 
StatusCode updateDirectories ()
 Update directory data.
 

Protected Attributes

DBaseEntries m_output
 Output streams.
 
DBaseEntries m_input
 Input streams.
 
Connections m_connections
 Container of connection points.
 

Additional Inherited Members

- Public Types inherited from extends2< DataSvc, INTupleSvc, IDataSourceMgr >
typedef extends2 base_class
 Typedef to this class.
 
typedef extend_interfaces2
< INTupleSvc, IDataSourceMgr
extend_interfaces_base
 Typedef to the base of this class.
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces.
 

Detailed Description

NTuple service.

See the Interface definition files for more detailed documentation of the implementing class. Base class: Gaudi/DataSvc/DataSvc.h Generic N tuple service interface: Gaudi/Interfaces/INTupleSvc.h Generic IAddressCreator interface: Gaudi/Interfaces/IAddressCreator.h Generic IConversionSvc interface: Gaudi/Interfaces/IConversionSvc.h

Author
M.Frank

Definition at line 25 of file NTupleSvc.h.

Member Typedef Documentation

typedef std::map<std::string, Connection> NTupleSvc::Connections
protected

Definition at line 35 of file NTupleSvc.h.

typedef std::vector< std::string > NTupleSvc::DBaseEntries
protected

Definition at line 34 of file NTupleSvc.h.

typedef std::pair<std::string,std::string> NTupleSvc::Prop
protected

Definition at line 36 of file NTupleSvc.h.

Constructor & Destructor Documentation

NTupleSvc::NTupleSvc ( const std::string &  name,
ISvcLocator svc 
)

Standard Constructor.

Definition at line 62 of file NTupleSvc.cpp.

NTupleSvc::~NTupleSvc ( )
virtual

Standard Destructor.

Definition at line 72 of file NTupleSvc.cpp.

{
}

Member Function Documentation

NTuple::Tuple * NTupleSvc::access ( const std::string &  fullPath,
const std::string &  filename 
)
virtual

Access N tuple on disk.

Definition at line 561 of file NTupleSvc.cpp.

{
return 0;
}
StatusCode NTupleSvc::attachTuple ( const std::string &  filename,
const std::string &  logname,
const char  typ,
const long  t 
)
protected

Attach output/input file.

Definition at line 494 of file NTupleSvc.cpp.

{
// First get the root object
if ( status.isSuccess() ) {
// Now add the registry entry to the store
std::string entryname = m_rootName;
entryname += '/';
entryname += logname;
new GenericAddress(t, CLID_NTupleFile, filename, entryname, 0, typ);
status = registerAddress(p, logname, pA);
if ( status.isSuccess() ) {
log << MSG::INFO << "Added stream file:" << filename << " as " << logname << endmsg;
return status;
}
pA->release();
}
log << MSG::ERROR << "Cannot add file:" << filename << " as " << logname << endmsg;
return status;
}
NTuple::Tuple * NTupleSvc::book ( const std::string &  fullPath,
const CLID type,
const std::string &  title 
)
virtual

Book Ntuple and register it with the data store.

Definition at line 387 of file NTupleSvc.cpp.

{
DataObject* pObj = 0;
std::string path = fullPath;
if ( path[0] != SEPARATOR ) {
path = m_rootName;
path += SEPARATOR;
path += fullPath;
}
StatusCode status = retrieveObject(path, pObj);
if ( !status.isSuccess() ) {
int sep = path.rfind(SEPARATOR);
if ( sep > 0 ) {
std::string p_path (path, 0, sep);
std::string o_path (path, sep, path.length());
DataObject* dir = createDirectory(p_path);
if ( 0 != dir ) {
NTuple::Tuple* tup = book( dir, o_path, type, title);
if ( 0 == tup ) {
log << MSG::ERROR << "Cannot book N-tuple " << path << " (Unknown reason)" << endmsg;
}
return tup;
}
log << MSG::ERROR << "Cannot book N-tuple " << path << " (Invalid parent directory)" << endmsg;
return 0;
}
log << MSG::ERROR << "Cannot book N-tuple " << path << " (Invalid path)" << endmsg;
return 0;
}
log << MSG::ERROR << "Cannot book N-tuple " << path << " (Exists already)" << endmsg;
return 0;
}
NTuple::Tuple * NTupleSvc::book ( const std::string &  dirPath,
const std::string &  relPath,
const CLID type,
const std::string &  title 
)
virtual

Book Ntuple and register it with the data store.

Definition at line 421 of file NTupleSvc.cpp.

{
std::string full = dirPath;
if (relPath[0] != SEPARATOR) full += SEPARATOR;
full += relPath;
return book(full, type, title);
}
NTuple::Tuple * NTupleSvc::book ( const std::string &  dirPath,
long  id,
const CLID type,
const std::string &  title 
)
virtual

Book Ntuple and register it with the data store.

Definition at line 429 of file NTupleSvc.cpp.

{
return book( dirPath, toStr(id), type, title);
}
NTuple::Tuple * NTupleSvc::book ( DataObject pParent,
const std::string &  relPath,
const CLID type,
const std::string &  title 
)
virtual

Book Ntuple and register it with the data store.

Definition at line 434 of file NTupleSvc.cpp.

{
NTuple::Tuple* pObj = 0;
// Check if object is already present
StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj));
// No ? Then create it!
if ( !status.isSuccess() ) {
status = create( type, title, pObj);
if ( status.isSuccess() ) {
// Finally register the created N tuple with the store
status = registerObject(pParent, relPath, pObj);
if ( status.isSuccess() ) {
return pObj;
}
pObj->release();
}
}
return 0;
}
NTuple::Tuple * NTupleSvc::book ( DataObject pParent,
long  id,
const CLID type,
const std::string &  title 
)
virtual

Book Ntuple and register it with the data store.

Definition at line 454 of file NTupleSvc.cpp.

{
return book( pParent, toStr(id), type, title);
}
StatusCode NTupleSvc::connect ( const std::string &  ident)
virtual

Add file to list I/O list.

Definition at line 225 of file NTupleSvc.cpp.

{
std::string logName;
return connect(ident, logName);
}
StatusCode NTupleSvc::connect ( const std::string &  ident,
std::string &  logname 
)
virtual

Add file to list I/O list.

Reimplemented in TagCollectionSvc.

Definition at line 230 of file NTupleSvc.cpp.

{
DataObject* pO = 0;
if ( status.isSuccess() ) {
char typ=0;
Tokenizer tok(true);
std::vector<Prop> props;
long loc = ident.find(" ");
std::string filename, auth, svc = "", db_typ = "";
logname = ident.substr(0,loc);
tok.analyse(ident.substr(loc+1,ident.length()), " ", "", "", "=", "'", "'");
for ( Tokenizer::Items::iterator i = tok.items().begin(); i != tok.items().end(); ++i) {
const std::string& tag = (*i).tag();
switch( ::toupper(tag[0]) ) {
case 'A':
break;
case 'F': // FILE='<file name>'
case 'D': // DATAFILE='<file name>'
filename = (*i).value();
break;
case 'O': // OPT='<NEW<CREATE,WRITE>, UPDATE, READ>'
switch( ::toupper((*i).value()[0]) ) {
case 'C':
case 'N':
case 'W':
typ = 'N';
break;
case 'U':
typ = 'U';
break;
case 'O':
case 'R':
typ = 'O';
break;
default:
typ = 0;
break;
}
break;
case 'T': // TYP='<HBOOK,ROOT,OBJY,...>'
db_typ = (*i).value();
break;
default:
props.push_back( Prop((*i).tag(), (*i).value()));
break;
}
}
if ( 0 != typ ) {
IConversionSvc* pSvc = 0;
status = createService(name()+'.'+logname, db_typ, props, pSvc);
if ( status.isSuccess() ) {
status = attachTuple(filename, logname, typ, pSvc->repSvcType());
if ( status.isSuccess() ) {
m_connections.insert(Connections::value_type(m_rootName+'/'+logname,Connection(pSvc)));
}
}
}
}
log << MSG::ERROR << "Cannot add " << ident << " invalid filename!" << endmsg;
}
StatusCode NTupleSvc::create ( const CLID typ,
const std::string &  title,
NTuple::Tuple *&  refpTuple 
)
virtual

Create requested N tuple (Hide constructor)

Eventually allow loading through factory?

Definition at line 366 of file NTupleSvc.cpp.

{
NTuple::TupleImp* pTuple = 0;
if ( typ == CLID_ColumnWiseTuple ) {
pTuple = new NTuple::ColumnWiseTuple( title );
}
else if ( typ == CLID_RowWiseTuple ) {
pTuple = new NTuple::RowWiseTuple( title );
}
else {
}
if ( 0 != pTuple ) {
pTuple->setTupleService(this);
}
refpTuple = pTuple;
return status;
}
NTuple::Directory * NTupleSvc::createDirectory ( DataObject pParent,
const std::string &  title 
)
virtual

Create Ntuple directory and register it with the data store.

Definition at line 462 of file NTupleSvc.cpp.

{
if ( 0 != pParent ) {
IRegistry* pDir = pParent->registry();
if ( 0 != pDir ) {
std::string full = pDir->identifier();
full += (relPath[0]=='/') ? "" : "/";
full += relPath;
return createDirectory(full);
}
}
return 0;
}
NTuple::Directory * NTupleSvc::createDirectory ( DataObject pParent,
long  id 
)
virtual

Create Ntuple directory and register it with the data store.

Definition at line 477 of file NTupleSvc.cpp.

{
return createDirectory( pParent, toStr(id) );
}
NTuple::Directory * NTupleSvc::createDirectory ( const std::string &  dirPath,
long  id 
)
virtual

Create Ntuple directory and register it with the data store.

Definition at line 482 of file NTupleSvc.cpp.

{
return createDirectory( dirPath, toStr(id) );
}
NTuple::Directory * NTupleSvc::createDirectory ( const std::string &  dirPath,
const std::string &  title 
)
virtual

Create Ntuple directory and register it with the data store.

Definition at line 487 of file NTupleSvc.cpp.

{
std::string full = dirPath;
full += (relPath[0]=='/') ? "" : "/";
full += relPath;
return createDirectory(full);
}
NTuple::Directory * NTupleSvc::createDirectory ( const std::string &  fullPath)
virtual

Create Ntuple directory and register it with the data store.

Definition at line 518 of file NTupleSvc.cpp.

{
StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&p));
if ( !status.isSuccess() ) {
int sep2 = fullPath.rfind(SEPARATOR);
if ( sep2 > 0 ) {
std::string relPath = fullPath.substr(0, sep2);
p = createDirectory(relPath);
if ( 0 != p ) {
p = new NTuple::Directory();
// Finally register the created N tuple with the store
status = registerObject(fullPath, p);
if ( status.isSuccess() ) {
// ...starting from the file entries
if ( 0 != svc ) {
IOpaqueAddress* pAddr = 0;
status = svc->createRep (p, pAddr);
if ( status.isSuccess() ) {
p->registry()->setAddress(pAddr);
status = svc->fillRepRefs (pAddr, p);
if ( status.isSuccess() ) {
return p;
}
}
}
}
p->release();
p = 0;
}
}
}
try {
p = dynamic_cast<NTuple::Directory*>(p);
return p;
}
catch (...) {
}
return 0;
}
StatusCode NTupleSvc::createService ( const std::string &  nam,
const std::string &  typ,
const std::vector< Prop > &  props,
IConversionSvc *&  pSvc 
)
protected

Create conversion service.

CGL: set the storage type

Definition at line 294 of file NTupleSvc.cpp.

{
// Get the value of the Stat persistancy mechanism from the AppMgr
IProperty* appPropMgr = 0;
StatusCode sts = serviceLocator()->queryInterface(IProperty::interfaceID(), pp_cast<void>(&appPropMgr) );
if( !sts.isSuccess() ) {
// Report an error and return the FAILURE status code
log << MSG::ERROR << "Could not get PropMgr" << endmsg;
return sts;
}
StringProperty sp("HistogramPersistency","");
sts = appPropMgr->getProperty( &sp );
if ( !sts.isSuccess() ) {
log << MSG::ERROR << "Could not get NTuple Persistency format"
<< " from ApplicationMgr properties" << endmsg;
return sts;
}
long storage_typ = TEST_StorageType;
if ( sp.value() == "HBOOK" ) {
storage_typ = HBOOK_StorageType;
}
else if ( sp.value() == "ROOT" ) {
storage_typ = ROOT_StorageType;
}
else {
appPropMgr->release();
log << MSG::ERROR << "Unknown NTuple Persistency format: " << sp.value() << endmsg;
}
// Clean up
appPropMgr->release();
if ( typ.length() > 0 && typ != sp.value() ) {
log << MSG::WARNING << "NTuple persistency type is "
<< sp.value() << "." << endmsg
<< "Type given by job option "
<< "NTupleSvc.Input/Output ignored!" << endmsg;
}
// log << MSG::DEBUG << "storage type: " << m_storageType << endmsg;
// FIXME: (MCl) why NTupleSvc has to directly create a ConversionSvc?
IService* pService = 0;
IInterface* iface = new ConversionSvc(name()+"Conversions", serviceLocator(), storage_typ);
StatusCode status = iface->queryInterface(IService::interfaceID(), pp_cast<void>(&pService));
if ( status.isSuccess() ) {
status = iface->queryInterface(IConversionSvc::interfaceID(), pp_cast<void>(&pSvc));
if ( !status.isSuccess() ) {
pService->release();
return status;
}
}
status = pService->sysInitialize();
if ( !status.isSuccess() ) {
return status;
}
pService->release();
status = pSvc->setDataProvider(this);
if ( !status.isSuccess() ) {
return status;
}
return status;
}
StatusCode NTupleSvc::disconnect ( const std::string &  nam)
virtual

Close open connection.

Definition at line 197 of file NTupleSvc.cpp.

{
Connections::iterator i = m_connections.find(nam);
if ( i != m_connections.end() ) {
releaseConnection((*i).second);
m_connections.erase(i);
}
}
StatusCode NTupleSvc::disconnectAll ( )
virtual

Close all open connections.

Definition at line 208 of file NTupleSvc.cpp.

{
for(Connections::iterator i = m_connections.begin(); i != m_connections.end(); ++i) {
releaseConnection((*i).second);
}
m_connections.erase(m_connections.begin(), m_connections.end());
}
StatusCode NTupleSvc::finalize ( )
virtual

DataSvc overrides: stop the service.

stop the service.

Reimplemented from DataSvc.

Reimplemented in TagCollectionSvc.

Definition at line 217 of file NTupleSvc.cpp.

{
status = clearStore();
status = DataSvc::finalize();
status = disconnectAll();
return status;
}
IConversionSvc * NTupleSvc::getDataLoader ( IRegistry pReg)
virtual

DataSvc overrides: Retrieve data loader.

DataSvc override: Retrieve data loader.

Reimplemented from DataSvc.

Definition at line 113 of file NTupleSvc.cpp.

{
if ( 0 != pRegistry ) {
std::string full = pRegistry->identifier();
size_t len = m_rootName.length();
size_t idx = full.find(SEPARATOR,len+1);
std::string path = (idx==std::string::npos) ? full : full.substr(0, idx);
Connections::iterator i = m_connections.find(path);
if ( i != m_connections.end() ) {
return (*i).second.service;
}
}
return 0;
}
StatusCode NTupleSvc::initialize ( )
virtual

DataSvc overrides: Initialize the service.

Initialize the service.

Reimplemented from DataSvc.

Reimplemented in TagCollectionSvc.

Definition at line 76 of file NTupleSvc.cpp.

{
if ( status.isSuccess() ) {
status = setProperties();
if ( status.isSuccess() ) {
status = setRoot(m_rootName, root);
for ( DBaseEntries::iterator i = m_output.begin(); i != m_output.end(); ++i ) {
iret = connect(*i);
if ( !iret.isSuccess() ) {
status = iret;
}
}
for ( DBaseEntries::iterator j = m_input.begin(); j != m_input.end(); ++j ) {
iret = connect(*j);
if ( !iret.isSuccess() ) {
status = iret;
}
}
}
}
return status;
}
bool NTupleSvc::isConnected ( const std::string &  identifier) const
virtual

Check if a datasource is connected.

Definition at line 107 of file NTupleSvc.cpp.

{
Connections::const_iterator i = m_connections.find(identifier);
return !(i==m_connections.end());
}
StatusCode NTupleSvc::readRecord ( NTuple::Tuple tuple)
virtual

Read single record from N tuple.

Definition at line 659 of file NTupleSvc.cpp.

{
StatusCode status = INVALID_OBJECT;
NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
if ( 0 != tuple ) {
try {
if ( 0 == pSvc ) {
pSvc = getDataLoader(n_tuple->registry());
tuple->setConversionService(pSvc);
}
if ( 0 != pSvc ) {
IRegistry* pReg = n_tuple->registry();
IOpaqueAddress* pAddr = pReg->address();
status = pSvc->updateObj(pAddr, n_tuple);
if ( status.isSuccess() ) {
status = pSvc->updateObjRefs(pAddr, n_tuple);
}
return status;
}
}
catch(...) {
status = INVALID_OBJECT;
}
}
return status;
}
StatusCode NTupleSvc::readRecord ( const std::string &  fullPath)
virtual

Read single record from N tuple.

Definition at line 688 of file NTupleSvc.cpp.

{
NTuple::Tuple* pObj = 0;
StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
if ( status.isSuccess() ) {
return readRecord ( pObj );
}
return INVALID_OBJ_PATH;
}
StatusCode NTupleSvc::readRecord ( DataObject pParent,
const std::string &  relPath 
)
virtual

Read single record from N tuple.

Definition at line 698 of file NTupleSvc.cpp.

{
NTuple::Tuple* pObj = 0;
StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
if ( status.isSuccess() ) {
return readRecord ( pObj );
}
return INVALID_OBJ_PATH;
}
StatusCode NTupleSvc::reinitialize ( )
virtual

DataSvc overrides: reinitialize service.

Initialize the service.

Reimplemented from DataSvc.

Definition at line 102 of file NTupleSvc.cpp.

{
}
void NTupleSvc::releaseConnection ( Connection c)
protected

Finalize single service.

Definition at line 187 of file NTupleSvc.cpp.

{
SmartIF<IService> isvc( c.service );
if ( isvc.isValid( ) ) {
isvc->finalize().ignore();
}
c.service->release();
c.service = 0;
}
StatusCode NTupleSvc::save ( const std::string &  fullPath)
virtual

Save N tuple to disk. Must be called in order to close the ntuple file properly.

Definition at line 567 of file NTupleSvc.cpp.

{
NTuple::Tuple* pObj = 0;
StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
if ( status.isSuccess() ) {
return save ( pObj );
}
return INVALID_OBJ_PATH;
}
StatusCode NTupleSvc::save ( NTuple::Tuple tuple)
virtual

Save N tuple to disk. Must be called in order to close the ntuple file properly.

Definition at line 578 of file NTupleSvc.cpp.

{
NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
if ( 0 != tuple ) {
try {
IRegistry* pReg = tuple->registry();
if ( 0 != pSvc && 0 != pReg ) {
IOpaqueAddress* pAddr = pReg->address();
StatusCode status = pSvc->updateRep(pAddr, n_tuple);
if ( status.isSuccess() ) {
status = pSvc->updateRepRefs(pAddr, n_tuple);
}
return status;
}
}
catch(...) {
}
}
return INVALID_OBJECT;
}
StatusCode NTupleSvc::save ( DataObject pParent,
const std::string &  relPath 
)
virtual

Save N tuple to disk. Must be called in order to close the ntuple file properly.

Definition at line 601 of file NTupleSvc.cpp.

{
NTuple::Tuple* pObj = 0;
StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
if ( status.isSuccess() ) {
return save ( pObj );
}
return INVALID_OBJ_PATH;
}
StatusCode NTupleSvc::updateDirectories ( )
protected

Update directory data.

Definition at line 127 of file NTupleSvc.cpp.

{
typedef std::vector<IRegistry*> Leaves;
long need_update = 0;
DataObject* pO = 0;
// log << MSG::DEBUG << "in finalize()" << endmsg;
if ( iret.isSuccess() ) {
Leaves leaves;
iret = objectLeaves(pO, leaves);
if ( iret.isSuccess() ) {
// Only traverse the tree below the files
for ( Leaves::iterator d = leaves.begin(); d != leaves.end(); d++ ) {
if ( (*d)->object() ) {
IOpaqueAddress* pA = (*d)->address();
if ( pA ) {
unsigned long typ = pA->ipar()[1];
if ( typ == 'R' || typ == 'N' || typ == 'U' ) {
// ...starting from the file entries: first save the directories/ntuples
if ( 0 != svc ) {
StatusCode status;
traverseSubTree ( (*d)->object(), &agent ).ignore();
for(int i = sel->size()-1; i >= 0; i-- ) {
DataObject* o = (*sel)[i];
IRegistry* r = o->registry();
status = svc->updateRep(r->address(), o);
if ( !status.isSuccess() ) {
iret = status;
}
}
for(int j = sel->size()-1; j >= 0; j-- ) {
DataObject* o = (*sel)[j];
IRegistry* r = o->registry();
status = svc->updateRepRefs(r->address(), o);
if ( !status.isSuccess() ) {
iret = status;
}
}
if ( iret.isSuccess() ) need_update += sel->size();
}
}
}
}
}
}
}
if ( !iret.isSuccess() ) {
log << MSG::ERROR << "ERROR while saving NTuples" << endmsg;
return iret;
}
else if ( need_update > 0 ) {
log << MSG::INFO << "NTuples saved successfully" << endmsg;
}
return iret;
}
StatusCode NTupleSvc::writeRecord ( NTuple::Tuple tuple)
virtual

Write single record to N tuple.

Definition at line 611 of file NTupleSvc.cpp.

{
NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
if ( 0 != tuple ) {
try {
if ( 0 == pSvc ) {
pSvc = getDataLoader(n_tuple->registry());
tuple->setConversionService(pSvc);
}
if ( 0 != pSvc ) {
IRegistry* pReg = n_tuple->registry();
IOpaqueAddress* pAddr = pReg->address();
StatusCode status = pSvc->createRep(n_tuple, pAddr);
if ( status.isSuccess() ) {
pReg->setAddress(pAddr);
status = pSvc->fillRepRefs(pAddr, n_tuple);
}
return status;
}
}
catch(...) {
}
}
return INVALID_OBJECT;
}
StatusCode NTupleSvc::writeRecord ( const std::string &  fullPath)
virtual

Write single record to N tuple.

Definition at line 639 of file NTupleSvc.cpp.

{
NTuple::Tuple* pObj = 0;
StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
if ( status.isSuccess() ) {
return writeRecord ( pObj );
}
return INVALID_OBJ_PATH;
}
StatusCode NTupleSvc::writeRecord ( DataObject pParent,
const std::string &  relPath 
)
virtual

Write single record to N tuple.

Definition at line 649 of file NTupleSvc.cpp.

{
NTuple::Tuple* pObj = 0;
StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
if ( status.isSuccess() ) {
return writeRecord ( pObj );
}
return INVALID_OBJ_PATH;
}

Member Data Documentation

Connections NTupleSvc::m_connections
protected

Container of connection points.

Definition at line 127 of file NTupleSvc.h.

DBaseEntries NTupleSvc::m_input
protected

Input streams.

Definition at line 125 of file NTupleSvc.h.

DBaseEntries NTupleSvc::m_output
protected

Output streams.

Definition at line 123 of file NTupleSvc.h.


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

Generated at Wed Jun 4 2014 14:49:03 for Gaudi Framework, version v25r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004