DetDataSvc Class Reference


More...

#include <DetectorDataSvc/DetDataSvc.h>

Inheritance diagram for DetDataSvc:
Collaboration diagram for DetDataSvc:

Public Member Functions

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

Private Member Functions

StatusCode setupDetectorDescription ()
 Deal with Detector Description initialization. More...
 

Private Attributes

int m_detStorageType = XML_StorageType
 Detector Data Persistency Storage type. More...
 
std::string m_detDbLocation = "empty"
 Location of detector Db (filename,URL) More...
 
std::string m_detDbRootName = "dd"
 Name of the root node of the detector. More...
 
std::string m_persistencySvcName = "DetectorPersistencySvc"
 Name of the persistency service. More...
 
bool m_usePersistency = false
 Flag to control if the persistency is required. More...
 
Gaudi::Time m_eventTime = 0
 Current event time. More...
 
SmartIF< IAddressCreatorm_addrCreator = nullptr
 Address Creator to be used. More...
 

Additional Inherited Members

- Public Types inherited from extends< TsDataSvc, IDetDataSvc, IIncidentListener >
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 TsDataSvc
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...
 
- Protected Member Functions inherited from TsDataSvc
bool checkRoot ()
 Check if root path is valid. More...
 
virtual IConversionSvcgetDataLoader (IRegistry *pReg)
 Retrieve customizable data loader according to registry entry to be retrieved. 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 inherited from TsDataSvc
CLID m_rootCLID
 Integer Property corresponding to CLID of root entry. More...
 
std::string m_rootName
 Name of root event. More...
 
IConversionSvcm_dataLoader
 Pointer to data loader service. More...
 
IIncidentSvcm_incidentSvc
 Pointer to incident service. More...
 
LoadItems m_preLoads
 Items to be pre-loaded. More...
 
bool m_forceLeaves
 Allow forced creation of default leaves on registerObject. More...
 
bool m_enableAccessHdlr
 Flag to enable interrupts on data access requests. More...
 
bool m_enableFaultHdlr
 Flag to enable interrupts on data creation requests. More...
 
DataSvcHelpers::RegistryEntrym_root
 Pointer to root entry. More...
 
DataSvcHelpers::InhibitMap * m_inhibitMap
 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
 Name of the data access incident. More...
 
std::string m_faultName
 Name of the data fault incident. More...
 
tsDataSvcMutex m_accessMutex
 Mutex to protect access to the store. 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...
 

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 28 of file DetDataSvc.h.

Constructor & Destructor Documentation

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

Standard Constructor.

Definition at line 181 of file DetDataSvc.cpp.

181  :
182  base_class(name,svc) {
183  declareProperty("DetStorageType", m_detStorageType = XML_StorageType );
184  declareProperty("DetDbLocation", m_detDbLocation = "empty" );
185  declareProperty("DetDbRootName", m_detDbRootName = "dd" );
186  declareProperty("UsePersistency", m_usePersistency = false );
187  declareProperty("PersistencySvc", m_persistencySvcName = "DetectorPersistencySvc" );
188  m_rootName = "/dd";
189  m_rootCLID = CLID_Catalog;
190 }
std::string m_rootName
Name of root event.
Definition: TsDataSvc.h:77
extends base_class
Typedef to this class.
Definition: extends.h:14
std::string m_persistencySvcName
Name of the persistency service.
Definition: DetDataSvc.h:98
int m_detStorageType
Detector Data Persistency Storage type.
Definition: DetDataSvc.h:89
const long XML_StorageType
Definition: ClassID.h:57
std::string m_detDbRootName
Name of the root node of the detector.
Definition: DetDataSvc.h:95
std::string m_detDbLocation
Location of detector Db (filename,URL)
Definition: DetDataSvc.h:92
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:215
CLID m_rootCLID
Integer Property corresponding to CLID of root entry.
Definition: TsDataSvc.h:75
bool m_usePersistency
Flag to control if the persistency is required.
Definition: DetDataSvc.h:101
DetDataSvc::~DetDataSvc ( )
overridedefault

Standard Destructor.

Member Function Documentation

StatusCode DetDataSvc::clearStore ( )
override

Remove all data objects in the data store.

Definition at line 150 of file DetDataSvc.cpp.

150  {
151 
153 
154  if( m_usePersistency ) {
155  // Create root address
156  unsigned long iargs[] = {0,0};
158  IOpaqueAddress* rootAddr;
160  CLID_Catalog,
161  args,
162  iargs,
163  rootAddr);
164  // Set detector data store root
165  if( sc.isSuccess() ) {
166  sc = i_setRoot( "/" + m_detDbRootName, rootAddr );
167  if( sc.isFailure() ) {
168  error() << "Unable to set detector data store root" << endmsg;
169  }
170  } else {
171  error() << "Unable to create address for /dd" << endmsg;
172  }
173  return sc;
174 
175  }
176  return StatusCode::SUCCESS;
177 
178 }
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ipar, IOpaqueAddress *&refpAddress)=0
Create a Generic address using explicit arguments to identify a single object.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
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
SmartIF< IAddressCreator > m_addrCreator
Address Creator to be used.
Definition: DetDataSvc.h:107
int m_detStorageType
Detector Data Persistency Storage type.
Definition: DetDataSvc.h:89
std::string m_detDbRootName
Name of the root node of the detector.
Definition: DetDataSvc.h:95
list args
Definition: gaudirun.py:290
virtual StatusCode i_setRoot(std::string root_name, DataObject *pRootObj)
Initialize data store for new event by giving new event path and root object.
Definition: TsDataSvc.cpp:176
std::string m_detDbLocation
Location of detector Db (filename,URL)
Definition: DetDataSvc.h:92
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: TsDataSvc.cpp:115
Opaque address interface definition.
void ignore() const
Definition: StatusCode.h:108
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool m_usePersistency
Flag to control if the persistency is required.
Definition: DetDataSvc.h:101
const Gaudi::Time & DetDataSvc::eventTime ( ) const
override

Get the event time.

Definition at line 204 of file DetDataSvc.cpp.

204  {
205  return m_eventTime;
206 }
Gaudi::Time m_eventTime
Current event time.
Definition: DetDataSvc.h:104
StatusCode DetDataSvc::finalize ( )
override

Finalize the service.

Definition at line 131 of file DetDataSvc.cpp.

132 {
133  DEBMSG << "Finalizing" << endmsg;
134 
135  // clears the store
136  m_usePersistency = false; // avoid creation of an empty store when clearing
137  clearStore().ignore();
138 
139  // Releases the address creator
140  m_addrCreator = nullptr;
141 
142  // Releases the DataLoader
143  setDataLoader(nullptr).ignore();
144 
145  // Finalize the base class
146  return TsDataSvc::finalize();
147 }
StatusCode clearStore() override
Remove all data objects in the data store.
Definition: DetDataSvc.cpp:150
SmartIF< IAddressCreator > m_addrCreator
Address Creator to be used.
Definition: DetDataSvc.h:107
#define DEBMSG
Definition: DetDataSvc.cpp:19
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc=0) override
IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data pro...
Definition: TsDataSvc.cpp:214
StatusCode finalize() override
Service initialization.
Definition: TsDataSvc.cpp:1362
void ignore() const
Definition: StatusCode.h:108
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool m_usePersistency
Flag to control if the persistency is required.
Definition: DetDataSvc.h:101
void DetDataSvc::handle ( const Incident inc)
override

Inform that a new incident has occured.

Inform that a new incident has occurred.

Definition at line 209 of file DetDataSvc.cpp.

209  {
210  ON_DEBUG {
211  debug() << "New incident received" << endmsg;
212  debug() << "Incident source: " << inc.source() << endmsg;
213  debug() << "Incident type: " << inc.type() << endmsg;
214  }
215 }
const std::string & type() const
Access to the incident type.
Definition: Incident.h:41
const std::string & source() const
Access to the source of the incident.
Definition: Incident.h:47
#define ON_DEBUG
Definition: DetDataSvc.cpp:16
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode DetDataSvc::initialize ( )
override

Initialize the service.

Definition at line 27 of file DetDataSvc.cpp.

27  {
28  // Call base class initialization
30  if( UNLIKELY(sc.isFailure()) ) return sc;
31 
32  // Set Data Loader
34  if( UNLIKELY(!cnv_svc) ) {
35  error() << "Unable to retrieve " << m_persistencySvcName << endmsg;
36  return StatusCode::FAILURE;
37  }
38 
39  sc = setDataLoader(cnv_svc);
40  if( UNLIKELY(sc.isFailure()) ) {
41  error() << "Unable to set DataLoader" << endmsg;
42  return sc;
43  }
44 
45  // Get address creator from the DetectorPersistencySvc
46  m_addrCreator = cnv_svc;
47  if ( UNLIKELY(!m_addrCreator) ) {
48  error() << "Unable to get AddressCreator." << endmsg;
49  return StatusCode::FAILURE;
50  }
51 
52  return setupDetectorDescription();
53 }
#define UNLIKELY(x)
Definition: Kernel.h:126
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
StatusCode initialize() override
Service initialization.
Definition: TsDataSvc.cpp:1321
std::string m_persistencySvcName
Name of the persistency service.
Definition: DetDataSvc.h:98
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
StatusCode setupDetectorDescription()
Deal with Detector Description initialization.
Definition: DetDataSvc.cpp:55
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
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
SmartIF< IAddressCreator > m_addrCreator
Address Creator to be used.
Definition: DetDataSvc.h:107
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc=0) override
IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data pro...
Definition: TsDataSvc.cpp:214
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode DetDataSvc::reinitialize ( )
override

Initialize the service.

Definition at line 113 of file DetDataSvc.cpp.

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

Set the new event time.

Definition at line 193 of file DetDataSvc.cpp.

193  {
194  m_eventTime = time;
195  DEBMSG << "Event Time set to " << eventTime() << endmsg;
196 }
const Gaudi::Time & eventTime() const override
Get the event time.
Definition: DetDataSvc.cpp:204
#define DEBMSG
Definition: DetDataSvc.cpp:19
Gaudi::Time m_eventTime
Current event time.
Definition: DetDataSvc.h:104
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode DetDataSvc::setupDetectorDescription ( )
private

Deal with Detector Description initialization.

Todo:
: remove references to obsolete package XMLDDDBROOT

Definition at line 55 of file DetDataSvc.cpp.

55  {
56  // Initialize the detector data transient store
57  ON_DEBUG {
58  debug() << "Storage type used is: " << m_detStorageType << endmsg;
59  debug() << "Setting DetectorDataSvc root node... " << endmsg;
60  }
61 
62  if( m_usePersistency ) {
63 
64  IOpaqueAddress* rootAddr = nullptr;
65  if( m_detDbLocation.empty() || "empty" == m_detDbLocation ) {
66 
67  // if the name of DBlocation is not given - construct it!
68  // by retrieving the value of XMLDDBROOT
69 
71  if ( isEnvSet("XMLDDDBROOT") ) {
72  m_detDbLocation = getEnv("XMLDDDBROOT");
73  m_detDbLocation += "/DDDB/lhcb.xml";
74  }
75  }
76  if( m_detDbLocation.empty() || "empty" == m_detDbLocation ) {
77  error() << "Detector data location name not set. Detector data will "
78  "not be found." << endmsg;
79  return StatusCode::FAILURE;
80  }
81  else {
82  // Create address
83  unsigned long iargs[]={0,0};
86  CLID_Catalog,
87  args,
88  iargs,
89  rootAddr);
90  if( sc.isSuccess() ) {
91  sc = i_setRoot( "/" + m_detDbRootName, rootAddr );
92  if( sc.isFailure() ) {
93  error() << "Unable to set detector data store root" << endmsg;
94  return sc;
95  }
96  }
97  else {
98  error() << "Unable to create address for /dd" << endmsg;
99  return sc;
100  }
101  }
102  // Writing the description file in the output log file [bugs #2854]
103  always() << "Detector description database: " << m_detDbLocation << endmsg;
104  }
105  else {
106  info() << "Detector description not requested to be loaded" << endmsg;
107  }
108 
109  return StatusCode::SUCCESS;
110 }
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:617
T empty(T...args)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ipar, IOpaqueAddress *&refpAddress)=0
Create a Generic address using explicit arguments to identify a single object.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
#define ON_DEBUG
Definition: DetDataSvc.cpp:16
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
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
SmartIF< IAddressCreator > m_addrCreator
Address Creator to be used.
Definition: DetDataSvc.h:107
int m_detStorageType
Detector Data Persistency Storage type.
Definition: DetDataSvc.h:89
GAUDI_API bool isEnvSet(const char *var)
Check if an environment variable is set or not.
Definition: System.cpp:637
std::string m_detDbRootName
Name of the root node of the detector.
Definition: DetDataSvc.h:95
list args
Definition: gaudirun.py:290
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
virtual StatusCode i_setRoot(std::string root_name, DataObject *pRootObj)
Initialize data store for new event by giving new event path and root object.
Definition: TsDataSvc.cpp:176
std::string m_detDbLocation
Location of detector Db (filename,URL)
Definition: DetDataSvc.h:92
Opaque address interface definition.
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool m_usePersistency
Flag to control if the persistency is required.
Definition: DetDataSvc.h:101
StatusCode DetDataSvc::updateObject ( DataObject toUpdate)
override

Update object.

Todo:
update also its ancestors in the data store if necessary

Definition at line 219 of file DetDataSvc.cpp.

219  {
220 
221  DEBMSG << "Method updateObject starting" << endmsg;
222 
223  // Check that object to update exists
224  if ( !toUpdate ) {
225  error() << "There is no DataObject to update" << endmsg;
226  return INVALID_OBJECT;
227  }
228 
229  // Retrieve IValidity interface of object to update
230  IValidity* condition = dynamic_cast<IValidity*>( toUpdate );
231  if ( !condition ) {
232  warning()
233  << "Cannot update DataObject: DataObject does not implement IValidity"
234  << endmsg;
235  return StatusCode::SUCCESS;
236  }
237 
238  // Check that the event time has been defined
239  if ( !validEventTime() ) {
240  warning()
241  << "Cannot update DataObject: event time undefined"
242  << endmsg;
243  return StatusCode::SUCCESS;
244  }
245 
246  // No need to update if condition is valid
247  if ( condition->isValid( eventTime() ) ) {
248  DEBMSG << "DataObject is valid: no need to update" << endmsg;
249  return StatusCode::SUCCESS;
250  }
251 
252  DEBMSG << "DataObject is invalid: update it" << endmsg;
253  // TODO: before loading updated object, update HERE its parent in data store
254 
255  // Now delegate update to the conversion service by calling the base class
256  DEBMSG << "Delegate update to relevant conversion service" << endmsg;
257  StatusCode status = TsDataSvc::updateObject(toUpdate);
258  if ( !status.isSuccess() ) {
259  error() << "Could not update DataObject" << endmsg;
260  if ( status == NO_DATA_LOADER )
261  error() << "There is no data loader" << endmsg;
262  return status;
263  }
264 
265  // Now cross-check that the new condition is valid
266  condition = dynamic_cast<IValidity*>(toUpdate);
267  if ( !condition ) {
268  error() << "Updated DataObject does not implement IValidity" << endmsg;
269  return StatusCode::FAILURE;
270  }
272  !condition->isValid( eventTime() ) ) {
273  error() << "Updated DataObject is not valid" << endmsg;
274  error() << "Are you sure the conversion service has updated it?" << endmsg;
275  return StatusCode::FAILURE;
276  }
277 
278  // DataObject was successfully updated
279  DEBMSG << "Method updateObject exiting successfully" << endmsg;
280  return StatusCode::SUCCESS;
281 
282 }
bool validEventTime() const override
Check if the event time has been set.
Definition: DetDataSvc.cpp:199
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:57
const Gaudi::Time & eventTime() const override
Get the event time.
Definition: DetDataSvc.cpp:204
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: TsDataSvc.cpp:1017
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
virtual bool isValid() const =0
Check if the object is valid (it can be always invalid).
#define DEBMSG
Definition: DetDataSvc.cpp:19
Interface for objects with a validity.
Definition: IValidity.h:9
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool DetDataSvc::validEventTime ( ) const
override

Check if the event time has been set.

Kept for backward compatibility, returns always true.

Definition at line 199 of file DetDataSvc.cpp.

199  {
200  return true;
201 }

Member Data Documentation

SmartIF<IAddressCreator> DetDataSvc::m_addrCreator = nullptr
private

Address Creator to be used.

Definition at line 107 of file DetDataSvc.h.

std::string DetDataSvc::m_detDbLocation = "empty"
private

Location of detector Db (filename,URL)

Definition at line 92 of file DetDataSvc.h.

std::string DetDataSvc::m_detDbRootName = "dd"
private

Name of the root node of the detector.

Definition at line 95 of file DetDataSvc.h.

int DetDataSvc::m_detStorageType = XML_StorageType
private

Detector Data Persistency Storage type.

Definition at line 89 of file DetDataSvc.h.

Gaudi::Time DetDataSvc::m_eventTime = 0
private

Current event time.

Definition at line 104 of file DetDataSvc.h.

std::string DetDataSvc::m_persistencySvcName = "DetectorPersistencySvc"
private

Name of the persistency service.

Definition at line 98 of file DetDataSvc.h.

bool DetDataSvc::m_usePersistency = false
private

Flag to control if the persistency is required.

Definition at line 101 of file DetDataSvc.h.


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