9 #include <boost/test/unit_test.hpp>
42 using namespace Acts::Experimental;
49 template <
typename surface_type,
typename surface_bounds_type>
54 const surface_bounds_type& sBounds,
59 m_surfaceBounds(sBounds),
65 std::vector<std::shared_ptr<DetectorVolume>> rootVolumes;
68 auto surface = Surface::makeShared<surface_type>(
69 (
m_transform), std::make_shared<surface_bounds_type>(m_surfaceBounds));
73 auto volume = DetectorVolumeFactory::construct(
78 rootVolumes.push_back(volume);
81 for (
auto [ip,
p] :
enumerate(volume->portalPtrs())) {
100 unsigned int volumeCount = 0;
109 auto& ccache = std::any_cast<
Cache&>(cache);
113 dVolume.assignGeometryId(geoID);
116 void assignGeometryId(
120 void assignGeometryId(
131 std::invalid_argument);
136 std::invalid_argument);
139 misCfg.
builders = {
nullptr,
nullptr};
142 std::invalid_argument);
145 misCfg.
builders = {
nullptr,
nullptr,
nullptr};
148 std::invalid_argument);
154 negZ.pretranslate(
Vector3(0., 0., -300.));
156 std::make_shared<CylindricalVolumeBuilder<DiscSurface, RadialBounds>>(
161 auto barrel = std::make_shared<
167 posZ.pretranslate(
Vector3(0., 0., 300.));
169 std::make_shared<CylindricalVolumeBuilder<DiscSurface, RadialBounds>>(
175 tripleZCfg.
auxiliary =
"*** Test 0 - Build triple in Z ***";
176 tripleZCfg.builders = {negDisc, barrel, posDisc};
177 tripleZCfg.binning = {
binZ};
178 tripleZCfg.geoIdGenerator = std::make_shared<VolumeGeoIdGenerator>();
180 tripleZCfg.geoIdReverseGen =
true;
182 auto tripleZ = std::make_shared<CylindricalContainerBuilder>(
187 BOOST_CHECK(portals.size() == 4
u);
188 BOOST_CHECK(roots.volumes.size() == 3
u);
189 BOOST_CHECK(roots.volumes[0]->geometryId().volume() == 3
u);
190 BOOST_CHECK(roots.volumes[1]->geometryId().volume() == 2
u);
191 BOOST_CHECK(roots.volumes[2]->geometryId().volume() == 1
u);
196 auto barrel0 = std::make_shared<
202 auto barrel1 = std::make_shared<
208 auto barrel2 = std::make_shared<
215 barrelRCfg.
auxiliary =
"*** Test 1 - Build multilayer barrel ***";
216 barrelRCfg.builders = {barrel0, barrel1, barrel2};
217 barrelRCfg.binning = {
binR};
218 barrelRCfg.geoIdGenerator = std::make_shared<VolumeGeoIdGenerator>();
220 auto barrelR = std::make_shared<CylindricalContainerBuilder>(
225 BOOST_CHECK(portals.size() == 4
u);
226 BOOST_CHECK(roots.volumes.size() == 3
u);
227 BOOST_CHECK(roots.volumes[0]->geometryId().volume() == 1
u);
228 BOOST_CHECK(roots.volumes[1]->geometryId().volume() == 2
u);
229 BOOST_CHECK(roots.volumes[2]->geometryId().volume() == 3
u);
235 barrelPhiCfg.
auxiliary =
"*** Test 2 - Build segmented phi barrel ***";
238 unsigned int phiSectors = 5;
241 std::vector<std::shared_ptr<DetectorVolume>> phiVolumes = {};
242 for (
unsigned int i = 0;
i < phiSectors; ++
i) {
245 10., 100., 100., phiHalfSector, -M_PI + (2
u *
i + 1
u) * phiHalfSector);
248 -M_PI + (2
u *
i + 1
u) * phiHalfSector);
250 auto builder = std::make_shared<
252 Transform3::Identity(), volumeBounds, surfaceBounds,
254 barrelPhiCfg.
builders.push_back(builder);
257 auto barrelPhi = std::make_shared<CylindricalContainerBuilder>(
262 BOOST_CHECK(portals.size() == 4
u);
263 BOOST_CHECK(roots.volumes.size() == 5
u);
268 auto beampipe = std::make_shared<
275 negZ.pretranslate(
Vector3(0., 0., -300.));
277 std::make_shared<CylindricalVolumeBuilder<DiscSurface, RadialBounds>>(
282 auto barrel0 = std::make_shared<
288 auto barrel1 = std::make_shared<
294 auto barrel2 = std::make_shared<
301 barrelRCfg.
builders = {barrel0, barrel1, barrel2};
302 barrelRCfg.binning = {
binR};
304 auto barrel = std::make_shared<CylindricalContainerBuilder>(
308 posZ.pretranslate(
Vector3(0., 0., 300.));
310 std::make_shared<CylindricalVolumeBuilder<DiscSurface, RadialBounds>>(
316 barrelEndcapCfg.
builders = {endcapN, barrel, endcapP};
317 barrelEndcapCfg.binning = {
binZ};
319 auto barrelEndcap = std::make_shared<CylindricalContainerBuilder>(
325 detectorCfg.
builders = {beampipe, barrelEndcap};
326 detectorCfg.binning = {
binR};
328 auto detector = std::make_shared<CylindricalContainerBuilder>(
332 BOOST_CHECK(portals.size() == 3
u);
333 BOOST_CHECK(roots.volumes.size() == 6
u);
336 BOOST_AUTO_TEST_SUITE_END()