The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
NTupleSvc Class Reference

NTuple service. More...

#include </builds/gaudi/Gaudi/GaudiSvc/src/NTupleSvc/NTupleSvc.h>

Inheritance diagram for NTupleSvc:
Collaboration diagram for NTupleSvc:

Classes

struct  Connection
 

Public Member Functions

StatusCode initialize () override
 DataSvc overrides: Initialize the service.
 
StatusCode reinitialize () override
 DataSvc overrides: reinitialize service.
 
StatusCode finalize () override
 DataSvc overrides: stop the service.
 
IConversionSvcgetDataLoader (IRegistry *pReg) override
 DataSvc overrides: Retrieve data loader.
 
NTuple::DirectorycreateDirectory (DataObject *pParent, const std::string &title) override
 Create Ntuple directory and register it with the data store.
 
NTuple::DirectorycreateDirectory (DataObject *pParent, long id) override
 Create Ntuple directory and register it with the data store.
 
NTuple::DirectorycreateDirectory (const std::string &dirPath, long id) override
 Create Ntuple directory and register it with the data store.
 
NTuple::DirectorycreateDirectory (const std::string &dirPath, const std::string &title) override
 Create Ntuple directory and register it with the data store.
 
NTuple::DirectorycreateDirectory (const std::string &fullPath) override
 Create Ntuple directory and register it with the data store.
 
StatusCode create (const CLID &typ, const std::string &title, NTuple::Tuple *&refpTuple) override
 Create requested N tuple (Hide constructor)
 
NTuple::Tuplebook (const std::string &fullPath, const CLID &type, const std::string &title) override
 Book Ntuple and register it with the data store.
 
NTuple::Tuplebook (const std::string &dirPath, const std::string &relPath, const CLID &type, const std::string &title) override
 Book Ntuple and register it with the data store.
 
NTuple::Tuplebook (const std::string &dirPath, long id, const CLID &type, const std::string &title) override
 Book Ntuple and register it with the data store.
 
NTuple::Tuplebook (DataObject *pParent, const std::string &relPath, const CLID &type, const std::string &title) override
 Book Ntuple and register it with the data store.
 
NTuple::Tuplebook (DataObject *pParent, long id, const CLID &type, const std::string &title) override
 Book Ntuple and register it with the data store.
 
NTuple::Tupleaccess (const std::string &fullPath, const std::string &filename) override
 Access N tuple on disk.
 
StatusCode save (const std::string &fullPath) override
 Save N tuple to disk. Must be called in order to close the ntuple file properly.
 
StatusCode save (NTuple::Tuple *tuple) override
 Save N tuple to disk. Must be called in order to close the ntuple file properly.
 
StatusCode save (DataObject *pParent, const std::string &relPath) override
 Save N tuple to disk. Must be called in order to close the ntuple file properly.
 
StatusCode writeRecord (NTuple::Tuple *tuple) override
 Write single record to N tuple.
 
StatusCode writeRecord (const std::string &fullPath) override
 Write single record to N tuple.
 
StatusCode writeRecord (DataObject *pParent, const std::string &relPath) override
 Write single record to N tuple.
 
StatusCode readRecord (NTuple::Tuple *tuple) override
 Read single record from N tuple.
 
StatusCode readRecord (const std::string &fullPath) override
 Read single record from N tuple.
 
StatusCode readRecord (DataObject *pParent, const std::string &relPath) override
 Read single record from N tuple.
 
bool isConnected (const std::string &identifier) const override
 Check if a datasource is connected.
 
StatusCode connect (const std::string &ident) override
 Add file to list I/O list.
 
StatusCode connect (const std::string &ident, std::string &logname) override
 Add file to list I/O list.
 
StatusCode disconnect (const std::string &nam) override
 Close open connection.
 
StatusCode disconnectAll () override
 Close all open connections.
 
 NTupleSvc (const std::string &name, ISvcLocator *svc)
 Standard Constructor.
 
- Public Member Functions inherited from extends< DataSvc, INTupleSvc, IDataSourceMgr >
void const * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast.
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface.
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames.
 
- Public Member Functions inherited from DataSvc
CLID rootCLID () const override
 IDataManagerSvc: Accessor for root event CLID.
 
const std::string & rootName () const override
 IDataManagerSvc: Accessor for root event name.
 
StatusCode registerAddress (std::string_view fullPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store.
 
StatusCode registerAddress (IRegistry *parentObj, std::string_view objectPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store.
 
StatusCode unregisterAddress (std::string_view fullPath) override
 IDataManagerSvc: Unregister object address from the data store.
 
StatusCode unregisterAddress (IRegistry *pParent, std::string_view objPath) override
 IDataManagerSvc: Unregister object address from the data store.
 
StatusCode objectLeaves (const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
 IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
 
StatusCode objectLeaves (const IRegistry *pRegistry, std::vector< IRegistry * > &refLeaves) override
 IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
 
StatusCode objectParent (const DataObject *pObject, IRegistry *&refpParent) override
 IDataManagerSvc: Explore the object store: retrieve the object's parent.
 
StatusCode objectParent (const IRegistry *pRegistry, IRegistry *&refpParent) override
 IDataManagerSvc: Explore the object store: retrieve the object's parent.
 
StatusCode clearSubTree (std::string_view sub_tree_path) override
 IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name.
 
StatusCode clearSubTree (DataObject *pObject) override
 IDataManagerSvc: Remove all data objects below the sub tree identified by the object.
 
StatusCode clearStore () override
 IDataManagerSvc: Remove all data objects in the data store.
 
StatusCode traverseSubTree (std::string_view sub_tree_path, IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full path name.
 
StatusCode traverseSubTree (DataObject *pObject, IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects below the sub tree.
 
StatusCode traverseTree (IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects in the data store.
 
StatusCode setRoot (std::string root_name, DataObject *pRootObj) override
 Initialize data store for new event by giving new event path and root object.
 
virtual StatusCode i_setRoot (std::string root_name, DataObject *pRootObj)
 Initialize data store for new event by giving new event path and root object.
 
StatusCode setRoot (std::string root_path, IOpaqueAddress *pRootAddr) override
 Initialize data store for new event by giving new event path and address of root object.
 
virtual StatusCode i_setRoot (std::string root_path, IOpaqueAddress *pRootAddr)
 Initialize data store for new event by giving new event path and address of root object.
 
StatusCode setDataLoader (IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr) override
 IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data provider.
 
StatusCode addPreLoadItem (const DataStoreItem &item) override
 Add an item to the preload list.
 
StatusCode removePreLoadItem (const DataStoreItem &item) override
 Remove an item from the preload list.
 
StatusCode resetPreLoad () override
 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.
 
StatusCode preLoad () override
 load all preload items of the list
 
StatusCode registerObject (std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
 Register object with the data store.
 
StatusCode registerObject (DataObject *parentObj, std::string_view objPath, DataObject *pObject) override
 Register object with the data store.
 
StatusCode unregisterObject (std::string_view fullPath) override
 Unregister object from the data store.
 
StatusCode unregisterObject (DataObject *pObject) override
 Unregister object from the data store.
 
StatusCode unregisterObject (DataObject *pObject, std::string_view objectPath) override
 Unregister object from the data store.
 
StatusCode retrieveObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
 Retrieve object from data store.
 
StatusCode findObject (std::string_view fullPath, DataObject *&pObject) override
 Find object identified by its full path in the data store.
 
StatusCode findObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
 Find object identified by its full path in the data store.
 
StatusCode linkObject (IRegistry *from, std::string_view objPath, DataObject *to) override
 Add a link to another object.
 
StatusCode linkObject (std::string_view fullPath, DataObject *to) override
 Add a link to another object.
 
StatusCode unlinkObject (IRegistry *from, std::string_view objPath) override
 Remove a link to another object.
 
StatusCode unlinkObject (DataObject *fromObj, std::string_view objPath) override
 Remove a link to another object.
 
StatusCode unlinkObject (std::string_view fullPath) override
 Remove a link to another object.
 
StatusCode updateObject (IRegistry *pDirectory) override
 Update object identified by its directory entry.
 
StatusCode updateObject (DataObject *toUpdate) override
 Update object.
 
StatusCode initialize () override
 Service initialization.
 
StatusCode reinitialize () override
 Service initialization.
 
StatusCode finalize () override
 Service initialization.
 
 DataSvc (const DataSvc &)=delete
 copy constructor disabled
 
DataSvcoperator= (const DataSvc &)=delete
 Fake assignment operator (never implemented).
 
StatusCode registerAddress (DataObject *parentObj, std::string_view objectPath, IOpaqueAddress *pAddress)
 Register object address with the data store.
 
StatusCode unregisterAddress (DataObject *pParent, std::string_view objPath)
 Unregister object address from the data store.
 
StatusCode registerObject (std::string_view fullPath, DataObject *pObject)
 Register object with the data store.
 
StatusCode registerObject (std::string_view parentPath, int item, DataObject *pObject)
 Register object with the data store.
 
StatusCode registerObject (DataObject *parentObj, int item, DataObject *pObject)
 Register object with the data store.
 
StatusCode retrieveObject (std::string_view fullPath, DataObject *&pObject)
 Retrieve object identified by its full path from the data store.
 
StatusCode retrieveObject (std::string_view parentPath, std::string_view objectPath, DataObject *&pObject)
 Retrieve object from data store.
 
StatusCode retrieveObject (std::string_view parentPath, int item, DataObject *&pObject)
 Retrieve object from data store.
 
StatusCode retrieveObject (DataObject *parentObj, std::string_view objectPath, DataObject *&pObject)
 Retrieve object from data store.
 
StatusCode retrieveObject (DataObject *parentObj, int item, DataObject *&pObject)
 Retrieve object from data store.
 
StatusCode findObject (std::string_view parentPath, std::string_view objectPath, DataObject *&pObject)
 Find object identified by its parent object and the path to the object relative to the parent.
 
StatusCode findObject (std::string_view parentPath, int item, DataObject *&pObject)
 Find object identified by its parent object and an integer identifier in the data store.
 
StatusCode findObject (DataObject *parentObj, std::string_view objectPath, DataObject *&pObject)
 Find object identified by its parent object and the path to the object relative to the parent.
 
StatusCode findObject (DataObject *parentObj, int item, DataObject *&pObject)
 Find object identified by its parent object and an integer identifier in the data store.
 
StatusCode linkObject (std::string_view fromPath, std::string_view objPath, DataObject *toObj)
 Add a link to another object.
 
StatusCode linkObject (DataObject *fromObj, std::string_view objPath, DataObject *toObj)
 Add a link to another object.
 
StatusCode unlinkObject (std::string_view fromPath, std::string_view objPath)
 Remove a link to another object.
 
- Public Member Functions inherited from extends< Service, IDataProviderSvc, IDataManagerSvc >
void const * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast.
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface.
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames.
 
- Public Member Functions inherited from Service
const std::string & name () const override
 Retrieve name of the service.
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
StatusCode sysInitialize () override
 Initialize Service.
 
StatusCode sysStart () override
 Initialize Service.
 
StatusCode sysStop () override
 Initialize Service.
 
StatusCode sysFinalize () override
 Finalize Service.
 
StatusCode sysReinitialize () override
 Re-initialize the Service.
 
StatusCode sysRestart () override
 Re-initialize the Service.
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor.
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator.
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
template<class T>
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
 
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, bool createIf=true)
 
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, const std::string &toolTypeAndName, bool createIf=true)
 Declare used tool.
 
template<class T>
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
 
template<class T>
void addToolsArray (ToolHandleArray< T > &hndlArr)
 
const std::vector< IAlgTool * > & tools () const
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property.
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property.
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation.
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property.
 
StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p) override
 set the property from another property with a different name
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
StatusCode setPropertyRepr (const std::string &n, const std::string &r) override
 set the property from name and value string representation
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property
 
const Gaudi::Details::PropertyBasegetProperty (std::string_view name) const override
 get the property by name
 
StatusCode getProperty (std::string_view n, std::string &v) const override
 convert the property to the string
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties
 
bool hasProperty (std::string_view name) const override
 Return true if we have a property with the given name.
 
Gaudi::Details::PropertyBaseproperty (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected
 
void bindPropertiesTo (Gaudi::Interfaces::IOptionsSvc &optsSvc)
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream)
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor.
 
const 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)
 

Protected Types

typedef std::vector< std::string > DBaseEntries
 
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 Member Functions inherited from DataSvc
bool checkRoot ()
 Check if root path is valid.
 
virtual DataObjectcreateDefaultObject () const
 Create default objects in case forced creation of leaves is requested.
 
virtual StatusCode loadObject (IRegistry *pNode)
 Invoke Persistency service to create transient object from its persistent representation.
 
virtual StatusCode loadObject (IConversionSvc *pLoader, IRegistry *pNode)
 Invoke Persistency service to create transient object from its persistent representation.
 
StatusCode retrieveEntry (DataSvcHelpers::RegistryEntry *pNode, std::string_view path, DataSvcHelpers::RegistryEntry *&pEntry)
 Retrieve registry entry from store.
 
DataObjecthandleDataFault (IRegistry *pReg, std::string_view path="")
 Invoke data fault handling if enabled.
 
- Protected Member Functions inherited from Service
std::vector< IAlgTool * > & tools ()
 
 ~Service () override
 
int outputLevel () const
 get the Service's output level
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches.
 
MSG::Level resetMessaging ()
 Reinitialize internal states.
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream.
 

Protected Attributes

Gaudi::Property< DBaseEntriesm_input { this, "Input", {}, "input streams" }
 
Gaudi::Property< DBaseEntriesm_output { this, "Output", {}, "output streams" }
 
Gaudi::Property< int > m_basketsize { this, "BasketSize", 32000, "BasketSize" }
 
std::map< std::string, Connectionm_connections
 Container of connection points.
 
- Protected Attributes inherited from DataSvc
SmartIF< IIncidentSvcm_incidentSvc = nullptr
 Pointer to incident service.
 
Gaudi::Property< CLIDm_rootCLID { this, "RootCLID", 110 , "CLID of root entry" }
 
Gaudi::Property< std::string > m_rootName { this, "RootName", "/Event", "name of root entry" }
 
std::unique_ptr< DataSvcHelpers::RegistryEntrym_root
 Pointer to root entry.
 
- Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state.
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state.
 
Gaudi::Property< int > m_outputLevel { this, "OutputLevel", MSG::NIL, "output level" }
 flag indicating whether ToolHandle tools have been added to m_tools
 
Gaudi::Property< bool > m_auditorInitialize { this, "AuditInitialize", false, "trigger auditor on initialize()" }
 
Gaudi::Property< bool > m_auditorStart { this, "AuditStart", false, "trigger auditor on start()" }
 
Gaudi::Property< bool > m_auditorStop { this, "AuditStop", false, "trigger auditor on stop()" }
 
Gaudi::Property< bool > m_auditorFinalize { this, "AuditFinalize", false, "trigger auditor on finalize()" }
 
Gaudi::Property< bool > m_auditorReinitialize { this, "AuditReinitialize", false, "trigger auditor on reinitialize()" }
 
Gaudi::Property< bool > m_auditorRestart { this, "AuditRestart", false, "trigger auditor on restart()" }
 
Gaudi::Property< bool > m_autoRetrieveTools
 
Gaudi::Property< bool > m_checkToolDeps
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service.
 

Additional Inherited Members

- Public Types inherited from extends< DataSvc, INTupleSvc, IDataSourceMgr >
using base_class
 Typedef to this class.
 
using extend_interfaces_base
 Typedef to the base of this class.
 
- Public Types inherited from extends< Service, IDataProviderSvc, IDataManagerSvc >
using base_class
 Typedef to this class.
 
using extend_interfaces_base
 Typedef to the base of this class.
 
- Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory<IService*( const std::string&, ISvcLocator* )>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl
 Typedef used to refer to this class from derived classes, as in.
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids
 take union of the ext_iids of all 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 32 of file NTupleSvc.h.

Member Typedef Documentation

◆ DBaseEntries

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

Definition at line 39 of file NTupleSvc.h.

◆ Prop

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

Definition at line 40 of file NTupleSvc.h.

Constructor & Destructor Documentation

◆ NTupleSvc()

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

Standard Constructor.

Definition at line 61 of file NTupleSvc.cpp.

61 : base_class( name, svc ) {
62 m_rootName = "/NTUPLES";
63 m_rootCLID = CLID_DataObject;
64}
Gaudi::Property< std::string > m_rootName
Definition DataSvc.h:53
Gaudi::Property< CLID > m_rootCLID
Definition DataSvc.h:52
const std::string & name() const override
Retrieve name of the service.
Definition Service.cpp:333

Member Function Documentation

◆ access()

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

Access N tuple on disk.

Definition at line 491 of file NTupleSvc.cpp.

491{ return nullptr; }

◆ attachTuple()

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 433 of file NTupleSvc.cpp.

434 {
435 DataObject* p;
436 // First get the root object
437 StatusCode status = retrieveObject( m_rootName.value(), p );
438 if ( status.isSuccess() ) {
439 // Now add the registry entry to the store
440 std::string entryname = m_rootName;
441 entryname += '/';
442 entryname += logname;
443 GenericAddress* pA = new GenericAddress( t, CLID_NTupleFile, filename, entryname, 0, typ );
444 status = registerAddress( p, logname, pA );
445 if ( status.isSuccess() ) {
446 info() << "Added stream file:" << filename << " as " << logname << endmsg;
447 return status;
448 }
449 pA->release();
450 }
451 error() << "Cannot add file:" << filename << " as " << logname << endmsg;
452 return status;
453}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.
Definition DataSvc.cpp:601
StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition DataSvc.cpp:198
unsigned long release() override
release reference to object
bool isSuccess() const
Definition StatusCode.h:314

◆ book() [1/5]

NTuple::Tuple * NTupleSvc::book ( const std::string & dirPath,
const std::string & relPath,
const CLID & type,
const std::string & title )
override

Book Ntuple and register it with the data store.

Definition at line 361 of file NTupleSvc.cpp.

362 {
363 std::string full = dirPath;
364 assert( !relPath.empty() );
365 if ( relPath[0] != SEPARATOR ) full += SEPARATOR;
366 full += relPath;
367 return book( full, type, title );
368}
constexpr char SEPARATOR
NTuple::Tuple * book(const std::string &fullPath, const CLID &type, const std::string &title) override
Book Ntuple and register it with the data store.

◆ book() [2/5]

NTuple::Tuple * NTupleSvc::book ( const std::string & dirPath,
long id,
const CLID & type,
const std::string & title )
override

Book Ntuple and register it with the data store.

Definition at line 371 of file NTupleSvc.cpp.

371 {
372 return book( dirPath, std::to_string( id ), type, title );
373}

◆ book() [3/5]

NTuple::Tuple * NTupleSvc::book ( const std::string & fullPath,
const CLID & type,
const std::string & title )
override

Book Ntuple and register it with the data store.

Definition at line 327 of file NTupleSvc.cpp.

327 {
328 DataObject* pObj = nullptr;
329 std::string path = fullPath;
330 assert( !path.empty() );
331 if ( path[0] != SEPARATOR ) {
333 path += SEPARATOR;
334 path += fullPath;
335 }
336 StatusCode status = retrieveObject( path, pObj );
337 if ( status.isSuccess() ) {
338 error() << "Cannot book N-tuple " << path << " (Exists already)" << endmsg;
339 return nullptr;
340 }
341 auto sep = path.rfind( SEPARATOR );
342 if ( sep == std::string::npos ) {
343 error() << "Cannot book N-tuple " << path << " (Invalid path)" << endmsg;
344 return nullptr;
345 }
346
347 std::string p_path( path, 0, sep );
348 std::string o_path( path, sep, path.length() );
349 DataObject* dir = createDirectory( p_path );
350 if ( !dir ) {
351 error() << "Cannot book N-tuple " << path << " (Invalid parent directory)" << endmsg;
352 return nullptr;
353 }
354
355 NTuple::Tuple* tup = book( dir, o_path, type, title );
356 if ( !tup ) { error() << "Cannot book N-tuple " << path << " (Unknown reason)" << endmsg; }
357 return tup;
358}
NTuple::Directory * createDirectory(DataObject *pParent, const std::string &title) override
Create Ntuple directory and register it with the data store.
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram

◆ book() [4/5]

NTuple::Tuple * NTupleSvc::book ( DataObject * pParent,
const std::string & relPath,
const CLID & type,
const std::string & title )
override

Book Ntuple and register it with the data store.

Definition at line 376 of file NTupleSvc.cpp.

377 {
378 NTuple::Tuple* pObj = nullptr;
379 // Check if object is already present
380 StatusCode status = findObject( pParent, relPath, *pp_cast<DataObject>( &pObj ) );
381 // No ? Then create it!
382 if ( !status.isSuccess() ) {
383 status = create( type, title, pObj );
384 if ( status.isSuccess() ) {
385 // Finally register the created N tuple with the store
386 status = registerObject( pParent, relPath, pObj );
387 if ( status.isSuccess() ) return pObj;
388 pObj->release();
389 }
390 }
391 return nullptr;
392}
DEST ** pp_cast(SRC **ptr)
Small function to be used instead of the construct (void**)&pointer, which produces,...
Definition IInterface.h:370
virtual unsigned long release()
release reference to object
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition DataSvc.cpp:623
StatusCode registerObject(std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
Register object with the data store.
Definition DataSvc.cpp:276
StatusCode create(const CLID &typ, const std::string &title, NTuple::Tuple *&refpTuple) override
Create requested N tuple (Hide constructor)

◆ book() [5/5]

NTuple::Tuple * NTupleSvc::book ( DataObject * pParent,
long id,
const CLID & type,
const std::string & title )
override

Book Ntuple and register it with the data store.

Definition at line 395 of file NTupleSvc.cpp.

395 {
396 return book( pParent, std::to_string( id ), type, title );
397}

◆ connect() [1/2]

StatusCode NTupleSvc::connect ( const std::string & ident)
override

Add file to list I/O list.

Definition at line 187 of file NTupleSvc.cpp.

187 {
188 std::string logName;
189 return connect( ident, logName );
190}
StatusCode connect(const std::string &ident) override
Add file to list I/O list.

◆ connect() [2/2]

StatusCode NTupleSvc::connect ( const std::string & ident,
std::string & logname )
override

Add file to list I/O list.

Definition at line 192 of file NTupleSvc.cpp.

192 {
193 DataObject* pO = nullptr;
194 StatusCode status = findObject( m_rootName.value(), pO );
195 if ( status.isSuccess() ) {
196 char typ = 0;
197 std::vector<Prop> props;
198 long loc = ident.find( " " );
199 std::string filename, auth, svc = "", db_typ = "";
200 logname = ident.substr( 0, loc );
201 using Parser = Gaudi::Utils::AttribStringParser;
202 // we assume that there is always a " "
203 // (but if it is not there, we probably will not match the pattern)
204 for ( auto attrib : Parser( ident.substr( loc + 1 ) ) ) {
205 switch ( ::toupper( attrib.tag[0] ) ) {
206 case 'A':
207 break;
208 case 'F': // FILE='<file name>'
209 case 'D': // DATAFILE='<file name>'
210 filename = std::move( attrib.value );
211 break;
212 case 'O': // OPT='<NEW<CREATE,WRITE>, UPDATE, READ>'
213 switch ( ::toupper( attrib.value[0] ) ) {
214 case 'C':
215 case 'N':
216 case 'W':
217 typ = 'N';
218 break;
219 case 'U':
220 typ = 'U';
221 break;
222 case 'O':
223 case 'R':
224 typ = 'O';
225 break;
226 default:
227 typ = 0;
228 break;
229 }
230 break;
231 case 'T': // TYP='<HBOOK,ROOT,OBJY,...>'
232 db_typ = std::move( attrib.value );
233 break;
234 default:
235 props.emplace_back( attrib.tag, attrib.value );
236 break;
237 }
238 }
239 if ( 0 != typ ) {
240 IConversionSvc* pSvc = nullptr;
241 status = createService( name() + '.' + logname, db_typ, props, pSvc );
242 if ( status.isSuccess() ) {
243 status = attachTuple( filename, logname, typ, pSvc->repSvcType() );
244 if ( status.isSuccess() ) {
245 m_connections.insert( { m_rootName + '/' + logname, Connection( pSvc ) } );
246 return StatusCode::SUCCESS;
247 }
248 }
249 }
250 }
251 error() << "Cannot add " << ident << " invalid filename!" << endmsg;
252 return StatusCode::FAILURE;
253}
void toupper(std::string &s)
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
StatusCode attachTuple(const std::string &filename, const std::string &logname, const char typ, const long t)
Attach output/input file.
std::map< std::string, Connection > m_connections
Container of connection points.
Definition NTupleSvc.h:129
StatusCode createService(const std::string &nam, const std::string &typ, const std::vector< Prop > &props, IConversionSvc *&pSvc)
Create conversion service.
constexpr static const auto SUCCESS
Definition StatusCode.h:99
constexpr static const auto FAILURE
Definition StatusCode.h:100

◆ create()

StatusCode NTupleSvc::create ( const CLID & typ,
const std::string & title,
NTuple::Tuple *& refpTuple )
override

Create requested N tuple (Hide constructor)

Eventually allow loading through factory?

Definition at line 308 of file NTupleSvc.cpp.

308 {
309 NTuple::TupleImp* pTuple = nullptr;
310 StatusCode status = StatusCode::FAILURE;
311 if ( typ == CLID_ColumnWiseTuple ) {
312 pTuple = new NTuple::ColumnWiseTuple( title );
313 } else if ( typ == CLID_RowWiseTuple ) {
314 pTuple = new NTuple::RowWiseTuple( title );
315 } else {
317 }
318 if ( pTuple ) {
319 pTuple->setTupleService( this );
320 status = StatusCode::SUCCESS;
321 }
322 refpTuple = pTuple;
323 return status;
324}
void setTupleService(INTupleSvc *svc)
Access conversion service.

◆ createDirectory() [1/5]

NTuple::Directory * NTupleSvc::createDirectory ( const std::string & dirPath,
const std::string & title )
override

Create Ntuple directory and register it with the data store.

Definition at line 425 of file NTupleSvc.cpp.

425 {
426 assert( !relPath.empty() );
427 std::string full = dirPath;
428 if ( relPath[0] != '/' ) full += "/";
429 full += relPath;
430 return createDirectory( full );
431}

◆ createDirectory() [2/5]

NTuple::Directory * NTupleSvc::createDirectory ( const std::string & dirPath,
long id )
override

Create Ntuple directory and register it with the data store.

Definition at line 420 of file NTupleSvc.cpp.

420 {
421 return createDirectory( dirPath, std::to_string( id ) );
422}

◆ createDirectory() [3/5]

NTuple::Directory * NTupleSvc::createDirectory ( const std::string & fullPath)
override

Create Ntuple directory and register it with the data store.

Definition at line 456 of file NTupleSvc.cpp.

456 {
457 NTuple::Directory* p = nullptr;
458 StatusCode status = findObject( fullPath, *pp_cast<DataObject>( &p ) );
459 if ( !status.isSuccess() ) {
460 auto sep2 = fullPath.rfind( SEPARATOR );
461 if ( sep2 != std::string::npos ) {
462 std::string relPath = fullPath.substr( 0, sep2 );
463 p = createDirectory( relPath );
464 if ( p ) {
465 p = new NTuple::Directory();
466 // Finally register the created N tuple with the store
467 status = registerObject( fullPath, p );
468 if ( status.isSuccess() ) {
469 // ...starting from the file entries
470 IConversionSvc* svc = getDataLoader( p->registry() );
471 if ( svc ) {
472 IOpaqueAddress* pAddr = nullptr;
473 status = svc->createRep( p, pAddr );
474 if ( status.isSuccess() ) {
475 p->registry()->setAddress( pAddr );
476 status = svc->fillRepRefs( pAddr, p );
477 if ( status.isSuccess() ) return p;
478 }
479 }
480 unregisterObject( p ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
481 }
482 p->release();
483 p = nullptr;
484 }
485 }
486 }
487 return p;
488}
IRegistry * registry() const
Get pointer to Registry.
Definition DataObject.h:79
StatusCode unregisterObject(std::string_view fullPath) override
Unregister object from the data store.
Definition DataSvc.cpp:356
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
virtual void setAddress(IOpaqueAddress *pAddress)=0
Set/Update Opaque storage address.
IConversionSvc * getDataLoader(IRegistry *pReg) override
DataSvc overrides: Retrieve data loader.
Definition NTupleSvc.cpp:95
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition StatusCode.h:139

◆ createDirectory() [4/5]

NTuple::Directory * NTupleSvc::createDirectory ( DataObject * pParent,
const std::string & title )
override

Create Ntuple directory and register it with the data store.

Definition at line 400 of file NTupleSvc.cpp.

400 {
401 assert( !relPath.empty() );
402 if ( pParent ) {
403 IRegistry* pDir = pParent->registry();
404 if ( pDir ) {
405 std::string full = pDir->identifier();
406 if ( relPath[0] != '/' ) full += "/";
407 full += relPath;
408 return createDirectory( full );
409 }
410 }
411 return nullptr;
412}
virtual const id_type & identifier() const =0
Full identifier (or key)

◆ createDirectory() [5/5]

NTuple::Directory * NTupleSvc::createDirectory ( DataObject * pParent,
long id )
override

Create Ntuple directory and register it with the data store.

Definition at line 415 of file NTupleSvc.cpp.

415 {
416 return createDirectory( pParent, std::to_string( id ) );
417}

◆ createService()

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 255 of file NTupleSvc.cpp.

256 {
258 // Get the value of the Stat persistancy mechanism from the AppMgr
259 auto appPropMgr = serviceLocator()->as<IProperty>();
260 if ( !appPropMgr ) {
261 // Report an error and return the FAILURE status code
262 error() << "Could not get PropMgr" << endmsg;
263 return StatusCode::FAILURE;
264 }
265
266 Gaudi::Property<std::string> sp( "HistogramPersistency", "" );
267 StatusCode sts = appPropMgr->getProperty( &sp );
268 if ( !sts.isSuccess() ) {
269 error() << "Could not get NTuple Persistency format"
270 << " from ApplicationMgr properties" << endmsg;
271 return sts;
272 }
273
274 long storage_typ = TEST_StorageType;
275 if ( sp.value() == "HBOOK" ) {
276 storage_typ = HBOOK_StorageType;
277 } else if ( sp.value() == "ROOT" ) {
278 storage_typ = ROOT_StorageType;
279 } else {
280 error() << "Unknown NTuple Persistency format: " << sp.value() << endmsg;
281 return StatusCode::FAILURE;
282 }
283
284 if ( !typ.empty() && typ != sp.value() ) {
285 warning() << "NTuple persistency type is " << sp.value() << "." << endmsg << "Type given by job option "
286 << "NTupleSvc.Input/Output ignored!" << endmsg;
287 }
288
289 // debug() << "storage type: " << m_storageType << endmsg;
290
291 // FIXME: (MCl) why NTupleSvc has to directly create a ConversionSvc?
292 IInterface* iface = new ConversionSvc( name() + "Conversions", serviceLocator(), storage_typ );
293 auto pService = SmartIF<IService>( iface );
294 if ( !pService ) return StatusCode::FAILURE;
295
296 auto cnvSvc = pService.as<IConversionSvc>();
297 if ( !cnvSvc ) return StatusCode::FAILURE;
298
299 pSvc = cnvSvc.get();
300 pSvc->addRef(); // make sure the caller gets a pSvc which points at something
301 // with a refCount of (at least) one...
302 auto status = pService->sysInitialize();
303 if ( !status.isSuccess() ) return status;
304 return pSvc->setDataProvider( this );
305}
const long HBOOK_StorageType
Definition ClassID.h:64
const long TEST_StorageType
Definition ClassID.h:57
const long ROOT_StorageType
Definition ClassID.h:60
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
virtual unsigned long addRef() const =0
Increment the reference count of Interface instance.
SmartIF< IFace > as()
Definition ISvcLocator.h:64
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition Service.cpp:336

◆ disconnect()

StatusCode NTupleSvc::disconnect ( const std::string & nam)
override

Close open connection.

Definition at line 163 of file NTupleSvc.cpp.

163 {
164 auto i = m_connections.find( nam );
165 if ( i == m_connections.end() ) return StatusCode::FAILURE;
166 releaseConnection( i->second );
167 m_connections.erase( i );
168 return StatusCode::SUCCESS;
169}
void releaseConnection(Connection &c)
Finalize single service.

◆ disconnectAll()

StatusCode NTupleSvc::disconnectAll ( )
override

Close all open connections.

Definition at line 172 of file NTupleSvc.cpp.

172 {
173 for ( auto& i : m_connections ) releaseConnection( i.second );
174 m_connections.clear();
175 return StatusCode::SUCCESS;
176}

◆ finalize()

StatusCode NTupleSvc::finalize ( )
override

DataSvc overrides: stop the service.

stop the service.

Definition at line 179 of file NTupleSvc.cpp.

179 {
180 StatusCode status = updateDirectories();
181 status = clearStore();
182 status = DataSvc::finalize();
183 status = disconnectAll();
184 return status;
185}
StatusCode finalize() override
Service initialization.
Definition DataSvc.cpp:828
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition DataSvc.cpp:85
StatusCode disconnectAll() override
Close all open connections.
StatusCode updateDirectories()
Update directory data.

◆ getDataLoader()

IConversionSvc * NTupleSvc::getDataLoader ( IRegistry * pReg)
overridevirtual

DataSvc overrides: Retrieve data loader.

DataSvc override: Retrieve data loader.

Reimplemented from DataSvc.

Definition at line 95 of file NTupleSvc.cpp.

95 {
96 if ( !pRegistry ) return nullptr;
97 std::string full = pRegistry->identifier();
98 auto len = m_rootName.length();
99 auto idx = full.find( SEPARATOR, len + 1 );
100 std::string path = ( idx == std::string::npos ) ? full : full.substr( 0, idx );
101 auto i = m_connections.find( path );
102 return ( i != m_connections.end() ) ? i->second.service : nullptr;
103}

◆ initialize()

StatusCode NTupleSvc::initialize ( )
override

DataSvc overrides: Initialize the service.

Definition at line 67 of file NTupleSvc.cpp.

67 {
68 StatusCode status = DataSvc::initialize();
69 if ( status.isSuccess() ) {
70 StatusCode iret = StatusCode::SUCCESS;
71 DataObject* root = new NTuple::Directory();
72 status = setRoot( m_rootName, root );
73 for ( auto& i : m_output ) {
74 iret = connect( i );
75 if ( !iret.isSuccess() ) status = iret;
76 }
77 for ( auto& j : m_input ) {
78 iret = connect( j );
79 if ( !iret.isSuccess() ) status = iret;
80 }
81 }
82 return status;
83}
StatusCode setRoot(std::string root_name, DataObject *pRootObj) override
Initialize data store for new event by giving new event path and root object.
Definition DataSvc.cpp:115
StatusCode initialize() override
Service initialization.
Definition DataSvc.cpp:795
Gaudi::Property< DBaseEntries > m_output
Definition NTupleSvc.h:125
Gaudi::Property< DBaseEntries > m_input
Definition NTupleSvc.h:124

◆ isConnected()

bool NTupleSvc::isConnected ( const std::string & identifier) const
override

Check if a datasource is connected.

Definition at line 89 of file NTupleSvc.cpp.

89 {
90 auto i = m_connections.find( identifier );
91 return i != m_connections.end();
92}

◆ readRecord() [1/3]

StatusCode NTupleSvc::readRecord ( const std::string & fullPath)
override

Read single record from N tuple.

Definition at line 591 of file NTupleSvc.cpp.

591 {
592 NTuple::Tuple* pObj = nullptr;
593 StatusCode status = findObject( fullPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
594 return status.isSuccess() ? readRecord( pObj ) : Status::INVALID_OBJ_PATH;
595}
StatusCode readRecord(NTuple::Tuple *tuple) override
Read single record from N tuple.

◆ readRecord() [2/3]

StatusCode NTupleSvc::readRecord ( DataObject * pParent,
const std::string & relPath )
override

Read single record from N tuple.

Definition at line 598 of file NTupleSvc.cpp.

598 {
599 NTuple::Tuple* pObj = nullptr;
600 StatusCode status = findObject( pParent, relPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
601 return status.isSuccess() ? readRecord( pObj ) : Status::INVALID_OBJ_PATH;
602}

◆ readRecord() [3/3]

StatusCode NTupleSvc::readRecord ( NTuple::Tuple * tuple)
override

Read single record from N tuple.

Definition at line 567 of file NTupleSvc.cpp.

567 {
568 StatusCode status = Status::INVALID_OBJECT;
569 NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
570 if ( tuple ) {
571 try {
572 IConversionSvc* pSvc = tuple->conversionService();
573 if ( !pSvc ) {
574 pSvc = getDataLoader( n_tuple->registry() );
575 tuple->setConversionService( pSvc );
576 }
577 if ( pSvc ) {
578 IRegistry* pReg = n_tuple->registry();
579 IOpaqueAddress* pAddr = pReg->address();
580 status = pSvc->updateObj( pAddr, n_tuple );
581 if ( status.isSuccess() ) { status = pSvc->updateObjRefs( pAddr, n_tuple ); }
582 return status;
583 }
584 status = Status::NO_DATA_LOADER;
585 } catch ( ... ) { status = Status::INVALID_OBJECT; }
586 }
587 return status;
588}
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
IConversionSvc * conversionService() const
Access conversion service.
void setConversionService(IConversionSvc *svc)
Access conversion service.

◆ reinitialize()

StatusCode NTupleSvc::reinitialize ( )
override

DataSvc overrides: reinitialize service.

Initialize the service.

Definition at line 86 of file NTupleSvc.cpp.

86{ return StatusCode::SUCCESS; }

◆ releaseConnection()

void NTupleSvc::releaseConnection ( Connection & c)
protected

Finalize single service.

Definition at line 155 of file NTupleSvc.cpp.

155 {
156 SmartIF<IService> isvc( c.service );
157 if ( isvc ) isvc->finalize().ignore();
158 c.service->release();
159 c.service = nullptr;
160}

◆ save() [1/3]

StatusCode NTupleSvc::save ( const std::string & fullPath)
override

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

Definition at line 494 of file NTupleSvc.cpp.

494 {
495 NTuple::Tuple* pObj = nullptr;
496 StatusCode status = findObject( fullPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
497 return status.isSuccess() ? save( pObj ) : Status::INVALID_OBJ_PATH;
498}
StatusCode save(const std::string &fullPath) override
Save N tuple to disk. Must be called in order to close the ntuple file properly.

◆ save() [2/3]

StatusCode NTupleSvc::save ( DataObject * pParent,
const std::string & relPath )
override

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

Definition at line 520 of file NTupleSvc.cpp.

520 {
521 NTuple::Tuple* pObj = nullptr;
522 StatusCode status = findObject( pParent, relPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
523 return status.isSuccess() ? save( pObj ) : Status::INVALID_OBJ_PATH;
524}

◆ save() [3/3]

StatusCode NTupleSvc::save ( NTuple::Tuple * tuple)
override

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

Definition at line 501 of file NTupleSvc.cpp.

501 {
502 NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
503 if ( tuple ) {
504 try {
505 IConversionSvc* pSvc = tuple->conversionService();
506 IRegistry* pReg = tuple->registry();
507 if ( pSvc && pReg ) {
508 IOpaqueAddress* pAddr = pReg->address();
509 StatusCode sc = pSvc->updateRep( pAddr, n_tuple );
510 if ( sc.isSuccess() ) sc = pSvc->updateRepRefs( pAddr, n_tuple );
511 return sc;
512 }
513 return Status::NO_DATA_LOADER;
514 } catch ( ... ) {}
515 }
516 return Status::INVALID_OBJECT;
517}
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.

◆ updateDirectories()

StatusCode NTupleSvc::updateDirectories ( )
protected

Update directory data.

Definition at line 105 of file NTupleSvc.cpp.

105 {
106 long need_update = 0;
107 DataObject* pO = nullptr;
108 StatusCode iret = findObject( m_rootName.value(), pO );
109 // debug() << "in finalize()" << endmsg;
110 if ( iret.isSuccess() ) {
111 std::vector<IRegistry*> leaves;
112 iret = objectLeaves( pO, leaves );
113 if ( iret.isSuccess() ) {
114 // Only traverse the tree below the files
115 for ( auto d = leaves.begin(); d != leaves.end(); d++ ) {
116 if ( !( *d )->object() ) continue;
117 IOpaqueAddress* pA = ( *d )->address();
118 if ( !pA ) continue;
119 unsigned long typ = pA->ipar()[1];
120 if ( typ != 'R' && typ != 'N' && typ != 'U' ) continue;
121 // ...starting from the file entries: first save the directories/ntuples
122 IConversionSvc* svc = getDataLoader( *d );
123 if ( !svc ) continue;
124
126 IDataManagerSvc::traverseSubTree( ( *d )->object(), [&sel]( IRegistry* r, int ) {
127 DataObject* obj = r->object();
128 if ( obj ) sel.push_back( obj );
129 return true;
130 } ).ignore();
131 for ( DataObject* o : reverse( sel ) ) {
132 IRegistry* r = o->registry();
133 auto status = svc->updateRep( r->address(), o );
134 if ( !status.isSuccess() ) iret = status;
135 }
136 for ( DataObject* o : reverse( sel ) ) {
137 IRegistry* r = o->registry();
138 auto status = svc->updateRepRefs( r->address(), o );
139 if ( !status.isSuccess() ) iret = status;
140 }
141
142 if ( iret.isSuccess() ) need_update += sel.size();
143 }
144 }
145 }
146 if ( !iret.isSuccess() ) {
147 error() << "ERROR while saving NTuples" << endmsg;
148 return iret;
149 }
150 if ( need_update > 0 ) { info() << "NTuples saved successfully" << endmsg; }
151 return iret;
152}
std::vector< DataObject * > IDataSelector
This is only a placeholder to allow me compiling until the responsible guy does his work!
StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
Definition DataSvc.cpp:181
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
::details::reverse_wrapper< T > reverse(T &&iterable)
Definition reverse.h:58
virtual StatusCode traverseSubTree(std::string_view sub_tree_path, IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects below the sub tree identified by its full path name.

◆ writeRecord() [1/3]

StatusCode NTupleSvc::writeRecord ( const std::string & fullPath)
override

Write single record to N tuple.

Definition at line 553 of file NTupleSvc.cpp.

553 {
554 NTuple::Tuple* pObj = nullptr;
555 StatusCode status = findObject( fullPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
556 return status.isSuccess() ? writeRecord( pObj ) : Status::INVALID_OBJ_PATH;
557}
StatusCode writeRecord(NTuple::Tuple *tuple) override
Write single record to N tuple.

◆ writeRecord() [2/3]

StatusCode NTupleSvc::writeRecord ( DataObject * pParent,
const std::string & relPath )
override

Write single record to N tuple.

Definition at line 560 of file NTupleSvc.cpp.

560 {
561 NTuple::Tuple* pObj = nullptr;
562 StatusCode status = findObject( pParent, relPath, *pp_cast<DataObject>( &pObj ) ); // Check if object is present
563 return status.isSuccess() ? writeRecord( pObj ) : Status::INVALID_OBJ_PATH;
564}

◆ writeRecord() [3/3]

StatusCode NTupleSvc::writeRecord ( NTuple::Tuple * tuple)
override

Write single record to N tuple.

Definition at line 527 of file NTupleSvc.cpp.

527 {
528 NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
529 if ( tuple ) {
530 try {
531 IConversionSvc* pSvc = tuple->conversionService();
532 if ( !pSvc ) {
533 pSvc = getDataLoader( n_tuple->registry() );
534 tuple->setConversionService( pSvc );
535 }
536 if ( pSvc ) {
537 IRegistry* pReg = n_tuple->registry();
538 IOpaqueAddress* pAddr = pReg->address();
539 StatusCode status = pSvc->createRep( n_tuple, pAddr );
540 if ( status.isSuccess() ) {
541 pReg->setAddress( pAddr );
542 status = pSvc->fillRepRefs( pAddr, n_tuple );
543 }
544 return status;
545 }
546 return Status::NO_DATA_LOADER;
547 } catch ( ... ) {}
548 }
549 return Status::INVALID_OBJECT;
550}

Member Data Documentation

◆ m_basketsize

Gaudi::Property<int> NTupleSvc::m_basketsize { this, "BasketSize", 32000, "BasketSize" }
protected

Definition at line 127 of file NTupleSvc.h.

127{ this, "BasketSize", 32000, "BasketSize" }; // ROOT default

◆ m_connections

std::map<std::string, Connection> NTupleSvc::m_connections
protected

Container of connection points.

Definition at line 129 of file NTupleSvc.h.

◆ m_input

Gaudi::Property<DBaseEntries> NTupleSvc::m_input { this, "Input", {}, "input streams" }
protected

Definition at line 124 of file NTupleSvc.h.

124{ this, "Input", {}, "input streams" };

◆ m_output

Gaudi::Property<DBaseEntries> NTupleSvc::m_output { this, "Output", {}, "output streams" }
protected

Definition at line 125 of file NTupleSvc.h.

125{ this, "Output", {}, "output streams" };

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