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