ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConeLayerTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ConeLayerTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2018 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
12 
21 
22 #include "LayerStub.hpp"
23 
24 using boost::test_tools::output_test_stream;
25 namespace utf = boost::unit_test;
26 
27 namespace Acts {
28 
29 namespace Test {
30 namespace Layers {
31 BOOST_AUTO_TEST_SUITE(Layers)
32 
33 
34 BOOST_AUTO_TEST_CASE(ConeLayerConstruction) {
35  // default constructor, copy and assignment are all deleted
36  // minimally need a Transform3D and a PlanarBounds object (e.g.
37  // ConeBounds) to construct
38  Translation3D translation{0., 1., 2.};
39  auto pTransform = std::make_shared<const Transform3D>(translation);
40  double alpha(M_PI / 8.0);
41  const bool symmetric(false);
42  auto pCone = std::make_shared<const ConeBounds>(alpha, symmetric);
43  // for some reason, this one doesnt exist
44  // auto pConeLayer = ConeLayer::create(pTransform, pCone);
45  // BOOST_CHECK_EQUAL(pConeLayer->layerType(), LayerType::passive);
46  // next level: need an array of Surfaces;
47  // bounds object, rectangle type
48  auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
50  std::shared_ptr<const Transform3D> pNullTransform{};
51  const std::vector<std::shared_ptr<const Surface>> aSurfaces{
52  Surface::makeShared<PlaneSurface>(pNullTransform, rBounds),
53  Surface::makeShared<PlaneSurface>(pNullTransform, rBounds)};
54  const double thickness(1.0);
55  auto pConeLayerFromSurfaces = ConeLayer::create(pTransform, pCone, nullptr);
56  BOOST_CHECK_EQUAL(pConeLayerFromSurfaces->layerType(), LayerType::active);
57  // construct with thickness:
58  auto pConeLayerWithThickness =
59  ConeLayer::create(pTransform, pCone, nullptr, thickness);
60  BOOST_CHECK_EQUAL(pConeLayerWithThickness->thickness(), thickness);
61  // with an approach descriptor...
62  std::unique_ptr<ApproachDescriptor> ad(
63  new GenericApproachDescriptor(aSurfaces));
64  auto adPtr = ad.get();
65  auto pConeLayerWithApproachDescriptor =
66  ConeLayer::create(pTransform, pCone, nullptr, thickness, std::move(ad));
67  BOOST_CHECK_EQUAL(pConeLayerWithApproachDescriptor->approachDescriptor(),
68  adPtr);
69  // with the layerType specified...
70  auto pConeLayerWithLayerType = ConeLayer::create(
71  pTransform, pCone, nullptr, thickness, std::move(ad), LayerType::passive);
72  BOOST_CHECK_EQUAL(pConeLayerWithLayerType->layerType(), LayerType::passive);
73 }
74 
76 BOOST_AUTO_TEST_CASE(ConeLayerProperties /*, *utf::expected_failures(1)*/) {
77  Translation3D translation{0., 1., 2.};
78  auto pTransform = std::make_shared<const Transform3D>(translation);
79  double alpha(M_PI / 8.0);
80  const bool symmetric(false);
81  // bounds object, rectangle type
82  auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
84  std::shared_ptr<const Transform3D> pNullTransform{};
85  auto pCone = std::make_shared<const ConeBounds>(alpha, symmetric);
86  const std::vector<std::shared_ptr<const Surface>> aSurfaces{
87  Surface::makeShared<PlaneSurface>(pNullTransform, rBounds),
88  Surface::makeShared<PlaneSurface>(pNullTransform, rBounds)};
89  // const double thickness(1.0);
90  auto pConeLayerFromSurfaces = ConeLayer::create(pTransform, pCone, nullptr);
91  // auto planeSurface = pConeLayer->surfaceRepresentation();
92  BOOST_CHECK_EQUAL(pConeLayerFromSurfaces->surfaceRepresentation().name(),
93  std::string("Acts::ConeSurface"));
94 }
95 
96 BOOST_AUTO_TEST_SUITE_END()
97 } // namespace Layers
98 } // namespace Test
99 
100 } // namespace Acts