Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:02:24

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/StraightLineStepper.hpp"
0010 
0011 #include "Acts/Definitions/TrackParametrization.hpp"
0012 #include "Acts/EventData/TransformationHelpers.hpp"
0013 #include "Acts/Propagator/detail/CovarianceEngine.hpp"
0014 
0015 namespace Acts {
0016 
0017 StraightLineStepper::State StraightLineStepper::makeState(
0018     const Options& options) const {
0019   State state{options};
0020   return state;
0021 }
0022 
0023 void StraightLineStepper::initialize(State& state,
0024                                      const BoundTrackParameters& par) const {
0025   initialize(state, par.parameters(), par.covariance(),
0026              par.particleHypothesis(), par.referenceSurface());
0027 }
0028 
0029 void StraightLineStepper::initialize(State& state,
0030                                      const BoundVector& boundParams,
0031                                      const std::optional<BoundMatrix>& cov,
0032                                      ParticleHypothesis particleHypothesis,
0033                                      const Surface& surface) const {
0034   FreeVector freeParams = transformBoundToFreeParameters(
0035       surface, state.options.geoContext, boundParams);
0036 
0037   state.particleHypothesis = particleHypothesis;
0038 
0039   state.pathAccumulated = 0;
0040   state.nSteps = 0;
0041   state.nStepTrials = 0;
0042   state.stepSize = ConstrainedStep();
0043   state.stepSize.setAccuracy(state.options.initialStepSize);
0044   state.stepSize.setUser(state.options.maxStepSize);
0045   state.previousStepSize = 0;
0046   state.statistics = StepperStatistics();
0047 
0048   state.pars = freeParams;
0049 
0050   // Init the jacobian matrix if needed
0051   state.covTransport = cov.has_value();
0052   if (state.covTransport) {
0053     state.cov = *cov;
0054     state.jacToGlobal = surface.boundToFreeJacobian(
0055         state.options.geoContext, freeParams.segment<3>(eFreePos0),
0056         freeParams.segment<3>(eFreeDir0));
0057     state.jacobian = BoundMatrix::Identity();
0058     state.jacTransport = FreeMatrix::Identity();
0059     state.derivative = FreeVector::Zero();
0060   }
0061 }
0062 
0063 Result<std::tuple<BoundTrackParameters, BoundMatrix, double>>
0064 StraightLineStepper::boundState(
0065     State& state, const Surface& surface, bool transportCov,
0066     const FreeToBoundCorrection& freeToBoundCorrection) const {
0067   return detail::boundState(
0068       state.options.geoContext, surface, state.cov, state.jacobian,
0069       state.jacTransport, state.derivative, state.jacToGlobal,
0070       state.additionalFreeCovariance, state.pars, state.particleHypothesis,
0071       state.covTransport && transportCov, state.pathAccumulated,
0072       freeToBoundCorrection);
0073 }
0074 
0075 std::tuple<BoundTrackParameters, BoundMatrix, double>
0076 StraightLineStepper::curvilinearState(State& state, bool transportCov) const {
0077   return detail::curvilinearState(
0078       state.cov, state.jacobian, state.jacTransport, state.derivative,
0079       state.jacToGlobal, state.additionalFreeCovariance, state.pars,
0080       state.particleHypothesis, state.covTransport && transportCov,
0081       state.pathAccumulated);
0082 }
0083 
0084 void StraightLineStepper::update(State& state, const FreeVector& freeParams,
0085                                  const BoundVector& /*boundParams*/,
0086                                  const Covariance& covariance,
0087                                  const Surface& surface) const {
0088   state.pars = freeParams;
0089   state.cov = covariance;
0090   state.jacToGlobal = surface.boundToFreeJacobian(
0091       state.options.geoContext, freeParams.template segment<3>(eFreePos0),
0092       freeParams.template segment<3>(eFreeDir0));
0093 }
0094 
0095 void StraightLineStepper::update(State& state, const Vector3& uposition,
0096                                  const Vector3& udirection, double qop,
0097                                  double time) const {
0098   state.pars.template segment<3>(eFreePos0) = uposition;
0099   state.pars.template segment<3>(eFreeDir0) = udirection;
0100   state.pars[eFreeTime] = time;
0101   state.pars[eFreeQOverP] = qop;
0102 }
0103 
0104 void StraightLineStepper::transportCovarianceToCurvilinear(State& state) const {
0105   detail::transportCovarianceToCurvilinear(
0106       state.cov, state.jacobian, state.jacTransport, state.derivative,
0107       state.jacToGlobal, state.additionalFreeCovariance,
0108       state.pars.template segment<3>(eFreeDir0));
0109 }
0110 
0111 void StraightLineStepper::transportCovarianceToBound(
0112     State& state, const Surface& surface,
0113     const FreeToBoundCorrection& freeToBoundCorrection) const {
0114   detail::transportCovarianceToBound(
0115       state.options.geoContext, surface, state.cov, state.jacobian,
0116       state.jacTransport, state.derivative, state.jacToGlobal,
0117       state.additionalFreeCovariance, state.pars, freeToBoundCorrection);
0118 }
0119 
0120 }  // namespace Acts