ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
detray::grid_builder< detector_t, grid_t, bin_filler_t, grid_factory_t > Class Template Reference

Build a grid of a certain shape. More...

#include <detray/builders/grid_builder.hpp>

Inheritance diagram for detray::grid_builder< detector_t, grid_t, bin_filler_t, grid_factory_t >:
[legend]
Collaboration diagram for detray::grid_builder< detector_t, grid_t, bin_filler_t, grid_factory_t >:
[legend]

Public Types

using algebra_type = typename detector_t::algebra_type
 Algebra backend used by the grid and detector.
using detector_type = detector_t
 Detector type whose volume and accelerator data this builder updates.
using scalar_type = dscalar<algebra_type>
 Scalar type used for grid axes and coordinates.
using value_type = typename detector_type::surface_type
 Surface type stored as a grid value.
Public Types inherited from detray::volume_decorator< detector_t >
using scalar_t = dscalar<typename detector_t::algebra_type>
 Scalar type used by the detector's algebra.
Public Types inherited from detray::volume_builder_interface< detector_t >
using algebra_type = typename detector_t::algebra_type
 Algebra type used by the detector.
using scalar_type = dscalar<algebra_type>
 Scalar type used by the detector's algebra.

Public Member Functions

 grid_builder (std::unique_ptr< volume_builder_interface< detector_t > > vol_builder)
 Decorate a volume with a surface accelerator grid.
auto build (detector_t &det, const volume_builder_options &opt, typename detector_t::geometry_context ctx={}) -> typename detector_t::volume_type *override
 Add the volume and the grid to the detector det.
template<typename volume_type, typename... Args>
void fill_grid (const detector_t &det, const volume_type &vol, const typename detector_t::geometry_context ctx={}, const bin_filler_t bin_filler={}, Args &&...args)
 Fill grid from existing volume using a bin filling strategy This can also be called without a volume builder.
template<typename volume_type, typename surface_container_t, typename transform_container_t, typename mask_container_t, typename... Args>
void fill_grid (const volume_type &vol, const surface_container_t &surfaces, const transform_container_t &transforms, const mask_container_t &masks, const typename detector_t::geometry_context ctx={}, const bin_filler_t bin_filler={}, Args &&...args)
 Fill grid from externally provided surfaces - temporary solution until the volume builders can be deployed in the toy detector.
auto & get ()
template<typename grid_shape_t>
void init_grid (const mask< grid_shape_t, algebra_type > &m, const darray< std::size_t, grid_t::dim > &n_bins, const std::vector< std::pair< typename grid_t::loc_bin_index, dindex > > &bin_capacities={}, const darray< std::vector< scalar_type >, grid_t::dim > &ax_bin_edges=darray< std::vector< scalar_type >, grid_t::dim >())
 Initialize a grid from a shape mask and explicit binning parameters.
void init_grid (const std::vector< scalar_type > &spans, const std::vector< std::size_t > &n_bins, const std::vector< std::pair< typename grid_t::loc_bin_index, dindex > > &bin_capacities={}, const std::vector< std::vector< scalar_type > > &ax_bin_edges=std::vector< std::vector< scalar_type > >())
 Build the empty grid from axis parameters.
void set_add_passives (bool is_add_passive=false)
 Should the passive surfaces be added to the grid ?
void set_type (link_id_t sf_id)
 Set the surface category this grid should contain (type id in the accelerator link in the volume descriptor).
void set_type (std::size_t sf_id)
 Set the surface category this grid should contain (type id in the accelerator link in the volume descriptor).
Public Member Functions inherited from detray::volume_decorator< detector_t >
 volume_decorator (std::unique_ptr< volume_builder_interface< detector_t > > vol_builder)
 Wraps a volume builder.
void add_surfaces (std::shared_ptr< surface_factory_interface< detector_t > > sf_factory, typename detector_t::geometry_context ctx={}) override
 Adds surfaces through the wrapped builder's factory interface.
void add_volume_placement (const typename detector_t::point3_type &t) override
 Adds a placement using a translation and identity rotation.
void add_volume_placement (const typename detector_t::point3_type &t, const typename detector_t::vector3_type &x, const typename detector_t::vector3_type &z) override
 Adds a placement using a translation and its x- and z-axes.
void add_volume_placement (const typename detector_t::transform3_type &trf={}) override
 Adds a placement transform to the wrapped builder.
auto build (detector_t &det, const volume_builder_options &opt, typename detector_t::geometry_context={}) -> typename detector_t::volume_type *override
 Builds the wrapped volume in the detector.
bool has_accel () const override
 Returns whether sensitive surfaces are added to brute force lookup.
void has_accel (bool toggle) override
 Forwards the brute-force acceleration setting to the wrapped builder.
std::string_view name () override
 Returns the wrapped volume's name.
auto operator() () -> typename detector_t::volume_type &override
 Returns the mutable volume being built.
auto operator() () const -> const typename detector_t::volume_type &override
 Returns const access to the wrapped volume.
void set_name (std::string volume_name) override
 Sets the wrapped volume's name.
auto vol_index () const -> dindex override
 Returns the index assigned by the wrapped builder.
Public Member Functions inherited from detray::volume_builder_interface< detector_t >
virtual void add_volume_placement (const dpoint3D< algebra_type > &t)=0
 Add the transform for the volume placement from the translation t.
virtual void add_volume_placement (const dpoint3D< algebra_type > &t, const dvector3D< algebra_type > &x, const dvector3D< algebra_type > &z)=0
 Add the transform for the volume placement from the translation t , the new x- and z-axis (x, z).
virtual void add_volume_placement (const dtransform3D< algebra_type > &trf={})=0
 Add the transform for the volume placement - copy.

Additional Inherited Members

Protected Member Functions inherited from detray::volume_decorator< detector_t >
volume_builder_interface< detector_t > * get_builder ()
 Access to underlying builderReturns a pointer to the wrapped builder.
detector_t::surface_lookup_container & surfaces () override
 Returns mutable access to the wrapped builder's surface lookup container.
detector_t::transform_container & transforms () override
 Returns mutable access to the wrapped builder's transforms.
detector_t::mask_container & masks () override
 Returns mutable access to the wrapped builder's masks.
Protected Member Functions inherited from detray::volume_builder_interface< detector_t >

Detailed Description

template<concepts::detector detector_t, concepts::grid grid_t, typename bin_filler_t = fill_by_pos, typename grid_factory_t = grid_factory_type<grid_t>>
class detray::grid_builder< detector_t, grid_t, bin_filler_t, grid_factory_t >

Build a grid of a certain shape.

Decorator class to a volume builder that adds a grid as the volumes geometry accelerator structure.

Constructor & Destructor Documentation

◆ grid_builder()

template<concepts::detector detector_t, concepts::grid grid_t, typename bin_filler_t = fill_by_pos, typename grid_factory_t = grid_factory_type<grid_t>>
detray::grid_builder< detector_t, grid_t, bin_filler_t, grid_factory_t >::grid_builder ( std::unique_ptr< volume_builder_interface< detector_t > > vol_builder)
explicit

Decorate a volume with a surface accelerator grid.

Parameters
vol_builderVolume builder that receives the grid accelerator.

Member Function Documentation

◆ build()

template<concepts::detector detector_t, concepts::grid grid_t, typename bin_filler_t = fill_by_pos, typename grid_factory_t = grid_factory_type<grid_t>>
auto detray::grid_builder< detector_t, grid_t, bin_filler_t, grid_factory_t >::build ( detector_t & det,
const volume_builder_options & opt,
typename detector_t::geometry_context ctx = {} )->typenamedetector_t::volume_type *
overridevirtual

Add the volume and the grid to the detector det.

Parameters
detDetector receiving the grid.
optOptions controlling volume construction.
ctxGeometry context used for transform lookup.
Returns
Pointer to the built volume.

Implements detray::volume_builder_interface< detector_t >.

◆ fill_grid() [1/2]

template<concepts::detector detector_t, concepts::grid grid_t, typename bin_filler_t = fill_by_pos, typename grid_factory_t = grid_factory_type<grid_t>>
template<typename volume_type, typename... Args>
void detray::grid_builder< detector_t, grid_t, bin_filler_t, grid_factory_t >::fill_grid ( const detector_t & det,
const volume_type & vol,
const typename detector_t::geometry_context ctx = {},
const bin_filler_t bin_filler = {},
Args &&... args )

Fill grid from existing volume using a bin filling strategy This can also be called without a volume builder.

Parameters
detDetector providing surface and transform data.
volVolume whose surfaces populate the grid.
ctxGeometry context used for transform lookup.
bin_fillerStrategy used to populate bins.
argsAdditional arguments forwarded to the bin filler.

◆ fill_grid() [2/2]

template<concepts::detector detector_t, concepts::grid grid_t, typename bin_filler_t = fill_by_pos, typename grid_factory_t = grid_factory_type<grid_t>>
template<typename volume_type, typename surface_container_t, typename transform_container_t, typename mask_container_t, typename... Args>
void detray::grid_builder< detector_t, grid_t, bin_filler_t, grid_factory_t >::fill_grid ( const volume_type & vol,
const surface_container_t & surfaces,
const transform_container_t & transforms,
const mask_container_t & masks,
const typename detector_t::geometry_context ctx = {},
const bin_filler_t bin_filler = {},
Args &&... args )

Fill grid from externally provided surfaces - temporary solution until the volume builders can be deployed in the toy detector.

Parameters
volVolume whose surfaces populate the grid.
surfacesSurfaces to consider for the grid.
transformsTransform store for the supplied surfaces.
masksMask store for the supplied surfaces.
ctxGeometry context used for transform lookup.
bin_fillerStrategy used to populate bins.
argsAdditional arguments forwarded to the bin filler.

◆ get()

template<concepts::detector detector_t, concepts::grid grid_t, typename bin_filler_t = fill_by_pos, typename grid_factory_t = grid_factory_type<grid_t>>
auto & detray::grid_builder< detector_t, grid_t, bin_filler_t, grid_factory_t >::get ( )
Returns
access to the new grid

◆ init_grid() [1/2]

template<concepts::detector detector_t, concepts::grid grid_t, typename bin_filler_t = fill_by_pos, typename grid_factory_t = grid_factory_type<grid_t>>
template<typename grid_shape_t>
void detray::grid_builder< detector_t, grid_t, bin_filler_t, grid_factory_t >::init_grid ( const mask< grid_shape_t, algebra_type > & m,
const darray< std::size_t, grid_t::dim > & n_bins,
const std::vector< std::pair< typename grid_t::loc_bin_index, dindex > > & bin_capacities = {},
const darray< std::vector< scalar_type >, grid_t::dim > & ax_bin_edges = darray<std::vector<scalar_type>, grid_t::dim>() )

Initialize a grid from a shape mask and explicit binning parameters.

Parameters
mMask defining the grid's geometric bounds.
n_binsNumber of bins on each axis.
bin_capacitiesOptional capacities for local bins.
ax_bin_edgesOptional explicit edges for each axis.

◆ init_grid() [2/2]

template<concepts::detector detector_t, concepts::grid grid_t, typename bin_filler_t = fill_by_pos, typename grid_factory_t = grid_factory_type<grid_t>>
void detray::grid_builder< detector_t, grid_t, bin_filler_t, grid_factory_t >::init_grid ( const std::vector< scalar_type > & spans,
const std::vector< std::size_t > & n_bins,
const std::vector< std::pair< typename grid_t::loc_bin_index, dindex > > & bin_capacities = {},
const std::vector< std::vector< scalar_type > > & ax_bin_edges = std::vector<std::vector<scalar_type>>() )

Build the empty grid from axis parameters.

Parameters
spansCoordinate span for each grid axis.
n_binsNumber of bins on each axis.
bin_capacitiesOptional capacities for local bins.
ax_bin_edgesOptional explicit edges for each axis.

◆ set_add_passives()

template<concepts::detector detector_t, concepts::grid grid_t, typename bin_filler_t = fill_by_pos, typename grid_factory_t = grid_factory_type<grid_t>>
void detray::grid_builder< detector_t, grid_t, bin_filler_t, grid_factory_t >::set_add_passives ( bool is_add_passive = false)

Should the passive surfaces be added to the grid ?

Parameters
is_add_passiveTrue to include passive surfaces.

◆ set_type() [1/2]

template<concepts::detector detector_t, concepts::grid grid_t, typename bin_filler_t = fill_by_pos, typename grid_factory_t = grid_factory_type<grid_t>>
void detray::grid_builder< detector_t, grid_t, bin_filler_t, grid_factory_t >::set_type ( link_id_t sf_id)

Set the surface category this grid should contain (type id in the accelerator link in the volume descriptor).

Parameters
sf_idSurface category identifier to associate with this grid.

◆ set_type() [2/2]

template<concepts::detector detector_t, concepts::grid grid_t, typename bin_filler_t = fill_by_pos, typename grid_factory_t = grid_factory_type<grid_t>>
void detray::grid_builder< detector_t, grid_t, bin_filler_t, grid_factory_t >::set_type ( std::size_t sf_id)

Set the surface category this grid should contain (type id in the accelerator link in the volume descriptor).

Parameters
sf_idSurface category identifier to associate with this grid.