![]() |
|
|||
File indexing completed on 2025-09-18 08:33:10
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/Volume.hpp" 0013 #include "Acts/Geometry/VolumeBounds.hpp" 0014 #include "Acts/Utilities/AxisDefinitions.hpp" 0015 #include "Acts/Utilities/BoundingBox.hpp" 0016 0017 #include <array> 0018 #include <cmath> 0019 #include <cstddef> 0020 #include <iomanip> 0021 #include <iosfwd> 0022 #include <memory> 0023 #include <ostream> 0024 #include <stdexcept> 0025 #include <vector> 0026 0027 namespace Acts { 0028 0029 class RectangleBounds; 0030 0031 /// @class CuboidVolumeBounds 0032 /// 0033 /// Bounds for a cubical Volume, the orientedSurfaces(...) method creates a 0034 /// vector of 6 surfaces: 0035 /// 0036 /// BoundarySurfaceFace [index]: 0037 /// 0038 /// - negativeFaceXY [0] : Rectangular Acts::PlaneSurface, parallel to \f$ xy 0039 /// \f$ plane at negative \f$ z \f$ 0040 /// - positiveFaceXY [1] : Rectangular Acts::PlaneSurface, parallel to \f$ xy 0041 /// \f$ plane at positive \f$ z \f$ 0042 /// - negativeFaceXY [2] : Rectangular Acts::PlaneSurface, attached to \f$ yz 0043 /// \f$ plane at negative \f$ x \f$ 0044 /// - positiveFaceXY [3] : Rectangular Acts::PlaneSurface, attached to \f$ yz 0045 /// \f$ plane at negative \f$ x \f$ 0046 /// - negativeFaceXY [4] : Rectangular Acts::PlaneSurface, parallel to \f$ zx 0047 /// \f$ plane at negative \f$ y \f$ 0048 /// - positiveFaceXY [5] : Rectangular Acts::PlaneSurface, parallel to \f$ zx 0049 /// \f$ plane at positive \f$ y \f$ 0050 /// 0051 class CuboidVolumeBounds : public VolumeBounds { 0052 public: 0053 /// @enum BoundValues for streaming and access 0054 enum BoundValues : unsigned int { 0055 eHalfLengthX = 0, 0056 eHalfLengthY = 1, 0057 eHalfLengthZ = 2, 0058 eSize 0059 }; 0060 0061 CuboidVolumeBounds() = delete; 0062 0063 /// Constructor - the box boundaries 0064 /// 0065 /// @param halex is the half length of the cube in x 0066 /// @param haley is the half length of the cube in y 0067 /// @param halez is the half length of the cube in z 0068 CuboidVolumeBounds(double halex, double haley, double halez) noexcept(false); 0069 0070 /// Constructor - from a fixed size array 0071 /// 0072 /// @param values iw the bound values 0073 CuboidVolumeBounds(const std::array<double, eSize>& values); 0074 0075 CuboidVolumeBounds( 0076 std::initializer_list<std::pair<BoundValues, double>> keyValues); 0077 0078 /// Copy Constructor 0079 /// 0080 /// @param bobo is the source volume bounds to be copied 0081 CuboidVolumeBounds(const CuboidVolumeBounds& bobo) = default; 0082 0083 /// Assignment operator 0084 /// 0085 /// @param bobo is the source volume bounds to be assigned 0086 CuboidVolumeBounds& operator=(const CuboidVolumeBounds& bobo) = default; 0087 0088 ~CuboidVolumeBounds() override = default; 0089 0090 VolumeBounds::BoundsType type() const final { return VolumeBounds::eCuboid; } 0091 0092 /// Return the bound values as dynamically sized vector 0093 /// 0094 /// @return this returns a copy of the internal values 0095 std::vector<double> values() const final; 0096 0097 /// This method checks if position in the 3D volume 0098 /// frame is inside the cylinder 0099 /// 0100 /// @param pos is the position in volume frame to be checked 0101 /// @param tol is the absolute tolerance to be applied 0102 bool inside(const Vector3& pos, double tol = 0.) const override; 0103 0104 /// Oriented surfaces, i.e. the decomposed boundary surfaces and the 0105 /// according navigation direction into the volume given the normal 0106 /// vector on the surface 0107 /// 0108 /// @param transform is the 3D transform to be applied to the boundary 0109 /// surfaces to position them in 3D space 0110 /// 0111 /// It will throw an exception if the orientation prescription is not adequate 0112 /// 0113 /// @return a vector of surfaces bounding this volume 0114 std::vector<OrientedSurface> orientedSurfaces( 0115 const Transform3& transform = Transform3::Identity()) const override; 0116 0117 /// Construct bounding box for this shape 0118 /// @param trf Optional transform 0119 /// @param envelope Optional envelope to add / subtract from min/max 0120 /// @param entity Entity to associate this bounding box with 0121 /// @return Constructed bounding box 0122 Volume::BoundingBox boundingBox(const Transform3* trf = nullptr, 0123 const Vector3& envelope = {0, 0, 0}, 0124 const Volume* entity = nullptr) const final; 0125 0126 /// Get the canonical binning direction, i.e. the binning directions 0127 /// for that fully describe the shape's extent 0128 /// 0129 /// @return vector of canonical binning values 0130 std::vector<AxisDirection> canonicalAxes() const override { 0131 using enum AxisDirection; 0132 return {AxisX, AxisY, AxisZ}; 0133 }; 0134 0135 /// Binning borders in double 0136 /// 0137 /// @param aDir is the axis direction for which the 0138 /// reference border is requested 0139 /// 0140 /// @return float offset to be used for the binning 0141 double referenceBorder(AxisDirection aDir) const final; 0142 0143 /// Access to the bound values 0144 /// @param bValue the class nested enum for the array access 0145 double get(BoundValues bValue) const { return m_values[bValue]; } 0146 0147 /// Set a bound value 0148 /// @param bValue the bound value identifier 0149 /// @param value the value to be set 0150 void set(BoundValues bValue, double value); 0151 0152 /// Set a range of bound values 0153 /// @param keyValues the initializer list of key value pairs 0154 void set(std::initializer_list<std::pair<BoundValues, double>> keyValues); 0155 0156 /// Convert axis direction to a corresponding bound value 0157 /// in local coordinate convention 0158 /// @param direction the axis direction to convert 0159 static BoundValues fromAxisDirection(AxisDirection direction); 0160 0161 /// Output Method for std::ostream 0162 /// 0163 /// @param os is ostream operator to be dumped into 0164 std::ostream& toStream(std::ostream& os) const override; 0165 0166 private: 0167 /// The bound values ordered in a fixed size array 0168 std::array<double, eSize> m_values; 0169 0170 std::shared_ptr<const RectangleBounds> m_xyBounds{nullptr}; 0171 std::shared_ptr<const RectangleBounds> m_yzBounds{nullptr}; 0172 std::shared_ptr<const RectangleBounds> m_zxBounds{nullptr}; 0173 0174 /// Create the surface bounds 0175 void buildSurfaceBounds(); 0176 0177 /// Check the input values for consistency, 0178 /// will throw a logic_exception if consistency is not given 0179 void checkConsistency() noexcept(false); 0180 }; 0181 } // 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 |
![]() ![]() |