Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:09:39

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2019-2020 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/Propagator/StraightLineStepper.hpp"
0010 
0011 #include "Acts/EventData/TransformationHelpers.hpp"
0012 #include "Acts/Propagator/detail/CovarianceEngine.hpp"
0013 
0014 namespace Acts {
0015 
0016 Result<std::tuple<BoundTrackParameters, BoundMatrix, double>>
0017 StraightLineStepper::boundState(
0018     State& state, const Surface& surface, bool transportCov,
0019     const FreeToBoundCorrection& freeToBoundCorrection) const {
0020   return detail::boundState(
0021       state.geoContext, surface, state.cov, state.jacobian, state.jacTransport,
0022       state.derivative, state.jacToGlobal, state.pars, state.particleHypothesis,
0023       state.covTransport && transportCov, state.pathAccumulated,
0024       freeToBoundCorrection);
0025 }
0026 
0027 std::tuple<CurvilinearTrackParameters, BoundMatrix, double>
0028 StraightLineStepper::curvilinearState(State& state, bool transportCov) const {
0029   return detail::curvilinearState(
0030       state.cov, state.jacobian, state.jacTransport, state.derivative,
0031       state.jacToGlobal, state.pars, state.particleHypothesis,
0032       state.covTransport && transportCov, state.pathAccumulated);
0033 }
0034 
0035 void StraightLineStepper::update(State& state, const FreeVector& freeParams,
0036                                  const BoundVector& /*boundParams*/,
0037                                  const Covariance& covariance,
0038                                  const Surface& surface) const {
0039   state.pars = freeParams;
0040   state.cov = covariance;
0041   state.jacToGlobal = surface.boundToFreeJacobian(
0042       state.geoContext, freeParams.template segment<3>(eFreePos0),
0043       freeParams.template segment<3>(eFreeDir0));
0044 }
0045 
0046 void StraightLineStepper::update(State& state, const Vector3& uposition,
0047                                  const Vector3& udirection, double qop,
0048                                  double time) const {
0049   state.pars.template segment<3>(eFreePos0) = uposition;
0050   state.pars.template segment<3>(eFreeDir0) = udirection;
0051   state.pars[eFreeTime] = time;
0052   state.pars[eFreeQOverP] = qop;
0053 }
0054 
0055 void StraightLineStepper::transportCovarianceToCurvilinear(State& state) const {
0056   detail::transportCovarianceToCurvilinear(
0057       state.cov, state.jacobian, state.jacTransport, state.derivative,
0058       state.jacToGlobal, state.pars.template segment<3>(eFreeDir0));
0059 }
0060 
0061 void StraightLineStepper::transportCovarianceToBound(
0062     State& state, const Surface& surface,
0063     const FreeToBoundCorrection& freeToBoundCorrection) const {
0064   detail::transportCovarianceToBound(
0065       state.geoContext, surface, state.cov, state.jacobian, state.jacTransport,
0066       state.derivative, state.jacToGlobal, state.pars, freeToBoundCorrection);
0067 }
0068 
0069 void StraightLineStepper::resetState(State& state,
0070                                      const BoundVector& boundParams,
0071                                      const BoundSquareMatrix& cov,
0072                                      const Surface& surface,
0073                                      const double stepSize) const {
0074   FreeVector freeParams =
0075       transformBoundToFreeParameters(surface, state.geoContext, boundParams);
0076 
0077   // Update the stepping state
0078   state.pars = freeParams;
0079   state.cov = cov;
0080   state.stepSize = ConstrainedStep(stepSize);
0081   state.pathAccumulated = 0.;
0082 
0083   // Reinitialize the stepping jacobian
0084   state.jacToGlobal = surface.boundToFreeJacobian(
0085       state.geoContext, freeParams.template segment<3>(eFreePos0),
0086       freeParams.template segment<3>(eFreeDir0));
0087   state.jacobian = BoundMatrix::Identity();
0088   state.jacTransport = FreeMatrix::Identity();
0089   state.derivative = FreeVector::Zero();
0090 }
0091 
0092 }  // namespace Acts