|
||||
File indexing completed on 2025-01-18 09:10:51
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 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 CylinderVolumeBounds& operator=(const CylinderVolumeBounds& cylbo) = default; 0136 0137 VolumeBounds::BoundsType type() const final { 0138 return VolumeBounds::eCylinder; 0139 } 0140 0141 /// Return the bound values as dynamically sized vector 0142 /// 0143 /// @return this returns a copy of the internal values 0144 std::vector<double> values() const final; 0145 0146 /// This method checks if position in the 3D volume 0147 /// frame is inside the cylinder 0148 /// 0149 /// @param pos is a global position to be checked 0150 /// @param tol is the tolerance for the check 0151 bool inside(const Vector3& pos, double tol = 0.) const override; 0152 0153 /// Oriented surfaces, i.e. the decomposed boundary surfaces and the 0154 /// according navigation direction into the volume given the normal 0155 /// vector on the surface 0156 /// 0157 /// @param transform is the 3D transform to be applied to the boundary 0158 /// surfaces to position them in 3D space 0159 /// 0160 /// It will throw an exception if the orientation prescription is not adequate 0161 /// 0162 /// @return a vector of surfaces bounding this volume 0163 std::vector<OrientedSurface> orientedSurfaces( 0164 const Transform3& transform = Transform3::Identity()) const override; 0165 0166 /// Construct bounding box for this shape 0167 /// @param trf Optional transform 0168 /// @param envelope Optional envelope to add / subtract from min/max 0169 /// @param entity Entity to associate this bounding box with 0170 /// @return Constructed bounding box 0171 Volume::BoundingBox boundingBox(const Transform3* trf = nullptr, 0172 const Vector3& envelope = {0, 0, 0}, 0173 const Volume* entity = nullptr) const final; 0174 0175 /// Get the canonical binning directions, i.e. the axis directions 0176 /// that fully describe the shape's extent 0177 /// 0178 /// @return vector of canonical binning values 0179 std::vector<AxisDirection> canonicalAxes() const override { 0180 using enum AxisDirection; 0181 return {AxisR, AxisPhi, AxisZ}; 0182 }; 0183 0184 /// Binning offset - overloaded for some R-binning types 0185 /// 0186 /// @param aDir is the axis direction used for the binning 0187 Vector3 referenceOffset(AxisDirection aDir) const override; 0188 0189 /// Binning borders in double 0190 /// 0191 /// @param aDir is the axis direction used for the binning 0192 double referenceBorder(AxisDirection aDir) const override; 0193 0194 /// Output Method for std::ostream 0195 /// @param os is the output stream 0196 std::ostream& toStream(std::ostream& os) const override; 0197 0198 /// Access to the bound values 0199 /// @param bValue the class nested enum for the array access 0200 double get(BoundValues bValue) const { return m_values[bValue]; } 0201 0202 /// Set a bound value 0203 /// @param bValue the bound value identifier 0204 /// @param value the value to be set 0205 void set(BoundValues bValue, double value); 0206 0207 /// Set a range of bound values 0208 /// @param keyValues the initializer list of key value pairs 0209 void set(std::initializer_list<std::pair<BoundValues, double>> keyValues); 0210 0211 private: 0212 /// The internal version of the bounds can be float/double 0213 std::array<double, eSize> m_values{}; 0214 0215 /// Bounds of the inner CylinderBounds 0216 std::shared_ptr<const CylinderBounds> m_innerCylinderBounds{nullptr}; 0217 /// Bounds of the inner CylinderBounds 0218 std::shared_ptr<const CylinderBounds> m_outerCylinderBounds{nullptr}; 0219 /// Bounds of the bottom/top Radial 0220 std::shared_ptr<const RadialBounds> m_discBounds{nullptr}; 0221 /// Bounds of the sector planes 0222 std::shared_ptr<const PlanarBounds> m_sectorPlaneBounds{nullptr}; 0223 0224 /// Check the input values for consistency, 0225 /// will throw a logic_exception if consistency is not given 0226 void checkConsistency(); 0227 0228 /// Helper method to create the surface bounds 0229 void buildSurfaceBounds(); 0230 }; 0231 0232 } // 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 |