|
||||
File indexing completed on 2025-01-19 09:23:34
0001 // This file is part of the Acts project. 0002 // 0003 // Copyright (C) 2016-2020 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 http://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/BoundaryCheck.hpp" 0014 #include "Acts/Surfaces/SurfaceBounds.hpp" 0015 #include "Acts/Utilities/detail/periodic.hpp" 0016 0017 #include <array> 0018 #include <cmath> 0019 #include <cstddef> 0020 #include <iostream> 0021 #include <stdexcept> 0022 #include <vector> 0023 0024 namespace Acts { 0025 0026 /// @class CylinderBounds 0027 /// @image html CylinderBounds.gif 0028 /// 0029 /// Bounds for a cylindrical Surface. 0030 /// 0031 /// These bounds may be used for a CylinderSurface 0032 /// In case of bounds for a StraightLineSurface the radius determines the radius 0033 /// within a localPosition 0034 /// is regarded as inside bounds. 0035 /// 0036 /// CylinderBounds also enhance the possibility of a cylinder segment with an 0037 /// opening angle @f$ 2\cdot\phi_{half}@f$ 0038 /// around an average @f$ \phi @f$ angle @f$ \phi_{ave} @f$. 0039 /// 0040 /// CylinderBounds also supports beveled sides defined by an angle. 0041 /// Different angles can be defined on both sides of the cylinder. 0042 /// A positive angle is defined as "extruding" from the defined Zlength, 0043 /// while a negative angle is "intruding" on the Zlength. 0044 /// + - - + 0045 /// ________________________ 0046 /// \ | / \ | / 0047 /// \ | / \ | / 0048 /// \|/______________\|/ 0049 /// 2 * ZhalfLength 0050 class CylinderBounds : public SurfaceBounds { 0051 public: 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 CylinderBounds() = delete; 0063 0064 /// Constructor - full cylinder 0065 /// 0066 /// @param r The radius of the cylinder 0067 /// @param halfZ The half length in z 0068 /// @param halfPhi The half opening angle 0069 /// @param avgPhi (optional) The phi value from which the opening angle spans 0070 /// @param bevelMinZ (optional) The bevel on the negative z side 0071 /// @param bevelMaxZ (optional) The bevel on the positive z sid The bevel on the positive z side 0072 CylinderBounds(double r, double halfZ, double halfPhi = M_PI, 0073 double avgPhi = 0., double bevelMinZ = 0., 0074 double bevelMaxZ = 0.) noexcept(false) 0075 : m_values({r, halfZ, halfPhi, avgPhi, bevelMinZ, bevelMaxZ}), 0076 m_closed(std::abs(halfPhi - M_PI) < s_epsilon) { 0077 checkConsistency(); 0078 } 0079 0080 /// Constructor - from fixed size array 0081 /// 0082 /// @param values The parameter values 0083 CylinderBounds(const std::array<double, eSize>& values) noexcept(false) 0084 : m_values(values), 0085 m_closed(std::abs(values[eHalfPhiSector] - M_PI) < s_epsilon) { 0086 checkConsistency(); 0087 } 0088 0089 ~CylinderBounds() override = default; 0090 0091 BoundsType type() const final; 0092 0093 /// Return the bound values as dynamically sized vector 0094 /// 0095 /// @return this returns a copy of the internal values 0096 std::vector<double> values() const final; 0097 0098 /// Inside check for the bounds object driven by the boundary check directive 0099 /// Each Bounds has a method inside, which checks if a LocalPosition is inside 0100 /// the bounds Inside can be called without/with tolerances. 0101 /// 0102 /// @param lposition Local position (assumed to be in right surface frame) 0103 /// @param bcheck boundary check directive 0104 /// @return boolean indicator for the success of this operation 0105 bool inside(const Vector2& lposition, 0106 const BoundaryCheck& bcheck) const final; 0107 0108 /// Specialized method for CylinderBounds that checks if a global position 0109 /// is within the cylinder cover 0110 /// 0111 /// @param position is the position in the cylinder frame 0112 /// @param bcheck is the boundary check directive 0113 /// @return boolean indicator for operation success 0114 bool inside3D(const Vector3& position, 0115 const BoundaryCheck& bcheck = BoundaryCheck(true)) const; 0116 0117 /// Access to the bound values 0118 /// @param bValue the class nested enum for the array access 0119 double get(BoundValues bValue) const { return m_values[bValue]; } 0120 0121 /// Returns true for full phi coverage 0122 bool coversFullAzimuth() const; 0123 0124 /// Create the bows/circles on either side of the cylinder 0125 /// 0126 /// @param trans is the global transform 0127 /// @param lseg are the numbero if phi segments 0128 std::vector<Vector3> createCircles(const Transform3 trans, 0129 std::size_t lseg) const; 0130 0131 /// Output Method for std::ostream 0132 std::ostream& toStream(std::ostream& sl) const final; 0133 0134 private: 0135 /// The bound radius, half Z, half phi and average phi 0136 std::array<double, eSize> m_values; 0137 /// Indicator if the bounds are closed 0138 bool m_closed{false}; 0139 0140 /// Check the input values for consistency, will throw a logic_exception 0141 /// if consistency is not given 0142 void checkConsistency() noexcept(false); 0143 0144 /// Helper method to shift into the phi-frame 0145 /// @param lposition the polar coordinates in the global frame 0146 Vector2 shifted(const Vector2& lposition) const; 0147 0148 /// Return the jacobian into the polar coordinate 0149 ActsMatrix<2, 2> jacobian() const; 0150 }; 0151 0152 inline std::vector<double> CylinderBounds::values() const { 0153 std::vector<double> valvector; 0154 valvector.insert(valvector.begin(), m_values.begin(), m_values.end()); 0155 return valvector; 0156 } 0157 0158 inline bool CylinderBounds::coversFullAzimuth() const { 0159 return m_closed; 0160 } 0161 0162 } // 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 |