30 typename detector_t::geometry_context ctx) {
31 using algebra_t =
typename detector_t::algebra_type;
36 using nav_link_t =
typename detector_t::surface_type::navigation_link;
37 using material_id =
typename detector_t::material::id;
45 std::make_unique<volume_builder<detector_t>>(volume_id::e_cylinder);
48 v_builder->add_volume_placement(transform3_t(point3_t{0.f, 0.f, 2.f}));
53 const auto vol_link{
static_cast<nav_link_t
>(v_mat_builder.vol_index())};
56 auto rectangle_factory =
57 std::make_shared<homogeneous_material_factory<detector_t>>(
58 std::make_unique<rectangle_factory_t>());
60 rectangle_factory->push_back({surface_id::e_sensitive,
61 transform3_t(point3_t{0.f, 0.f, 0.f}), vol_link,
62 std::vector<scalar_t>{-3.f, 3.f}});
63 rectangle_factory->add_material(
64 material_id::e_material_slab,
67 auto annulus_factory =
68 std::make_shared<homogeneous_material_factory<detector_t>>(
69 std::make_unique<annulus_factory_t>());
71 annulus_factory->push_back(
72 {surface_id::e_sensitive, transform3_t(point3_t{1.f, 0.f, 0.f}), vol_link,
73 std::vector<scalar_t>{1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f}});
74 annulus_factory->add_material(
75 material_id::e_material_slab,
79 auto trapezoid_factory =
80 std::make_shared<homogeneous_material_factory<detector_t>>(
81 std::make_unique<trapezoid_factory_t>());
83 trapezoid_factory->push_back(
84 {surface_id::e_sensitive, transform3_t(point3_t{2.f, 0.f, 0.f}), vol_link,
85 std::vector<scalar_t>{1.f, 2.f, 3.f, 1.f / 6.f}});
86 trapezoid_factory->add_material(
87 material_id::e_material_rod,
91 v_mat_builder.add_surfaces(rectangle_factory, ctx);
92 v_mat_builder.add_surfaces(annulus_factory, ctx);
93 v_mat_builder.add_surfaces(trapezoid_factory, ctx);
96 v_mat_builder.build(d, builder_opts);
get_scalar_t< A, T > dscalar
Scalar type for algebra A and value type T.
Definition algebra.hpp:64
void prefill_detector(detector_t &d, typename detector_t::geometry_context ctx)
Adds a few surfaces to the detector for testing the builder code on non-empty detectors.
Definition prefill_detector.hpp:29
get_transform3D_t< A, T > dtransform3D
Three-dimensional transform type for algebra A and value type T.
Definition algebra.hpp:84
get_point3D_t< A, T > dpoint3D
Three-dimensional point type for algebra A and value type T.
Definition algebra.hpp:72