ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
detray::io Namespace Reference

The following enums are global for all detectors. More...

Classes

struct  axis_payload
 axis definition and bin edges More...
struct  common_header_payload
 a payload for common information More...
struct  detector_grids_payload
 A payload for the grid collections of a detector. More...
struct  detector_homogeneous_material_payload
 A payload for the homogeneous material description of a detector. More...
struct  detector_payload
 A payload for a detector geometry. More...
struct  detector_reader_config
 config struct for detector reading. More...
struct  detector_writer_config
 config struct for detector writing. More...
class  file_handle
 Wrapper around a file stream. More...
struct  geo_sub_header_payload
 Geometry payloads. More...
class  geometry_reader
 Tracking geometry reader backend. More...
class  geometry_writer
 Tracking geometry writer backend. More...
struct  grid_bin_payload
 A payload for a single grid bin. More...
struct  grid_payload
 A payload for a grid definition. More...
struct  grid_sub_header_payload
 Payloads for a uniform grid. More...
struct  header_payload
 a payload for common and extra information More...
class  homogeneous_material_reader
 Homogeneous material reader backend. More...
struct  homogeneous_material_sub_header_payload
 Material payloads. More...
class  homogeneous_material_writer
 Homogeneous material writer backend. More...
class  json_converter
 Class that adds converts io payloads to json and back. More...
class  json_converter< detector_t, backend_t >
 Class that adds json functionality to backend reader types. More...
struct  mask_payload
 A payload object for surface masks. More...
class  material_map_reader
 Material map reader backend. More...
class  material_map_writer
 Material maps writer backend. More...
struct  material_param_payload
 A payload object for a material parametrization. More...
struct  material_volume_payload
 A payload object for all of the [surface] material contained in a volume. More...
class  reader_interface
 Abstract base class for detray detector component readers. More...
 A payload for a single object link (volume local). More...
class  surface_grid_reader
 Surface grid reader backend. More...
class  surface_grid_writer
 Surface grid writer backend. More...
struct  surface_material_payload
 A payload object for a material slab/rod. More...
struct  surface_payload
 A payload for surfaces. More...
struct  transform_payload
 A payload for an affine transformation in homogeneous coordinates. More...
 A payload for a typed object link (dtyped_index). More...
struct  volume_material_payload
 A payload for the material of a volume. More...
struct  volume_payload
 A payload for volumes. More...
class  writer_interface
 Abstract base class for detray detector component writers. More...

Typedefs

template<detray::concepts::algebra algebra_t>
using frame_registry
 Register the grid shapes to the accel_id enum.
template<detray::concepts::algebra algebra_t>
using material_registry
 Register the material types to the material_id enum.
using scalar = double
 Default scalar precision used for serialized geometry payloads.
using shape_registry
 Register the mask shapes to the IO shape_id enum.
using geo_header_payload = header_payload<geo_sub_header_payload>
 a payload for the geometry file header
using material_link_payload = typed_link_payload<io::material_id>
 A payload object to link a surface to its material.
using acc_links_payload = typed_link_payload<io::accel_id>
 A payload object to link a volume to its acceleration data structures.
using homogeneous_material_header_payload
 a payload for the homogeneous material file header
using grid_header_payload = header_payload<grid_sub_header_payload>
 a payload for the grid file header

Enumerations

enum class  accel_id : unsigned int {
  brute_force = 0u , cartesian2_grid = 1u , cuboid3_grid = 2u , polar2_grid = 3u ,
  concentric_cylinder2_grid = 4u , cylinder2_grid = 5u , cylinder3_grid = 6u , n_accel = 7u ,
  unknown = n_accel
}
 Enumerate the different acceleration data structures.
enum class  format { json = 0u }
 Supported serialization formats.
enum class  material_id : unsigned int {
  annulus2_map = 0u , rectangle2_map = 1u , cuboid3_map = 2u , concentric_cylinder2_map = 3u ,
  cylinder2_map = 4u , cylinder3_map = 5u , ring2_map = 0u , trapezoid2_map = 1u ,
  slab = 6u , rod = 7u , raw_material = 8u , n_mats = 9u ,
  unknown = n_mats
}
 Enumerate the different material types.
enum class  shape_id : unsigned int {
  annulus2 = 0u , cuboid3 = 1u , cylinder2 = 2u , cylinder3 = 3u ,
  portal_cylinder2 = 4u , rectangle2 = 5u , ring2 = 6u , trapezoid2 = 7u ,
  drift_cell = 8u , straw_tube = 9u , single1 = 10u , single2 = 11u ,
  single3 = 12u , n_shapes = 13u , unknown = n_shapes
}
 Enumerate the shape primitives globally.

Functions

std::string alt_file_name (const std::string &name)
 Find an unused numbered alternative to an existing file name.
auto create_path (const std::string &outdir)
 Check if a given file path exists and generate it if not.
bool file_exists (const std::string &outdir)
 Check if a file exists.
std::ostream & operator<< (std::ostream &os, accel_id aid)
 Write a navigation-accelerator identifier using its enumerator name.
std::ostream & operator<< (std::ostream &os, material_id mid)
 Write a material representation identifier using its enumerator name.
std::ostream & operator<< (std::ostream &os, shape_id sid)
 Write a surface-shape identifier using its enumerator name.
template<class detector_t, std::size_t CAP = 0u, std::size_t DIM = 2u>
void read_components_from_file (const std::vector< std::string > &file_names, detector_builder< typename detector_t::metadata, volume_builder > &det_builder)
 Read detector components from a list of files.
template<class detector_t, std::size_t CAP = 0u, std::size_t DIM = 2u, template< typename > class volume_builder_t = volume_builder>
auto read_detector (vecmem::memory_resource &resc, const detector_reader_config &cfg) noexcept(false)
 Reader function for detray detectors.
template<class detector_t>
void write_detector (detector_t &det, const typename detector_t::name_map &names, detector_writer_config &cfg)
 Writer function for detray detectors.

Detailed Description

The following enums are global for all detectors.

Raw indices (std::size_t) denote links between data components in different files, while links used in detray detector objects are modelled as e.g.

single_link_payload

Note
All indices are with respect to volume that the data belongs to, starting at zero

Typedef Documentation

◆ frame_registry

Initial value:
match types with indices/identifiers and vice versa.
Definition type_registry.hpp:33
Projection into a 3D cartesian coordinate frame.
Definition cartesian3D.hpp:19
Projection into a 2D concentric cylindrical frame (No rotation in coordinate transformation).
Definition concentric_cylindrical2D.hpp:21
Projection into a 2D cylindrical coordinate frame.
Definition cylindrical2D.hpp:20
Projection into a 3D cylindrical coordinate frame.
Definition cylindrical3D.hpp:20
Projection into a polar coordinate frame.
Definition polar2D.hpp:20

Register the grid shapes to the accel_id enum.

Note
the first type corresponds to a non-grid type in the enum (brute force)

◆ homogeneous_material_header_payload

Initial value:
a payload for common and extra information
Definition payloads.hpp:54

a payload for the homogeneous material file header

◆ material_registry

Initial value:
Projection into a 2D cartesian coordinate frame.
Definition cartesian2D.hpp:19
Rod structure to be mapped on the line mask.
Definition material_rod.hpp:26
Slab structure to be mapped on the mask (plane, cylinder).
Definition material_slab.hpp:25
Material composition properties and density data used by interactions.
Definition material.hpp:36

Register the material types to the material_id enum.

◆ shape_registry

Initial value:
Geometrical shape of a stereo annulus that is used for the ITk strip endcaps.
Definition annulus2D.hpp:48
Geometrical shape of a 2D concentric cylinder.
Definition concentric_cylinder2D.hpp:32
Geometrical shape of a full 3D cuboid.
Definition cuboid3D.hpp:32
Geometrical shape of a 2D cylinder.
Definition cylinder2D.hpp:33
Geometrical shape of a full 3D cylinder.
Definition cylinder3D.hpp:32
Geometrical shape of a rectangle2D.
Definition rectangle2D.hpp:30
Geometrical shape of a closed ring.
Definition ring2D.hpp:34
Underlying geometry for a single parameter bound mask.
Definition single3D.hpp:34
Geometrical shape of a trapezoid2D.
Definition trapezoid2D.hpp:34
shape_id
Enumerate the shape primitives globally.
Definition definitions.hpp:33
line< false > line_circular
Radial crossection, boundary check in polar coordinates.
Definition line.hpp:340
line< true > line_square
Square crossection, boundary check in cartesian coordinates.
Definition line.hpp:342

Register the mask shapes to the IO shape_id enum.

Function Documentation

◆ alt_file_name()

std::string detray::io::alt_file_name ( const std::string & name)

Find an unused numbered alternative to an existing file name.

Parameters
nameoriginal file path
Returns
an alternative file name by counting up, if file exists

◆ create_path()

auto detray::io::create_path ( const std::string & outdir)

Check if a given file path exists and generate it if not.

Parameters
outdirdirectory path to create
Returns
filesystem path for the requested directory

◆ file_exists()

bool detray::io::file_exists ( const std::string & outdir)

Check if a file exists.

Parameters
outdirpath to inspect
Returns
true when the path exists

◆ operator<<() [1/3]

std::ostream & detray::io::operator<< ( std::ostream & os,
accel_id aid )

Write a navigation-accelerator identifier using its enumerator name.

Parameters
osoutput stream
aididentifier to print
Returns
the output stream

◆ operator<<() [2/3]

std::ostream & detray::io::operator<< ( std::ostream & os,
material_id mid )

Write a material representation identifier using its enumerator name.

Parameters
osoutput stream
mididentifier to print
Returns
the output stream

◆ operator<<() [3/3]

std::ostream & detray::io::operator<< ( std::ostream & os,
shape_id sid )

Write a surface-shape identifier using its enumerator name.

Parameters
osoutput stream
sididentifier to print
Returns
the output stream

◆ read_components_from_file()

template<class detector_t, std::size_t CAP = 0u, std::size_t DIM = 2u>
void detray::io::read_components_from_file ( const std::vector< std::string > & file_names,
detector_builder< typename detector_t::metadata, volume_builder > & det_builder )

Read detector components from a list of files.

Parameters
file_nameslist of files to be read
det_builderdetector builder to be filled

◆ read_detector()

template<class detector_t, std::size_t CAP = 0u, std::size_t DIM = 2u, template< typename > class volume_builder_t = volume_builder>
auto detray::io::read_detector ( vecmem::memory_resource & resc,
const detector_reader_config & cfg )

Reader function for detray detectors.

Template Parameters
detector_tthe type of detector to be built
CAPsurface grid bin capacity. If CAP is 0, the grid reader builds a grid type with dynamic bin capacity
DIMdimension of the surface grids, usually 2D
volume_builder_tthe type of base volume builder to be used
Parameters
rescthe memory resource to be used for the detector container allocs
cfgthe detector reader configuration
Returns
a complete detector object + a map that contains the volume names

◆ write_detector()

template<class detector_t>
void detray::io::write_detector ( detector_t & det,
const typename detector_t::name_map & names,
detector_writer_config & cfg )

Writer function for detray detectors.

Assemble the configured component writers and serialize the detector.

Template Parameters
detector_tdetector type providing stores and name map
Parameters
detdetector whose component stores are written
namesmap used to write component names
cfgoutput format, destination, and component-selection options