Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-17 08:00:15

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
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 namespace ActsTests {
0035 
0036 BOOST_AUTO_TEST_SUITE(DetectorSuite)
0037 
0038 BOOST_AUTO_TEST_CASE(Multi_Wire_Structure_Builder_StrawSurfacesCreation) {
0039   // Create the surfaces of the multiwire structure-straw surfaces
0040   std::vector<std::shared_ptr<Surface>> strawSurfaces = {};
0041 
0042   // Set the number of surfaces along each dimension of the multi wire structure
0043   // aligned along z axis
0044   std::size_t nSurfacesY = 3;
0045   std::size_t nSurfacesX = 15;
0046 
0047   double radius = 15.;
0048   double halfZ = 250.;
0049 
0050   // The transform of the 1st surface
0051   Vector3 ipos = {-0.5 * nSurfacesX * 2 * radius + radius,
0052                   -0.5 * nSurfacesY * 2 * radius + radius, 0.};
0053   AngleAxis3 rotation(std::numbers::pi / 2., Vector3(0., 1., 0.));
0054 
0055   Vector3 pos = ipos;
0056 
0057   // Generate the surfaces
0058   for (std::size_t i = 0; i < nSurfacesY; i++) {
0059     for (std::size_t j = 0; j < nSurfacesX; j++) {
0060       auto surface = Surface::makeShared<StrawSurface>(
0061           Transform3(Translation3(pos)), radius, halfZ);
0062       strawSurfaces.push_back(surface);
0063       pos.x() = ipos.x() + 2 * j * radius;
0064       pos.y() = ipos.y() + 2 * i * radius;
0065     }
0066   }
0067 
0068   std::vector<double> vBounds = {0.5 * nSurfacesX * 2 * radius,
0069                                  0.5 * nSurfacesX * 2 * radius,
0070                                  0.5 * nSurfacesY * 2 * radius, halfZ};
0071 
0072   MultiWireStructureBuilder::Config mlCfg;
0073   mlCfg.name = "Multi_Layer_With_Wires";
0074   mlCfg.mlSurfaces = strawSurfaces;
0075   mlCfg.mlBounds = vBounds;
0076   mlCfg.mlBinning = {
0077       {DirectedProtoAxis(AxisDirection::AxisX, AxisBoundaryType::Bound,
0078                          -vBounds[0], vBounds[0], nSurfacesX),
0079        1u},
0080       {DirectedProtoAxis(AxisDirection::AxisY, AxisBoundaryType::Bound,
0081                          -vBounds[1], vBounds[1], nSurfacesY),
0082        0u}};
0083 
0084   MultiWireStructureBuilder mlBuilder(mlCfg);
0085   auto [volumes, portals, roots] = mlBuilder.construct(tContext);
0086 
0087   BOOST_CHECK_EQUAL(volumes.size(), 1u);
0088   BOOST_CHECK_EQUAL(volumes.front()->surfaces().size(),
0089                     nSurfacesX * nSurfacesY);
0090   BOOST_CHECK(volumes.front()->volumes().empty());
0091   BOOST_CHECK(volumes.front()->internalNavigation().connected());
0092 }
0093 
0094 BOOST_AUTO_TEST_SUITE_END()
0095 
0096 }  // namespace ActsTests