ATLAS Offline Software
CurvilinearCovarianceHelper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ACTSTRK_CURVILINEARCOVARIANCEHELPER_H
6 #define ACTSTRK_CURVILINEARCOVARIANCEHELPER_H
7 
8 #include "Acts/Geometry/GeometryContext.hpp"
9 #include "Acts/EventData/TrackParameters.hpp"
10 #include "Acts/Propagator/detail/JacobianEngine.hpp"
11 
12 namespace ActsTrk::detail {
16  inline double computeDtDs(const Acts::ParticleHypothesis &hypothesis, double qop) {
17  return std::hypot(1.,hypothesis.mass() / hypothesis.extractMomentum(qop));
18  }
19 
27  inline Acts::FreeToPathMatrix computeFreeToPathDerivatives( const Acts::Vector3 &direction,
28  double qop,
29  const Acts::Vector3 &bfield,
30  const Acts::ParticleHypothesis &particle_hypothesis)
31  {
32  Acts::FreeToPathMatrix path_length_deriv;
33  static_assert(path_length_deriv.cols() == 8); // ensure that all elements are initialized
34  path_length_deriv.segment<3>(Acts::eFreePos0) = direction;
35  path_length_deriv(0,Acts::eFreeTime) = computeDtDs(particle_hypothesis,qop);
36  path_length_deriv.segment<3>(Acts::eFreeDir0) = (qop * direction.cross(bfield)).transpose();
37  path_length_deriv(0,Acts::eFreeQOverP) = 0.;
38  return path_length_deriv;
39  }
40 
41 
61  inline std::optional<Acts::BoundMatrix> convertActsBoundCovToCurvilinearParam(const Acts::GeometryContext &tgContext,
62  const Acts::BoundTrackParameters &param,
63  const Acts::Vector3 &magnFieldVect,
64  const Acts::ParticleHypothesis &particle_hypothesis)
65  {
66  if (param.covariance().has_value()) {
67  Acts::FreeVector freeParams = Acts::transformBoundToFreeParameters(
68  param.referenceSurface(), tgContext, param.parameters());
69  Acts::Vector3 position = freeParams.segment<3>(Acts::eFreePos0);
70  Acts::Vector3 direction = freeParams.segment<3>(Acts::eFreeDir0);
71  Acts::BoundMatrix b2c;
72  Acts::detail::boundToCurvilinearTransportJacobian(direction, // magnFieldVect.normalized(),
73  param.referenceSurface().boundToFreeJacobian(tgContext, position, direction),
74  Acts::FreeMatrix::Identity(),
76  param.parameters()[Acts::eBoundQOverP],
77  magnFieldVect,
78  particle_hypothesis),
79  b2c);
80 
81  return b2c * param.covariance().value() * b2c.transpose();
82  }
83  else {
84  return {};
85  }
86  }
87 }
88 
89 #endif
ActsTrk::detail::convertActsBoundCovToCurvilinearParam
std::optional< Acts::BoundMatrix > convertActsBoundCovToCurvilinearParam(const Acts::GeometryContext &tgContext, const Acts::BoundTrackParameters &param, const Acts::Vector3 &magnFieldVect, const Acts::ParticleHypothesis &particle_hypothesis)
Convert the covariance of the given Acts track parameters into curvilinear parameterisation.
Definition: CurvilinearCovarianceHelper.h:61
ActsTrk::detail::computeFreeToPathDerivatives
Acts::FreeToPathMatrix computeFreeToPathDerivatives(const Acts::Vector3 &direction, double qop, const Acts::Vector3 &bfield, const Acts::ParticleHypothesis &particle_hypothesis)
Compute the path length derivatives for the free/bound to curvilinear paramter transform.
Definition: CurvilinearCovarianceHelper.h:27
xAOD::ParticleHypothesis
ParticleHypothesis
Definition: TrackingPrimitives.h:192
ActsTrk::detail::computeDtDs
double computeDtDs(const Acts::ParticleHypothesis &hypothesis, double qop)
Helper function to compute dt/ds Helper function to compute the derivative of the time as function of...
Definition: CurvilinearCovarianceHelper.h:16
ActsTrk::detail
Definition: Decoration.h:15