33 TempInterface (
size_t size) : m_size (
size) {}
34 using AuxVectorData::setStore;
36 virtual size_t size_v()
const override {
return m_size; }
37 virtual size_t capacity_v()
const override {
return m_size; }
61 (
const SG::IConstAuxStore& orig,
65 size_t size = orig.size();
74 if( nremaining == 0) {
89 dyn_auxids = iio->getDynamicAuxIDs();
90 sel_auxids = iio->getSelectedAuxIDs();
95 copy.resize (nremaining);
104 if (
r.isLinked (
auxid))
continue;
114 if (dyn_auxids.test(
auxid) || !new_auxids.test(
auxid)) {
116 if (info->vetoed(
auxid))
continue;
122 if (dyn_auxids.test(
auxid) && !sel_auxids.test(
auxid)) {
127 const void* src = orig.getData (
auxid);
133 if (decors.test (
auxid) &&
r.getName (
auxid) !=
"mcEventWeights") {
134 std::ostringstream
ss;
135 ss <<
"unlocked decoration " <<
r.getName(
auxid)
136 <<
" (" <<
auxid <<
") in object of type "
137 << AthContainers_detail::typeinfoName (
typeid (orig));
144 const std::type_info* typ = iio->getIOType (
auxid);
145 if (strstr (typ->name(),
"PackedContainer") !=
nullptr) {
162 const size_t eltSize{
r.getEltSize(
auxid) };
163 const std::string typeName{
r.getTypeName(
auxid) };
164 const unsigned int nmantissa{ info !=
nullptr ? info->compression(
auxid) : 0 };
167 void* dst = copy.getData (
auxid, nremaining, nremaining);
174 size_t sz = v->size();
175 copy.getData (linked_auxid, 0,
sz);
179 TempInterface srciface (orig.size());
180 srciface.setStore (&orig);
181 TempInterface dstiface (copy.size());
182 dstiface.setStore (©);
185 if (nremaining ==
size) {
187 r.copyForOutput (
auxid, dstiface, 0, srciface, 0,
size);
191 for (std::size_t isrc = 0, idst = 0; isrc <
size; ++isrc) {
192 if (!dec || !dec->
thinned(isrc)) {
193 r.copyForOutput (
auxid, dstiface, idst, srciface, isrc, 1);
214 const std::size_t idst,
216 const std::size_t eltSize,
217 const std::string& typeName,
218 const unsigned int nmantissa)
223 static const unsigned int NMANTISSA_MAX = 23;
224 if (nmantissa == 0 || nmantissa >= NMANTISSA_MAX)
return;
227 static const std::vector<CxxUtils::FloatCompressor> compressors = [] {
228 std::vector<CxxUtils::FloatCompressor> result;
229 result.reserve(NMANTISSA_MAX);
230 for (std::size_t idx = 0; idx < NMANTISSA_MAX; ++idx)
231 result.emplace_back(idx);
236 char* eltPtr =
reinterpret_cast<char*
>(dst) + idst*eltSize;
239 if(typeName ==
"float") {
241 float* f =
reinterpret_cast<float*
> (eltPtr);
242 for (
size_t i = 0; i < n; i++) {
243 *f = compressors[nmantissa].reduceFloatPrecision(*f);
246 }
else if (typeName ==
"std::vector<float>"){
247 for (
size_t i = 0; i < n; i++) {
248 std::vector<float> &vals = *(
reinterpret_cast<std::vector<float>*
>(eltPtr));
249 for(
auto &val: vals) {
250 val = compressors[nmantissa].reduceFloatPrecision(val);
Handle mappings between names and auxid_t.
Interface providing I/O for a generic auxiliary store.
Interface for non-const operations on an auxiliary store.
Interface for const operations on an auxiliary store.
size_t size() const
Number of registered mappings.
Hold thinning decisions for one container.
Hold information about an option setting request.
Handle mappings between names and auxid_t.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Manage lookup of vectors of auxiliary data.
Interface providing I/O for a generic auxiliary store.
Interface for non-const operations on an auxiliary store.
Abstract interface for manipulating vectors of arbitrary types.
Container to hold aux data to be stored in a packed form.
const PackedParameters & parms() const
Return the packing parameters for this container.
Describe how the contents of a PackedContainer are to be saved.
bool isSigned() const
Are elements being written as signed numbers?
bool isFloat() const
Are elements being written as floating-point numbers?
uint8_t nbits() const
The number of bits used to store each element.
bool rounding() const
Should floats be rounded during writing?
uint8_t nmantissa() const
The number of bits used for the mantissa portion of a float-point representation, excluding a sign bi...
float scale() const
Return the scale for floating-point numbers.
Hold thinning decisions for one container.
bool thinned(size_t ndx) const
Return true if element ndx should be thinned.
size_t thinnedSize() const
Return the size of the container being thinned after thinning.
Hold thinning/slimming information for a given object.
A set of aux data identifiers.
Helper to copy an aux store while applying thinning.
Helper for emitting error messages.
#define ATHCONTAINERS_WARNING(ctx, msg)
void copyAuxStoreThinned(const SG::IConstAuxStore &orig, SG::IAuxStore ©, const SG::ThinningInfo *info)
Helper to copy an aux store while applying thinning.
static const auxid_t null_auxid
To signal no aux data item.
SG::auxid_t auxid() const
Return the aux id for this variable.
void lossyFloatCompress(void *dst, const std::size_t dst_index, const std::size_t n, const std::size_t eltSize, const std::string &typeName, const unsigned int nmantissa)
Helper method to apply lossy float compression.
virtual size_t size() const override
Return the number of elements in the store.
size_t auxid_t
Identifier for a particular aux data item.
Helper to disable undefined behavior sanitizer for a function.
#define NO_SANITIZE_UNDEFINED