File KdtSurfacesProvider.hpp

namespace Acts


This file is foreseen for the Geometry module to replace Extent

namespace Experimental
template<size_t kDIM = 2u, size_t bSize = 100u, typename reference_generator = detail::PolyhedronReferenceGenerator<1u, false>>
class KdtSurfaces
#include <Acts/Detector/KdtSurfacesProvider.hpp>

A wrapper class around a KDTree of surfaces.

It also deals with the conversion from global query to KDTree lookup positions

Public Types

using Entry = std::pair<Query, std::shared_ptr<Surface>>

Broadcast the entry.

using KDTS = KDTree<kDIM, std::shared_ptr<Surface>, ActsScalar, std::array, bSize>

Broadcast the surface KDT type.

using Query = std::array<ActsScalar, kDIM>

Broadcast the query definition.

Public Functions

inline KdtSurfaces(const GeometryContext &gctx, const std::vector<std::shared_ptr<Surface>> &surfaces, const std::array<BinningValue, kDIM> &casts, const reference_generator &rgen = detail::PolyhedronReferenceGenerator<1u, false>{})

Constructor from a vector of surfaces.

  • gctx – the geometry context of this call

  • surfaces – the surfaces to be filled into the tree

  • casts – the cast list from global position into kdtree local

  • rgen – the reference point generator

inline std::vector<std::shared_ptr<Surface>> surfaces(const Extent &extent) const

Query with an Extent object.


extent – is the range Extent to be queried


the matching surfaces fpulled from the KDT structure

inline std::vector<std::shared_ptr<Surface>> surfaces(const RangeXD<kDIM, ActsScalar> &range) const

Query with a Range object.


range – is the range to be queried


the matching surfaces from the KDT structure

Private Functions

inline Query cog(const std::vector<Query> &cQueries) const

Helper method to calculate the center of gravity in the casted frame (i.e.

query frame)


will do nothing if vector size is equal to 1


no checking on qQueries.empty() is done as the positions are to be provided by a generator which itself is tested for consistency


cQueries – are the casted query positions


the center of gravity as a query object

template<typename Array, std::size_t... idx>
inline void fillCasts(const Vector3 &position, Array &a, std::index_sequence<idx...>) const

Unroll the cast loop.

  • position – is the position of the update call

  • a – is the array to be filled

Private Members

std::array<BinningValue, kDIM> m_casts = {}

Cast values that turn a global position to lookup position.

std::unique_ptr<KDTS> m_kdt = nullptr

The KDTree as single source for the surfaces (maybe shared)

reference_generator m_rGenerator

Helper to generate reference points for filling.

template<size_t kDIM = 2u, size_t bSize = 100u, typename reference_generator = detail::PolyhedronReferenceGenerator<1u, false>>
class KdtSurfacesProvider : public Acts::Experimental::ISurfacesProvider
#include <Acts/Detector/KdtSurfacesProvider.hpp>

Callable struct wrapper around the KDT surface structure.

This allows to create small region based callable structs at configuration level that are then connected to an InternalStructureBuilder

Public Functions

inline KdtSurfacesProvider(std::shared_ptr<KdtSurfaces<kDIM, bSize, reference_generator>> kdts, const Extent &kregion)

The prefilled surfaces in a KD tree structure, it is generally shared amongst different providers.

  • kdts – the prefilled KDTree structure

  • kregion – the region where these are pulled from

inline std::vector<std::shared_ptr<Surface>> surfaces([[maybe_unused]] const GeometryContext &gctx) const final

The call to provide the surfaces.

Private Members

std::shared_ptr<KdtSurfaces<kDIM, bSize, reference_generator>> m_kdt = nullptr
Extent m_region

The query region.