Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MultiWireStructureBuilderTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MultiWireStructureBuilderTests.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 
21 
22 #include <algorithm>
23 #include <iterator>
24 #include <memory>
25 #include <utility>
26 #include <vector>
27 
28 using namespace Acts;
29 using namespace Acts::Experimental;
30 
32 
33 BOOST_AUTO_TEST_SUITE(Detector)
34 
35 BOOST_AUTO_TEST_CASE(Multi_Wire_Structure_Builder_StrawSurfacesCreation) {
36  // Create the surfaces of the multiwire structure-straw surfaces
37  std::vector<std::shared_ptr<Acts::Surface>> strawSurfaces = {};
38 
39  // Set the number of surfaces along each dimension of the multi wire structure
40  // aligned along z axis
41  std::size_t nSurfacesY = 3;
42  std::size_t nSurfacesX = 15;
43 
44  double radius = 15.;
45  double halfZ = 250.;
46 
47  // The transform of the 1st surface
48  Vector3 ipos = {-0.5 * nSurfacesX * 2 * radius + radius,
49  -0.5 * nSurfacesY * 2 * radius + radius, 0.};
50  AngleAxis3 rotation(M_PI / 2, Acts::Vector3(0., 1., 0.));
51 
52  Vector3 pos = ipos;
53 
54  // Generate the surfaces
55  for (std::size_t i = 0; i < nSurfacesY; i++) {
56  for (std::size_t j = 0; j < nSurfacesX; j++) {
57  auto surface = Surface::makeShared<StrawSurface>(
58  Transform3(Translation3(pos)), radius, halfZ);
59  strawSurfaces.push_back(surface);
60  pos.x() = ipos.x() + 2 * j * radius;
61  pos.y() = ipos.y() + 2 * i * radius;
62  }
63  }
64 
65  std::vector<ActsScalar> vBounds = {0.5 * nSurfacesX * 2 * radius,
66  0.5 * nSurfacesY * 2 * radius, halfZ};
67 
69  mlCfg.name = "Multi_Layer_With_Wires";
70  mlCfg.mlSurfaces = strawSurfaces;
71  mlCfg.mlBounds = vBounds;
72  mlCfg.mlBinning = {
73  ProtoBinning(Acts::binX, Acts::detail::AxisBoundaryType::Bound,
74  -vBounds[0], vBounds[0], nSurfacesX, 1u),
75  ProtoBinning(Acts::binY, Acts::detail::AxisBoundaryType::Bound,
76  -vBounds[1], vBounds[1], nSurfacesY, 0u)};
77 
78  MultiWireStructureBuilder mlBuilder(mlCfg);
79  auto [volumes, portals, roots] = mlBuilder.construct(tContext);
80 
81  BOOST_CHECK(volumes.size() == 1u);
82  BOOST_CHECK(volumes.front()->surfaces().size() == nSurfacesX * nSurfacesY);
83  BOOST_CHECK(volumes.front()->volumes().empty());
84  BOOST_CHECK(volumes.front()->surfaceCandidatesUpdator().connected());
85 }
86 
87 BOOST_AUTO_TEST_SUITE_END()