![]() |
|
|||
File indexing completed on 2025-09-18 08:11:36
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/GeometryContext.hpp" 0013 #include "Acts/Geometry/GeometryObject.hpp" 0014 #include "Acts/Utilities/BoundingBox.hpp" 0015 #include "Acts/Utilities/Logger.hpp" 0016 0017 #include <iosfwd> 0018 #include <memory> 0019 #include <optional> 0020 0021 namespace Acts { 0022 0023 class VolumeBounds; 0024 0025 /// @class Volume 0026 /// 0027 /// It inherits from GeometryObject for geometry identification 0028 /// 0029 /// Base class for all volumes inside the tracking realm, it defines the 0030 /// interface for inherited Volume classes regarding the geometrical 0031 /// information. 0032 class Volume : public GeometryObject { 0033 public: 0034 using BoundingBox = AxisAlignedBoundingBox<Volume, double, 3>; 0035 0036 /// Explicit constructor with shared arguments 0037 /// 0038 /// @param transform is the transform to position the volume in 3D space 0039 /// @param volbounds is the volume boundary definitions 0040 Volume(const Transform3& transform, std::shared_ptr<VolumeBounds> volbounds); 0041 0042 /// Copy Constructor - with optional shift 0043 /// 0044 /// @param vol is the source volume for the copy 0045 /// @param shift is the optional shift applied as : shift * vol.transform() 0046 Volume(const Volume& vol, const Transform3& shift = Transform3::Identity()); 0047 0048 ~Volume() noexcept override = default; 0049 0050 /// Assignment operator 0051 /// 0052 /// @param vol is the source volume to be copied 0053 Volume& operator=(const Volume& vol); 0054 0055 /// Return methods for geometry transform 0056 const Transform3& transform() const; 0057 0058 /// Returns the inverted transform of this volume. 0059 const Transform3& itransform() const; 0060 0061 void setTransform(const Transform3& transform); 0062 0063 /// returns the center of the volume 0064 const Vector3& center() const; 0065 0066 /// Returns a const reference to the volume bounds 0067 const VolumeBounds& volumeBounds() const; 0068 0069 /// Returns a mutable reference to the volume bounds 0070 VolumeBounds& volumeBounds(); 0071 0072 /// Returns shared pointer to the volume bounds 0073 std::shared_ptr<const VolumeBounds> volumeBoundsPtr() const; 0074 0075 /// Returns shared pointer to the volume bounds 0076 std::shared_ptr<VolumeBounds> volumeBoundsPtr(); 0077 0078 /// Set volume bounds and update volume bounding boxes implicitly 0079 /// @param volbounds The volume bounds to be assigned 0080 void assignVolumeBounds(std::shared_ptr<VolumeBounds> volbounds); 0081 0082 /// Set the volume bounds and optionally also update the volume transform 0083 /// @param volbounds The volume bounds to be assigned 0084 /// @param transform The transform to be assigned, can be optional 0085 /// @param logger A logger object to log messages 0086 virtual void update(std::shared_ptr<VolumeBounds> volbounds, 0087 std::optional<Transform3> transform = std::nullopt, 0088 const Logger& logger = Acts::getDummyLogger()); 0089 0090 /// Construct bounding box for this shape 0091 /// @param envelope Optional envelope to add / subtract from min/max 0092 /// @return Constructed bounding box pointing to this volume 0093 BoundingBox boundingBox(const Vector3& envelope = {0, 0, 0}) const; 0094 0095 /// Construct oriented bounding box for this shape 0096 /// @note This will build an oriented bounding box with an 0097 /// envelope value of (0.05, 0.05, 0.05)mm 0098 /// @return Constructed oriented bounding box pointing to this volume 0099 BoundingBox orientedBoundingBox() const; 0100 0101 /// Inside() method for checks 0102 /// 0103 /// @param gpos is the position to be checked 0104 /// @param tol is the tolerance parameter 0105 /// 0106 /// @return boolean indicator if the position is inside 0107 bool inside(const Vector3& gpos, double tol = 0.) const; 0108 0109 /// The binning position method 0110 /// - as default the center is given, but may be overloaded 0111 /// 0112 /// @param gctx The current geometry context object, e.g. alignment 0113 /// @param aDir is the axis direction for the reference position 0114 /// @return vector 3D that can be used for the binning 0115 Vector3 referencePosition(const GeometryContext& gctx, 0116 AxisDirection aDir) const override; 0117 0118 bool operator==(const Volume& other) const; 0119 0120 /// Produces a 3D visualization of this volume 0121 /// @param helper The visualization helper describing the output format 0122 /// @param gctx The geometry context 0123 /// @param viewConfig The view configuration 0124 void visualize(IVisualization3D& helper, const GeometryContext& gctx, 0125 const ViewConfig& viewConfig) const; 0126 0127 protected: 0128 Transform3 m_transform; 0129 Transform3 m_itransform; 0130 Vector3 m_center; 0131 0132 private: 0133 std::shared_ptr<VolumeBounds> m_volumeBounds; 0134 }; 0135 0136 /**Overload of << operator for std::ostream for debug output*/ 0137 std::ostream& operator<<(std::ostream& sl, const Volume& vol); 0138 0139 } // 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 |
![]() ![]() |