Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:09:59

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2016-2020 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 http://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 Scalar = ActsScalar;
0034   using ParametersVector = BoundVector;
0035   using CovarianceMatrix = BoundSquareMatrix;
0036   using ParticleHypothesis = particle_hypothesis_t;
0037 
0038   /// Construct from four-position, direction, and qOverP.
0039   ///
0040   /// @param pos4 Track position/time four-vector
0041   /// @param dir Track direction three-vector; normalization is ignored.
0042   /// @param qOverP Charge over momentum
0043   /// @param cov Curvilinear bound parameters covariance matrix
0044   /// @param particleHypothesis Particle hypothesis
0045   GenericCurvilinearTrackParameters(const Vector4& pos4, const Vector3& dir,
0046                                     Scalar qOverP,
0047                                     std::optional<CovarianceMatrix> cov,
0048                                     ParticleHypothesis particleHypothesis)
0049       : Base(CurvilinearSurface(pos4.segment<3>(ePos0), dir).surface(),
0050              transformFreeToCurvilinearParameters(pos4[eTime], dir, qOverP),
0051              std::move(cov), std::move(particleHypothesis)) {}
0052 
0053   /// Construct from four-position, angles, and qOverP.
0054   ///
0055   /// @param pos4 Track position/time four-vector
0056   /// @param phi Transverse track direction angle
0057   /// @param theta Longitudinal track direction angle
0058   /// @param qOverP Charge over momentum
0059   /// @param cov Curvilinear bound parameters covariance matrix
0060   /// @param particleHypothesis Particle hypothesis
0061   GenericCurvilinearTrackParameters(const Vector4& pos4, Scalar phi,
0062                                     Scalar theta, Scalar qOverP,
0063                                     std::optional<CovarianceMatrix> cov,
0064                                     ParticleHypothesis particleHypothesis)
0065       : Base(CurvilinearSurface(pos4.segment<3>(ePos0),
0066                                 makeDirectionFromPhiTheta(phi, theta))
0067                  .surface(),
0068              transformFreeToCurvilinearParameters(pos4[eTime], phi, theta,
0069                                                   qOverP),
0070              std::move(cov), std::move(particleHypothesis)) {}
0071 
0072   /// Converts a bound track parameter with a different hypothesis.
0073   template <typename other_particle_hypothesis_t>
0074   GenericCurvilinearTrackParameters(
0075       const GenericCurvilinearTrackParameters<other_particle_hypothesis_t>&
0076           other)
0077       : GenericCurvilinearTrackParameters(other.fourPosition(),
0078                                           other.particleHypothesis(),
0079                                           other.covariance()) {}
0080 
0081   /// Converts an unknown bound track parameter.
0082   template <typename other_track_parameter_t>
0083   static GenericCurvilinearTrackParameters create(
0084       const other_track_parameter_t& other) {
0085     static_assert(
0086         Concepts::BoundTrackParametersConcept<other_track_parameter_t>);
0087 
0088     return GenericCurvilinearTrackParameters(
0089         other.fourPosition(), other.particleHypothesis(), other.covariance());
0090   }
0091 
0092   /// Parameters are not default constructible due to the charge type.
0093   GenericCurvilinearTrackParameters() = delete;
0094   GenericCurvilinearTrackParameters(const GenericCurvilinearTrackParameters&) =
0095       default;
0096   GenericCurvilinearTrackParameters(GenericCurvilinearTrackParameters&&) =
0097       default;
0098   ~GenericCurvilinearTrackParameters() = default;
0099   GenericCurvilinearTrackParameters& operator=(
0100       const GenericCurvilinearTrackParameters&) = default;
0101   GenericCurvilinearTrackParameters& operator=(
0102       GenericCurvilinearTrackParameters&&) = default;
0103 
0104   using GenericBoundTrackParameters<ParticleHypothesis>::fourPosition;
0105   using GenericBoundTrackParameters<ParticleHypothesis>::position;
0106 
0107   /// Space-time position four-vector.
0108   Vector4 fourPosition() const {
0109     return GenericBoundTrackParameters<ParticleHypothesis>::fourPosition({});
0110   }
0111   /// Spatial position three-vector.
0112   Vector3 position() const {
0113     return GenericBoundTrackParameters<ParticleHypothesis>::position({});
0114   }
0115 };
0116 
0117 }  // namespace Acts