Back to home page

EIC code displayed by LXR

 
 

    


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

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/Detector.hpp"
0013 #include "Acts/Detector/DetectorVolume.hpp"
0014 #include "Acts/Detector/MultiWireStructureBuilder.hpp"
0015 #include "Acts/Navigation/DetectorVolumeFinders.hpp"
0016 #include "Acts/Navigation/InternalNavigation.hpp"
0017 #include "Acts/Navigation/NavigationState.hpp"
0018 #include "Acts/Navigation/NavigationStateFillers.hpp"
0019 #include "Acts/Navigation/NavigationStateUpdaters.hpp"
0020 #include "Acts/Surfaces/RectangleBounds.hpp"
0021 #include "Acts/Surfaces/StrawSurface.hpp"
0022 #include "Acts/Surfaces/Surface.hpp"
0023 #include "Acts/Utilities/Grid.hpp"
0024 #include "Acts/Utilities/VectorHelpers.hpp"
0025 
0026 #include <fstream>
0027 #include <memory>
0028 #include <string>
0029 #include <vector>
0030 
0031 using namespace Acts;
0032 using namespace Acts::Experimental;
0033 using namespace Acts::detail;
0034 
0035 GeometryContext tContext;
0036 
0037 BOOST_AUTO_TEST_SUITE(Experimental)
0038 
0039 BOOST_AUTO_TEST_CASE(Navigation_in_Indexed_Surfaces) {
0040   std::vector<std::shared_ptr<Acts::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 = 4;
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 
0054   Vector3 pos = ipos;
0055 
0056   // Generate the surfaces
0057   for (std::size_t i = 0; i < nSurfacesY; i++) {
0058     for (std::size_t j = 0; j < nSurfacesX; j++) {
0059       pos.x() = ipos.x() + 2 * j * radius;
0060 
0061       auto surface = Surface::makeShared<StrawSurface>(
0062           Transform3(Translation3(pos)), radius, halfZ);
0063 
0064       strawSurfaces.push_back(surface);
0065     }
0066 
0067     pos.y() = ipos.y() + 2 * (i + 1) * radius;
0068   }
0069 
0070   std::vector<double> vBounds = {0.5 * nSurfacesX * 2 * radius,
0071                                  0.5 * nSurfacesX * 2 * radius,
0072                                  0.5 * nSurfacesY * 2 * radius, halfZ};
0073 
0074   MultiWireStructureBuilder::Config mlCfg;
0075   mlCfg.name = "Multi_Layer_With_Wires";
0076   mlCfg.mlSurfaces = strawSurfaces;
0077 
0078   mlCfg.mlBinning = {
0079       ProtoBinning(Acts::AxisDirection::AxisX, Acts::AxisBoundaryType::Bound,
0080                    -vBounds[0], vBounds[0], nSurfacesX, 1u),
0081       ProtoBinning(Acts::AxisDirection::AxisY, Acts::AxisBoundaryType::Bound,
0082                    -vBounds[1], vBounds[1], nSurfacesY, 0u)};
0083   mlCfg.mlBounds = vBounds;
0084 
0085   MultiWireStructureBuilder mlBuilder(mlCfg);
0086   auto [volumes, portals, roots] = mlBuilder.construct(tContext);
0087 
0088   Acts::Experimental::NavigationState nState;
0089   nState.position = Acts::Vector3(0., -60., 0.);
0090   nState.direction = Acts::Vector3(0., 1., 0.);
0091 
0092   nState.currentVolume = volumes.front().get();
0093   nState.currentVolume->updateNavigationState(tContext, nState);
0094 
0095   // check the surface candidates after update (12 surfaces + 6 portals but only
0096   // 5 are reachable, but one excluded due to new > s_onTolerance rule)
0097   BOOST_CHECK_EQUAL(nState.surfaceCandidates.size(), 4u);
0098 }
0099 
0100 BOOST_AUTO_TEST_SUITE_END()