|
||||
File indexing completed on 2025-01-18 09:27:39
0001 // This file is part of the Acts project. 0002 // 0003 // Copyright (C) 2016-2018 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 http://mozilla.org/MPL/2.0/. 0008 0009 #pragma once 0010 0011 #include "Acts/Definitions/Algebra.hpp" 0012 #include "Acts/Definitions/Direction.hpp" 0013 #include "Acts/Geometry/Volume.hpp" 0014 #include "Acts/Surfaces/RegularSurface.hpp" 0015 #include "Acts/Utilities/BinningType.hpp" 0016 0017 #include <cmath> 0018 #include <iostream> 0019 #include <memory> 0020 #include <utility> 0021 #include <vector> 0022 0023 namespace Acts { 0024 0025 class Surface; 0026 class VolumeBounds; 0027 class Direction; 0028 0029 struct OrientedSurface { 0030 std::shared_ptr<RegularSurface> surface; 0031 Direction direction; 0032 }; 0033 0034 // Planar definitions to help construct the boundary surfaces 0035 static const Transform3 s_planeXY = Transform3::Identity(); 0036 static const Transform3 s_planeYZ = AngleAxis3(0.5 * M_PI, Vector3::UnitY()) * 0037 AngleAxis3(0.5 * M_PI, Vector3::UnitZ()) * 0038 Transform3::Identity(); 0039 static const Transform3 s_planeZX = AngleAxis3(-0.5 * M_PI, Vector3::UnitX()) * 0040 AngleAxis3(-0.5 * M_PI, Vector3::UnitZ()) * 0041 Transform3::Identity(); 0042 0043 /// @class VolumeBounds 0044 /// 0045 /// Pure Absract Base Class for Volume bounds. 0046 /// 0047 /// Acts::VolumeBounds are a set of up to six confining Surfaces that are stored 0048 /// in a std::vector. 0049 /// Each type of Acts::VolumeBounds has to implement a orientedSurfaces() and 0050 /// a inside() method. 0051 /// 0052 /// The Volume, retrieving a set of Surfaces from the VolumeBounds, can turn the 0053 /// Surfaces into BoundarySurfaces. 0054 0055 class VolumeBounds { 0056 public: 0057 // @enum BoundsType 0058 /// This is nested to the VolumeBounds, as also SurfaceBounds will have 0059 /// Bounds Type. 0060 enum BoundsType : int { 0061 eCone = 0, 0062 eCuboid = 1, 0063 eCutoutCylinder = 2, 0064 eCylinder = 3, 0065 eGenericCuboid = 4, 0066 eTrapezoid = 5, 0067 eOther = 6 0068 }; 0069 0070 /// Static member to get the name of the BoundsType 0071 static const std::vector<std::string> s_boundsTypeNames; 0072 0073 VolumeBounds() = default; 0074 0075 virtual ~VolumeBounds() = default; 0076 0077 /// Return the bounds type - for persistency optimization 0078 /// 0079 /// @return is a BoundsType enum 0080 virtual BoundsType type() const = 0; 0081 0082 /// Access method for bound values, this is a dynamically sized 0083 /// vector containing the parameters needed to describe these bounds 0084 /// 0085 /// @return of the stored values for this SurfaceBounds object 0086 virtual std::vector<double> values() const = 0; 0087 0088 /// Checking if position given in volume frame is inside 0089 /// 0090 /// @param gpos is the global position to be checked 0091 /// @param tol is the tolerance applied for the inside check 0092 /// 0093 /// @return boolean indicating if the position is inside 0094 virtual bool inside(const Vector3& gpos, double tol = 0.) const = 0; 0095 0096 /// Oriented surfaces, i.e. the decomposed boundary surfaces and the 0097 /// according navigation direction into the volume given the normal 0098 /// vector on the surface 0099 /// 0100 /// @param transform is the 3D transform to be applied to the boundary 0101 /// surfaces to position them in 3D space 0102 /// 0103 /// It will throw an exception if the orientation prescription is not adequate 0104 /// 0105 /// @return a vector of surfaces bounding this volume 0106 virtual std::vector<OrientedSurface> orientedSurfaces( 0107 const Transform3& transform = Transform3::Identity()) const = 0; 0108 0109 /// Construct bounding box for this shape 0110 /// @param trf Optional transform 0111 /// @param envelope Optional envelope to add / subtract from min/max 0112 /// @param entity Entity to associate this bounding box with 0113 /// @return Constructed bounding box 0114 virtual Volume::BoundingBox boundingBox( 0115 const Transform3* trf = nullptr, const Vector3& envelope = {0, 0, 0}, 0116 const Volume* entity = nullptr) const = 0; 0117 0118 /// Get the canonical binning values, i.e. the binning values 0119 /// for that fully describe the shape's extent 0120 /// 0121 /// @return vector of canonical binning values 0122 /// 0123 /// @note This is the default implementation that 0124 /// returns the bounding box binning. Individual shapes 0125 /// should override this method 0126 virtual std::vector<Acts::BinningValue> canonicalBinning() const { 0127 return {Acts::binX, Acts::binY, Acts::binZ}; 0128 }; 0129 0130 /// Binning offset - overloaded for some R-binning types 0131 /// 0132 /// @param bValue is the binning schema used 0133 /// 0134 /// @return vector 3D to be used for the binning 0135 virtual Vector3 binningOffset(BinningValue bValue) const; 0136 0137 /// Binning borders in double 0138 /// 0139 /// @param bValue is the binning schema used 0140 /// 0141 /// @return float offset to be used for the binning 0142 virtual double binningBorder(BinningValue bValue) const; 0143 0144 /// Output Method for std::ostream, to be overloaded by child classes 0145 /// 0146 /// @param sl is the output stream to be dumped into 0147 virtual std::ostream& toStream(std::ostream& sl) const = 0; 0148 }; 0149 0150 /// Binning offset - overloaded for some R-binning types 0151 inline Vector3 VolumeBounds::binningOffset( 0152 BinningValue /*bValue*/) const { // standard offset is 0.,0.,0. 0153 return Vector3(0., 0., 0.); 0154 } 0155 0156 inline double VolumeBounds::binningBorder(BinningValue /*bValue*/) const { 0157 return 0.; 0158 } 0159 0160 /// Overload of << operator for std::ostream for debug output 0161 std::ostream& operator<<(std::ostream& sl, const VolumeBounds& vb); 0162 0163 inline bool operator==(const VolumeBounds& lhs, const VolumeBounds& rhs) { 0164 if (&lhs == &rhs) { 0165 return true; 0166 } 0167 return (lhs.type() == rhs.type()) && (lhs.values() == rhs.values()); 0168 } 0169 0170 } // 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 |