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