49 const std::vector<const xAOD::SpacePointContainer*>& spacePointCollections,
50 std::vector<float>& features, std::vector<std::uint64_t>& moduleIds,
51 std::vector<int>& ids,
52 std::vector<const xAOD::SpacePoint*>& allSPPtrs,
53 std::size_t nFeatures)
const {
56 for (
const auto* spc : spacePointCollections) {
59 moduleIds.reserve(nSP);
60 allSPPtrs.reserve(nSP);
62 std::size_t skipped = 0;
63 for (
const auto* spc : spacePointCollections) {
64 for (
const auto*
sp : *spc) {
65 const auto* cl1 =
sp->measurements().front();
67 static_cast<Identifier::value_type
>(cl1->identifier()));
70 const auto* cl2 =
sp->measurements().at(1);
72 static_cast<Identifier::value_type
>(cl2->identifier()));
80 if (overlapFlag == 2 || overlapFlag == 3) {
82 ACTS_VERBOSE(
"Skip phi overlap spacepoint (flag=" << overlapFlag
93 allSPPtrs.push_back(
sp);
97 ACTS_DEBUG(
"Skipped " << skipped <<
" SPs because of phi overlap");
98 nSP = allSPPtrs.size();
99 ACTS_DEBUG(
"Keep " << nSP <<
" SPs for feature creation");
101 std::vector<std::size_t> idxs(nSP);
102 std::iota(idxs.begin(), idxs.end(), 0);
104 idxs, [&](
auto a,
auto b) {
return moduleIds.at(
a) < moduleIds.at(b); });
105 std::ranges::sort(moduleIds);
109 std::vector<const xAOD::SpacePoint*> sortedSPPtrs(nSP);
110 for (std::size_t k = 0; k < nSP; ++k) {
111 sortedSPPtrs.at(k) = allSPPtrs.at(idxs.at(k));
113 allSPPtrs.swap(sortedSPPtrs);
115 features.assign(nFeatures * nSP, 0.f);
118 for (std::size_t k = 0; k < nSP; ++k) {
119 ids.at(k) =
static_cast<int>(k);
121 std::span<float> f(features.data() + k * nFeatures, nFeatures);
122 const auto&
sp = *allSPPtrs.at(k);
124 using namespace Acts::VectorHelpers;
126 Acts::Vector3 spp{
sp.x(),
sp.y(),
sp.z()};
128 if (
sp.measurements().size() == 1) {
129 for (std::size_t j = 0; j < nFeatures; j += 4) {
130 f[j + 0] =
perp(spp) / 1000.f;
131 f[j + 1] =
phi(spp) / std::numbers::pi_v<float>;
132 f[j + 2] =
sp.z() / 1000.f;
137 f[j + 0] =
perp(spp) / 1000.f;
138 f[j + 1] =
phi(spp) / std::numbers::pi_v<float>;
139 f[j + 2] =
sp.z() / 1000.f;
142 for (
const auto* m :
sp.measurements()) {
144 auto gp = cl->globalPosition();
146 f[j + 0] =
perp(gp) / 1000.f;
147 f[j + 1] =
phi(gp) / std::numbers::pi_v<float>;
148 f[j + 2] = gp.z() / 1000.f;
154 return StatusCode::SUCCESS;