File indexing completed on 2026-04-17 08:35:33
0001 #ifndef VECGEOM_SURFACE_SPHERECONVERTER_H_
0002 #define VECGEOM_SURFACE_SPHERECONVERTER_H_
0003
0004 #include <VecGeom/surfaces/conv/Builder.h>
0005 #include <VecGeom/surfaces/Model.h>
0006
0007 #include <VecGeom/volumes/Sphere.h>
0008 #include <VecGeom/volumes/UnplacedOrb.h>
0009
0010 namespace vgbrep {
0011 namespace conv {
0012
0013
0014
0015
0016
0017
0018 template <typename Real_t>
0019 bool CreateSphereSurfaces(vecgeom::UnplacedSphere const &sph, int logical_id, bool intersection = false)
0020 {
0021
0022
0023 auto rmax = sph.GetRmax();
0024 int isurf;
0025 LogicExpressionCPU logic;
0026 vecgeom::Transformation3DMP<Real_t> identity;
0027
0028 vecgeom::Precision surfdata[1];
0029 surfdata[0] = rmax;
0030 isurf = builder::CreateLocalSurface<Real_t>(
0031 builder::CreateUnplacedSurface<Real_t>(SurfaceType::kSpherical, surfdata, false),
0032 builder::CreateFrame<Real_t>(FrameType::kZPhi,
0033 ZPhiMask<Real_t>{-rmax, rmax, true, 0., rmax, 0., vecgeom::kTwoPi}),
0034 identity);
0035 builder::AddSurfaceToShell<Real_t>(logical_id, isurf);
0036 if (intersection) builder::GetSurface<Real_t>(isurf).fSkipConvexity = true;
0037 logic.push_back(isurf);
0038
0039 builder::AddLogicToShell<Real_t>(logical_id, logic);
0040 return true;
0041 }
0042
0043
0044
0045
0046
0047
0048 template <typename Real_t>
0049 bool CreateSphereSurfaces(vecgeom::UnplacedOrb const &orb, int logical_id, bool intersection = false)
0050 {
0051 vecgeom::UnplacedSphere temp_sph(0, orb.GetRadius());
0052 return CreateSphereSurfaces<Real_t>(temp_sph, logical_id, intersection);
0053 }
0054
0055 }
0056 }
0057 #endif