ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
Acts::GridSurfaceMaterial Class Referencefinal

Concrete, non-template surface material backed by a 2D grid. More...

#include <Acts/Material/GridSurfaceMaterial.hpp>

Inheritance diagram for Acts::GridSurfaceMaterial:
[legend]
Collaboration diagram for Acts::GridSurfaceMaterial:
[legend]

Classes

struct  GloballyIndexed
 Per-bin indices into a (possibly shared) globally owned material vector. More...
struct  Indexed
 Per-bin indices into a locally owned material vector. More...

Public Types

using Direct = std::vector<MaterialSlab>
 Material slabs stored directly, one per bin (including under-/overflow).
using Storage = std::variant<Direct, Indexed, GloballyIndexed>
 The material storage backend: one of Direct, Indexed or GloballyIndexed.

Public Member Functions

 GridSurfaceMaterial (MultiAxisSpec2D binning, Storage storage, double splitFactor=1., MappingType mappingType=MappingType::Default)
 Construct from a 2D binning spec and a storage backend.
const MultiAxisSpec2Dbinning () const
 Return the 2D multi-axis binning spec.
std::vector< AxisDirectionlocalAxisDirections () const override
 Returns the axis directions for the local coordinate system.
const MaterialSlabmaterialSlab (const Vector2 &lp) const final
 Return method for full material description of the Surface.
virtual MaterialSlab materialSlab (const Vector2 &lp, Direction pDir, MaterialUpdateMode mode) const
 Return method for fully scaled material description of the Surface.
const IMultiAxis2DmultiAxis () const
 Return the multi-axis used for local position lookup.
ISurfaceMaterialscale (double factor) override
 Scale material.
const Storagestorage () const
 Return the material storage backend.
std::ostream & toStream (std::ostream &sl) const override
 Output Method for std::ostream, to be overloaded by child classes.
Public Member Functions inherited from Acts::ISurfaceMaterial
 ISurfaceMaterial ()=default
 Constructor.
 ISurfaceMaterial (double splitFactor)
 Constructor.
 ISurfaceMaterial (double splitFactor, MappingType mappingType)
 Constructor.
virtual ~ISurfaceMaterial ()=default
 Destructor.
double factor (Direction pDir, MaterialUpdateMode mode) const
 Update pre factor.
MappingType mappingType () const
 Return the type of surface material mapping.
std::string toString () const
 output into a string

Static Public Member Functions

static std::unique_ptr< GridSurfaceMaterialcreateDirect (const IAxis &axis0, const IAxis &axis1, const std::vector< std::vector< MaterialSlab > > &payload)
 Create a GridSurfaceMaterial with direct storage from two axes.
static std::unique_ptr< GridSurfaceMaterialcreateDirect (const MultiAxisSpec2D &binning, const Surface &surface, const std::vector< std::vector< MaterialSlab > > &payload)
 Create a GridSurfaceMaterial with direct storage by resolving a multi-axis spec against a surface.
static std::unique_ptr< GridSurfaceMaterialcreateGloballyIndexed (const IAxis &axis0, const IAxis &axis1, std::shared_ptr< std::vector< MaterialSlab > > material, const std::vector< std::vector< std::size_t > > &payload)
 Create a GridSurfaceMaterial with globally indexed storage from two axes.
static std::unique_ptr< GridSurfaceMaterialcreateGloballyIndexed (const MultiAxisSpec2D &binning, const Surface &surface, std::shared_ptr< std::vector< MaterialSlab > > material, const std::vector< std::vector< std::size_t > > &payload)
 Create a GridSurfaceMaterial with globally indexed storage from a multi-axis spec resolved against a surface.
static std::unique_ptr< GridSurfaceMaterialcreateIndexed (const IAxis &axis0, const IAxis &axis1, std::vector< MaterialSlab > material, const std::vector< std::vector< std::size_t > > &payload)
 Create a GridSurfaceMaterial with locally indexed storage from two axes.
static std::unique_ptr< GridSurfaceMaterialcreateIndexed (const MultiAxisSpec2D &binning, const Surface &surface, std::vector< MaterialSlab > material, const std::vector< std::vector< std::size_t > > &payload)
 Create a GridSurfaceMaterial with locally indexed storage from a multi-axis spec resolved against a surface.

Additional Inherited Members

Protected Attributes inherited from Acts::ISurfaceMaterial
MappingType m_mappingType {MappingType::Default}
 Use the default mapping type by default.
double m_splitFactor {1.}
 the split factor in favour of oppositePre

Detailed Description

Concrete, non-template surface material backed by a 2D grid.

The grid geometry is described by a (fully specified) MultiAxisSpec2D, resolved internally into an IMultiAxis2D that maps a local surface position to a flattened bin index, see IMultiAxis. That index then addresses one of three storage backends:

  • Direct : a material slab stored directly per bin
  • Indexed : a per-bin index into a locally owned material vector
  • GloballyIndexed : a per-bin index into a (possibly shared) globally owned material vector

All three backends share the same binning/indexing logic, so the local lookup, scaling and I/O only need to branch on the storage backend, not on the concrete grid or axis types.

The grid is always 2D: local (bound) lookup is assumed to already be expressed in the grid's own 2D coordinate system, i.e. lp[0] maps directly onto axis 0 and lp[1] onto axis 1. Only local lookup is supported - there is no global (Vector3) lookup, since that would require a global-to-local coordinate transform.

Constructor & Destructor Documentation

◆ GridSurfaceMaterial()

Acts::GridSurfaceMaterial::GridSurfaceMaterial ( MultiAxisSpec2D binning,
Storage storage,
double splitFactor = 1.,
MappingType mappingType = MappingType::Default )
explicit

Construct from a 2D binning spec and a storage backend.

Parameters
binningthe fully specified 2D multi-axis binning spec
storagethe material storage backend
splitFactorpre/post splitting directive
mappingTypetype of surface mapping associated to the surface
Exceptions
std::domain_errorif binning is not fully specified
std::invalid_argumentif the storage size does not match the number of bins implied by binning (including under-/overflow)

Member Function Documentation

◆ binning()

const MultiAxisSpec2D & Acts::GridSurfaceMaterial::binning ( ) const

Return the 2D multi-axis binning spec.

Returns
const reference to the binning spec

◆ createDirect() [1/2]

std::unique_ptr< GridSurfaceMaterial > Acts::GridSurfaceMaterial::createDirect ( const IAxis & axis0,
const IAxis & axis1,
const std::vector< std::vector< MaterialSlab > > & payload )
static

Create a GridSurfaceMaterial with direct storage from two axes.

Parameters
axis0the axis in direction 0
axis1the axis in direction 1
payloadthe material payload, one slab per regular bin, column major, i.e. [i0][i1]
Returns
a unique pointer to the created surface material

◆ createDirect() [2/2]

std::unique_ptr< GridSurfaceMaterial > Acts::GridSurfaceMaterial::createDirect ( const MultiAxisSpec2D & binning,
const Surface & surface,
const std::vector< std::vector< MaterialSlab > > & payload )
static

Create a GridSurfaceMaterial with direct storage by resolving a multi-axis spec against a surface.

This follows the same pattern as ProtoGridSurfaceMaterial: the (possibly deferred) axis specs are resolved against surface via resolveMultiAxis, exactly as is done for a ProtoGridSurfaceMaterial in BinnedSurfaceMaterialAccumulator. Binning restricted to a single local direction is expressed by a single-bin spec in the other direction.

Parameters
binningthe 2D multi-axis binning spec (deferred axes are resolved against surface)
surfacethe surface to resolve the deferred axes against
payloadthe material payload, one slab per regular bin, column major, i.e. [i0][i1]
Returns
a unique pointer to the created surface material

◆ createGloballyIndexed() [1/2]

std::unique_ptr< GridSurfaceMaterial > Acts::GridSurfaceMaterial::createGloballyIndexed ( const IAxis & axis0,
const IAxis & axis1,
std::shared_ptr< std::vector< MaterialSlab > > material,
const std::vector< std::vector< std::size_t > > & payload )
static

Create a GridSurfaceMaterial with globally indexed storage from two axes.

Parameters
axis0the axis in direction 0
axis1the axis in direction 1
materialthe (possibly shared) globally owned material vector, addressed by payload
payloadthe index payload, one index per regular bin, column major, i.e. [i0][i1]
Returns
a unique pointer to the created surface material

◆ createGloballyIndexed() [2/2]

std::unique_ptr< GridSurfaceMaterial > Acts::GridSurfaceMaterial::createGloballyIndexed ( const MultiAxisSpec2D & binning,
const Surface & surface,
std::shared_ptr< std::vector< MaterialSlab > > material,
const std::vector< std::vector< std::size_t > > & payload )
static

Create a GridSurfaceMaterial with globally indexed storage from a multi-axis spec resolved against a surface.

Parameters
binningthe binning specification for the grid
surfacethe surface to which the material is applied
materialthe (possibly shared) globally owned material vector, addressed by payload
payloadthe index payload, one index per regular bin, column major, i.e. [i0][i1]
Returns
a unique pointer to the created surface material

◆ createIndexed() [1/2]

std::unique_ptr< GridSurfaceMaterial > Acts::GridSurfaceMaterial::createIndexed ( const IAxis & axis0,
const IAxis & axis1,
std::vector< MaterialSlab > material,
const std::vector< std::vector< std::size_t > > & payload )
static

Create a GridSurfaceMaterial with locally indexed storage from two axes.

Parameters
axis0the axis in direction 0
axis1the axis in direction 1
materialthe locally owned material vector, addressed by payload
payloadthe index payload, one index per regular bin, column major, i.e. [i0][i1]
Returns
a unique pointer to the created surface material

◆ createIndexed() [2/2]

std::unique_ptr< GridSurfaceMaterial > Acts::GridSurfaceMaterial::createIndexed ( const MultiAxisSpec2D & binning,
const Surface & surface,
std::vector< MaterialSlab > material,
const std::vector< std::vector< std::size_t > > & payload )
static

Create a GridSurfaceMaterial with locally indexed storage from a multi-axis spec resolved against a surface.

Parameters
binningthe 2D multi-axis binning spec (deferred axes are resolved against surface)
surfacethe surface to resolve the deferred axes against
materialthe locally owned material vector, addressed by payload
payloadthe index payload, one index per regular bin, column major, i.e. [i0][i1]
Returns
a unique pointer to the created surface material

◆ localAxisDirections()

std::vector< AxisDirection > Acts::GridSurfaceMaterial::localAxisDirections ( ) const
overridevirtual

Returns the axis directions for the local coordinate system.

Returns
Vector of axis directions defining the local coordinate system

Returns the directions of both axes of binning() if both carry a direction (as is always the case when built by resolving against a Surface, see the createDirect / createIndexed / createGloballyIndexed factory methods), or an empty vector if either does not - this lets Surface::assignSurfaceMaterial detect whether the grid's axis order needs swapping to match the surface's canonical local axes.

Implements Acts::ISurfaceMaterial.

◆ materialSlab() [1/2]

const MaterialSlab & Acts::GridSurfaceMaterial::materialSlab ( const Vector2 & lp) const
finalvirtual

Return method for full material description of the Surface.

  • from local coordinate of the material grid
Parameters
lpis the local position used for the (eventual) lookup
Returns
const MaterialSlab

Implements Acts::ISurfaceMaterial.

◆ materialSlab() [2/2]

virtual MaterialSlab Acts::ISurfaceMaterial::materialSlab ( const Vector2 & lp,
Direction pDir,
MaterialUpdateMode mode ) const
virtual

Return method for fully scaled material description of the Surface.

  • from local coordinate of the material grid
Parameters
lpis the local position used for the (eventual) lookup
pDiris the positive direction through the surface
modeis the material update directive
Returns
MaterialSlab

Reimplemented from Acts::ISurfaceMaterial.

◆ multiAxis()

const IMultiAxis2D & Acts::GridSurfaceMaterial::multiAxis ( ) const

Return the multi-axis used for local position lookup.

Returns
const reference to the resolved multi-axis

◆ scale()

ISurfaceMaterial & Acts::GridSurfaceMaterial::scale ( double factor)
overridevirtual

Scale material.

Parameters
factoris the scale factor applied
Returns
Reference to this material object for chaining
Note
For GloballyIndexed storage this scales the entries addressed by this grid's indices in place, in the (possibly shared) global material vector - entries shared with other grids are scaled too.

Implements Acts::ISurfaceMaterial.

◆ storage()

const Storage & Acts::GridSurfaceMaterial::storage ( ) const

Return the material storage backend.

Returns
const reference to the storage variant

◆ toStream()

std::ostream & Acts::GridSurfaceMaterial::toStream ( std::ostream & sl) const
overridevirtual

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

Parameters
slOutput stream to write to
Returns
Reference to the output stream for chaining

Implements Acts::ISurfaceMaterial.