ATLAS Offline Software
AuxInfoBase.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 /*
3  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 */
5 #ifndef XAODCORE_AUXINFOBASE_H
6 #define XAODCORE_AUXINFOBASE_H
7 
8 // System include(s):
9 #include <vector>
10 
11 // EDM include(s):
17 #ifndef XAOD_STANDALONE
18 # include "AthenaKernel/ILockable.h"
19 #endif // not XAOD_STANDALONE
20 
21 // Local include(s):
22 #include "xAODCore/AuxSelection.h"
23 
24 // Forward declaration(s):
25 namespace SG {
26  class IAuxTypeVector;
27  class AuxDataOption;
28 }
29 
30 namespace xAOD {
31 
43  class AuxInfoBase : public SG::IAuxStore,
44  public SG::IAuxStoreIO,
45  public SG::IAuxStoreHolder
46 #ifndef XAOD_STANDALONE
47  , public ILockable
48 #endif // not XAOD_STANDALONE
49  {
50 
51  public:
56 
58  AuxInfoBase( bool allowDynamicVars = true );
60  AuxInfoBase( const AuxInfoBase& parent );
64  ~AuxInfoBase();
65 
67  AuxInfoBase& operator=( const AuxInfoBase& rhs );
68 
71 
73  virtual SG::IAuxStore* getStore() override;
75  virtual const SG::IAuxStore* getStore() const override;
77  virtual void setStore( SG::IAuxStore* store ) override;
79  virtual AuxStoreType getStoreType() const override { return AST_ObjectStore; }
80 
82 
85 
87  virtual const void* getData( auxid_t auxid ) const override;
88 
90  virtual const SG::IAuxTypeVector* getVector (SG::auxid_t auxid) const override final;
91 
93  virtual const auxid_set_t& getAuxIDs() const override;
94 
96  virtual const auxid_set_t& getDecorIDs() const override;
97 
99  virtual bool isDecoration (auxid_t auxid) const override;
100 
102  virtual void* getDecoration( auxid_t auxid, size_t size,
103  size_t capacity ) override;
104 
106  virtual void lock() override;
107 
109  virtual bool clearDecorations() override;
110 
112  virtual size_t size() const override;
113 
115  virtual void lockDecoration (SG::auxid_t auxid) override;
116 
118  virtual const SG::IAuxTypeVector* linkedVector (SG::auxid_t auxid) const override;
119 
121 
124 
126  virtual void* getData( auxid_t auxid, size_t size,
127  size_t capacity ) override;
128 
130  virtual const auxid_set_t& getWritableAuxIDs() const override;
131 
133  virtual bool resize( size_t size ) override;
135  virtual void reserve( size_t size ) override;
137  virtual void shift( size_t pos, ptrdiff_t offs ) override;
139  virtual bool insertMove (size_t pos,
140  IAuxStore& other,
141  const SG::auxid_set_t& ignore) override;
143  virtual bool setOption( auxid_t id, const SG::AuxDataOption& option ) override;
144 
146  virtual SG::IAuxTypeVector* linkedVector (SG::auxid_t auxid) override;
147 
149 
152 
154  virtual const void* getIOData( auxid_t auxid ) const override;
155 
157  virtual const std::type_info* getIOType( auxid_t auxid ) const override;
158 
160  virtual const auxid_set_t& getDynamicAuxIDs() const override;
161 
163  virtual SG::auxid_set_t getSelectedAuxIDs() const override;
164 
166 
169 
171  const char* name() const;
173  void setName( const char* name );
174 
176 
178  template <class T, class ALLOC = std::allocator<T> >
179  using AuxVariable_t = T;
180  template <class T, class ALLOC = std::allocator<T> >
181  using LinkedVariable_t = std::vector<T, ALLOC>;
182 
184  template< typename T >
185  auxid_t getAuxID( const std::string& name,
186  T& /*info*/,
189  const SG::auxid_t linkedVariable = SG::null_auxid );
191  template< typename T >
192  void regAuxVar( auxid_t auxid, const std::string& name,
193  T& info );
194 
195  private:
199  std::vector< SG::IAuxTypeVector* > m_vecs;
200 
208  bool m_locked;
209 
212  typedef AthContainers_detail::lock_guard< mutex_t > guard_t;
213  mutable mutex_t m_mutex;
214 
216  std::string m_name;
217 
218  }; // class AuxInfoBase
219 
220 } // namespace xAOD
221 
222 // Declare a class ID for the class:
223 #include "xAODCore/CLASS_DEF.h"
224 CLASS_DEF( xAOD::AuxInfoBase, 226113180, 1 )
225 
226 // Describe the inheritance of the class:
227 #include "xAODCore/BaseInfo.h"
230 
231 // Include the template implementation:
232 #include "AuxInfoBase.icc"
233 
234 #endif // XAODCORE_AUXINFOBASE_H
xAOD::AuxInfoBase
Common base class for auxiliary info objects.
Definition: AuxInfoBase.h:49
grepfile.info
info
Definition: grepfile.py:38
xAOD::AuxInfoBase::regAuxVar
void regAuxVar(auxid_t auxid, const std::string &name, T &info)
Register one of the persistent variables internally.
SGTest::store
TestStore store
Definition: TestStore.cxx:23
AuxInfoBase.icc
xAOD::AuxInfoBase::LinkedVariable_t
std::vector< T, ALLOC > LinkedVariable_t
Definition: AuxInfoBase.h:181
xAOD::AuxInfoBase::linkedVector
virtual const SG::IAuxTypeVector * linkedVector(SG::auxid_t auxid) const override
Return interface for a linked variable.
Definition: AuxInfoBase.cxx:359
IAuxStoreHolder.h
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
xAOD::AuxInfoBase::auxid_t
SG::auxid_t auxid_t
The aux ID type definition.
Definition: AuxInfoBase.h:53
xAOD::AuxInfoBase::mutex_t
AthContainers_detail::mutex mutex_t
Mutex for multithread synchronization.
Definition: AuxInfoBase.h:211
xAOD::AuxInfoBase::getSelectedAuxIDs
virtual SG::auxid_set_t getSelectedAuxIDs() const override
Get the IDs of the selected dynamic Aux variables (for writing)
Definition: AuxInfoBase.cxx:657
xAOD::AuxInfoBase::AuxInfoBase
AuxInfoBase(bool allowDynamicVars=true)
Default constructor.
Definition: AuxInfoBase.cxx:25
AthenaPoolTestRead.flags
flags
Definition: AthenaPoolTestRead.py:8
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
xAOD::AuxInfoBase::getIOType
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.
Definition: AuxInfoBase.cxx:612
xAOD::AuxInfoBase::m_vecs
std::vector< SG::IAuxTypeVector * > m_vecs
Internal list of all managed variables.
Definition: AuxInfoBase.h:199
xAOD::AuxInfoBase::size
virtual size_t size() const override
Get the size of the container.
Definition: AuxInfoBase.cxx:393
xAOD::AuxInfoBase::AuxVariable_t
T AuxVariable_t
Declare how to wrap variables for this sort of base.
Definition: AuxInfoBase.h:179
ILockable.h
Interface to allow an object to lock itself when made const in SG.
xAOD::AuxInfoBase::getDynamicAuxIDs
virtual const auxid_set_t & getDynamicAuxIDs() const override
Get the types(names) of variables created dynamically.
Definition: AuxInfoBase.cxx:636
xAOD::AuxInfoBase::setOption
virtual bool setOption(auxid_t id, const SG::AuxDataOption &option) override
Make an option setting on an aux variable.
Definition: AuxInfoBase.cxx:567
xAOD::AuxInfoBase::resize
virtual bool resize(size_t size) override
Resize the arrays to a given size.
Definition: AuxInfoBase.cxx:467
xAOD::other
@ other
Definition: TrackingPrimitives.h:509
xAOD::AuxInfoBase::getIOData
virtual const void * getIOData(auxid_t auxid) const override
Get a pointer to the data being stored for one aux data item.
Definition: AuxInfoBase.cxx:585
xAOD::AuxInfoBase::getWritableAuxIDs
virtual const auxid_set_t & getWritableAuxIDs() const override
Return a set of writable data identifiers.
Definition: AuxInfoBase.cxx:460
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::AuxInfoBase::setName
void setName(const char *name)
Set the name of the container instance.
Definition: AuxInfoBase.cxx:684
xAOD::AuxInfoBase::m_ownsStore
bool m_ownsStore
Flag deciding if the object owns the dynamic store or not.
Definition: AuxInfoBase.h:206
xAOD::AuxInfoBase::name
const char * name() const
Get the name of the container instance.
Definition: AuxInfoBase.cxx:679
xAOD::AuxInfoBase::getVector
virtual const SG::IAuxTypeVector * getVector(SG::auxid_t auxid) const override final
Return vector interface for one aux data item.
Definition: AuxInfoBase.cxx:204
SG::IAuxStoreIO
Interface providing I/O for a generic auxiliary store.
Definition: IAuxStoreIO.h:44
xAOD::AuxInfoBase::insertMove
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore) override
Insert contents of another store via move.
Definition: AuxInfoBase.cxx:549
xAOD::AuxInfoBase::getData
virtual const void * getData(auxid_t auxid) const override
Get a pointer to a given array.
Definition: AuxInfoBase.cxx:195
xAOD::AuxInfoBase::getStoreType
virtual AuxStoreType getStoreType() const override
Return the type of the store object.
Definition: AuxInfoBase.h:79
xAOD::AuxInfoBase::getDecoration
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity) override
Get a pointer to a given array, as a decoration.
Definition: AuxInfoBase.cxx:265
SG::IAuxStoreHolder::AuxStoreType
AuxStoreType
Type of the auxiliary store.
Definition: IAuxStoreHolder.h:66
DiTauMassTools::ignore
void ignore(T &&)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:58
xAOD::AuxInfoBase::isDecoration
virtual bool isDecoration(auxid_t auxid) const override
Test if a variable is a decoration.
Definition: AuxInfoBase.cxx:239
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
CaloCellPos2Ntuple.None
None
Definition: CaloCellPos2Ntuple.py:23
xAOD::AuxInfoBase::m_store
SG::IAuxStore * m_store
Internal dynamic auxiliary store object.
Definition: AuxInfoBase.h:202
xAOD::AuxInfoBase::getDecorIDs
virtual const auxid_set_t & getDecorIDs() const override
Get the types(names) of decorations handled by this container.
Definition: AuxInfoBase.cxx:256
xAOD::AuxInfoBase::m_name
std::string m_name
Name of the container in memory. Set externally.
Definition: AuxInfoBase.h:216
xAOD::AuxInfoBase::operator=
AuxInfoBase & operator=(const AuxInfoBase &rhs)
Assignment operator.
Definition: AuxInfoBase.cxx:105
IAuxStoreIO.h
Interface providing I/O for a generic auxiliary store.
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::AuxInfoBase::getStore
virtual SG::IAuxStore * getStore() override
Get the currently used internal store object.
Definition: AuxInfoBase.cxx:140
SG::AuxVarFlags
AuxVarFlags
Additional flags to qualify an auxiliary variable.
Definition: AuxTypes.h:58
xAOD::AuxInfoBase::auxid_set_t
SG::auxid_set_t auxid_set_t
The aux ID set type definition.
Definition: AuxInfoBase.h:55
xAOD::AuxInfoBase::getAuxIDs
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
Definition: AuxInfoBase.cxx:249
SG::AuxDataOption
Hold information about an option setting request.
Definition: AuxDataOption.h:37
xAOD::AuxInfoBase::setStore
virtual void setStore(SG::IAuxStore *store) override
Set a different internal store object.
Definition: AuxInfoBase.cxx:160
xAOD::AuxInfoBase::shift
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the contents of the stored arrays.
Definition: AuxInfoBase.cxx:532
xAOD::AuxInfoBase::reserve
virtual void reserve(size_t size) override
Reserve a given size for the arrays.
Definition: AuxInfoBase.cxx:501
SG_BASES3
SG_BASES3(xAOD::AuxInfoBase, SG::IAuxStore, SG::IAuxStoreIO, SG::IAuxStoreHolder)
xAOD::AuxInfoBase::guard_t
AthContainers_detail::lock_guard< mutex_t > guard_t
Definition: AuxInfoBase.h:212
xAOD::AuxInfoBase::lockDecoration
virtual void lockDecoration(SG::auxid_t auxid) override
Lock a decoration.
Definition: AuxInfoBase.cxx:351
threading.h
Threading definitions.
CLASS_DEF.h
File providing the different SG_BASE macros.
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
SG::IAuxStore
Interface for non-const operations on an auxiliary store.
Definition: IAuxStore.h:48
AuxSelection.h
xAOD::AuxInfoBase::getAuxID
auxid_t getAuxID(const std::string &name, 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.
xAOD::AuxInfoBase::m_storeIO
SG::IAuxStoreIO * m_storeIO
The IO interface to the internal auxiliary store.
Definition: AuxInfoBase.h:204
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
SG::IAuxTypeVector
Abstract interface for manipulating vectors of arbitrary types.
Definition: IAuxTypeVector.h:42
AuxTypeRegistry.h
Handle mappings between names and auxid_t.
IAuxStore.h
Interface for non-const operations on an auxiliary store.
ILockable
Interface to allow an object to lock itself when made const in SG.
Definition: ILockable.h:32
SG::auxid_set_t
A set of aux data identifiers.
Definition: AuxTypes.h:47
xAOD::AuxInfoBase::~AuxInfoBase
~AuxInfoBase()
Destructor.
Definition: AuxInfoBase.cxx:86
xAOD::AuxInfoBase::clearDecorations
virtual bool clearDecorations() override
Clear all decorations.
Definition: AuxInfoBase.cxx:322
SG::IAuxStoreHolder::AST_ObjectStore
@ AST_ObjectStore
The store describes a single object.
Definition: IAuxStoreHolder.h:67
SG::IAuxStoreHolder
Interface for objects taking part in direct ROOT I/O.
Definition: IAuxStoreHolder.h:36
xAOD::AuxInfoBase::m_auxids
auxid_set_t m_auxids
Internal list of all available variables.
Definition: AuxInfoBase.h:197
xAOD::AuxInfoBase::m_locked
bool m_locked
Has the container been locked?
Definition: AuxInfoBase.h:208
xAOD::AuxInfoBase::m_mutex
mutex_t m_mutex
Definition: AuxInfoBase.h:213
xAOD::AuxInfoBase::lock
virtual void lock() override
Lock the container.
Definition: AuxInfoBase.cxx:308