Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:11:20

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2017-2018 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #include <boost/test/data/test_case.hpp>
0010 #include <boost/test/tools/output_test_stream.hpp>
0011 #include <boost/test/unit_test.hpp>
0012 
0013 #include "Acts/Definitions/Algebra.hpp"
0014 #include "Acts/Geometry/ApproachDescriptor.hpp"
0015 #include "Acts/Geometry/ConeLayer.hpp"
0016 #include "Acts/Geometry/GenericApproachDescriptor.hpp"
0017 #include "Acts/Geometry/Layer.hpp"
0018 #include "Acts/Surfaces/ConeBounds.hpp"
0019 #include "Acts/Surfaces/PlaneSurface.hpp"
0020 #include "Acts/Surfaces/RectangleBounds.hpp"
0021 #include "Acts/Surfaces/Surface.hpp"
0022 #include "Acts/Surfaces/SurfaceArray.hpp"
0023 
0024 #include <cmath>
0025 #include <memory>
0026 #include <utility>
0027 #include <vector>
0028 
0029 namespace Acts {
0030 namespace Test {
0031 namespace Layers {
0032 BOOST_AUTO_TEST_SUITE(Layers)
0033 
0034 /// Unit test for creating compliant/non-compliant ConeLayer object
0035 BOOST_AUTO_TEST_CASE(ConeLayerConstruction) {
0036   // default constructor, copy and assignment are all deleted
0037   // minimally need a Transform3 and a PlanarBounds object (e.g.
0038   // ConeBounds) to construct
0039   Translation3 translation{0., 1., 2.};
0040   auto pTransform = Transform3(translation);
0041   double alpha(M_PI / 8.0);
0042   const bool symmetric(false);
0043   auto pCone = std::make_shared<const ConeBounds>(alpha, symmetric);
0044   // for some reason, this one doesn't exist
0045   // auto         pConeLayer = ConeLayer::create(pTransform, pCone);
0046   // BOOST_CHECK_EQUAL(pConeLayer->layerType(), LayerType::passive);
0047   // next level: need an array of Surfaces;
0048   // bounds object, rectangle type
0049   auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
0050   /// Constructor with transform pointer
0051   const std::vector<std::shared_ptr<const Surface>> aSurfaces{
0052       Surface::makeShared<PlaneSurface>(Transform3::Identity(), rBounds),
0053       Surface::makeShared<PlaneSurface>(Transform3::Identity(), rBounds)};
0054   const double thickness(1.0);
0055   auto pConeLayerFromSurfaces = ConeLayer::create(pTransform, pCone, nullptr);
0056   BOOST_CHECK_EQUAL(pConeLayerFromSurfaces->layerType(), LayerType::active);
0057   // construct with thickness:
0058   auto pConeLayerWithThickness =
0059       ConeLayer::create(pTransform, pCone, nullptr, thickness);
0060   BOOST_CHECK_EQUAL(pConeLayerWithThickness->thickness(), thickness);
0061   // with an approach descriptor...
0062   std::unique_ptr<ApproachDescriptor> ad(
0063       new GenericApproachDescriptor(aSurfaces));
0064   auto adPtr = ad.get();
0065   auto pConeLayerWithApproachDescriptor =
0066       ConeLayer::create(pTransform, pCone, nullptr, thickness, std::move(ad));
0067   BOOST_CHECK_EQUAL(pConeLayerWithApproachDescriptor->approachDescriptor(),
0068                     adPtr);
0069   // with the layerType specified...
0070   auto pConeLayerWithLayerType = ConeLayer::create(
0071       pTransform, pCone, nullptr, thickness, std::move(ad), LayerType::passive);
0072   BOOST_CHECK_EQUAL(pConeLayerWithLayerType->layerType(), LayerType::passive);
0073 }
0074 
0075 BOOST_AUTO_TEST_SUITE_END()
0076 }  // namespace Layers
0077 }  // namespace Test
0078 }  // namespace Acts