|
Gaudi Framework, version v23r2 |
| Home | Generated: Thu Jun 28 2012 |
--------------------------------------------------------------------------- More...
#include <DetectorDataSvc/DetDataSvc.h>


Public Member Functions | |
| virtual StatusCode | initialize () |
| Initialize the service. | |
| virtual StatusCode | reinitialize () |
| Initialize the service. | |
| virtual StatusCode | finalize () |
| Finalize the service. | |
| virtual StatusCode | clearStore () |
| Remove all data objects in the data store. | |
| virtual StatusCode | updateObject (DataObject *toUpdate) |
| Update object. | |
| DetDataSvc (const std::string &name, ISvcLocator *svc) | |
| Standard Constructor. | |
| virtual | ~DetDataSvc () |
| Standard Destructor. | |
| virtual bool | validEventTime () const |
| Check if the event time has been set. | |
| virtual const Gaudi::Time & | eventTime () const |
| Get the event time. | |
| virtual void | setEventTime (const Gaudi::Time &time) |
| Set the new event time. | |
| virtual void | handle (const Incident &) |
| Inform that a new incident has occured. | |
Private Member Functions | |
| StatusCode | setupDetectorDescription () |
| Deal with Detector Description initialization. | |
Private Attributes | |
| int | m_detStorageType |
| Detector Data Persistency Storage type. | |
| std::string | m_detDbLocation |
| Location of detector Db (filename,URL) | |
| std::string | m_detDbRootName |
| Name of the root node of the detector. | |
| std::string | m_persistencySvcName |
| Name of the persistency service. | |
| bool | m_usePersistency |
| Flag to control if the persistency is required. | |
| Gaudi::Time | m_eventTime |
| Current event time. | |
| SmartIF< IAddressCreator > | m_addrCreator |
| Address Creator to be used. | |
Friends | |
| class | SvcFactory< DetDataSvc > |
---------------------------------------------------------------------------
A DataSvc specialized in detector data.
Definition at line 24 of file DetDataSvc.h.
| DetDataSvc::DetDataSvc | ( | const std::string & | name, |
| ISvcLocator * | svc | ||
| ) |
Standard Constructor.
Definition at line 186 of file DetDataSvc.cpp.
: base_class(name,svc), m_eventTime(0) { declareProperty("DetStorageType", m_detStorageType = XML_StorageType ); declareProperty("DetDbLocation", m_detDbLocation = "empty" ); declareProperty("DetDbRootName", m_detDbRootName = "dd" ); declareProperty("UsePersistency", m_usePersistency = false ); declareProperty("PersistencySvc", m_persistencySvcName = "DetectorPersistencySvc" ); m_rootName = "/dd"; m_rootCLID = CLID_Catalog; m_addrCreator = 0; }
| DetDataSvc::~DetDataSvc | ( | ) | [virtual] |
| StatusCode DetDataSvc::clearStore | ( | ) | [virtual] |
Remove all data objects in the data store.
Reimplemented from DataSvc.
Definition at line 152 of file DetDataSvc.cpp.
{
MsgStream log(msgSvc(), name());
DataSvc::clearStore().ignore();
if( m_usePersistency ) {
// Create root address
unsigned long iargs[] = {0,0};
const std::string args[] = {m_detDbLocation, m_detDbRootName};
IOpaqueAddress* rootAddr;
StatusCode sc = m_addrCreator->createAddress (m_detStorageType,
CLID_Catalog,
args,
iargs,
rootAddr);
// Set detector data store root
if( sc.isSuccess() ) {
std::string dbrName = "/" + m_detDbRootName;
sc = i_setRoot( dbrName, rootAddr );
if( sc.isFailure() ) {
error() << "Unable to set detector data store root" << endmsg;
}
} else {
error() << "Unable to create address for /dd" << endmsg;
}
return sc;
}
return StatusCode::SUCCESS;
}
| const Gaudi::Time & DetDataSvc::eventTime | ( | ) | const [virtual] |
| StatusCode DetDataSvc::finalize | ( | ) | [virtual] |
Finalize the service.
Reimplemented from DataSvc.
Definition at line 133 of file DetDataSvc.cpp.
{
DEBMSG << "Finalizing" << endmsg;
// clears the store
m_usePersistency = false; // avoid creation of an empty store when clearing
clearStore().ignore();
// Releases the address creator
m_addrCreator = 0;
// Releases the DataLoader
setDataLoader(0).ignore();
// Finalize the base class
return DataSvc::finalize();
}
| void DetDataSvc::handle | ( | const Incident & | inc ) | [virtual] |
Inform that a new incident has occured.
Inform that a new incident has occurred.
Definition at line 219 of file DetDataSvc.cpp.
| StatusCode DetDataSvc::initialize | ( | ) | [virtual] |
Initialize the service.
Reimplemented from DataSvc.
Definition at line 28 of file DetDataSvc.cpp.
{
// Call base class initialization
StatusCode sc = DataSvc::initialize();
if( UNLIKELY(sc.isFailure()) ) return sc;
// Set Data Loader
SmartIF<IConversionSvc> cnv_svc(serviceLocator()->service(m_persistencySvcName));
if( UNLIKELY(!cnv_svc.isValid()) ) {
error() << "Unable to retrieve " << m_persistencySvcName << endmsg;
return StatusCode::FAILURE;
}
sc = setDataLoader(cnv_svc);
if( UNLIKELY(sc.isFailure()) ) {
error() << "Unable to set DataLoader" << endmsg;
return sc;
}
// Get address creator from the DetectorPersistencySvc
m_addrCreator = cnv_svc;
if ( UNLIKELY(!m_addrCreator.isValid()) ) {
error() << "Unable to get AddressCreator." << endmsg;
return StatusCode::FAILURE;
}
return setupDetectorDescription();
}
| StatusCode DetDataSvc::reinitialize | ( | ) | [virtual] |
Initialize the service.
Reimplemented from DataSvc.
Definition at line 115 of file DetDataSvc.cpp.
{
// The DetectorDataSvc does not need to be re-initialized. If it is done
// all the Algorithms having references to DetectorElements will become
// invalid and crash the program. (Pere Mato)
// Call base class reinitialization
//StatusCode sc = DataSvc::reinitialize();
//if( sc.isFailure() ) return sc;
// Delete the associated event time
//if( 0 != m_eventTime ) delete m_eventTime;
//m_eventTimeDefined = false;
//return setupDetectorDescription();
return StatusCode::SUCCESS;
}
| void DetDataSvc::setEventTime | ( | const Gaudi::Time & | time ) | [virtual] |
Set the new event time.
Definition at line 203 of file DetDataSvc.cpp.
{
m_eventTime = time;
DEBMSG << "Event Time set to " << eventTime() << endmsg;
}
| StatusCode DetDataSvc::setupDetectorDescription | ( | ) | [private] |
Deal with Detector Description initialization.
Definition at line 56 of file DetDataSvc.cpp.
{
// Initialize the detector data transient store
ON_DEBUG {
debug() << "Storage type used is: " << m_detStorageType << endmsg;
debug() << "Setting DetectorDataSvc root node... " << endmsg;
}
if( m_usePersistency ) {
IOpaqueAddress* rootAddr;
if( m_detDbLocation.empty() || "empty" == m_detDbLocation ) {
// if the name of DBlocation is not given - construct it!
// by retrieving the value of XMLDDBROOT
if ( isEnvSet("XMLDDDBROOT") ) {
m_detDbLocation = getEnv("XMLDDDBROOT");
m_detDbLocation += "/DDDB/lhcb.xml";
}
}
if( m_detDbLocation.empty() || "empty" == m_detDbLocation ) {
error() << "Detector data location name not set. Detector data will "
"not be found." << endmsg;
return StatusCode::FAILURE;
}
else {
// Create address
unsigned long iargs[]={0,0};
const std::string args[] = {m_detDbLocation, m_detDbRootName};
StatusCode sc = m_addrCreator->createAddress (m_detStorageType,
CLID_Catalog,
args,
iargs,
rootAddr);
if( sc.isSuccess() ) {
std::string dbrName = "/" + m_detDbRootName;
sc = i_setRoot( dbrName, rootAddr );
if( sc.isFailure() ) {
error() << "Unable to set detector data store root" << endmsg;
return sc;
}
}
else {
error() << "Unable to create address for /dd" << endmsg;
return sc;
}
}
// Writing the description file in the output log file [bugs #2854]
always() << "Detector description database: " << m_detDbLocation << endmsg;
}
else {
info() << "Detector description not requested to be loaded" << endmsg;
}
return StatusCode::SUCCESS;
}
| StatusCode DetDataSvc::updateObject | ( | DataObject * | toUpdate ) | [virtual] |
Update object.
Reimplemented from DataSvc.
Definition at line 230 of file DetDataSvc.cpp.
{
DEBMSG << "Method updateObject starting" << endmsg;
// Check that object to update exists
if ( 0 == toUpdate ) {
error() << "There is no DataObject to update" << endmsg;
return INVALID_OBJECT;
}
// Retrieve IValidity interface of object to update
IValidity* condition = dynamic_cast<IValidity*>( toUpdate );
if ( 0 == condition ) {
warning()
<< "Cannot update DataObject: DataObject does not implement IValidity"
<< endmsg;
return StatusCode::SUCCESS;
}
// Check that the event time has been defined
if ( !validEventTime() ) {
warning()
<< "Cannot update DataObject: event time undefined"
<< endmsg;
return StatusCode::SUCCESS;
}
// No need to update if condition is valid
if ( condition->isValid( eventTime() ) ) {
DEBMSG << "DataObject is valid: no need to update" << endmsg;
return StatusCode::SUCCESS;
} else {
DEBMSG << "DataObject is invalid: update it" << endmsg;
}
// TODO: before loading updated object, update HERE its parent in data store
// Now delegate update to the conversion service by calling the base class
DEBMSG << "Delegate update to relevant conversion service" << endmsg;
StatusCode status = DataSvc::updateObject(toUpdate);
if ( !status.isSuccess() ) {
error() << "Could not update DataObject" << endmsg;
if ( status == NO_DATA_LOADER )
error() << "There is no data loader" << endmsg;
return status;
}
// Now cross-check that the new condition is valid
condition = dynamic_cast<IValidity*>(toUpdate);
if ( 0 == condition ) {
error() << "Updated DataObject does not implement IValidity" << endmsg;
return StatusCode::FAILURE;
}
if ( FSMState() == Gaudi::StateMachine::RUNNING &&
!condition->isValid( eventTime() ) ) {
error() << "Updated DataObject is not valid" << endmsg;
error() << "Are you sure the conversion service has updated it?" << endmsg;
return StatusCode::FAILURE;
}
// DataObject was successfully updated
DEBMSG << "Method updateObject exiting successfully" << endmsg;
return StatusCode::SUCCESS;
}
| bool DetDataSvc::validEventTime | ( | ) | const [virtual] |
Check if the event time has been set.
Kept for backward compatibility, returns always true.
Definition at line 209 of file DetDataSvc.cpp.
{
return true;
}
friend class SvcFactory< DetDataSvc > [friend] |
Definition at line 27 of file DetDataSvc.h.
SmartIF<IAddressCreator> DetDataSvc::m_addrCreator [private] |
Address Creator to be used.
Definition at line 103 of file DetDataSvc.h.
std::string DetDataSvc::m_detDbLocation [private] |
Location of detector Db (filename,URL)
Definition at line 88 of file DetDataSvc.h.
std::string DetDataSvc::m_detDbRootName [private] |
Name of the root node of the detector.
Definition at line 91 of file DetDataSvc.h.
int DetDataSvc::m_detStorageType [private] |
Detector Data Persistency Storage type.
Definition at line 85 of file DetDataSvc.h.
Gaudi::Time DetDataSvc::m_eventTime [private] |
Current event time.
Definition at line 100 of file DetDataSvc.h.
std::string DetDataSvc::m_persistencySvcName [private] |
Name of the persistency service.
Definition at line 94 of file DetDataSvc.h.
bool DetDataSvc::m_usePersistency [private] |
Flag to control if the persistency is required.
Definition at line 97 of file DetDataSvc.h.