File Surface.hpp

namespace Acts

Note

This file is foreseen for the Geometry module to replace Extent

Functions

inline std::ostream &operator<<(std::ostream &os, const std::tuple<const Surface&, const GeometryContext&> &tup)

Print surface information to the provided stream.

Internally invokes the surface.toStream(...)-method. This can be easily used e.g. like std::cout << std::tie(surface, geometryContext);

class Surface : public virtual Acts::GeometryObject, public std::enable_shared_from_this<Surface>
#include <Acts/Surfaces/Surface.hpp>

Abstract Base Class for tracking surfaces.

The Surface class builds the core of the Acts Tracking Geometry. All other geometrical objects are either extending the surface or are built from it.

Surfaces are either owned by Detector elements or the Tracking Geometry, in which case they are not copied within the data model objects.

Subclassed by Acts::ConeSurface, Acts::CylinderSurface, Acts::DiscSurface, Acts::LineSurface, Acts::PlaneSurface

Public Types

enum SurfaceType

This enumerator simplifies the persistency & calculations, by saving a dynamic_cast, e.g.

for persistency

Values:

enumerator Cone
enumerator Cylinder
enumerator Disc
enumerator Perigee
enumerator Plane
enumerator Straw
enumerator Curvilinear
enumerator Other

Public Functions

virtual ~Surface()
AlignmentToBoundMatrix alignmentToBoundDerivative(const GeometryContext &gctx, const FreeVector &parameters, const FreeVector &pathDerivative) const

The derivative of bound track parameters w.r.t.

alignment parameters of its reference surface (i.e. local frame origin in global 3D Cartesian coordinates and its rotation represented with extrinsic Euler angles)

Parameters
  • gctx – The current geometry context object, e.g. alignment change of alignment parameters

  • parameters – is the free parameters

  • pathDerivative – is the derivative of free parameters w.r.t. path length

Returns

Derivative of bound track parameters w.r.t. local frame alignment parameters

virtual AlignmentToPathMatrix alignmentToPathDerivative(const GeometryContext &gctx, const FreeVector &parameters) const

Calculate the derivative of path length at the geometry constraint or point-of-closest-approach w.r.t.

alignment parameters of the surface (i.e. local frame origin in global 3D Cartesian coordinates and its rotation represented with extrinsic Euler angles)

Note

Re-implementation is needed for surface whose intersection with track is not its local xy plane, e.g. LineSurface, CylinderSurface and ConeSurface

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • parameters – is the free parameters

Returns

Derivative of path length w.r.t. the alignment parameters

void assignSurfaceMaterial(std::shared_ptr<const ISurfaceMaterial> material)

Assign the surface material description.

The material is usually derived in a complicated way and loaded from a framework given source. As various surfaces may share the same source this is provided by a shared pointer

Parameters

material – Material description associated to this surface

const DetectorElementBase *associatedDetectorElement() const

Return method for the associated Detector Element.

Returns

plain pointer to the DetectorElement, can be nullptr

const Layer *associatedLayer() const

Return method for the associated Layer in which the surface is embedded.

Returns

Layer by plain pointer, can be nullptr

void associateLayer(const Layer &lay)

Set Associated Layer Many surfaces can be associated to a Layer, but it might not be known yet during construction of the layer, this can be set afterwards.

Parameters

lay – the assignment Layer by reference

virtual const SurfaceBounds &bounds() const = 0

Return method for SurfaceBounds.

Returns

SurfaceBounds by reference

virtual BoundToFreeMatrix boundToFreeJacobian(const GeometryContext &gctx, const BoundVector &boundParams) const

Calculate the jacobian from local to global which the surface knows best, hence the calculation is done here.

Note

In principle, the input could also be a free parameters vector as it could be transformed to a bound parameters. But the transform might fail in case the parameters is not on surface. To avoid the check inside this function, it takes directly the bound parameters as input (then the check might be done where this function is called).

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • boundParams – is the bound parameters vector

Returns

Jacobian from local to global

virtual Vector3 center(const GeometryContext &gctx) const

Return method for the surface center by reference.

Note

the center is always recalculated in order to not keep a cache

Parameters

gctx – The current geometry context object, e.g. alignment

Returns

center position by value

virtual FreeToBoundMatrix freeToBoundJacobian(const GeometryContext &gctx, const FreeVector &parameters) const

Calculate the jacobian from global to local which the surface knows best, hence the calculation is done here.

Note

It assumes the input free parameters is on surface, hence no onSurface check is done inside this function.

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • parameters – is the free parameters

Returns

Jacobian from global to local

virtual FreeToPathMatrix freeToPathDerivative(const GeometryContext &gctx, const FreeVector &parameters) const

Calculate the derivative of path length at the geometry constraint or point-of-closest-approach w.r.t.

free parameters. The calculation is identical for all surfaces where the reference frame does not depend on the direction

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • parameters – is the free parameters

Returns

Derivative of path length w.r.t. free parameters

std::shared_ptr<Surface> getSharedPtr()

Retrieve a std::shared_ptr for this surface (non-const version)

Note

Will error if this was not created through the makeShared factory since it needs access to the original reference. In C++14 this is undefined behavior (but most likely implemented as a bad_weak_ptr exception), in C++17 it is defined as that exception.

Note

Only call this if you need shared ownership of this object.

Returns

The shared pointer

std::shared_ptr<const Surface> getSharedPtr() const

Retrieve a std::shared_ptr for this surface (const version)

Note

Will error if this was not created through the makeShared factory since it needs access to the original reference. In C++14 this is undefined behavior, but most likely implemented as a bad_weak_ptr exception, in C++17 it is defined as that exception.

Note

Only call this if you need shared ownership of this object.

Returns

The shared pointer

virtual Result<Vector2> globalToLocal(const GeometryContext &gctx, const Vector3 &position, const Vector3 &momentum, double tolerance = s_onSurfaceTolerance) const = 0

Global to local transformation Generalized global to local transformation for the surface types.

Since some surface types need the global momentum/direction to resolve sign ambiguity this is also provided

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • position – global 3D position - considered to be on surface but not inside bounds (check is done)

  • momentum – global 3D momentum representation (optionally ignored)

  • tolerance – optional tolerance within which a point is considered valid on surface

Returns

a Result<Vector2> which can be !ok() if the operation fails

virtual bool insideBounds(const Vector2 &lposition, const BoundaryCheck &bcheck = true) const

The insideBounds method for local positions.

Parameters
  • lposition – The local position to check

  • bcheck – BoundaryCheck directive for this onSurface check

Returns

boolean indication if operation was successful

virtual SurfaceIntersection intersect(const GeometryContext &gctx, const Vector3 &position, const Vector3 &direction, const BoundaryCheck &bcheck) const = 0

Straight line intersection schema from position/direction.

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • position – The position to start from

  • direction – The direction at start

  • bcheck – the Boundary Check

Returns

SurfaceIntersection object (contains intersection & surface)

bool isOnSurface(const GeometryContext &gctx, const Vector3 &position, const Vector3 &momentum, const BoundaryCheck &bcheck = true) const

The geometric onSurface method.

Geometrical check whether position is on Surface

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • position – global position to be evaludated

  • momentum – global momentum (required for line-type surfaces)

  • bcheck – BoundaryCheck directive for this onSurface check

Returns

boolean indication if operation was successful

virtual ActsMatrix<2, 3> localCartesianToBoundLocalDerivative(const GeometryContext &gctx, const Vector3 &position) const = 0

Calculate the derivative of bound track parameters local position w.r.t.

position in local 3D Cartesian coordinates

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • position – The position of the paramters in global

Returns

Derivative of bound local position w.r.t. position in local 3D cartesian coordinates

virtual Vector3 localToGlobal(const GeometryContext &gctx, const Vector2 &lposition, const Vector3 &momentum) const = 0

Local to global transformation Generalized local to global transformation for the surface types.

Since some surface types need the global momentum/direction to resolve sign ambiguity this is also provided

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • lposition – local 2D position in specialized surface frame

  • momentum – global 3D momentum representation (optionally ignored)

Returns

The global position by value

virtual std::string name() const = 0

Return properly formatted class name.

virtual Vector3 normal(const GeometryContext &gctx, const Vector2 &lposition) const = 0

Return method for the normal vector of the surface The normal vector can only be generally defined at a given local position It requires a local position to be given (in general)

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • lposition – is the local position where the normal vector is constructed

Returns

normal vector by value

virtual Vector3 normal(const GeometryContext &gctx, const Vector3 &position) const

Return method for the normal vector of the surface The normal vector can only be generally defined at a given local position It requires a local position to be given (in general)

Parameters
  • position – is the global position where the normal vector is constructed

  • gctx – The current geometry context object, e.g. alignment

Returns

normal vector by value

inline virtual Vector3 normal(const GeometryContext &gctx) const

Return method for the normal vector of the surface.

It will return a normal vector at the center() position

Parameters

gctx – The current geometry context object, e.g. alignment

Returns

normal vector by value

virtual bool operator!=(const Surface &sf) const

Comparison (non-equality) operator.

Parameters

sf – Source surface for the comparison

Surface &operator=(const Surface &other)

Assignment operator.

Note

copy construction invalidates the association to detector element and layer

Parameters

other – Source surface for the assignment

virtual bool operator==(const Surface &other) const

Comparison (equality) operator The strategy for comparison is (a) first pointer comparison (b) then type comparison (c) then bounds comparison (d) then transform comparison.

Parameters

other – source surface for the comparison

virtual double pathCorrection(const GeometryContext &gctx, const Vector3 &position, const Vector3 &direction) const = 0

Calucation of the path correction for incident.

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • position – global 3D position - considered to be on surface but not inside bounds (check is done)

  • direction – global 3D momentum direction

Returns

Path correction with respect to the nominal incident.

virtual Polyhedron polyhedronRepresentation(const GeometryContext &gctx, size_t lseg) const = 0

Return a Polyhedron for this object.

Note

An internal surface transform can invalidate the extrema in the transformed space

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • lseg – Number of segments along curved lines, if the lseg is set to one, only the corners and the extrema are given, otherwise it represents the number of segments for a full 2*M_PI circle and is scaled to the relevant sector

Returns

A list of vertices and a face/facett description of it

virtual Acts::RotationMatrix3 referenceFrame(const GeometryContext &gctx, const Vector3 &position, const Vector3 &momentum) const

Return mehtod for the reference frame This is the frame in which the covariance matrix is defined (specialized by all surfaces)

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • position – global 3D position - considered to be on surface but not inside bounds (check is done)

  • momentum – global 3D momentum representation (optionally ignored)

Returns

RotationMatrix3 which defines the three axes of the measurement frame

const ISurfaceMaterial *surfaceMaterial() const

Return method for the associated Material to this surface.

Returns

SurfaceMaterial as plain pointer, can be nullptr

const std::shared_ptr<const ISurfaceMaterial> &surfaceMaterialSharedPtr() const

Return method for the shared pointer to the associated Material.

Returns

SurfaceMaterial as shared_pointer, can be nullptr

virtual std::ostream &toStream(const GeometryContext &gctx, std::ostream &sl) const

Output Method for std::ostream, to be overloaded by child classes.

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • sl – is the ostream to be dumped into

virtual const Transform3 &transform(const GeometryContext &gctx) const

Return method for the surface Transform3 by reference In case a detector element is associated the surface transform is just forwarded to the detector element in order to keep the (mis-)alignment cache cetrally handled.

Parameters

gctx – The current geometry context object, e.g. alignment

Returns

the contextual transform

virtual SurfaceType type() const = 0

Return method for the Surface type to avoid dynamic casts.

Public Static Functions

template<class T, typename ...Args>
static inline std::shared_ptr<T> makeShared(Args&&... args)

Factory for producing memory managed instances of Surface.

Will forward all parameters and will attempt to find a suitable constructor.

Protected Functions

Surface(const Transform3 &transform = Transform3::Identity())

Constructor with Transform3 as a shared object.

Note

also acts as default constructor

Parameters

transform – Transform3 positions the surface in 3D global space

Surface(const Surface &other)

Copy constructor.

Note

copy construction invalidates the association to detector element and layer

Parameters

other – Source surface for copy.

Surface(const DetectorElementBase &detelement)

Constructor fromt DetectorElementBase: Element proxy.

Parameters

detelement – Detector element which is represented by this surface

Surface(const GeometryContext &gctx, const Surface &other, const Transform3 &shift)

Copy constructor with optional shift.

Note

copy construction invalidates the association to detector element and layer

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • other – Source surface for copy

  • shift – Additional transform applied as: shift * transform

Protected Attributes

const DetectorElementBase *m_associatedDetElement = {nullptr}

Pointer to the a DetectorElementBase.

const Layer *m_associatedLayer = {nullptr}

The associated layer Layer - layer in which the Surface is be embedded, nullptr if not associated.

const TrackingVolume *m_associatedTrackingVolume = {nullptr}

The assoicated TrackingVolume - tracking volume in case the surface is a boundary surface, nullptr if not associated.

std::shared_ptr<const ISurfaceMaterial> m_surfaceMaterial

Possibility to attach a material descrption.

Transform3 m_transform = Transform3::Identity()

Transform3 definition that positions (translation, rotation) the surface in global space.

Private Functions

AlignmentToBoundMatrix alignmentToBoundDerivativeWithoutCorrection(const GeometryContext &gctx, const FreeVector &parameters) const

Calculate the derivative of bound track parameters w.r.t.

alignment parameters of its reference surface (i.e. origin in global 3D Cartesian coordinates and its rotation represented with extrinsic Euler angles) without any path correction

Note

This function should be used together with alignment to path derivative to get the full alignment to bound derivatives

Parameters
  • gctx – The current geometry context object, e.g. alignment

  • parameters – is the free parameters

Returns

Derivative of bound track parameters w.r.t. local frame alignment parameters without path correction