Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:46

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/Direction.hpp"
0013 #include "Acts/Definitions/TrackParametrization.hpp"
0014 #include "Acts/Geometry/GeometryContext.hpp"
0015 #include "Acts/Surfaces/Surface.hpp"
0016 #include "Acts/Utilities/Logger.hpp"
0017 
0018 #include <optional>
0019 #include <tuple>
0020 
0021 namespace Acts {
0022 
0023 /// @brief Free to bound transformation Correction configuration class
0024 ///
0025 struct FreeToBoundCorrection {
0026   /// Apply correction or not
0027   bool apply = false;
0028 
0029   /// UKF tuning parameters
0030   double alpha = 0.1;
0031   double beta = 2;
0032 
0033   /// The cutoff of incident angles cosine for correction
0034   double cosIncidentAngleMinCutoff = 1e-5;
0035   double cosIncidentAngleMaxCutoff = 0.99500417;
0036 
0037   /// Default constructor
0038   FreeToBoundCorrection() = default;
0039 
0040   /// Construct from boolean and UKF parameters (alpha, beta)
0041   ///
0042   /// @param apply_ Whether to apply correction
0043   /// @param alpha_ The UKF tuning parameter alpha
0044   /// @param beta_ The UKF tuning parameter beta
0045   FreeToBoundCorrection(bool apply_, double alpha_, double beta_);
0046 
0047   /// Construct from boolean only
0048   ///
0049   /// @param apply_ Whether to apply correction
0050   explicit FreeToBoundCorrection(bool apply_);
0051 
0052   /// Return boolean for applying correction or not
0053   operator bool() const;
0054 };
0055 
0056 namespace detail {
0057 
0058 /// @brief Corrected free to bound transform class based on covariance matrix sqrt root in UKF: https://doi.org/10.1117/12.280797
0059 ///
0060 struct CorrectedFreeToBoundTransformer {
0061   /// Construct from boolean, UKF tuning parameters (alpha, beta) and incident
0062   /// angle cutoff for correction
0063   ///
0064   /// @param alpha The UKF tuning parameter alpha
0065   /// @param beta The UKF tuning parameter beta
0066   /// @param cosIncidentAngleMinCutoff The cosine of max incident angle
0067   /// @param cosIncidentAngleMaxCutoff The cosine of min incident angle
0068   CorrectedFreeToBoundTransformer(double alpha, double beta,
0069                                   double cosIncidentAngleMinCutoff,
0070                                   double cosIncidentAngleMaxCutoff);
0071 
0072   /// Construct from a FreeToBoundCorrection
0073   ///
0074   /// @param freeToBoundCorrection The freeToBoundCorrection object
0075   CorrectedFreeToBoundTransformer(
0076       const FreeToBoundCorrection& freeToBoundCorrection);
0077 
0078   /// Default constructors
0079   CorrectedFreeToBoundTransformer() = default;
0080   CorrectedFreeToBoundTransformer(const CorrectedFreeToBoundTransformer&) =
0081       default;
0082   CorrectedFreeToBoundTransformer(CorrectedFreeToBoundTransformer&&) = default;
0083   CorrectedFreeToBoundTransformer& operator=(
0084       const CorrectedFreeToBoundTransformer&) = default;
0085   CorrectedFreeToBoundTransformer& operator=(
0086       CorrectedFreeToBoundTransformer&&) = default;
0087 
0088   /// Get the non-linearity corrected bound parameters and its covariance
0089   ///
0090   /// @param freeParams The free parameters vector
0091   /// @param freeCovariance The free parameters covariance
0092   /// @param Surface The surface of the bound parameters being represented
0093   /// @param geoContext The geometry context
0094   /// @param navDir The navigation direction
0095   /// @param logger The logger
0096   std::optional<std::tuple<BoundVector, BoundSquareMatrix>> operator()(
0097       const FreeVector& freeParams, const FreeSquareMatrix& freeCovariance,
0098       const Surface& surface, const GeometryContext& geoContext,
0099       Direction navDir = Direction::Forward(),
0100       const Logger& logger = getDummyLogger()) const;
0101 
0102  private:
0103   /// The parameters to tune the weight in UKF (0 < alpha <=1)
0104   double m_alpha = 0.1;
0105   double m_beta = 2;
0106 
0107   /// The maximum incident angle (i.e. minimum cos incident angle) cutoff for
0108   /// correction
0109   double m_cosIncidentAngleMinCutoff = 1e-5;
0110 
0111   /// The minimum incident angle (i.e. maximum cos incident angle) cutoff for
0112   /// correction, note cos(0.1) = 0.99500417
0113   double m_cosIncidentAngleMaxCutoff = 0.99500417;
0114 };
0115 
0116 }  // namespace detail
0117 }  // namespace Acts