Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10: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/EventData/GenericBoundTrackParameters.hpp"
0012 #include "Acts/EventData/TrackParametersConcept.hpp"
0013 #include "Acts/Surfaces/CurvilinearSurface.hpp"
0014 
0015 namespace Acts {
0016 
0017 /// Curvilinear track parameters for a single track.
0018 ///
0019 /// @tparam particle_hypothesis_t Helper type to interpret the particle charge/momentum
0020 ///
0021 /// This is intended as a user-facing data class that adds additional accessors
0022 /// and charge/momentum interpretation on top of the pure parameters vector. All
0023 /// parameters and their corresponding covariance matrix are stored in
0024 /// curvilinear parametrization.
0025 ///
0026 /// @see GenericBoundTrackParameters
0027 template <typename particle_hypothesis_t>
0028 class GenericCurvilinearTrackParameters
0029     : public GenericBoundTrackParameters<particle_hypothesis_t> {
0030   using Base = GenericBoundTrackParameters<particle_hypothesis_t>;
0031 
0032  public:
0033   using ParametersVector = BoundVector;
0034   using CovarianceMatrix = BoundSquareMatrix;
0035   using ParticleHypothesis = particle_hypothesis_t;
0036 
0037   /// Construct from four-position, direction, and qOverP.
0038   ///
0039   /// @param pos4 Track position/time four-vector
0040   /// @param dir Track direction three-vector; normalization is ignored.
0041   /// @param qOverP Charge over momentum
0042   /// @param cov Curvilinear bound parameters covariance matrix
0043   /// @param particleHypothesis Particle hypothesis
0044   GenericCurvilinearTrackParameters(const Vector4& pos4, const Vector3& dir,
0045                                     double qOverP,
0046                                     std::optional<CovarianceMatrix> cov,
0047                                     ParticleHypothesis particleHypothesis)
0048       : Base(CurvilinearSurface(pos4.segment<3>(ePos0), dir).surface(),
0049              transformFreeToCurvilinearParameters(pos4[eTime], dir, qOverP),
0050              std::move(cov), std::move(particleHypothesis)) {}
0051 
0052   /// Construct from four-position, angles, and qOverP.
0053   ///
0054   /// @param pos4 Track position/time four-vector
0055   /// @param phi Transverse track direction angle
0056   /// @param theta Longitudinal track direction angle
0057   /// @param qOverP Charge over momentum
0058   /// @param cov Curvilinear bound parameters covariance matrix
0059   /// @param particleHypothesis Particle hypothesis
0060   GenericCurvilinearTrackParameters(const Vector4& pos4, double phi,
0061                                     double theta, double qOverP,
0062                                     std::optional<CovarianceMatrix> cov,
0063                                     ParticleHypothesis particleHypothesis)
0064       : Base(CurvilinearSurface(pos4.segment<3>(ePos0),
0065                                 makeDirectionFromPhiTheta(phi, theta))
0066                  .surface(),
0067              transformFreeToCurvilinearParameters(pos4[eTime], phi, theta,
0068                                                   qOverP),
0069              std::move(cov), std::move(particleHypothesis)) {}
0070 
0071   /// Converts a bound track parameter with a different hypothesis.
0072   template <typename other_particle_hypothesis_t>
0073   GenericCurvilinearTrackParameters(
0074       const GenericCurvilinearTrackParameters<other_particle_hypothesis_t>&
0075           other)
0076       : GenericCurvilinearTrackParameters(other.fourPosition(),
0077                                           other.particleHypothesis(),
0078                                           other.covariance()) {}
0079 
0080   /// Converts an unknown bound track parameter.
0081   template <typename other_track_parameter_t>
0082   static GenericCurvilinearTrackParameters create(
0083       const other_track_parameter_t& other) {
0084     static_assert(BoundTrackParametersConcept<other_track_parameter_t>);
0085 
0086     return GenericCurvilinearTrackParameters(
0087         other.fourPosition(), other.particleHypothesis(), other.covariance());
0088   }
0089 
0090   /// Parameters are not default constructible due to the charge type.
0091   GenericCurvilinearTrackParameters() = delete;
0092   GenericCurvilinearTrackParameters(const GenericCurvilinearTrackParameters&) =
0093       default;
0094   GenericCurvilinearTrackParameters(GenericCurvilinearTrackParameters&&) =
0095       default;
0096   ~GenericCurvilinearTrackParameters() = default;
0097   GenericCurvilinearTrackParameters& operator=(
0098       const GenericCurvilinearTrackParameters&) = default;
0099   GenericCurvilinearTrackParameters& operator=(
0100       GenericCurvilinearTrackParameters&&) = default;
0101 
0102   using GenericBoundTrackParameters<ParticleHypothesis>::fourPosition;
0103   using GenericBoundTrackParameters<ParticleHypothesis>::position;
0104 
0105   /// Space-time position four-vector.
0106   Vector4 fourPosition() const {
0107     return GenericBoundTrackParameters<ParticleHypothesis>::fourPosition({});
0108   }
0109   /// Spatial position three-vector.
0110   Vector3 position() const {
0111     return GenericBoundTrackParameters<ParticleHypothesis>::position({});
0112   }
0113 
0114   /// Reflect the parameters.
0115   /// @return Reflected parameters.
0116   GenericCurvilinearTrackParameters<ParticleHypothesis> reflect() const {
0117     GenericCurvilinearTrackParameters<ParticleHypothesis> reflected = *this;
0118     reflected.reflectInPlace();
0119     return reflected;
0120   }
0121 };
0122 
0123 }  // namespace Acts