Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MultiWireNavigationTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MultiWireNavigationTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2022-2023 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <boost/test/unit_test.hpp>
10 
25 
26 #include <fstream>
27 #include <memory>
28 #include <string>
29 #include <vector>
30 
31 using namespace Acts;
32 using namespace Acts::Experimental;
33 using namespace Acts::detail;
34 
36 
37 BOOST_AUTO_TEST_SUITE(Experimental)
38 
39 BOOST_AUTO_TEST_CASE(Navigation_in_Indexed_Surfaces) {
40  using GlobalBin = size_t;
41  using LocalBin = std::array<size_t, 2u>;
42 
43  std::vector<std::shared_ptr<Acts::Surface>> strawSurfaces = {};
44 
45  // Set the number of surfaces along each dimension of the multi wire structure
46  // aligned along z axis
47  std::size_t nSurfacesY = 4;
48  std::size_t nSurfacesX = 15;
49 
50  double radius = 15.;
51  double halfZ = 250.;
52 
53  // The transform of the 1st surface
54  Vector3 ipos = {-0.5 * nSurfacesX * 2 * radius + radius,
55  -0.5 * nSurfacesY * 2 * radius + radius, 0.};
56 
57  Vector3 pos = ipos;
58 
59  // Generate the surfaces
60  for (std::size_t i = 0; i < nSurfacesY; i++) {
61  for (std::size_t j = 0; j < nSurfacesX; j++) {
62  pos.x() = ipos.x() + 2 * j * radius;
63 
64  auto surface = Surface::makeShared<StrawSurface>(
65  Transform3(Translation3(pos)), radius, halfZ);
66 
67  strawSurfaces.push_back(surface);
68  }
69 
70  pos.y() = ipos.y() + 2 * (i + 1) * radius;
71  }
72 
73  std::vector<ActsScalar> vBounds = {0.5 * nSurfacesX * 2 * radius,
74  0.5 * nSurfacesY * 2 * radius, halfZ};
75 
77  mlCfg.name = "Multi_Layer_With_Wires";
78  mlCfg.mlSurfaces = strawSurfaces;
79 
80  mlCfg.mlBinning = {
81  ProtoBinning(Acts::binX, Acts::detail::AxisBoundaryType::Bound,
82  -vBounds[0], vBounds[0], nSurfacesX, 1u),
83  ProtoBinning(Acts::binY, Acts::detail::AxisBoundaryType::Bound,
84  -vBounds[1], vBounds[1], nSurfacesY, 0u)};
85  mlCfg.mlBounds = vBounds;
86 
87  MultiWireStructureBuilder mlBuilder(mlCfg);
88  auto [volumes, portals, roots] = mlBuilder.construct(tContext);
89 
91  nState.position = Acts::Vector3(0., -60., 0.);
92  nState.direction = Acts::Vector3(-1., 1., 0.);
93 
94  nState.currentVolume = volumes.front().get();
96 
97  // check the surface candidates after update (12 surfaces + 6 portals)
98  BOOST_CHECK(nState.surfaceCandidates.size() == 18u);
99 }
100 
101 BOOST_AUTO_TEST_SUITE_END()