EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TransformFreeToBoundTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TransformFreeToBoundTests.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(TransformFreeToBound)
30 
32  GlobalToBoundTrackParameters,
33  surfaces* posSymmetric* posSymmetric* ts* phis* thetas* ps* qsNonZero,
34  surface, l0, l1, time, phiInput, theta, p, q) {
35  // phi is ill-defined in forward/backward tracks
36  const auto phi = ((0 < theta) and (theta < M_PI)) ? phiInput : 0.0;
37  const auto qOverP = q / p;
38 
40  Vector2D loc(l0, l1);
42  // transform reference position
43  Vector3D pos = surface->localToGlobal(geoCtx, loc, dir);
44 
45  // convert free parameters to bound parameters
46  {
47  BOOST_TEST_INFO("Transform free parameters vector onto surface "
48  << surface->name());
49 
50  FreeVector fv = FreeVector::Zero();
51  fv[eFreePos0] = pos[ePos0];
52  fv[eFreePos1] = pos[ePos1];
53  fv[eFreePos2] = pos[ePos2];
54  fv[eFreeTime] = time;
55  fv[eFreeDir0] = dir[eMom0];
56  fv[eFreeDir1] = dir[eMom1];
57  fv[eFreeDir2] = dir[eMom2];
58  fv[eFreeQOverP] = qOverP;
59  BoundVector bv =
60  detail::transformFreeToBoundParameters(fv, *surface, geoCtx);
67  }
68  // convert separate components to bound parameters
69  {
70  BOOST_TEST_INFO("Transform free parameters components onto surface "
71  << surface->name());
72 
74  pos, time, dir, qOverP, *surface, geoCtx);
81  }
82 }
83 
84 BOOST_DATA_TEST_CASE(GlobalToCurvilinearParameters,
85  ts* phis* thetas* ps* qsNonZero, time, phiInput, theta, p,
86  q) {
87  // phi is ill-defined in forward/backward tracks
88  const auto phi = ((0 < theta) and (theta < M_PI)) ? phiInput : 0.0;
89  const auto qOverP = q / p;
90 
93 
94  // convert w/ direction
95  {
96  BoundVector bv =
103  CHECK_CLOSE_OR_SMALL(bv[eBoundQOverP], qOverP, eps, eps);
104  }
105  // convert w/ angles
106  {
107  BoundVector bv =
109  CHECK_SMALL(bv[eBoundLoc0], eps);
110  CHECK_SMALL(bv[eBoundLoc1], eps);
114  CHECK_CLOSE_OR_SMALL(bv[eBoundQOverP], qOverP, eps, eps);
115  }
116 }
117 
118 BOOST_AUTO_TEST_SUITE_END()