The Gaudi Framework  v40r0 (475e45c1)
DetDataSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #pragma once
12 
13 // Base classes
14 // #include "GaudiKernel/DataSvc.h"
15 // D. Piparo: Change to the new thread safe version
18 #include <GaudiKernel/IRegistry.h>
19 #include <GaudiKernel/Time.h>
20 #include <GaudiKernel/TsDataSvc.h>
21 
22 // Forward declarations
23 class StatusCode;
24 class IAddressCreator;
25 
27  //--------------------------------------------------------------------------
37 
38 class DetDataSvc : public extends<TsDataSvc, IDetDataSvc, IIncidentListener> {
39 
40  // unhides DataSvc updateObject methods
42 
43 public:
44  // Overloaded DataSvc methods
45 
47  StatusCode initialize() override;
48 
50  StatusCode reinitialize() override;
51 
53  StatusCode finalize() override;
54 
56  StatusCode clearStore() override;
57 
59  StatusCode updateObject( DataObject* toUpdate ) override;
60 
62  DetDataSvc( const std::string& name, ISvcLocator* svc );
63 
65  ~DetDataSvc() override = default;
66 
67 private:
70 
72  StatusCode loadObject( IConversionSvc* pLoader, IRegistry* pNode ) override final {
74  return TsDataSvc::loadObject( pLoader, pNode );
75  }
76  error() << "Trying to load " << pNode->identifier() << " while RUNNING" << endmsg;
77  return StatusCode::FAILURE;
78  }
79 
80 public:
81  // Implementation of the IDetDataSvc interface
82 
85  bool validEventTime() const override;
86 
88  const Gaudi::Time& eventTime() const override;
89 
91  void setEventTime( const Gaudi::Time& time ) override;
92 
93 public:
94  // Implementation of the IIncidentListener interface
95 
97  void handle( const Incident& ) override;
98 
99 private:
101  "Detector Data Persistency Storage type" };
102  Gaudi::Property<std::string> m_detDbLocation{ this, "DetDbLocation", "empty",
103  "location of detector Db (filename,URL)" };
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" };
112  Gaudi::Property<bool> m_usePersistency{ this, "UsePersistency", false, "control if the persistency is required" };
113  Gaudi::Property<std::string> m_persistencySvcName{ this, "PersistencySvc", "DetectorPersistencySvc",
114  "name of the persistency service" };
115 
116  Gaudi::Property<bool> m_allowLoadInRunning{ 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" };
119 
122 
125 };
TsDataSvc::loadObject
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: TsDataSvc.cpp:444
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: PropertyBase.h:34
DetDataSvc::m_detDbRootName
Gaudi::Property< std::string > m_detDbRootName
Definition: DetDataSvc.h:104
IAddressCreator
Definition: IAddressCreator.h:33
TsDataSvc.h
DetDataSvc::initialize
StatusCode initialize() override
Initialize the service.
Definition: DetDataSvc.cpp:37
PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >::setProperty
StatusCode setProperty(const Gaudi::Details::PropertyBase &p)
Set the property from a property.
Definition: IProperty.h:38
ISvcLocator
Definition: ISvcLocator.h:42
IRegistry
Definition: IRegistry.h:29
DetDataSvc::m_addrCreator
SmartIF< IAddressCreator > m_addrCreator
Address Creator to be used.
Definition: DetDataSvc.h:124
DetDataSvc::setEventTime
void setEventTime(const Gaudi::Time &time) override
Set the new event time.
Definition: DetDataSvc.cpp:181
DetDataSvc::updateObject
StatusCode updateObject(DataObject *toUpdate) override
Update object.
Definition: DetDataSvc.cpp:203
Service::FSMState
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:55
Gaudi::Time
Definition: Time.h:238
DetDataSvc
Definition: DetDataSvc.h:38
DetDataSvc::m_allowLoadInRunning
Gaudi::Property< bool > m_allowLoadInRunning
Definition: DetDataSvc.h:116
Service::name
const std::string & name() const override
Retrieve name of the service
Definition: Service.cpp:333
StatusCode
Definition: StatusCode.h:64
Gaudi::tagged_bool_ns::tagged_bool
Definition: TaggedBool.h:15
DetDataSvc::loadObject
StatusCode loadObject(IConversionSvc *pLoader, IRegistry *pNode) override final
Invoke Persistency service to create transient object from its persistent representation.
Definition: DetDataSvc.h:72
DetDataSvc::m_usePersistency
Gaudi::Property< bool > m_usePersistency
Definition: DetDataSvc.h:112
XML_StorageType
const long XML_StorageType
Definition: ClassID.h:65
DetDataSvc::validEventTime
bool validEventTime() const override
Check if the event time has been set.
Definition: DetDataSvc.cpp:187
DetDataSvc::~DetDataSvc
~DetDataSvc() override=default
Standard Destructor.
SmartIF< IAddressCreator >
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:198
IDetDataSvc.h
DetDataSvc::DetDataSvc
DetDataSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: DetDataSvc.cpp:176
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:19
IRegistry.h
Gaudi::StateMachine::RUNNING
@ RUNNING
Definition: StateMachine.h:25
plotSpeedupsPyRoot.time
time
Definition: plotSpeedupsPyRoot.py:180
DetDataSvc::finalize
StatusCode finalize() override
Finalize the service.
Definition: DetDataSvc.cpp:135
DetDataSvc::m_persistencySvcName
Gaudi::Property< std::string > m_persistencySvcName
Definition: DetDataSvc.h:113
StatusCode::ignore
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition: StatusCode.h:139
DetDataSvc::eventTime
const Gaudi::Time & eventTime() const override
Get the event time.
Definition: DetDataSvc.cpp:190
DetDataSvc::setupDetectorDescription
StatusCode setupDetectorDescription()
Deal with Detector Description initialization.
Definition: DetDataSvc.cpp:65
DetDataSvc::m_detDbLocation
Gaudi::Property< std::string > m_detDbLocation
Definition: DetDataSvc.h:102
Time.h
IIncidentListener.h
TsDataSvc::updateObject
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: TsDataSvc.cpp:634
DetDataSvc::reinitialize
StatusCode reinitialize() override
Initialize the service.
Definition: DetDataSvc.cpp:117
DataObject
Definition: DataObject.h:37
DetDataSvc::clearStore
StatusCode clearStore() override
Remove all data objects in the data store.
Definition: DetDataSvc.cpp:153
DetDataSvc::handle
void handle(const Incident &) override
Inform that a new incident has occured.
Definition: DetDataSvc.cpp:193
DetDataSvc::m_detStorageType
Gaudi::Property< int > m_detStorageType
Definition: DetDataSvc.h:100
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:100
Incident
Definition: Incident.h:24
Gaudi::Property< int >
DetDataSvc::m_eventTime
Gaudi::Time m_eventTime
Current event time.
Definition: DetDataSvc.h:121
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator
Definition: Service.cpp:336
IConversionSvc
Definition: IConversionSvc.h:43