Skip to content

Commit

Permalink
fix doc; tolerance less annulus inside check
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand committed Dec 19, 2024
1 parent a0d665d commit 529a109
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 48 deletions.
11 changes: 0 additions & 11 deletions Core/include/Acts/Surfaces/AnnulusBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,6 @@ class AnnulusBounds : public DiscBounds {
/// if consistency is not given
void checkConsistency() noexcept(false);

/// Inside check for the bounds object driven by the boundary check directive
/// Each Bounds has a method inside, which checks if a LocalPosition is inside
/// the bounds Inside can be called without/with tolerances.
///
/// @param lposition Local position (assumed to be in right surface frame)
/// @param tolR tolerance on the radius
/// @param tolPhi tolerance on the polar angle phi
/// @return boolean indicator for the success of this operation
virtual bool inside(const Vector2& lposition, double tolR,
double tolPhi) const final;

/// Transform the strip cartesian
/// into the module polar system
///
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Surfaces/ConeBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class ConeBounds : public SurfaceBounds {
/// @copydoc SurfaceBounds::inside
bool inside(const Vector2& lposition) const final;

/// @copydoc SurfaceBounds::inside
/// @copydoc SurfaceBounds::closestPoint
Vector2 closestPoint(const Vector2& lposition,
const std::optional<SquareMatrix2>& metric) const final;

Expand Down
56 changes: 20 additions & 36 deletions Core/src/Surfaces/AnnulusBounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,26 @@ SquareMatrix2 AnnulusBounds::boundToCartesianMetric(
}

bool AnnulusBounds::inside(const Vector2& lposition) const {
return inside(lposition, 0., 0.);
// locpo is PC in STRIP SYSTEM
// need to perform internal rotation induced by average phi
Vector2 locpo_rotated = m_rotationStripPC * lposition;
double phiLoc = locpo_rotated[1];
double rLoc = locpo_rotated[0];

if (phiLoc < get(eMinPhiRel) || phiLoc > get(eMaxPhiRel)) {
return false;
}

// calculate R in MODULE SYSTEM to evaluate R-bounds
// don't need R, can use R^2
double r_mod2 = m_shiftPC[0] * m_shiftPC[0] + rLoc * rLoc +
2 * m_shiftPC[0] * rLoc * cos(phiLoc - m_shiftPC[1]);

if (r_mod2 < get(eMinR) * get(eMinR) || r_mod2 > get(eMaxR) * get(eMaxR)) {
return false;
}

return true;
}

Vector2 AnnulusBounds::closestPoint(
Expand Down Expand Up @@ -335,41 +354,6 @@ Vector2 AnnulusBounds::closestPoint(
return currentClosest;
}

bool AnnulusBounds::inside(const Vector2& lposition, double tolR,
double tolPhi) const {
// locpo is PC in STRIP SYSTEM
// need to perform internal rotation induced by average phi
Vector2 locpo_rotated = m_rotationStripPC * lposition;
double phiLoc = locpo_rotated[1];
double rLoc = locpo_rotated[0];

if (phiLoc < (get(eMinPhiRel) - tolPhi) ||
phiLoc > (get(eMaxPhiRel) + tolPhi)) {
return false;
}

// calculate R in MODULE SYSTEM to evaluate R-bounds
if (tolR == 0.) {
// don't need R, can use R^2
double r_mod2 = m_shiftPC[0] * m_shiftPC[0] + rLoc * rLoc +
2 * m_shiftPC[0] * rLoc * cos(phiLoc - m_shiftPC[1]);

if (r_mod2 < get(eMinR) * get(eMinR) || r_mod2 > get(eMaxR) * get(eMaxR)) {
return false;
}
} else {
// use R
double r_mod = sqrt(m_shiftPC[0] * m_shiftPC[0] + rLoc * rLoc +
2 * m_shiftPC[0] * rLoc * cos(phiLoc - m_shiftPC[1]));

if (r_mod < (get(eMinR) - tolR) || r_mod > (get(eMaxR) + tolR)) {
return false;
}
}

return true;
}

Vector2 AnnulusBounds::stripXYToModulePC(const Vector2& vStripXY) const {
Vector2 vecModuleXY = vStripXY + m_shiftXY;
return {vecModuleXY.norm(), VectorHelpers::phi(vecModuleXY)};
Expand Down

0 comments on commit 529a109

Please sign in to comment.