Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:26:18

0001 // This file is part of VecGeom and is distributed under the
0002 // conditions in the file LICENSE.txt in the top directory.
0003 // For the full list of authors see CONTRIBUTORS.txt and `git log`.
0004 
0005 /// Declaration of the placed Ellipsoid volume
0006 /// @file volumes/PlacedEllipsoid.h
0007 /// @author Evgueni Tcherniaev
0008 
0009 #ifndef VECGEOM_VOLUMES_PLACEDELLIPSOID_H_
0010 #define VECGEOM_VOLUMES_PLACEDELLIPSOID_H_
0011 
0012 #include "VecGeom/base/Global.h"
0013 
0014 #include "VecGeom/volumes/PlacedVolume.h"
0015 #include "VecGeom/volumes/UnplacedVolume.h"
0016 #include "VecGeom/volumes/kernel/EllipsoidImplementation.h"
0017 #include "VecGeom/volumes/PlacedVolImplHelper.h"
0018 #include "VecGeom/volumes/UnplacedEllipsoid.h"
0019 
0020 namespace vecgeom {
0021 
0022 VECGEOM_DEVICE_FORWARD_DECLARE(class PlacedEllipsoid;);
0023 VECGEOM_DEVICE_DECLARE_CONV(class, PlacedEllipsoid);
0024 
0025 inline namespace VECGEOM_IMPL_NAMESPACE {
0026 
0027 /// Class for the positioned ellipsoid volume
0028 class PlacedEllipsoid : public PlacedVolumeImplHelper<UnplacedEllipsoid, VPlacedVolume> {
0029   using Base = PlacedVolumeImplHelper<UnplacedEllipsoid, VPlacedVolume>;
0030 
0031 public:
0032 #ifndef VECCORE_CUDA
0033   using Base::Base;
0034 
0035   /// Constructor
0036   /// @param label Name of logical volume
0037   /// @param logicalVolume The logical volume to be positioned
0038   /// @param transformation The positioning transformation
0039   PlacedEllipsoid(char const *const label, LogicalVolume const *const logicalVolume,
0040                   Transformation3D const *const transformation)
0041       : Base(label, logicalVolume, transformation)
0042   {
0043   }
0044 
0045   /// Constructor
0046   /// @param logicalVolume The logical volume to be positioned
0047   /// @param transformation The positioning transformation.
0048   PlacedEllipsoid(LogicalVolume const *const logicalVolume, Transformation3D const *const transformation)
0049       : PlacedEllipsoid("", logicalVolume, transformation)
0050   {
0051   }
0052 #else
0053   /// CUDA version of constructor
0054   VECCORE_ATT_DEVICE PlacedEllipsoid(LogicalVolume const *const logicalVolume,
0055                                      Transformation3D const *const transformation, const int id, const int copy_no,
0056                                      const int child_id)
0057       : Base(logicalVolume, transformation, id, copy_no, child_id)
0058   {
0059   }
0060 #endif
0061   /// Destructor
0062   VECCORE_ATT_HOST_DEVICE
0063   virtual ~PlacedEllipsoid() {}
0064 
0065   /// Getter for x semi-axis
0066   VECCORE_ATT_HOST_DEVICE
0067   VECGEOM_FORCE_INLINE
0068   Precision GetDx() const { return GetUnplacedVolume()->GetDx(); }
0069 
0070   /// Getter for y semi-axis
0071   VECCORE_ATT_HOST_DEVICE
0072   VECGEOM_FORCE_INLINE
0073   Precision GetDy() const { return GetUnplacedVolume()->GetDy(); }
0074 
0075   /// Getter for z semi-axis
0076   VECCORE_ATT_HOST_DEVICE
0077   VECGEOM_FORCE_INLINE
0078   Precision GetDz() const { return GetUnplacedVolume()->GetDz(); }
0079 
0080   /// Getter for bottom cut in local z, return -dz if the cut is not set
0081   VECCORE_ATT_HOST_DEVICE
0082   VECGEOM_FORCE_INLINE
0083   Precision GetZBottomCut() const { return GetUnplacedVolume()->GetZBottomCut(); }
0084 
0085   /// Getter for top cut in local z, return +dz if the cut is not set
0086   VECCORE_ATT_HOST_DEVICE
0087   VECGEOM_FORCE_INLINE
0088   Precision GetZTopCut() const { return GetUnplacedVolume()->GetZTopCut(); }
0089 
0090   /// Set ellipsoid dimensions
0091   /// @param dx Length of x semi-axis
0092   /// @param dy Length of y semi-axis
0093   /// @param dy Length of z semi-axis
0094   VECCORE_ATT_HOST_DEVICE
0095   VECGEOM_FORCE_INLINE
0096   void SetSemiAxes(Precision dx, Precision dy, Precision dz)
0097   {
0098     const_cast<UnplacedEllipsoid *>(GetUnplacedVolume())->SetSemiAxes(dx, dy, dz);
0099   }
0100 
0101   /// Set cuts in z
0102   /// @param zBottomCut Bottom cut in local z, shape lies above this plane
0103   /// @param zTopCut Top cut in local z, shape lies below this plane
0104   VECCORE_ATT_HOST_DEVICE
0105   VECGEOM_FORCE_INLINE
0106   void SetZCuts(Precision zBottomCut, Precision zTopCut)
0107   {
0108     const_cast<UnplacedEllipsoid *>(GetUnplacedVolume())->SetZCuts(zBottomCut, zTopCut);
0109   }
0110 
0111   VECCORE_ATT_HOST_DEVICE
0112   virtual void PrintType() const override;
0113   virtual void PrintType(std::ostream &os) const override;
0114 
0115 // Comparison specific
0116 #ifndef VECCORE_CUDA
0117   virtual VPlacedVolume const *ConvertToUnspecialized() const override;
0118 #ifdef VECGEOM_ROOT
0119   virtual TGeoShape const *ConvertToRoot() const override
0120   {
0121     return nullptr; // There is no suitable TGeo shape 2019.06.17
0122   }
0123 #endif
0124 #ifdef VECGEOM_GEANT4
0125   virtual G4VSolid const *ConvertToGeant4() const override;
0126 #endif
0127 #endif // VECCORE_CUDA
0128 };
0129 } // namespace VECGEOM_IMPL_NAMESPACE
0130 } // namespace vecgeom
0131 
0132 #endif