|
|
|||
File indexing completed on 2026-05-29 07:46:31
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 DiamondVolumeBounds 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 /// @image html 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 DiamondVolumeBounds : 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 /// Enumeration of faces of the diamond volume 0070 enum class Face : unsigned int { 0071 0072 NegativeZFaceXY = 0, 0073 PositiveZFaceXY = 1, 0074 NegativeXFaceYZ12 = 2, // Acts::PlaneSurface attached to [-x1,-y1] and 0075 // [-x2,0] at negative x 0076 PositiveXFaceYZ12 = 0077 3, // Acts::PlaneSurface attached to [x1,-y1] and [x2,0] at positive x 0078 NegativeXFaceYZ23 = 0079 4, // Acts::PlaneSurface attached to [-x2,0] and [-x3,y2] at negative x 0080 PositiveXFaceYZ23 = 0081 5, // Acts::PlaneSurface attached to [x2,0] and [x3,y2] at positive x 0082 NegativeYFaceZX = 6, 0083 PositiveYFaceZX = 7 0084 0085 }; 0086 0087 /// Constructor - the polygonal prism boundaries 0088 /// 0089 /// @param x1 is the half length in x at negative y1 0090 /// @param x2 is the half length in x at y=0 0091 /// @param x3 is the half length in x at positive y2 0092 /// @param y1 is the positive y extent 0093 /// @param y2 is the negative y extent 0094 /// @param halez is the half length in z 0095 DiamondVolumeBounds(double x1, double x2, double x3, double y1, double y2, 0096 double halez) noexcept(false); 0097 0098 /// Copy constructor 0099 /// @param other The other DiamondVolumeBounds to copy from 0100 DiamondVolumeBounds(const DiamondVolumeBounds& other) = default; 0101 0102 /// Move constructor 0103 /// @param other The other DiamondVolumeBounds to move from 0104 DiamondVolumeBounds(DiamondVolumeBounds&& other) = default; 0105 0106 /// Copy constructor assignment 0107 /// @param other The other DiamondVolumeBounds to copy from 0108 /// @return Reference to this object 0109 DiamondVolumeBounds& operator=(const DiamondVolumeBounds& other) = default; 0110 0111 /// Move constructor assignment 0112 /// @param other The other DiamondVolumeBounds to move from 0113 /// @return Reference to this object 0114 DiamondVolumeBounds& operator=(DiamondVolumeBounds&& other) = default; 0115 0116 /// Default destructor 0117 ~DiamondVolumeBounds() override = default; 0118 0119 VolumeBounds::BoundsType type() const final { 0120 return VolumeBounds::BoundsType::eDiamond; 0121 } 0122 0123 /// Return the bound values as dynamically sized vector 0124 /// 0125 /// @return this returns a copy of the internal values 0126 std::vector<double> values() const final; 0127 0128 /// This method checks if position in the 3D volume frame 0129 /// is inside the cylinder 0130 /// 0131 /// @param pos is the global position to be checked 0132 /// @param tol is the tolerance applied 0133 /// 0134 /// @return boolean indicator if position is inside 0135 bool inside(const Vector3& pos, double tol = 0.) const final; 0136 0137 /// Oriented surfaces, i.e. the decomposed boundary surfaces and the 0138 /// according navigation direction into the volume given the normal 0139 /// vector on the surface 0140 /// 0141 /// @param transform is the 3D transform to be applied to the boundary 0142 /// surfaces to position them in 3D space 0143 /// 0144 /// It will throw an exception if the orientation prescription is not adequate 0145 /// 0146 /// @return a vector of surfaces bounding this volume 0147 std::vector<OrientedSurface> orientedSurfaces( 0148 const Transform3& transform = Transform3::Identity()) const final; 0149 0150 /// Construct bounding box for this shape 0151 /// @param trf Optional transform 0152 /// @param envelope Optional envelope to add / subtract from min/max 0153 /// @param entity Entity to associate this bounding box with 0154 /// @return Constructed bounding box 0155 Volume::BoundingBox boundingBox(const Transform3* trf = nullptr, 0156 const Vector3& envelope = {0, 0, 0}, 0157 const Volume* entity = nullptr) const final; 0158 0159 /// Output Method for std::ostream 0160 /// @param os is the output stream 0161 /// @return Modified ostream for chaining 0162 std::ostream& toStream(std::ostream& os) const override; 0163 0164 /// Access to the bound values 0165 /// @param bValue the class nested enum for the array access 0166 /// @return The bound value at the specified index 0167 double get(BoundValues bValue) const { return m_values[bValue]; } 0168 0169 private: 0170 /// The bound values stored in an array 0171 std::array<double, eSize> m_values{}; 0172 /// The face plane surface parallel to YZ at positive X attached to [x1,y1] 0173 /// and [x2,0] 0174 std::shared_ptr<Acts::RectangleBounds> m_FaceYZ12Bounds; 0175 /// The face plane surface parallel to YZ attached to [x2,0] and [x3,y2] 0176 std::shared_ptr<Acts::RectangleBounds> m_FaceYZ23Bounds; 0177 // The face plane surface parallel to ZX at negative Y 0178 std::shared_ptr<Acts::RectangleBounds> m_negYFaceZXBounds; 0179 // The face plane surface parallel to ZX at positive Y 0180 std::shared_ptr<Acts::RectangleBounds> m_posYFaceZXBounds; 0181 /// The face diamond surface parallel to XY 0182 std::shared_ptr<Acts::DiamondBounds> m_FaceXYBounds; 0183 0184 // Helper method to build the surface bounds 0185 void buildSurfaceBounds(); 0186 0187 // Check the input values for consistency, 0188 // will throw a logic_exception if consistency is not given 0189 void checkConsistency() noexcept(false); 0190 }; 0191 0192 /// @cond 0193 /// @brief Streaming operator for the polygon volume surfaces 0194 inline std::ostream& operator<<(std::ostream& os, 0195 DiamondVolumeBounds::Face face) { 0196 switch (face) { 0197 case DiamondVolumeBounds::Face::NegativeZFaceXY: 0198 return os << "NegativeZFaceXY"; 0199 case DiamondVolumeBounds::Face::PositiveZFaceXY: 0200 return os << "PositiveZFaceXY"; 0201 case DiamondVolumeBounds::Face::NegativeXFaceYZ12: 0202 return os << "NegativeXFaceYZ12"; 0203 case DiamondVolumeBounds::Face::PositiveXFaceYZ12: 0204 return os << "PositiveXFaceYZ12"; 0205 case DiamondVolumeBounds::Face::NegativeXFaceYZ23: 0206 return os << "NegativeXFaceYZ23"; 0207 case DiamondVolumeBounds::Face::PositiveXFaceYZ23: 0208 return os << "PositiveXFaceYZ23"; 0209 case DiamondVolumeBounds::Face::NegativeYFaceZX: 0210 return os << "NegativeYFaceZX"; 0211 case DiamondVolumeBounds::Face::PositiveYFaceZX: 0212 return os << "PositiveYFaceZX"; 0213 default: 0214 return os << "Unknown"; 0215 } 0216 } 0217 /// @endcond 0218 0219 } // 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 |
|