Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SurfaceBinningMatcherTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SurfaceBinningMatcherTests.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/unit_test.hpp>
11 
19 
20 #include <cmath>
21 #include <memory>
22 #include <vector>
23 
24 #include <boost/format.hpp>
25 
26 namespace Acts {
27 
28 namespace Test {
29 
30 // Create a test context
32 
33 BOOST_AUTO_TEST_CASE(PlaneSurfaceMatcher) {
34  auto identity = Transform3::Identity();
35 
36  double rMin = 5.;
37  double rMax = 10.;
38  double rMinTol = 0.1;
39  double rMaxTol = 0.5;
40 
41  double phiTol = 0.1;
42 
43  auto oneBounds = std::make_shared<RadialBounds>(rMin, rMax, M_PI / 16, 0.);
44  auto oneSurface = Surface::makeShared<DiscSurface>(identity, oneBounds);
45 
46  auto otherBounds =
47  std::make_shared<RadialBounds>(2 * rMax, 4 * rMax, M_PI / 16, 0.5 * M_PI);
48  auto otherSurface = Surface::makeShared<DiscSurface>(identity, otherBounds);
49 
50  auto similarRbounds = std::make_shared<RadialBounds>(
51  rMin - 0.5 * rMinTol, rMax + 0.5 * rMaxTol, M_PI / 16, 0.5 * M_PI);
52  auto similarRSurface =
53  Surface::makeShared<DiscSurface>(identity, similarRbounds);
54 
55  auto similarPhiBounds =
56  std::make_shared<RadialBounds>(0.25 * rMin, 0.5 * rMin, M_PI / 16, 0.);
57  auto similarPhiSurface =
58  Surface::makeShared<DiscSurface>(identity, similarPhiBounds);
59 
61  sbm.tolerances[binR] = {rMinTol, rMaxTol};
62  sbm.tolerances[binPhi] = {phiTol, phiTol};
63 
64  // Always true
65  for (int ib = 0; ib < binValues; ++ib) {
66  BOOST_CHECK(
67  sbm(tgContext, (BinningValue)ib, oneSurface.get(), oneSurface.get()));
68  }
69  // Not matching in R
70  BOOST_CHECK(!sbm(tgContext, binR, oneSurface.get(), otherSurface.get()));
71  // Not matching in phi
72  BOOST_CHECK(!sbm(tgContext, binPhi, oneSurface.get(), otherSurface.get()));
73 
74  // Good enough matching in R
75  BOOST_CHECK(sbm(tgContext, binR, oneSurface.get(), similarRSurface.get()));
76  // Good enough matching in phi
77  BOOST_CHECK(
78  sbm(tgContext, binPhi, oneSurface.get(), similarPhiSurface.get()));
79 }
80 
81 } // namespace Test
82 
83 } // namespace Acts