Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-13 08:18:50

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/Geometry/GeometryContext.hpp"
0013 #include "Acts/Geometry/Layer.hpp"
0014 #include "Acts/Geometry/NavigationLayer.hpp"
0015 #include "Acts/Surfaces/Surface.hpp"
0016 #include "Acts/Utilities/BinningType.hpp"
0017 
0018 #include <cmath>
0019 #include <memory>
0020 #include <utility>
0021 
0022 #include "../Surfaces/SurfaceStub.hpp"
0023 
0024 using namespace Acts;
0025 
0026 GeometryContext tgContext = GeometryContext();
0027 
0028 namespace ActsTests {
0029 
0030 BOOST_AUTO_TEST_SUITE(GeometrySuite)
0031 
0032 /// Unit test for creating compliant/non-compliant NavigationLayer object
0033 BOOST_AUTO_TEST_CASE(NavigationLayerConstruction) {
0034   // default constructor, copy and assignment are all deleted
0035   std::shared_ptr<const Surface> pSurface = Surface::makeShared<SurfaceStub>();
0036   auto pNavigationLayer = NavigationLayer::create(std::move(pSurface));
0037   BOOST_CHECK_EQUAL(pNavigationLayer->layerType(), LayerType::navigation);
0038   // next level: with thickness
0039   const double thickness = 0.1;
0040   auto pSurface2 = Surface::makeShared<SurfaceStub>();
0041   auto pThickNavigationLayer =
0042       NavigationLayer::create(std::move(pSurface2), thickness);
0043   BOOST_CHECK_EQUAL(pThickNavigationLayer->layerType(), LayerType::navigation);
0044 }
0045 
0046 /// Unit test for testing NavigationLayer properties
0047 BOOST_AUTO_TEST_CASE(NavigationLayerProperties) {
0048   const double thickness = 0.1;
0049   std::shared_ptr<const Surface> pSurface = Surface::makeShared<SurfaceStub>();
0050   auto rawSurfacePtr = pSurface.get();
0051   auto pNavigationLayer =
0052       NavigationLayer::create(std::move(pSurface), thickness);
0053   AxisDirection b{AxisDirection::AxisZ};
0054   Vector3 origin{0., 0., 0.};
0055   // referencePosition(), needs a better test
0056   BOOST_CHECK_EQUAL(pNavigationLayer->referencePosition(tgContext, b), origin);
0057   // surfaceRepresentation() [looks dangerous]
0058   BOOST_CHECK_EQUAL(rawSurfacePtr,
0059                     &(pNavigationLayer->surfaceRepresentation()));
0060   // isOnLayer()
0061   BOOST_CHECK(pNavigationLayer->isOnLayer(tgContext, origin,
0062                                           BoundaryTolerance::None()));
0063   // isOnLayer()
0064   Vector3 crazyPosition{1000., 10000., std::nan("")};
0065   // layer stub has hard-coded globalToLocal return value
0066   BOOST_CHECK(pNavigationLayer->isOnLayer(tgContext, crazyPosition,
0067                                           BoundaryTolerance::None()));
0068   // resolve()
0069   BOOST_CHECK(!pNavigationLayer->resolve(true, true, true));
0070 }
0071 
0072 BOOST_AUTO_TEST_SUITE_END()
0073 
0074 }  // namespace ActsTests