Skip to content

Commit

Permalink
move function definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand committed Dec 18, 2024
1 parent f876ea0 commit 1155b26
Show file tree
Hide file tree
Showing 20 changed files with 223 additions and 366 deletions.
84 changes: 16 additions & 68 deletions Core/include/Acts/Surfaces/AnnulusBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ class AnnulusBounds : public DiscBounds {

AnnulusBounds(const AnnulusBounds& source) = default;

SurfaceBounds::BoundsType type() const final;
SurfaceBounds::BoundsType type() const final {
return SurfaceBounds::eAnnulus;
}

/// Return the bound values as dynamically sized vector
///
Expand Down Expand Up @@ -98,24 +100,29 @@ class AnnulusBounds : public DiscBounds {

/// @brief Returns the right angular edge of the module
/// @return The right side angle
double phiMin() const;
double phiMin() const { return get(eMinPhiRel) + get(eAveragePhi); }

/// @brief Returns the left angular edge of the module
/// @return The left side angle
double phiMax() const;
double phiMax() const { return get(eMaxPhiRel) + get(eAveragePhi); }

/// Returns true for full phi coverage
bool coversFullAzimuth() const final;
bool coversFullAzimuth() const final {
return (std::abs((get(eMinPhiRel) - get(eMaxPhiRel)) - std::numbers::pi) <
s_onSurfaceTolerance);
}

/// Checks if this is inside the radial coverage
/// given the a tolerance
bool insideRadialBounds(double R, double tolerance = 0.) const final;
bool insideRadialBounds(double R, double tolerance = 0.) const final {
return ((R + tolerance) > get(eMinR) && (R - tolerance) < get(eMaxR));
}

/// Return a reference radius for binning
double binningValueR() const final;
double binningValueR() const final { return 0.5 * (get(eMinR) + get(eMaxR)); }

/// Return a reference radius for binning
double binningValuePhi() const final;
double binningValuePhi() const final { return get(eAveragePhi); }

/// @brief Returns moduleOrigin, but rotated out, so @c averagePhi is already
/// considered. The module origin needs to consider the rotation introduced by
Expand Down Expand Up @@ -146,10 +153,10 @@ class AnnulusBounds : public DiscBounds {
unsigned int quarterSegments = 2u) const override;

/// This method returns inner radius
double rMin() const final;
double rMin() const final { return get(eMinR); }

/// This method returns outer radius
double rMax() const final;
double rMax() const final { return get(eMaxR); }

private:
std::array<double, eSize> m_values;
Expand Down Expand Up @@ -207,63 +214,4 @@ class AnnulusBounds : public DiscBounds {
double squaredNorm(const Vector2& v, const SquareMatrix2& weight) const;
};

inline SurfaceBounds::BoundsType AnnulusBounds::type() const {
return SurfaceBounds::eAnnulus;
}

inline double AnnulusBounds::rMin() const {
return get(eMinR);
}

inline double AnnulusBounds::rMax() const {
return get(eMaxR);
}

inline double AnnulusBounds::phiMin() const {
return get(eMinPhiRel) + get(eAveragePhi);
}

inline double AnnulusBounds::phiMax() const {
return get(eMaxPhiRel) + get(eAveragePhi);
}

inline bool AnnulusBounds::coversFullAzimuth() const {
return (std::abs((get(eMinPhiRel) - get(eMaxPhiRel)) - std::numbers::pi) <
s_onSurfaceTolerance);
}

inline bool AnnulusBounds::insideRadialBounds(double R,
double tolerance) const {
return ((R + tolerance) > get(eMinR) && (R - tolerance) < get(eMaxR));
}

inline double AnnulusBounds::binningValueR() const {
return 0.5 * (get(eMinR) + get(eMaxR));
}

inline double AnnulusBounds::binningValuePhi() const {
return get(eAveragePhi);
}

inline std::vector<double> AnnulusBounds::values() const {
std::vector<double> valvector;
valvector.insert(valvector.begin(), m_values.begin(), m_values.end());
return valvector;
}

inline void AnnulusBounds::checkConsistency() noexcept(false) {
if (get(eMinR) < 0. || get(eMaxR) < 0. || get(eMinR) > get(eMaxR) ||
std::abs(get(eMinR) - get(eMaxR)) < s_epsilon) {
throw std::invalid_argument("AnnulusBounds: invalid radial setup.");
}
if (get(eMinPhiRel) != detail::radian_sym(get(eMinPhiRel)) ||
get(eMaxPhiRel) != detail::radian_sym(get(eMaxPhiRel)) ||
get(eMinPhiRel) > get(eMaxPhiRel)) {
throw std::invalid_argument("AnnulusBounds: invalid phi boundary setup.");
}
if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) {
throw std::invalid_argument("AnnulusBounds: invalid phi positioning.");
}
}

} // namespace Acts
39 changes: 3 additions & 36 deletions Core/include/Acts/Surfaces/ConeBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@
#pragma once

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/Tolerance.hpp"
#include "Acts/Surfaces/BoundaryTolerance.hpp"
#include "Acts/Surfaces/SurfaceBounds.hpp"
#include "Acts/Utilities/detail/periodic.hpp"

#include <array>
#include <cmath>
#include <cstdlib>
#include <iosfwd>
#include <numbers>
#include <stdexcept>
#include <vector>

namespace Acts {
Expand Down Expand Up @@ -74,7 +71,7 @@ class ConeBounds : public SurfaceBounds {
/// @param values The parameter array
ConeBounds(const std::array<double, eSize>& values) noexcept(false);

BoundsType type() const final;
BoundsType type() const final { return SurfaceBounds::eCone; }

/// Return the bound values as dynamically sized vector
///
Expand All @@ -100,10 +97,10 @@ class ConeBounds : public SurfaceBounds {
///
/// @param z is the z value for which r is requested
/// @return is the r value associated with z
double r(double z) const;
double r(double z) const { return std::abs(z * m_tanAlpha); }

/// Return tangent of alpha (pre-computed)
double tanAlpha() const;
double tanAlpha() const { return m_tanAlpha; }

/// Access to the bound values
/// @param bValue the class nested enum for the array access
Expand All @@ -123,34 +120,4 @@ class ConeBounds : public SurfaceBounds {
Vector2 shifted(const Vector2& lposition) const;
};

inline double ConeBounds::r(double z) const {
return std::abs(z * m_tanAlpha);
}

inline double ConeBounds::tanAlpha() const {
return m_tanAlpha;
}

inline std::vector<double> ConeBounds::values() const {
std::vector<double> valvector;
valvector.insert(valvector.begin(), m_values.begin(), m_values.end());
return valvector;
}

inline void ConeBounds::checkConsistency() noexcept(false) {
if (get(eAlpha) < 0. || get(eAlpha) >= std::numbers::pi) {
throw std::invalid_argument("ConeBounds: invalid open angle.");
}
if (get(eMinZ) > get(eMaxZ) ||
std::abs(get(eMinZ) - get(eMaxZ)) < s_epsilon) {
throw std::invalid_argument("ConeBounds: invalid z range setup.");
}
if (get(eHalfPhiSector) < 0. || abs(eHalfPhiSector) > std::numbers::pi) {
throw std::invalid_argument("ConeBounds: invalid phi sector setup.");
}
if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) {
throw std::invalid_argument("ConeBounds: invalid phi positioning.");
}
}

} // namespace Acts
14 changes: 2 additions & 12 deletions Core/include/Acts/Surfaces/CylinderBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class CylinderBounds : public SurfaceBounds {
double get(BoundValues bValue) const { return m_values[bValue]; }

/// Returns true for full phi coverage
bool coversFullAzimuth() const;
bool coversFullAzimuth() const { return m_closed; }

/// Create the bow/circle vertices on either side of the cylinder
///
Expand Down Expand Up @@ -138,17 +138,7 @@ class CylinderBounds : public SurfaceBounds {
Vector2 shifted(const Vector2& lposition) const;

/// Return the jacobian into the polar coordinate
ActsMatrix<2, 2> jacobian() const;
SquareMatrix2 jacobian() const;
};

inline std::vector<double> CylinderBounds::values() const {
std::vector<double> valvector;
valvector.insert(valvector.begin(), m_values.begin(), m_values.end());
return valvector;
}

inline bool CylinderBounds::coversFullAzimuth() const {
return m_closed;
}

} // namespace Acts
17 changes: 0 additions & 17 deletions Core/include/Acts/Surfaces/DiamondBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <algorithm>
#include <array>
#include <iosfwd>
#include <stdexcept>
#include <vector>

namespace Acts {
Expand Down Expand Up @@ -113,20 +112,4 @@ class DiamondBounds : public PlanarBounds {
void checkConsistency() noexcept(false);
};

inline std::vector<double> DiamondBounds::values() const {
std::vector<double> valvector;
valvector.insert(valvector.begin(), m_values.begin(), m_values.end());
return valvector;
}

inline void DiamondBounds::checkConsistency() noexcept(false) {
if (std::ranges::any_of(m_values, [](auto v) { return v <= 0.; })) {
throw std::invalid_argument("DiamondBounds: negative half length.");
}
if (get(eHalfLengthXnegY) > get(eHalfLengthXzeroY) ||
get(eHalfLengthXposY) > get(eHalfLengthXzeroY)) {
throw std::invalid_argument("DiamondBounds: not a diamond shape.");
}
}

} // namespace Acts
Loading

0 comments on commit 1155b26

Please sign in to comment.