Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-02 08:37:48

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/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/GeometryContext.hpp"
0013 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0014 #include "Acts/MagneticField/MagneticFieldProvider.hpp"
0015 #include "Acts/MagneticField/NullBField.hpp"
0016 #include "Acts/Propagator/EigenStepper.hpp"
0017 #include "Acts/Propagator/Propagator.hpp"
0018 #include "Acts/Utilities/Delegate.hpp"
0019 #include "Acts/Utilities/Result.hpp"
0020 #include "Acts/Vertexing/LinearizedTrack.hpp"
0021 
0022 #include <memory>
0023 
0024 namespace Acts {
0025 
0026 /// @class HelicalTrackLinearizer
0027 /// Linearizes the track parameters at the PCA to a user-provided
0028 /// point (linPoint). The track parameters are written as a function
0029 /// of the global PCA position and the momentum of the particle at
0030 /// the PCA. The linearization then reads (see Eq. 5.7 in Ref. (1)):
0031 ///
0032 /// q = A (r - r_0) + B (p - p_0) + c,
0033 ///
0034 /// where q are the Perigee parameters wrt linPoint, {r_0} r is the {initial}
0035 /// 4D PCA position, {p_0} p is the {initial} momentum (phi, theta, q/p) at the
0036 /// PCA, and c is the constant term of the expansion. A and B are matrices of
0037 /// derivatives, denoted hereafter as "positionJacobian" and
0038 /// "momentumJacobian" respectively.
0039 ///
0040 /// This class computes A and B using the analytic formulae of Ref. (1).
0041 ///
0042 /// Ref. (1) - CERN-THESIS-2010-027, Giacinto Piacquadio (Freiburg U.)
0043 class HelicalTrackLinearizer {
0044  public:
0045   /// @brief Configuration struct
0046   struct Config {
0047     /// The magnetic field provider for helical track propagation
0048     std::shared_ptr<const MagneticFieldProvider> bField =
0049         std::make_shared<NullBField>();
0050 
0051     /// Track propagator for linearization calculations
0052     std::shared_ptr<const BasePropagator> propagator;
0053 
0054     /// Tolerance determining how close we need to get to the Perigee surface to
0055     /// reach it during propagation
0056     double targetTolerance = 1e-12;
0057   };
0058 
0059   /// @brief Constructor
0060   ///
0061   /// @param config Configuration object
0062   /// @param _logger a logger instance
0063   explicit HelicalTrackLinearizer(
0064       const Config& config,
0065       std::unique_ptr<const Logger> _logger = getDefaultLogger("HelTrkLinProp",
0066                                                                Logging::INFO))
0067       : m_cfg(config), m_logger{std::move(_logger)} {
0068     if (!m_cfg.propagator) {
0069       throw std::invalid_argument("HelicalTrackLinearizer: propagator is null");
0070     }
0071   }
0072 
0073   /// @brief Function that linearizes BoundTrackParameters at
0074   /// the PCA to a given Perigee surface
0075   ///
0076   /// @param params Parameters to linearize
0077   /// @param linPointTime Time associated to the linearization point
0078   /// @note Transverse plane of the Perigee corresponding to @p linPoint is
0079   /// parallel to the global x-y plane
0080   /// @param perigeeSurface Perigee surface belonging to @p linPoint
0081   /// @param gctx Geometry context
0082   /// @param mctx Magnetic field context
0083   /// @param fieldCache Magnetic field cache
0084   ///
0085   /// @return Linearized track
0086   Result<LinearizedTrack> linearizeTrack(
0087       const BoundTrackParameters& params, double linPointTime,
0088       const Surface& perigeeSurface, const Acts::GeometryContext& gctx,
0089       const Acts::MagneticFieldContext& mctx,
0090       MagneticFieldProvider::Cache& fieldCache) const;
0091 
0092  private:
0093   /// Configuration object
0094   const Config m_cfg;
0095 
0096   std::unique_ptr<const Logger> m_logger;
0097 
0098   const Logger& logger() const { return *m_logger; }
0099 };
0100 
0101 }  // namespace Acts