File indexing completed on 2025-01-18 09:12:33
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Detector/MultiWireStructureBuilder.hpp"
0013 #include "Acts/Geometry/GeometryContext.hpp"
0014 #include "Acts/Surfaces/LineBounds.hpp"
0015 #include "Acts/Surfaces/RectangleBounds.hpp"
0016 #include "Acts/Surfaces/StrawSurface.hpp"
0017 #include "Acts/Surfaces/Surface.hpp"
0018 #include "Acts/Visualization/GeometryView3D.hpp"
0019 #include "Acts/Visualization/IVisualization3D.hpp"
0020 #include "Acts/Visualization/ObjVisualization3D.hpp"
0021
0022 #include <algorithm>
0023 #include <iterator>
0024 #include <memory>
0025 #include <numbers>
0026 #include <utility>
0027 #include <vector>
0028
0029 using namespace Acts;
0030 using namespace Acts::Experimental;
0031
0032 GeometryContext tContext;
0033
0034 BOOST_AUTO_TEST_SUITE(Detector)
0035
0036 BOOST_AUTO_TEST_CASE(Multi_Wire_Structure_Builder_StrawSurfacesCreation) {
0037
0038 std::vector<std::shared_ptr<Acts::Surface>> strawSurfaces = {};
0039
0040
0041
0042 std::size_t nSurfacesY = 3;
0043 std::size_t nSurfacesX = 15;
0044
0045 double radius = 15.;
0046 double halfZ = 250.;
0047
0048
0049 Vector3 ipos = {-0.5 * nSurfacesX * 2 * radius + radius,
0050 -0.5 * nSurfacesY * 2 * radius + radius, 0.};
0051 AngleAxis3 rotation(std::numbers::pi / 2., Acts::Vector3(0., 1., 0.));
0052
0053 Vector3 pos = ipos;
0054
0055
0056 for (std::size_t i = 0; i < nSurfacesY; i++) {
0057 for (std::size_t j = 0; j < nSurfacesX; j++) {
0058 auto surface = Surface::makeShared<StrawSurface>(
0059 Transform3(Translation3(pos)), radius, halfZ);
0060 strawSurfaces.push_back(surface);
0061 pos.x() = ipos.x() + 2 * j * radius;
0062 pos.y() = ipos.y() + 2 * i * radius;
0063 }
0064 }
0065
0066 std::vector<double> vBounds = {0.5 * nSurfacesX * 2 * radius,
0067 0.5 * nSurfacesX * 2 * radius,
0068 0.5 * nSurfacesY * 2 * radius, halfZ};
0069
0070 MultiWireStructureBuilder::Config mlCfg;
0071 mlCfg.name = "Multi_Layer_With_Wires";
0072 mlCfg.mlSurfaces = strawSurfaces;
0073 mlCfg.mlBounds = vBounds;
0074 mlCfg.mlBinning = {
0075 ProtoBinning(Acts::AxisDirection::AxisX, Acts::AxisBoundaryType::Bound,
0076 -vBounds[0], vBounds[0], nSurfacesX, 1u),
0077 ProtoBinning(Acts::AxisDirection::AxisY, Acts::AxisBoundaryType::Bound,
0078 -vBounds[1], vBounds[1], nSurfacesY, 0u)};
0079
0080 MultiWireStructureBuilder mlBuilder(mlCfg);
0081 auto [volumes, portals, roots] = mlBuilder.construct(tContext);
0082
0083 BOOST_CHECK_EQUAL(volumes.size(), 1u);
0084 BOOST_CHECK_EQUAL(volumes.front()->surfaces().size(),
0085 nSurfacesX * nSurfacesY);
0086 BOOST_CHECK(volumes.front()->volumes().empty());
0087 BOOST_CHECK(volumes.front()->internalNavigation().connected());
0088 }
0089
0090 BOOST_AUTO_TEST_SUITE_END()