![]() |
|
|||
File indexing completed on 2025-10-17 07:58:32
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/Geometry/BoundarySurfaceFace.hpp" 0013 #include "Acts/Geometry/Volume.hpp" 0014 #include "Acts/Geometry/VolumeBounds.hpp" 0015 #include "Acts/Utilities/AxisDefinitions.hpp" 0016 0017 #include <array> 0018 #include <initializer_list> 0019 #include <iosfwd> 0020 #include <memory> 0021 #include <numbers> 0022 #include <ostream> 0023 #include <vector> 0024 0025 namespace Acts { 0026 0027 class CylinderBounds; 0028 class RadialBounds; 0029 class PlanarBounds; 0030 0031 /// @class CylinderVolumeBounds 0032 /// 0033 /// Bounds for a cylindrical Volume, the orientedSurfaces(..) method creates a 0034 /// vector of up to 6 surfaces: 0035 /// 0036 /// case A) 3 Surfaces (full cylindrical tube): 0037 /// BoundarySurfaceFace [index]: 0038 /// - negativeFaceXY [0] : Acts::DiscSurface with \f$ r_{inner}=0 \f$, 0039 /// parallel to \f$ xy \f$ plane at negative \f$ z\f$ 0040 /// - positiveFaceXY [1] : Acts::DiscSurface with \f$ r_{inner}=0 \f$, 0041 /// parallel to \f$ xy \f$ plane at positive \f$ z\f$ 0042 /// - cylinderCover [2] : Acts::CylinderSurface confining the Acts::Volume 0043 /// 0044 /// case B) 4 Surfaces (tube with inner and outer radius): 0045 /// BoundarySurfaceFace [index]: 0046 /// - negativeFaceXY [0] : Acts::DiscSurface with \f$ r_{inner}>0 \f$, 0047 /// parallel to \f$ xy \f$ plane at negative \f$ z\f$ 0048 /// - positiveFaceXY [1] : Acts::DiscSurface with \f$ r_{inner}>0 \f$, 0049 /// parallel to \f$ xy \f$ plane at positive \f$ z\f$ 0050 /// - tubeOuterCover [2] : Acts::CylinderSurface with \f$ r = r_{outer} \f$ 0051 /// - tubeInnerCover [3] : Acts::CylinderSurface with \f$ r = r_{inner} \f$ 0052 /// 0053 /// case C) 6 Surfaces (sectoral tube with inner and outer radius): 0054 /// BoundarySurfaceFace [index]: 0055 /// - negativeFaceXY [0] : Acts::DiscSurface with \f$ r_{inner}>0\f$ 0056 /// and \f$ \phi < \pi \f$, 0057 /// parallel to \f$ xy \f$ plane at negative \f$z\f$ 0058 /// - positiveFaceXY [1] : Acts::DiscSurface with \f$ r_{inner}>0 \f$ 0059 /// and \f$ \phi < \pi \f$, 0060 /// parallel to \f$ xy \f$ plane at positive \f$z\f$ 0061 /// - tubeSectorOuterCover [2] : Acts::CylinderSurface with 0062 /// \f$ r = r_{outer}\f$ 0063 /// - tubeSectorInnerCover [3] : Acts::CylinderSurface with 0064 /// \f$ r = r_{inner} \f$ 0065 /// - tubeSectorNegativePhi [4] : Rectangular Acts::PlaneSurface attached to 0066 /// [0] and [1] at negative \f$ \phi \f$ 0067 /// - tubeSectorNegativePhi [5] : 0068 // Rectangular Acts::PlaneSurface attached to 0069 /// [0] and [1] at positive \f$ \phi \f$ 0070 /// 0071 class CylinderVolumeBounds : public VolumeBounds { 0072 public: 0073 /// @enum BoundValues for streaming and access 0074 enum BoundValues : unsigned int { 0075 eMinR = 0, 0076 eMaxR = 1, 0077 eHalfLengthZ = 2, 0078 eHalfPhiSector = 3, 0079 eAveragePhi = 4, 0080 eBevelMinZ = 5, 0081 eBevelMaxZ = 6, 0082 eSize 0083 }; 0084 0085 /// Enum describing the possible faces of a cylinder volume 0086 /// @note These values are synchronized with the BoundarySurfaceFace enum. 0087 /// Once Gen1 is removed, this can be changed. 0088 enum class Face : unsigned int { 0089 PositiveDisc = BoundarySurfaceFace::positiveFaceXY, 0090 NegativeDisc = BoundarySurfaceFace::negativeFaceXY, 0091 OuterCylinder = BoundarySurfaceFace::tubeOuterCover, 0092 InnerCylinder = BoundarySurfaceFace::tubeInnerCover, 0093 NegativePhiPlane = BoundarySurfaceFace::tubeSectorNegativePhi, 0094 PositivePhiPlane = BoundarySurfaceFace::tubeSectorPositivePhi 0095 }; 0096 0097 CylinderVolumeBounds() = delete; 0098 0099 /// Constructor 0100 /// 0101 /// @param rmin The inner radius of the cylinder 0102 /// @param rmax The outer radius of the cylinder 0103 /// @param halfz The half length in z 0104 /// @param halfphi The half lopening angle 0105 /// @param avgphi The average phi value 0106 /// @param bevelMinZ The bevel angle, in radians, for the negative side 0107 /// @param bevelMaxZ The bevel angle, in radians, for the positive side 0108 CylinderVolumeBounds(double rmin, double rmax, double halfz, 0109 double halfphi = std::numbers::pi, double avgphi = 0., 0110 double bevelMinZ = 0., double bevelMaxZ = 0.); 0111 0112 /// Constructor - from a fixed size array 0113 /// 0114 /// @param values The bound values 0115 explicit CylinderVolumeBounds(const std::array<double, eSize>& values); 0116 0117 /// Constructor - extruded from cylinder bounds and thickness 0118 /// 0119 /// @param cBounds the cylinder bounds 0120 /// @param thickness of the extrusion 0121 CylinderVolumeBounds(const CylinderBounds& cBounds, double thickness); 0122 0123 /// Constructor - extruded from radial bounds and thickness 0124 /// 0125 /// @param rBounds the Radial bounds 0126 /// @param thickness 0127 CylinderVolumeBounds(const RadialBounds& rBounds, double thickness); 0128 0129 /// Copy Constructor 0130 /// 0131 /// @param cylbo is the source cylinder volume bounds for the copy 0132 CylinderVolumeBounds(const CylinderVolumeBounds& cylbo); 0133 0134 ~CylinderVolumeBounds() override = default; 0135 /// Assignment operator 0136 /// @param cylbo Source cylinder volume bounds to copy from 0137 /// @return Reference to this object after assignment 0138 CylinderVolumeBounds& operator=(const CylinderVolumeBounds& cylbo) = default; 0139 0140 VolumeBounds::BoundsType type() const final { 0141 return VolumeBounds::eCylinder; 0142 } 0143 0144 /// Return the bound values as dynamically sized vector 0145 /// 0146 /// @return this returns a copy of the internal values 0147 std::vector<double> values() const final; 0148 0149 /// This method checks if position in the 3D volume 0150 /// frame is inside the cylinder 0151 /// 0152 /// @param pos is a global position to be checked 0153 /// @param tol is the tolerance for the check 0154 /// @return True if the position is inside the cylinder bounds 0155 bool inside(const Vector3& pos, double tol = 0.) const override; 0156 0157 /// Oriented surfaces, i.e. the decomposed boundary surfaces and the 0158 /// according navigation direction into the volume given the normal 0159 /// vector on the surface 0160 /// 0161 /// @param transform is the 3D transform to be applied to the boundary 0162 /// surfaces to position them in 3D space 0163 /// 0164 /// It will throw an exception if the orientation prescription is not adequate 0165 /// 0166 /// @return a vector of surfaces bounding this volume 0167 std::vector<OrientedSurface> orientedSurfaces( 0168 const Transform3& transform = Transform3::Identity()) const override; 0169 0170 /// Construct bounding box for this shape 0171 /// @param trf Optional transform 0172 /// @param envelope Optional envelope to add / subtract from min/max 0173 /// @param entity Entity to associate this bounding box with 0174 /// @return Constructed bounding box 0175 Volume::BoundingBox boundingBox(const Transform3* trf = nullptr, 0176 const Vector3& envelope = {0, 0, 0}, 0177 const Volume* entity = nullptr) const final; 0178 0179 /// Get the canonical binning directions, i.e. the axis directions 0180 /// that fully describe the shape's extent 0181 /// 0182 /// @return vector of canonical binning values 0183 std::vector<AxisDirection> canonicalAxes() const override { 0184 using enum AxisDirection; 0185 return {AxisR, AxisPhi, AxisZ}; 0186 }; 0187 0188 /// Binning offset - overloaded for some R-binning types 0189 /// 0190 /// @param aDir is the axis direction used for the binning 0191 /// @return Reference offset vector for the given axis direction 0192 Vector3 referenceOffset(AxisDirection aDir) const override; 0193 0194 /// Binning borders in double 0195 /// 0196 /// @param aDir is the axis direction used for the binning 0197 /// @return Reference border value for the given axis direction 0198 double referenceBorder(AxisDirection aDir) const override; 0199 0200 /// Output Method for std::ostream 0201 /// @param os is the output stream 0202 /// @return Reference to the output stream after writing 0203 std::ostream& toStream(std::ostream& os) const override; 0204 0205 /// Access to the bound values 0206 /// @param bValue the class nested enum for the array access 0207 /// @return The requested bound value 0208 double get(BoundValues bValue) const { return m_values[bValue]; } 0209 0210 /// Set a bound value 0211 /// @param bValue the bound value identifier 0212 /// @param value the value to be set 0213 void set(BoundValues bValue, double value); 0214 0215 /// Set a range of bound values 0216 /// @param keyValues the initializer list of key value pairs 0217 void set(std::initializer_list<std::pair<BoundValues, double>> keyValues); 0218 0219 private: 0220 /// The internal version of the bounds can be float/double 0221 std::array<double, eSize> m_values{}; 0222 0223 /// Bounds of the inner CylinderBounds 0224 std::shared_ptr<const CylinderBounds> m_innerCylinderBounds{nullptr}; 0225 /// Bounds of the inner CylinderBounds 0226 std::shared_ptr<const CylinderBounds> m_outerCylinderBounds{nullptr}; 0227 /// Bounds of the bottom/top Radial 0228 std::shared_ptr<const RadialBounds> m_discBounds{nullptr}; 0229 /// Bounds of the sector planes 0230 std::shared_ptr<const PlanarBounds> m_sectorPlaneBounds{nullptr}; 0231 0232 /// Check the input values for consistency, 0233 /// will throw a logic_exception if consistency is not given 0234 void checkConsistency(); 0235 0236 /// Helper method to create the surface bounds 0237 void buildSurfaceBounds(); 0238 }; 0239 0240 } // 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 |
![]() ![]() |