|
|
|||
File indexing completed on 2025-10-24 08:18:35
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 0016 #include <array> 0017 #include <iosfwd> 0018 #include <memory> 0019 #include <vector> 0020 0021 namespace Acts { 0022 0023 class CylinderBounds; 0024 class DiscBounds; 0025 0026 /// Class which implements a cutout cylinder. This shape is basically a 0027 /// cylinder, with another, smaller cylinder subtracted from the center. 0028 /// --------------------- rmax 0029 /// | | 0030 /// | |---------| | rmed 0031 /// | | | | 0032 /// ------ ------ rmin 0033 /// -- hlZc -- 0034 /// --------- hlZ ------- 0035 /// 0036 /// 0037 /// @todo add sectoral cutouts 0038 class CutoutCylinderVolumeBounds : public VolumeBounds { 0039 public: 0040 /// @enum BoundValues for streaming and access 0041 enum BoundValues : int { 0042 eMinR = 0, 0043 eMedR = 1, 0044 eMaxR = 2, 0045 eHalfLengthZ = 3, 0046 eHalfLengthZcutout = 4, 0047 eSize 0048 }; 0049 0050 /// Constructor from defining parameters 0051 /// 0052 /// @param rmin Minimum radius at the "choke points" 0053 /// @param rmed The medium radius (outer radius of the cutout) 0054 /// @param rmax The outer radius of the overall shape 0055 /// @param hlZ The longer halflength of the shape 0056 /// @param hlZc The cutout halflength of the shape 0057 CutoutCylinderVolumeBounds(double rmin, double rmed, double rmax, double hlZ, 0058 double hlZc) noexcept(false) 0059 : m_values({rmin, rmed, rmax, hlZ, hlZc}) { 0060 checkConsistency(); 0061 buildSurfaceBounds(); 0062 } 0063 0064 /// Constructor - from a fixed size array 0065 /// 0066 /// @param values The bound values 0067 explicit CutoutCylinderVolumeBounds( 0068 const std::array<double, eSize>& values) noexcept(false) 0069 : m_values(values) { 0070 checkConsistency(); 0071 buildSurfaceBounds(); 0072 } 0073 0074 VolumeBounds::BoundsType type() const final { 0075 return VolumeBounds::eCutoutCylinder; 0076 } 0077 0078 /// Return the bound values as dynamically sized vector 0079 /// 0080 /// @return this returns a copy of the internal values 0081 std::vector<double> values() const final; 0082 0083 /// Inside method to test whether a point is inside the shape 0084 /// 0085 /// @param gpos The point to test 0086 /// @param tol The tolerance to test with 0087 /// @return Whether the point is inside or not. 0088 bool inside(const Vector3& gpos, double tol = 0) const override; 0089 0090 /// Oriented surfaces, i.e. the decomposed boundary surfaces and the 0091 /// according navigation direction into the volume given the normal 0092 /// vector on the surface 0093 /// 0094 /// @param transform is the 3D transform to be applied to the boundary 0095 /// surfaces to position them in 3D space 0096 /// 0097 /// It will throw an exception if the orientation prescription is not adequate 0098 /// 0099 /// @return a vector of surfaces bounding this volume 0100 std::vector<OrientedSurface> orientedSurfaces( 0101 const Transform3& transform = Transform3::Identity()) const override; 0102 0103 /// Construct bounding box for this shape 0104 /// 0105 /// @param trf Optional transform 0106 /// @param envelope Optional envelope to add / subtract from min/max 0107 /// @param entity Entity to associate this bounding box with 0108 /// @return Constructed bounding box 0109 Volume::BoundingBox boundingBox(const Transform3* trf = nullptr, 0110 const Vector3& envelope = {0, 0, 0}, 0111 const Volume* entity = nullptr) const final; 0112 0113 /// Get the canonical binning direction, i.e. the axis values 0114 /// that fully describe the shape's extent 0115 /// 0116 /// @return vector of canonical binning values 0117 std::vector<AxisDirection> canonicalAxes() const override { 0118 using enum AxisDirection; 0119 return {AxisR, AxisPhi, AxisZ}; 0120 }; 0121 0122 /// Write information about this instance to an outstream 0123 /// 0124 /// @param sl The outstream 0125 /// @return The outstream 0126 std::ostream& toStream(std::ostream& sl) const override; 0127 0128 /// Access to the bound values 0129 /// @param bValue the class nested enum for the array access 0130 /// @return Value of the specified bound parameter 0131 double get(BoundValues bValue) const { return m_values[bValue]; } 0132 0133 private: 0134 std::array<double, eSize> m_values; 0135 0136 // The surface bound objects 0137 std::shared_ptr<const CylinderBounds> m_innerCylinderBounds{nullptr}; 0138 std::shared_ptr<const CylinderBounds> m_cutoutCylinderBounds{nullptr}; 0139 std::shared_ptr<const CylinderBounds> m_outerCylinderBounds{nullptr}; 0140 std::shared_ptr<const DiscBounds> m_outerDiscBounds{nullptr}; 0141 std::shared_ptr<const DiscBounds> m_innerDiscBounds{nullptr}; 0142 0143 /// Create the surface bound objects 0144 void buildSurfaceBounds(); 0145 0146 /// Check the input values for consistency, 0147 /// will throw a logic_exception if consistency is not given 0148 void checkConsistency() noexcept(false); 0149 }; 0150 0151 } // 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 |
|