ATLAS Offline Software
Loading...
Searching...
No Matches
Event/xAOD/xAODInDetMeasurement/Root/Utilities.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include <numeric>
8
10
11 float computeTotalCharge( const SG::AuxElement& cluster) {
12 static const SG::AuxElement::Accessor<SG::JaggedVecElt<float> > chargesAcc("chargeList");
13 assert( chargesAcc.isAvailable( cluster ) );
14 const std::vector<float>& charges = chargesAcc(cluster);
15 return std::accumulate(charges.begin(), charges.end(), 0.);
16 }
17
18 int computeTotalToT( const SG::AuxElement& cluster) {
19 static const SG::AuxElement::Accessor< SG::JaggedVecElt<int> > totsAcc("totList");
20 assert( totsAcc.isAvailable( cluster ) );
21 const std::vector<int>& tots = totsAcc(cluster);
22 return std::accumulate(tots.begin(), tots.end(), 0);
23 }
24
25}
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.