diff --git a/Core/include/ACTS/Layers/GenericApproachDescriptor.hpp b/Core/include/ACTS/Layers/GenericApproachDescriptor.hpp index 7224e5a4d33973acb1fed299e989de887a1ff4e9..a649466748e11efd204450cb70a7aeac5124180f 100644 --- a/Core/include/ACTS/Layers/GenericApproachDescriptor.hpp +++ b/Core/include/ACTS/Layers/GenericApproachDescriptor.hpp @@ -44,7 +44,7 @@ public: } /// A generic approach descriptor with shared surfaces to test - /// can not be sed with Acts::Surfaces obejcts + /// can not be used with Acts::Surfaces objects /// /// @param aSurfaces are the approach surfaces GenericApproachDescriptor(std::vector<std::shared_ptr<const T>> aSurfaces) @@ -67,9 +67,9 @@ public: /// get the compatible surfaces /// - /// @param gpos is the global posoition to start the approach from + /// @param gpos is the global position to start the approach from /// @param dir is the direction in which you approach the layer - /// @param bcheck is the boundary check presrcition + /// @param bcheck is the boundary check prescription /// @param ice is a (future) compatibility estimater if needed /// /// @return : a boolean indicating if an actual intersection had been tried diff --git a/Core/include/ACTS/Layers/NavigationLayer.hpp b/Core/include/ACTS/Layers/NavigationLayer.hpp index eafd687022559ea8a2dbf838f8540cfd4eabe752..32f4effea8a1f29fcb99e279556970dbf317f0b4 100644 --- a/Core/include/ACTS/Layers/NavigationLayer.hpp +++ b/Core/include/ACTS/Layers/NavigationLayer.hpp @@ -77,7 +77,7 @@ public: /// @param gpos is the global position for the check /// @param bcheck is the boundary check directive /// - /// @return boolean that indicates if the poisiton is on surface + /// @return boolean that indicates if the position is on surface bool isOnLayer(const Vector3D& gpos, const BoundaryCheck& bcheck = true) const final override; diff --git a/Tests/Layers/CMakeLists.txt b/Tests/Layers/CMakeLists.txt index 984dc048262f03f8680f69fe3be8b30da7b67134..b12be181086ae8ce6fc07613c06c9afa549e46b4 100644 --- a/Tests/Layers/CMakeLists.txt +++ b/Tests/Layers/CMakeLists.txt @@ -14,4 +14,8 @@ add_executable (CylinderLayerTests CylinderLayerTests.cpp) target_link_libraries (CylinderLayerTests PRIVATE ACTSCore) add_test (NAME CylinderLayerTests COMMAND CylinderLayerTests) +add_executable (ConeLayerTests ConeLayerTests.cpp) +target_link_libraries (ConeLayerTests PRIVATE ACTSCore) +add_test (NAME ConeLayerTests COMMAND ConeLayerTests) + diff --git a/Tests/Layers/ConeLayerTests.cpp b/Tests/Layers/ConeLayerTests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cae1fbe98084d4503eff9b1dd9c20e3735efe95d --- /dev/null +++ b/Tests/Layers/ConeLayerTests.cpp @@ -0,0 +1,116 @@ +// This file is part of the ACTS project. +// +// Copyright (C) 2016 ACTS project team +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#define BOOST_TEST_MODULE Layer Tests + +#include <boost/test/included/unit_test.hpp> +// leave blank line + +#include <boost/test/data/test_case.hpp> +// leave blank line + +#include <boost/test/output_test_stream.hpp> +// leave blank line + +//#include <limits> +#include "ACTS/Layers/ConeLayer.hpp" +#include "ACTS/Surfaces/ConeBounds.hpp" +//#include "ACTS/Utilities/Definitions.hpp" +#include "ACTS/EventData/SingleTrackParameters.hpp" +#include "ACTS/Layers/GenericApproachDescriptor.hpp" +#include "ACTS/Tools/SurfaceArrayCreator.hpp" +#include "ACTS/Volumes/CuboidVolumeBounds.hpp" +#include "LayerStub.hpp" + +using boost::test_tools::output_test_stream; +namespace utf = boost::unit_test; + +namespace Acts { + +namespace Test { + namespace Layers { + BOOST_AUTO_TEST_SUITE(Layers); + + /// Unit test for creating compliant/non-compliant ConeLayer object + BOOST_AUTO_TEST_CASE(ConeLayerConstruction) + { + // default constructor, copy and assignment are all deleted + // minimally need a Transform3D and a PlanarBounds object (e.g. + // ConeBounds) to construct + Translation3D translation{0., 1., 2.}; + auto pTransform = std::make_shared<const Transform3D>(translation); + double alpha(M_PI / 8.0); + const bool symmetric(false); + auto pCone = std::make_shared<const ConeBounds>(alpha, symmetric); + //for some reason, this one doesnt exist + //auto pConeLayer = ConeLayer::create(pTransform, pCone); + //BOOST_TEST(pConeLayer->layerType() == LayerType::passive); + // next level: need an array of Surfaces; + const std::vector<const Surface*> aSurfaces{new SurfaceStub(), + new SurfaceStub()}; + const double thickness(1.0); + SurfaceArrayCreator sac; + size_t binsX(2), binsY(4); + auto pSurfaceArray + = sac.surfaceArrayOnPlane(aSurfaces, 10, 20, binsX, binsY); + auto pConeLayerFromSurfaces + = ConeLayer::create(pTransform, pCone, std::move(pSurfaceArray)); + BOOST_TEST(pConeLayerFromSurfaces->layerType() == LayerType::active); + // construct with thickness: + auto pConeLayerWithThickness = ConeLayer::create( + pTransform, pCone, std::move(pSurfaceArray), thickness); + BOOST_TEST(pConeLayerWithThickness->thickness() == thickness); + // with an approach descriptor... + std::unique_ptr<ApproachDescriptor> ad( + new GenericApproachDescriptor<Surface>(aSurfaces)); + auto adPtr = ad.get(); + auto pConeLayerWithApproachDescriptor + = ConeLayer::create(pTransform, + pCone, + std::move(pSurfaceArray), + thickness, + std::move(ad)); + BOOST_TEST(pConeLayerWithApproachDescriptor->approachDescriptor() + == adPtr); + // with the layerType specified... + auto pConeLayerWithLayerType = ConeLayer::create(pTransform, + pCone, + std::move(pSurfaceArray), + thickness, + std::move(ad), + LayerType::passive); + BOOST_TEST(pConeLayerWithLayerType->layerType() == LayerType::passive); + } + + /// Unit test for testing Layer properties + BOOST_AUTO_TEST_CASE(LayerProperties /*, *utf::expected_failures(1)*/) + { + Translation3D translation{0., 1., 2.}; + auto pTransform = std::make_shared<const Transform3D>(translation); + double alpha(M_PI / 8.0); + const bool symmetric(false); + auto pCone = std::make_shared<const ConeBounds>(alpha, symmetric); + const std::vector<const Surface*> aSurfaces{new SurfaceStub(), + new SurfaceStub()}; + //const double thickness(1.0); + SurfaceArrayCreator sac; + size_t binsX(2), binsY(4); + auto pSurfaceArray + = sac.surfaceArrayOnPlane(aSurfaces, 10, 20, binsX, binsY); + auto pConeLayerFromSurfaces + = ConeLayer::create(pTransform, pCone, std::move(pSurfaceArray)); + // auto planeSurface = pConeLayer->surfaceRepresentation(); + BOOST_TEST(pConeLayerFromSurfaces->surfaceRepresentation().name() + == std::string("Acts::ConeSurface")); + } + + BOOST_AUTO_TEST_SUITE_END(); + } // end of namespace Layers +} // end of namespace Test + +} // end of namespace Acts