| The Gaudi Framework v32r1 (f65d50dc)

DetDataSvc.h
Go to the documentation of this file.
1 #ifndef DETECTORDATASVC_DETDATASVC_H
2 #define DETECTORDATASVC_DETDATASVC_H
3
4 // Base classes
5 //#include "GaudiKernel/DataSvc.h"
6 // D. Piparo: Change to the new thread safe version
7 #include "GaudiKernel/IDetDataSvc.h"
8 #include "GaudiKernel/IIncidentListener.h"
9 #include "GaudiKernel/IRegistry.h"
10 #include "GaudiKernel/Time.h"
11 #include "GaudiKernel/TsDataSvc.h"
12
13 // Forward declarations
14 class StatusCode;
15 class IAddressCreator;
16
18 //--------------------------------------------------------------------------
28
29 class DetDataSvc : public extends<TsDataSvc, IDetDataSvc, IIncidentListener> {
30
31 // unhides DataSvc updateObject methods
32 using TsDataSvc::updateObject;
33
34 public:
35 // Overloaded DataSvc methods
36
38 StatusCode initialize() override;
39
41 StatusCode reinitialize() override;
42
44 StatusCode finalize() override;
45
47 StatusCode clearStore() override;
48
50 StatusCode updateObject( DataObject* toUpdate ) override;
51
53 DetDataSvc( const std::string& name, ISvcLocator* svc );
54
56 ~DetDataSvc() override = default;
57
58 private:
60 StatusCode setupDetectorDescription();
61
62 using TsDataSvc::loadObject;
63 StatusCode loadObject( IConversionSvc* pLoader, IRegistry* pNode ) override final {
64 if ( LIKELY( m_allowLoadInRunning ||
65 serviceLocator().as<IStateful>()->FSMState() != Gaudi::StateMachine::RUNNING ) ) {
66 return TsDataSvc::loadObject( pLoader, pNode );
67 }
68 error() << "Trying to load " << pNode->identifier() << " while RUNNING" << endmsg;
69 return StatusCode::FAILURE;
70 }
71
72 public:
73 // Implementation of the IDetDataSvc interface
74
77 bool validEventTime() const override;
78
80 const Gaudi::Time& eventTime() const override;
81
83 void setEventTime( const Gaudi::Time& time ) override;
84
85 public:
86 // Implementation of the IIncidentListener interface
87
89 void handle( const Incident& ) override;
90
91 private:
92 Gaudi::Property<int> m_detStorageType{this, "DetStorageType", XML_StorageType,
93 "Detector Data Persistency Storage type"};
94 Gaudi::Property<std::string> m_detDbLocation{this, "DetDbLocation", "empty",
95 "location of detector Db (filename,URL)"};
96 Gaudi::Property<std::string> m_detDbRootName{this,
97 "DetDbRootName",
98 "dd",
99 [this]( Gaudi::Details::PropertyBase& ) {
100 this->setProperty( "RootName", "/" + this->m_detDbRootName ).ignore();
101 },
102 Gaudi::Details::Property::ImmediatelyInvokeHandler{true},
103 "name of the root node of the detector"};
104 Gaudi::Property<bool> m_usePersistency{this, "UsePersistency", false, "control if the persistency is required"};
105 Gaudi::Property<std::string> m_persistencySvcName{this, "PersistencySvc", "DetectorPersistencySvc",
106 "name of the persistency service"};
107
108 Gaudi::Property<bool> m_allowLoadInRunning{this, "AllowLoadInRunning", true,
109 "if set to false, no new object can be loaded while in running state "
110 "(updates are still allowed), this forces preloading of the geometry"};
111
113 Gaudi::Time m_eventTime = 0;
114
116 SmartIF<IAddressCreator> m_addrCreator = nullptr;
117 };
118
119 #endif // DETECTORDATASVC_DETDATASVC_H
plotSpeedupsPyRoot.time
def time
Definition: plotSpeedupsPyRoot.py:152
DetDataSvc::validEventTime
bool validEventTime() const override
Check if the event time has been set.
Definition: DetDataSvc.cpp:177
SmartIF< IAddressCreator >
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:277
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
IConversionSvc
Definition: IConversionSvc.h:37
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
Service::FSMState
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:52
PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >::setProperty
StatusCode setProperty(const Gaudi::Details::PropertyBase &p) override
set the property form another property
Definition: PropertyHolder.h:145
DetDataSvc::eventTime
const Gaudi::Time & eventTime() const override
Get the event time.
Definition: DetDataSvc.cpp:180
DetDataSvc::handle
void handle(const Incident &) override
Inform that a new incident has occured.
Definition: DetDataSvc.cpp:183
TsDataSvc::updateObject
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: TsDataSvc.cpp:649
DetDataSvc::updateObject
StatusCode updateObject(DataObject *toUpdate) override
Update object.
Definition: DetDataSvc.cpp:193
Gaudi::Details::Property::ImmediatelyInvokeHandler
Gaudi::tagged_bool< class ImmediatelyInvokeHandler_tag > ImmediatelyInvokeHandler
Definition: Property.h:141
IAddressCreator
IAddressCreator interface definition.
Definition: IAddressCreator.h:28
DetDataSvc::m_detDbRootName
Gaudi::Property< std::string > m_detDbRootName
Definition: DetDataSvc.h:96
DetDataSvc::~DetDataSvc
~DetDataSvc() override=default
Standard Destructor.
DetDataSvc::m_detDbLocation
Gaudi::Property< std::string > m_detDbLocation
Definition: DetDataSvc.h:94
std::string
STL class.
DetDataSvc::m_usePersistency
Gaudi::Property< bool > m_usePersistency
Definition: DetDataSvc.h:104
DetDataSvc::setupDetectorDescription
StatusCode setupDetectorDescription()
Deal with Detector Description initialization.
Definition: DetDataSvc.cpp:55
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
DetDataSvc
A DataSvc specialized in detector data.
Definition: DetDataSvc.h:29
DetDataSvc::clearStore
StatusCode clearStore() override
Remove all data objects in the data store.
Definition: DetDataSvc.cpp:143
Gaudi::Time
Based on seal::Time.
Definition: Time.h:231
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
DetDataSvc::m_addrCreator
SmartIF< IAddressCreator > m_addrCreator
Address Creator to be used.
Definition: DetDataSvc.h:116
IDetDataSvc.h
DetDataSvc::DetDataSvc
DetDataSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: DetDataSvc.cpp:166
DetDataSvc::reinitialize
StatusCode reinitialize() override
Initialize the service.
Definition: DetDataSvc.cpp:107
IRegistry.h
IRegistry
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
DetDataSvc::finalize
StatusCode finalize() override
Finalize the service.
Definition: DetDataSvc.cpp:125
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
Time.h
DetDataSvc::loadObject
StatusCode loadObject(IConversionSvc *pLoader, IRegistry *pNode) override final
Invoke Persistency service to create transient object from its persistent representation.
Definition: DetDataSvc.h:63
DetDataSvc::initialize
StatusCode initialize() override
Initialize the service.
Definition: DetDataSvc.cpp:27
LIKELY
#define LIKELY(x)
Definition: Kernel.h:95
XML_StorageType
const long XML_StorageType
Definition: ClassID.h:57
StatusCode::ignore
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
Gaudi::StateMachine::RUNNING
Definition: StateMachine.h:16
DetDataSvc::m_persistencySvcName
Gaudi::Property< std::string > m_persistencySvcName
Definition: DetDataSvc.h:105
DetDataSvc::m_eventTime
Gaudi::Time m_eventTime
Current event time.
Definition: DetDataSvc.h:113
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
DetDataSvc::m_detStorageType
Gaudi::Property< int > m_detStorageType
Definition: DetDataSvc.h:92
DetDataSvc::setEventTime
void setEventTime(const Gaudi::Time &time) override
Set the new event time.
Definition: DetDataSvc.cpp:171
IIncidentListener.h
DetDataSvc::m_allowLoadInRunning
Gaudi::Property< bool > m_allowLoadInRunning
Definition: DetDataSvc.h:108
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
TsDataSvc.h
TsDataSvc::loadObject
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: TsDataSvc.cpp:459
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192