Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:14

0001 /// @file UnplacedCoaxialCones.h
0002 /// @author Raman Sehgal (raman.sehgal@cern.ch)
0003 
0004 #ifndef VECGEOM_VOLUMES_UNPLACEDCOAXIALCONES_H_
0005 #define VECGEOM_VOLUMES_UNPLACEDCOAXIALCONES_H_
0006 
0007 #include "VecGeom/base/Cuda.h"
0008 #include "VecGeom/base/Global.h"
0009 #include "VecGeom/base/AlignedBase.h"
0010 #include "VecGeom/base/Vector3D.h"
0011 #include "VecGeom/volumes/UnplacedVolume.h"
0012 #include "VecGeom/volumes/CoaxialConesStruct.h" // the pure CoaxialCones struct
0013 #include "VecGeom/volumes/kernel/CoaxialConesImplementation.h"
0014 #include "VecGeom/volumes/UnplacedVolumeImplHelper.h"
0015 
0016 namespace vecgeom {
0017 
0018 VECGEOM_DEVICE_FORWARD_DECLARE(class UnplacedCoaxialCones;);
0019 VECGEOM_DEVICE_DECLARE_CONV(class, UnplacedCoaxialCones);
0020 
0021 inline namespace VECGEOM_IMPL_NAMESPACE {
0022 
0023 class UnplacedCoaxialCones : public SIMDUnplacedVolumeImplHelper<CoaxialConesImplementation>, public AlignedBase {
0024 
0025 private:
0026   CoaxialConesStruct<Precision> fCoaxialCones;
0027 
0028 public:
0029   /*
0030    * All the required Parametric CoaxialCones Constructor
0031    *
0032    */
0033   VECCORE_ATT_HOST_DEVICE
0034   UnplacedCoaxialCones() { ComputeBBox(); }
0035 
0036   VECCORE_ATT_HOST_DEVICE
0037   UnplacedCoaxialCones(unsigned int numOfCones, Precision *rmin1Vect, Precision *rmax1Vect, Precision *rmin2Vect,
0038                        Precision *rmax2Vect, Precision dz, Precision sphi, Precision dphi)
0039       : fCoaxialCones(numOfCones, rmin1Vect, rmax1Vect, rmin2Vect, rmax2Vect, dz, sphi, dphi)
0040   {
0041     ComputeBBox();
0042   }
0043 
0044   VECCORE_ATT_HOST_DEVICE
0045   CoaxialConesStruct<Precision> const &GetStruct() const { return fCoaxialCones; }
0046 
0047   VECCORE_ATT_HOST_DEVICE
0048   void Extent(Vector3D<Precision> &, Vector3D<Precision> &) const override;
0049 
0050   Precision Capacity() const override { return fCoaxialCones.fCubicVolume; }
0051 
0052   Precision SurfaceArea() const override { return fCoaxialCones.fSurfaceArea; }
0053 
0054   VECCORE_ATT_HOST_DEVICE
0055   virtual bool Normal(Vector3D<Precision> const &p, Vector3D<Precision> &normal) const override
0056   {
0057     return fCoaxialCones.Normal(p, normal);
0058   }
0059 
0060   std::string GetEntityType() const { return "CoaxialCones"; }
0061 
0062   std::ostream &StreamInfo(std::ostream &os) const;
0063 
0064 public:
0065   virtual int MemorySize() const final { return sizeof(*this); }
0066 
0067   VECCORE_ATT_HOST_DEVICE
0068   virtual void Print() const override;
0069 
0070   virtual void Print(std::ostream &os) const override;
0071 
0072 #ifdef VECGEOM_CUDA_INTERFACE
0073   virtual size_t DeviceSizeOf() const override { return DevicePtr<cuda::UnplacedCoaxialCones>::SizeOf(); }
0074   virtual DevicePtr<cuda::VUnplacedVolume> CopyToGpu() const override;
0075   virtual DevicePtr<cuda::VUnplacedVolume> CopyToGpu(DevicePtr<cuda::VUnplacedVolume> const gpu_ptr) const override;
0076 #endif
0077 
0078 #ifndef VECCORE_CUDA
0079   // this is the function called from the VolumeFactory
0080   // this may be specific to the shape
0081   template <TranslationCode trans_code, RotationCode rot_code>
0082   static VPlacedVolume *Create(LogicalVolume const *const logical_volume, Transformation3D const *const transformation,
0083                                VPlacedVolume *const placement = NULL);
0084 
0085   VPlacedVolume *SpecializedVolume(LogicalVolume const *const volume, Transformation3D const *const transformation,
0086                                    const TranslationCode trans_code, const RotationCode rot_code,
0087                                    VPlacedVolume *const placement) const override;
0088 #else
0089   template <TranslationCode trans_code, RotationCode rot_code>
0090   VECCORE_ATT_DEVICE
0091   static VPlacedVolume *Create(LogicalVolume const *const logical_volume, Transformation3D const *const transformation,
0092                                const int id, const int copy_no, const int child_id,
0093                                VPlacedVolume *const placement = NULL);
0094   VECCORE_ATT_DEVICE VPlacedVolume *SpecializedVolume(LogicalVolume const *const volume,
0095                                                       Transformation3D const *const transformation,
0096                                                       const TranslationCode trans_code, const RotationCode rot_code,
0097                                                       const int id, const int copy_no, const int child_id,
0098                                                       VPlacedVolume *const placement) const override;
0099 
0100 #endif
0101 };
0102 } // namespace VECGEOM_IMPL_NAMESPACE
0103 } // namespace vecgeom
0104 
0105 #endif