File indexing completed on 2025-01-18 09:12:47
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/TrackParametrization.hpp"
0013 #include "Acts/Geometry/GeometryContext.hpp"
0014 #include "Acts/Propagator/detail/JacobianEngine.hpp"
0015 #include "Acts/Surfaces/CurvilinearSurface.hpp"
0016 #include "Acts/Surfaces/PlaneSurface.hpp"
0017 #include "Acts/Surfaces/Surface.hpp"
0018
0019 namespace Acts::Test {
0020
0021
0022
0023
0024
0025 BOOST_AUTO_TEST_CASE(jacobian_engine_to_bound) {
0026
0027 GeometryContext tgContext = GeometryContext();
0028
0029
0030 Vector3 position{1., 2., 3.};
0031 double time = 4.;
0032 Vector3 direction = Vector3(5., 2., 7.).normalized();
0033 double qop = 0.125;
0034
0035
0036 auto pSurface = CurvilinearSurface(position, direction).planeSurface();
0037
0038
0039 Vector3 odirection = Vector3(6., 2., 8.).normalized();
0040 auto oSurface = CurvilinearSurface(position, odirection).planeSurface();
0041
0042
0043 FreeVector freeParameters;
0044 freeParameters << position[0], position[1], position[2], time, direction[0],
0045 direction[1], direction[2], qop;
0046
0047 BoundVector boundParameters;
0048 boundParameters << 0., 0., VectorHelpers::phi(direction),
0049 VectorHelpers::theta(direction), qop, time;
0050
0051
0052 BoundSquareMatrix boundCovariance = 0.025 * BoundSquareMatrix::Identity();
0053 FreeSquareMatrix freeCovariance = 0.025 * FreeSquareMatrix::Identity();
0054
0055 FreeMatrix noTransportJacobian = FreeMatrix::Identity();
0056 FreeMatrix realTransportJacobian = 2 * FreeMatrix::Identity();
0057
0058 FreeToPathMatrix freeToPathDerivatives =
0059 pSurface->freeToPathDerivative(tgContext, position, direction);
0060 BoundToFreeMatrix boundToFreeJacobian =
0061 pSurface->boundToFreeJacobian(tgContext, position, direction);
0062
0063
0064
0065 BoundMatrix b2bTransportJacobian;
0066 detail::boundToBoundTransportJacobian(
0067 tgContext, *pSurface, freeParameters, boundToFreeJacobian,
0068 noTransportJacobian, freeToPathDerivatives, b2bTransportJacobian);
0069 BoundSquareMatrix newBoundCovariance =
0070 b2bTransportJacobian * boundCovariance * b2bTransportJacobian.transpose();
0071 BOOST_CHECK(boundCovariance.isApprox(newBoundCovariance));
0072
0073 detail::boundToBoundTransportJacobian(
0074 tgContext, *oSurface, freeParameters, boundToFreeJacobian,
0075 noTransportJacobian, freeToPathDerivatives, b2bTransportJacobian);
0076 newBoundCovariance =
0077 b2bTransportJacobian * boundCovariance * b2bTransportJacobian.transpose();
0078 BOOST_CHECK(!boundCovariance.isApprox(newBoundCovariance));
0079
0080
0081 detail::boundToBoundTransportJacobian(
0082 tgContext, *pSurface, freeParameters, boundToFreeJacobian,
0083 realTransportJacobian, freeToPathDerivatives, b2bTransportJacobian);
0084 newBoundCovariance =
0085 b2bTransportJacobian * boundCovariance * b2bTransportJacobian.transpose();
0086 BOOST_CHECK(!boundCovariance.isApprox(newBoundCovariance));
0087
0088 FreeToBoundMatrix f2bTransportJacobian;
0089 detail::freeToBoundTransportJacobian(
0090 tgContext, *pSurface, freeParameters, noTransportJacobian,
0091 freeToPathDerivatives, f2bTransportJacobian);
0092
0093 newBoundCovariance =
0094 f2bTransportJacobian * freeCovariance * f2bTransportJacobian.transpose();
0095 BOOST_CHECK(!boundCovariance.isApprox(newBoundCovariance));
0096 }
0097
0098
0099
0100
0101
0102 BOOST_AUTO_TEST_CASE(jacobian_engine_to_curvilinear) {
0103
0104 GeometryContext tgContext = GeometryContext();
0105
0106
0107 Vector3 position{1., 2., 3.};
0108 Vector3 direction = Vector3(5., 2., 7.).normalized();
0109
0110
0111 auto pSurface = CurvilinearSurface(position, direction).planeSurface();
0112
0113
0114 BoundSquareMatrix boundCovariance = 0.025 * BoundSquareMatrix::Identity();
0115 FreeSquareMatrix freeCovariance = 0.025 * FreeSquareMatrix::Identity();
0116
0117 FreeMatrix noTransportJacobian = FreeMatrix::Identity();
0118
0119 FreeToPathMatrix freeToPathDerivatives =
0120 pSurface->freeToPathDerivative(tgContext, position, direction);
0121 BoundToFreeMatrix boundToFreeJacobian =
0122 CurvilinearSurface(direction).boundToFreeJacobian();
0123
0124
0125
0126 BoundMatrix b2cTransportJacobian;
0127 detail::boundToCurvilinearTransportJacobian(
0128 direction, boundToFreeJacobian, noTransportJacobian,
0129 freeToPathDerivatives, b2cTransportJacobian);
0130 BoundSquareMatrix newBoundCovariance =
0131 b2cTransportJacobian * boundCovariance * b2cTransportJacobian.transpose();
0132 BOOST_CHECK(boundCovariance.isApprox(newBoundCovariance));
0133
0134 detail::boundToCurvilinearTransportJacobian(
0135 Vector3(4., 5., 6.).normalized(), boundToFreeJacobian,
0136 noTransportJacobian, freeToPathDerivatives, b2cTransportJacobian);
0137 newBoundCovariance =
0138 b2cTransportJacobian * boundCovariance * b2cTransportJacobian.transpose();
0139 BOOST_CHECK(!boundCovariance.isApprox(newBoundCovariance));
0140
0141 FreeToBoundMatrix f2cTransportJacobian =
0142 detail::freeToCurvilinearTransportJacobian(direction, noTransportJacobian,
0143 freeToPathDerivatives);
0144
0145 newBoundCovariance =
0146 f2cTransportJacobian * freeCovariance * f2cTransportJacobian.transpose();
0147 BOOST_CHECK(!boundCovariance.isApprox(newBoundCovariance));
0148 }
0149
0150
0151
0152
0153
0154 BOOST_AUTO_TEST_CASE(jacobian_engine_to_free) {
0155
0156 GeometryContext tgContext = GeometryContext();
0157
0158
0159 Vector3 position{1., 2., 3.};
0160 Vector3 direction = Vector3(5., 2., 7.).normalized();
0161
0162
0163 auto pSurface = CurvilinearSurface(position, direction).planeSurface();
0164
0165
0166 BoundSquareMatrix boundCovariance = 0.025 * BoundSquareMatrix::Identity();
0167 FreeSquareMatrix freeCovariance = 0.025 * FreeSquareMatrix::Identity();
0168
0169 FreeMatrix noTransportJacobian = FreeMatrix::Identity();
0170
0171 BoundToFreeMatrix boundToFreeJacobian =
0172 pSurface->boundToFreeJacobian(tgContext, position, direction);
0173
0174
0175 BoundToFreeMatrix b2fTransportJacobian = detail::boundToFreeTransportJacobian(
0176 boundToFreeJacobian, noTransportJacobian);
0177
0178 FreeMatrix newFreeCovariance1 =
0179 b2fTransportJacobian * boundCovariance * b2fTransportJacobian.transpose();
0180 BOOST_CHECK(!newFreeCovariance1.isApprox(freeCovariance));
0181
0182
0183 boundToFreeJacobian = CurvilinearSurface(direction).boundToFreeJacobian();
0184 BoundToFreeMatrix c2fTransportJacobian = detail::boundToFreeTransportJacobian(
0185 boundToFreeJacobian, noTransportJacobian);
0186
0187 FreeMatrix newFreeCovariance2 =
0188 c2fTransportJacobian * boundCovariance * c2fTransportJacobian.transpose();
0189 BOOST_CHECK(!newFreeCovariance2.isApprox(freeCovariance));
0190
0191 BOOST_CHECK(newFreeCovariance1.isApprox(newFreeCovariance2));
0192 }
0193
0194 }