Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-13 07:59:15

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