NTupleSvc Class Reference

NTuple service. More...

#include <src/NTupleSvc/NTupleSvc.h>

Inheritance diagram for NTupleSvc:
Collaboration diagram for NTupleSvc:

Classes

struct  Connection
 

Public Member Functions

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

Protected Types

typedef std::vector< std::stringDBaseEntries
 
typedef std::map< std::string, ConnectionConnections
 
typedef std::pair< std::string, std::stringProp
 

Protected Member Functions

StatusCode createService (const std::string &nam, const std::string &typ, const std::vector< Prop > &props, IConversionSvc *&pSvc)
 Create conversion service. More...
 
void releaseConnection (Connection &c)
 Finalize single service. More...
 
StatusCode attachTuple (const std::string &filename, const std::string &logname, const char typ, const long t)
 Attach output/input file. More...
 
StatusCode updateDirectories ()
 Update directory data. More...
 
- Protected Member Functions inherited from DataSvc
bool checkRoot ()
 Check if root path is valid. More...
 
virtual DataObjectcreateDefaultObject () const
 Create default objects in case forced creation of leaves is requested. More...
 
virtual StatusCode loadObject (IRegistry *pNode)
 Invoke Persistency service to create transient object from its persistent representation. More...
 
virtual StatusCode loadObject (IConversionSvc *pLoader, IRegistry *pNode)
 Invoke Persistency service to create transient object from its persistent representation. More...
 
StatusCode retrieveEntry (DataSvcHelpers::RegistryEntry *pNode, const std::string &path, DataSvcHelpers::RegistryEntry *&pEntry)
 Retrieve registry entry from store. More...
 
DataObjecthandleDataFault (IRegistry *pReg, const std::string &path="")
 Invoke data fault handling if enabled. More...
 
- Protected Member Functions inherited from Service
 ~Service () override
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Protected Attributes

DBaseEntries m_output
 Output streams. More...
 
DBaseEntries m_input
 Input streams. More...
 
Connections m_connections
 Container of connection points. More...
 
- Protected Attributes inherited from DataSvc
CLID m_rootCLID = 110
 Integer Property corresponding to CLID of root entry. More...
 
std::string m_rootName = "/Event"
 Name of root event. More...
 
SmartIF< IConversionSvcm_dataLoader = nullptr
 Pointer to data loader service. More...
 
SmartIF< IIncidentSvcm_incidentSvc = nullptr
 Pointer to incident service. More...
 
LoadItems m_preLoads
 Items to be pre-loaded. More...
 
bool m_forceLeaves = false
 Allow forced creation of default leaves on registerObject. More...
 
bool m_enableAccessHdlr = false
 Flag to enable interrupts on data access requests. More...
 
bool m_enableFaultHdlr = false
 Flag to enable interrupts on data creation requests. More...
 
DataSvcHelpers::RegistryEntrym_root = nullptr
 Pointer to root entry. More...
 
DataSvcHelpers::InhibitMap * m_inhibitMap = nullptr
 Map with object paths to be inhibited from loading. More...
 
std::vector< std::stringm_inhibitPathes
 Property for the inhibited leaves. More...
 
std::string m_accessName = "DataAccess"
 Name of the data access incident. More...
 
std::string m_faultName = "DataFault"
 Name of the data fault incident. More...
 
- Protected Attributes inherited from Service
IntegerProperty m_outputLevel = MSG::NIL
 Service output level. More...
 
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state. More...
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state. More...
 

Additional Inherited Members

- Public Types inherited from extends< DataSvc, INTupleSvc, IDataSourceMgr >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
- Public Types inherited from DataSvc
typedef std::vector< DataStoreItemLoadItems
 Define set of load items. More...
 
- Public Types inherited from extends< Service, IDataProviderSvc, IDataManagerSvc >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
- Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > Factory
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Public Types inherited from extend_interfaces< Interfaces...>
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 

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 24 of file NTupleSvc.h.

Member Typedef Documentation

Definition at line 36 of file NTupleSvc.h.

Definition at line 35 of file NTupleSvc.h.

Definition at line 37 of file NTupleSvc.h.

Constructor & Destructor Documentation

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

Standard Constructor.

Definition at line 60 of file NTupleSvc.cpp.

61  : base_class(name, svc)
62 {
63  declareProperty("Input", m_input);
64  declareProperty("Output", m_output);
65  m_rootName = "/NTUPLES";
66  m_rootCLID = CLID_DataObject;
67 }
std::string m_rootName
Name of root event.
Definition: DataSvc.h:55
extends base_class
Typedef to this class.
Definition: extends.h:14
DBaseEntries m_input
Input streams.
Definition: NTupleSvc.h:126
DBaseEntries m_output
Output streams.
Definition: NTupleSvc.h:124
CLID m_rootCLID
Integer Property corresponding to CLID of root entry.
Definition: DataSvc.h:53
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:215
NTupleSvc::~NTupleSvc ( )
virtual

Standard Destructor.

Definition at line 70 of file NTupleSvc.cpp.

70  {
71 }

Member Function Documentation

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

Access N tuple on disk.

Definition at line 519 of file NTupleSvc.cpp.

519  {
520  return nullptr;
521 }
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 461 of file NTupleSvc.cpp.

461  {
462  DataObject* p;
463  // First get the root object
464  StatusCode status = retrieveObject(m_rootName, p);
465  if ( status.isSuccess() ) {
466  // Now add the registry entry to the store
467  std::string entryname = m_rootName;
468  entryname += '/';
469  entryname += logname;
470  GenericAddress* pA =
471  new GenericAddress(t, CLID_NTupleFile, filename, entryname, 0, typ);
472  status = registerAddress(p, logname, pA);
473  if ( status.isSuccess() ) {
474  info() << "Added stream file:" << filename << " as " << logname << endmsg;
475  return status;
476  }
477  pA->release();
478  }
479  error() << "Cannot add file:" << filename << " as " << logname << endmsg;
480  return status;
481 }
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
unsigned long release() override
release reference to object
std::string m_rootName
Name of root event.
Definition: DataSvc.h:55
Generic Transient Address.
StatusCode registerAddress(const std::string &fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:244
STL class.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:763
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
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 355 of file NTupleSvc.cpp.

355  {
356  DataObject* pObj = nullptr;
357  std::string path = fullPath;
358  if ( path[0] != SEPARATOR ) {
359  path = m_rootName;
360  path += SEPARATOR;
361  path += fullPath;
362  }
363  StatusCode status = retrieveObject(path, pObj);
364  if ( status.isSuccess() ) {
365  error() << "Cannot book N-tuple " << path << " (Exists already)" << endmsg;
366  return nullptr;
367  }
368  auto sep = path.rfind(SEPARATOR);
369  if ( sep == std::string::npos ) {
370  error() << "Cannot book N-tuple " << path << " (Invalid path)" << endmsg;
371  return nullptr;
372  }
373 
374  std::string p_path (path, 0, sep);
375  std::string o_path (path, sep, path.length());
376  DataObject* dir = createDirectory(p_path);
377  if ( !dir ) {
378  error() << "Cannot book N-tuple " << path << " (Invalid parent directory)" << endmsg;
379  return nullptr;
380  }
381 
382  NTuple::Tuple* tup = book( dir, o_path, type, title);
383  if ( !tup ) {
384  error() << "Cannot book N-tuple " << path << " (Unknown reason)" << endmsg;
385  }
386  return tup;
387 }
constexpr char SEPARATOR
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
std::string m_rootName
Name of root event.
Definition: DataSvc.h:55
T rfind(T...args)
virtual NTuple::Directory * createDirectory(DataObject *pParent, const std::string &title)
Create Ntuple directory and register it with the data store.
Definition: NTupleSvc.cpp:429
STL class.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
string type
Definition: gaudirun.py:151
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:763
virtual NTuple::Tuple * book(const std::string &fullPath, const CLID &type, const std::string &title)
Book Ntuple and register it with the data store.
Definition: NTupleSvc.cpp:355
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
T length(T...args)
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
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 390 of file NTupleSvc.cpp.

390  {
391  std::string full = dirPath;
392  if (relPath[0] != SEPARATOR) full += SEPARATOR;
393  full += relPath;
394  return book(full, type, title);
395 }
constexpr char SEPARATOR
STL class.
string type
Definition: gaudirun.py:151
virtual NTuple::Tuple * book(const std::string &fullPath, const CLID &type, const std::string &title)
Book Ntuple and register it with the data store.
Definition: NTupleSvc.cpp:355
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 398 of file NTupleSvc.cpp.

398  {
399  return book( dirPath, toStr(id), type, title);
400 }
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
Definition: IAuditor.h:106
string type
Definition: gaudirun.py:151
virtual NTuple::Tuple * book(const std::string &fullPath, const CLID &type, const std::string &title)
Book Ntuple and register it with the data store.
Definition: NTupleSvc.cpp:355
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 403 of file NTupleSvc.cpp.

403  {
404  NTuple::Tuple* pObj = nullptr;
405  // Check if object is already present
406  StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj));
407  // No ? Then create it!
408  if ( !status.isSuccess() ) {
409  status = create( type, title, pObj);
410  if ( status.isSuccess() ) {
411  // Finally register the created N tuple with the store
412  status = registerObject(pParent, relPath, pObj);
413  if ( status.isSuccess() ) return pObj;
414  pObj->release();
415  }
416  }
417  return nullptr;
418 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
StatusCode registerObject(const std::string &fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:356
string type
Definition: gaudirun.py:151
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:56
virtual StatusCode create(const CLID &typ, const std::string &title, NTuple::Tuple *&refpTuple)
Create requested N tuple (Hide constructor)
Definition: NTupleSvc.cpp:334
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 421 of file NTupleSvc.cpp.

424  {
425  return book( pParent, toStr(id), type, title);
426 }
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
Definition: IAuditor.h:106
string type
Definition: gaudirun.py:151
virtual NTuple::Tuple * book(const std::string &fullPath, const CLID &type, const std::string &title)
Book Ntuple and register it with the data store.
Definition: NTupleSvc.cpp:355
StatusCode NTupleSvc::connect ( const std::string ident)
virtual

Add file to list I/O list.

Definition at line 206 of file NTupleSvc.cpp.

206  {
207  std::string logName;
208  return connect(ident, logName);
209 }
STL class.
virtual StatusCode connect(const std::string &ident)
Add file to list I/O list.
Definition: NTupleSvc.cpp:206
StatusCode NTupleSvc::connect ( const std::string ident,
std::string logname 
)
virtual

Add file to list I/O list.

Reimplemented in TagCollectionSvc.

Definition at line 211 of file NTupleSvc.cpp.

211  {
212  DataObject* pO = nullptr;
213  StatusCode status = findObject(m_rootName, pO);
214  if ( status.isSuccess() ) {
215  char typ=0;
216  std::vector<Prop> props;
217  long loc = ident.find(" ");
218  std::string filename, auth, svc = "", db_typ = "";
219  logname = ident.substr(0, loc);
220  using Parser = Gaudi::Utils::AttribStringParser;
221  // we assume that there is always a " "
222  // (but if it is not there, we probably will not match the pattern)
223  for (auto attrib: Parser(ident.substr(loc + 1))) {
224  switch( ::toupper(attrib.tag[0]) ) {
225  case 'A':
226  break;
227  case 'F': // FILE='<file name>'
228  case 'D': // DATAFILE='<file name>'
229  filename = std::move(attrib.value);
230  break;
231  case 'O': // OPT='<NEW<CREATE,WRITE>, UPDATE, READ>'
232  switch( ::toupper(attrib.value[0]) ) {
233  case 'C':
234  case 'N':
235  case 'W':
236  typ = 'N';
237  break;
238  case 'U':
239  typ = 'U';
240  break;
241  case 'O':
242  case 'R':
243  typ = 'O';
244  break;
245  default:
246  typ = 0;
247  break;
248  }
249  break;
250  case 'T': // TYP='<HBOOK,ROOT,OBJY,...>'
251  db_typ = std::move(attrib.value);
252  break;
253  default:
254  props.emplace_back( attrib.tag, attrib.value);
255  break;
256  }
257  }
258  if ( 0 != typ ) {
259  IConversionSvc* pSvc = nullptr;
260  status = createService(name()+'.'+logname, db_typ, props, pSvc);
261  if ( status.isSuccess() ) {
262  status = attachTuple(filename, logname, typ, pSvc->repSvcType());
263  if ( status.isSuccess() ) {
264  m_connections.insert(Connections::value_type(m_rootName+'/'+logname,Connection(pSvc)));
265  return StatusCode::SUCCESS;
266  }
267  }
268  }
269  }
270  error() << "Cannot add " << ident << " invalid filename!" << endmsg;
271  return StatusCode::FAILURE;
272 }
Parse attribute strings allowing iteration over the various attributes.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
std::string m_rootName
Name of root event.
Definition: DataSvc.h:55
StatusCode createService(const std::string &nam, const std::string &typ, const std::vector< Prop > &props, IConversionSvc *&pSvc)
Create conversion service.
Definition: NTupleSvc.cpp:274
STL class.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
T move(T...args)
T insert(T...args)
T find(T...args)
STL class.
T substr(T...args)
StatusCode attachTuple(const std::string &filename, const std::string &logname, const char typ, const long t)
Attach output/input file.
Definition: NTupleSvc.cpp:461
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
void toupper(std::string &s)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
T emplace_back(T...args)
Connections m_connections
Container of connection points.
Definition: NTupleSvc.h:128
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 334 of file NTupleSvc.cpp.

334  {
335  NTuple::TupleImp* pTuple = nullptr;
337  if ( typ == CLID_ColumnWiseTuple ) {
338  pTuple = new NTuple::ColumnWiseTuple( title );
339  }
340  else if ( typ == CLID_RowWiseTuple ) {
341  pTuple = new NTuple::RowWiseTuple( title );
342  }
343  else {
345  }
346  if ( pTuple ) {
347  pTuple->setTupleService(this);
348  status = StatusCode::SUCCESS;
349  }
350  refpTuple = pTuple;
351  return status;
352 }
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
void setTupleService(INTupleSvc *svc)
Access conversion service.
NTuple::Directory * NTupleSvc::createDirectory ( DataObject pParent,
const std::string title 
)
virtual

Create Ntuple directory and register it with the data store.

Definition at line 429 of file NTupleSvc.cpp.

430  {
431  if ( pParent ) {
432  IRegistry* pDir = pParent->registry();
433  if ( pDir ) {
434  std::string full = pDir->identifier();
435  if (relPath[0]!='/') full += "/";
436  full += relPath;
437  return createDirectory(full);
438  }
439  }
440  return nullptr;
441 }
virtual NTuple::Directory * createDirectory(DataObject *pParent, const std::string &title)
Create Ntuple directory and register it with the data store.
Definition: NTupleSvc.cpp:429
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
STL class.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual const id_type & identifier() const =0
Full identifier (or key)
NTuple::Directory * NTupleSvc::createDirectory ( DataObject pParent,
long  id 
)
virtual

Create Ntuple directory and register it with the data store.

Definition at line 444 of file NTupleSvc.cpp.

444  {
445  return createDirectory( pParent, toStr(id) );
446 }
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
Definition: IAuditor.h:106
virtual NTuple::Directory * createDirectory(DataObject *pParent, const std::string &title)
Create Ntuple directory and register it with the data store.
Definition: NTupleSvc.cpp:429
NTuple::Directory * NTupleSvc::createDirectory ( const std::string dirPath,
long  id 
)
virtual

Create Ntuple directory and register it with the data store.

Definition at line 449 of file NTupleSvc.cpp.

449  {
450  return createDirectory( dirPath, toStr(id) );
451 }
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
Definition: IAuditor.h:106
virtual NTuple::Directory * createDirectory(DataObject *pParent, const std::string &title)
Create Ntuple directory and register it with the data store.
Definition: NTupleSvc.cpp:429
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 454 of file NTupleSvc.cpp.

454  {
455  std::string full = dirPath;
456  if (relPath[0]!='/') full += "/";
457  full += relPath;
458  return createDirectory(full);
459 }
virtual NTuple::Directory * createDirectory(DataObject *pParent, const std::string &title)
Create Ntuple directory and register it with the data store.
Definition: NTupleSvc.cpp:429
STL class.
NTuple::Directory * NTupleSvc::createDirectory ( const std::string fullPath)
virtual

Create Ntuple directory and register it with the data store.

Definition at line 484 of file NTupleSvc.cpp.

484  {
485  NTuple::Directory* p = nullptr;
486  StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&p));
487  if ( !status.isSuccess() ) {
488  auto sep2 = fullPath.rfind(SEPARATOR);
489  if ( sep2 != std::string::npos ) {
490  std::string relPath = fullPath.substr(0, sep2);
491  p = createDirectory(relPath);
492  if ( p ) {
493  p = new NTuple::Directory();
494  // Finally register the created N tuple with the store
495  status = registerObject(fullPath, p);
496  if ( status.isSuccess() ) {
497  // ...starting from the file entries
499  if ( svc ) {
500  IOpaqueAddress* pAddr = nullptr;
501  status = svc->createRep (p, pAddr);
502  if ( status.isSuccess() ) {
503  p->registry()->setAddress(pAddr);
504  status = svc->fillRepRefs (pAddr, p);
505  if ( status.isSuccess() ) return p;
506  }
507  }
508  unregisterObject(p);
509  }
510  p->release();
511  p = nullptr;
512  }
513  }
514  }
515  return dynamic_cast<NTuple::Directory*>(p);
516 }
StatusCode unregisterObject(const std::string &fullPath) override
Unregister object from the data store.
Definition: DataSvc.cpp:471
constexpr char SEPARATOR
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
T rfind(T...args)
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
StatusCode registerObject(const std::string &fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:356
virtual NTuple::Directory * createDirectory(DataObject *pParent, const std::string &title)
Create Ntuple directory and register it with the data store.
Definition: NTupleSvc.cpp:429
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
STL class.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
DataSvc overrides: Retrieve data loader.
Definition: NTupleSvc.cpp:107
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:56
virtual void setAddress(IOpaqueAddress *pAddress)=0
Set/Update Opaque storage address.
T substr(T...args)
Opaque address interface definition.
Small class representing an N tuple directory in the transient store.
Definition: NTuple.h:1068
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
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 274 of file NTupleSvc.cpp.

278 {
280  // Get the value of the Stat persistancy mechanism from the AppMgr
281  auto appPropMgr = serviceLocator()->as<IProperty>();
282  if( !appPropMgr ) {
283  // Report an error and return the FAILURE status code
284  error() << "Could not get PropMgr" << endmsg;
285  return StatusCode::FAILURE;
286  }
287 
288  StringProperty sp("HistogramPersistency","");
289  StatusCode sts = appPropMgr->getProperty( &sp );
290  if ( !sts.isSuccess() ) {
291  error() << "Could not get NTuple Persistency format"
292  << " from ApplicationMgr properties" << endmsg;
293  return sts;
294  }
295 
296  long storage_typ = TEST_StorageType;
297  if ( sp.value() == "HBOOK" ) {
298  storage_typ = HBOOK_StorageType;
299  }
300  else if ( sp.value() == "ROOT" ) {
301  storage_typ = ROOT_StorageType;
302  }
303  else {
304  error() << "Unknown NTuple Persistency format: " << sp.value() << endmsg;
305  return StatusCode::FAILURE;
306  }
307 
308  if ( !typ.empty() && typ != sp.value() ) {
309  warning() << "NTuple persistency type is "
310  << sp.value() << "." << endmsg
311  << "Type given by job option "
312  << "NTupleSvc.Input/Output ignored!" << endmsg;
313  }
314 
315  // debug() << "storage type: " << m_storageType << endmsg;
316 
317  // FIXME: (MCl) why NTupleSvc has to directly create a ConversionSvc?
318  IInterface* iface = new ConversionSvc(name()+"Conversions", serviceLocator(), storage_typ);
319  auto pService = SmartIF<IService>( iface );
320  if ( !pService ) return StatusCode::FAILURE;
321 
322  auto cnvSvc = pService.as<IConversionSvc>();
323  if (!cnvSvc) return StatusCode::FAILURE;
324 
325  pSvc = cnvSvc.get();
326  pSvc->addRef(); // make sure the caller gets a pSvc which points at something
327  // with a refCount of (at least) one...
328  auto status = pService->sysInitialize();
329  if ( !status.isSuccess() ) return status;
330  return pSvc->setDataProvider(this);
331 }
const long TEST_StorageType
Definition: ClassID.h:49
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
T empty(T...args)
const long HBOOK_StorageType
Definition: ClassID.h:56
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
SmartIF< IFace > as()
Definition: ISvcLocator.h:106
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Definition of the basic interface.
Definition: IInterface.h:234
const long ROOT_StorageType
Definition: ClassID.h:52
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
Base class for all conversion services.
Definition: ConversionSvc.h:46
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:21
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode NTupleSvc::disconnect ( const std::string nam)
virtual

Close open connection.

Definition at line 180 of file NTupleSvc.cpp.

180  {
181  auto i = m_connections.find(nam);
182  if ( i != m_connections.end() ) {
183  releaseConnection(i->second);
185  return StatusCode::SUCCESS;
186  }
187  return StatusCode::FAILURE;
188 }
void releaseConnection(Connection &c)
Finalize single service.
Definition: NTupleSvc.cpp:172
T end(T...args)
T erase(T...args)
T find(T...args)
list i
Definition: ana.py:128
Connections m_connections
Container of connection points.
Definition: NTupleSvc.h:128
StatusCode NTupleSvc::disconnectAll ( )
virtual

Close all open connections.

Definition at line 191 of file NTupleSvc.cpp.

191  {
192  for(auto &i : m_connections ) releaseConnection(i.second);
193  m_connections.clear();
194  return StatusCode::SUCCESS;
195 }
void releaseConnection(Connection &c)
Finalize single service.
Definition: NTupleSvc.cpp:172
list i
Definition: ana.py:128
Connections m_connections
Container of connection points.
Definition: NTupleSvc.h:128
StatusCode NTupleSvc::finalize ( )
virtual

DataSvc overrides: stop the service.

stop the service.

Definition at line 198 of file NTupleSvc.cpp.

198  {
199  StatusCode status = updateDirectories();
200  status = clearStore();
201  status = DataSvc::finalize();
202  status = disconnectAll();
203  return status;
204 }
StatusCode updateDirectories()
Update directory data.
Definition: NTupleSvc.cpp:118
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode finalize() override
Service initialization.
Definition: DataSvc.cpp:1188
virtual StatusCode disconnectAll()
Close all open connections.
Definition: NTupleSvc.cpp:191
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:114
IConversionSvc * NTupleSvc::getDataLoader ( IRegistry pReg)
virtual

DataSvc overrides: Retrieve data loader.

DataSvc override: Retrieve data loader.

Reimplemented from DataSvc.

Definition at line 107 of file NTupleSvc.cpp.

107  {
108  if ( !pRegistry ) return nullptr;
109  std::string full = pRegistry->identifier();
110  auto len = m_rootName.length();
111  auto idx = full.find(SEPARATOR,len+1);
112  std::string path = (idx==std::string::npos) ? full : full.substr(0, idx);
113  auto i = m_connections.find(path);
114  return ( i != m_connections.end() ) ? i->second.service
115  : nullptr;
116 }
constexpr char SEPARATOR
std::string m_rootName
Name of root event.
Definition: DataSvc.h:55
T end(T...args)
STL class.
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
T find(T...args)
T length(T...args)
T substr(T...args)
list i
Definition: ana.py:128
Connections m_connections
Container of connection points.
Definition: NTupleSvc.h:128
StatusCode NTupleSvc::initialize ( )
virtual

DataSvc overrides: Initialize the service.

Initialize the service.

Definition at line 74 of file NTupleSvc.cpp.

74  {
76  if ( status.isSuccess() ) {
77  status = setProperties();
78  if ( status.isSuccess() ) {
81  status = setRoot(m_rootName, root);
82  for ( auto& i : m_output ) {
83  iret = connect(i);
84  if ( !iret.isSuccess() ) status = iret;
85  }
86  for ( auto& j : m_input ) {
87  iret = connect(j);
88  if ( !iret.isSuccess() ) status = iret;
89  }
90  }
91  }
92  return status;
93 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
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:153
std::string m_rootName
Name of root event.
Definition: DataSvc.h:55
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual StatusCode connect(const std::string &ident)
Add file to list I/O list.
Definition: NTupleSvc.cpp:206
StatusCode setProperties()
Method for setting declared properties to the values specified for the job.
Definition: Service.cpp:363
DBaseEntries m_input
Input streams.
Definition: NTupleSvc.h:126
StatusCode initialize() override
Service initialization.
Definition: DataSvc.cpp:1153
DBaseEntries m_output
Output streams.
Definition: NTupleSvc.h:124
tuple root
Definition: IOTest.py:42
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
Small class representing an N tuple directory in the transient store.
Definition: NTuple.h:1068
list i
Definition: ana.py:128
bool NTupleSvc::isConnected ( const std::string identifier) const
virtual

Check if a datasource is connected.

Definition at line 101 of file NTupleSvc.cpp.

101  {
102  auto i = m_connections.find(identifier);
103  return i!=m_connections.end();
104 }
T end(T...args)
T find(T...args)
list i
Definition: ana.py:128
Connections m_connections
Container of connection points.
Definition: NTupleSvc.h:128
StatusCode NTupleSvc::readRecord ( NTuple::Tuple tuple)
virtual

Read single record from N tuple.

Definition at line 603 of file NTupleSvc.cpp.

603  {
604  StatusCode status = INVALID_OBJECT;
605  NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
606  if ( tuple ) {
607  try {
608  IConversionSvc* pSvc = tuple->conversionService();
609  if ( !pSvc ) {
610  pSvc = getDataLoader(n_tuple->registry());
611  tuple->setConversionService(pSvc);
612  }
613  if ( pSvc ) {
614  IRegistry* pReg = n_tuple->registry();
615  IOpaqueAddress* pAddr = pReg->address();
616  status = pSvc->updateObj(pAddr, n_tuple);
617  if ( status.isSuccess() ) {
618  status = pSvc->updateObjRefs(pAddr, n_tuple);
619  }
620  return status;
621  }
623  }
624  catch(...) {
625  status = INVALID_OBJECT;
626  }
627  }
628  return status;
629 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
No data loader available.
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
DataSvc overrides: Retrieve data loader.
Definition: NTupleSvc.cpp:107
void setConversionService(IConversionSvc *svc)
Access conversion service.
Opaque address interface definition.
IConversionSvc * conversionService() const
Access conversion service.
StatusCode NTupleSvc::readRecord ( const std::string fullPath)
virtual

Read single record from N tuple.

Definition at line 632 of file NTupleSvc.cpp.

632  {
633  NTuple::Tuple* pObj = nullptr;
634  StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
635  return status.isSuccess() ? readRecord ( pObj ) : INVALID_OBJ_PATH;
636 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
virtual StatusCode readRecord(NTuple::Tuple *tuple)
Read single record from N tuple.
Definition: NTupleSvc.cpp:603
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
StatusCode NTupleSvc::readRecord ( DataObject pParent,
const std::string relPath 
)
virtual

Read single record from N tuple.

Definition at line 639 of file NTupleSvc.cpp.

639  {
640  NTuple::Tuple* pObj = nullptr;
641  StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
642  return status.isSuccess() ? readRecord ( pObj ) : INVALID_OBJ_PATH;
643 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
virtual StatusCode readRecord(NTuple::Tuple *tuple)
Read single record from N tuple.
Definition: NTupleSvc.cpp:603
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
StatusCode NTupleSvc::reinitialize ( )
virtual

DataSvc overrides: reinitialize service.

Initialize the service.

Definition at line 96 of file NTupleSvc.cpp.

96  {
97  return StatusCode::SUCCESS;
98 }
void NTupleSvc::releaseConnection ( Connection c)
protected

Finalize single service.

Definition at line 172 of file NTupleSvc.cpp.

172  {
173  SmartIF<IService> isvc( c.service );
174  if ( isvc ) isvc->finalize().ignore();
175  c.service->release();
176  c.service = nullptr;
177 }
tuple c
Definition: gaudirun.py:391
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 524 of file NTupleSvc.cpp.

524  {
525  NTuple::Tuple* pObj = nullptr;
526  StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
527  return status.isSuccess() ? save ( pObj ) : INVALID_OBJ_PATH;
528 }
virtual StatusCode save(const std::string &fullPath)
Save N tuple to disk. Must be called in order to close the ntuple file properly.
Definition: NTupleSvc.cpp:524
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
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 531 of file NTupleSvc.cpp.

531  {
532  NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
533  if ( tuple ) {
534  try {
535  IConversionSvc* pSvc = tuple->conversionService();
536  IRegistry* pReg = tuple->registry();
537  if ( pSvc && pReg ) {
538  IOpaqueAddress* pAddr = pReg->address();
539  StatusCode status = pSvc->updateRep(pAddr, n_tuple);
540  if ( status.isSuccess() ) {
541  status = pSvc->updateRepRefs(pAddr, n_tuple);
542  }
543  return status;
544  }
546  }
547  catch(...) {
548  }
549  }
550  return INVALID_OBJECT;
551 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
No data loader available.
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
Opaque address interface definition.
IConversionSvc * conversionService() const
Access conversion service.
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 554 of file NTupleSvc.cpp.

554  {
555  NTuple::Tuple* pObj = nullptr;
556  StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
557  return status.isSuccess() ? save ( pObj ) : INVALID_OBJ_PATH;
558 }
virtual StatusCode save(const std::string &fullPath)
Save N tuple to disk. Must be called in order to close the ntuple file properly.
Definition: NTupleSvc.cpp:524
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
StatusCode NTupleSvc::updateDirectories ( )
protected

Update directory data.

Definition at line 118 of file NTupleSvc.cpp.

118  {
119  typedef std::vector<IRegistry*> Leaves;
120  long need_update = 0;
121  DataObject* pO = nullptr;
122  StatusCode iret = findObject(m_rootName, pO);
123  // debug() << "in finalize()" << endmsg;
124  if ( iret.isSuccess() ) {
125  Leaves leaves;
126  iret = objectLeaves(pO, leaves);
127  if ( iret.isSuccess() ) {
128  // Only traverse the tree below the files
129  for ( auto d = leaves.begin(); d != leaves.end(); d++ ) {
130  if ( !(*d)->object() ) continue;
131  IOpaqueAddress* pA = (*d)->address();
132  if ( !pA ) continue;
133  unsigned long typ = pA->ipar()[1];
134  if ( typ != 'R' && typ != 'N' && typ != 'U' ) continue;
135  // ...starting from the file entries: first save the directories/ntuples
136  IConversionSvc* svc = getDataLoader(*d);
137  if ( !svc ) continue;
138 
139  StatusCode status;
140  DataSelectionAgent agent;
141  IDataSelector* sel = agent.selectedObjects();
142  traverseSubTree ( (*d)->object(), &agent ).ignore();
143  for(int i = sel->size()-1; i >= 0; i-- ) {
144  DataObject* o = (*sel)[i];
145  IRegistry* r = o->registry();
146  status = svc->updateRep(r->address(), o);
147  if ( !status.isSuccess() ) {
148  iret = status;
149  }
150  }
151  for(int j = sel->size()-1; j >= 0; j-- ) {
152  DataObject* o = (*sel)[j];
153  IRegistry* r = o->registry();
154  status = svc->updateRepRefs(r->address(), o);
155  if ( !status.isSuccess() ) iret = status;
156  }
157  if ( iret.isSuccess() ) need_update += sel->size();
158  }
159  }
160  }
161  if ( !iret.isSuccess() ) {
162  error() << "ERROR while saving NTuples" << endmsg;
163  return iret;
164  }
165  else if ( need_update > 0 ) {
166  info() << "NTuples saved successfully" << endmsg;
167  }
168  return iret;
169 }
DataSelectionAgent base in charge of collecting all the refereces to DataObjects in a transient store...
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
std::string m_rootName
Name of root event.
Definition: DataSvc.h:55
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
IDataSelector * selectedObjects()
Return the set of selected DataObjects.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
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:225
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
DataSvc overrides: Retrieve data loader.
Definition: NTupleSvc.cpp:107
T size(T...args)
Opaque address interface definition.
StatusCode traverseSubTree(const std::string &sub_tree_path, IDataStoreAgent *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full pat...
Definition: DataSvc.cpp:126
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
list i
Definition: ana.py:128
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode NTupleSvc::writeRecord ( NTuple::Tuple tuple)
virtual

Write single record to N tuple.

Definition at line 561 of file NTupleSvc.cpp.

561  {
562  NTuple::TupleImp* tuple = (NTuple::TupleImp*)n_tuple;
563  if ( tuple ) {
564  try {
565  IConversionSvc* pSvc = tuple->conversionService();
566  if ( !pSvc ) {
567  pSvc = getDataLoader(n_tuple->registry());
568  tuple->setConversionService(pSvc);
569  }
570  if ( pSvc ) {
571  IRegistry* pReg = n_tuple->registry();
572  IOpaqueAddress* pAddr = pReg->address();
573  StatusCode status = pSvc->createRep(n_tuple, pAddr);
574  if ( status.isSuccess() ) {
575  pReg->setAddress(pAddr);
576  status = pSvc->fillRepRefs(pAddr, n_tuple);
577  }
578  return status;
579  }
581  }
582  catch(...) {
583  }
584  }
585  return INVALID_OBJECT;
586 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
No data loader available.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
DataSvc overrides: Retrieve data loader.
Definition: NTupleSvc.cpp:107
virtual void setAddress(IOpaqueAddress *pAddress)=0
Set/Update Opaque storage address.
void setConversionService(IConversionSvc *svc)
Access conversion service.
Opaque address interface definition.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
IConversionSvc * conversionService() const
Access conversion service.
StatusCode NTupleSvc::writeRecord ( const std::string fullPath)
virtual

Write single record to N tuple.

Definition at line 589 of file NTupleSvc.cpp.

589  {
590  NTuple::Tuple* pObj = nullptr;
591  StatusCode status = findObject(fullPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
592  return status.isSuccess() ? writeRecord ( pObj ) : INVALID_OBJ_PATH;
593 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
virtual StatusCode writeRecord(NTuple::Tuple *tuple)
Write single record to N tuple.
Definition: NTupleSvc.cpp:561
StatusCode NTupleSvc::writeRecord ( DataObject pParent,
const std::string relPath 
)
virtual

Write single record to N tuple.

Definition at line 596 of file NTupleSvc.cpp.

596  {
597  NTuple::Tuple* pObj = nullptr;
598  StatusCode status = findObject(pParent, relPath, *pp_cast<DataObject>(&pObj)); // Check if object is present
599  return status.isSuccess() ? writeRecord ( pObj ) : INVALID_OBJ_PATH;
600 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
virtual StatusCode writeRecord(NTuple::Tuple *tuple)
Write single record to N tuple.
Definition: NTupleSvc.cpp:561

Member Data Documentation

Connections NTupleSvc::m_connections
protected

Container of connection points.

Definition at line 128 of file NTupleSvc.h.

DBaseEntries NTupleSvc::m_input
protected

Input streams.

Definition at line 126 of file NTupleSvc.h.

DBaseEntries NTupleSvc::m_output
protected

Output streams.

Definition at line 124 of file NTupleSvc.h.


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