File indexing completed on 2026-10-04 09:27:52
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef NAVIGATION_VSAFETYESTIMATOR_H_
0009 #define NAVIGATION_VSAFETYESTIMATOR_H_
0010
0011 #include "VecGeom/base/Global.h"
0012 #include "VecGeom/base/Vector3D.h"
0013 #include "VecGeom/base/SOA3D.h"
0014 #include "VecGeom/base/Transformation3D.h"
0015 #include "VecGeom/navigation/NavigationState.h"
0016 #include "VecGeom/navigation/NavStatePool.h"
0017 #include "VecGeom/volumes/PlacedVolume.h"
0018 #include "VecGeom/volumes/LogicalVolume.h"
0019 #include "VecGeom/navigation/NavStateFwd.h"
0020
0021 namespace vecgeom {
0022 inline namespace VECGEOM_IMPL_NAMESPACE {
0023
0024
0025 template <typename T>
0026 class Vector3D;
0027
0028 class LogicalVolume;
0029 class Transformation3D;
0030 class VPlacedVolume;
0031
0032
0033
0034
0035
0036
0037 class VSafetyEstimator {
0038
0039 public:
0040
0041
0042
0043
0044 VECCORE_ATT_HOST_DEVICE
0045 virtual Precision ComputeSafety(Vector3D<Precision> const & ,
0046 NavigationState const & ) const = 0;
0047
0048 VECCORE_ATT_HOST_DEVICE
0049 virtual Precision ComputeSafetyForLocalPoint(Vector3D<Precision> const & ,
0050 VPlacedVolume const * ) const = 0;
0051
0052
0053 VECCORE_ATT_HOST_DEVICE
0054 virtual Precision ComputeSafetyToDaughtersForLocalPoint(Vector3D<Precision> const & ,
0055 LogicalVolume const * ) const = 0;
0056
0057
0058
0059
0060
0061
0062 using Real_v = vecgeom::VectorBackend::Real_v;
0063 using Bool_v = vecCore::Mask_v<Real_v>;
0064
0065 public:
0066 VECCORE_ATT_HOST_DEVICE
0067 virtual ~VSafetyEstimator() {}
0068
0069
0070 virtual const char *GetName() const = 0;
0071 };
0072
0073
0074
0075 template <typename Impl>
0076 class VSafetyEstimatorHelper : public VSafetyEstimator {
0077
0078 public:
0079 VECCORE_ATT_HOST_DEVICE
0080 virtual Precision ComputeSafety(Vector3D<Precision> const &globalpoint, NavigationState const &state) const override
0081 {
0082
0083 Transformation3D m;
0084 state.TopMatrix(m);
0085 Vector3D<Precision> localpoint = m.Transform(globalpoint);
0086
0087
0088 return ((Impl *)this)->Impl::ComputeSafetyForLocalPoint(localpoint, state.Top());
0089 }
0090
0091 static const char *GetClassName() { return Impl::gClassNameString; }
0092
0093 virtual const char *GetName() const override { return GetClassName(); }
0094 };
0095
0096 }
0097 }
0098
0099 #endif