File indexing completed on 2025-01-18 10:14:09
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef VECGEOM_VOLUMES_PLACEDTRD_H_
0010 #define VECGEOM_VOLUMES_PLACEDTRD_H_
0011
0012 #include "VecGeom/base/Global.h"
0013 #ifndef VECCORE_CUDA
0014 #include "VecGeom/base/RNG.h"
0015 #include <cmath>
0016 #endif
0017 #include "VecGeom/volumes/PlacedVolume.h"
0018 #include "VecGeom/volumes/UnplacedVolume.h"
0019 #include "VecGeom/volumes/kernel/TrdImplementation.h"
0020 #include "VecGeom/volumes/PlacedVolImplHelper.h"
0021 #include "VecGeom/volumes/UnplacedTrd.h"
0022
0023 namespace vecgeom {
0024
0025 VECGEOM_DEVICE_FORWARD_DECLARE(class PlacedTrd;);
0026 VECGEOM_DEVICE_DECLARE_CONV(class, PlacedTrd);
0027
0028 inline namespace VECGEOM_IMPL_NAMESPACE {
0029
0030
0031 class PlacedTrd : public VPlacedVolume {
0032
0033 public:
0034 using VPlacedVolume::VPlacedVolume;
0035 #ifndef VECCORE_CUDA
0036
0037
0038
0039
0040 PlacedTrd(char const *const label, LogicalVolume const *const logicalVolume,
0041 Transformation3D const *const transformation)
0042 : VPlacedVolume(label, logicalVolume, transformation)
0043 {
0044 }
0045
0046
0047
0048
0049 PlacedTrd(LogicalVolume const *const logicalVolume, Transformation3D const *const transformation)
0050 : PlacedTrd("", logicalVolume, transformation)
0051 {
0052 }
0053 #else
0054
0055 VECCORE_ATT_DEVICE PlacedTrd(LogicalVolume const *const logicalVolume, Transformation3D const *const transformation,
0056 const int id, const int copy_no, const int child_id)
0057 : VPlacedVolume(logicalVolume, transformation, id, copy_no, child_id)
0058 {
0059 }
0060 #endif
0061
0062
0063 VECCORE_ATT_HOST_DEVICE
0064 virtual ~PlacedTrd() {}
0065
0066
0067 VECCORE_ATT_HOST_DEVICE
0068 UnplacedTrd const *GetUnplacedVolume() const
0069 {
0070 return static_cast<UnplacedTrd const *>(GetLogicalVolume()->GetUnplacedVolume());
0071 }
0072
0073 VECCORE_ATT_HOST_DEVICE
0074 virtual void PrintType() const override;
0075 virtual void PrintType(std::ostream &s) const override;
0076
0077
0078 VECCORE_ATT_HOST_DEVICE
0079 VECGEOM_FORCE_INLINE
0080 Precision dx1() const { return GetUnplacedVolume()->dx1(); }
0081
0082
0083 VECCORE_ATT_HOST_DEVICE
0084 VECGEOM_FORCE_INLINE
0085 Precision dx2() const { return GetUnplacedVolume()->dx2(); }
0086
0087
0088 VECCORE_ATT_HOST_DEVICE
0089 VECGEOM_FORCE_INLINE
0090 Precision dy1() const { return GetUnplacedVolume()->dy1(); }
0091
0092
0093 VECCORE_ATT_HOST_DEVICE
0094 VECGEOM_FORCE_INLINE
0095 Precision dy2() const { return GetUnplacedVolume()->dy2(); }
0096
0097
0098 VECCORE_ATT_HOST_DEVICE
0099 VECGEOM_FORCE_INLINE
0100 Precision dz() const { return GetUnplacedVolume()->dz(); }
0101
0102
0103 Precision GetXHalfLength1() const { return GetUnplacedVolume()->dx1(); }
0104
0105
0106 Precision GetXHalfLength2() const { return GetUnplacedVolume()->dx2(); }
0107
0108
0109 Precision GetYHalfLength1() const { return GetUnplacedVolume()->dy1(); }
0110
0111
0112 Precision GetYHalfLength2() const { return GetUnplacedVolume()->dy2(); }
0113
0114
0115 Precision GetZHalfLength() const { return GetUnplacedVolume()->dz(); }
0116
0117
0118 void SetXHalfLength1(Precision arg) { const_cast<UnplacedTrd *>(GetUnplacedVolume())->SetXHalfLength1(arg); }
0119
0120
0121 void SetXHalfLength2(Precision arg) { const_cast<UnplacedTrd *>(GetUnplacedVolume())->SetXHalfLength2(arg); }
0122
0123
0124 void SetYHalfLength1(Precision arg) { const_cast<UnplacedTrd *>(GetUnplacedVolume())->SetYHalfLength1(arg); }
0125
0126
0127 void SetYHalfLength2(Precision arg) { const_cast<UnplacedTrd *>(GetUnplacedVolume())->SetYHalfLength2(arg); }
0128
0129
0130 void SetZHalfLength(Precision arg) { const_cast<UnplacedTrd *>(GetUnplacedVolume())->SetZHalfLength(arg); }
0131
0132
0133
0134
0135
0136
0137
0138 void SetAllParameters(Precision x1, Precision x2, Precision y1, Precision y2, Precision z)
0139 {
0140 const_cast<UnplacedTrd *>(GetUnplacedVolume())->SetAllParameters(x1, x2, y1, y2, z);
0141 }
0142
0143 #ifndef VECCORE_CUDA
0144
0145 VECGEOM_FORCE_INLINE
0146 virtual int MemorySize() const override { return sizeof(*this); }
0147
0148 virtual VPlacedVolume const *ConvertToUnspecialized() const override;
0149
0150 #ifdef VECGEOM_ROOT
0151 virtual TGeoShape const *ConvertToRoot() const override { return GetUnplacedVolume()->ConvertToRoot(GetName()); }
0152 #endif
0153 #ifdef VECGEOM_GEANT4
0154 G4VSolid const *ConvertToGeant4() const override { return GetUnplacedVolume()->ConvertToGeant4(GetName()); }
0155 #endif
0156 #endif
0157 };
0158
0159 template <typename UnplacedTrd_t>
0160 class SPlacedTrd : public PlacedVolumeImplHelper<UnplacedTrd_t, PlacedTrd> {
0161 using Base = PlacedVolumeImplHelper<UnplacedTrd_t, PlacedTrd>;
0162
0163 public:
0164 typedef UnplacedTrd UnplacedShape_t;
0165 using Base::Base;
0166 };
0167
0168 }
0169 }
0170
0171 #endif