Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:33:33

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 parallelepiped volume.
0006 /// @file volumes/PlacedParallelepiped.h
0007 /// @author Johannes de Fine Licht, Mihaela Gheata
0008 
0009 #ifndef VECGEOM_VOLUMES_PLACEDPARALLELEPIPED_H_
0010 #define VECGEOM_VOLUMES_PLACEDPARALLELEPIPED_H_
0011 
0012 #include "VecGeom/base/Global.h"
0013 #include "VecGeom/volumes/PlacedVolume.h"
0014 #include "VecGeom/volumes/UnplacedVolume.h"
0015 #include "VecGeom/volumes/kernel/ParallelepipedImplementation.h"
0016 #include "VecGeom/volumes/PlacedVolImplHelper.h"
0017 #include "VecGeom/volumes/UnplacedParallelepiped.h"
0018 
0019 namespace vecgeom {
0020 
0021 VECGEOM_DEVICE_FORWARD_DECLARE(class PlacedParallelepiped;);
0022 VECGEOM_DEVICE_DECLARE_CONV(class, PlacedParallelepiped);
0023 
0024 inline namespace VECGEOM_IMPL_NAMESPACE {
0025 
0026 /// Class for the positioned parallelepiped volume
0027 class PlacedParallelepiped : public PlacedVolumeImplHelper<UnplacedParallelepiped, VPlacedVolume> {
0028   using Base = PlacedVolumeImplHelper<UnplacedParallelepiped, VPlacedVolume>;
0029 
0030 public:
0031 #ifndef VECCORE_CUDA
0032   using Base::Base;
0033   /// Constructor
0034   /// @param label Name of logical volume.
0035   /// @param logical_volume The logical volume to be positioned.
0036   /// @param transformation The positioning transformation.
0037   PlacedParallelepiped(char const *const label, LogicalVolume const *const logical_volume,
0038                        Transformation3D const *const transformation)
0039       : Base(label, logical_volume, transformation)
0040   {
0041   }
0042 
0043   /// Constructor
0044   /// @param logical_volume The logical volume to be positioned.
0045   /// @param transformation The positioning transformation.
0046   PlacedParallelepiped(LogicalVolume const *const logical_volume, Transformation3D const *const transformation)
0047       : PlacedParallelepiped("", logical_volume, transformation)
0048   {
0049   }
0050 
0051 #else
0052   /// CUDA version of constructor
0053   VECCORE_ATT_DEVICE PlacedParallelepiped(LogicalVolume const *const logical_volume,
0054                                           Transformation3D const *const transformation, const int id, const int copy_no,
0055                                           const int child_id)
0056       : Base(logical_volume, transformation, id, copy_no, child_id)
0057   {
0058   }
0059 
0060 #endif
0061   /// Destructor
0062   VECCORE_ATT_HOST_DEVICE
0063   virtual ~PlacedParallelepiped() {}
0064 
0065   /// Getter for unplaced volume
0066   VECCORE_ATT_HOST_DEVICE
0067   UnplacedParallelepiped const *GetUnplacedVolume() const
0068   {
0069     return static_cast<UnplacedParallelepiped const *>(GetLogicalVolume()->GetUnplacedVolume());
0070   }
0071 
0072   VECCORE_ATT_HOST_DEVICE
0073   virtual void PrintType() const override;
0074   virtual void PrintType(std::ostream &s) const override;
0075 
0076   /// Accessor for dimensions
0077   VECCORE_ATT_HOST_DEVICE
0078   Vector3D<Precision> const &GetDimensions() const { return GetUnplacedVolume()->GetDimensions(); }
0079 
0080   /// Accessor for x dimension
0081   VECCORE_ATT_HOST_DEVICE
0082   Precision GetX() const { return GetUnplacedVolume()->GetX(); }
0083 
0084   /// Accessor for y dimension
0085   VECCORE_ATT_HOST_DEVICE
0086   Precision GetY() const { return GetUnplacedVolume()->GetY(); }
0087 
0088   /// Accessor for z dimension
0089   VECCORE_ATT_HOST_DEVICE
0090   Precision GetZ() const { return GetUnplacedVolume()->GetZ(); }
0091 
0092   /// Accessor for alpha angle
0093   VECCORE_ATT_HOST_DEVICE
0094   Precision GetAlpha() const { return GetUnplacedVolume()->GetAlpha(); }
0095 
0096   /// Accessor for polar angle
0097   VECCORE_ATT_HOST_DEVICE
0098   Precision GetTheta() const { return GetUnplacedVolume()->GetTheta(); }
0099 
0100   /// Accessor for azimuthal angle
0101   VECCORE_ATT_HOST_DEVICE
0102   Precision GetPhi() const { return GetUnplacedVolume()->GetPhi(); }
0103 
0104   /// Returns tan(alpha)
0105   VECCORE_ATT_HOST_DEVICE
0106   Precision GetTanAlpha() const { return GetUnplacedVolume()->GetTanAlpha(); }
0107 
0108   /// Returns tan(alpha)*sin(phi)
0109   VECCORE_ATT_HOST_DEVICE
0110   Precision GetTanThetaSinPhi() const { return GetUnplacedVolume()->GetTanThetaSinPhi(); }
0111 
0112   /// Returns tan(alpha)*cos(phi)
0113   VECCORE_ATT_HOST_DEVICE
0114   Precision GetTanThetaCosPhi() const { return GetUnplacedVolume()->GetTanThetaCosPhi(); }
0115 
0116 #ifndef VECCORE_CUDA
0117   virtual VPlacedVolume const *ConvertToUnspecialized() const override;
0118 #ifdef VECGEOM_ROOT
0119   virtual TGeoShape const *ConvertToRoot() const override;
0120 #endif
0121 #ifdef VECGEOM_GEANT4
0122   virtual G4VSolid const *ConvertToGeant4() const override;
0123 #endif
0124 #endif // VECCORE_CUDA
0125 };
0126 } // namespace VECGEOM_IMPL_NAMESPACE
0127 } // namespace vecgeom
0128 
0129 #endif // VECGEOM_VOLUMES_PLACEDPARALLELEPIPED_H_