|
|
|||
File indexing completed on 2025-11-02 08:52:45
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 TrapezoidBounds; 0026 0027 /// @class TrapezoidVolumeBounds 0028 /// 0029 /// Bounds for a trapezoidal shaped Volume, the orientedSurface(...) method 0030 /// creates a vector of 6 surfaces: 0031 /// 0032 /// BoundarySurfaceFace [index]: 0033 /// 0034 /// - negativeFaceXY [0] : Trazpezoidal Acts::PlaneSurface, 0035 /// parallel to \f$ xy \f$ plane at negative \f$z\f$ 0036 /// - positiveFaceXY [1] : Trazpezoidal Acts::PlaneSurface, 0037 /// parallel to \f$ xy \f$ plane at positive \f$z\f$ 0038 /// - trapezoidFaceAlpha [2] : Rectangular Acts::PlaneSurface, 0039 /// attached to [0] and [1] at negative \f$x\f$ 0040 /// (associated to alpha) 0041 /// - trapezoidFaceBeta [3] : Rectangular Acts::PlaneSurface, 0042 /// attached to [0] and [1] at positive \f$ x\f$ 0043 /// (associated to beta) 0044 /// - negativeFaceZX [4] : Rectangular Acts::PlaneSurface, 0045 /// parallel to \f$ zx \f$ plane at negative \f$y\f$ 0046 /// - positiveFaceZX [5] : Rectangular Acts::PlaneSurface, 0047 /// parallel to \f$ zx \f$ plane at positive \f$y\f$ 0048 /// 0049 /// ``` 0050 /// PositiveZFaceXY--------+ PositiveYFaceZX 0051 /// | | 0052 /// TrapezoidFaceAlpha | v 0053 /// | | +----------------------------------+ 0054 /// | v | | 0055 /// | + +--+------------------------------++ | 0056 /// | /| / | +-+ | 0057 /// | / | / | +-+ | + 0058 /// +---+ / | / | +-+ | ++ 0059 /// | / | / +----------------------+-+---------+ +-+| 0060 /// | / | / +-+ +-+ | 0061 /// | / + / +-+ +-+ | 0062 /// | / / / +-+ +-+ | 0063 /// v/ / / +-+ +-+ + 0064 /// / / / +-+ +-+ +- 0065 /// / / / +------------------+-+------------++ +-+ +-+ 0066 /// / / / / +-+ +-+ +-+ +-+ 0067 /// / / / / +-+ +-+ +-+ +-+ 0068 /// / / +----X-----------------+ +-+ +-+ +-+ 0069 /// + / / +-+ +-+ +-+ 0070 /// | +--X------X------------+ +-+ -+ +-+ 0071 /// | | / / | +-+ + +-+ 0072 /// | |/ / | +-+ | +-+ ^ 0073 /// | X / | +-+ | +-+ | 0074 /// |/| / | +-+ | +-+ | 0075 /// + | / | +-+ | +-+ | z ^ ^ y 0076 /// +---X------------------+ +-+ ^ |-+ +-----+ | / 0077 /// / ^ +-+ | + | | / 0078 /// +---------++-----------+ | | |/ 0079 /// | | | X------> x 0080 /// NegativeYFaceZX NegativeZFaceXY | 0081 /// TrapezoidFaceBeta 0082 /// ``` 0083 class TrapezoidVolumeBounds : public VolumeBounds { 0084 public: 0085 /// @enum BoundValues for access / streaming 0086 enum BoundValues : unsigned int { 0087 eHalfLengthXnegY = 0, //!< halflength in x at negative y 0088 eHalfLengthXposY = 1, //!< halflength in x at positive y 0089 eHalfLengthY = 2, //!< halflength in y 0090 eHalfLengthZ = 3, //!< halflength in z 0091 eAlpha = 4, //!< opening angle alpha (in point A) 0092 eBeta = 5, //!< opening angle beta (in point B) 0093 eSize //!< length of the bounds vector 0094 }; 0095 0096 /// Enum describing the possible faces of a trapezoidal volume 0097 /// @note These values are synchronized with the BoundarySurfaceFace enum. 0098 /// Once Gen1 is removed, this can be changed. 0099 enum class Face : unsigned int { 0100 0101 NegativeZFaceXY = BoundarySurfaceFace::negativeFaceXY, 0102 PositiveZFaceXY = BoundarySurfaceFace::positiveFaceXY, 0103 TrapezoidFaceAlpha = 0104 BoundarySurfaceFace::trapezoidFaceAlpha, // Acts::PlaneSurface attached 0105 // to [0] and [1] at negative 0106 // x 0107 TrapezoidFaceBeta = 0108 BoundarySurfaceFace::trapezoidFaceBeta, // Acts::PlaneSurface attached 0109 // to [0] and [1] at positive x 0110 NegativeYFaceZX = BoundarySurfaceFace::negativeFaceZX, 0111 PositiveYFaceZX = BoundarySurfaceFace::positiveFaceZX 0112 0113 }; 0114 0115 TrapezoidVolumeBounds() = delete; 0116 0117 /// Constructor - the trapezoid boundaries (symmetric trapezoid) 0118 /// 0119 /// @param minhalex is the half length in x at minimal y 0120 /// @param maxhalex is the half length in x at maximal y 0121 /// @param haley is the half length in y 0122 /// @param halez is the half length in z 0123 TrapezoidVolumeBounds(double minhalex, double maxhalex, double haley, 0124 double halez) noexcept(false); 0125 0126 /// Constructor - the trapezoid boundaries (arbitrary trapezoid) 0127 /// 0128 /// @param minhalex is the half length in x at minimal y 0129 /// @param haley is the half length in y 0130 /// @param halez is the half length in z 0131 /// @param alpha is the opening angle at -x,-y 0132 /// @param beta is the opening angle at +x,-y 0133 TrapezoidVolumeBounds(double minhalex, double haley, double halez, 0134 double alpha, double beta) noexcept(false); 0135 0136 /// Constructor - from a fixed size array 0137 /// 0138 /// @param values The bound values 0139 explicit TrapezoidVolumeBounds( 0140 const std::array<double, eSize>& values) noexcept(false) 0141 : m_values(values) { 0142 checkConsistency(); 0143 buildSurfaceBounds(); 0144 } 0145 0146 /// Copy constructor 0147 /// @param trabo Source trapezoidal volume bounds to copy from 0148 TrapezoidVolumeBounds(const TrapezoidVolumeBounds& trabo) = default; 0149 0150 /// Default destructor 0151 ~TrapezoidVolumeBounds() override = default; 0152 0153 /// Copy assignment operator 0154 /// @param trabo Source trapezoidal volume bounds to assign from 0155 /// @return Reference to this object 0156 TrapezoidVolumeBounds& operator=(const TrapezoidVolumeBounds& trabo) = 0157 default; 0158 0159 VolumeBounds::BoundsType type() const final { 0160 return VolumeBounds::eTrapezoid; 0161 } 0162 0163 /// Return the bound values as dynamically sized vector 0164 /// 0165 /// @return this returns a copy of the internal values 0166 std::vector<double> values() const final; 0167 0168 /// This method checks if position in the 3D volume frame 0169 /// is inside the cylinder 0170 /// 0171 /// @param pos is the global position to be checked 0172 /// @param tol is the tolerance applied 0173 /// 0174 /// @return boolean indicator if position is inside 0175 bool inside(const Vector3& pos, double tol = 0.) const override; 0176 0177 /// Oriented surfaces, i.e. the decomposed boundary surfaces and the 0178 /// according navigation direction into the volume given the normal 0179 /// vector on the surface 0180 /// 0181 /// @param transform is the 3D transform to be applied to the boundary 0182 /// surfaces to position them in 3D space 0183 /// 0184 /// It will throw an exception if the orientation prescription is not adequate 0185 /// 0186 /// @return a vector of surfaces bounding this volume 0187 std::vector<OrientedSurface> orientedSurfaces( 0188 const Transform3& transform = Transform3::Identity()) const override; 0189 0190 /// Construct bounding box for this shape 0191 /// @param trf Optional transform 0192 /// @param envelope Optional envelope to add / subtract from min/max 0193 /// @param entity Entity to associate this bounding box with 0194 /// @return Constructed bounding box 0195 Volume::BoundingBox boundingBox(const Transform3* trf = nullptr, 0196 const Vector3& envelope = {0, 0, 0}, 0197 const Volume* entity = nullptr) const final; 0198 0199 /// Output Method for std::ostream 0200 /// @param os is the output stream 0201 /// @return Modified ostream for chaining 0202 std::ostream& toStream(std::ostream& os) const override; 0203 0204 /// Access to the bound values 0205 /// @param bValue the class nested enum for the array access 0206 /// @return The bound value at the specified index 0207 double get(BoundValues bValue) const { return m_values[bValue]; } 0208 0209 private: 0210 /// The internal version of the bounds can be float/double 0211 std::array<double, eSize> m_values{}; 0212 /// The face PlaneSurface parallel to local xy plane 0213 std::shared_ptr<const TrapezoidBounds> m_faceXYTrapezoidBounds{nullptr}; 0214 /// Thhe face PlaneSurface attached to alpha (negative local x) 0215 std::shared_ptr<const RectangleBounds> m_faceAlphaRectangleBounds{nullptr}; 0216 /// The face PlaneSurface attached to beta (positive local x) 0217 std::shared_ptr<const RectangleBounds> m_faceBetaRectangleBounds{nullptr}; 0218 /// The face PlaneSurface parallel to local zx plane, negative local y 0219 std::shared_ptr<const RectangleBounds> m_faceZXRectangleBoundsBottom{nullptr}; 0220 /// The face PlaneSurface parallel to local zx plane, positive local y 0221 std::shared_ptr<const RectangleBounds> m_faceZXRectangleBoundsTop{nullptr}; 0222 0223 /// Check the input values for consistency, 0224 /// will throw a logic_exception if consistency is not given 0225 void checkConsistency() noexcept(false); 0226 0227 /// Helper method to create the surface bounds 0228 void buildSurfaceBounds(); 0229 }; 0230 0231 } // 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 |
|