Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Acts/Geometry/Volume.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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/Geometry/GeometryContext.hpp"
0013 #include "Acts/Geometry/GeometryObject.hpp"
0014 #include "Acts/Utilities/BinningType.hpp"
0015 #include "Acts/Utilities/BoundingBox.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, ActsScalar, 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,
0041          std::shared_ptr<const VolumeBounds> volbounds);
0042 
0043   /// Copy Constructor - with optional shift
0044   ///
0045   /// @param vol is the source volume for the copy
0046   /// @param shift is the optional shift applied as : shift * vol.transform()
0047   Volume(const Volume& vol, const Transform3& shift = Transform3::Identity());
0048 
0049   Volume() = delete;
0050   virtual ~Volume() = default;
0051 
0052   /// Assignment operator
0053   ///
0054   /// @param vol is the source volume to be copied
0055   Volume& operator=(const Volume& vol);
0056 
0057   /// Return methods for geometry transform
0058   const Transform3& transform() const;
0059 
0060   /// Returns the inverted transform of this volume.
0061   const Transform3& itransform() const;
0062 
0063   void setTransform(const Transform3& transform);
0064 
0065   /// returns the center of the volume
0066   const Vector3& center() const;
0067 
0068   /// Returns const reference to the volume bounds
0069   const VolumeBounds& volumeBounds() const;
0070 
0071   /// Returns shared pointer to the volume bounds
0072   std::shared_ptr<const VolumeBounds> volumeBoundsPtr() const;
0073 
0074   /// Set volume bounds and update volume bounding boxes implicitly
0075   /// @param volbounds The volume bounds to be assigned
0076   void assignVolumeBounds(std::shared_ptr<const VolumeBounds> volbounds);
0077 
0078   /// Set the volume bounds and optionally also update the volume transform
0079   /// @param volbounds The volume bounds to be assigned
0080   /// @param transform The transform to be assigned, can be optional
0081   virtual void update(std::shared_ptr<const VolumeBounds> volbounds,
0082                       std::optional<Transform3> transform = std::nullopt);
0083 
0084   /// Construct bounding box for this shape
0085   /// @param envelope Optional envelope to add / subtract from min/max
0086   /// @return Constructed bounding box pointing to this volume
0087   BoundingBox boundingBox(const Vector3& envelope = {0, 0, 0}) const;
0088 
0089   /// Construct oriented bounding box for this shape
0090   /// @note This will build an oriented bounding box with an
0091   ///       envelope value of (0.05, 0.05, 0.05)mm
0092   /// @return Constructed oriented bounding box pointing to this volume
0093   BoundingBox orientedBoundingBox() const;
0094 
0095   /// Inside() method for checks
0096   ///
0097   /// @param gpos is the position to be checked
0098   /// @param tol is the tolerance parameter
0099   ///
0100   /// @return boolean indicator if the position is inside
0101   bool inside(const Vector3& gpos, ActsScalar tol = 0.) const;
0102 
0103   /// The binning position method
0104   /// - as default the center is given, but may be overloaded
0105   ///
0106   /// @param gctx The current geometry context object, e.g. alignment
0107   /// @param bValue is the binning value schema
0108   ///
0109   /// @return vector 3D that can be used for the binning
0110   Vector3 binningPosition(const GeometryContext& gctx,
0111                           BinningValue bValue) const override;
0112 
0113   bool operator==(const Volume& other) const;
0114   bool operator!=(const Volume& other) const;
0115 
0116  protected:
0117   Transform3 m_transform;
0118   Transform3 m_itransform;
0119   Vector3 m_center;
0120   std::shared_ptr<const VolumeBounds> m_volumeBounds;
0121 };
0122 
0123 /**Overload of << operator for std::ostream for debug output*/
0124 std::ostream& operator<<(std::ostream& sl, const Volume& vol);
0125 
0126 }  // namespace Acts