File indexing completed on 2025-08-05 08:09:40
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Surfaces/CurvilinearSurface.hpp"
0010
0011 #include "Acts/Definitions/Tolerance.hpp"
0012 #include "Acts/Surfaces/PlaneSurface.hpp"
0013 #include "Acts/Utilities/JacobianHelpers.hpp"
0014 #include "Acts/Utilities/VectorHelpers.hpp"
0015
0016 #include <iomanip>
0017 #include <ios>
0018 #include <ostream>
0019
0020 namespace Acts {
0021
0022 bool CurvilinearSurface::isStandardRepresentation() const {
0023 Vector3 T = m_direction.normalized();
0024 return std::abs(T.dot(Vector3::UnitZ())) < s_curvilinearProjTolerance;
0025 }
0026
0027 RotationMatrix3 CurvilinearSurface::referenceFrame() const {
0028
0029
0030
0031
0032 Vector3 T = m_direction.normalized();
0033 Vector3 U = (isStandardRepresentation() ? Vector3::UnitZ() : Vector3::UnitX())
0034 .cross(T)
0035 .normalized();
0036 Vector3 V = T.cross(U);
0037
0038 RotationMatrix3 rframe;
0039 rframe << U, V, T;
0040 return rframe;
0041 }
0042
0043 Transform3 CurvilinearSurface::transform() const {
0044 Transform3 transform = Transform3(referenceFrame());
0045 transform.pretranslate(center());
0046 return transform;
0047 }
0048
0049 BoundToFreeMatrix CurvilinearSurface::boundToFreeJacobian() const {
0050
0051
0052
0053
0054 BoundToFreeMatrix jacobian = BoundToFreeMatrix::Zero();
0055
0056
0057 const auto rframe = referenceFrame();
0058
0059
0060 jacobian.topLeftCorner<3, 2>() = rframe.topLeftCorner<3, 2>();
0061
0062 jacobian(eFreeTime, eBoundTime) = 1;
0063
0064 jacobian.block<3, 2>(eFreeDir0, eBoundPhi) =
0065 sphericalToFreeDirectionJacobian(m_direction);
0066 jacobian(eFreeQOverP, eBoundQOverP) = 1;
0067
0068 return jacobian;
0069 }
0070
0071 FreeToBoundMatrix CurvilinearSurface::freeToBoundJacobian() const {
0072
0073
0074
0075
0076 FreeToBoundMatrix jacobian = FreeToBoundMatrix::Zero();
0077
0078
0079 RotationMatrix3 rframeT = referenceFrame().transpose();
0080
0081
0082 jacobian.block<2, 3>(eBoundLoc0, eFreePos0) = rframeT.block<2, 3>(0, 0);
0083
0084 jacobian(eBoundTime, eFreeTime) = 1;
0085
0086 jacobian.block<2, 3>(eBoundPhi, eFreeDir0) =
0087 freeToSphericalDirectionJacobian(m_direction);
0088 jacobian(eBoundQOverP, eFreeQOverP) = 1;
0089
0090 return jacobian;
0091 }
0092
0093 FreeToPathMatrix CurvilinearSurface::freeToPathDerivative() const {
0094 FreeToPathMatrix freeToPath = FreeToPathMatrix::Zero();
0095 freeToPath.segment<3>(eFreePos0) = -1.0 * m_direction;
0096 return freeToPath;
0097 }
0098
0099 std::ostream& CurvilinearSurface::toStream(std::ostream& sl) const {
0100 sl << "Curvilinear Surface" << std::endl;
0101 sl << " Center position (x, y, z) = (" << m_position.x() << ", "
0102 << m_position.y() << ", " << m_position.z() << ")" << std::endl;
0103 sl << " Direction (x, y, z) = (" << m_direction.x() << ", "
0104 << m_direction.y() << ", " << m_direction.z() << ")" << std::endl;
0105 return sl;
0106 }
0107
0108 std::string CurvilinearSurface::toString() const {
0109 std::stringstream ss;
0110 ss << std::setiosflags(std::ios::fixed);
0111 ss << std::setprecision(4);
0112 ss << std::boolalpha;
0113 toStream(ss);
0114 return ss.str();
0115 }
0116
0117 std::shared_ptr<PlaneSurface> CurvilinearSurface::planeSurface() const {
0118 return Surface::makeShared<PlaneSurface>(transform());
0119 }
0120
0121 std::shared_ptr<Surface> CurvilinearSurface::surface() const {
0122 return planeSurface();
0123 }
0124
0125 std::ostream& operator<<(std::ostream& os, const CurvilinearSurface& surface) {
0126 return surface.toStream(os);
0127 }
0128
0129 }