Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-17 09:21:47

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 #pragma once
0010 
0011 #include "Acts/Geometry/GeometryContext.hpp"
0012 #include "Acts/Propagator/Propagator.hpp"
0013 #include "Acts/Utilities/Result.hpp"
0014 #include "Acts/Vertexing/LinearizedTrack.hpp"
0015 
0016 namespace Acts {
0017 
0018 class MagneticFieldQuery;
0019 
0020 /// @class NumericalTrackLinearizer
0021 /// Linearizes the track parameters at the PCA to a user-provided
0022 /// point (linPoint). The track parameters are written as a function
0023 /// of the global 4D PCA position and the momentum of the particle at
0024 /// the PCA (i.e., (phi, theta, q/p)). The linearization then reads
0025 /// (see Eq. 5.7 in Ref(1)):
0026 ///
0027 /// q = A (r - r_0) + B (p - p_0) + c,
0028 ///
0029 /// where q are the Perigee parameters wrt linPoint, {r_0} r is the {initial}
0030 /// 4D PCA position, {p_0} p is the {initial} momentum at the PCA, and c is
0031 /// the constant term of the expansion. A and B are matrices of derivatives,
0032 /// denoted hereafter as "positionJacobian" and "momentumJacobian" respectively.
0033 /// Note that, unlike in Ref. (1), we add the time to the parametrization, which
0034 /// adds a row and a column to A and a row to B.
0035 ///
0036 /// This class computes A and B by wiggling one of the 7 parameters
0037 /// at the PCA and computing the new PCA wrt linPoint. The derivatives wrt
0038 /// the k-th parameter pk are then calculated via
0039 ///
0040 /// (q(p1, p2, ..., pk+delta, ... p7) - q(p1, p2, ..., pk, ... p7))/delta,
0041 ///
0042 /// where q(p1, p2, ..., pk+delta, ... p7) are the new Perigee parameters
0043 /// (corresponding to the new PCA to linPoint). Note that p1 corresponds to
0044 /// the x-position of the PCA, p2 corresponds to the y-position of the PCA, etc.
0045 ///
0046 /// @note Connection to RiddersStepper: The RiddersStepper does a very
0047 /// similar thing to what this class does, but it wiggles BoundTrackParameters
0048 /// (FreeTrackParameters could also be used if Propagator.hpp and Propagator.ipp
0049 /// were adapted to accommodate them). Here, we wiggle neither
0050 /// BoundTrackParameters nor FreeTrackParameters, but rather the parameters
0051 /// described above.
0052 ///
0053 /// Ref.(1) - CERN-THESIS-2010-027, Giacinto Piacquadio (Freiburg U.)
0054 class NumericalTrackLinearizer {
0055  public:
0056   /// @brief Configuration struct
0057   struct Config {
0058     /// Construct the configuration with a propagator.
0059     /// @param prop Propagator
0060     explicit Config(std::shared_ptr<const BasePropagator> prop)
0061         : propagator(std::move(prop)) {}
0062 
0063     /// Track propagator for numerical calculations
0064     std::shared_ptr<const BasePropagator> propagator;
0065 
0066     /// Tolerance determining how close we need to get to a surface to
0067     /// reach it during propagation
0068     double targetTolerance = 1e-12;
0069 
0070     /// Setting size of the perturbation delta for calculation of numerical
0071     /// derivatives (i.e., f'(x) ~ (f(x+delta) - f(x)) / delta)
0072     double delta = 1e-8;
0073   };
0074 
0075   /// @brief Constructor
0076   ///
0077   /// @param config Configuration object
0078   /// @param _logger Logging instance
0079   explicit NumericalTrackLinearizer(
0080       const Config& config,
0081       std::unique_ptr<const Logger> _logger = getDefaultLogger("NumTrkLinProp",
0082                                                                Logging::INFO))
0083       : m_cfg(config), m_logger{std::move(_logger)} {}
0084 
0085   /// Linearize using propagation; no separate field lookup is needed.
0086   /// @param params Parameters to linearize
0087   /// @param linPointTime Time of the linearization point
0088   /// @param perigeeSurface Surface defining the linearization point
0089   /// @param gctx Geometry context
0090   /// @param fieldQuery Query supplying the context for propagation
0091   /// @return Linearized track or a propagation error
0092   Result<LinearizedTrack> linearizeTrack(const BoundTrackParameters& params,
0093                                          double linPointTime,
0094                                          const Surface& perigeeSurface,
0095                                          const GeometryContext& gctx,
0096                                          MagneticFieldQuery& fieldQuery) const;
0097 
0098  private:
0099   const Config m_cfg;
0100 
0101   std::unique_ptr<const Logger> m_logger;
0102 
0103   const Logger& logger() const { return *m_logger; }
0104 };
0105 
0106 }  // namespace Acts