File indexing completed on 2026-04-17 08:35:33
0001 #ifndef VECGEOM_SURFACE_ELLIPTICALTUBECONVERTER_H_
0002 #define VECGEOM_SURFACE_ELLIPTICALTUBECONVERTER_H_
0003
0004 #include <VecGeom/surfaces/conv/Builder.h>
0005 #include <VecGeom/surfaces/Model.h>
0006
0007 #include <VecGeom/volumes/EllipticalTube.h>
0008
0009 namespace vgbrep {
0010 namespace conv {
0011
0012
0013
0014
0015
0016
0017 template <typename Real_t>
0018 bool CreateEllipticalTubeSurfaces(vecgeom::UnplacedEllipticalTube const &tube, int logical_id,
0019 bool intersection = false)
0020 {
0021 using ZPhiMask_t = ZPhiMask<Real_t>;
0022 using WindowMask_t = WindowMask<Real_t>;
0023
0024 LogicExpressionCPU logic;
0025
0026 int isurf;
0027 vecgeom::Precision surfdata[3];
0028
0029 auto &cpudata = CPUsurfData<Real_t>::Instance();
0030
0031
0032
0033
0034
0035
0036 isurf = builder::CreateLocalSurface<Real_t>(
0037 builder::CreateUnplacedSurface<Real_t>(SurfaceType::kPlanar),
0038 builder::CreateFrame<Real_t>(FrameType::kWindow, WindowMask_t{tube.GetDx(), tube.GetDy()}),
0039 vecgeom::Transformation3DMP<Precision>(0., 0., tube.GetDz(), 0., 0., 0.));
0040 builder::AddSurfaceToShell<Real_t>(logical_id, isurf);
0041 if (intersection) builder::GetSurface<Real_t>(isurf).fSkipConvexity = true;
0042 builder::GetSurface<Real_t>(isurf).fSkipConvexity = true;
0043
0044 VECGEOM_ASSERT(isurf >= 0);
0045 cpudata.fLocalSurfaces[isurf].fLogicId = isurf;
0046 logic.push_back(isurf);
0047 logic.push_back(land);
0048
0049
0050 isurf = builder::CreateLocalSurface<Real_t>(
0051 builder::CreateUnplacedSurface<Real_t>(SurfaceType::kPlanar),
0052 builder::CreateFrame<Real_t>(FrameType::kWindow, WindowMask_t{tube.GetDx(), tube.GetDy()}),
0053 vecgeom::Transformation3DMP<Precision>(0., 0., -tube.GetDz(), 0., 180., 0.));
0054 builder::AddSurfaceToShell<Real_t>(logical_id, isurf);
0055 if (intersection) builder::GetSurface<Real_t>(isurf).fSkipConvexity = true;
0056 builder::GetSurface<Real_t>(isurf).fSkipConvexity = true;
0057
0058 VECGEOM_ASSERT(isurf >= 0);
0059 cpudata.fLocalSurfaces[isurf].fLogicId = isurf;
0060 logic.push_back(isurf);
0061 logic.push_back(land);
0062
0063 vecgeom::Transformation3DMP<Real_t> identity;
0064
0065
0066 surfdata[0] = tube.GetDx();
0067 surfdata[1] = tube.GetDy();
0068 surfdata[2] = tube.GetDz();
0069 auto rmax = vecCore::math::Max(tube.GetDx(), tube.GetDy());
0070 isurf = builder::CreateLocalSurface<Real_t>(
0071 builder::CreateUnplacedSurface<Real_t>(SurfaceType::kElliptical, surfdata),
0072 builder::CreateFrame<Real_t>(FrameType::kZPhi, ZPhiMask_t{-surfdata[2], surfdata[2], 1, rmax,
0073 rmax, static_cast<vecgeom::Precision>(0),
0074 static_cast<vecgeom::Precision>(360)}),
0075 identity);
0076 builder::AddSurfaceToShell<Real_t>(logical_id, isurf);
0077 if (intersection) builder::GetSurface<Real_t>(isurf).fSkipConvexity = true;
0078
0079 VECGEOM_ASSERT(isurf >= 0);
0080 cpudata.fLocalSurfaces[isurf].fLogicId = isurf;
0081 logic.push_back(isurf);
0082
0083 builder::AddLogicToShell<Real_t>(logical_id, logic);
0084
0085 return true;
0086 }
0087
0088 }
0089 }
0090 #endif