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