9 #include <boost/test/unit_test.hpp>
36 using namespace Acts::Experimental;
42 template <
typename bounds_type>
48 m_bounds(std::
move(bounds)) {}
52 return {
m_transform, std::make_unique<bounds_type>(m_bounds),
64 template <
typename surface_type,
typename bounds_type>
70 m_bounds(std::
move(bounds)) {}
74 auto surface = Surface::makeShared<surface_type>(
75 m_transform, std::make_shared<bounds_type>(m_bounds));
91 void assignGeometryId(
97 s->assignGeometryId(geoID);
101 void assignGeometryId(
105 void assignGeometryId(
113 template <
typename bounds_type>
119 m_bounds(std::
move(bounds)) {}
123 auto bounds = std::make_unique<bounds_type>(m_bounds);
125 auto volume = DetectorVolumeFactory::construct(
141 dvCfg.
auxiliary =
"*** Test X * Misconfigued ***";
142 dvCfg.
name =
"EmptyCylinder";
147 std::invalid_argument);
152 auto cBuilder = std::make_shared<ExternalsBuilder<CylinderVolumeBounds>>(
153 Transform3::Identity(), cBounds);
156 dvCfg.
auxiliary =
"*** Test 0 - Empty Cylinder ***";
157 dvCfg.name =
"EmptyCylinder";
158 dvCfg.externalsBuilder = cBuilder;
159 dvCfg.internalsBuilder =
nullptr;
161 auto dvBuilder = std::make_shared<DetectorVolumeBuilder>(
166 BOOST_CHECK(volumes.size() == 1
u);
167 BOOST_CHECK(volumes.front()->surfaces().empty());
168 BOOST_CHECK(volumes.front()->volumes().empty());
170 BOOST_CHECK(portals.size() == 4
u);
172 BOOST_CHECK(roots.volumes.size() == 1
u);
173 BOOST_CHECK(roots.volumeFinder.connected());
178 auto cBuilder = std::make_shared<ExternalsBuilder<CylinderVolumeBounds>>(
179 Transform3::Identity(), cvBounds);
183 std::make_shared<InternalSurfaceBuilder<CylinderSurface, CylinderBounds>>(
184 Transform3::Identity(), csBounds);
187 dvCfg.
auxiliary =
"*** Test 1 - Cylinder with internal Surface ***";
188 dvCfg.name =
"CylinderWithSurface";
189 dvCfg.externalsBuilder = cBuilder;
190 dvCfg.internalsBuilder = sBuilder;
191 dvCfg.geoIdGenerator = std::make_shared<SurfaceGeoIdGenerator>();
193 auto dvBuilder = std::make_shared<DetectorVolumeBuilder>(
198 BOOST_CHECK(volumes.size() == 1
u);
199 BOOST_CHECK(volumes.front()->surfaces().size() == 1
u);
201 BOOST_CHECK(volumes.front()->surfaces().front()->geometryId().passive() ==
203 BOOST_CHECK(volumes.front()->volumes().empty());
205 BOOST_CHECK(portals.size() == 4
u);
207 BOOST_CHECK(roots.volumes.size() == 1
u);
208 BOOST_CHECK(roots.volumeFinder.connected());
213 auto cBuilder = std::make_shared<ExternalsBuilder<CylinderVolumeBounds>>(
214 Transform3::Identity(), cvBounds);
217 auto iBuilder = std::make_shared<InternalVolumeBuilder<CylinderVolumeBounds>>(
218 Transform3::Identity(), ciBounds);
221 dvCfg.
auxiliary =
"*** Test 2 - Cylinder with internal Volume ***";
222 dvCfg.name =
"CylinderWithVolume";
223 dvCfg.externalsBuilder = cBuilder;
224 dvCfg.internalsBuilder = iBuilder;
225 dvCfg.addInternalsToRoot =
false;
227 auto dvBuilder = std::make_shared<DetectorVolumeBuilder>(
232 BOOST_CHECK(volumes.size() == 1
u);
233 BOOST_CHECK(portals.size() == 4
u);
234 BOOST_CHECK(roots.volumes.size() == 1
u);
239 auto cBuilder = std::make_shared<ExternalsBuilder<CylinderVolumeBounds>>(
240 Transform3::Identity(), cvBounds);
243 auto iBuilder = std::make_shared<InternalVolumeBuilder<CylinderVolumeBounds>>(
244 Transform3::Identity(), ciBounds);
248 "*** Test 3 - Cylinder with internal Volume, adding to root ***";
249 dvCfg.name =
"CylinderWithVolume";
250 dvCfg.externalsBuilder = cBuilder;
251 dvCfg.internalsBuilder = iBuilder;
252 dvCfg.addInternalsToRoot =
true;
254 auto dvBuilder = std::make_shared<DetectorVolumeBuilder>(
259 BOOST_CHECK(volumes.size() == 1
u);
260 BOOST_CHECK(volumes.front()->surfaces().empty());
261 BOOST_CHECK(volumes.front()->volumes().size() == 1
u);
263 BOOST_CHECK(portals.size() == 4
u);
265 BOOST_CHECK(roots.volumes.size() == 2
u);
266 BOOST_CHECK(roots.volumeFinder.connected());
269 BOOST_AUTO_TEST_SUITE_END()