Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
17 #ifndef XAOD_STANDALONE
18 # include "GaudiKernel/ThreadLocalContext.h"
20 #endif // not XAOD_STANDALONE
27 #include <memory_resource>
33 AuxContainerBase::AuxContainerBase(
bool allowDynamicVars )
38 bool allowDynamicVars )
40 m_auxids(), m_vecs(), m_store( nullptr ), m_storeIO( nullptr ),
44 m_memResource( memResource ){
46 if( allowDynamicVars ) {
62 m_auxids(), m_vecs(), m_store( nullptr ), m_storeIO( nullptr ),
65 m_memResource(
parent.m_memResource )
87 std::pmr::memory_resource* memResource )
91 m_storeIO( nullptr ), m_ownsStore( false ),
94 m_memResource( memResource ){
106 for( ; itr !=
end; ++itr ) {
107 if( ! *itr )
continue;
124 if(
this == &rhs )
return *
this;
163 const std::pmr::memory_resource* cptr = m_memResource.get();
164 std::pmr::memory_resource*
ptr ATLAS_THREAD_SAFE =
const_cast<std::pmr::memory_resource*
>( cptr );
166 #ifndef XAOD_STANDALONE
167 const EventContext& ctx = Gaudi::Hive::currentContext();
174 ptr = std::pmr::get_default_resource();
177 m_memResource.set(
ptr );
246 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
252 auxids_nc.
insert( auxid );
254 auxid_t linked_id =
r.linkedVariable( auxid );
255 if (linked_id != SG::null_auxid) {
256 auxids_nc.insert( linked_id );
261 std::cout <<
"ERROR xAOD::AuxContainerBase::getData "
262 <<
"Unknown variable ("
264 <<
") requested" << std::endl;
309 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
316 auxid_t linked_id =
r.linkedVariable( auxid );
317 if (linked_id != SG::null_auxid) {
325 std::cout <<
"ERROR xAOD::AuxContainerBase::getDecoration "
326 <<
"Can't provide variable "
365 bool anycleared =
false;
370 if (!anycleared)
return false;
401 auxid_t linked_id =
r.linkedVariable( auxid );
402 if (linked_id != SG::null_auxid) {
405 return m_vecs[ linked_id ];
418 auxid_t linked_id =
r.linkedVariable( auxid );
419 if (linked_id != SG::null_auxid) {
422 return m_vecs[ linked_id ];
470 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
477 auxid_t linked_id =
r.linkedVariable( auxid );
478 if (linked_id != SG::null_auxid) {
484 std::cout <<
"ERROR xAOD::AuxContainerBase::getData "
485 <<
"Unknown variable ("
487 <<
") requested" << std::endl;
491 m_vecs[ auxid ]->reserve( capacity );
496 return m_vecs[ auxid ]->toPtr();
520 if(
v && !
v->isLinked()) {
521 if (!
v->resize(
size ))
547 if(
v && !
v->isLinked()) {
572 if(
v && !
v->isLinked()) {
573 v->shift(
pos, offs );
598 size_t other_size =
other.size();
610 if (
other.getData (
id)) {
611 void* src_ptr =
other.getData (
id, other_size, other_size);
619 const void* orig = v_dst->
toPtr();
621 if (orig != v_dst->
toPtr())
645 return m_vecs[
id]->setOption (option);
667 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
671 std::cout <<
"ERROR xAOD::AuxContainerBase::getIOData "
672 <<
"Unknown variable ("
674 <<
") requested" << std::endl;
683 return m_vecs[ auxid ]->toVector();
692 if( ( auxid >=
m_vecs.size() ) || ( !
m_vecs[ auxid ] ) ) {
JetConstituentVector::iterator iterator
std::string m_name
Name of the container in memory. Set externally.
virtual bool shift(size_t pos, ptrdiff_t offs)=0
Shift the elements of the vector.
virtual void lock() override
Lock the container.
bool isLinked() const
Return true if this variable is linked from another one.
virtual void setStore(SG::IAuxStore *store) override
Set a different internal store object.
virtual const std::type_info * getIOType(auxid_t auxid) const override
Return the type of the data to be stored for one aux data item.
const char * name() const
Get the name of the container instance.
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore=SG::auxid_set_t())=0
Move all elements from other to this store.
virtual void lockDecoration(SG::auxid_t auxid)=0
Lock a decoration.
virtual const IAuxTypeVector * getVector(SG::auxid_t auxid) const =0
Return vector interface for one aux data item.
virtual bool clearDecorations() override
Clear all decorations.
ReadStats & stats()
Access the object belonging to the current thread.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
SG::IAuxStore * m_store
Internal dynamic auxiliary store object.
std::pmr::memory_resource * memResource()
Return the memory resource to use.
virtual const SG::IAuxTypeVector * linkedVector(SG::auxid_t auxid) const override
Return interface for a linked variable.
AuxContainerBase & operator=(const AuxContainerBase &rhs)
Assignment operator.
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
AthContainers_detail::lock_guard< mutex_t > guard_t
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
Exception — Attempted to modify auxiliary data in a locked store.
virtual bool setOption(auxid_t id, const SG::AuxDataOption &option) override
Make an option setting on an aux variable.
bool hasExtendedEventContext(const EventContext &ctx)
Test whether a context object has an extended context installed.
Exceptions that can be thrown from AthContainers.
virtual bool isDecoration(auxid_t auxid) const override
Test if a variable is a decoration.
Helper for getting a const version of a pointer.
Common base class for the auxiliary containers.
virtual bool insertMove(size_t pos, void *src, size_t src_pos, size_t src_n, IAuxStore &srcStore)=0
Insert elements into the vector via move semantics.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
virtual const std::type_info * getIOType(SG::auxid_t auxid) const =0
Return the type of the data to be stored for one aux data item.
virtual bool resize(size_t size) override
Resize the arrays to a given size.
virtual size_t size() const =0
Return the number of elements in the store.
virtual void shift(size_t pos, ptrdiff_t offs)=0
Shift the elements of the container.
virtual IAuxTypeVector * linkedVector(SG::auxid_t)
~AuxContainerBase()
Destructor.
Interface providing I/O for a generic auxiliary store.
virtual SG::IAuxStore * getStore() override
Get the currently used internal store object.
Handle mappings between names and auxid_t.
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
virtual size_t size() const override
Get the size of the container.
virtual const auxid_set_t & getDynamicAuxIDs() const override
Get the types(names) of variables created dynamically.
virtual void reserve(size_t size) override
Reserve a given size for the arrays.
virtual bool setOption(auxid_t, const AuxDataOption &)
Set an option for a given auxiliary variable.
size_t auxid_t
Identifier for a particular aux data item.
virtual bool clearDecorations()=0
Clear all decorations.
SG::auxid_set_t auxid_set_t
The aux ID set type definition.
auxid_set_t m_auxids
Internal list of all available variables.
std::vector< SG::IAuxTypeVector * > m_vecs
Internal list of all managed variables.
ConcurrentBitset & insert(bit_t bit, bit_t new_nbits=0)
Set a bit to 1.
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the contents of the stored arrays.
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity)=0
Return the data vector for one aux data decoration item.
virtual const auxid_set_t & getDecorIDs() const override
Get the types(names) of decorations handled by this container.
const std::type_info * getVecType(SG::auxid_t auxid) const
Return the type of the STL vector used to hold an aux data item.
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity) override
Get a pointer to a given array, as a decoration.
static IOStats & instance()
Singleton object accessor.
Hold information about an option setting request.
virtual SG::auxid_set_t getSelectedAuxIDs() const override
Get the IDs of the selected dynamic Aux variables (for writing)
virtual const SG::IAuxTypeVector * getVector(SG::auxid_t auxid) const override final
Return vector interface for one aux data item.
const T * as_const_ptr(const T *p)
Helper for getting a const version of a pointer.
virtual const auxid_set_t & getWritableAuxIDs() const override
Return a set of writable data identifiers.
virtual const void * getIOData(SG::auxid_t auxid) const =0
Return a pointer to the data to be stored for one aux data item.
virtual const void * getData(auxid_t auxid) const override
Get a pointer to a given array.
void readBranch(const std::string &prefix, SG::auxid_t auxid)
Function incrementing the read counter on a specific branch.
SG::auxid_t auxid_t
The aux ID type definition.
Interface for non-const operations on an auxiliary store.
An auxiliary data store that holds data internally.
CxxUtils::CachedPointer< std::pmr::memory_resource > m_memResource ATLAS_THREAD_SAFE
Memory resource to use for this container.
virtual void * getData(auxid_t auxid, size_t size, size_t capacity)=0
Return the data vector for one aux data item.
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore) override
Insert contents of another store via move.
bool m_locked
Has the container been locked?
Abstract interface for manipulating vectors of arbitrary types.
virtual void lockDecoration(SG::auxid_t auxid) override
Lock a decoration.
bool m_ownsStore
Flag deciding if the object owns the dynamic store or not.
virtual const SG::auxid_set_t & getDecorIDs() const =0
Return a set of identifiers for decorations in this store.
Handle mappings between names and auxid_t.
virtual void lock()=0
Lock the container.
SG::IAuxStoreIO * m_storeIO
The IO interface to the internal auxiliary store.
AuxContainerBase(bool allowDynamicVars=true)
Default constructor.
virtual const void * getIOData(auxid_t auxid) const override
Get a pointer to the data being stored for one aux data item.
virtual bool resize(size_t sz)=0
Change the size of all aux data vectors.
A set of aux data identifiers.
void setName(const char *name)
Set the name of the container instance.
virtual bool isDecoration(auxid_t auxid) const =0
Test if a particular variable is tagged as a decoration.
Define macros for attributes used to control the static checker.
An auxiliary data store that holds data internally.
virtual const SG::auxid_set_t & getAuxIDs() const =0
Return a set of identifiers for existing data items in this store.
virtual void * toPtr()=0
Return a pointer to the start of the vector's data.
virtual void reserve(size_t sz)=0
Change the capacity of all aux data vectors.