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 
72  Acts::BoundToFreeMatrix boundToFreeJacobian = param.referenceSurface().boundToFreeJacobian(tgContext, position, direction);
73  Acts::FreeMatrix freeTransportJacobian = Acts::FreeMatrix::Identity();
74  Acts::FreeToBoundMatrix freeToBoundJacobian;
75  Acts::FreeVector freeToPathDerivatives = computeFreeToPathDerivatives(direction,
76  param.parameters()[Acts::eBoundQOverP],
77  magnFieldVect,
78  particle_hypothesis);
79  Acts::BoundMatrix fullTransportJacobian;
80  Acts::detail::boundToCurvilinearTransportJacobian(direction,
81  boundToFreeJacobian,
82  freeTransportJacobian,
83  freeToBoundJacobian,
84  freeToPathDerivatives,
85  fullTransportJacobian);
86 
87  return fullTransportJacobian * param.covariance().value() * fullTransportJacobian.transpose();
88  }
89  else {
90  return {};
91  }
92  }
93 }
94 
95 #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:193
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
Athena definition of the Eigen plugin.
Definition: MeasurementCalibratorBase.h:19