Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TransformBoundToFreeTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TransformBoundToFreeTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 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 <algorithm>
21 #include <limits>
22 #include <utility>
23 #include <vector>
24 
26 
27 using namespace Acts;
28 using namespace Acts::UnitLiterals;
29 
30 namespace {
31 constexpr auto eps = std::numeric_limits<ActsScalar>::epsilon();
32 }
33 
34 BOOST_AUTO_TEST_SUITE(TransformBoundToFree)
35 
37  Parameters,
38  surfaces* posSymmetric* posSymmetric* ts* phis* thetas* ps* qsNonZero,
39  surface, l0, l1, time, phi, theta, p, q) {
41 
42  Vector2 loc(l0, l1);
43  Vector3 dir = makeDirectionFromPhiTheta(phi, theta);
44  // transform reference position
45  Vector3 pos = surface->localToGlobal(geoCtx, loc, dir);
46 
47  const auto qOverP = q / p;
48 
49  // construct bound parameters
50  BoundVector bv = BoundVector::Zero();
51  bv[eBoundLoc0] = l0;
52  bv[eBoundLoc1] = l1;
53  bv[eBoundTime] = time;
54  bv[eBoundPhi] = phi;
55  bv[eBoundTheta] = theta;
56  bv[eBoundQOverP] = qOverP;
57 
58  // convert to free parameters
59  FreeVector fv = detail::transformBoundToFreeParameters(*surface, geoCtx, bv);
60 
61  CHECK_CLOSE_OR_SMALL(fv.segment<3>(eFreePos0), pos, eps, eps);
63  CHECK_CLOSE_REL(fv.segment<3>(eFreeDir0).norm(), 1, eps);
64  CHECK_CLOSE_OR_SMALL(fv.segment<3>(eFreeDir0), dir, eps, eps);
66 }
67 
68 BOOST_AUTO_TEST_SUITE_END()