Skip to content

Commit

Permalink
Merge branch 'main' into refactor/consistent-measurement-id
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Aug 15, 2023
2 parents 4d583b4 + 951edca commit 2d8cb4a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Core/include/Acts/Surfaces/LineSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ class LineSurface : public Surface {
ActsMatrix<2, 3> localCartesianToBoundLocalDerivative(
const GeometryContext& gctx, const Vector3& position) const final;

Vector3 lineDirection(const GeometryContext& gctx) const;

protected:
std::shared_ptr<const LineBounds> m_bounds; ///< bounds (shared)

Expand Down
17 changes: 11 additions & 6 deletions Core/src/Surfaces/LineSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ Acts::LineSurface& Acts::LineSurface::operator=(const LineSurface& other) {
Acts::Vector3 Acts::LineSurface::localToGlobal(const GeometryContext& gctx,
const Vector2& lposition,
const Vector3& direction) const {
Vector3 lineDirection = transform(gctx).rotation() * Vector3::UnitZ();
Vector3 unitZ0 = lineDirection(gctx);

// get the vector perpendicular to the momentum direction and the straw axis
Vector3 radiusAxisGlobal = lineDirection.cross(direction);
Vector3 radiusAxisGlobal = unitZ0.cross(direction);
Vector3 locZinGlobal =
transform(gctx) * Vector3(0., 0., lposition[eBoundLoc1]);
// add eBoundLoc0 * radiusAxis
Expand Down Expand Up @@ -109,7 +109,7 @@ std::string Acts::LineSurface::name() const {
Acts::RotationMatrix3 Acts::LineSurface::referenceFrame(
const GeometryContext& gctx, const Vector3& /*position*/,
const Vector3& direction) const {
Vector3 unitZ0 = transform(gctx).rotation() * Vector3::UnitZ();
Vector3 unitZ0 = lineDirection(gctx);
Vector3 unitD0 = unitZ0.cross(direction).normalized();
Vector3 unitDistance = unitD0.cross(unitZ0);

Expand Down Expand Up @@ -157,7 +157,7 @@ Acts::SurfaceIntersection Acts::LineSurface::intersect(
// Origin of the line surface
Vector3 mb = transform(gctx).translation();
// Line surface axis
Vector3 eb = transform(gctx).rotation() * Vector3::UnitZ();
Vector3 eb = lineDirection(gctx);

// Now go ahead and solve for the closest approach
Vector3 mab = mb - ma;
Expand Down Expand Up @@ -258,7 +258,7 @@ Acts::FreeToPathMatrix Acts::LineSurface::freeToPathDerivative(
// The vector between position and center
Vector3 pcRowVec = position - center(gctx);
// The local frame z axis
Vector3 localZAxis = transform(gctx).rotation() * Vector3::UnitZ();
Vector3 localZAxis = lineDirection(gctx);
// The local z coordinate
double pz = pcRowVec.dot(localZAxis);
// Cosine of angle between momentum direction and local frame z axis
Expand Down Expand Up @@ -288,7 +288,7 @@ Acts::AlignmentToPathMatrix Acts::LineSurface::alignmentToPathDerivative(
// The vector between position and center
Vector3 pcRowVec = position - center(gctx);
// The local frame z axis
Vector3 localZAxis = transform(gctx).rotation() * Vector3::UnitZ();
Vector3 localZAxis = lineDirection(gctx);
// The local z coordinate
double pz = pcRowVec.dot(localZAxis);
// Cosine of angle between momentum direction and local frame z axis
Expand Down Expand Up @@ -321,3 +321,8 @@ Acts::ActsMatrix<2, 3> Acts::LineSurface::localCartesianToBoundLocalDerivative(

return loc3DToLocBound;
}

Acts::Vector3 Acts::LineSurface::lineDirection(
const GeometryContext& gctx) const {
return transform(gctx).linear().col(2);
}

0 comments on commit 2d8cb4a

Please sign in to comment.