File indexing completed on 2025-01-18 10:14:08
0001
0002
0003
0004 #ifndef VECGEOM_VOLUMES_PLACEDHYPE_H_
0005 #define VECGEOM_VOLUMES_PLACEDHYPE_H_
0006
0007 #include "VecGeom/base/Global.h"
0008 #ifndef VECCORE_CUDA
0009 #include "VecGeom/base/RNG.h"
0010 #include <cmath>
0011 #endif
0012 #include "VecGeom/volumes/PlacedVolume.h"
0013 #include "VecGeom/volumes/UnplacedVolume.h"
0014 #include "VecGeom/volumes/kernel/HypeImplementation.h"
0015 #include "VecGeom/volumes/PlacedVolImplHelper.h"
0016 #include "VecGeom/volumes/UnplacedHype.h"
0017
0018 namespace vecgeom {
0019
0020 VECGEOM_DEVICE_FORWARD_DECLARE(class PlacedHype;);
0021 VECGEOM_DEVICE_DECLARE_CONV(class, PlacedHype);
0022 inline namespace VECGEOM_IMPL_NAMESPACE {
0023
0024 class PlacedHype : public VPlacedVolume {
0025
0026 public:
0027 using VPlacedVolume::VPlacedVolume;
0028 #ifndef VECCORE_CUDA
0029
0030 PlacedHype(char const *const label, LogicalVolume const *const logicalVolume,
0031 Transformation3D const *const transformation)
0032 : VPlacedVolume(label, logicalVolume, transformation)
0033 {
0034 }
0035
0036 PlacedHype(LogicalVolume const *const logicalVolume, Transformation3D const *const transformation)
0037 : PlacedHype("", logicalVolume, transformation)
0038 {
0039 }
0040 #else
0041 VECCORE_ATT_DEVICE PlacedHype(LogicalVolume const *const logicalVolume, Transformation3D const *const transformation,
0042 const int id, const int copy_no, const int child_id)
0043 : VPlacedVolume(logicalVolume, transformation, id, copy_no, child_id)
0044 {
0045 }
0046 #endif
0047
0048 VECCORE_ATT_HOST_DEVICE
0049 virtual ~PlacedHype() {}
0050
0051 VECCORE_ATT_HOST_DEVICE
0052 VECGEOM_FORCE_INLINE
0053 UnplacedHype const *GetUnplacedVolume() const
0054 {
0055 return static_cast<UnplacedHype const *>(GetLogicalVolume()->GetUnplacedVolume());
0056 }
0057
0058 VECCORE_ATT_HOST_DEVICE
0059 virtual void PrintType() const override;
0060 virtual void PrintType(std::ostream &s) const override;
0061
0062 VECCORE_ATT_HOST_DEVICE
0063 VECGEOM_FORCE_INLINE
0064 Precision GetRmin() const { return GetUnplacedVolume()->GetRmin(); }
0065
0066 VECCORE_ATT_HOST_DEVICE
0067 VECGEOM_FORCE_INLINE
0068 Precision GetRmax() const { return GetUnplacedVolume()->GetRmax(); }
0069
0070 VECCORE_ATT_HOST_DEVICE
0071 VECGEOM_FORCE_INLINE
0072 Precision GetRmin2() const { return GetUnplacedVolume()->GetRmin2(); }
0073
0074 VECCORE_ATT_HOST_DEVICE
0075 VECGEOM_FORCE_INLINE
0076 Precision GetRmax2() const { return GetUnplacedVolume()->GetRmax2(); }
0077
0078 VECCORE_ATT_HOST_DEVICE
0079 VECGEOM_FORCE_INLINE
0080 Precision GetStIn() const { return GetUnplacedVolume()->GetStIn(); }
0081
0082 VECCORE_ATT_HOST_DEVICE
0083 VECGEOM_FORCE_INLINE
0084 Precision GetStOut() const { return GetUnplacedVolume()->GetStOut(); }
0085
0086 VECCORE_ATT_HOST_DEVICE
0087 VECGEOM_FORCE_INLINE
0088 Precision GetTIn() const { return GetUnplacedVolume()->GetTIn(); }
0089
0090 VECCORE_ATT_HOST_DEVICE
0091 VECGEOM_FORCE_INLINE
0092 Precision GetTOut() const { return GetUnplacedVolume()->GetTOut(); }
0093
0094 VECCORE_ATT_HOST_DEVICE
0095 VECGEOM_FORCE_INLINE
0096 Precision GetTIn2() const { return GetUnplacedVolume()->GetTIn2(); }
0097
0098 VECCORE_ATT_HOST_DEVICE
0099 VECGEOM_FORCE_INLINE
0100 Precision GetTOut2() const { return GetUnplacedVolume()->GetTOut2(); }
0101
0102 VECCORE_ATT_HOST_DEVICE
0103 VECGEOM_FORCE_INLINE
0104 Precision GetTIn2Inv() const { return GetUnplacedVolume()->GetTIn2Inv(); }
0105
0106 VECCORE_ATT_HOST_DEVICE
0107 VECGEOM_FORCE_INLINE
0108 Precision GetTOut2Inv() const { return GetUnplacedVolume()->GetTOut2Inv(); }
0109
0110 VECCORE_ATT_HOST_DEVICE
0111 VECGEOM_FORCE_INLINE
0112 Precision GetDz() const { return GetUnplacedVolume()->GetDz(); }
0113
0114 VECCORE_ATT_HOST_DEVICE
0115 VECGEOM_FORCE_INLINE
0116 Precision GetDz2() const { return GetUnplacedVolume()->GetDz2(); }
0117
0118 VECCORE_ATT_HOST_DEVICE
0119 VECGEOM_FORCE_INLINE
0120 Precision GetEndInnerRadius() const { return GetUnplacedVolume()->GetEndInnerRadius(); }
0121
0122 VECCORE_ATT_HOST_DEVICE
0123 VECGEOM_FORCE_INLINE
0124 Precision GetEndInnerRadius2() const { return GetUnplacedVolume()->GetEndInnerRadius2(); }
0125
0126 VECCORE_ATT_HOST_DEVICE
0127 VECGEOM_FORCE_INLINE
0128 Precision GetEndOuterRadius() const { return GetUnplacedVolume()->GetEndOuterRadius(); }
0129
0130 VECCORE_ATT_HOST_DEVICE
0131 VECGEOM_FORCE_INLINE
0132 Precision GetEndOuterRadius2() const { return GetUnplacedVolume()->GetEndOuterRadius2(); }
0133
0134 VECCORE_ATT_HOST_DEVICE
0135 VECGEOM_FORCE_INLINE
0136 Precision GetInSqSide() const { return GetUnplacedVolume()->GetInSqSide(); }
0137
0138 VECCORE_ATT_HOST_DEVICE
0139 VECGEOM_FORCE_INLINE
0140 Precision GetZToleranceLevel() const { return GetUnplacedVolume()->GetZToleranceLevel(); }
0141
0142 VECCORE_ATT_HOST_DEVICE
0143 VECGEOM_FORCE_INLINE
0144 Precision GetInnerRadToleranceLevel() const { return GetUnplacedVolume()->GetInnerRadToleranceLevel(); }
0145
0146 VECCORE_ATT_HOST_DEVICE
0147 VECGEOM_FORCE_INLINE
0148 Precision GetOuterRadToleranceLevel() const { return GetUnplacedVolume()->GetOuterRadToleranceLevel(); }
0149
0150 template <bool ForInnerSurface>
0151 VECGEOM_FORCE_INLINE VECCORE_ATT_HOST_DEVICE Precision GetHypeRadius2(Precision dz) const
0152 {
0153 return GetUnplacedVolume()->GetHypeRadius2<ForInnerSurface>(dz);
0154 }
0155
0156 VECCORE_ATT_HOST_DEVICE
0157 VECGEOM_FORCE_INLINE
0158 bool PointOnZSurface(Vector3D<Precision> const &p) const { return GetUnplacedVolume()->PointOnZSurface(p); }
0159
0160 template <bool ForInnerSurface>
0161 VECGEOM_FORCE_INLINE VECCORE_ATT_HOST_DEVICE bool PointOnHyperbolicSurface(Vector3D<Precision> const &p) const
0162 {
0163 return GetUnplacedVolume()->PointOnHyperbolicSurface<ForInnerSurface>(p);
0164 }
0165
0166 Precision SurfaceArea() const override { return GetUnplacedVolume()->SurfaceArea(); }
0167
0168
0169
0170
0171
0172 VECGEOM_FORCE_INLINE
0173 virtual int MemorySize() const override { return sizeof(*this); }
0174
0175 #ifndef VECCORE_CUDA
0176 virtual VPlacedVolume const *ConvertToUnspecialized() const override;
0177
0178 #ifdef VECGEOM_ROOT
0179 virtual TGeoShape const *ConvertToRoot() const override { return GetUnplacedVolume()->ConvertToRoot(GetName()); }
0180 #endif
0181 #ifdef VECGEOM_GEANT4
0182 virtual G4VSolid const *ConvertToGeant4() const override { return GetUnplacedVolume()->ConvertToGeant4(GetName()); }
0183 #endif
0184
0185 #endif
0186 };
0187
0188 template <typename UnplacedHype_t>
0189 class SPlacedHype : public PlacedVolumeImplHelper<UnplacedHype_t, PlacedHype> {
0190 using Base = PlacedVolumeImplHelper<UnplacedHype_t, PlacedHype>;
0191
0192 public:
0193 typedef UnplacedHype UnplacedShape_t;
0194 using Base::Base;
0195 };
0196
0197 }
0198 }
0199
0200 #endif