EIC 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 
17 
18 #include <boost/format.hpp>
19 
20 namespace Acts {
21 
22 namespace Test {
23 
24 // Create a test context
26 
27 BOOST_AUTO_TEST_CASE(PlaneSurfaceMatcher) {
28  auto identity = Transform3D::Identity();
29 
30  double rMin = 5.;
31  double rMax = 10.;
32  double rMinTol = 0.1;
33  double rMaxTol = 0.5;
34 
35  double phiTol = 0.1;
36 
37  auto oneBounds = std::make_shared<RadialBounds>(rMin, rMax, M_PI / 16, 0.);
38  auto oneSurface = Surface::makeShared<DiscSurface>(identity, oneBounds);
39 
40  auto otherBounds =
41  std::make_shared<RadialBounds>(2 * rMax, 4 * rMax, M_PI / 16, 0.5 * M_PI);
42  auto otherSurface = Surface::makeShared<DiscSurface>(identity, otherBounds);
43 
44  auto similarRbounds = std::make_shared<RadialBounds>(
45  rMin - 0.5 * rMinTol, rMax + 0.5 * rMaxTol, M_PI / 16, 0.5 * M_PI);
46  auto similarRSurface =
47  Surface::makeShared<DiscSurface>(identity, similarRbounds);
48 
49  auto similarPhiBounds =
50  std::make_shared<RadialBounds>(0.25 * rMin, 0.5 * rMin, M_PI / 16, 0.);
51  auto similarPhiSurface =
52  Surface::makeShared<DiscSurface>(identity, similarPhiBounds);
53 
55  sbm.tolerances[binR] = {rMinTol, rMaxTol};
56  sbm.tolerances[binPhi] = {phiTol, phiTol};
57 
58  // Always true
59  for (int ib = 0; ib < binValues; ++ib) {
60  BOOST_CHECK(
61  sbm(tgContext, (BinningValue)ib, oneSurface.get(), oneSurface.get()));
62  }
63  // Not matching in R
64  BOOST_CHECK(!sbm(tgContext, binR, oneSurface.get(), otherSurface.get()));
65  // Not matching in phi
66  BOOST_CHECK(!sbm(tgContext, binPhi, oneSurface.get(), otherSurface.get()));
67 
68  // Good enough matching in R
69  BOOST_CHECK(sbm(tgContext, binR, oneSurface.get(), similarRSurface.get()));
70  // Good enough matching in phi
71  BOOST_CHECK(
72  sbm(tgContext, binPhi, oneSurface.get(), similarPhiSurface.get()));
73 }
74 
75 } // namespace Test
76 
77 } // namespace Acts