Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-06 08:56:37

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/Propagator/detail/SympyJacobianEngine.hpp"
0010 
0011 #include "Acts/Surfaces/CurvilinearSurface.hpp"
0012 #include "Acts/Surfaces/Surface.hpp"
0013 
0014 #include "codegen/sympy_jac_math.hpp"
0015 
0016 namespace Acts::detail {
0017 
0018 void sympy::boundToBoundTransportJacobian(
0019     const GeometryContext& geoContext, const Surface& surface,
0020     const FreeVector& freeParameters,
0021     const BoundToFreeMatrix& boundToFreeJacobian,
0022     const FreeMatrix& freeTransportJacobian,
0023     FreeToBoundMatrix& freeToBoundJacobian,
0024     const FreeVector& freeToPathDerivatives,
0025     BoundMatrix& fullTransportJacobian) {
0026   const Vector3 position = freeParameters.segment<3>(eFreePos0);
0027   const Vector3 direction = freeParameters.segment<3>(eFreeDir0);
0028   // Calculate the derivative of path length at the final surface or the
0029   // point-of-closest approach w.r.t. free parameters
0030   const FreeToPathMatrix freeToPath =
0031       surface.freeToPathDerivative(geoContext, position, direction);
0032   // Calculate the jacobian from free to bound at the final surface
0033   freeToBoundJacobian =
0034       surface.freeToBoundJacobian(geoContext, position, direction);
0035   // https://acts.readthedocs.io/en/latest/white_papers/correction-for-transport-jacobian.html
0036   // Calculate the full jacobian from the local/bound parameters at the start
0037   // surface to local/bound parameters at the final surface
0038   // @note jac(locA->locB) = jac(gloB->locB)*(1+
0039   // pathCorrectionFactor(gloB))*jacTransport(gloA->gloB) *jac(locA->gloA)
0040 
0041   boundToBoundTransportJacobianImpl(
0042       freeToBoundJacobian.data(), freeTransportJacobian.data(),
0043       boundToFreeJacobian.data(), freeToPathDerivatives.data(),
0044       freeToPath.data(), fullTransportJacobian.data());
0045 }
0046 
0047 void sympy::boundToCurvilinearTransportJacobian(
0048     const Vector3& direction, const BoundToFreeMatrix& boundToFreeJacobian,
0049     const FreeMatrix& freeTransportJacobian,
0050     FreeToBoundMatrix& freeToBoundJacobian,
0051     const FreeVector& freeToPathDerivatives,
0052     BoundMatrix& fullTransportJacobian) {
0053   // Calculate the jacobian from global to local at the curvilinear surface
0054   freeToBoundJacobian = CurvilinearSurface(direction).freeToBoundJacobian();
0055 
0056   // Calculate the full jocobian from the local parameters at the start surface
0057   // to curvilinear parameters
0058   // @note jac(locA->locB) = jac(gloB->locB)*(1+
0059   // pathCorrectionFactor(gloB))*jacTransport(gloA->gloB) *jac(locA->gloA)
0060 
0061   boundToCurvilinearTransportJacobianImpl(
0062       freeToBoundJacobian.data(), freeTransportJacobian.data(),
0063       boundToFreeJacobian.data(), freeToPathDerivatives.data(),
0064       direction.data(), fullTransportJacobian.data());
0065 }
0066 
0067 }  // namespace Acts::detail