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

A DataSvc specialized in detector data. More...

#include <DetectorDataSvc/DetDataSvc.h>

Inheritance diagram for DetDataSvc:
Collaboration diagram for DetDataSvc:

Public Member Functions

StatusCode initialize () override
 Initialize the service.
 
StatusCode reinitialize () override
 Initialize the service.
 
StatusCode finalize () override
 Finalize the service.
 
StatusCode clearStore () override
 Remove all data objects in the data store.
 
StatusCode updateObject (DataObject *toUpdate) override
 Update object.
 
 DetDataSvc (const std::string &name, ISvcLocator *svc)
 Standard Constructor.
 
 ~DetDataSvc () override=default
 Standard Destructor.
 
bool validEventTime () const override
 Check if the event time has been set.
 
const Gaudi::TimeeventTime () const override
 Get the event time.
 
void setEventTime (const Gaudi::Time &time) override
 Set the new event time.
 
void handle (const Incident &) override
 Inform that a new incident has occured.
 
- Public Member Functions inherited from extends< TsDataSvc, IDetDataSvc, IIncidentListener >
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 TsDataSvc
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 i_setRoot (DataObject *pRootObj)
 
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 i_setRoot (IOpaqueAddress *pRootAddr)
 
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.
 
 TsDataSvc (const std::string &name, ISvcLocator *svc)
 constructor
 
 TsDataSvc (const TsDataSvc &)=delete
 no copy constructor
 
TsDataSvcoperator= (const TsDataSvc &)=delete
 no assignment operator
 
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)
 

Private Member Functions

StatusCode setupDetectorDescription ()
 Deal with Detector Description initialization.
 
StatusCode loadObject (IConversionSvc *pLoader, IRegistry *pNode) override final
 Invoke Persistency service to create transient object from its persistent representation.
 
StatusCode updateObject (IRegistry *pDirectory) override
 Update object identified by its directory entry.
 
virtual StatusCode loadObject (IRegistry *pNode)
 Invoke Persistency service to create transient object from its persistent representation.
 

Private Attributes

Gaudi::Property< int > m_detStorageType
 
Gaudi::Property< std::string > m_detDbLocation
 
Gaudi::Property< std::string > m_detDbRootName
 
Gaudi::Property< bool > m_usePersistency { this, "UsePersistency", false, "control if the persistency is required" }
 
Gaudi::Property< std::string > m_persistencySvcName
 
Gaudi::Property< bool > m_allowLoadInRunning
 
Gaudi::Time m_eventTime = 0
 Current event time.
 
SmartIF< IAddressCreatorm_addrCreator = nullptr
 Address Creator to be used.
 

Additional Inherited Members

- Public Types inherited from extends< TsDataSvc, IDetDataSvc, IIncidentListener >
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...
 
- Protected Member Functions inherited from TsDataSvc
bool checkRoot ()
 Check if root path is valid.
 
virtual IConversionSvcgetDataLoader (IRegistry *pReg)
 Retrieve customizable data loader according to registry entry to be retrieved.
 
virtual DataObjectcreateDefaultObject () const
 Create default objects in case forced creation of leaves is requested.
 
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 inherited from TsDataSvc
tsDataSvcMutex m_accessMutex
 Mutex to protect access to the store.
 
- 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.
 

Detailed Description

A DataSvc specialized in detector data.


Now inherits from TsDataSvc, a thread safe version of the DataSvc, which allows concurrent retrieval of DataObjects.

Author
Marco Clemencic (previous author unknown)
Danilo Piparo

Definition at line 38 of file DetDataSvc.h.

Constructor & Destructor Documentation

◆ DetDataSvc()

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

Standard Constructor.

Definition at line 176 of file DetDataSvc.cpp.

176 : extends( name, svc ) {
177 setProperty( "RootCLID", CLID_Catalog ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
178}
bool PyHelper setProperty(IInterface *p, char *name, char *value)
const std::string & name() const override
Retrieve name of the service.
Definition Service.cpp:333

◆ ~DetDataSvc()

DetDataSvc::~DetDataSvc ( )
overridedefault

Standard Destructor.

Member Function Documentation

◆ clearStore()

StatusCode DetDataSvc::clearStore ( )
override

Remove all data objects in the data store.

Definition at line 153 of file DetDataSvc.cpp.

153 {
154
156
157 if ( m_usePersistency ) {
158 // Create root address
159 unsigned long iargs[] = { 0, 0 };
160 const std::string args[] = { m_detDbLocation, m_detDbRootName };
161 IOpaqueAddress* rootAddr;
162 StatusCode sc = m_addrCreator->createAddress( m_detStorageType, CLID_Catalog, args, iargs, rootAddr );
163 // Set detector data store root
164 if ( sc.isSuccess() ) {
165 sc = i_setRoot( rootAddr );
166 if ( sc.isFailure() ) { error() << "Unable to set detector data store root" << endmsg; }
167 } else {
168 error() << "Unable to create address for /dd" << endmsg;
169 }
170 return sc;
171 }
172 return StatusCode::SUCCESS;
173}
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)
Gaudi::Property< int > m_detStorageType
Definition DetDataSvc.h:100
Gaudi::Property< std::string > m_detDbLocation
Definition DetDataSvc.h:102
Gaudi::Property< std::string > m_detDbRootName
Definition DetDataSvc.h:104
Gaudi::Property< bool > m_usePersistency
Definition DetDataSvc.h:112
SmartIF< IAddressCreator > m_addrCreator
Address Creator to be used.
Definition DetDataSvc.h:124
bool isFailure() const
Definition StatusCode.h:129
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition StatusCode.h:139
bool isSuccess() const
Definition StatusCode.h:314
constexpr static const auto SUCCESS
Definition StatusCode.h:99
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 clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition TsDataSvc.cpp:89

◆ eventTime()

const Gaudi::Time & DetDataSvc::eventTime ( ) const
override

Get the event time.

Definition at line 190 of file DetDataSvc.cpp.

190{ return m_eventTime; }
Gaudi::Time m_eventTime
Current event time.
Definition DetDataSvc.h:121

◆ finalize()

StatusCode DetDataSvc::finalize ( )
override

Finalize the service.

Definition at line 135 of file DetDataSvc.cpp.

135 {
136 DEBMSG << "Finalizing" << endmsg;
137
138 // clears the store
139 m_usePersistency = false; // avoid creation of an empty store when clearing
140 clearStore().ignore();
141
142 // Releases the address creator
143 m_addrCreator = nullptr;
144
145 // Releases the DataLoader
146 setDataLoader( nullptr ).ignore();
147
148 // Finalize the base class
149 return TsDataSvc::finalize();
150}
#define DEBMSG
StatusCode clearStore() override
Remove all data objects in the data store.
StatusCode finalize() override
Service initialization.
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr) override
IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data pro...

◆ handle()

void DetDataSvc::handle ( const Incident & inc)
override

Inform that a new incident has occured.

Inform that a new incident has occurred.

Definition at line 193 of file DetDataSvc.cpp.

193 {
194 ON_DEBUG {
195 debug() << "New incident received" << endmsg;
196 debug() << "Incident source: " << inc.source() << endmsg;
197 debug() << "Incident type: " << inc.type() << endmsg;
198 }
199}
#define ON_DEBUG
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
const std::string & type() const
Access to the incident type.
Definition Incident.h:43
const std::string & source() const
Access to the source of the incident.
Definition Incident.h:49

◆ initialize()

StatusCode DetDataSvc::initialize ( )
override

Initialize the service.

Definition at line 37 of file DetDataSvc.cpp.

37 {
38 // Call base class initialization
39 StatusCode sc = TsDataSvc::initialize();
40 if ( sc.isFailure() ) return sc;
41
42 // Set Data Loader
43 auto cnv_svc = serviceLocator()->service<IConversionSvc>( m_persistencySvcName );
44 if ( !cnv_svc ) {
45 error() << "Unable to retrieve " << m_persistencySvcName << endmsg;
47 }
48
49 sc = setDataLoader( cnv_svc );
50 if ( sc.isFailure() ) {
51 error() << "Unable to set DataLoader" << endmsg;
52 return sc;
53 }
54
55 // Get address creator from the DetectorPersistencySvc
56 m_addrCreator = cnv_svc;
57 if ( !m_addrCreator ) {
58 error() << "Unable to get AddressCreator." << endmsg;
60 }
61
63}
StatusCode setupDetectorDescription()
Deal with Detector Description initialization.
Gaudi::Property< std::string > m_persistencySvcName
Definition DetDataSvc.h:113
virtual SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition Service.cpp:336
constexpr static const auto FAILURE
Definition StatusCode.h:100
StatusCode initialize() override
Service initialization.

◆ loadObject() [1/2]

StatusCode DetDataSvc::loadObject ( IConversionSvc * pLoader,
IRegistry * pNode )
inlinefinaloverrideprivatevirtual

Invoke Persistency service to create transient object from its persistent representation.

Reimplemented from TsDataSvc.

Definition at line 72 of file DetDataSvc.h.

72 {
74 return TsDataSvc::loadObject( pLoader, pNode );
75 }
76 error() << "Trying to load " << pNode->identifier() << " while RUNNING" << endmsg;
78 }
Gaudi::Property< bool > m_allowLoadInRunning
Definition DetDataSvc.h:116
virtual const id_type & identifier() const =0
Full identifier (or key)
Gaudi::StateMachine::State FSMState() const override
Definition Service.h:55
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.

◆ loadObject() [2/2]

StatusCode TsDataSvc::loadObject ( IRegistry * pNode)
privatevirtual

Invoke Persistency service to create transient object from its persistent representation.

Reimplemented from TsDataSvc.

Definition at line 273 of file TsDataSvc.cpp.

444 {
445 IConversionSvc* pLoader = getDataLoader( pRegistry );
446 return loadObject( pLoader, pRegistry );
447}
StatusCode loadObject(IConversionSvc *pLoader, IRegistry *pNode) override final
Invoke Persistency service to create transient object from its persistent representation.
Definition DetDataSvc.h:72
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.

◆ reinitialize()

StatusCode DetDataSvc::reinitialize ( )
override

Initialize the service.

Definition at line 117 of file DetDataSvc.cpp.

117 {
118 // The DetectorDataSvc does not need to be re-initialized. If it is done
119 // all the Algorithms having references to DetectorElements will become
120 // invalid and crash the program. (Pere Mato)
121
122 // Call base class reinitialization
123 // StatusCode sc = DataSvc::reinitialize();
124 // if( sc.isFailure() ) return sc;
125
126 // Delete the associated event time
127 // if( 0 != m_eventTime ) delete m_eventTime;
128 // m_eventTimeDefined = false;
129
130 // return setupDetectorDescription();
131 return StatusCode::SUCCESS;
132}

◆ setEventTime()

void DetDataSvc::setEventTime ( const Gaudi::Time & time)
override

Set the new event time.

Definition at line 181 of file DetDataSvc.cpp.

181 {
183 DEBMSG << "Event Time set to " << eventTime() << endmsg;
184}
const Gaudi::Time & eventTime() const override
Get the event time.

◆ setupDetectorDescription()

StatusCode DetDataSvc::setupDetectorDescription ( )
private

Deal with Detector Description initialization.

Todo
: remove references to obsolete package XMLDDDBROOT

Definition at line 65 of file DetDataSvc.cpp.

65 {
66 // Initialize the detector data transient store
67 ON_DEBUG {
68 debug() << "Storage type used is: " << m_detStorageType << endmsg;
69 debug() << "Setting DetectorDataSvc root node... " << endmsg;
70 }
71
72 if ( m_usePersistency ) {
73
74 IOpaqueAddress* rootAddr = nullptr;
75 if ( m_detDbLocation.empty() || m_detDbLocation == "empty" ) {
76
77 // if the name of DBlocation is not given - construct it!
78 // by retrieving the value of XMLDDBROOT
79
81 if ( isEnvSet( "XMLDDDBROOT" ) ) {
82 const std::string loc = getEnv( "XMLDDDBROOT" );
83 m_detDbLocation = loc + "/DDDB/lhcb.xml";
84 }
85 }
86 if ( m_detDbLocation.empty() || m_detDbLocation == "empty" ) {
87 error() << "Detector data location name not set. Detector data will "
88 "not be found."
89 << endmsg;
91 } else {
92 // Create address
93 unsigned long iargs[] = { 0, 0 };
94 const std::string args[] = { m_detDbLocation, m_detDbRootName };
95 StatusCode sc = m_addrCreator->createAddress( m_detStorageType, CLID_Catalog, args, iargs, rootAddr );
96 if ( sc.isSuccess() ) {
97 sc = i_setRoot( rootAddr );
98 if ( sc.isFailure() ) {
99 error() << "Unable to set detector data store root" << endmsg;
100 return sc;
101 }
102 } else {
103 error() << "Unable to create address for /dd" << endmsg;
104 return sc;
105 }
106 }
107 // Writing the description file in the output log file [bugs #2854]
108 always() << "Detector description database: " << m_detDbLocation.value() << endmsg;
109 } else {
110 info() << "Detector description not requested to be loaded" << endmsg;
111 }
112
113 return StatusCode::SUCCESS;
114}
GAUDI_API bool isEnvSet(const char *var)
Check if an environment variable is set or not.
Definition System.cpp:349
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition System.cpp:329
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)

◆ updateObject() [1/2]

StatusCode DetDataSvc::updateObject ( DataObject * toUpdate)
override

Update object.

Todo
update also its ancestors in the data store if necessary

Definition at line 203 of file DetDataSvc.cpp.

203 {
204
205 DEBMSG << "Method updateObject starting" << endmsg;
206
207 // Check that object to update exists
208 if ( !toUpdate ) {
209 error() << "There is no DataObject to update" << endmsg;
210 return Status::INVALID_OBJECT;
211 }
212
213 // Retrieve IValidity interface of object to update
214 IValidity* condition = dynamic_cast<IValidity*>( toUpdate );
215 if ( !condition ) {
216 warning() << "Cannot update DataObject: DataObject does not implement IValidity" << endmsg;
217 return StatusCode::SUCCESS;
218 }
219
220 // Check that the event time has been defined
221 if ( !validEventTime() ) {
222 warning() << "Cannot update DataObject: event time undefined" << endmsg;
223 return StatusCode::SUCCESS;
224 }
225
226 // No need to update if condition is valid
227 if ( condition->isValid( eventTime() ) ) {
228 DEBMSG << "DataObject is valid: no need to update" << endmsg;
229 return StatusCode::SUCCESS;
230 }
231
232 DEBMSG << "DataObject is invalid: update it" << endmsg;
233 // TODO: before loading updated object, update HERE its parent in data store
234
235 // Now delegate update to the conversion service by calling the base class
236 DEBMSG << "Delegate update to relevant conversion service" << endmsg;
237 StatusCode status = TsDataSvc::updateObject( toUpdate );
238 if ( !status.isSuccess() ) {
239 error() << "Could not update DataObject" << endmsg;
240 if ( status == Status::NO_DATA_LOADER ) error() << "There is no data loader" << endmsg;
241 return status;
242 }
243
244 // Now cross-check that the new condition is valid
245 condition = dynamic_cast<IValidity*>( toUpdate );
246 if ( !condition ) {
247 error() << "Updated DataObject does not implement IValidity" << endmsg;
248 return StatusCode::FAILURE;
249 }
250 if ( FSMState() == Gaudi::StateMachine::RUNNING && !condition->isValid( eventTime() ) ) {
251 error() << "Updated DataObject is not valid" << endmsg;
252 error() << "Are you sure the conversion service has updated it?" << endmsg;
253 return StatusCode::FAILURE;
254 }
255
256 // DataObject was successfully updated
257 DEBMSG << "Method updateObject exiting successfully" << endmsg;
258 return StatusCode::SUCCESS;
259}
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
bool validEventTime() const override
Check if the event time has been set.
virtual bool isValid() const =0
Check if the object is valid (it can be always invalid).
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.

◆ updateObject() [2/2]

StatusCode TsDataSvc::updateObject ( IRegistry * pDirectory)
overrideprivate

Update object identified by its directory entry.

Update object.

Definition at line 236 of file TsDataSvc.cpp.

634 {
635 if ( !pRegistry ) return Status::INVALID_OBJ_ADDR; // Precondition: Addres must be valid
636 DataObject* toUpdate = pRegistry->object();
637 return toUpdate ? updateObject( toUpdate ) : loadObject( pRegistry );
638}
StatusCode updateObject(DataObject *toUpdate) override
Update object.

◆ validEventTime()

bool DetDataSvc::validEventTime ( ) const
override

Check if the event time has been set.

Kept for backward compatibility, returns always true.

Definition at line 187 of file DetDataSvc.cpp.

187{ return true; }

Member Data Documentation

◆ m_addrCreator

SmartIF<IAddressCreator> DetDataSvc::m_addrCreator = nullptr
private

Address Creator to be used.

Definition at line 124 of file DetDataSvc.h.

◆ m_allowLoadInRunning

Gaudi::Property<bool> DetDataSvc::m_allowLoadInRunning
private
Initial value:
{ this, "AllowLoadInRunning", true,
"if set to false, no new object can be loaded while in running state "
"(updates are still allowed), this forces preloading of the geometry" }

Definition at line 116 of file DetDataSvc.h.

116 { this, "AllowLoadInRunning", true,
117 "if set to false, no new object can be loaded while in running state "
118 "(updates are still allowed), this forces preloading of the geometry" };

◆ m_detDbLocation

Gaudi::Property<std::string> DetDataSvc::m_detDbLocation
private
Initial value:
{ this, "DetDbLocation", "empty",
"location of detector Db (filename,URL)" }

Definition at line 102 of file DetDataSvc.h.

102 { this, "DetDbLocation", "empty",
103 "location of detector Db (filename,URL)" };

◆ m_detDbRootName

Gaudi::Property<std::string> DetDataSvc::m_detDbRootName
private
Initial value:
{ this,
"DetDbRootName",
"dd",
this->setProperty( "RootName", "/" + this->m_detDbRootName ).ignore();
},
"name of the root node of the detector" }
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Gaudi::tagged_bool< class ImmediatelyInvokeHandler_tag > ImmediatelyInvokeHandler
Definition Property.h:23

Definition at line 104 of file DetDataSvc.h.

104 { this,
105 "DetDbRootName",
106 "dd",
107 [this]( Gaudi::Details::PropertyBase& ) {
108 this->setProperty( "RootName", "/" + this->m_detDbRootName ).ignore();
109 },
111 "name of the root node of the detector" };

◆ m_detStorageType

Gaudi::Property<int> DetDataSvc::m_detStorageType
private
Initial value:
{ this, "DetStorageType", XML_StorageType,
"Detector Data Persistency Storage type" }
const long XML_StorageType
Definition ClassID.h:65

Definition at line 100 of file DetDataSvc.h.

100 { this, "DetStorageType", XML_StorageType,
101 "Detector Data Persistency Storage type" };

◆ m_eventTime

Gaudi::Time DetDataSvc::m_eventTime = 0
private

Current event time.

Definition at line 121 of file DetDataSvc.h.

◆ m_persistencySvcName

Gaudi::Property<std::string> DetDataSvc::m_persistencySvcName
private
Initial value:
{ this, "PersistencySvc", "DetectorPersistencySvc",
"name of the persistency service" }

Definition at line 113 of file DetDataSvc.h.

113 { this, "PersistencySvc", "DetectorPersistencySvc",
114 "name of the persistency service" };

◆ m_usePersistency

Gaudi::Property<bool> DetDataSvc::m_usePersistency { this, "UsePersistency", false, "control if the persistency is required" }
private

Definition at line 112 of file DetDataSvc.h.

112{ this, "UsePersistency", false, "control if the persistency is required" };

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