Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:33

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 BOOST_AUTO_TEST_SUITE(Detector)
0035 
0036 BOOST_AUTO_TEST_CASE(Multi_Wire_Structure_Builder_StrawSurfacesCreation) {
0037   // Create the surfaces of the multiwire structure-straw surfaces
0038   std::vector<std::shared_ptr<Acts::Surface>> strawSurfaces = {};
0039 
0040   // Set the number of surfaces along each dimension of the multi wire structure
0041   // aligned along z axis
0042   std::size_t nSurfacesY = 3;
0043   std::size_t nSurfacesX = 15;
0044 
0045   double radius = 15.;
0046   double halfZ = 250.;
0047 
0048   // The transform of the 1st surface
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   // Generate the surfaces
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()