Back to home page

EIC code displayed by LXR

 
 

    


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

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/ApproachDescriptor.hpp"
0013 #include "Acts/Geometry/DiscLayer.hpp"
0014 #include "Acts/Geometry/GenericApproachDescriptor.hpp"
0015 #include "Acts/Geometry/Layer.hpp"
0016 #include "Acts/Surfaces/DiscSurface.hpp"
0017 #include "Acts/Surfaces/PlaneSurface.hpp"
0018 #include "Acts/Surfaces/RadialBounds.hpp"
0019 #include "Acts/Surfaces/RectangleBounds.hpp"
0020 #include "Acts/Surfaces/Surface.hpp"
0021 #include "Acts/Surfaces/SurfaceArray.hpp"
0022 
0023 #include <memory>
0024 #include <string>
0025 #include <utility>
0026 #include <vector>
0027 
0028 namespace Acts::Test::Layers {
0029 
0030 BOOST_AUTO_TEST_SUITE(Layers)
0031 
0032 /// Unit test for creating compliant/non-compliant DiscLayer object
0033 BOOST_AUTO_TEST_CASE(DiscLayerConstruction) {
0034   // default constructor, copy and assignment are all deleted
0035   // minimally need a Transform3 and a PlanarBounds object (e.g.
0036   // RadialBounds) to construct
0037   Translation3 translation{0., 1., 2.};
0038   auto pTransform = Transform3(translation);
0039   const double minRad(5.), maxRad(10.);  // 20 x 10 disc
0040   auto pDisc = std::make_shared<const RadialBounds>(minRad, maxRad);
0041   auto pDiscLayer = DiscLayer::create(pTransform, pDisc, nullptr, 1.);
0042   BOOST_CHECK_EQUAL(pDiscLayer->layerType(), LayerType::passive);
0043   // next level: need an array of Surfaces;
0044   // bounds object, rectangle type
0045   auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
0046   /// Construction
0047   const std::vector<std::shared_ptr<const Surface>> aSurfaces{
0048       Surface::makeShared<PlaneSurface>(Transform3::Identity(), rBounds),
0049       Surface::makeShared<PlaneSurface>(Transform3::Identity(), rBounds)};
0050   const double thickness(1.0);
0051   auto pDiscLayerFromSurfaces =
0052       DiscLayer::create(pTransform, pDisc, nullptr, 1.);
0053   BOOST_CHECK_EQUAL(pDiscLayerFromSurfaces->layerType(), LayerType::passive);
0054   // construct with thickness:
0055   auto pDiscLayerWithThickness =
0056       DiscLayer::create(pTransform, pDisc, nullptr, thickness);
0057   BOOST_CHECK_EQUAL(pDiscLayerWithThickness->thickness(), thickness);
0058   // with an approach descriptor...
0059   std::unique_ptr<ApproachDescriptor> ad(
0060       new GenericApproachDescriptor(aSurfaces));
0061   auto adPtr = ad.get();
0062   auto pDiscLayerWithApproachDescriptor =
0063       DiscLayer::create(pTransform, pDisc, nullptr, thickness, std::move(ad));
0064   BOOST_CHECK_EQUAL(pDiscLayerWithApproachDescriptor->approachDescriptor(),
0065                     adPtr);
0066   // with the layerType specified...
0067   auto pDiscLayerWithLayerType = DiscLayer::create(
0068       pTransform, pDisc, nullptr, thickness, std::move(ad), LayerType::passive);
0069   BOOST_CHECK_EQUAL(pDiscLayerWithLayerType->layerType(), LayerType::passive);
0070 }
0071 
0072 /// Unit test for testing Layer properties
0073 BOOST_AUTO_TEST_CASE(DiscLayerProperties) {
0074   Translation3 translation{0., 1., 2.};
0075   auto pTransform = Transform3(translation);
0076   const double minRad(5.), maxRad(10.);  // 20 x 10 disc
0077   auto pDisc = std::make_shared<const RadialBounds>(minRad, maxRad);
0078   auto pDiscLayer = DiscLayer::create(pTransform, pDisc, nullptr, 1.);
0079   // auto planeSurface = pDiscLayer->surfaceRepresentation();
0080   BOOST_CHECK_EQUAL(pDiscLayer->surfaceRepresentation().name(),
0081                     std::string("Acts::DiscSurface"));
0082 }
0083 
0084 BOOST_AUTO_TEST_SUITE_END()
0085 
0086 }  // namespace Acts::Test::Layers