Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NavigationStateTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file NavigationStateTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2022 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 
12 #include "Acts/Detector/Portal.hpp"
19 
20 #include <memory>
21 #include <vector>
22 
23 // A test context
25 
26 namespace Acts {
27 namespace Experimental {
29 class DetectorVolume {};
30 } // namespace Experimental
31 } // namespace Acts
32 
33 BOOST_AUTO_TEST_SUITE(Experimental)
34 
35 BOOST_AUTO_TEST_CASE(NavigationState) {
36  // A navigation state struct
38  auto dTransform = Acts::Transform3::Identity();
39 
40  // A rectangle bound surface
41  auto rectangle = std::make_shared<Acts::RectangleBounds>(10., 100.);
42  auto surfaceA =
43  Acts::Surface::makeShared<Acts::PlaneSurface>(dTransform, rectangle);
44  auto surfaceB =
45  Acts::Surface::makeShared<Acts::PlaneSurface>(dTransform, rectangle);
46  auto surfaceC =
47  Acts::Surface::makeShared<Acts::PlaneSurface>(dTransform, rectangle);
48 
49  // portal surfaces
50  auto pSurfaceA =
51  Acts::Surface::makeShared<Acts::PlaneSurface>(dTransform, rectangle);
52  auto pSurfaceB =
53  Acts::Surface::makeShared<Acts::PlaneSurface>(dTransform, rectangle);
54 
55  // Create a few fake portals out of it
58 
59  std::vector<const Acts::Surface*> surfaces = {surfaceA.get(), surfaceB.get(),
60  surfaceC.get()};
61  std::vector<const Acts::Experimental::Portal*> portals = {portalA.get(),
62  portalB.get()};
63 
64  auto dVolume = std::make_unique<Acts::Experimental::DetectorVolume>();
65  const auto volume = dVolume.get();
66 
68  BOOST_CHECK(nState.currentVolume == volume);
69 
71  BOOST_CHECK(nState.surfaceCandidates.size() == portals.size());
72 
74  BOOST_CHECK(nState.surfaceCandidates.size() ==
75  portals.size() + surfaces.size());
76 }
77 
78 BOOST_AUTO_TEST_SUITE_END()