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