File indexing completed on 2025-08-05 08:09:40
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Surfaces/ConeBounds.hpp"
0010
0011 #include "Acts/Definitions/TrackParametrization.hpp"
0012
0013 #include <cmath>
0014 #include <iomanip>
0015 #include <iostream>
0016 #include <limits>
0017
0018 Acts::ConeBounds::ConeBounds(double alpha, bool symm, double halfphi,
0019 double avphi) noexcept(false)
0020 : m_values({alpha, symm ? -std::numeric_limits<double>::infinity() : 0,
0021 std::numeric_limits<double>::infinity(), halfphi, avphi}),
0022 m_tanAlpha(std::tan(alpha)) {
0023 checkConsistency();
0024 }
0025
0026 Acts::ConeBounds::ConeBounds(double alpha, double minz, double maxz,
0027 double halfphi, double avphi) noexcept(false)
0028 : m_values({alpha, minz, maxz, halfphi, avphi}),
0029 m_tanAlpha(std::tan(alpha)) {
0030 checkConsistency();
0031 }
0032
0033 Acts::ConeBounds::ConeBounds(const std::array<double, eSize>& values) noexcept(
0034 false)
0035 : m_values(values), m_tanAlpha(std::tan(values[eAlpha])) {
0036 checkConsistency();
0037 }
0038
0039 Acts::SurfaceBounds::BoundsType Acts::ConeBounds::type() const {
0040 return SurfaceBounds::eCone;
0041 }
0042
0043
0044 Acts::Vector2 Acts::ConeBounds::shifted(const Acts::Vector2& lposition) const {
0045 using Acts::detail::radian_sym;
0046
0047 auto x = r(lposition[eBoundLoc1]);
0048 Vector2 shifted;
0049 shifted[eBoundLoc1] = lposition[eBoundLoc1];
0050 shifted[eBoundLoc0] =
0051 std::isnormal(x)
0052 ? (x * radian_sym((lposition[eBoundLoc0] / x) - get(eAveragePhi)))
0053 : lposition[eBoundLoc0];
0054 return shifted;
0055 }
0056
0057 bool Acts::ConeBounds::inside(const Acts::Vector2& lposition,
0058 const Acts::BoundaryCheck& bcheck) const {
0059 auto rphiHalf = r(lposition[eBoundLoc1]) * get(eHalfPhiSector);
0060 return bcheck.isInside(shifted(lposition), Vector2(-rphiHalf, get(eMinZ)),
0061 Vector2(rphiHalf, get(eMaxZ)));
0062 }
0063
0064 std::ostream& Acts::ConeBounds::toStream(std::ostream& sl) const {
0065 sl << std::setiosflags(std::ios::fixed);
0066 sl << std::setprecision(7);
0067 sl << "Acts::ConeBounds: (tanAlpha, minZ, maxZ, halfPhiSector, averagePhi) "
0068 "= ";
0069 sl << "(" << m_tanAlpha << ", " << get(eMinZ) << ", " << get(eMaxZ) << ", "
0070 << get(eHalfPhiSector) << ", " << get(eAveragePhi) << ")";
0071 sl << std::setprecision(-1);
0072 return sl;
0073 }