|
|
|||
File indexing completed on 2026-11-19 10:06:13
0001 // This file is part of the ACTS project. 0002 // 0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project 0004 // 0005 // This Source Code Form is subject to the terms of the Mozilla Public 0006 // License, v. 2.0. If a copy of the MPL was not distributed with this 0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/. 0008 0009 #pragma once 0010 0011 #include "Acts/Definitions/Algebra.hpp" 0012 #include "Acts/Definitions/Tolerance.hpp" 0013 #include "Acts/Surfaces/SurfaceBounds.hpp" 0014 0015 #include <array> 0016 #include <cmath> 0017 #include <iostream> 0018 #include <numbers> 0019 #include <vector> 0020 0021 namespace Acts { 0022 0023 /// @class CylinderBounds 0024 /// @image html CylinderBounds.gif 0025 /// 0026 /// Bounds for a cylindrical Surface. 0027 /// 0028 /// These bounds may be used for a CylinderSurface 0029 /// In case of bounds for a StraightLineSurface the radius determines the radius 0030 /// within a localPosition 0031 /// is regarded as inside bounds. 0032 /// 0033 /// CylinderBounds also enhance the possibility of a cylinder segment with an 0034 /// opening angle @f$ 2\cdot\phi_{half}@f$ 0035 /// around an average @f$ \phi @f$ angle @f$ \phi_{ave} @f$. 0036 /// 0037 /// CylinderBounds also supports beveled sides defined by an angle. 0038 /// Different angles can be defined on both sides of the cylinder. 0039 /// A positive angle is defined as "extruding" from the defined Zlength, 0040 /// while a negative angle is "intruding" on the Zlength. 0041 /// + - - + 0042 /// ________________________ 0043 /// \ | / \ | / 0044 /// \ | / \ | / 0045 /// \|/______________\|/ 0046 /// 2 * ZhalfLength 0047 /// 0048 class CylinderBounds : public SurfaceBounds { 0049 public: 0050 /// @enum BoundValues 0051 /// Enumeration for the bound values 0052 enum BoundValues : int { 0053 eR = 0, 0054 eHalfLengthZ = 1, 0055 eHalfPhiSector = 2, 0056 eAveragePhi = 3, 0057 eBevelMinZ = 4, 0058 eBevelMaxZ = 5, 0059 eSize = 6 0060 }; 0061 0062 /// Constructor - full cylinder 0063 /// 0064 /// @param r The radius of the cylinder 0065 /// @param halfZ The half length in z 0066 /// @param halfPhi The half opening angle 0067 /// @param avgPhi (optional) The phi value from which the opening angle spans 0068 /// @param bevelMinZ (optional) The bevel on the negative z side 0069 /// @param bevelMaxZ (optional) The bevel on the positive z side 0070 CylinderBounds(double r, double halfZ, double halfPhi = std::numbers::pi, 0071 double avgPhi = 0., double bevelMinZ = 0., 0072 double bevelMaxZ = 0.) noexcept(false) 0073 : m_values({r, halfZ, halfPhi, avgPhi, bevelMinZ, bevelMaxZ}), 0074 m_closed(std::abs(halfPhi - std::numbers::pi) < 0075 s_fullAzimuthTolerance) { 0076 checkConsistency(); 0077 } 0078 0079 /// Constructor from array 0080 /// @param values The bound values stored in an array 0081 explicit CylinderBounds(const std::array<double, eSize>& values) noexcept( 0082 false) 0083 : m_values(values), 0084 m_closed(std::abs(values[eHalfPhiSector] - std::numbers::pi) < 0085 s_fullAzimuthTolerance) { 0086 checkConsistency(); 0087 } 0088 0089 /// @copydoc SurfaceBounds::type 0090 BoundsType type() const final { return eCylinder; } 0091 0092 /// @copydoc SurfaceBounds::isCartesian 0093 bool isCartesian() const final { return true; } 0094 0095 /// @copydoc SurfaceBounds::boundToCartesianJacobian 0096 SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final { 0097 static_cast<void>(lposition); 0098 return SquareMatrix2::Identity(); 0099 } 0100 0101 /// @copydoc SurfaceBounds::boundToCartesianMetric 0102 SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final { 0103 static_cast<void>(lposition); 0104 return SquareMatrix2::Identity(); 0105 } 0106 0107 /// Return the bound values as dynamically sized vector 0108 /// @return this returns a copy of the internal values 0109 std::vector<double> values() const final; 0110 0111 /// @copydoc SurfaceBounds::inside 0112 bool inside(const Vector2& lposition) const final; 0113 0114 /// @copydoc SurfaceBounds::closestPoint 0115 Vector2 closestPoint(const Vector2& lposition, 0116 const SquareMatrix2& metric) const final; 0117 0118 using SurfaceBounds::inside; 0119 0120 /// Access to the bound values 0121 /// @param bValue the class nested enum for the array access 0122 /// @return Value of the specified bound parameter 0123 double get(BoundValues bValue) const { return m_values[bValue]; } 0124 0125 /// Returns true for full phi coverage 0126 /// @return True if the cylinder covers full azimuthal range 0127 bool coversFullAzimuth() const { return m_closed; } 0128 0129 /// Create the bow/circle vertices on either side of the cylinder 0130 /// 0131 /// @param transform is the global transform 0132 /// @param quarterSegments is the number of segments to approximate a quarter 0133 /// of a circle. In order to symmetrize fully closed and sectoral cylinders, 0134 /// also in the first case the two end points are given (albeit they overlap) 0135 /// in -pi / pi 0136 /// 0137 /// @return a singlevector containing the vertices from one side and then 0138 /// from the other side consecutively 0139 std::vector<Vector3> circleVertices(const Transform3 transform, 0140 unsigned int quarterSegments) const; 0141 0142 /// @copydoc SurfaceBounds::center 0143 /// @note For CylinderBounds: returns (averagePhi, 0) in local (rphi, z) coordinates 0144 Vector2 center() const final; 0145 0146 /// Output Method for std::ostream 0147 /// @param sl The output stream to write to 0148 /// @return Reference to the output stream after writing 0149 std::ostream& toStream(std::ostream& sl) const final; 0150 0151 private: 0152 /// The bound radius, half Z, half phi and average phi 0153 std::array<double, eSize> m_values; 0154 /// Indicator if the bounds are closed 0155 bool m_closed{false}; 0156 0157 /// Check the input values for consistency, will throw a logic_exception 0158 /// if consistency is not given 0159 void checkConsistency() noexcept(false); 0160 0161 /// Helper method to shift into the phi-frame 0162 /// @param lposition the polar coordinates in the global frame 0163 Vector2 shifted(const Vector2& lposition) const; 0164 }; 0165 0166 } // namespace Acts
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|