|
|
|||
File indexing completed on 2026-04-17 07:59:01
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 0016 #include <array> 0017 #include <iosfwd> 0018 #include <memory> 0019 #include <ostream> 0020 #include <vector> 0021 0022 namespace Acts { 0023 0024 class RectangleBounds; 0025 class DiamondBounds; 0026 0027 /// @class ConvexPolygonVolumeBounds 0028 /// 0029 /// Bounds for a polygonal prism shaped Volume, the orientedSurface(...) method 0030 /// creates a vector of 8 surfaces: 0031 /// 2 Diamond Shape Surfaces (see 0032 /// https://github.com/acts-project/acts/blob/main/docs/figures/doxygen/DiamondBounds.svg) 0033 /// and 6 Rectangular Shape Surfaces. 0034 /// 0035 /// BoundarySurfaceFace [index]: 0036 /// 0037 /// - negativeFaceXY [0] : Diamond Acts::PlaneSurface, 0038 /// parallel to \f$ xy \f$ plane at negative \f$ z \f$ 0039 /// - positiveFaceXY [1] : Diamond Acts::PlaneSurface, 0040 /// parallel to \f$ xy \f$ plane at positive \f$ z \f$ 0041 /// - negativeXFaceYZ12 [2] : Rectangular Acts::PlaneSurface, 0042 /// parallel to \f$ yz \f$ plane at negative \f$ x \f$ attached at [-x1,-y1] and [-x2,0] 0043 /// - positiveXFaceYZ12 [3] : Rectangular Acts::PlaneSurface, 0044 /// parallel to \f$ yz \f$ plane at positive \f$ x \f$ attached at [x1,-y1] and [x2,0] 0045 /// - negativeXFaceYZ23 [4] : Rectangular Acts::PlaneSurface, 0046 /// parallel to \f$ yz \f$ plane at negative \f$ x \f$ attached at [-x2,0] and [-x3,y2] 0047 /// - positiveXFaceYZ23 [5] : Rectangular Acts::PlaneSurface, 0048 /// parallel to \f$ yz \f$ plane at positive \f$ x \f$ attached at [x2,0] and [x3,y2] 0049 /// - negativeYFaceZX [6] : Rectangular Acts::PlaneSurface, 0050 /// parallel to \f$ zx \f$ plane at negative \f$ y \f$ 0051 /// - positiveYFaceZX [7] : Rectangular Acts::PlaneSurface, 0052 /// parallel to \f$ zx \f$ plane at positive \f$ y \f$ 0053 /// 0054 class ConvexPolygonVolumeBounds : public VolumeBounds { 0055 public: 0056 /// @enum BoundValues for access / streaming 0057 enum BoundValues : unsigned int { 0058 eHalfLengthX1 = 0, //!< half length in x at positive y1 0059 eHalfLengthX2 = 1, //!< half length in x at y=0 0060 eHalfLengthX3 = 2, //!< half length in x at negative y2 0061 eLengthY1 = 3, //!< length in positive y1 0062 eLengthY2 = 4, //!< length in negative y2 0063 eHalfLengthZ = 5, //!< half length in z 0064 eAlphaAngle = 6, //!< angle alpha between negYFaceZX and faceYZ12 0065 eBetaAngle = 7, //!< angle beta between FaceYZ12 and FaceYZ23 0066 eSize //!< length of the bounds vector 0067 }; 0068 0069 enum class Face : unsigned int { 0070 0071 NegativeZFaceXY = 0, 0072 PositiveZFaceXY = 1, 0073 NegativeXFaceYZ12 = 2, // Acts::PlaneSurface attached to [-x1,-y1] and 0074 // [-x2,0] at negative x 0075 PositiveXFaceYZ12 = 0076 3, // Acts::PlaneSurface attached to [x1,-y1] and [x2,0] at positive x 0077 NegativeXFaceYZ23 = 0078 4, // Acts::PlaneSurface attached to [-x2,0] and [-x3,y2] at negative x 0079 PositiveXFaceYZ23 = 0080 5, // Acts::PlaneSurface attached to [x2,0] and [x3,y2] at positive x 0081 NegativeYFaceZX = 6, 0082 PositiveYFaceZX = 7 0083 0084 }; 0085 0086 /// Constructor - the polygonal prism boundaries 0087 /// 0088 /// @param x1 is the half length in x at negative y1 0089 /// @param x2 is the half length in x at y=0 0090 /// @param x3 is the half length in x at positive y2 0091 /// @param y1 is the positive y extent 0092 /// @param y2 is the negative y extent 0093 /// @param halez is the half length in z 0094 ConvexPolygonVolumeBounds(double x1, double x2, double x3, double y1, 0095 double y2, double halez) noexcept(false); 0096 0097 /// Copy constructor 0098 /// @param other The other ConvexPolygonVolumeBounds to copy from 0099 ConvexPolygonVolumeBounds(const ConvexPolygonVolumeBounds& other) = default; 0100 0101 /// Move constructor 0102 /// @param other The other ConvexPolygonVolumeBounds to move from 0103 ConvexPolygonVolumeBounds(ConvexPolygonVolumeBounds&& other) = default; 0104 0105 /// Copy constructor assignment 0106 /// @param other The other ConvexPolygonVolumeBounds to copy from 0107 ConvexPolygonVolumeBounds& operator=(const ConvexPolygonVolumeBounds& other) = 0108 default; 0109 0110 /// Move constructor assignment 0111 /// @param other The other ConvexPolygonVolumeBounds to move from 0112 ConvexPolygonVolumeBounds& operator=(ConvexPolygonVolumeBounds&& other) = 0113 default; 0114 0115 /// Default destructor 0116 ~ConvexPolygonVolumeBounds() override = default; 0117 0118 VolumeBounds::BoundsType type() const final { 0119 return VolumeBounds::BoundsType::eConvexPolygon; 0120 } 0121 0122 /// Return the bound values as dynamically sized vector 0123 /// 0124 /// @return this returns a copy of the internal values 0125 std::vector<double> values() const final; 0126 0127 /// This method checks if position in the 3D volume frame 0128 /// is inside the cylinder 0129 /// 0130 /// @param pos is the global position to be checked 0131 /// @param tol is the tolerance applied 0132 /// 0133 /// @return boolean indicator if position is inside 0134 bool inside(const Vector3& pos, double tol = 0.) const final; 0135 0136 /// Oriented surfaces, i.e. the decomposed boundary surfaces and the 0137 /// according navigation direction into the volume given the normal 0138 /// vector on the surface 0139 /// 0140 /// @param transform is the 3D transform to be applied to the boundary 0141 /// surfaces to position them in 3D space 0142 /// 0143 /// It will throw an exception if the orientation prescription is not adequate 0144 /// 0145 /// @return a vector of surfaces bounding this volume 0146 std::vector<OrientedSurface> orientedSurfaces( 0147 const Transform3& transform = Transform3::Identity()) const final; 0148 0149 /// Construct bounding box for this shape 0150 /// @param trf Optional transform 0151 /// @param envelope Optional envelope to add / subtract from min/max 0152 /// @param entity Entity to associate this bounding box with 0153 /// @return Constructed bounding box 0154 Volume::BoundingBox boundingBox(const Transform3* trf = nullptr, 0155 const Vector3& envelope = {0, 0, 0}, 0156 const Volume* entity = nullptr) const final; 0157 0158 /// Output Method for std::ostream 0159 /// @param os is the output stream 0160 /// @return Modified ostream for chaining 0161 std::ostream& toStream(std::ostream& os) const override; 0162 0163 /// Access to the bound values 0164 /// @param bValue the class nested enum for the array access 0165 /// @return The bound value at the specified index 0166 double get(BoundValues bValue) const { return m_values[bValue]; } 0167 0168 private: 0169 /// The bound values stored in an array 0170 std::array<double, eSize> m_values{}; 0171 /// The face plane surface parallel to YZ at positive X attached to [x1,y1] 0172 /// and [x2,0] 0173 std::shared_ptr<Acts::RectangleBounds> m_FaceYZ12Bounds; 0174 /// The face plane surface parallel to YZ attached to [x2,0] and [x3,y2] 0175 std::shared_ptr<Acts::RectangleBounds> m_FaceYZ23Bounds; 0176 // The face plane surface parallel to ZX at negative Y 0177 std::shared_ptr<Acts::RectangleBounds> m_negYFaceZXBounds; 0178 // The face plane surface parallel to ZX at positive Y 0179 std::shared_ptr<Acts::RectangleBounds> m_posYFaceZXBounds; 0180 /// The face diamond surface parallel to XY 0181 std::shared_ptr<Acts::DiamondBounds> m_FaceXYBounds; 0182 0183 // Helper method to build the surface bounds 0184 void buildSurfaceBounds(); 0185 0186 // Check the input values for consistency, 0187 // will throw a logic_exception if consistency is not given 0188 void checkConsistency() noexcept(false); 0189 }; 0190 0191 /// @cond 0192 /// @brief Streaming operator for the polygon volume surfaces 0193 inline std::ostream& operator<<(std::ostream& os, 0194 ConvexPolygonVolumeBounds::Face face) { 0195 switch (face) { 0196 case ConvexPolygonVolumeBounds::Face::NegativeZFaceXY: 0197 return os << "NegativeZFaceXY"; 0198 case ConvexPolygonVolumeBounds::Face::PositiveZFaceXY: 0199 return os << "PositiveZFaceXY"; 0200 case ConvexPolygonVolumeBounds::Face::NegativeXFaceYZ12: 0201 return os << "NegativeXFaceYZ12"; 0202 case ConvexPolygonVolumeBounds::Face::PositiveXFaceYZ12: 0203 return os << "PositiveXFaceYZ12"; 0204 case ConvexPolygonVolumeBounds::Face::NegativeXFaceYZ23: 0205 return os << "NegativeXFaceYZ23"; 0206 case ConvexPolygonVolumeBounds::Face::PositiveXFaceYZ23: 0207 return os << "PositiveXFaceYZ23"; 0208 case ConvexPolygonVolumeBounds::Face::NegativeYFaceZX: 0209 return os << "NegativeYFaceZX"; 0210 case ConvexPolygonVolumeBounds::Face::PositiveYFaceZX: 0211 return os << "PositiveYFaceZX"; 0212 default: 0213 return os << "Unknown"; 0214 } 0215 } 0216 /// @endcond 0217 0218 } // 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 |
|