ATLAS Offline Software
|
Auxiliary variable type allowing storage as a jagged vector. That is, the payloads for all the DataVector elements are stored contiguously in a single vector. More...
#include "AthContainers/JaggedVecImpl.h"
#include "AthContainers/tools/JaggedVecVectorFactory.h"
#include "AthContainers/JaggedVecConstAccessor.h"
#include "AthContainers/JaggedVecAccessor.h"
#include "AthContainers/JaggedVecDecorator.h"
Go to the source code of this file.
Auxiliary variable type allowing storage as a jagged vector. That is, the payloads for all the DataVector elements are stored contiguously in a single vector.
std::vector<T>
. This means that the auxiliary variable itself is stored as a nested std::vector<std::vector<T>
>. This tends to be somewhat inefficient in space, as well as being not so friendly if one wants to share the data with heterogenous resources such as GPUs.A jagged vector flattens this structure. The variable itself contains simply a pair of indices into another, ‘linked’, variable, which holds the items for all container elements in a single contiguous block. Specialized accessor classes allow one to treat the data as if it were still a separate vector per element.
The usual way of declaring a jagged vector variable in an xAOD container class is to use the macro defined in xAODCore/JaggedVec.h:
This will declare an auxiliary variable intVec
of type SG::JaggedVecElt<int>
containing the indices of the vector elements, as well as a variable intVec_linked
of type int
containing the actual vector data.
One does not usually interact directly with the linked variable or even with the SG::JaggedVecElt
type. Rather, the usual Accessor classes provide a vector-like interface. So one can write, for example,
ConstAccessor
and Decorator
should work as expected. The accessors can also be used to create dynamic jagged vector variables. A jagged vector should be able to hold any type that can be put in a std::vector
. In particular, std::string
and ElementLink
have been tested. However, if you are not using a primitive type, you may need to add dictionary entries in order to save the variable.
As mentioned above, you don't usually need to interact with the _linked
variable holding the actual payload. However, you may need to name it if you are selecting individual variables to write.
Definition in file Control/AthContainers/AthContainers/JaggedVec.h.