ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
detray::svgtools::illustrator< detector_t > Class Template Reference

SVG generator for a detector and related entities. More...

#include <detray/plugins/svgtools/illustrator.hpp>

Public Member Functions

 illustrator (const detector_t &detector, const typename detector_t::name_map &name_map, const styling::style &style=detray::svgtools::styling::tableau_colorblind::style)
std::string det_name () const
template<typename view_t>
auto draw_detector (const view_t &view, const typename detector_t::geometry_context &gctx={}, const float r_length=1100.f, const float z_length=3100.f) const
 Converts a detray detector to an svg.
template<typename view_t, typename intersection_t>
auto draw_intersections (const std::string &prefix, const std::vector< intersection_t > &intersections, const typename detector_t::vector3_type dir, const view_t &view, const dindex_range highlight_idx={detail::invalid_value< dindex >(), detail::invalid_value< dindex >()}, const typename detector_t::geometry_context &gctx={}) const
 Converts a collection of intersections to an svg.
template<typename view_t, class trajectory_t, typename intersection_t>
auto draw_intersections_and_trajectory (const std::string &prefix, const std::vector< intersection_t > &intersections, const trajectory_t &trajectory, const view_t &view, typename detector_t::scalar_type max_path=500.f, const dindex_range highlight_idx={detail::invalid_value< dindex >(), detail::invalid_value< dindex >()}, const typename detector_t::geometry_context &gctx={}) const
 Converts a trajectory and its intersections to an svg with a related coloring.
template<typename view_t, concepts::point3D point_t>
auto draw_landmark (const std::string &prefix, const point_t &point, const view_t &view) const
 Converts a point to an svg.
template<typename view_t>
auto draw_surface (const dindex index, const view_t &view, const typename detector_t::geometry_context &gctx={}) const
 Converts a single detray surface of the detector to an svg.
template<typename view_t>
auto draw_surface_material (const dindex index, const view_t &view) const
 Converts the material map of a single detray surface to an svg.
template<detray::ranges::range range_t, typename view_t>
auto draw_surface_materials (const range_t &indices, const view_t &view) const
 Converts the material of multiple detray surfaces to an svg.
template<detray::ranges::range range_t, typename view_t>
auto draw_surfaces (const range_t &indices, const view_t &view, const typename detector_t::geometry_context &gctx={}) const
 Converts a multiple of detray surfaces of the detector to an svg.
template<typename view_t, typename point3_container>
auto draw_trajectory (const std::string &prefix, const point3_container &points, const view_t &view) const
 Converts a trajectory to an svg.
template<typename view_t, template< typename > class trajectory_t, concepts::algebra algebra_t>
auto draw_trajectory (const std::string &prefix, const trajectory_t< algebra_t > &trajectory, const dscalar< algebra_t > path, const view_t &view) const
 Converts a trajectory to an svg.
template<typename view_t>
auto draw_volume (const dindex index, const view_t &view, const typename detector_t::geometry_context &gctx={}) const
 Converts a detray volume of the detector to an svg.
template<typename view_t>
auto draw_volume (const std::string_view name, const view_t &view, const typename detector_t::geometry_context &gctx={}) const
 Converts a detray volume of the detector to an svg.
template<detray::ranges::range range_t, typename view_t>
auto draw_volumes (const range_t &volume_ids, const view_t &view, const typename detector_t::geometry_context &gctx={}) const
 Converts multiple detray volumes of the detector to an svg.
void hide_eta_lines (bool toggle=true)
 Toggle eta lines in detector rz-view.
void hide_grids (bool toggle=true)
 Toggle surface grids.
void hide_material (bool toggle=true)
 Toggle surface material.
void hide_passives (bool toggle=true)
 Toggle passive surfaces.
void hide_portals (bool toggle=true)
 Toggle portal surfaces.
const detector_t::name_map & names ()
void search_window (std::array< dindex, 2 > window)
 Neighborhood search window for the grid display.
void show_info (bool toggle=true)
 Toggle info boxes.
styling::style & style ()
 Access the illustrator style.

Detailed Description

template<concepts::detector detector_t>
class detray::svgtools::illustrator< detector_t >

SVG generator for a detector and related entities.

Provides an easy interface for displaying typical objects in a detector. For more flexibility, use the tools in svgtools::conversion to convert detray objects to their respective proto object. Use functions in svgtools::meta::display and actsvg::display to display the proto objects.

Note
Avoid using ids containing spaces or dashes as this seems to cause issues (for instance regarding information boxes). Furthermore, to view information boxes, they must be enabled in the constructor. Furthermore the svg viewer (opening the file after it is created) must support animations.

Constructor & Destructor Documentation

◆ illustrator()

template<concepts::detector detector_t>
detray::svgtools::illustrator< detector_t >::illustrator ( const detector_t & detector,
const typename detector_t::name_map & name_map,
const styling::style & style = detray::svgtools::styling::tableau_colorblind::style )
Parameters
detectorthe detector
name_mapnaming scheme of the detector
styledisplay style
Note
information boxes are enabled by default

Member Function Documentation

◆ det_name()

template<concepts::detector detector_t>
std::string detray::svgtools::illustrator< detector_t >::det_name ( ) const
Returns
the detector name

◆ draw_detector()

template<concepts::detector detector_t>
template<typename view_t>
auto detray::svgtools::illustrator< detector_t >::draw_detector ( const view_t & view,
const typename detector_t::geometry_context & gctx = {},
const float r_length = 1100.f,
const float z_length = 3100.f ) const

Converts a detray detector to an svg.

Parameters
viewthe display view.
gctxthe geometry context.
r_lengthradial extent used for eta-line overlays
z_lengthlongitudinal extent used for eta-line overlays
Returns
SVG object representing the detector.

◆ draw_intersections()

template<concepts::detector detector_t>
template<typename view_t, typename intersection_t>
auto detray::svgtools::illustrator< detector_t >::draw_intersections ( const std::string & prefix,
const std::vector< intersection_t > & intersections,
const typename detector_t::vector3_type dir,
const view_t & view,
const dindex_range highlight_idx = {detail::invalid_value<dindex>(), detail::invalid_value<dindex>()},
const typename detector_t::geometry_context & gctx = {} ) const

Converts a collection of intersections to an svg.

Parameters
prefixthe id of the svg object.
intersectionsthe intersection collection.
dirthe direction of the trajectory.
viewthe display view.
highlight_idxinclusive range of highlighted intersection indices
gctxthe geometry context.
Returns
SVG object representing the intersection record.

◆ draw_intersections_and_trajectory()

template<concepts::detector detector_t>
template<typename view_t, class trajectory_t, typename intersection_t>
auto detray::svgtools::illustrator< detector_t >::draw_intersections_and_trajectory ( const std::string & prefix,
const std::vector< intersection_t > & intersections,
const trajectory_t & trajectory,
const view_t & view,
typename detector_t::scalar_type max_path = 500.f,
const dindex_range highlight_idx = {detail::invalid_value<dindex>(), detail::invalid_value<dindex>()},
const typename detector_t::geometry_context & gctx = {} ) const

Converts a trajectory and its intersections to an svg with a related coloring.

Parameters
prefixthe id of the svg object.
intersectionsthe intersection record.
trajectorythe trajectory (eg. ray or helix).
viewthe display view.
max_paththe maximal path length from trajectory origin.
highlight_idxinclusive range of highlighted intersection indices
gctxthe geometry context.
Returns
SVG object representing the trajectory and intersections

◆ draw_landmark()

template<concepts::detector detector_t>
template<typename view_t, concepts::point3D point_t>
auto detray::svgtools::illustrator< detector_t >::draw_landmark ( const std::string & prefix,
const point_t & point,
const view_t & view ) const

Converts a point to an svg.

Parameters
prefixthe id of the svg object.
pointthe point.
viewthe display view.
Returns
actsvg::svg::object of the point.

◆ draw_surface()

template<concepts::detector detector_t>
template<typename view_t>
auto detray::svgtools::illustrator< detector_t >::draw_surface ( const dindex index,
const view_t & view,
const typename detector_t::geometry_context & gctx = {} ) const

Converts a single detray surface of the detector to an svg.

Parameters
indexthe index of the surface in the detector.
viewthe display view.
gctxthe geometry context.
Returns
actsvg::svg::object of the detector's surface.

◆ draw_surface_material()

template<concepts::detector detector_t>
template<typename view_t>
auto detray::svgtools::illustrator< detector_t >::draw_surface_material ( const dindex index,
const view_t & view ) const

Converts the material map of a single detray surface to an svg.

Parameters
indexthe index of the surface in the detector.
viewthe display view.
Returns
a pair containing the surface SVG and its material overlay.

◆ draw_surface_materials()

template<concepts::detector detector_t>
template<detray::ranges::range range_t, typename view_t>
auto detray::svgtools::illustrator< detector_t >::draw_surface_materials ( const range_t & indices,
const view_t & view ) const

Converts the material of multiple detray surfaces to an svg.

Parameters
indicesthe collection of surface indices in the detector to convert.
viewthe display view.
Returns
actsvg::svg::object of the surface's material maps.

◆ draw_surfaces()

template<concepts::detector detector_t>
template<detray::ranges::range range_t, typename view_t>
auto detray::svgtools::illustrator< detector_t >::draw_surfaces ( const range_t & indices,
const view_t & view,
const typename detector_t::geometry_context & gctx = {} ) const

Converts a multiple of detray surfaces of the detector to an svg.

Parameters
indicesthe collection of surface indices in the detector to convert.
viewthe display view.
gctxthe geometry context.
Returns
actsvg::svg::object of the detector's surfaces.

◆ draw_trajectory() [1/2]

template<concepts::detector detector_t>
template<typename view_t, typename point3_container>
auto detray::svgtools::illustrator< detector_t >::draw_trajectory ( const std::string & prefix,
const point3_container & points,
const view_t & view ) const

Converts a trajectory to an svg.

Parameters
prefixthe id of the svg object.
pointsordered positions making up the trajectory
viewthe display view.
Returns
actsvg::svg::object of the trajectory.

◆ draw_trajectory() [2/2]

template<concepts::detector detector_t>
template<typename view_t, template< typename > class trajectory_t, concepts::algebra algebra_t>
auto detray::svgtools::illustrator< detector_t >::draw_trajectory ( const std::string & prefix,
const trajectory_t< algebra_t > & trajectory,
const dscalar< algebra_t > path,
const view_t & view ) const

Converts a trajectory to an svg.

Parameters
prefixthe id of the svg object.
trajectorythe trajectory (eg. ray or helix).
pathmaximal pathlength of along the trajectory.
viewthe display view.
Returns
actsvg::svg::object of the trajectory.

◆ draw_volume() [1/2]

template<concepts::detector detector_t>
template<typename view_t>
auto detray::svgtools::illustrator< detector_t >::draw_volume ( const dindex index,
const view_t & view,
const typename detector_t::geometry_context & gctx = {} ) const

Converts a detray volume of the detector to an svg.

Parameters
indexthe index of the volume in the detector.
viewthe display view.
gctxthe geometry context.
Returns
actsvg::svg::object of the detector's volume.

◆ draw_volume() [2/2]

template<concepts::detector detector_t>
template<typename view_t>
auto detray::svgtools::illustrator< detector_t >::draw_volume ( const std::string_view name,
const view_t & view,
const typename detector_t::geometry_context & gctx = {} ) const

Converts a detray volume of the detector to an svg.

Parameters
namethe name of the volume.
viewthe display view.
gctxthe geometry context.
Returns
actsvg::svg::object of the detector's volume.

◆ draw_volumes()

template<concepts::detector detector_t>
template<detray::ranges::range range_t, typename view_t>
auto detray::svgtools::illustrator< detector_t >::draw_volumes ( const range_t & volume_ids,
const view_t & view,
const typename detector_t::geometry_context & gctx = {} ) const

Converts multiple detray volumes of the detector to an svg.

Parameters
volume_idsthe collection of volume indices or names in the detector to convert.
viewthe display view.
gctxthe geometry context.
Returns
actsvg::svg::object of the detector's volumes.

◆ hide_eta_lines()

template<concepts::detector detector_t>
void detray::svgtools::illustrator< detector_t >::hide_eta_lines ( bool toggle = true)

Toggle eta lines in detector rz-view.

Parameters
toggletrue to hide eta lines

◆ hide_grids()

template<concepts::detector detector_t>
void detray::svgtools::illustrator< detector_t >::hide_grids ( bool toggle = true)

Toggle surface grids.

Parameters
toggletrue enables the named display option

◆ hide_material()

template<concepts::detector detector_t>
void detray::svgtools::illustrator< detector_t >::hide_material ( bool toggle = true)

Toggle surface material.

Parameters
toggletrue to hide material overlays

◆ hide_passives()

template<concepts::detector detector_t>
void detray::svgtools::illustrator< detector_t >::hide_passives ( bool toggle = true)

Toggle passive surfaces.

Parameters
toggletrue enables the named display option

◆ hide_portals()

template<concepts::detector detector_t>
void detray::svgtools::illustrator< detector_t >::hide_portals ( bool toggle = true)

Toggle portal surfaces.

Parameters
toggletrue enables the named display option

◆ names()

template<concepts::detector detector_t>
const detector_t::name_map & detray::svgtools::illustrator< detector_t >::names ( )
Returns
the detector and volume names

◆ search_window()

template<concepts::detector detector_t>
void detray::svgtools::illustrator< detector_t >::search_window ( std::array< dindex, 2 > window)

Neighborhood search window for the grid display.

Parameters
windownumber of neighboring bins to include on each axis

◆ show_info()

template<concepts::detector detector_t>
void detray::svgtools::illustrator< detector_t >::show_info ( bool toggle = true)

Toggle info boxes.

Parameters
toggletrue to show information boxes

◆ style()

template<concepts::detector detector_t>
styling::style & detray::svgtools::illustrator< detector_t >::style ( )

Access the illustrator style.

Returns
mutable style settings used by the illustrator