File indexing completed on 2025-07-13 07:51: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 std::shared_ptr<PlaneSurface> pSurface =
0037 CurvilinearSurface(position, direction).planeSurface();
0038
0039
0040 Vector3 odirection = Vector3(6., 2., 8.).normalized();
0041 std::shared_ptr<PlaneSurface> oSurface =
0042 CurvilinearSurface(position, odirection).planeSurface();
0043
0044
0045 FreeVector freeParameters;
0046 freeParameters << position[0], position[1], position[2], time, direction[0],
0047 direction[1], direction[2], qop;
0048
0049 BoundVector boundParameters;
0050 boundParameters << 0., 0., VectorHelpers::phi(direction),
0051 VectorHelpers::theta(direction), qop, time;
0052
0053
0054 BoundSquareMatrix boundCovariance = 0.025 * BoundSquareMatrix::Identity();
0055 FreeSquareMatrix freeCovariance = 0.025 * FreeSquareMatrix::Identity();
0056
0057 FreeMatrix noTransportJacobian = FreeMatrix::Identity();
0058 FreeMatrix realTransportJacobian = 2 * FreeMatrix::Identity();
0059
0060 FreeToPathMatrix freeToPathDerivatives =
0061 pSurface->freeToPathDerivative(tgContext, position, direction);
0062 BoundToFreeMatrix boundToFreeJacobian =
0063 pSurface->boundToFreeJacobian(tgContext, position, direction);
0064
0065
0066
0067 BoundMatrix b2bTransportJacobian;
0068 FreeToBoundMatrix freeToBoundJacobian;
0069 detail::boundToBoundTransportJacobian(
0070 tgContext, *pSurface, freeParameters, boundToFreeJacobian,
0071 noTransportJacobian, freeToBoundJacobian, freeToPathDerivatives,
0072 b2bTransportJacobian);
0073 BoundSquareMatrix newBoundCovariance =
0074 b2bTransportJacobian * boundCovariance * b2bTransportJacobian.transpose();
0075 BOOST_CHECK(boundCovariance.isApprox(newBoundCovariance));
0076
0077 detail::boundToBoundTransportJacobian(
0078 tgContext, *oSurface, freeParameters, boundToFreeJacobian,
0079 noTransportJacobian, freeToBoundJacobian, freeToPathDerivatives,
0080 b2bTransportJacobian);
0081 newBoundCovariance =
0082 b2bTransportJacobian * boundCovariance * b2bTransportJacobian.transpose();
0083 BOOST_CHECK(!boundCovariance.isApprox(newBoundCovariance));
0084
0085
0086 detail::boundToBoundTransportJacobian(
0087 tgContext, *pSurface, freeParameters, boundToFreeJacobian,
0088 realTransportJacobian, freeToBoundJacobian, freeToPathDerivatives,
0089 b2bTransportJacobian);
0090 newBoundCovariance =
0091 b2bTransportJacobian * boundCovariance * b2bTransportJacobian.transpose();
0092 BOOST_CHECK(!boundCovariance.isApprox(newBoundCovariance));
0093
0094 FreeToBoundMatrix f2bTransportJacobian;
0095 detail::freeToBoundTransportJacobian(
0096 tgContext, *pSurface, freeParameters, noTransportJacobian,
0097 freeToPathDerivatives, f2bTransportJacobian);
0098
0099 newBoundCovariance =
0100 f2bTransportJacobian * freeCovariance * f2bTransportJacobian.transpose();
0101 BOOST_CHECK(!boundCovariance.isApprox(newBoundCovariance));
0102 }
0103
0104
0105
0106
0107
0108 BOOST_AUTO_TEST_CASE(jacobian_engine_to_curvilinear) {
0109
0110 GeometryContext tgContext = GeometryContext();
0111
0112
0113 Vector3 position{1., 2., 3.};
0114 Vector3 direction = Vector3(5., 2., 7.).normalized();
0115
0116
0117 std::shared_ptr<PlaneSurface> pSurface =
0118 CurvilinearSurface(position, direction).planeSurface();
0119
0120
0121 BoundSquareMatrix boundCovariance = 0.025 * BoundSquareMatrix::Identity();
0122 FreeSquareMatrix freeCovariance = 0.025 * FreeSquareMatrix::Identity();
0123
0124 FreeMatrix noTransportJacobian = FreeMatrix::Identity();
0125 FreeToBoundMatrix freeToBoundJacobian;
0126
0127 FreeToPathMatrix freeToPathDerivatives =
0128 pSurface->freeToPathDerivative(tgContext, position, direction);
0129 BoundToFreeMatrix boundToFreeJacobian =
0130 CurvilinearSurface(direction).boundToFreeJacobian();
0131
0132
0133
0134 BoundMatrix b2cTransportJacobian;
0135 detail::boundToCurvilinearTransportJacobian(
0136 direction, boundToFreeJacobian, noTransportJacobian, freeToBoundJacobian,
0137 freeToPathDerivatives, b2cTransportJacobian);
0138 BoundSquareMatrix newBoundCovariance =
0139 b2cTransportJacobian * boundCovariance * b2cTransportJacobian.transpose();
0140 BOOST_CHECK(boundCovariance.isApprox(newBoundCovariance));
0141
0142 detail::boundToCurvilinearTransportJacobian(
0143 Vector3(4., 5., 6.).normalized(), boundToFreeJacobian,
0144 noTransportJacobian, freeToBoundJacobian, freeToPathDerivatives,
0145 b2cTransportJacobian);
0146 newBoundCovariance =
0147 b2cTransportJacobian * boundCovariance * b2cTransportJacobian.transpose();
0148 BOOST_CHECK(!boundCovariance.isApprox(newBoundCovariance));
0149
0150 FreeToBoundMatrix f2cTransportJacobian =
0151 detail::freeToCurvilinearTransportJacobian(direction, noTransportJacobian,
0152 freeToPathDerivatives);
0153
0154 newBoundCovariance =
0155 f2cTransportJacobian * freeCovariance * f2cTransportJacobian.transpose();
0156 BOOST_CHECK(!boundCovariance.isApprox(newBoundCovariance));
0157 }
0158
0159
0160
0161
0162
0163 BOOST_AUTO_TEST_CASE(jacobian_engine_to_free) {
0164
0165 GeometryContext tgContext = GeometryContext();
0166
0167
0168 Vector3 position{1., 2., 3.};
0169 Vector3 direction = Vector3(5., 2., 7.).normalized();
0170
0171
0172 std::shared_ptr<PlaneSurface> pSurface =
0173 CurvilinearSurface(position, direction).planeSurface();
0174
0175
0176 BoundSquareMatrix boundCovariance = 0.025 * BoundSquareMatrix::Identity();
0177 FreeSquareMatrix freeCovariance = 0.025 * FreeSquareMatrix::Identity();
0178
0179 FreeMatrix noTransportJacobian = FreeMatrix::Identity();
0180
0181 BoundToFreeMatrix boundToFreeJacobian =
0182 pSurface->boundToFreeJacobian(tgContext, position, direction);
0183
0184
0185 BoundToFreeMatrix b2fTransportJacobian = detail::boundToFreeTransportJacobian(
0186 boundToFreeJacobian, noTransportJacobian);
0187
0188 FreeMatrix newFreeCovariance1 =
0189 b2fTransportJacobian * boundCovariance * b2fTransportJacobian.transpose();
0190 BOOST_CHECK(!newFreeCovariance1.isApprox(freeCovariance));
0191
0192
0193 boundToFreeJacobian = CurvilinearSurface(direction).boundToFreeJacobian();
0194 BoundToFreeMatrix c2fTransportJacobian = detail::boundToFreeTransportJacobian(
0195 boundToFreeJacobian, noTransportJacobian);
0196
0197 FreeMatrix newFreeCovariance2 =
0198 c2fTransportJacobian * boundCovariance * c2fTransportJacobian.transpose();
0199 BOOST_CHECK(!newFreeCovariance2.isApprox(freeCovariance));
0200
0201 BOOST_CHECK(newFreeCovariance1.isApprox(newFreeCovariance2));
0202 }
0203
0204 }