Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-13 11:00:31

0001 /// @file PlacedHalfSpace.h
0002 /// @brief Placed-volume wrapper for Boolean half-space operands.
0003 
0004 #ifndef VECGEOM_VOLUMES_PLACEDHALFSPACE_H_
0005 #define VECGEOM_VOLUMES_PLACEDHALFSPACE_H_
0006 
0007 #include "VecGeom/base/Global.h"
0008 #include "VecGeom/volumes/PlacedVolImplHelper.h"
0009 #include "VecGeom/volumes/PlacedVolume.h"
0010 #include "VecGeom/volumes/UnplacedHalfSpace.h"
0011 #include "VecGeom/volumes/UnplacedVolume.h"
0012 #include "VecGeom/volumes/kernel/HalfSpaceImplementation.h"
0013 
0014 namespace vecgeom {
0015 
0016 VECGEOM_DEVICE_FORWARD_DECLARE(class PlacedHalfSpace;);
0017 VECGEOM_DEVICE_DECLARE_CONV(class, PlacedHalfSpace);
0018 
0019 inline namespace VECGEOM_IMPL_NAMESPACE {
0020 
0021 /// @brief Placed representation of an infinite half-space.
0022 /// @details Half-spaces are intended as Boolean CSG operands. They can be
0023 /// placed inside Boolean trees, but geometry placement guards reject direct
0024 /// use as world or daughter volumes.
0025 class PlacedHalfSpace : public PlacedVolumeImplHelper<UnplacedHalfSpace, VPlacedVolume> {
0026   using Base = PlacedVolumeImplHelper<UnplacedHalfSpace, VPlacedVolume>;
0027 
0028 public:
0029 #ifndef VECCORE_CUDA
0030   using Base::Base;
0031   /// @brief Construct a named placed half-space.
0032   /// @param label Placed volume label.
0033   /// @param logicalVolume Logical volume owning the unplaced half-space.
0034   /// @param transformation Transform from the mother frame to the half-space frame.
0035   PlacedHalfSpace(char const *const label, LogicalVolume const *const logicalVolume,
0036                   Transformation3D const *const transformation)
0037       : Base(label, logicalVolume, transformation)
0038   {
0039   }
0040 
0041   /// @brief Construct an unnamed placed half-space.
0042   PlacedHalfSpace(LogicalVolume const *const logicalVolume, Transformation3D const *const transformation)
0043       : PlacedHalfSpace("", logicalVolume, transformation)
0044   {
0045   }
0046 #else
0047   /// @brief Device-side constructor used by CUDA geometry copying.
0048   VECCORE_ATT_DEVICE
0049   PlacedHalfSpace(LogicalVolume const *const logicalVolume, Transformation3D const *const transformation, const int id,
0050                   const int copy_no, const int child_id)
0051       : Base(logicalVolume, transformation, id, copy_no, child_id)
0052   {
0053   }
0054 #endif
0055 
0056   VECCORE_ATT_HOST_DEVICE
0057   virtual ~PlacedHalfSpace() {}
0058 
0059   /// @brief Return one point on the local limiting plane.
0060   VECCORE_ATT_HOST_DEVICE
0061   Vector3D<Precision> const &GetPoint() const { return GetUnplacedVolume()->GetPoint(); }
0062 
0063   /// @brief Return the local unit normal pointing outside the half-space.
0064   VECCORE_ATT_HOST_DEVICE
0065   Vector3D<Precision> const &GetNormal() const { return GetUnplacedVolume()->GetNormal(); }
0066 
0067   /// @brief Print the concrete placed half-space type to stdout.
0068   VECCORE_ATT_HOST_DEVICE
0069   virtual void PrintType() const override;
0070   /// @brief Print the concrete placed half-space type to a stream.
0071   virtual void PrintType(std::ostream &os) const override;
0072 
0073 #ifndef VECCORE_CUDA
0074   /// @brief Convert to the unspecialized placed half-space representation.
0075   virtual VPlacedVolume const *ConvertToUnspecialized() const override;
0076 #ifdef VECGEOM_ROOT
0077   /// @brief Convert to ROOT's `TGeoHalfSpace` when ROOT support is enabled.
0078   virtual TGeoShape const *ConvertToRoot() const override { return GetUnplacedVolume()->ConvertToRoot(GetName()); }
0079 #endif
0080 #ifdef VECGEOM_GEANT4
0081   /// @brief Return null because Geant4 has no half-space solid.
0082   virtual G4VSolid const *ConvertToGeant4() const override { return nullptr; }
0083 #endif
0084 #endif // VECCORE_CUDA
0085 };
0086 
0087 } // namespace VECGEOM_IMPL_NAMESPACE
0088 } // namespace vecgeom
0089 
0090 #endif // VECGEOM_VOLUMES_PLACEDHALFSPACE_H_