File SurfaceArrayCreator.hpp

namespace Acts

Note

This file is foreseen for the Geometry module to replace Extent

Typedefs

using AxisScalar = Vector3::Scalar
using SurfaceMatcher = std::function<bool(const GeometryContext &gctx, BinningValue, const Surface*, const Surface*)>
using SurfaceMatrix = std::vector<SurfaceVector>
typedef std::vector<const Surface*> SurfaceVector
using V3Matrix = std::vector<V3Vector>
using V3Vector = std::vector<Vector3>
class SurfaceArrayCreator
#include <Acts/Geometry/SurfaceArrayCreator.hpp>

It is designed create sub surface arrays to be ordered on Surfaces.

Public Functions

inline SurfaceArrayCreator(std::unique_ptr<const Logger> logger = getDefaultLogger("SurfaceArrayCreator", Logging::INFO))

Constructor with default config.

Parameters

logger – logging instance

inline SurfaceArrayCreator(const Config &cfg, std::unique_ptr<const Logger> logger = getDefaultLogger("SurfaceArrayCreator", Logging::INFO))

Constructor with explicit config.

Parameters
  • cfg – Explicit config struct

  • logger – logging instance

virtual ~SurfaceArrayCreator() = default

Destructor.

inline void setLogger(std::unique_ptr<const Logger> logger)

Set logging instance.

Parameters

logger – is the logging instance to be set

std::unique_ptr<SurfaceArray> surfaceArrayOnCylinder(const GeometryContext &gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsPhi, size_t binsZ, std::optional<ProtoLayer> protoLayerOpt = std::nullopt, const Transform3 &transform = Transform3::Identity()) const

SurfaceArrayCreator interface method.

  • create an array in a cylinder, binned in phi, z when extremas and bin numbers are known

Warning

This function requires the cylinder aligned with the z-axis

Parameters
  • surfaces – is the vector of pointers to sensitive surfaces to be ordered on the cylinder

  • gctx[in] The gometry context fro this building call

  • protoLayerOpt – The proto layer containing the layer size

  • binsPhi – is the number of bins in phi for the surfaces

  • binsZ – is the number of bin in Z for the surfaces

  • transform – is the (optional) additional transform applied

Pre

the pointers to the sensitive surfaces in the surfaces vectors all need to be valid, since no check is performed

Returns

a unique pointer to a new SurfaceArray

std::unique_ptr<Acts::SurfaceArray> surfaceArrayOnCylinder(const GeometryContext &gctx, std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypePhi = equidistant, BinningType bTypeZ = equidistant, std::optional<ProtoLayer> protoLayerOpt = std::nullopt, const Transform3 &transform = Transform3::Identity()) const

SurfaceArrayCreator interface method.

  • create an array in a cylinder, binned in phi, z when extremas and bin numbers are unknown - this method goes through the surfaces and finds out the needed information

Warning

This function requires the cylinder aligned with the z-axis

Parameters
  • surfaces – is the vector of pointers to sensitive surfaces to be ordered on the cylinder

  • gctx[in] The gometry context fro this building call

  • protoLayerOpt – The proto layer containing the layer size

  • bTypePhi – the binning type in phi direction (equidistant/aribtrary)

  • bTypeZ – the binning type in z direction (equidistant/aribtrary)

  • transform – is the (optional) additional transform applied

Pre

the pointers to the sensitive surfaces in the surfaces vectors all need to be valid, since no check is performed

Returns

a unique pointer a new SurfaceArray

std::unique_ptr<SurfaceArray> surfaceArrayOnDisc(const GeometryContext &gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsR, size_t binsPhi, std::optional<ProtoLayer> protoLayerOpt = std::nullopt, const Transform3 &transform = Transform3::Identity()) const

SurfaceArrayCreator interface method.

  • create an array on a disc, binned in r, phi when extremas and bin numbers are known

Warning

This function requires the disc aligned with the z-axis

Parameters
  • surfaces – is the vector of pointers to sensitive surfaces to be ordered on the disc

  • gctx[in] The gometry context fro this building call

  • protoLayerOpt – The proto layer containing the layer size

  • binsPhi – is the number of bins in phi for the surfaces

  • binsR – is the number of bin in R for the surfaces

  • transform – is the (optional) additional transform applied

Pre

the pointers to the sensitive surfaces in the surfaces vectors all need to be valid, since no check is performed

Returns

a unique pointer a new SurfaceArray

std::unique_ptr<Acts::SurfaceArray> surfaceArrayOnDisc(const GeometryContext &gctx, std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypeR, BinningType bTypePhi, std::optional<ProtoLayer> protoLayerOpt = std::nullopt, const Transform3 &transform = Transform3::Identity()) const

SurfaceArrayCreator interface method.

  • create an array in a cylinder, binned in phi, r when extremas and bin numbers are unknown - this method goes through the surfaces and finds out the needed information

Note

If there is more than on R-Ring, number of phi bins will be set to lowest number of surfaces of any R-ring. This ignores bTypePhi and produces equidistant binning in phi

Warning

This function requires the disc aligned with the z-axis

Parameters
  • surfaces – is the vector of pointers to sensitive surfaces to be ordered on the disc

  • gctx[in] The gometry context fro this building call

  • protoLayerOpt – The proto layer containing the layer size

  • bTypeR – the binning type in r direction (equidistant/aribtrary)

  • bTypePhi – the binning type in phi direction (equidistant/aribtrary)

  • transform – is the (optional) additional transform applied

Pre

the pointers to the sensitive surfaces in the surfaces vectors all need to be valid, since no check is performed

Returns

a unique pointer a new SurfaceArray

std::unique_ptr<SurfaceArray> surfaceArrayOnPlane(const GeometryContext &gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t bins1, size_t bins2, BinningValue bValue, std::optional<ProtoLayer> protoLayerOpt = std::nullopt, const Transform3 &transform = Transform3::Identity()) const

SurfaceArrayCreator interface method.

  • create an array on a plane

Warning

This function requires the plane aligned with either the x-, y- or z-axis

Parameters
  • gctx[in] The gometry context fro this building call

  • surfaces[in] is the vector of pointers to sensitive surfaces to be ordered on the plane

  • bins1[in] is the number of bins in the orthogonal direction to bValue

  • bins2[in] is the number of bins in the orthogonal direction to bValue

  • bValue[in] Direction of the aligned surfaces

  • protoLayerOpt[in] Optional ProtoLayer instance

  • transform[in] is the (optional) additional transform applied

Pre

the pointers to the sensitive surfaces in the surfaces vectors all need to be valid, since no check is performed

Returns

a unique pointer a new SurfaceArray

Public Static Functions

static inline bool isSurfaceEquivalent(const GeometryContext &gctx, BinningValue bValue, const Surface *a, const Surface *b)

Static check funtion for surface equivalent.

Parameters
  • gctx[in] the geometry context for this check

  • bValue – the binning value for the binning

  • a – first surface for checking

  • b – second surface for checking

Private Functions

inline void completeBinning(const GeometryContext &gctx, SurfaceArray::ISurfaceGridLookup &sl, const std::vector<const Surface*> &surfaces) const

Private helper method to complete the binning.

given a grid point o | 0 | 1 | 2 | 3 | 4 |

0 | x | | | | x | 1 | | | o | | | 2 | x | | | | x |

This is being called when you chose to use more bins thans surfaces I.e. to put a finer granularity binning onto your surface Neighbour bins are then filled to contain pointers as well This method delegates to SurfaceGridLookup itself.

Parameters
  • gctx[in] the geometry context for this call

  • sl – The SurfaceGridLookup

  • surfaces – the surfaces

ProtoAxis createEquidistantAxis(const GeometryContext &gctx, const std::vector<const Surface*> &surfaces, BinningValue bValue, ProtoLayer protoLayer, Transform3 &transform, size_t nBins = 0) const

SurfaceArrayCreator internal method Creates a equidistant ProtoAxis when the extremas and the bin number are It loops through the surfaces and finds out the needed information First the surfaces are sorted in the binning direction and the so called “key” surfaces (surfaces with different positions in the binning direction) are extracted.

The number of key surfaces euqals the number of bins. Afterwards the minimum and maximum are calculated by subtracting/adding half of a bin size to the center position (in the binning direction) to the first/last surface.

Note

currently implemented for phi, r and z bining

Note

This only creates the ProtoAxis, this needs to be turned into an actual Axis object to be used

Parameters
  • gctx[in] the geometry context for this call

  • surfaces – are the sensitive surfaces to be

  • bValue – the BinningValue in which direction should be binned (currently possible: binPhi, binR, binZ)

  • protoLayer – Instance of ProtoLayer holding generic layer info

  • transform – is the (optional) additional transform applied

  • nBins – Number of bins to use, 0 means determine automatically

Returns

Instance of ProtoAxis containing determined properties

ProtoAxis createVariableAxis(const GeometryContext &gctx, const std::vector<const Surface*> &surfaces, BinningValue bValue, ProtoLayer protoLayer, Transform3 &transform) const

SurfaceArrayCreator internal method Creates a variable ProtoAxis from a vector of (unsorted) surfaces with PlanarBounds It loops through the surfaces and finds out the needed information First the surfaces are sorted in the binning direction and the so called “key” surfaces (surfaces with different positions in the binning direction) are extracted.

The boundary value between two surfaces is the mean value of the two center position in the binning direction. The first and the last boundaries are calculated from the vertices of the first and last surface.

Note

currently implemented for phi, r and z bining

Note

This only creates the ProtoAxis, this needs to be turned into an actual Axis object to be used

Parameters
  • gctx[in] the geometry context for this call

  • surfaces – are the sensitive surfaces to be

  • bValue – the BinningValue in which direction should be binned (currently possible: binPhi, binR, binZ)

  • protoLayer – Instance of ProtoLayer holding generic layer info

  • transform – is the (optional) additional transform applied

Returns

Instance of ProtoAxis containing determined properties

size_t determineBinCount(const GeometryContext &gctx, const std::vector<const Surface*> &surfaces, BinningValue bValue) const
std::vector<const Surface*> findKeySurfaces(const std::vector<const Surface*> &surfaces, const std::function<bool(const Surface*, const Surface*)> &equal) const
inline const Logger &logger() const

Private access to logger.

std::vector<Acts::Vector3> makeGlobalVertices(const GeometryContext &gctx, const Acts::Surface &surface, const std::vector<Acts::Vector2> &locVertices) const

Private helper method to transform the vertices of surface bounds into global coordinates.

Parameters
  • gctx[in] the geometry context for this call

  • surface – the surface associated with the given vertices

  • locVertices – a vector of the vertices in local coordinates

Returns

a vector of the vertices in global coordinates

Private Members

Config m_cfg

configuration object

std::unique_ptr<const Logger> m_logger

logging instance

Private Static Functions

template<detail::AxisBoundaryType bdtA, detail::AxisBoundaryType bdtB, typename F1, typename F2>
static inline std::unique_ptr<SurfaceArray::ISurfaceGridLookup> makeSurfaceGridLookup2D(F1 globalToLocal, F2 localToGlobal, ProtoAxis pAxisA, ProtoAxis pAxisB)

SurfaceArrayCreator internal method.

Creates a SurfaceGridLookup instance within an any This is essentially a factory which absorbs some if/else logic that is required by the templating.

Template Parameters
  • bdtA – AxisBoundaryType of axis A

  • bdtB – AxisBoundaryType of axis B

  • F1 – type-deducted value of g2l lambda

  • F2 – type-deducted value of l2g lambda

Parameters
  • globalToLocal – transform callable

  • localToGlobal – transform callable

  • pAxisA – ProtoAxis object for axis A

  • pAxisB – ProtoAxis object for axis B

Friends

friend class Acts::SurfaceArray
friend struct Acts::Test::SurfaceArrayCreatorFixture
struct Config
#include <Acts/Geometry/SurfaceArrayCreator.hpp>

Public Members

bool doPhiBinningOptimization = true

Optimize the binning in phi for disc layers.

Reduces the number of bins to the lowest number of non-equivalent phi surfaces of all r-bins. If false, this step is skipped.

SurfaceMatcher surfaceMatcher = SurfaceArrayCreator::isSurfaceEquivalent

Type-erased function which determines whether two surfaces are supposed to be considered equivalent in terms of the binning.

struct ProtoAxis
#include <Acts/Geometry/SurfaceArrayCreator.hpp>

Public Functions

inline size_t getBin(AxisScalar x) const

Public Members

std::vector<AxisScalar> binEdges
BinningType bType
BinningValue bValue
AxisScalar max
AxisScalar min
size_t nBins
namespace Test