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 
20 
21 #include "LayerStub.hpp"
22 
23 using boost::test_tools::output_test_stream;
24 namespace utf = boost::unit_test;
25 
26 namespace Acts {
27 
28 namespace Test {
29 namespace Layers {
30 BOOST_AUTO_TEST_SUITE(Layers)
31 
32 
33 BOOST_AUTO_TEST_CASE(ConeLayerConstruction) {
34  // default constructor, copy and assignment are all deleted
35  // minimally need a Transform3D and a PlanarBounds object (e.g.
36  // ConeBounds) to construct
37  Translation3D translation{0., 1., 2.};
38  auto pTransform = Transform3D(translation);
39  double alpha(M_PI / 8.0);
40  const bool symmetric(false);
41  auto pCone = std::make_shared<const ConeBounds>(alpha, symmetric);
42  // for some reason, this one doesnt exist
43  // auto pConeLayer = ConeLayer::create(pTransform, pCone);
44  // BOOST_CHECK_EQUAL(pConeLayer->layerType(), LayerType::passive);
45  // next level: need an array of Surfaces;
46  // bounds object, rectangle type
47  auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
49  const std::vector<std::shared_ptr<const Surface>> aSurfaces{
50  Surface::makeShared<PlaneSurface>(Transform3D::Identity(), rBounds),
51  Surface::makeShared<PlaneSurface>(Transform3D::Identity(), rBounds)};
52  const double thickness(1.0);
53  auto pConeLayerFromSurfaces = ConeLayer::create(pTransform, pCone, nullptr);
54  BOOST_CHECK_EQUAL(pConeLayerFromSurfaces->layerType(), LayerType::active);
55  // construct with thickness:
56  auto pConeLayerWithThickness =
57  ConeLayer::create(pTransform, pCone, nullptr, thickness);
58  BOOST_CHECK_EQUAL(pConeLayerWithThickness->thickness(), thickness);
59  // with an approach descriptor...
60  std::unique_ptr<ApproachDescriptor> ad(
61  new GenericApproachDescriptor(aSurfaces));
62  auto adPtr = ad.get();
63  auto pConeLayerWithApproachDescriptor =
64  ConeLayer::create(pTransform, pCone, nullptr, thickness, std::move(ad));
65  BOOST_CHECK_EQUAL(pConeLayerWithApproachDescriptor->approachDescriptor(),
66  adPtr);
67  // with the layerType specified...
68  auto pConeLayerWithLayerType = ConeLayer::create(
69  pTransform, pCone, nullptr, thickness, std::move(ad), LayerType::passive);
70  BOOST_CHECK_EQUAL(pConeLayerWithLayerType->layerType(), LayerType::passive);
71 }
72 
73 BOOST_AUTO_TEST_SUITE_END()
74 } // namespace Layers
75 } // namespace Test
76 
77 } // namespace Acts