Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-03 08:58:51

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/Portal.hpp"
0013 #include "Acts/Navigation/NavigationState.hpp"
0014 #include "Acts/Navigation/NavigationStateFillers.hpp"
0015 #include "Acts/Surfaces/PlaneSurface.hpp"
0016 #include "Acts/Surfaces/RectangleBounds.hpp"
0017 #include "Acts/Surfaces/Surface.hpp"
0018 
0019 #include <memory>
0020 #include <vector>
0021 
0022 namespace Acts::Experimental {
0023 /// Define a dummy detector volume
0024 class DetectorVolume {};
0025 }  // namespace Acts::Experimental
0026 
0027 using namespace Acts;
0028 
0029 namespace ActsTests {
0030 
0031 BOOST_AUTO_TEST_SUITE(NavigationSuite)
0032 
0033 BOOST_AUTO_TEST_CASE(NavigationState) {
0034   // A navigation state struct
0035   Experimental::NavigationState nState;
0036   auto dTransform = Transform3::Identity();
0037 
0038   // A rectangle bound surface
0039   auto rectangle = std::make_shared<RectangleBounds>(10., 100.);
0040   auto surfaceA = Surface::makeShared<PlaneSurface>(dTransform, rectangle);
0041   auto surfaceB = Surface::makeShared<PlaneSurface>(dTransform, rectangle);
0042   auto surfaceC = Surface::makeShared<PlaneSurface>(dTransform, rectangle);
0043 
0044   // portal surfaces
0045   auto pSurfaceA = Surface::makeShared<PlaneSurface>(dTransform, rectangle);
0046   auto pSurfaceB = Surface::makeShared<PlaneSurface>(dTransform, rectangle);
0047 
0048   // Create a few fake portals out of it
0049   auto portalA = std::make_shared<Experimental::Portal>(pSurfaceA);
0050   auto portalB = std::make_shared<Experimental::Portal>(pSurfaceB);
0051 
0052   std::vector<const Surface*> surfaces = {surfaceA.get(), surfaceB.get(),
0053                                           surfaceC.get()};
0054   std::vector<const Experimental::Portal*> portals = {portalA.get(),
0055                                                       portalB.get()};
0056 
0057   auto dVolume = std::make_unique<Experimental::DetectorVolume>();
0058   const auto volume = dVolume.get();
0059 
0060   Experimental::DetectorVolumeFiller::fill(nState, volume);
0061   BOOST_CHECK_EQUAL(nState.currentVolume, volume);
0062 
0063   Experimental::PortalsFiller::fill(nState, portals);
0064   BOOST_CHECK_EQUAL(nState.surfaceCandidates.size(), portals.size());
0065 
0066   Experimental::SurfacesFiller::fill(nState, surfaces);
0067   BOOST_CHECK_EQUAL(nState.surfaceCandidates.size(),
0068                     portals.size() + surfaces.size());
0069 }
0070 
0071 BOOST_AUTO_TEST_SUITE_END()
0072 
0073 }  // namespace ActsTests