EIC 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 
15 #include "Acts/Utilities/Units.hpp"
16 
17 #include <cmath>
18 #include <limits>
19 
21 
22 using namespace Acts;
23 using namespace Acts::UnitLiterals;
24 
25 namespace {
27 }
28 
29 BOOST_AUTO_TEST_SUITE(TransformBoundToFree)
30 
32  Parameters,
33  surfaces* posSymmetric* posSymmetric* ts* phis* thetas* ps* qsNonZero,
34  surface, l0, l1, time, phi, theta, p, q) {
36 
37  Vector2D loc(l0, l1);
38  Vector3D dir = makeDirectionUnitFromPhiTheta(phi, theta);
39  // transform reference position
40  Vector3D pos = surface->localToGlobal(geoCtx, loc, dir);
41 
42  const auto qOverP = q / p;
43 
44  // construct bound parameters
45  BoundVector bv = BoundVector::Zero();
46  bv[eBoundLoc0] = l0;
47  bv[eBoundLoc1] = l1;
48  bv[eBoundTime] = time;
49  bv[eBoundPhi] = phi;
50  bv[eBoundTheta] = theta;
51  bv[eBoundQOverP] = qOverP;
52 
53  // convert to free parameters
55 
56  CHECK_CLOSE_OR_SMALL(fv.segment<3>(eFreePos0), pos, eps, eps);
58  CHECK_CLOSE_REL(fv.segment<3>(eFreeDir0).norm(), 1, eps);
59  CHECK_CLOSE_OR_SMALL(fv.segment<3>(eFreeDir0), dir, eps, eps);
61 }
62 
63 BOOST_AUTO_TEST_SUITE_END()