1 #define DETECTORDATASVC_DETDATASVC_CPP
5 #include "GaudiKernel/IAddressCreator.h"
6 #include "GaudiKernel/IConversionSvc.h"
7 #include "GaudiKernel/IOpaqueAddress.h"
8 #include "GaudiKernel/ISvcLocator.h"
9 #include "GaudiKernel/IValidity.h"
10 #include "GaudiKernel/DataObject.h"
11 #include "GaudiKernel/MsgStream.h"
12 #include "GaudiKernel/System.h"
16 #define ON_DEBUG if (UNLIKELY(outputLevel() <= MSG::DEBUG))
17 #define ON_VERBOSE if (UNLIKELY(outputLevel() <= MSG::VERBOSE))
19 #define DEBMSG ON_DEBUG debug()
20 #define VERMSG ON_VERBOSE verbose()
33 auto cnv_svc = serviceLocator()->service<
IConversionSvc>(m_persistencySvcName);
35 error() <<
"Unable to retrieve " << m_persistencySvcName <<
endmsg;
39 sc = setDataLoader(cnv_svc);
41 error() <<
"Unable to set DataLoader" <<
endmsg;
46 m_addrCreator = cnv_svc;
48 error() <<
"Unable to get AddressCreator." <<
endmsg;
52 return setupDetectorDescription();
59 debug() <<
"Setting DetectorDataSvc root node... " <<
endmsg;
77 error() <<
"Detector data location name not set. Detector data will "
83 unsigned long iargs[]={0,0};
93 error() <<
"Unable to set detector data store root" <<
endmsg;
98 error() <<
"Unable to create address for /dd" <<
endmsg;
106 info() <<
"Detector description not requested to be loaded" <<
endmsg;
143 setDataLoader(
nullptr).ignore();
158 unsigned long iargs[] = {0,0};
170 error() <<
"Unable to set detector data store root" <<
endmsg;
173 error() <<
"Unable to create address for /dd" <<
endmsg;
191 m_rootCLID = CLID_Catalog;
213 debug() <<
"New incident received" <<
endmsg;
214 debug() <<
"Incident source: " << inc.
source() <<
endmsg;
215 debug() <<
"Incident type: " << inc.
type() <<
endmsg;
227 error() <<
"There is no DataObject to update" <<
endmsg;
228 return INVALID_OBJECT;
235 <<
"Cannot update DataObject: DataObject does not implement IValidity"
243 <<
"Cannot update DataObject: event time undefined"
250 DEBMSG <<
"DataObject is valid: no need to update" <<
endmsg;
258 DEBMSG <<
"Delegate update to relevant conversion service" <<
endmsg;
261 error() <<
"Could not update DataObject" <<
endmsg;
262 if ( status == NO_DATA_LOADER )
263 error() <<
"There is no data loader" <<
endmsg;
268 condition =
dynamic_cast<IValidity*
>(toUpdate);
270 error() <<
"Updated DataObject does not implement IValidity" <<
endmsg;
275 error() <<
"Updated DataObject is not valid" <<
endmsg;
276 error() <<
"Are you sure the conversion service has updated it?" <<
endmsg;
281 DEBMSG <<
"Method updateObject exiting successfully" <<
endmsg;
bool validEventTime() const override
Check if the event time has been set.
Definition of the MsgStream class used to transmit messages.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
const std::string & type() const
Access to the incident type.
const Gaudi::Time & eventTime() const override
Get the event time.
void handle(const Incident &) override
Inform that a new incident has occured.
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.
const std::string & source() const
Access to the source of the incident.
bool isSuccess() const
Test for a status code of SUCCESS.
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
StatusCode updateObject(DataObject *toUpdate) override
Update object.
StatusCode initialize() override
Service initialization.
const long XML_StorageType
std::string m_persistencySvcName
Name of the persistency service.
bool isFailure() const
Test for a status code of FAILURE.
StatusCode setupDetectorDescription()
Deal with Detector Description initialization.
StatusCode clearStore() override
Remove all data objects in the data store.
This class is used for returning status codes from appropriate routines.
#define DECLARE_COMPONENT(type)
SmartIF< IAddressCreator > m_addrCreator
Address Creator to be used.
GAUDI_API bool isEnvSet(const char *var)
Check if an environment variable is set or not.
int m_detStorageType
Detector Data Persistency Storage type.
DetDataSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
StatusCode reinitialize() override
Initialize the service.
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
virtual bool isValid() const =0
Check if the object is valid (it can be always invalid).
StatusCode finalize() override
Finalize the service.
std::string m_detDbRootName
Name of the root node of the detector.
StatusCode finalize() override
Service initialization.
Gaudi::Time m_eventTime
Current event time.
Base class used to extend a class implementing other interfaces.
std::string m_detDbLocation
Location of detector Db (filename,URL)
Base class for all Incidents (computing events).
void setEventTime(const Gaudi::Time &time) override
Set the new event time.
Interface for objects with a validity.
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Opaque address interface definition.
A DataObject is the base class of any identifiable object on any data store.
bool m_usePersistency
Flag to control if the persistency is required.