The Gaudi Framework  master (08f81203)
Loading...
Searching...
No Matches
EvtStoreSvc Class Reference

Use a minimal event store implementation, and adds everything required to satisfy the IDataProviderSvc, IDataManagerSvc and IHiveWhiteBoard interfaces by throwing exceptions except when the functionality is really needed... More...

Inheritance diagram for EvtStoreSvc:
Collaboration diagram for EvtStoreSvc:

Public Member Functions

CLID rootCLID () const override
const std::string & rootName () const override
StatusCode setDataLoader (IConversionSvc *svc, IDataProviderSvc *dpsvc) override
size_t allocateStore (int evtnumber) override
 Allocate a store partition for a given event number.
StatusCode freeStore (size_t partition) override
 Free a store partition.
size_t freeSlots () override
StatusCode selectStore (size_t partition) override
 Activate a partition object. The identifies the partition uniquely.
StatusCode clearStore () override
StatusCode clearStore (size_t partition) override
 Remove all data objects in one 'slot' of the data store.
StatusCode setNumberOfStores (size_t slots) override
 Set the number of event slots (copies of DataSvc objects).
size_t getNumberOfStores () const override
size_t getPartitionNumber (int eventnumber) const override
 Get the partition number corresponding to a given event.
bool exists (const DataObjID &id) override
StatusCode objectParent (const DataObject *, IRegistry *&) override
StatusCode objectParent (const IRegistry *, IRegistry *&) override
StatusCode objectLeaves (const DataObject *, std::vector< IRegistry * > &) override
StatusCode objectLeaves (const IRegistry *, std::vector< IRegistry * > &) override
StatusCode clearSubTree (std::string_view) override
StatusCode clearSubTree (DataObject *obj) override
StatusCode traverseSubTree (std::string_view, IDataStoreAgent *) override
StatusCode traverseSubTree (DataObject *obj, IDataStoreAgent *pAgent) override
StatusCode traverseTree (IDataStoreAgent *pAgent) override
StatusCode setRoot (std::string root_name, DataObject *pObject) override
StatusCode setRoot (std::string root_path, IOpaqueAddress *pRootAddr) override
StatusCode unregisterAddress (std::string_view) override
StatusCode unregisterAddress (IRegistry *, std::string_view) override
StatusCode registerAddress (std::string_view fullPath, IOpaqueAddress *pAddress) override
StatusCode registerAddress (IRegistry *parentObj, std::string_view objectPath, IOpaqueAddress *pAddress) override
StatusCode registerObject (std::string_view parentPath, std::string_view objectPath, DataObject *pObject) override
StatusCode registerObject (DataObject *parentObj, std::string_view objectPath, DataObject *pObject) override
StatusCode unregisterObject (std::string_view) override
StatusCode unregisterObject (DataObject *obj) override
StatusCode unregisterObject (DataObject *obj, std::string_view sr) override
StatusCode retrieveObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
StatusCode findObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
StatusCode findObject (std::string_view fullPath, DataObject *&pObject) override
StatusCode updateObject (IRegistry *) override
StatusCode updateObject (DataObject *) override
StatusCode addPreLoadItem (const DataStoreItem &) override
StatusCode removePreLoadItem (const DataStoreItem &) override
StatusCode resetPreLoad () override
StatusCode preLoad () override
StatusCode linkObject (IRegistry *, std::string_view, DataObject *) override
StatusCode linkObject (std::string_view, DataObject *) override
StatusCode unlinkObject (IRegistry *, std::string_view) override
StatusCode unlinkObject (DataObject *, std::string_view) override
StatusCode unlinkObject (std::string_view) override
StatusCode initialize () override
StatusCode finalize () override
Public Member Functions inherited from extends< Service, IDataProviderSvc, IDataManagerSvc, IHiveWhiteBoard >
void const * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast.
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface.
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames.
Public Member Functions inherited from Service
const std::string & name () const override
 Retrieve name of the service.
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.
StatusCode sysStart () override
 Initialize Service.
StatusCode sysStop () override
 Initialize Service.
StatusCode sysFinalize () override
 Finalize Service.
StatusCode sysReinitialize () override
 Re-initialize the Service.
StatusCode sysRestart () override
 Re-initialize the Service.
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor.
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator.
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
template<class T>
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, bool createIf=true)
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, const std::string &toolTypeAndName, bool createIf=true)
 Declare used tool.
template<class T>
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
template<class T>
void addToolsArray (ToolHandleArray< T > &hndlArr)
const std::vector< IAlgTool * > & tools () const
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 PropertyHolder ()=default
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property.
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property.
StatusCode setPropertyRepr (const std::string &n, const std::string &r) override
 set the property from name and value string representation
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties
bool hasProperty (std::string_view name) const override
 Return true if we have a property with the given name.
Gaudi::Details::PropertyBaseproperty (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected
void bindPropertiesTo (Gaudi::Interfaces::IOptionsSvc &optsSvc)
PropertyHolderoperator= (const PropertyHolder &)=delete
Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor.
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
MsgStreammsgStream () const
 Return an uninitialized MsgStream.
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS)
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL)
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR)
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR)
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING)
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO)
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG)
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE)
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO)
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream)
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream

Private Member Functions

std::size_t poolSize () const
void fillStats (Partition &p) const
void initStore (Partition &p) const

Private Attributes

Gaudi::Property< CLIDm_rootCLID { this, "RootCLID", 110 , "CLID of root entry" }
Gaudi::Property< std::string > m_rootName { this, "RootName", "/Event", "name of root entry" }
Gaudi::Property< bool > m_forceLeaves
Gaudi::Property< std::string > m_loader { this, "DataLoader", "EventPersistencySvc" }
Gaudi::Property< size_t > m_slots { this, "EventSlots", 1, "number of event slots" }
Gaudi::Property< bool > m_printPoolStats { this, "PrintPoolStats", false, "Print memory pool statistics" }
Gaudi::Property< std::size_t > m_poolSize { this, "PoolSize", 1024, "Initial per-event memory pool size [KiB]" }
Gaudi::Property< std::size_t > m_estStoreBuckets
Gaudi::Accumulators::AveragingCounter< std::size_t > m_usedPoolSize
Gaudi::Accumulators::AveragingCounter< std::size_t > m_servedPoolAllocations
Gaudi::Accumulators::AveragingCounter< std::size_t > m_usedPoolAllocations
Gaudi::Accumulators::AveragingCounter< std::size_t > m_storeEntries
Gaudi::Accumulators::AveragingCounter< std::size_t > m_storeBuckets
SmartIF< IConversionSvcm_dataLoader
std::vector< DataStoreItemm_preLoads
 Items to be pre-loaded.
std::vector< Synced< Partition > > m_partitions
 The actual store(s).
tbb::concurrent_queue< size_t > m_freeSlots
Gaudi::Property< std::vector< std::string > > m_inhibitPrefixes
Gaudi::Property< bool > m_followLinksToAncestors
std::string_view m_onlyThisID

Additional Inherited Members

Public Types inherited from extends< Service, IDataProviderSvc, IDataManagerSvc, IHiveWhiteBoard >
using base_class
 Typedef to this class.
using extend_interfaces_base
 Typedef to the base of this class.
Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory<IService*( const std::string&, ISvcLocator* )>
Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl
 Typedef used to refer to this class from derived classes, as in.
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class
Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids
 take union of the ext_iids of all Interfaces...
Protected Member Functions inherited from Service
std::vector< IAlgTool * > & tools ()
 ~Service () override
int outputLevel () const
 get the Service's output level
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const override final
 Set up local caches.
MSG::Level resetMessaging ()
 Reinitialize internal states.
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream.
Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state.
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state.
Gaudi::Property< int > m_outputLevel { this, "OutputLevel", MSG::NIL, "output level" }
 flag indicating whether ToolHandle tools have been added to m_tools
Gaudi::Property< bool > m_auditorInitialize { this, "AuditInitialize", false, "trigger auditor on initialize()" }
Gaudi::Property< bool > m_auditorStart { this, "AuditStart", false, "trigger auditor on start()" }
Gaudi::Property< bool > m_auditorStop { this, "AuditStop", false, "trigger auditor on stop()" }
Gaudi::Property< bool > m_auditorFinalize { this, "AuditFinalize", false, "trigger auditor on finalize()" }
Gaudi::Property< bool > m_auditorReinitialize { this, "AuditReinitialize", false, "trigger auditor on reinitialize()" }
Gaudi::Property< bool > m_auditorRestart { this, "AuditRestart", false, "trigger auditor on restart()" }
Gaudi::Property< bool > m_autoRetrieveTools
Gaudi::Property< bool > m_checkToolDeps
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service.

Detailed Description

Use a minimal event store implementation, and adds everything required to satisfy the IDataProviderSvc, IDataManagerSvc and IHiveWhiteBoard interfaces by throwing exceptions except when the functionality is really needed...

Author
Gerhard Raven
Version
1.0

Definition at line 235 of file EvtStoreSvc.cpp.

Member Function Documentation

◆ addPreLoadItem()

StatusCode EvtStoreSvc::addPreLoadItem ( const DataStoreItem & item)
override

Definition at line 655 of file EvtStoreSvc.cpp.

655 {
656 auto i = std::find( m_preLoads.begin(), m_preLoads.end(), item );
657 if ( i == m_preLoads.end() ) m_preLoads.push_back( item );
658 return StatusCode::SUCCESS;
659}
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
constexpr static const auto SUCCESS
Definition StatusCode.h:99

◆ allocateStore()

size_t EvtStoreSvc::allocateStore ( int evtnumber)
override

Allocate a store partition for a given event number.

Definition at line 420 of file EvtStoreSvc.cpp.

420 {
421 // take next free slot in the list
422 size_t slot = std::string::npos;
423 if ( m_freeSlots.try_pop( slot ) ) {
424 assert( slot != std::string::npos );
425 assert( slot < m_partitions.size() );
426 [[maybe_unused]] auto prev = m_partitions[slot].with_lock(
427 [evtnumber]( Partition& p ) { return std::exchange( p.eventNumber, evtnumber ); } );
428 assert( prev == -1 ); // or whatever value represents 'free'
429 }
430 return slot;
431}
std::vector< Synced< Partition > > m_partitions
The actual store(s).
tbb::concurrent_queue< size_t > m_freeSlots

◆ clearStore() [1/2]

StatusCode EvtStoreSvc::clearStore ( )
override

Definition at line 481 of file EvtStoreSvc.cpp.

481 {
482 m_onlyThisID = {};
483 return fwd( [this]( Partition& p ) {
484 fillStats( p );
485 initStore( p ); // replace with a clean store
486 return StatusCode::SUCCESS;
487 } );
488}
void fillStats(Partition &p) const
void initStore(Partition &p) const
std::string_view m_onlyThisID

◆ clearStore() [2/2]

StatusCode EvtStoreSvc::clearStore ( size_t partition)
override

Remove all data objects in one 'slot' of the data store.

Definition at line 466 of file EvtStoreSvc.cpp.

466 {
467 m_onlyThisID = {};
468 return m_partitions[partition].with_lock( [this]( Partition& p ) {
469 fillStats( p );
470 initStore( p ); // replace with a clean store
471 return StatusCode::SUCCESS;
472 } );
473}

◆ clearSubTree() [1/2]

StatusCode EvtStoreSvc::clearSubTree ( DataObject * obj)
inlineoverride

Definition at line 321 of file EvtStoreSvc.cpp.

321 {
322 return obj && obj->registry() ? clearSubTree( obj->registry()->identifier() ) : StatusCode::FAILURE;
323 }
IRegistry * registry() const
Get pointer to Registry.
Definition DataObject.h:79
StatusCode clearSubTree(std::string_view) override
virtual const id_type & identifier() const =0
Full identifier (or key).

◆ clearSubTree() [2/2]

StatusCode EvtStoreSvc::clearSubTree ( std::string_view top)
override

Definition at line 474 of file EvtStoreSvc.cpp.

474 {
475 top = normalize_path( top, rootName() );
476 return fwd( [&]( Partition& p ) {
477 p.store->erase_if( [top]( const auto& value ) { return value.first.starts_with( top ); } );
478 return StatusCode::SUCCESS;
479 } );
480}
const std::string & rootName() const override

◆ exists()

bool EvtStoreSvc::exists ( const DataObjID & id)
inlineoverride

Definition at line 309 of file EvtStoreSvc.cpp.

309 {
310 DataObject* pObject{ nullptr };
311 return findObject( id.fullKey(), pObject ).isSuccess();
312 }
StatusCode findObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
bool isSuccess() const
Definition StatusCode.h:302

◆ fillStats()

void EvtStoreSvc::fillStats ( Partition & p) const
inlineprivate

Definition at line 252 of file EvtStoreSvc.cpp.

252 {
253 if ( !m_printPoolStats ) return;
254 auto n_allocs = p.store->num_allocations();
255 if ( n_allocs ) {
256 m_storeEntries += p.store->size();
257 m_usedPoolSize += p.store->used_bytes();
258 m_storeBuckets += p.store->used_buckets();
259 m_usedPoolAllocations += p.store->used_blocks();
260 m_servedPoolAllocations += n_allocs;
261 }
262 }
Gaudi::Accumulators::AveragingCounter< std::size_t > m_usedPoolAllocations
Gaudi::Accumulators::AveragingCounter< std::size_t > m_storeBuckets
Gaudi::Accumulators::AveragingCounter< std::size_t > m_servedPoolAllocations
Gaudi::Property< bool > m_printPoolStats
Gaudi::Accumulators::AveragingCounter< std::size_t > m_usedPoolSize
Gaudi::Accumulators::AveragingCounter< std::size_t > m_storeEntries

◆ finalize()

StatusCode EvtStoreSvc::finalize ( )
inlineoverride

Definition at line 396 of file EvtStoreSvc.cpp.

396 {
397 if ( m_printPoolStats ) {
398 info() << "Mean memory pool usage: " << float( 1e-3f * float( m_usedPoolSize.mean() ) ) << " KiB serving "
399 << float( m_servedPoolAllocations.mean() ) << " allocations from " << float( m_usedPoolAllocations.mean() )
400 << " to produce " << float( m_storeEntries.mean() ) << " entries in " << float( m_storeBuckets.mean() )
401 << " buckets" << endmsg;
402 }
403 setDataLoader( nullptr, nullptr ).ignore(); // release
404 return extends::finalize();
405 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc) override
void ignore() const
Allow discarding a StatusCode without warning.
Definition StatusCode.h:128

◆ findObject() [1/2]

StatusCode EvtStoreSvc::findObject ( IRegistry * pDirectory,
std::string_view path,
DataObject *& pObject )
override

Definition at line 645 of file EvtStoreSvc.cpp.

645 {
646 return retrieveObject( pDirectory, path, pObject );
647}
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override

◆ findObject() [2/2]

StatusCode EvtStoreSvc::findObject ( std::string_view fullPath,
DataObject *& pObject )
override

Definition at line 648 of file EvtStoreSvc.cpp.

648 {
649 return retrieveObject( nullptr, fullPath, pObject );
650}

◆ freeSlots()

size_t EvtStoreSvc::freeSlots ( )
inlineoverride

Definition at line 302 of file EvtStoreSvc.cpp.

302{ return m_freeSlots.unsafe_size(); }

◆ freeStore()

StatusCode EvtStoreSvc::freeStore ( size_t partition)
override

Free a store partition.

Definition at line 458 of file EvtStoreSvc.cpp.

458 {
459 assert( partition < m_partitions.size() );
460 auto prev = m_partitions[partition].with_lock( []( Partition& p ) { return std::exchange( p.eventNumber, -1 ); } );
461 if ( prev == -1 ) return StatusCode::FAILURE; // double free -- should never happen!
462 m_freeSlots.push( partition );
463 return StatusCode::SUCCESS;
464}
constexpr static const auto FAILURE
Definition StatusCode.h:100

◆ getNumberOfStores()

size_t EvtStoreSvc::getNumberOfStores ( ) const
inlineoverride

Definition at line 307 of file EvtStoreSvc.cpp.

307{ return m_slots; }
Gaudi::Property< size_t > m_slots

◆ getPartitionNumber()

size_t EvtStoreSvc::getPartitionNumber ( int eventnumber) const
override

Get the partition number corresponding to a given event.

Definition at line 447 of file EvtStoreSvc.cpp.

447 {
448 auto i = std::find_if( begin( m_partitions ), end( m_partitions ),
449 with_lock( [eventnumber]( const Partition& p ) { return p.eventNumber == eventnumber; } ) );
450 return i != end( m_partitions ) ? std::distance( begin( m_partitions ), i ) : std::string::npos;
451}
AttribStringParser::Iterator begin(const AttribStringParser &parser)
auto with_lock(Fun &&f)

◆ initialize()

StatusCode EvtStoreSvc::initialize ( )
inlineoverride

Definition at line 374 of file EvtStoreSvc.cpp.

374 {
375 Entry::setDataProviderSvc( this );
376 extends::initialize().ignore();
377 if ( !setNumberOfStores( m_slots ).isSuccess() ) {
378 error() << "Cannot set number of slots" << endmsg;
379 return StatusCode::FAILURE;
380 }
381 m_partitions = std::vector<Synced<Partition>>( m_slots );
382 // m_partitions is now full of empty std::optionals, fill them now.
383 for ( auto& synced_p : m_partitions ) {
384 synced_p.with_lock( [this]( Partition& p ) { initStore( p ); } );
385 }
386 for ( size_t i = 0; i < m_slots; i++ ) { m_freeSlots.push( i ); }
387 selectStore( 0 ).ignore();
388
389 auto loader = serviceLocator()->service( m_loader ).as<IConversionSvc>().get();
390 if ( !loader ) {
391 error() << "Cannot get IConversionSvc " << m_loader.value() << endmsg;
392 return StatusCode::FAILURE;
393 }
394 return setDataLoader( loader, nullptr );
395 }
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode selectStore(size_t partition) override
Activate a partition object. The identifies the partition uniquely.
Gaudi::Property< std::string > m_loader
StatusCode setNumberOfStores(size_t slots) override
Set the number of event slots (copies of DataSvc objects).
virtual SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition Service.cpp:336
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
Definition SmartIF.h:110
get
decorate the vector of properties
Definition decorators.py:94

◆ initStore()

void EvtStoreSvc::initStore ( Partition & p) const
inlineprivate

Definition at line 264 of file EvtStoreSvc.cpp.

264 {
265 if ( p.store ) {
266 // re-use the existing memory pool
267 p.store->reset();
268 } else {
269 p.store.emplace( m_estStoreBuckets, poolSize() );
270 }
271 }
std::size_t poolSize() const
Gaudi::Property< std::size_t > m_estStoreBuckets

◆ linkObject() [1/2]

StatusCode EvtStoreSvc::linkObject ( IRegistry * ,
std::string_view ,
DataObject *  )
inlineoverride

Definition at line 368 of file EvtStoreSvc.cpp.

368{ return dummy( __FUNCTION__ ); }

◆ linkObject() [2/2]

StatusCode EvtStoreSvc::linkObject ( std::string_view ,
DataObject *  )
inlineoverride

Definition at line 369 of file EvtStoreSvc.cpp.

369{ return dummy( __FUNCTION__ ); }

◆ objectLeaves() [1/2]

StatusCode EvtStoreSvc::objectLeaves ( const DataObject * ,
std::vector< IRegistry * > &  )
inlineoverride

Definition at line 317 of file EvtStoreSvc.cpp.

317{ return StatusCode::SUCCESS; }

◆ objectLeaves() [2/2]

StatusCode EvtStoreSvc::objectLeaves ( const IRegistry * ,
std::vector< IRegistry * > &  )
inlineoverride

Definition at line 318 of file EvtStoreSvc.cpp.

318{ return StatusCode::SUCCESS; }

◆ objectParent() [1/2]

StatusCode EvtStoreSvc::objectParent ( const DataObject * ,
IRegistry *&  )
inlineoverride

Definition at line 314 of file EvtStoreSvc.cpp.

314{ return dummy( __FUNCTION__ ); }

◆ objectParent() [2/2]

StatusCode EvtStoreSvc::objectParent ( const IRegistry * ,
IRegistry *&  )
inlineoverride

Definition at line 315 of file EvtStoreSvc.cpp.

315{ return dummy( __FUNCTION__ ); }

◆ poolSize()

std::size_t EvtStoreSvc::poolSize ( ) const
inlineprivate

Definition at line 250 of file EvtStoreSvc.cpp.

250{ return m_poolSize * 1024; }
Gaudi::Property< std::size_t > m_poolSize

◆ preLoad()

StatusCode EvtStoreSvc::preLoad ( )
override

Definition at line 665 of file EvtStoreSvc.cpp.

665 {
666 for ( const auto& i : m_preLoads ) {
667 DataObject* pObj;
668 if ( msgLevel( MSG::DEBUG ) ) debug() << "Preloading " << i.path() << endmsg;
669 retrieveObject( nullptr, i.path(), pObj ).ignore();
670 }
671 return StatusCode::SUCCESS;
672}
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
@ DEBUG
Definition IMessageSvc.h:22

◆ registerAddress() [1/2]

StatusCode EvtStoreSvc::registerAddress ( IRegistry * parentObj,
std::string_view objectPath,
IOpaqueAddress * pAddress )
override

Definition at line 553 of file EvtStoreSvc.cpp.

553 {
554 auto addr = std::unique_ptr<IOpaqueAddress>( pAddr );
555 if ( !addr ) return Status::INVALID_OBJ_ADDR; // Precondition: Address must be valid
556 if ( msgLevel( MSG::DEBUG ) ) {
557 debug() << "registerAddress( (IRegistry*)" << (void*)pReg << ", " << path << ", (IOpaqueAddress*)" << addr.get()
558 << "[ " << addr->par()[0] << ", " << addr->par()[1] << " ]"
559 << " )" << endmsg;
560 }
561 if ( path.empty() || path[0] != '/' ) return StatusCode::FAILURE;
562 if ( !m_onlyThisID.empty() && addr->par()[0] != m_onlyThisID ) {
563 if ( msgLevel( MSG::DEBUG ) )
564 debug() << "Attempt to load " << addr->par()[1] << " from file " << addr->par()[0] << " blocked -- different file"
565 << endmsg;
566 return StatusCode::SUCCESS;
567 }
568 if ( std::any_of(
570 [addrPath = addr->par()[1]]( std::string_view prefix ) { return addrPath.starts_with( prefix ); } ) ) {
571 if ( msgLevel( MSG::DEBUG ) )
572 debug() << "Attempt to load " << addr->par()[1] << " from file " << addr->par()[0] << " blocked -- path inhibited"
573 << endmsg;
574 return StatusCode::SUCCESS;
575 }
576
577 auto object = createObj( *m_dataLoader, *addr ); // Call data loader
578 if ( !object ) return Status::INVALID_OBJECT;
579 auto fullpath = ( pReg ? pReg->identifier() : m_rootName.value() ) + std::string{ path };
580 // the data loader expects the path _including_ the root
581 LocalArena dummy_arena{ fullpath.size() + 1 };
582 auto dummy = Entry{ fullpath, {}, {}, &dummy_arena };
583 object->setRegistry( &dummy );
584 addr->setRegistry( &dummy );
585 auto status = m_dataLoader->fillObjRefs( addr.get(), object.get() );
586 if ( !status.isSuccess() ) return status;
587 // note: put will overwrite the registry in pObject to point at the
588 // one actually used -- so we do not dangle, pointing at dummy beyond its
589 // lifetime
590 if ( msgLevel( MSG::DEBUG ) ) {
591 auto ptr = object.get();
592 debug() << "registerAddress: " << std::quoted( normalize_path( fullpath, rootName() ) ) << " (DataObject*)"
593 << static_cast<void*>( ptr ) << ( ptr ? " -> " + System::typeinfoName( typeid( *ptr ) ) : std::string{} )
594 << endmsg;
595 }
596 fwd( [&]( Partition& p ) {
597 p.store->put( normalize_path( fullpath, rootName() ), std::move( object ), std::move( addr ) );
598 return StatusCode::SUCCESS;
599 } ).ignore();
600 return status;
601}
Gaudi::Property< std::vector< std::string > > m_inhibitPrefixes
SmartIF< IConversionSvc > m_dataLoader
Gaudi::Property< std::string > m_rootName
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition System.cpp:254

◆ registerAddress() [2/2]

StatusCode EvtStoreSvc::registerAddress ( std::string_view fullPath,
IOpaqueAddress * pAddress )
override

Definition at line 550 of file EvtStoreSvc.cpp.

550 {
551 return registerAddress( nullptr, path, pAddr );
552}
StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress) override

◆ registerObject() [1/2]

StatusCode EvtStoreSvc::registerObject ( DataObject * parentObj,
std::string_view objectPath,
DataObject * pObject )
override

Definition at line 608 of file EvtStoreSvc.cpp.

608 {
609 if ( parentObj ) return StatusCode::FAILURE;
610 return fwd( [&, object = std::unique_ptr<DataObject>( pObject ),
611 path = normalize_path( path, rootName() )]( Partition& p ) mutable {
612 if ( m_forceLeaves ) {
613 auto dir = path;
614 for ( auto i = dir.rfind( '/' ); i != std::string_view::npos; i = dir.rfind( '/' ) ) {
615 dir = dir.substr( 0, i );
616 if ( !p.store->find( dir ) ) {
617 if ( msgLevel( MSG::DEBUG ) ) {
618 debug() << "registerObject: adding directory " << std::quoted( dir ) << endmsg;
619 }
620 p.store->put( dir, std::unique_ptr<DataObject>{} );
621 }
622 }
623 }
624 if ( msgLevel( MSG::DEBUG ) ) {
625 auto ptr = object.get();
626 debug() << "registerObject: " << std::quoted( path ) << " (DataObject*)" << static_cast<void*>( ptr )
627 << ( ptr ? " -> " + System::typeinfoName( typeid( *ptr ) ) : std::string{} ) << endmsg;
628 }
629 p.store->put( path, std::move( object ) );
630 return StatusCode::SUCCESS;
631 } );
632}
Gaudi::Property< bool > m_forceLeaves

◆ registerObject() [2/2]

StatusCode EvtStoreSvc::registerObject ( std::string_view parentPath,
std::string_view objectPath,
DataObject * pObject )
override

Definition at line 602 of file EvtStoreSvc.cpp.

603 {
604 return parentPath.empty()
605 ? registerObject( nullptr, objectPath, pObject )
606 : registerObject( nullptr, std::string{ parentPath }.append( "/" ).append( objectPath ), pObject );
607}
StatusCode registerObject(std::string_view parentPath, std::string_view objectPath, DataObject *pObject) override

◆ removePreLoadItem()

StatusCode EvtStoreSvc::removePreLoadItem ( const DataStoreItem & item)
override

Definition at line 660 of file EvtStoreSvc.cpp.

660 {
661 auto i = std::remove( m_preLoads.begin(), m_preLoads.begin(), item );
662 m_preLoads.erase( i, m_preLoads.end() );
663 return StatusCode::SUCCESS;
664}

◆ resetPreLoad()

StatusCode EvtStoreSvc::resetPreLoad ( )
inlineoverride

Definition at line 362 of file EvtStoreSvc.cpp.

362 {
363 m_preLoads.clear();
364 return StatusCode::SUCCESS;
365 }

◆ retrieveObject()

StatusCode EvtStoreSvc::retrieveObject ( IRegistry * pDirectory,
std::string_view path,
DataObject *& pObject )
override

Definition at line 633 of file EvtStoreSvc.cpp.

633 {
634 if ( pDirectory ) return StatusCode::FAILURE;
635 return fwd( [&]( Partition& p ) {
636 path = normalize_path( path, rootName() );
637 pObject = const_cast<DataObject*>( p.store->get( path ) );
638 if ( msgLevel( MSG::DEBUG ) ) {
639 debug() << "retrieveObject: " << std::quoted( path ) << " (DataObject*)" << (void*)pObject
640 << ( pObject ? " -> " + System::typeinfoName( typeid( *pObject ) ) : std::string{} ) << endmsg;
641 }
642 return pObject ? StatusCode::SUCCESS : StatusCode::FAILURE;
643 } );
644}

◆ rootCLID()

CLID EvtStoreSvc::rootCLID ( ) const
override

Definition at line 412 of file EvtStoreSvc.cpp.

412{ return m_rootCLID; }
Gaudi::Property< CLID > m_rootCLID

◆ rootName()

const std::string & EvtStoreSvc::rootName ( ) const
override

Definition at line 413 of file EvtStoreSvc.cpp.

413{ return m_rootName; }

◆ selectStore()

StatusCode EvtStoreSvc::selectStore ( size_t partition)
override

Activate a partition object. The identifies the partition uniquely.

Definition at line 453 of file EvtStoreSvc.cpp.

453 {
454 s_current = &m_partitions[partition];
455 return StatusCode::SUCCESS;
456}

◆ setDataLoader()

StatusCode EvtStoreSvc::setDataLoader ( IConversionSvc * svc,
IDataProviderSvc * dpsvc )
override

Definition at line 414 of file EvtStoreSvc.cpp.

414 {
415 m_dataLoader = pDataLoader;
416 if ( m_dataLoader ) m_dataLoader->setDataProvider( dpsvc ? dpsvc : this ).ignore();
417 return StatusCode::SUCCESS;
418}

◆ setNumberOfStores()

StatusCode EvtStoreSvc::setNumberOfStores ( size_t slots)
override

Set the number of event slots (copies of DataSvc objects).

Definition at line 433 of file EvtStoreSvc.cpp.

433 {
434 if ( slots < size_t{ 1 } ) {
435 error() << "Invalid number of slots (" << slots << ")" << endmsg;
436 return StatusCode::FAILURE;
437 }
439 error() << "Too late to change the number of slots!" << endmsg;
440 return StatusCode::FAILURE;
441 }
442 m_slots = slots;
444 return StatusCode::SUCCESS;
445}
static GAUDI_API void setNumConcEvents(const std::size_t &nE)
Gaudi::StateMachine::State FSMState() const override
Definition Service.h:55

◆ setRoot() [1/2]

StatusCode EvtStoreSvc::setRoot ( std::string root_name,
DataObject * pObject )
override

Definition at line 510 of file EvtStoreSvc.cpp.

510 {
511 if ( msgLevel( MSG::DEBUG ) ) {
512 debug() << "setRoot( " << root_path << ", (DataObject*)" << (void*)pObject << " )" << endmsg;
513 }
514 if ( !fwd( []( Partition& p ) {
515 return p.store->empty() ? StatusCode::SUCCESS : StatusCode::FAILURE;
516 } ).isSuccess() ) {
517 throw GaudiException{ "setRoot called with non-empty store", "EvtStoreSvc", StatusCode::FAILURE };
518 }
519 return registerObject( nullptr, root_path, pObject );
520}

◆ setRoot() [2/2]

StatusCode EvtStoreSvc::setRoot ( std::string root_path,
IOpaqueAddress * pRootAddr )
override

Definition at line 521 of file EvtStoreSvc.cpp.

521 {
522 auto rootAddr = std::unique_ptr<IOpaqueAddress>( pRootAddr );
523 if ( msgLevel( MSG::DEBUG ) ) {
524 debug() << "setRoot( " << root_path << ", (IOpaqueAddress*)" << rootAddr.get();
525 if ( rootAddr ) debug() << "[ " << rootAddr->par()[0] << ", " << rootAddr->par()[1] << " ]";
526 debug() << " )" << endmsg;
527 }
528 if ( !fwd( []( Partition& p ) {
529 return p.store->empty() ? StatusCode::SUCCESS : StatusCode::FAILURE;
530 } ).isSuccess() ) {
531 throw GaudiException{ "setRoot called with non-empty store", "EvtStoreSvc", StatusCode::FAILURE };
532 }
533 if ( !rootAddr ) return Status::INVALID_OBJ_ADDR; // Precondition: Address must be valid
534 if ( !m_followLinksToAncestors ) m_onlyThisID = rootAddr->par()[0];
535 auto object = createObj( *m_dataLoader, *rootAddr ); // Call data loader
536 if ( !object ) return Status::INVALID_OBJECT;
537 if ( msgLevel( MSG::DEBUG ) ) { debug() << "Root Object " << root_path << " created " << endmsg; }
538 LocalArena dummy_arena{ root_path.size() + 1 };
539 auto dummy = Entry{ root_path, {}, {}, &dummy_arena };
540 object->setRegistry( &dummy );
541 rootAddr->setRegistry( &dummy );
542 auto status = m_dataLoader->fillObjRefs( rootAddr.get(), object.get() );
543 if ( status.isSuccess() ) {
544 auto pObject = object.get();
545 status = registerObject( nullptr, root_path, object.release() );
546 if ( status.isSuccess() ) pObject->registry()->setAddress( rootAddr.release() );
547 }
548 return status;
549}
Gaudi::Property< bool > m_followLinksToAncestors
str release
Definition conf.py:27

◆ traverseSubTree() [1/2]

StatusCode EvtStoreSvc::traverseSubTree ( DataObject * obj,
IDataStoreAgent * pAgent )
inlineoverride

Definition at line 326 of file EvtStoreSvc.cpp.

326 {
327 return ( obj && obj->registry() ) ? traverseSubTree( obj->registry()->identifier(), pAgent ) : StatusCode::FAILURE;
328 }
StatusCode traverseSubTree(std::string_view, IDataStoreAgent *) override

◆ traverseSubTree() [2/2]

StatusCode EvtStoreSvc::traverseSubTree ( std::string_view top,
IDataStoreAgent * pAgent )
override

Definition at line 489 of file EvtStoreSvc.cpp.

489 {
490 return fwd( [&]( Partition& p ) {
491 top = normalize_path( top, rootName() );
492 unsigned int nbSlashesInRootName = std::count( rootName().begin(), rootName().end(), '/' );
493 auto cmp = []( const Entry* lhs, const Entry* rhs ) { return lhs->identifier() < rhs->identifier(); };
494 std::set<const Entry*, decltype( cmp )> keys{ std::move( cmp ) };
495 for ( const auto& v : *p.store ) {
496 if ( v.second.identifier().starts_with( top ) ) keys.insert( &v.second );
497 }
498 auto k = keys.begin();
499 while ( k != keys.end() ) {
500 const auto& id = ( *k )->identifier();
501 int level = std::count( id.begin(), id.end(), '/' ) + nbSlashesInRootName;
502 bool accept = pAgent->analyse( const_cast<Entry*>( *( k++ ) ), level );
503 if ( !accept ) {
504 k = std::find_if_not( k, keys.end(), [&id]( const auto& e ) { return e->identifier().starts_with( id ); } );
505 }
506 }
507 return StatusCode::SUCCESS;
508 } );
509}
virtual bool analyse(IRegistry *pObject, int level)=0
Analyse the data object.

◆ traverseTree()

StatusCode EvtStoreSvc::traverseTree ( IDataStoreAgent * pAgent)
inlineoverride

Definition at line 329 of file EvtStoreSvc.cpp.

329{ return traverseSubTree( std::string_view{}, pAgent ); }

◆ unlinkObject() [1/3]

StatusCode EvtStoreSvc::unlinkObject ( DataObject * ,
std::string_view  )
inlineoverride

Definition at line 371 of file EvtStoreSvc.cpp.

371{ return dummy( __FUNCTION__ ); }

◆ unlinkObject() [2/3]

StatusCode EvtStoreSvc::unlinkObject ( IRegistry * ,
std::string_view  )
inlineoverride

Definition at line 370 of file EvtStoreSvc.cpp.

370{ return dummy( __FUNCTION__ ); }

◆ unlinkObject() [3/3]

StatusCode EvtStoreSvc::unlinkObject ( std::string_view )
inlineoverride

Definition at line 372 of file EvtStoreSvc.cpp.

372{ return dummy( __FUNCTION__ ); }

◆ unregisterAddress() [1/2]

StatusCode EvtStoreSvc::unregisterAddress ( IRegistry * ,
std::string_view  )
inlineoverride

Definition at line 335 of file EvtStoreSvc.cpp.

335{ return dummy( __FUNCTION__ ); };

◆ unregisterAddress() [2/2]

StatusCode EvtStoreSvc::unregisterAddress ( std::string_view )
inlineoverride

Definition at line 334 of file EvtStoreSvc.cpp.

334{ return dummy( __FUNCTION__ ); };

◆ unregisterObject() [1/3]

StatusCode EvtStoreSvc::unregisterObject ( DataObject * obj)
inlineoverride

Definition at line 343 of file EvtStoreSvc.cpp.

343 {
344 return ( obj && obj->registry() ) ? unregisterObject( obj->registry()->identifier() ) : StatusCode::FAILURE;
345 }
StatusCode unregisterObject(std::string_view) override

◆ unregisterObject() [2/3]

StatusCode EvtStoreSvc::unregisterObject ( DataObject * obj,
std::string_view sr )
inlineoverride

Definition at line 346 of file EvtStoreSvc.cpp.

346 {
347 return !obj ? unregisterObject( sr )
348 : obj->registry() ? unregisterObject( ( obj->registry()->identifier() + '/' ).append( sr ) )
349 : StatusCode::FAILURE;
350 };
constexpr double sr

◆ unregisterObject() [3/3]

StatusCode EvtStoreSvc::unregisterObject ( std::string_view sr)
override

Definition at line 651 of file EvtStoreSvc.cpp.

651 {
652 sr = normalize_path( sr, rootName() );
653 return fwd( [&]( Partition& p ) { return p.store->erase( sr ) != 0 ? StatusCode::SUCCESS : StatusCode::FAILURE; } );
654}

◆ updateObject() [1/2]

StatusCode EvtStoreSvc::updateObject ( DataObject * )
inlineoverride

Definition at line 358 of file EvtStoreSvc.cpp.

358{ return dummy( __FUNCTION__ ); }

◆ updateObject() [2/2]

StatusCode EvtStoreSvc::updateObject ( IRegistry * )
inlineoverride

Definition at line 357 of file EvtStoreSvc.cpp.

357{ return dummy( __FUNCTION__ ); }

Member Data Documentation

◆ m_dataLoader

SmartIF<IConversionSvc> EvtStoreSvc::m_dataLoader
private

Definition at line 273 of file EvtStoreSvc.cpp.

◆ m_estStoreBuckets

Gaudi::Property<std::size_t> EvtStoreSvc::m_estStoreBuckets
private
Initial value:
{ this, "StoreBuckets", 100,
"Estimated number of buckets in the store" }

Definition at line 244 of file EvtStoreSvc.cpp.

244 { this, "StoreBuckets", 100,
245 "Estimated number of buckets in the store" };

◆ m_followLinksToAncestors

Gaudi::Property<bool> EvtStoreSvc::m_followLinksToAncestors
private
Initial value:
{
this, "FollowLinksToAncestors", true,
"Load objects which reside in files other than the one corresponding to the root of the event store" }

Definition at line 288 of file EvtStoreSvc.cpp.

288 {
289 this, "FollowLinksToAncestors", true,
290 "Load objects which reside in files other than the one corresponding to the root of the event store" };

◆ m_forceLeaves

Gaudi::Property<bool> EvtStoreSvc::m_forceLeaves
private
Initial value:
{ this, "ForceLeaves", false,
"force creation of default leaves on registerObject" }

Definition at line 238 of file EvtStoreSvc.cpp.

238 { this, "ForceLeaves", false,
239 "force creation of default leaves on registerObject" };

◆ m_freeSlots

tbb::concurrent_queue<size_t> EvtStoreSvc::m_freeSlots
private

Definition at line 281 of file EvtStoreSvc.cpp.

◆ m_inhibitPrefixes

Gaudi::Property<std::vector<std::string> > EvtStoreSvc::m_inhibitPrefixes
private
Initial value:
{
this,
"InhibitedPathPrefixes",
{},
"Prefixes of TES locations that will not be loaded by the persistency service " }

Definition at line 283 of file EvtStoreSvc.cpp.

283 {
284 this,
285 "InhibitedPathPrefixes",
286 {},
287 "Prefixes of TES locations that will not be loaded by the persistency service " };

◆ m_loader

Gaudi::Property<std::string> EvtStoreSvc::m_loader { this, "DataLoader", "EventPersistencySvc" }
private

Definition at line 240 of file EvtStoreSvc.cpp.

240{ this, "DataLoader", "EventPersistencySvc" };

◆ m_onlyThisID

std::string_view EvtStoreSvc::m_onlyThisID
private

Definition at line 291 of file EvtStoreSvc.cpp.

◆ m_partitions

std::vector<Synced<Partition> > EvtStoreSvc::m_partitions
private

The actual store(s).

Definition at line 279 of file EvtStoreSvc.cpp.

◆ m_poolSize

Gaudi::Property<std::size_t> EvtStoreSvc::m_poolSize { this, "PoolSize", 1024, "Initial per-event memory pool size [KiB]" }
private

Definition at line 243 of file EvtStoreSvc.cpp.

243{ this, "PoolSize", 1024, "Initial per-event memory pool size [KiB]" };

◆ m_preLoads

std::vector<DataStoreItem> EvtStoreSvc::m_preLoads
private

Items to be pre-loaded.

Definition at line 276 of file EvtStoreSvc.cpp.

◆ m_printPoolStats

Gaudi::Property<bool> EvtStoreSvc::m_printPoolStats { this, "PrintPoolStats", false, "Print memory pool statistics" }
private

Definition at line 242 of file EvtStoreSvc.cpp.

242{ this, "PrintPoolStats", false, "Print memory pool statistics" };

◆ m_rootCLID

Gaudi::Property<CLID> EvtStoreSvc::m_rootCLID { this, "RootCLID", 110 , "CLID of root entry" }
private

Definition at line 236 of file EvtStoreSvc.cpp.

236{ this, "RootCLID", 110 /*CLID_Event*/, "CLID of root entry" };

◆ m_rootName

Gaudi::Property<std::string> EvtStoreSvc::m_rootName { this, "RootName", "/Event", "name of root entry" }
private

Definition at line 237 of file EvtStoreSvc.cpp.

237{ this, "RootName", "/Event", "name of root entry" };

◆ m_servedPoolAllocations

Gaudi::Accumulators::AveragingCounter<std::size_t> EvtStoreSvc::m_servedPoolAllocations
private

Definition at line 246 of file EvtStoreSvc.cpp.

◆ m_slots

Gaudi::Property<size_t> EvtStoreSvc::m_slots { this, "EventSlots", 1, "number of event slots" }
private

Definition at line 241 of file EvtStoreSvc.cpp.

241{ this, "EventSlots", 1, "number of event slots" };

◆ m_storeBuckets

Gaudi::Accumulators::AveragingCounter<std::size_t> EvtStoreSvc::m_storeBuckets
private

Definition at line 247 of file EvtStoreSvc.cpp.

◆ m_storeEntries

Gaudi::Accumulators::AveragingCounter<std::size_t> EvtStoreSvc::m_storeEntries
private

Definition at line 247 of file EvtStoreSvc.cpp.

◆ m_usedPoolAllocations

Gaudi::Accumulators::AveragingCounter<std::size_t> EvtStoreSvc::m_usedPoolAllocations
private

Definition at line 247 of file EvtStoreSvc.cpp.

◆ m_usedPoolSize

Gaudi::Accumulators::AveragingCounter<std::size_t> EvtStoreSvc::m_usedPoolSize
mutableprivate

Definition at line 246 of file EvtStoreSvc.cpp.


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