Skip to content

Commit

Permalink
revert: "perf: LineSurface back to col(2) for local z axis (acts-…
Browse files Browse the repository at this point in the history
…project#2369)" (acts-project#2377)

Unexpectedly acts-project#2369 seems to change the Athena output which should only happen in major versions of Acts.
  • Loading branch information
andiwand authored Aug 17, 2023
1 parent a22a8be commit 92841d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
2 changes: 0 additions & 2 deletions Core/include/Acts/Surfaces/LineSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,6 @@ 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: 6 additions & 11 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 unitZ0 = lineDirection(gctx);
Vector3 lineDirection = transform(gctx).rotation() * Vector3::UnitZ();

// get the vector perpendicular to the momentum direction and the straw axis
Vector3 radiusAxisGlobal = unitZ0.cross(direction);
Vector3 radiusAxisGlobal = lineDirection.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 = lineDirection(gctx);
Vector3 unitZ0 = transform(gctx).rotation() * Vector3::UnitZ();
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 = lineDirection(gctx);
Vector3 eb = transform(gctx).rotation() * Vector3::UnitZ();

// 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 = lineDirection(gctx);
Vector3 localZAxis = transform(gctx).rotation() * Vector3::UnitZ();
// 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 = lineDirection(gctx);
Vector3 localZAxis = transform(gctx).rotation() * Vector3::UnitZ();
// 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,8 +321,3 @@ 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 92841d7

Please sign in to comment.