ATLAS Offline Software
Loading...
Searching...
No Matches
xAOD::ZdcModuleAuxContainer_v2 Class Referenceabstract

Auxiliary store for xAOD::ZdcModuleContainer_v2. More...

#include <ZdcModuleAuxContainer_v2.h>

Inheritance diagram for xAOD::ZdcModuleAuxContainer_v2:
Collaboration diagram for xAOD::ZdcModuleAuxContainer_v2:

Public Types

typedef SG::auxid_t auxid_t
 The aux ID type definition.
typedef SG::auxid_set_t auxid_set_t
 The aux ID set type definition.
template<class T, class ALLOC = std::allocator<T>>
using AuxVariable_t = std::vector<T, ALLOC>
 Declare how to wrap variables for this sort of base.
template<class T, class ALLOC = std::allocator<T>>
using LinkedVariable_t = AuxVariable_t<T, ALLOC>
enum  AuxStoreType { AST_ObjectStore = 0 , AST_ContainerStore = 1 }
 Type of the auxiliary store. More...

Public Member Functions

 ZdcModuleAuxContainer_v2 ()
 Default constructor.
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.
template<typename T, typename ALLOC>
auxid_t getAuxID (const std::string &name, std::vector< T, ALLOC > &, SG::AuxVarFlags flags=SG::AuxVarFlags::None, const SG::auxid_t linkedVariable=SG::null_auxid)
 Get the auxiliary ID for one of the persistent variables.
template<typename T>
auxid_t getAuxID (const std::string &name, SG::PackedContainer< T > &, SG::AuxVarFlags flags=SG::AuxVarFlags::None, const SG::auxid_t linkedVariable=SG::null_auxid)
 Get the auxiliary ID for one of the persistent variables.
template<typename T, typename ALLOC>
void regAuxVar (auxid_t auxid, const std::string &name, std::vector< T, ALLOC > &vec)
 Register one of the persistent variables internally.
template<typename T>
void regAuxVar (auxid_t auxid, const std::string &name, SG::PackedContainer< T > &vec)
 Register one of the persistent variables internally.
Functions implementing the SG::IAuxStoreHolder interface
virtual SG::IAuxStoregetStore () override
 Get the currently used internal store object.
virtual const SG::IAuxStoregetStore () const override
virtual void setStore (SG::IAuxStore *store) override
 Set a different internal store object.
virtual AuxStoreType getStoreType () const override
 Return the type of the store object.
std::pmr::memory_resource * memResource ()
 Return the memory resource to use.
Functions implementing the SG::IConstAuxStore interface
virtual const void * getData (auxid_t auxid) const override
 Get a pointer to a given array.
virtual const SG::IAuxTypeVectorgetVector (SG::auxid_t auxid) const override final
 Return vector interface for one aux data item.
virtual const auxid_set_tgetAuxIDs () const override
 Get the types(names) of variables handled by this container.
virtual const auxid_set_tgetDecorIDs () const override
 Get the types(names) of decorations handled by this container.
virtual SG::auxid_set_t getCopyIDs (bool warnUnlocked=false) const override
 Get the set of variables that we should deep copy.
virtual bool isDecoration (auxid_t auxid) const override
 Test if a variable is a decoration.
virtual void * getDecoration (auxid_t auxid, size_t size, size_t capacity) override
 Get a pointer to a given array, as a decoration.
virtual void lock () override
 Lock the container.
virtual bool clearDecorations () override
 Clear all decorations.
virtual size_t size () const override
 Get the size of the container.
virtual void lockDecoration (SG::auxid_t auxid) override
 Lock a decoration.
virtual const SG::IAuxTypeVectorlinkedVector (SG::auxid_t auxid) const override
 Return interface for a linked variable.
Functions implementing the SG::IAuxStore interface
virtual void * getData (auxid_t auxid, size_t size, size_t capacity) override
 Get a pointer to a given array, creating the array if necessary.
virtual SG::IAuxTypeVectorlinkedVector (SG::auxid_t auxid) override
 Return interface for a linked variable.
virtual const auxid_set_tgetWritableAuxIDs () const override
 Return a set of writable data identifiers.
virtual bool resize (size_t size) override
 Resize the arrays to a given size.
virtual void reserve (size_t size) override
 Reserve a given size for the arrays.
virtual void shift (size_t pos, ptrdiff_t offs) override
 Shift the contents of the stored arrays.
virtual bool insertMove (size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore) override
 Insert contents of another store via move.
virtual bool setOption (auxid_t id, const SG::AuxDataOption &option) override
 Make an option setting on an aux variable.
Functions implementing the SG::IAuxStoreIO interface
virtual const void * getIOData (auxid_t auxid) const override
 Get a pointer to the data being stored for one aux data item.
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.
virtual const auxid_set_tgetDynamicAuxIDs () const override
 Get the types(names) of variables created dynamically.
virtual SG::auxid_set_t getSelectedAuxIDs () const override
 Get the IDs of the selected dynamic Aux variables (for writing).
Functions managing the instance name of the container
const charname () const
 Get the name of the container instance.
void setName (const char *name)
 Set the name of the container instance.

Static Public Attributes

static constexpr bool supportsThinning = true
 Mark that this type supports thinning operations.

Private Types

typedef AthContainers_detail::mutex mutex_t
 Mutex for multithread synchronization.
typedef AthContainers_detail::lock_guard< mutex_tguard_t

Private Member Functions

template<typename ELT, typename CONT>
void regAuxVar1 (auxid_t auxid, const std::string &name, CONT &vec)
 Common code between regAuxVar cases.

Private Attributes

std::vector< uint32_tzdcId
std::vector< intzdcSide
std::vector< intzdcModule
std::vector< intzdcType
std::vector< intzdcChannel
auxid_set_t m_auxids
 Internal list of all available variables.
std::vector< SG::IAuxTypeVector * > m_vecs
 Internal list of all managed variables.
SG::IAuxStorem_store
 Internal dynamic auxiliary store object.
SG::IAuxStoreIOm_storeIO
 The IO interface to the internal auxiliary store.
bool m_ownsStore
 Flag deciding if the object owns the dynamic store or not.
bool m_locked
 Has the container been locked?
mutex_t m_mutex
std::string m_name
 Name of the container in memory. Set externally.
CxxUtils::CachedPointer< std::pmr::memory_resource > m_memResource ATLAS_THREAD_SAFE
 Memory resource to use for this container.

Detailed Description

Auxiliary store for xAOD::ZdcModuleContainer_v2.

This is a custom auxiliary container for xAOD::ZdcModuleContainer_v2, to be used in the main reconstruction code.

Author
Peter Steinberg peter.nosp@m..ste.nosp@m.inber.nosp@m.g@bn.nosp@m.l.gov
Revision
693858
Date
2015-09-09 12:30:15 +0200 (Wed, 09 Sep 2015)

Definition at line 31 of file ZdcModuleAuxContainer_v2.h.

Member Typedef Documentation

◆ auxid_set_t

The aux ID set type definition.

Definition at line 61 of file AuxContainerBase.h.

◆ auxid_t

The aux ID type definition.

Definition at line 59 of file AuxContainerBase.h.

◆ AuxVariable_t

template<class T, class ALLOC = std::allocator<T>>
using xAOD::AuxContainerBase::AuxVariable_t = std::vector<T, ALLOC>
inherited

Declare how to wrap variables for this sort of base.

Definition at line 194 of file AuxContainerBase.h.

◆ guard_t

Definition at line 246 of file AuxContainerBase.h.

◆ LinkedVariable_t

template<class T, class ALLOC = std::allocator<T>>
using xAOD::AuxContainerBase::LinkedVariable_t = AuxVariable_t<T, ALLOC>
inherited

Definition at line 196 of file AuxContainerBase.h.

◆ mutex_t

Mutex for multithread synchronization.

Definition at line 245 of file AuxContainerBase.h.

Member Enumeration Documentation

◆ AuxStoreType

Type of the auxiliary store.

In the xAOD EDM we use auxiliary store objects in some cases to describe a single object, and in most cases to describe a container of objects. This enumeration declares which type the object implementing this interface is.

Enumerator
AST_ObjectStore 

The store describes a single object.

AST_ContainerStore 

The store describes a container.

Definition at line 66 of file IAuxStoreHolder.h.

66 {
67 AST_ObjectStore = 0,
69 };
@ AST_ContainerStore
The store describes a container.
@ AST_ObjectStore
The store describes a single object.

Constructor & Destructor Documentation

◆ ZdcModuleAuxContainer_v2()

xAOD::ZdcModuleAuxContainer_v2::ZdcModuleAuxContainer_v2 ( )

Default constructor.

Definition at line 13 of file ZdcModuleAuxContainer_v2.cxx.

15
16 // Digit collectoins
22
23
24 }
#define AUX_VARIABLE(VAR,...)
Convenience macro for declaring an auxiliary variable.
Definition AuxVariable.h:23
AuxContainerBase(bool allowDynamicVars=true)
Default constructor.

Member Function Documentation

◆ clearDecorations()

bool xAOD::AuxContainerBase::clearDecorations ( )
overridevirtualinherited

Clear all decorations.

Definition at line 364 of file AuxContainerBase.cxx.

364 {
365
366 // Guard against multi-threaded execution:
367 guard_t guard( m_mutex );
368
369 // Clear the decorations from the dynamic store:
370 bool anycleared = false;
371 if( m_store ) {
372 anycleared = m_store->clearDecorations();
373 }
374 // Early exit if there were no decorations.
375 if (!anycleared) return false;
376
377 // Construct the list of managed auxiliary variables from scratch after
378 // the cleanup:
380 for( auxid_t auxid = 0; auxid < m_vecs.size(); ++auxid ) {
381 if( m_vecs[ auxid ] ) {
382 ids.insert( auxid );
383 }
384 }
385 if( m_store ) {
386 ids.insert (m_store->getAuxIDs());
387 }
388 m_auxids = std::move(ids);
389
390 return true;
391 }
SG::auxid_set_t auxid_set_t
The aux ID set type definition.
SG::IAuxStore * m_store
Internal dynamic auxiliary store object.
AthContainers_detail::lock_guard< mutex_t > guard_t
auxid_set_t m_auxids
Internal list of all available variables.
std::vector< SG::IAuxTypeVector * > m_vecs
Internal list of all managed variables.
SG::auxid_t auxid_t
The aux ID type definition.
SG::auxid_t auxid() const
Return the aux id for this variable.

◆ getAuxID() [1/2]

template<typename T>
auxid_t xAOD::AuxContainerBase::getAuxID ( const std::string & name,
SG::PackedContainer< T > & ,
SG::AuxVarFlags flags = SG::AuxVarFlags::None,
const SG::auxid_t linkedVariable = SG::null_auxid )
inherited

Get the auxiliary ID for one of the persistent variables.

◆ getAuxID() [2/2]

template<typename T, typename ALLOC>
auxid_t xAOD::AuxContainerBase::getAuxID ( const std::string & name,
std::vector< T, ALLOC > & ,
SG::AuxVarFlags flags = SG::AuxVarFlags::None,
const SG::auxid_t linkedVariable = SG::null_auxid )
inherited

Get the auxiliary ID for one of the persistent variables.

◆ getAuxIDs()

const AuxContainerBase::auxid_set_t & xAOD::AuxContainerBase::getAuxIDs ( ) const
overridevirtualinherited

Get the types(names) of variables handled by this container.

Definition at line 277 of file AuxContainerBase.cxx.

277 {
278
279 // Return the full list of IDs:
280 return getWritableAuxIDs();
281 }
virtual const auxid_set_t & getWritableAuxIDs() const override
Return a set of writable data identifiers.

◆ getCopyIDs()

SG::auxid_set_t xAOD::AuxContainerBase::getCopyIDs ( bool warnUnlocked = false) const
overridevirtualinherited

Get the set of variables that we should deep copy.

Definition at line 293 of file AuxContainerBase.cxx.

294 {
295 return SG::getCopyIDs (getAuxIDs(), getDecorIDs(), warnUnlocked, {});
296 }
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
virtual const auxid_set_t & getDecorIDs() const override
Get the types(names) of decorations handled by this container.
virtual SG::auxid_set_t getCopyIDs(bool warnUnlocked=false) const override
Return the set of variables to copy in a deep copy.

◆ getData() [1/2]

const void * xAOD::AuxContainerBase::getData ( auxid_t auxid) const
overridevirtualinherited

Get a pointer to a given array.

Definition at line 232 of file AuxContainerBase.cxx.

232 {
233
234 const SG::IAuxTypeVector* v = getVector( auxid );
235 if( v ) {
236 return v->toPtr();
237 }
238 return nullptr;
239 }
virtual const SG::IAuxTypeVector * getVector(SG::auxid_t auxid) const override final
Return vector interface for one aux data item.

◆ getData() [2/2]

void * xAOD::AuxContainerBase::getData ( auxid_t auxid,
size_t size,
size_t capacity )
overridevirtualinherited

Get a pointer to a given array, creating the array if necessary.

Implements SG::IAuxStore.

Definition at line 469 of file AuxContainerBase.cxx.

470 {
471
472 // Guard against multi-threaded execution:
473 guard_t guard( m_mutex );
474
475 if( ( auxid >= m_vecs.size() ) || ( ! m_vecs[ auxid ] ) ) {
476
477 if( m_store ) {
478 void* result = m_store->getData( auxid, size, capacity );
479 if( result ) {
480 m_auxids.insert( auxid );
481 const SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
482 auxid_t linked_id = r.linkedVariable( auxid );
483 if (linked_id != SG::null_auxid) {
484 m_auxids.insert( linked_id );
485 }
486 }
487 return result;
488 } else {
489 std::cout << "ERROR xAOD::AuxContainerBase::getData "
490 << "Unknown variable ("
492 << ") requested" << std::endl;
493 return nullptr;
494 }
495 }
496 m_vecs[ auxid ]->reserve( capacity );
497 if (m_vecs[ auxid ]->size() < size) {
498 m_vecs[ auxid ]->resize( size );
499 }
500
501 return m_vecs[ auxid ]->toPtr();
502 }
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
virtual size_t size() const override
Get the size of the container.
int r
Definition globals.cxx:22
static const auxid_t null_auxid
To signal no aux data item.
Definition AuxTypes.h:30

◆ getDecoration()

void * xAOD::AuxContainerBase::getDecoration ( auxid_t auxid,
size_t size,
size_t capacity )
overridevirtualinherited

Get a pointer to a given array, as a decoration.

Reimplemented in xAOD::EventInfoAuxContainer_v1.

Definition at line 307 of file AuxContainerBase.cxx.

308 {
309 {
310 // Guard against multi-threaded execution:
311 guard_t guard( m_mutex );
312
313 // Check if we have it as a static variable:
314 if( ( auxid >= m_vecs.size() ) || ( ! m_vecs[ auxid ] ) ) {
315 // If not, but we have a dynamic store, push it in there:
316 if( m_store ) {
317 void* result = m_store->getDecoration( auxid, size, capacity );
318 if( result ) {
319 m_auxids.insert( auxid );
320 const SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
321 auxid_t linked_id = r.linkedVariable( auxid );
322 if (linked_id != SG::null_auxid) {
323 m_auxids.insert( linked_id );
324 }
325 }
326 return result;
327 }
328 // If we don't have a dynamic store, complain:
329 else {
330 std::cout << "ERROR xAOD::AuxContainerBase::getDecoration "
331 << "Can't provide variable "
333 << std::endl;
334 return nullptr;
335 }
336 }
337
338 // If the container is locked, static variables can't be accessed this
339 // way:
340 if( m_locked ) {
341 throw SG::ExcStoreLocked( auxid );
342 }
343 }
344
345 // If the container is not locked, then fall back on the normal accessor
346 // function:
347 return getData( auxid, size, capacity );
348 }
bool m_locked
Has the container been locked?
virtual const void * getData(auxid_t auxid) const override
Get a pointer to a given array.

◆ getDecorIDs()

const AuxContainerBase::auxid_set_t & xAOD::AuxContainerBase::getDecorIDs ( ) const
overridevirtualinherited

Get the types(names) of decorations handled by this container.

Definition at line 284 of file AuxContainerBase.cxx.

284 {
285
286 if( m_store ) {
287 return m_store->getDecorIDs();
288 }
289 static const auxid_set_t empty;
290 return empty;
291 }
static const Attributes_t empty

◆ getDynamicAuxIDs()

const AuxContainerBase::auxid_set_t & xAOD::AuxContainerBase::getDynamicAuxIDs ( ) const
overridevirtualinherited

Get the types(names) of variables created dynamically.

Implements SG::IAuxStoreIO.

Definition at line 708 of file AuxContainerBase.cxx.

708 {
709
710 // Guard against multi-threaded execution:
711 guard_t guard( m_mutex );
712
713 // All the variables handled by the internal store are dynamic
714 // if such a store exists:
715 if( m_storeIO && m_store) {
716 // I mean, all the variables. Not just the ones reported as dynamic
717 // by the internal object. Because the internal object may be something
718 // that was put into this one in order to achieve data slimming.
719 return m_store->getAuxIDs();
720 }
721 // In case we don't use an internal store, there are no dynamic
722 // variables:
723 static const auxid_set_t dummy (0);
724 return dummy;
725 }
SG::IAuxStoreIO * m_storeIO
The IO interface to the internal auxiliary store.

◆ getIOData()

const void * xAOD::AuxContainerBase::getIOData ( auxid_t auxid) const
overridevirtualinherited

Get a pointer to the data being stored for one aux data item.

Implements SG::IAuxStoreIO.

Definition at line 666 of file AuxContainerBase.cxx.

666 {
667
668 // Guard against multi-threaded execution:
669 guard_t guard( m_mutex );
670
671 // If the variable is not static, look for it in the dynamic store:
672 if( ( auxid >= m_vecs.size() ) || ( ! m_vecs[ auxid ] ) ) {
673 if( m_storeIO ) {
674 return m_storeIO->getIOData( auxid );
675 } else {
676 std::cout << "ERROR xAOD::AuxContainerBase::getIOData "
677 << "Unknown variable ("
679 << ") requested" << std::endl;
680 return nullptr;
681 }
682 }
683
684 // Update the statistics for this variable. The dynamic store registers
685 // its own variable accesses.
687
688 return m_vecs[ auxid ]->toVector();
689 }
std::string m_name
Name of the container in memory. Set externally.
ReadStats & stats()
Access the object belonging to the current thread.
Definition IOStats.cxx:17
static IOStats & instance()
Singleton object accessor.
Definition IOStats.cxx:11
void readBranch(const std::string &prefix, SG::auxid_t auxid)
Function incrementing the read counter on a specific branch.

◆ getIOType()

const std::type_info * xAOD::AuxContainerBase::getIOType ( auxid_t auxid) const
overridevirtualinherited

Return the type of the data to be stored for one aux data item.

Implements SG::IAuxStoreIO.

Definition at line 691 of file AuxContainerBase.cxx.

691 {
692
693 // Guard against multi-threaded execution:
694 guard_t guard( m_mutex );
695
696 // If the variable is not static, ask the dynamic store:
697 if( ( auxid >= m_vecs.size() ) || ( ! m_vecs[ auxid ] ) ) {
698 if( m_storeIO ) {
699 return m_storeIO->getIOType( auxid );
700 }
701 }
702
703 // Fall back on getting the information from the registry:
705 }
const std::type_info * getVecType(SG::auxid_t auxid) const
Return the type of the STL vector used to hold an aux data item.

◆ getSelectedAuxIDs()

AuxContainerBase::auxid_set_t xAOD::AuxContainerBase::getSelectedAuxIDs ( ) const
overridevirtualinherited

Get the IDs of the selected dynamic Aux variables (for writing).

Reimplemented from SG::IAuxStoreIO.

Definition at line 728 of file AuxContainerBase.cxx.

728 {
729
730 // Guard against multi-threaded execution:
731 guard_t guard( m_mutex );
732
733 // All the variables handled by the internal store are dynamic
734 // if such a store exists:
735 if( m_storeIO && m_store) {
736 // I mean, all the variables. Not just the ones reported as dynamic
737 // by the internal object. Because the internal object may be something
738 // that was put into this one in order to achieve data slimming.
739 return m_store->getAuxIDs();
740 }
741
742 // In case we don't use an internal store, there are no dynamic
743 // variables:
744 return auxid_set_t();
745 }

◆ getStore() [1/2]

const SG::IAuxStore * xAOD::AuxContainerBase::getStore ( ) const
overridevirtualinherited

Implements SG::IAuxStoreHolder.

Definition at line 183 of file AuxContainerBase.cxx.

184 {
185 return m_store;
186 }

◆ getStore() [2/2]

SG::IAuxStore * xAOD::AuxContainerBase::getStore ( )
overridevirtualinherited

Get the currently used internal store object.

Implements SG::IAuxStoreHolder.

Definition at line 156 of file AuxContainerBase.cxx.

157 {
158 return m_store;
159 }

◆ getStoreType()

virtual AuxStoreType xAOD::AuxContainerBase::getStoreType ( ) const
inlineoverridevirtualinherited

Return the type of the store object.

Implements SG::IAuxStoreHolder.

Definition at line 88 of file AuxContainerBase.h.

88{ return AST_ContainerStore; }

◆ getVector()

const SG::IAuxTypeVector * xAOD::AuxContainerBase::getVector ( SG::auxid_t auxid) const
finaloverridevirtualinherited

Return vector interface for one aux data item.

Definition at line 241 of file AuxContainerBase.cxx.

241 {
242
243 // Guard against multi-threaded execution:
244 guard_t guard( m_mutex );
245
246 if( ( auxid >= m_vecs.size() ) || ( ! m_vecs[ auxid ] ) ) {
247 if( m_store ) {
248 const SG::IAuxTypeVector* result = m_store->getVector( auxid );
249 if( result ) {
250 auxid_set_t& auxids_nc ATLAS_THREAD_SAFE =
251 const_cast<auxid_set_t&> (m_auxids);
252 auxids_nc.insert( auxid );
253 const SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
254 auxid_t linked_id = r.linkedVariable( auxid );
255 if (linked_id != SG::null_auxid) {
256 auxids_nc.insert( linked_id );
257 }
258 }
259 return result;
260 } else {
261 std::cout << "ERROR xAOD::AuxContainerBase::getData "
262 << "Unknown variable ("
264 << ") requested" << std::endl;
265 return nullptr;
266 }
267 }
268
269 // Update the statistics for this variable. The dynamic store registers
270 // its own variable accesses.
272
273 return m_vecs[ auxid ];
274 }
CxxUtils::CachedPointer< std::pmr::memory_resource > m_memResource ATLAS_THREAD_SAFE
Memory resource to use for this container.

◆ getWritableAuxIDs()

const AuxContainerBase::auxid_set_t & xAOD::AuxContainerBase::getWritableAuxIDs ( ) const
overridevirtualinherited

Return a set of writable data identifiers.

Implements SG::IAuxStore.

Definition at line 505 of file AuxContainerBase.cxx.

505 {
506
507 // Return the full list of known IDs. The constness of this object's
508 // members comes from the object being const or not.
509 return m_auxids;
510 }

◆ insertMove() [1/2]

virtual bool SG::IAuxStore::insertMove ( size_t pos,
IAuxStore & other,
const SG::auxid_set_t & ignore = SG::auxid_set_t() )
pure virtualinherited

Move all elements from other to this store.

Parameters
posThe starting index of the insertion.
otherStore from which to do the move.
ignoreSet of variables that should not be added to the store.

Let len be the size of other. The store will be increased in size by len elements, with the elements at pos being copied to pos+len. Then, for each auxiliary variable, the entire contents of that variable for other will be moved to this store at index pos. This will be done via move semantics if possible; otherwise, it will be done with a copy. Variables present in this store but not in other will have the corresponding elements default-initialized. Variables in other but not in this store will be added unless they are in ignore.

Returns true if it is known that none of the vectors' memory moved, false otherwise.

◆ insertMove() [2/2]

bool xAOD::AuxContainerBase::insertMove ( size_t pos,
IAuxStore & other,
const SG::auxid_set_t & ignore )
overridevirtualinherited

Insert contents of another store via move.

Definition at line 591 of file AuxContainerBase.cxx.

593 {
594 // Guard against multi-threaded execution:
595 guard_t guard( m_mutex );
596
597 // This operation is not allowed on a locked container:
598 if( m_locked ) {
599 throw SG::ExcStoreLocked( "insertMove" );
600 }
601
602 bool nomove = true;
603 size_t other_size = other.size();
604
605 SG::auxid_set_t ignore = ignore_in;
606
607 // Do the operation on the static variables:
608 for (SG::auxid_t id : m_auxids) {
609 SG::IAuxTypeVector* v_dst = nullptr;
610 if (id < m_vecs.size())
611 v_dst = m_vecs[id];
612 // Skip linked vars --- they should be taken care of by the parent var.
613 if (v_dst && !v_dst->isLinked()) {
614 ignore.insert (id);
615 if (other.getData (id)) {
616 void* src_ptr = other.getData (id, other_size, other_size);
617 if (src_ptr) {
618 if (!v_dst->insertMove (pos, src_ptr, 0, other_size,
619 other))
620 nomove = false;
621 }
622 }
623 else {
624 const void* orig = v_dst->toPtr();
625 v_dst->shift (pos, other_size);
626 if (orig != v_dst->toPtr())
627 nomove = false;
628 }
629 }
630 }
631
632 // Do the operation on the dynamic variables:
633 if( m_store ) {
634 if (!m_store->insertMove( pos, other, ignore ))
635 nomove = false;
636
637 // Notice any new variables added as a result of this.
638 m_auxids.insert (m_store->getAuxIDs());
639 }
640
641 return nomove;
642 }
bool isLinked() const
Return true if this variable is linked from another one.
virtual void * toPtr()=0
Return a pointer to the start of the vector's data.
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.
virtual bool shift(size_t pos, ptrdiff_t offs)=0
Shift the elements of the vector.
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27

◆ isDecoration()

bool xAOD::AuxContainerBase::isDecoration ( auxid_t auxid) const
overridevirtualinherited

Test if a variable is a decoration.

Reimplemented in xAOD::EventInfoAuxContainer_v1.

Definition at line 298 of file AuxContainerBase.cxx.

299 {
300 guard_t guard( m_mutex );
301 if (m_store) {
302 return m_store->isDecoration (auxid);
303 }
304 return false;
305 }

◆ linkedVector() [1/2]

const SG::IAuxTypeVector * xAOD::AuxContainerBase::linkedVector ( SG::auxid_t auxid) const
overridevirtualinherited

Return interface for a linked variable.

Definition at line 403 of file AuxContainerBase.cxx.

404 {
405 const SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
406 auxid_t linked_id = r.linkedVariable( auxid );
407 if (linked_id != SG::null_auxid) {
408 guard_t guard( m_mutex );
409 if (linked_id < m_vecs.size() && m_vecs[ linked_id ]) {
410 return m_vecs[ linked_id ];
411 }
412 if (m_store) {
413 return CxxUtils::as_const_ptr(m_store)->linkedVector( auxid );
414 }
415 }
416 return nullptr;
417 }
const T * as_const_ptr(const T *p)
Helper for getting a const version of a pointer.

◆ linkedVector() [2/2]

SG::IAuxTypeVector * xAOD::AuxContainerBase::linkedVector ( SG::auxid_t auxid)
overridevirtualinherited

Return interface for a linked variable.

Reimplemented from SG::IAuxStore.

Definition at line 420 of file AuxContainerBase.cxx.

421 {
422 const SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
423 auxid_t linked_id = r.linkedVariable( auxid );
424 if (linked_id != SG::null_auxid) {
425 guard_t guard( m_mutex );
426 if (linked_id < m_vecs.size() && m_vecs[ linked_id ]) {
427 return m_vecs[ linked_id ];
428 }
429 if (m_store) {
430 return m_store->linkedVector( auxid );
431 }
432 }
433 return nullptr;
434 }

◆ lock()

void xAOD::AuxContainerBase::lock ( )
overridevirtualinherited

Lock the container.

Definition at line 350 of file AuxContainerBase.cxx.

350 {
351
352 // Guard against multi-threaded execution:
353 guard_t guard( m_mutex );
354
355 // Lock the object and its dynamic store:
356 m_locked = true;
357 if( m_store ) {
358 m_store->lock();
359 }
360
361 return;
362 }

◆ lockDecoration()

void xAOD::AuxContainerBase::lockDecoration ( SG::auxid_t auxid)
overridevirtualinherited

Lock a decoration.

Reimplemented in xAOD::EventInfoAuxContainer_v1.

Definition at line 394 of file AuxContainerBase.cxx.

395 {
396 guard_t guard (m_mutex);
397 if (m_store) {
398 m_store->lockDecoration (auxid);
399 }
400 }

◆ memResource()

std::pmr::memory_resource * xAOD::AuxContainerBase::memResource ( )
inherited

Return the memory resource to use.

Definition at line 161 of file AuxContainerBase.cxx.

162 {
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 );
165 if( !ptr ) {
166#ifndef XAOD_STANDALONE
167 const EventContext& ctx = Gaudi::Hive::currentContext();
168 if( Atlas::hasExtendedEventContext( ctx ) ) {
169 ptr = Atlas::getExtendedEventContext( ctx ).memResource();
170 }
171 if( !ptr )
172#endif
173 {
174 ptr = std::pmr::get_default_resource();
175 }
176 if( ptr ) {
177 m_memResource.set( ptr );
178 }
179 }
180 return ptr;
181 }
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
bool hasExtendedEventContext(const EventContext &ctx)
Test whether a context object has an extended context installed.
void * ptr(T *p)
Definition SGImplSvc.cxx:74

◆ name()

const char * xAOD::AuxContainerBase::name ( ) const
inherited

Get the name of the container instance.

Definition at line 750 of file AuxContainerBase.cxx.

750 {
751
752 return m_name.c_str();
753 }

◆ regAuxVar() [1/2]

template<typename T>
void xAOD::AuxContainerBase::regAuxVar ( auxid_t auxid,
const std::string & name,
SG::PackedContainer< T > & vec )
inherited

Register one of the persistent variables internally.

◆ regAuxVar() [2/2]

template<typename T, typename ALLOC>
void xAOD::AuxContainerBase::regAuxVar ( auxid_t auxid,
const std::string & name,
std::vector< T, ALLOC > & vec )
inherited

Register one of the persistent variables internally.

◆ regAuxVar1()

template<typename ELT, typename CONT>
void xAOD::AuxContainerBase::regAuxVar1 ( auxid_t auxid,
const std::string & name,
CONT & vec )
privateinherited

Common code between regAuxVar cases.

◆ reserve()

void xAOD::AuxContainerBase::reserve ( size_t size)
overridevirtualinherited

Reserve a given size for the arrays.

Implements SG::IAuxStore.

Definition at line 540 of file AuxContainerBase.cxx.

540 {
541
542 // Guard against multi-threaded execution:
543 guard_t guard( m_mutex );
544
545 // This operation is not allowed on a locked container:
546 if( m_locked ) {
547 throw SG::ExcStoreLocked( "reserve" );
548 }
549
550 // Do the operation on the static variables:
551 for (SG::IAuxTypeVector* v : m_vecs) {
552 if(v && !v->isLinked()) {
553 v->reserve( size );
554 }
555 }
556
557 // Do the operation on the dynamic variables:
558 if( m_store ) {
559 m_store->reserve( size );
560 }
561
562 return;
563 }

◆ resize()

bool xAOD::AuxContainerBase::resize ( size_t size)
overridevirtualinherited

Resize the arrays to a given size.

Implements SG::IAuxStore.

Definition at line 512 of file AuxContainerBase.cxx.

512 {
513
514 // Guard against multi-threaded execution:
515 guard_t guard( m_mutex );
516
517 // This operation is not allowed on a locked container:
518 if( m_locked ) {
519 throw SG::ExcStoreLocked( "resize" );
520 }
521
522 // Do the operation on the static variables:
523 bool nomoves = true;
524 for (SG::IAuxTypeVector* v : m_vecs) {
525 if(v && !v->isLinked()) {
526 if (!v->resize( size ))
527 nomoves = false;
528 }
529 }
530
531 // Do the operation on the dynamic variables:
532 if( m_store ) {
533 if (!m_store->resize( size ))
534 nomoves = false;
535 }
536
537 return nomoves;
538 }

◆ setName()

void xAOD::AuxContainerBase::setName ( const char * name)
inherited

Set the name of the container instance.

Definition at line 755 of file AuxContainerBase.cxx.

755 {
756
757 m_name = name;
758 return;
759 }
const char * name() const
Get the name of the container instance.

◆ setOption()

bool xAOD::AuxContainerBase::setOption ( auxid_t id,
const SG::AuxDataOption & option )
overridevirtualinherited

Make an option setting on an aux variable.

Reimplemented from SG::IAuxStore.

Definition at line 645 of file AuxContainerBase.cxx.

646 {
647
648 guard_t guard (m_mutex);
649 if (id < m_vecs.size() && m_vecs[id] != nullptr)
650 return m_vecs[id]->setOption (option);
651
652 if (m_store)
653 return m_store->setOption (id, option);
654 return false;
655 }

◆ setStore()

void xAOD::AuxContainerBase::setStore ( SG::IAuxStore * store)
overridevirtualinherited

Set a different internal store object.

This function is used by the I/O infrastructure to possibly put a store object into this one, which can interact with dynamic variables directly.

Note that the object takes ownership of the received store.

Parameters
storeThe store that should be used for dynamic variable handling inside the object from now on

Implements SG::IAuxStoreHolder.

Definition at line 197 of file AuxContainerBase.cxx.

197 {
198
199 // Guard against multi-threaded execution:
200 guard_t guard( m_mutex );
201
202 // Check that no funny business is going on:
203 if( m_store == store ) return;
204
205 // Clean up the current store object:
206 if( m_store && m_ownsStore ) {
207 m_auxids -= m_store->getAuxIDs();
208 delete m_store;
209 }
210 m_store = nullptr;
211 m_storeIO = nullptr;
212
213 // Take posession of the new object:
214 m_store = store;
215 m_storeIO = dynamic_cast< SG::IAuxStoreIO* >( m_store );
216 m_ownsStore = true;
217 if( m_store ) {
218 m_auxids.insert (m_store->getAuxIDs());
219 }
220
221 return;
222 }
bool m_ownsStore
Flag deciding if the object owns the dynamic store or not.
TestStore store
Definition TestStore.cxx:23

◆ shift()

void xAOD::AuxContainerBase::shift ( size_t pos,
ptrdiff_t offs )
overridevirtualinherited

Shift the contents of the stored arrays.

Implements SG::IAuxStore.

Definition at line 565 of file AuxContainerBase.cxx.

565 {
566
567 // Guard against multi-threaded execution:
568 guard_t guard( m_mutex );
569
570 // This operation is not allowed on a locked container:
571 if( m_locked ) {
572 throw SG::ExcStoreLocked( "shift" );
573 }
574
575 // Do the operation on the static variables:
576 for (SG::IAuxTypeVector* v : m_vecs) {
577 if(v && !v->isLinked()) {
578 v->shift( pos, offs );
579 }
580 }
581
582 // Do the operation on the dynamic variables:
583 if( m_store ) {
584 m_store->shift( pos, offs );
585 }
586
587 return;
588 }

◆ size()

size_t xAOD::AuxContainerBase::size ( ) const
overridevirtualinherited

Get the size of the container.

Definition at line 437 of file AuxContainerBase.cxx.

437 {
438
439 // Guard against multi-threaded execution:
440 guard_t guard (m_mutex);
441
442 // Try to find a variable:
443 for (SG::auxid_t i : m_auxids) {
444 if( ( i < m_vecs.size() ) && m_vecs[ i ] && !m_vecs[ i ]->isLinked()) {
445 size_t sz = m_vecs[ i ]->size();
446 if( sz > 0 ) {
447 return sz;
448 }
449 }
450 }
451
452 // If we didn't find any, let's ask the dynamic store:
453 if( m_store ) {
454 return m_store->size();
455 }
456
457 // If we don't have any variables, then the size must be null:
458 return 0;
459 }
static Double_t sz

Member Data Documentation

◆ ATLAS_THREAD_SAFE

CxxUtils::CachedPointer<std::pmr::memory_resource> m_memResource xAOD::AuxContainerBase::ATLAS_THREAD_SAFE
mutableprivateinherited

Memory resource to use for this container.

Definition at line 253 of file AuxContainerBase.h.

◆ m_auxids

auxid_set_t xAOD::AuxContainerBase::m_auxids
privateinherited

Internal list of all available variables.

Definition at line 231 of file AuxContainerBase.h.

◆ m_locked

bool xAOD::AuxContainerBase::m_locked
privateinherited

Has the container been locked?

Definition at line 242 of file AuxContainerBase.h.

◆ m_mutex

mutex_t xAOD::AuxContainerBase::m_mutex
mutableprivateinherited

Definition at line 247 of file AuxContainerBase.h.

◆ m_name

std::string xAOD::AuxContainerBase::m_name
privateinherited

Name of the container in memory. Set externally.

Definition at line 250 of file AuxContainerBase.h.

◆ m_ownsStore

bool xAOD::AuxContainerBase::m_ownsStore
privateinherited

Flag deciding if the object owns the dynamic store or not.

Definition at line 240 of file AuxContainerBase.h.

◆ m_store

SG::IAuxStore* xAOD::AuxContainerBase::m_store
privateinherited

Internal dynamic auxiliary store object.

Definition at line 236 of file AuxContainerBase.h.

◆ m_storeIO

SG::IAuxStoreIO* xAOD::AuxContainerBase::m_storeIO
privateinherited

The IO interface to the internal auxiliary store.

Definition at line 238 of file AuxContainerBase.h.

◆ m_vecs

std::vector< SG::IAuxTypeVector* > xAOD::AuxContainerBase::m_vecs
privateinherited

Internal list of all managed variables.

Definition at line 233 of file AuxContainerBase.h.

◆ supportsThinning

bool SG::IAuxStore::supportsThinning = true
staticconstexprinherited

Mark that this type supports thinning operations.

See AthContainers/supportsThinning.h and AthenaPoolCnvSvc/T_AthenaPoolCnv.h. Helps guide which pool converter template will be used. If false, the default pool converter will be used rather than the aux store-specific one. Ordinary xAOD type should not touch this, but may be overridden in a derived class to handle certain special cases.

Definition at line 199 of file IAuxStore.h.

◆ zdcChannel

std::vector<int> xAOD::ZdcModuleAuxContainer_v2::zdcChannel
private

Definition at line 43 of file ZdcModuleAuxContainer_v2.h.

◆ zdcId

std::vector<uint32_t> xAOD::ZdcModuleAuxContainer_v2::zdcId
private

Definition at line 39 of file ZdcModuleAuxContainer_v2.h.

◆ zdcModule

std::vector<int> xAOD::ZdcModuleAuxContainer_v2::zdcModule
private

Definition at line 41 of file ZdcModuleAuxContainer_v2.h.

◆ zdcSide

std::vector<int> xAOD::ZdcModuleAuxContainer_v2::zdcSide
private

Definition at line 40 of file ZdcModuleAuxContainer_v2.h.

◆ zdcType

std::vector<int> xAOD::ZdcModuleAuxContainer_v2::zdcType
private

Definition at line 42 of file ZdcModuleAuxContainer_v2.h.


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