Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 08:19:54

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/Definitions/TrackParametrization.hpp"
0013 #include "Acts/Definitions/Units.hpp"
0014 #include "Acts/Geometry/GeometryContext.hpp"
0015 #include "Acts/Seeding/TrackParamsEstimationError.hpp"
0016 #include "Acts/Surfaces/Surface.hpp"
0017 #include "Acts/Utilities/Result.hpp"
0018 
0019 #include <cstddef>
0020 #include <span>
0021 
0022 namespace Acts {
0023 
0024 /// @defgroup est_track_params Estimate track parameters from seed
0025 ///
0026 /// The implemented method is based on the conformal map transformation. It
0027 /// estimates the full free track parameters, i.e. (x, y, z, t, dx, dy, dz, q/p)
0028 /// at the bottom space point. The magnetic field (which can be along any
0029 /// direction) is also necessary for the momentum estimation.
0030 ///
0031 /// It resembles the method used in ATLAS for the track parameters estimated
0032 /// from seed, i.e. the function InDet::SiTrackMaker_xk::getAtaPlane here:
0033 /// https://acode-browser.usatlas.bnl.gov/lxr/source/athena/InnerGeometry/InDetRecTools/SiTrackMakerTool_xk/src/SiTrackMaker_xk.cxx
0034 ///
0035 /// @{
0036 
0037 /// Estimate free track parameters from three space points.
0038 ///
0039 /// Optionally estimates the tangents at the three space points from helix fit.
0040 /// This can be used as an input for the strip space point calibration, which
0041 /// requires the track tangents at each space point as input.
0042 ///
0043 /// @param sp0 is the bottom space point
0044 /// @param t0 is the time of the bottom space point
0045 /// @param sp1 is the middle space point
0046 /// @param sp2 is the top space point
0047 /// @param bField is the magnetic field vector
0048 /// @param tangent0 is the output tangent at the bottom space point
0049 /// @param tangent1 is the output tangent at the middle space point
0050 /// @param tangent2 is the output tangent at the top space point
0051 ///
0052 /// @return the free parameters
0053 FreeVector estimateTrackParamsFromSeed(const Vector3& sp0, double t0,
0054                                        const Vector3& sp1, const Vector3& sp2,
0055                                        const Vector3& bField,
0056                                        Vector3* tangent0 = nullptr,
0057                                        Vector3* tangent1 = nullptr,
0058                                        Vector3* tangent2 = nullptr);
0059 
0060 /// Estimate bound track parameters from three space points
0061 ///
0062 /// @param gctx is the geometry context
0063 /// @param surface is the surface of the bottom space point. The estimated bound
0064 ///                track parameters will be represented at this surface.
0065 /// @param sp0 is the bottom space point
0066 /// @param t0 is the time of the bottom space point
0067 /// @param sp1 is the middle space point
0068 /// @param sp2 is the top space point
0069 /// @param bField is the magnetic field vector
0070 ///
0071 /// @return bound parameters
0072 Result<BoundVector> estimateTrackParamsFromSeed(
0073     const GeometryContext& gctx, const Surface& surface, const Vector3& sp0,
0074     double t0, const Vector3& sp1, const Vector3& sp2, const Vector3& bField);
0075 
0076 /// Configuration for the estimation of the covariance matrix of the track
0077 /// parameters with `estimateTrackParamCovariance`.
0078 struct EstimateTrackParamCovarianceConfig {
0079   /// The initial sigmas for the track parameters
0080   BoundVector initialSigmas = {1. * UnitConstants::mm,
0081                                1. * UnitConstants::mm,
0082                                1. * UnitConstants::degree,
0083                                1. * UnitConstants::degree,
0084                                1. * UnitConstants::e / UnitConstants::GeV,
0085                                1. * UnitConstants::ns};
0086 
0087   /// The initial sigma for the q/pt
0088   /// @note The resulting q/p sigma is added to the one in `initialSigmas`
0089   double initialSigmaQoverPt = 0. * UnitConstants::e / UnitConstants::GeV;
0090 
0091   /// The initial relative uncertainty sigma(pt)/pt
0092   /// @note The resulting q/p sigma is added to the one in `initialSigmas`
0093   double initialSigmaPtRel = 0.1;
0094 
0095   /// The inflation factors for the variances of the track parameters
0096   BoundVector initialVarInflation = {1., 1., 1., 1., 1., 1.};
0097   /// The inflation factor for time uncertainty if the time parameter was not
0098   /// estimated
0099   double noTimeVarInflation = 100.;
0100 };
0101 
0102 /// Estimate the covariance matrix of the given track parameters based on the
0103 /// provided configuration. The assumption is that we can model the uncertainty
0104 /// of the track parameters as a diagonal matrix with the provided initial
0105 /// sigmas. The inflation factors are used to inflate the initial variances
0106 /// based on the provided configuration. The uncertainty of q/p is estimated
0107 /// based on the relative uncertainty of the q/pt and the theta uncertainty.
0108 ///
0109 /// @param config is the configuration for the estimation
0110 /// @param params is the track parameters
0111 /// @param hasTime is true if the track parameters have time
0112 ///
0113 /// @return the covariance matrix of the track parameters
0114 BoundMatrix estimateTrackParamCovariance(
0115     const EstimateTrackParamCovarianceConfig& config, const BoundVector& params,
0116     bool hasTime);
0117 
0118 /// Estimate free track parameters from an ordered set of N >= 3 space points.
0119 ///
0120 /// Least-squares generalization of @ref estimateTrackParamsFromSeed. A Taubin
0121 /// circle fit transverse to the field, optionally refined geometrically, and a
0122 /// linear fit of the field coordinate against the transverse arc length. Points
0123 /// are taken in track order and are not sorted.
0124 ///
0125 /// The parameters are expressed at `spacePoints[referenceIndex]`, by default
0126 /// the first one. The fit itself does not depend on that choice: every point
0127 /// contributes to the same helix, and the reference only selects where it is
0128 /// evaluated. Reporting at a point deeper in the detector lets a downstream
0129 /// track finder start where the hit density, and with it the combinatorics, is
0130 /// lower, at the cost of a longer extrapolation back to the beam line.
0131 ///
0132 /// A vanishing curvature degenerates to a line and only the direction is
0133 /// estimated. Without a field q/p stays zero.
0134 ///
0135 /// Weights are relative (e.g. inverse-variance) factors on every fit stage. An
0136 /// empty span means uniform, a non-empty one must match `spacePoints` in size.
0137 ///
0138 /// @param spacePoints the ordered global space point positions
0139 /// @param bField the homogeneous magnetic field vector
0140 /// @param t0 the time assigned to the reference point (eFreeTime)
0141 /// @param geometricRefineIterations number of Gauss-Newton refinement
0142 ///        iterations on top of the algebraic circle fit (0 disables it)
0143 /// @param weights optional per-point weights for all fit stages
0144 ///        (empty span = uniform)
0145 /// @param referenceIndex index of the space point the parameters are expressed
0146 ///        at; must be a valid index into `spacePoints`
0147 /// @return the free parameters at the reference point, or an error
0148 Result<FreeVector> estimateTrackParamsFromSpacePoints(
0149     std::span<const Vector3> spacePoints, const Vector3& bField, double t0 = 0,
0150     std::size_t geometricRefineIterations = 0,
0151     std::span<const double> weights = {}, std::size_t referenceIndex = 0);
0152 
0153 /// @}
0154 
0155 }  // namespace Acts