ATLAS Offline Software
|
#include <RAuxStore.h>
Classes | |
class | RFieldInfo |
Public Types | |
enum | EStructMode { kUndefinedStore = 0, kContainerStore = 1, kObjectStore = 2 } |
"Structural" modes of the object More... | |
Public Member Functions | |
RAuxStore (const char *prefix="", Bool_t topStore=kTRUE, EStructMode mode=kUndefinedStore) | |
virtual | ~RAuxStore () |
Destructor. More... | |
EStructMode | structMode () const |
Return the structure mode of the object. More... | |
StatusCode | readFrom (const std::string &fileName, const std::string &ntupleName) |
Connect the object to an input RNTuple. More... | |
StatusCode | writeTo (const std::string &fileName, const std::string &ntupleName) |
Connect the object to an output RNTuple. More... | |
::Int_t | getEntry (Long64_t entry, ::Int_t getall=0) |
Get entry from the input RNTuple. More... | |
void | reset () |
Reset the store. More... | |
virtual const void * | getData (SG::auxid_t auxid) const=0 |
Pick up the const version from the base class. More... | |
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. More... | |
virtual bool | setOption (auxid_t, const AuxDataOption &) |
Set an option for a given auxiliary variable. More... | |
virtual const IAuxTypeVector * | linkedVector (SG::auxid_t) const |
Return interface for a linked variable. More... | |
Functions implementing the SG::IConstAuxStore interface | |
Get a pointer to a given array | |
virtual const void * | getData (auxid_t auxid) const override |
Get a pointer to a given array. More... | |
virtual const SG::IAuxTypeVector * | getVector (SG::auxid_t auxid) const override |
Return vector interface for one aux data item. More... | |
virtual const auxid_set_t & | getAuxIDs () const override |
Get the types(names) of variables handled by this container. More... | |
virtual const auxid_set_t & | getDecorIDs () const override |
Get the types(names) of decorations handled by this container. More... | |
virtual void * | getDecoration (auxid_t auxid, size_t size, size_t capacity) override |
Get a pointer to a given array, creating the array if necessary. More... | |
virtual bool | isDecoration (auxid_t auxid) const override |
Test if a variable is a decoration. More... | |
virtual void | lock () override |
Lock the object, and don't let decorations be added. More... | |
virtual bool | clearDecorations () override |
Remove the decorations added so far. More... | |
virtual void | lockDecoration (SG::auxid_t auxid) override |
Lock a decoration. More... | |
virtual size_t | size () const override |
Return the number of elements in the store. More... | |
virtual SG::IAuxTypeVector * | linkedVector (SG::auxid_t auxid) override |
Return interface for a linked variable. More... | |
virtual const SG::IAuxTypeVector * | linkedVector (SG::auxid_t auxid) const override |
Return const interface for a linked variable. More... | |
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. More... | |
virtual const auxid_set_t & | getWritableAuxIDs () const override |
Return a set of writable data identifiers. More... | |
virtual bool | resize (size_t size) override |
Resize the arrays to a given size. More... | |
virtual void | reserve (size_t size) override |
Reserve a given size for the arrays. More... | |
virtual void | shift (size_t pos, ptrdiff_t offs) override |
Shift the contents of the stored arrays. More... | |
virtual bool | insertMove (size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore) override |
Insert contents of another store via move. More... | |
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. More... | |
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. More... | |
virtual const auxid_set_t & | getDynamicAuxIDs () const override |
Get the types(names) of variables created dynamically. More... | |
virtual void | selectAux (const std::set< std::string > &attributes) |
Select dynamic auxiliary attributes for writing. More... | |
virtual auxid_set_t | getSelectedAuxIDs () const override |
Get the IDs of the selected aux variables. More... | |
Static Public Attributes | |
static constexpr bool | supportsThinning = true |
Mark that this type supports thinning operations. More... | |
Private Types | |
typedef SG::auxid_t | auxid_t |
Convenience type declaration. More... | |
typedef SG::auxid_set_t | auxid_set_t |
Convenience type declaration. More... | |
typedef AthContainers_detail::mutex | mutex_t |
Mutex type for multithread synchronization. More... | |
typedef AthContainers_detail::lock_guard< mutex_t > | guard_t |
Guard type for multithreaded synchronisation. More... | |
Private Member Functions | |
StatusCode | setupInputData (auxid_t auxid) |
Connect a variable to the input tree. More... | |
StatusCode | setupOutputData (auxid_t auxid) |
Connect a variable to the output ntuple. More... | |
StatusCode | scanInputNtuple () |
Scan the input RNTuple for auxiliary fields. More... | |
const std::type_info * | auxFieldType (const std::string &fieldName, const std::string &auxName, ::Bool_t staticField) |
Find the type_info to use as the aux type for a given field. More... | |
StatusCode | setupAuxField (const std::string &fieldName, const std::string &auxName, ::Bool_t staticField) |
Register one input field as an available auxiliary variable. More... | |
::Bool_t | isAuxIDSelected (auxid_t auxid) const |
Check if this auxiliary variable needs to go to the output. More... | |
::Bool_t | isPrimitiveField (std::string fieldName) |
Check if a field holds a primitive variable or not. More... | |
::Bool_t | isContainerField (std::string fieldName, auxid_t auxid) const |
Check if a field describes a container or a single object. More... | |
StatusCode | addVectorField (std::string fieldName, std::string fieldTypeName, ::Bool_t isInputFile) |
Add a vector field to a model (either the input or the output one) More... | |
::Bool_t | fieldInfosHasAuxid (auxid_t auxid) const |
Checks if the fieldInfos map has an entry for the given auxid. More... | |
Static Private Member Functions | |
::Bool_t | isRegisteredType (auxid_t auxid) |
Check if the auxiliary variable has a registered type. More... | |
Private Attributes | |
std::string | m_prefix |
Static prefix for the field names. More... | |
std::string | m_dynPrefix |
Dynamic prefix for the field names. More... | |
::Bool_t | m_topStore |
Flag stating whether this is a "top store". More... | |
EStructMode | m_structMode |
The "structural" mode of the object. More... | |
std::unique_ptr< RNTupleReader > | m_inNtuple |
The ntuple being read from. More... | |
std::unique_ptr< RNTupleReader > | m_outNtuple |
The the ntuple being written to. More... | |
::Bool_t | m_inputScanned |
"Scan status" of the input RNTuple More... | |
AuxSelection | m_selection |
Object helping to select which auxiliary variables to write. More... | |
SG::AuxStoreInternal * | m_transientStore {} |
Store for the in-memory-only variables. More... | |
auxid_set_t | m_auxIDs |
Internal list of variable IDs handled currently by the object. More... | |
auxid_set_t | m_decorIDs |
std::vector< SG::IAuxTypeVector * > | m_vecs |
Variables handled currently by the object. More... | |
std::size_t | m_size {} |
The current size of the container being described. More... | |
::Bool_t | m_locked |
Is this container locked? More... | |
std::vector< ::Bool_t > | m_isDecoration |
Flags items as decorations. More... | |
mutex_t | m_mutex1 |
Mutexes object used for multithreaded synchronisation. More... | |
mutex_t | m_mutex2 |
std::string | m_inFileName |
The input file that we are reading from. More... | |
std::string | m_outFileName |
The output file that we are writing to. More... | |
std::string | m_inputNtupleName |
The name of the ntuple that we are reading from. More... | |
std::string | m_outputNtupleName |
The name of the ntuple that we are writing to. More... | |
std::unique_ptr< RNTupleModel > | m_outModel |
The model of the output ntuple. More... | |
std::unique_ptr< RNTupleModel > | m_inModel |
The model of the input ntuple. More... | |
::Long64_t | m_entryToLoad |
The entry to load from the ntuple. More... | |
std::map< auxid_t, RFieldInfo > | m_fields |
A way to acces an representation of a field with an auxid. More... | |
Definition at line 36 of file RAuxStore.h.
|
private |
Convenience type declaration.
Definition at line 41 of file RAuxStore.h.
|
private |
Convenience type declaration.
Definition at line 39 of file RAuxStore.h.
|
private |
Guard type for multithreaded synchronisation.
Definition at line 220 of file RAuxStore.h.
|
private |
Mutex type for multithread synchronization.
Definition at line 218 of file RAuxStore.h.
"Structural" modes of the object
Enumerator | |
---|---|
kUndefinedStore | The structure mode is not defined. |
kContainerStore | The object describes an entire container. |
kObjectStore | The object describes a single object. |
Definition at line 45 of file RAuxStore.h.
xAOD::RAuxStore::RAuxStore | ( | const char * | prefix = "" , |
Bool_t | topStore = kTRUE , |
||
EStructMode | mode = kUndefinedStore |
||
) |
Definition at line 50 of file RAuxStore.cxx.
|
virtual |
|
private |
Add a vector field to a model (either the input or the output one)
This function creates a base field using the provided field name and type name.
Depending on whether the field is for the input file or the output file, it adds the field to the appropriate ntuple model.
fieldName | The name of the field to be added. |
fieldTypeName | The type name of the field to be added. |
isInputFile | A boolean flag indicating whether the field is for the input file. |
Definition at line 1807 of file RAuxStore.cxx.
|
private |
Find the type_info to use as the aux type for a given field.
This function retrieves the type information for a given auxiliary field.
It uses the field's inspector to determine the type and handles cases where the expected class or collection proxy is not available.
fieldName | The name of the field in the ntuple |
auxName | The name of the auxiliary field. |
isStaticField | kTRUE if this is a static field, and kFALSE if it's a dynamic one |
Definition at line 1385 of file RAuxStore.cxx.
|
overridevirtual |
Remove the decorations added so far.
Only works for transient decorations.
Only works for transient decorations.
Implements SG::IConstAuxStore.
Definition at line 406 of file RAuxStore.cxx.
|
private |
Checks if the fieldInfos map has an entry for the given auxid.
auxid | The auxid to check for in the fieldInfos map. |
kTRUE
if the fieldInfos map has an entry for the given auxid, kFALSE
otherwise. Definition at line 1836 of file RAuxStore.cxx.
|
overridevirtual |
Get the types(names) of variables handled by this container.
Implements SG::IConstAuxStore.
Definition at line 276 of file RAuxStore.cxx.
Get a pointer to a given array.
auxid | The auxiliary ID for which to retrieve the data pointer |
Implements SG::IConstAuxStore.
Definition at line 218 of file RAuxStore.cxx.
|
overridevirtual |
Get a pointer to a given array, creating the array if necessary.
Retrieves or creates data for a given auxiliary ID.
It handles both transient and output data, ensuring that the data is properly set up and sized.
auxid | The auxiliary ID for which data is requested |
size | The size of the data to be retrieved or created |
capacity | The capacity of the data to be retrieved or created |
Implements SG::IAuxStore.
Definition at line 524 of file RAuxStore.cxx.
|
inherited |
Pick up the const version from the base class.
|
overridevirtual |
Get a pointer to a given array, creating the array if necessary.
Returns a pointer to the decoration data corresponding to the specified auxid
.
If the decoration does not exist, it creates it. Handles locked stores and transient stores appropriately.
auxid | The auxiliary ID for which to retrieve or create the decoration. |
size | The size of the decoration vector. |
capacity | The capacity of the decoration vector. |
Implements SG::IConstAuxStore.
Definition at line 296 of file RAuxStore.cxx.
|
overridevirtual |
Get the types(names) of decorations handled by this container.
Retrieves the set of decoration IDs currently associated with this store.
Implements SG::IConstAuxStore.
Definition at line 282 of file RAuxStore.cxx.
|
overridevirtual |
Get the types(names) of variables created dynamically.
Implements SG::IAuxStoreIO.
Definition at line 848 of file RAuxStore.cxx.
Int_t xAOD::RAuxStore::getEntry | ( | Long64_t | entry, |
::Int_t | getall = 0 |
||
) |
|
overridevirtual |
Get a pointer to the data being stored for one aux data item.
Retrieves the input/output data for a given auxiliary ID.
It ensures that the data is properly set up and available in memory.
auxid | The auxiliary ID for which data is requested. |
Implements SG::IAuxStoreIO.
Definition at line 762 of file RAuxStore.cxx.
|
overridevirtual |
Return the type of the data to be stored for one aux data item.
Implements SG::IAuxStoreIO.
Definition at line 805 of file RAuxStore.cxx.
|
overridevirtual |
Get the IDs of the selected aux variables.
Retrieves the selected auxiliary IDs.
Reimplemented from SG::IAuxStoreIO.
Definition at line 871 of file RAuxStore.cxx.
|
overridevirtual |
Return vector interface for one aux data item.
auxid | The auxiliary ID for which to retrieve the data vector |
Implements SG::IConstAuxStore.
Definition at line 232 of file RAuxStore.cxx.
|
overridevirtual |
Return a set of writable data identifiers.
Retrieves a set of writable auxiliary IDs.
Implements SG::IAuxStore.
Definition at line 592 of file RAuxStore.cxx.
|
overridevirtual |
Insert contents of another store via move.
inserts and moves elements from another auxiliary store into this one, starting at the specified position.
It adjusts the size of the container accordingly.
pos | The position at which to start inserting elements. |
other | The auxiliary store from which to move elements. |
ignore_in | A set of auxiliary IDs to ignore during the move. |
Definition at line 708 of file RAuxStore.cxx.
|
pure virtualinherited |
Move all elements from other
to this store.
pos | The starting index of the insertion. |
other | Store from which to do the move. |
ignore | Set 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.
Implemented in SG::AuxStoreInternal.
|
private |
Check if this auxiliary variable needs to go to the output.
This function checks whether a given auxiliary ID is selected.
auxid | The auxiliary ID that should be checked |
kTRUE
if the variable needs to be written out, kFALSE
if not Definition at line 1611 of file RAuxStore.cxx.
|
private |
Check if a field describes a container or a single object.
This function checks whether a given field (determined by the fieldName) corresponds to a container or a single element based on its type information.
fieldName | The name of the field to check. |
auxid | The auxiliary ID of the variable to check. |
kTRUE
if the field represents a container, code>kFALSE otherwise. Definition at line 1650 of file RAuxStore.cxx.
Test if a variable is a decoration.
auxid | The auxiliary ID for which to check if it is a decoration |
Implements SG::IConstAuxStore.
Definition at line 375 of file RAuxStore.cxx.
|
private |
Check if a field holds a primitive variable or not.
This function checks whether the given field corresponds to a primitive data type based on its type information and the auxiliary ID provided.
fieldName | The name of the field to check. |
kTRUE
if the field describes a primitive variable, kFALSE
otherwise Definition at line 1777 of file RAuxStore.cxx.
|
staticprivate |
Check if the auxiliary variable has a registered type.
This function is used to test if a given auxiliary variable is known in the registry with a proper type.
auxid | The auxiliary ID to check |
kTRUE
if the full type of the auxiliary property is known, kFALSE
otherwise Definition at line 1628 of file RAuxStore.cxx.
|
overridevirtual |
Return const interface for a linked variable.
Looks up a linked variable associated with the provided auxid
.
If a linked variable exists within the current vector storage (m_vecs
), it returns the corresponding data vector. If not found, it checks the transient store for the linked vector.
auxid | The auxiliary ID for which to retrieve the linked variable |
Reimplemented from SG::IConstAuxStore.
Definition at line 477 of file RAuxStore.cxx.
|
overridevirtual |
Return interface for a linked variable.
(const version) Looks up a linked variable associated with the provided auxid
.
If a linked variable exists within the current vector storage (m_vecs
), it returns the corresponding data vector. If not found, it checks the transient store for the linked vector.
auxid | The auxiliary ID for which to retrieve the linked variable |
Reimplemented from SG::IAuxStore.
Definition at line 500 of file RAuxStore.cxx.
|
inlineinherited |
Return interface for a linked variable.
auxid | The ID of the parent variable. |
If auxid
has a linked variable, then return the IAuxTypeVector
describing it. Otherwise, return nullptr
. May return nullptr
unconditionally if this store does not support linked variables.
Definition at line 189 of file IConstAuxStore.h.
|
overridevirtual |
Lock the object, and don't let decorations be added.
Implements SG::IConstAuxStore.
Definition at line 389 of file RAuxStore.cxx.
|
overridevirtual |
Lock a decoration.
auxid | The auxiliary ID for which to lock the decoration |
Implements SG::IConstAuxStore.
Definition at line 434 of file RAuxStore.cxx.
StatusCode xAOD::RAuxStore::readFrom | ( | const std::string & | fileName, |
const std::string & | ntupleName | ||
) |
Connect the object to an input RNTuple.
This function is called by the infrastructure to connect the object to an input RNTuple whenever a new input file is opened.
fileName | Pointer to the file that is being read from |
ntupleName | Name of the ntuple that is being read from |
kTRUE
if successful, kFALSE
otherwise Definition at line 103 of file RAuxStore.cxx.
|
overridevirtual |
Reserve a given size for the arrays.
Reserves space for the auxiliary data vectors.
It ensures that the vectors have enough capacity to hold the specified number of elements.
size | The number of elements to reserve space for. |
Implements SG::IAuxStore.
Definition at line 635 of file RAuxStore.cxx.
void xAOD::RAuxStore::reset | ( | ) |
Reset the store.
This function resets the store to its initial state.
Definition at line 202 of file RAuxStore.cxx.
|
overridevirtual |
Resize the arrays to a given size.
size | The size to which the arrays should be resized |
Implements SG::IAuxStore.
Definition at line 601 of file RAuxStore.cxx.
|
private |
Scan the input RNTuple for auxiliary fields.
Scans the input ntuple for auxiliary data fields and sets up the necessary structures to access them.
It ensures that the input ntuple is properly scanned and the auxiliary data fields are set up.
kTRUE
if successful, kFALSE
otherwise Definition at line 887 of file RAuxStore.cxx.
|
virtual |
Select dynamic auxiliary attributes for writing.
Selects the auxiliary attributes specified in the input set.
attributes | A set of attribute names to be selected |
Definition at line 859 of file RAuxStore.cxx.
|
inlinevirtualinherited |
Set an option for a given auxiliary variable.
auxid | The identifier of the desired aux data item. |
option | The option to set. |
The interpretation of the option depends on the particular representation of the variable.
Returns true if the option setting was successful; false otherwise.
Reimplemented in xAOD::AuxContainerBase, xAOD::AuxInfoBase, and SG::AuxStoreInternal.
Definition at line 173 of file IAuxStore.h.
|
private |
Register one input field as an available auxiliary variable.
This function sets up an auxiliary field by determining its type and attempting to register it with the auxiliary type registry.
If the field type is not known, it tries to create a factory for the field's type. The function handles both static and dynamic fields and updates the set of known auxiliary IDs upon success.
fieldName | The name of the field in the ntuple |
auxName | The name of the auxiliary field |
isStaticField | kTRUE if this is a static field, and kFALSE if it's a dynamic one |
kTRUE
if successful, kFALSE
if not Definition at line 1456 of file RAuxStore.cxx.
|
private |
Connect a variable to the input tree.
This internal function takes care of connecting to an individual (sub-)field in the input file for a given auxiliary variable.
auxid | The ID of the variable to connect to |
kTRUE
if successful, kFALSE
otherwise Definition at line 974 of file RAuxStore.cxx.
|
private |
Connect a variable to the output ntuple.
This function is used internally to create an output field with the contents of a single auxiliary variable.
auxid | The ID of the variable to create an output field for |
kTRUE
if the operation was successful, kFALSE
if not Definition at line 1207 of file RAuxStore.cxx.
|
overridevirtual |
Shift the contents of the stored arrays.
Shifts the elements in the auxiliary data vectors by a specified offset.
It adjusts the size of the container accordingly.
pos | The position at which to start shifting. |
offs | The offset by which to shift the elements. |
Implements SG::IAuxStore.
Definition at line 666 of file RAuxStore.cxx.
|
overridevirtual |
Return the number of elements in the store.
Implements SG::IConstAuxStore.
Definition at line 445 of file RAuxStore.cxx.
RAuxStore::EStructMode xAOD::RAuxStore::structMode | ( | ) | const |
Return the structure mode of the object.
This function gets the structure mode of the object.
Definition at line 91 of file RAuxStore.cxx.
StatusCode xAOD::RAuxStore::writeTo | ( | const std::string & | fileName, |
const std::string & | ntupleName | ||
) |
Connect the object to an output RNTuple.
This function is called by the infrastructure to connect the object to an output RNTuple.
fileName | Pointer to the file that is being written to |
ntupleName | Name of the ntuple that is being written to |
kTRUE
if successful, kFALSE
otherwise Definition at line 136 of file RAuxStore.cxx.
|
private |
Internal list of variable IDs handled currently by the object.
Definition at line 205 of file RAuxStore.h.
|
private |
Definition at line 206 of file RAuxStore.h.
|
private |
Dynamic prefix for the field names.
Definition at line 184 of file RAuxStore.h.
|
private |
The entry to load from the ntuple.
Definition at line 237 of file RAuxStore.h.
|
private |
A way to acces an representation of a field with an auxid.
Definition at line 271 of file RAuxStore.h.
|
private |
The input file that we are reading from.
Definition at line 225 of file RAuxStore.h.
|
private |
The model of the input ntuple.
Definition at line 235 of file RAuxStore.h.
|
private |
The ntuple being read from.
Definition at line 192 of file RAuxStore.h.
|
private |
The name of the ntuple that we are reading from.
Definition at line 229 of file RAuxStore.h.
|
private |
"Scan status" of the input RNTuple
Definition at line 197 of file RAuxStore.h.
|
private |
Flags items as decorations.
Definition at line 215 of file RAuxStore.h.
|
private |
Is this container locked?
Definition at line 213 of file RAuxStore.h.
|
mutableprivate |
Mutexes object used for multithreaded synchronisation.
Definition at line 222 of file RAuxStore.h.
|
private |
Definition at line 222 of file RAuxStore.h.
|
private |
The output file that we are writing to.
Definition at line 227 of file RAuxStore.h.
|
private |
The model of the output ntuple.
Definition at line 233 of file RAuxStore.h.
|
private |
The the ntuple being written to.
Definition at line 194 of file RAuxStore.h.
|
private |
The name of the ntuple that we are writing to.
Definition at line 231 of file RAuxStore.h.
|
private |
Static prefix for the field names.
Definition at line 182 of file RAuxStore.h.
|
private |
Object helping to select which auxiliary variables to write.
Definition at line 200 of file RAuxStore.h.
|
private |
The current size of the container being described.
Definition at line 210 of file RAuxStore.h.
|
private |
The "structural" mode of the object.
Definition at line 189 of file RAuxStore.h.
|
private |
Flag stating whether this is a "top store".
Definition at line 186 of file RAuxStore.h.
|
private |
Store for the in-memory-only variables.
Definition at line 202 of file RAuxStore.h.
|
private |
Variables handled currently by the object.
Definition at line 208 of file RAuxStore.h.
|
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.