Back to home page

EIC code displayed by LXR

 
 

    


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

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 BOOST_AUTO_TEST_SUITE(Experimental)
0028 
0029 BOOST_AUTO_TEST_CASE(NavigationState) {
0030   // A navigation state struct
0031   Acts::Experimental::NavigationState nState;
0032   auto dTransform = Acts::Transform3::Identity();
0033 
0034   // A rectangle bound surface
0035   auto rectangle = std::make_shared<Acts::RectangleBounds>(10., 100.);
0036   auto surfaceA =
0037       Acts::Surface::makeShared<Acts::PlaneSurface>(dTransform, rectangle);
0038   auto surfaceB =
0039       Acts::Surface::makeShared<Acts::PlaneSurface>(dTransform, rectangle);
0040   auto surfaceC =
0041       Acts::Surface::makeShared<Acts::PlaneSurface>(dTransform, rectangle);
0042 
0043   // portal surfaces
0044   auto pSurfaceA =
0045       Acts::Surface::makeShared<Acts::PlaneSurface>(dTransform, rectangle);
0046   auto pSurfaceB =
0047       Acts::Surface::makeShared<Acts::PlaneSurface>(dTransform, rectangle);
0048 
0049   // Create a few fake portals out of it
0050   auto portalA = std::make_shared<Acts::Experimental::Portal>(pSurfaceA);
0051   auto portalB = std::make_shared<Acts::Experimental::Portal>(pSurfaceB);
0052 
0053   std::vector<const Acts::Surface*> surfaces = {surfaceA.get(), surfaceB.get(),
0054                                                 surfaceC.get()};
0055   std::vector<const Acts::Experimental::Portal*> portals = {portalA.get(),
0056                                                             portalB.get()};
0057 
0058   auto dVolume = std::make_unique<Acts::Experimental::DetectorVolume>();
0059   const auto volume = dVolume.get();
0060 
0061   Acts::Experimental::DetectorVolumeFiller::fill(nState, volume);
0062   BOOST_CHECK_EQUAL(nState.currentVolume, volume);
0063 
0064   Acts::Experimental::PortalsFiller::fill(nState, portals);
0065   BOOST_CHECK_EQUAL(nState.surfaceCandidates.size(), portals.size());
0066 
0067   Acts::Experimental::SurfacesFiller::fill(nState, surfaces);
0068   BOOST_CHECK_EQUAL(nState.surfaceCandidates.size(),
0069                     portals.size() + surfaces.size());
0070 }
0071 
0072 BOOST_AUTO_TEST_SUITE_END()