Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-01 07:53:29

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/TrackParametrization.hpp"
0013 
0014 #include <iosfwd>
0015 #include <memory>
0016 #include <string>
0017 
0018 namespace Acts {
0019 
0020 class Surface;
0021 class PlaneSurface;
0022 
0023 /// @brief Utility class for curvilinear surfaces
0024 ///
0025 class CurvilinearSurface final {
0026  public:
0027   /// Constructor with direction vector
0028   /// @param direction The direction vector of the curvilinear surface
0029   explicit CurvilinearSurface(const Vector3& direction)
0030       : m_direction{direction} {}
0031 
0032   /// Constructor with direction vector
0033   /// @param position The position of the curvilinear surface
0034   /// @param direction The direction vector of the curvilinear surface
0035   CurvilinearSurface(const Vector3& position, const Vector3& direction)
0036       : m_position{position}, m_direction{direction} {}
0037 
0038   /// Return method for the surface center by reference
0039   /// @note the center is always recalculated in order to not keep a cache
0040   /// @return center position by value
0041   Vector3 center() const { return m_position; }
0042 
0043   /// Return the surface normal at a given @p position and @p direction.
0044   /// This method is fully generic, and valid for all surface types.
0045   /// @note For some surface types, the @p direction is ignored, but
0046   ///       it is **not safe** to pass in a zero vector!
0047   /// @return The normal vector at the given position and direction
0048   Vector3 normal() const { return m_direction; }
0049 
0050   /// Check if this curvilinear surface uses standard representation
0051   /// @return True if using standard representation, false otherwise
0052   bool isStandardRepresentation() const;
0053 
0054   /// Return method for the reference frame
0055   /// This is the frame in which the covariance matrix is defined (specialized
0056   /// by all surfaces)
0057   ///
0058   /// @return RotationMatrix3 which defines the three axes of the measurement
0059   /// frame
0060   RotationMatrix3 referenceFrame() const;
0061 
0062   /// Return method for the surface Transform3 by reference
0063   /// In case a detector element is associated the surface transform
0064   /// is just forwarded to the detector element in order to keep the
0065   /// (mis-)alignment cache cetrally handled
0066   ///
0067   /// @return the contextual transform
0068   Transform3 transform() const;
0069 
0070   /// Calculate the jacobian from local to global which the surface knows best,
0071   /// hence the calculation is done here.
0072   ///
0073   /// @return Jacobian from local to global
0074   BoundToFreeMatrix boundToFreeJacobian() const;
0075 
0076   /// Calculate the jacobian from global to local which the surface knows best,
0077   /// hence the calculation is done here.
0078   ///
0079   /// @return Jacobian from global to local
0080   FreeToBoundMatrix freeToBoundJacobian() const;
0081 
0082   /// Calculate the derivative of path length at the geometry constraint or
0083   /// point-of-closest-approach w.r.t. free parameters. The calculation is
0084   /// identical for all surfaces where the reference frame does not depend on
0085   /// the direction
0086   ///
0087   /// @return Derivative of path length w.r.t. free parameters
0088   FreeToPathMatrix freeToPathDerivative() const;
0089 
0090   /// Output Method for std::ostream
0091   ///
0092   /// @param sl is the ostream to be dumped into
0093   /// @return Reference to the output stream after writing
0094   std::ostream& toStream(std::ostream& sl) const;
0095 
0096   /// Output into a std::string
0097   ///
0098   /// @return the string representation of the curvilinear surface
0099   std::string toString() const;
0100 
0101   /// Return the plane surface representation of the curvilinear surface
0102   ///
0103   /// @return the plane surface representation of the curvilinear surface
0104   std::shared_ptr<PlaneSurface> planeSurface() const;
0105 
0106   /// Return the surface representation of the curvilinear surface
0107   ///
0108   /// @note same as planeSurface() but returns the base class.
0109   ///   This is useful if the type of the surface is not relevant.
0110   ///
0111   /// @return the surface representation of the curvilinear surface
0112   std::shared_ptr<Surface> surface() const;
0113 
0114   /// Output operator
0115   ///
0116   /// @param os is the ostream to be dumped into
0117   /// @param surface is the CurvilinearSurface to be dumped
0118   /// @return the ostream
0119   friend std::ostream& operator<<(std::ostream& os,
0120                                   const CurvilinearSurface& surface);
0121 
0122  private:
0123   Vector3 m_position = Vector3::Zero();
0124   Vector3 m_direction = Vector3::UnitZ();
0125 };
0126 
0127 }  // namespace Acts