pyg4ometry.convert

Submodules

Attributes

Classes

_PolygonProcessing

RPP

Rectangular Parallelepiped

BOX

General Rectangular Parallelepiped

SPH

Sphere

RCC

Right Circular Cylinder

REC

Right Elliptical Cylinder

TRC

Truncated Right-angled Cone

ELL

Ellipsoid of Revolution

WED

Right Angle Wedge

RAW

Base class representing a body as defined in FLUKA

ARB

Arbitrary Convex Polyhedron

XYP

Infinite half-space delimited by the x-y plane (perpendicular to the z-axis)

XZP

Infinite half-space delimited by the x-y plane (perpendicular to the y-axis)

YZP

Infinite half-space delimited by the x-y plane (perpendicular to the x-axis)

PLA

Infinite half-space delimited by the x-y plane (perpendicular to the z-axis) Generic infinite half-space.

XCC

Infinite Circular Cylinder parallel to the x-axis

YCC

Infinite Circular Cylinder parallel to the y-axis

ZCC

Infinite Circular Cylinder parallel to the z-axis

XEC

Infinite Elliptical Cylinder parallel to the x-axis

YEC

Infinite Elliptical Cylinder parallel to the y-axis

ZEC

Infinite Elliptical Cylinder parallel to the z-axis

QUA

Generic quadric

Functions

fluka2Geant4(flukareg[, regions, omitRegions, ...])

Convert a FLUKA registry to a Geant4 Registry.

_rotoTranslationFromTra2(name, tra2[, flukaregistry, ...])

geant4Reg2FlukaReg(greg[, logicalVolumeName, ...])

Convert a Geant4 model to a FLUKA one. This is done by handing over a complete

geant4Logical2Fluka(logicalVolume[, flukaRegistry, ...])

Convert a single logical volume - not the main entry point for the conversion.

geant4PhysicalVolume2Fluka(physicalVolume[, mtra, ...])

geant4Solid2FlukaRegion(flukaNameCount, solid[, mtra, ...])

geant4MaterialDict2Fluka(matr, freg)

geant4Material2Fluka(material, freg[, ...])

geant4Box2Fluka(flukaNameCount, solid[, mtra, tra, ...])

geant4Tubs2Fluka(flukaNameCount, solid[, mtra, tra, ...])

geant4CutTubs2Fluka(flukaNameCount, solid[, mtra, ...])

geant4Cons2Fluka(flukaNameCount, solid[, mtra, tra, ...])

pycsgmesh2FlukaRegion(mesh, name[, mtra, tra, ...])

geant4Sphere2Fluka(flukaNameCount, solid[, mtra, tra, ...])

geant4Orb2Fluka(flukaNameCount, solid[, mtra, tra, ...])

geant4Torus2Fluka(flukaNameCount, solid[, mtra, tra, ...])

geant4Polycone2Fluka(flukaNameCount, solid[, mtra, ...])

geant4Extruded2Fluka(flukaNameCount, solid[, mtra, ...])

geant4Polyhedra2Fluka(flukaNameCount, solid[, mtra, ...])

geant4EllipticalTube2Fluka(flukaNameCount, solid[, ...])

geant4Ellipsoid2Fluka(flukaNameCount, solid[, mtra, ...])

geant4EllipticalCone2Fluka(flukaNameCount, solid[, ...])

geant4Paraboloid2Fluka(flukaNameCount, solid[, mtra, ...])

geant4Hype2Fluka(flukaNameCount, solid[, mtra, tra, ...])

geant4Tet2Fluka(flukaNameCount, solid[, mtra, tra, ...])

geant4GenericTrap2Fluka(flukaNameCount, solid[, mtra, ...])

makeStripName(mn)

makeShortName(mn)

transformQuadricFluka(axx, ayy, azz, axy, axz, ayz, ...)

transformQuadricMatrix(Q, P, R, M, T)

freecadDoc2Fluka(fcd)

part2Region(obj, trfm, fgreg[, meshDeviation])

stl2gdml(stlFileName[, gdmlFileName, worldMaterial, ...])

geant4Solid2Geant4Tessellated(solid)

geant4Solid2Geant4Tessellated_NoVTK(solid)

gdml2stl(gdmlFileName[, stlFileName, solidName])

mkVtkIdList(it)

pycsgMeshToVtkPolyData(mesh)

vtkPolyDataToNumpy(data)

pycsgMeshToObj(mesh, fileName)

pyg42VtkTransformation(mtra, tra)

vtkTransformation2PyG4(vt)

pycsgMeshToStl(mesh, fileName)

oceShape_Geant4_LogicalVolume(name, solid, material, greg)

Make a logical volume from input or get from registry

oceShape_Geant4_Assembly(name, greg)

Make a assembly volume from input or get from registry

oceShape_Geant4_Tessellated(name, shape, greg[, ...])

Make a tessellated solid from a OpenCascade shape

_oce2Geant4_traverse(shapeTool, label, greg, ...[, ...])

oce2Geant4(shapeTool, shapeName[, materialMap, ...])

Convert CAD geometry starting from shapeName

convertMeshToPolyTriangulation(m)

convertMeshToShapeUsingMakeShapeOnMesh(m)

convertMeshToShape(m)

vis2oce(vis[, stepFileName])

Package Contents

pyg4ometry.convert.fluka2Geant4(flukareg, regions=None, omitRegions=None, worldMaterial='G4_Galactic', worldDimensions=None, omitBlackholeRegions=True, quadricRegionAABBs=None, **kwargs)

Convert a FLUKA registry to a Geant4 Registry.

Parameters:
  • flukareg (FlukaRegistry) – FlukaRegistry instance to be converted.

  • regions (list) – Names of regions to be converted, by default all are converted. Mutually exclusive with omitRegions.

  • omitRegions (list) – Names of regions to be omitted from the conversion. This option is mutually exclusive with the kwarg regions.

  • worldMaterial (string) – name of world material to be used.

  • worldDimensions (list) – dimensions of world logical volume in converted Geant4. By default this is equal to WORLD_DIMENSIONS.

  • omitBlackholeRegions (bool) – whether or not to omit regions with the FLUKA material BLCKHOLE from the conversion. By default, true.

  • quadricRegionAABBs (dict) – The axis-aligned aabbs of any regions featuring QUA bodies, mapping region names to fluka.AABB instances.

Developer options (to kwargs) withLengthSafety: Whether or not to apply automatic length safety.

minimiseSolids: Whether or not to minimise the boxes and tubes of Geant4 used to represent infinite solids in FLUKA.

class pyg4ometry.convert._PolygonProcessing
classmethod windingNumber(pgon)

return the winding number of pgon :param pgon: list of points [[x1,y1], [x2,y2], … ] :type pgon: List[List[x1,y1], …] returns: Integer winding number

classmethod reversePolygon(pgon)

return reversed polygon :param pgon: list of points [[x1,y1], [x2,y2], … ] :type pgon: List[List[x1,y1], …] returns: List[List[x1,y1], …]

classmethod makePolygonFromList(pgon, type='')

Convert list of points [[x1,y1], [x2,y2], … ] to cgal Polygon_2

Parameters:
  • pgon (List[List[x,y], ..]) – list of points [[x1,y1], [x2,y2], … ]

  • type – Class of polygon (Polygon_2_EPICK, Polygon_2_EPECK, Partition_traits_2_Polygon_2_EPECK)

  • type – str

returns: Polygon_2

classmethod makeListFromPolygon(pgon)

Convert 2D polygon to list of points [[x1,y1], [x2,y2], … ]

Parameters:

pgon (Polygon_2_EPECK or Polygon_2_EPICK) – cgal Polygon_2 input

returns: [[x1,y1], [x2,y2], …]

classmethod decomposePolygon2d(pgon)

Decompose general 2D polygon (pgon) to convex 2D polygons

Parameters:

pgon (List(List[2])) – list of pgon points (which are lists) [[x1,y1], [x2,y2], …]

returns: List of polgons [pgon1, pgon2, …]

classmethod decomposePolygon2dWithHoles(pgonOuter, pgonHoles)

Decompose general 2D polygon with holes (pgon) to convex 2D polygons

Parameters:
  • pgonOuter – list of pgon points (which are lists) [[x1,y1], [x2,y2], …]

  • pgonHoles – List of polgons [pgon1, pgon2, …]

returns: List of polgons [pgon1, pgon2, …]

classmethod triangulatePolygon2d(pgon)

Triangulate general 2D polygon

Parameters:

pgonOuter – list of pgon points (which are lists) [[x1,y1], [x2,y2], …]

returns: List of triangles [ [[x1,y1], [x2,y2], [x3,y3]], [[x1,y1], [x2,y2], [x3,y3]], …]

pyg4ometry.convert._rotoTranslationFromTra2(name, tra2, flukaregistry=None, allowZero=False)
pyg4ometry.convert.geant4Reg2FlukaReg(greg, logicalVolumeName='', bakeTransforms=False)

Convert a Geant4 model to a FLUKA one. This is done by handing over a complete pyg4ometry.geant4.Registry instance.

Parameters:

greg (pyg4ometry.geant4.Registry) – geant4 registry

returns: pyg4ometry.fluka.FlukaRegistry

pyg4ometry.convert.geant4Logical2Fluka(logicalVolume, flukaRegistry=None, bakeTransforms=False)

Convert a single logical volume - not the main entry point for the conversion.

pyg4ometry.convert.geant4PhysicalVolume2Fluka(physicalVolume, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, flukaNameCount=0, bakeTransforms=False)
pyg4ometry.convert.geant4Solid2FlukaRegion(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransforms=False)
pyg4ometry.convert.geant4MaterialDict2Fluka(matr, freg)
pyg4ometry.convert.geant4Material2Fluka(material, freg, suggestedDensity=None, elementSuffix=False, materialNameShort=None)
pyg4ometry.convert.geant4Box2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4Tubs2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4CutTubs2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4Cons2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.pycsgmesh2FlukaRegion(mesh, name, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4Sphere2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4Orb2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4Torus2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4Polycone2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4Extruded2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4Polyhedra2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4EllipticalTube2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4Ellipsoid2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4EllipticalCone2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4Paraboloid2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4Hype2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4Tet2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.geant4GenericTrap2Fluka(flukaNameCount, solid, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), flukaRegistry=None, addRegistry=True, commentName='', bakeTransform=False)
pyg4ometry.convert.makeStripName(mn)
pyg4ometry.convert.makeShortName(mn)
pyg4ometry.convert.transformQuadricFluka(axx, ayy, azz, axy, axz, ayz, ax, ay, az, a, M, T)
pyg4ometry.convert.transformQuadricMatrix(Q, P, R, M, T)
class pyg4ometry.convert.RPP(name, xmin, xmax, ymin, ymax, zmin, zmax, transform=None, flukaregistry=None, addRegistry=True, comment='')

Bases: BodyMixin

Rectangular Parallelepiped

Parameters:
  • name (str) – of body

  • xmin (float) – lower x coordinate of RPP

  • xmax (float) – upper x coordinate of RPP

  • ymin (float) – lower y coordinate of RPP

  • ymax (float) – upper y coordinate of RPP

  • zmin (float) – lower z coordinate of RPP

  • zmax (float) – upper z coordinate of RPP)

name
lower
upper
transform
comment
centre(aabb=None)
rotation()
lengths()
geant4Solid(reg, aabb=None)
__repr__()
_withLengthSafety(safety, reg)
flukaFreeString()
hash()
class pyg4ometry.convert.BOX(name, vertex, edge1, edge2, edge3, transform=None, flukaregistry=None, addRegistry=True, comment='')

Bases: BodyMixin

General Rectangular Parallelepiped

Parameters:
  • name (str) – of body

  • vertex (list) – position [x, y, z] of one of the corners.

  • edge1 (list) – vector [x, y, z] denoting the first side of the box.

  • edge2 (list) – vector [x, y, z] denoting the second side of the box.

  • edge3 (list) – vector [x, y, z] denoting the second side of the box.

name
vertex
edge1
edge2
edge3
transform
comment
centre(aabb=None)
rotation()
lengths()
geant4Solid(greg, aabb=None)
__repr__()
_withLengthSafety(safety, reg)
flukaFreeString()
hash()
class pyg4ometry.convert.SPH(name, point, radius, transform=None, flukaregistry=None, comment='')

Bases: BodyMixin

Sphere

Parameters:
  • name (str) – of body

  • point (list) – position [x, y, z] of the centre of the sphere.

  • radius (float) – radius of the sphere.

name
point
radius
transform
comment
centre(aabb=None)
rotation()
geant4Solid(reg, aabb=None)
__repr__()
_withLengthSafety(safety, reg)
flukaFreeString()
hash()
class pyg4ometry.convert.RCC(name, face, direction, radius, transform=None, flukaregistry=None, comment='')

Bases: BodyMixin

Right Circular Cylinder

Parameters:
  • name (str) – of body

  • vertex (list) – position [x, y, z] of one of the faces of the cylinder.

  • edge1 (list) – vector [x, y, z] denoting the direction along the length of the cylinder.

  • edge2 (float) – radius of the cylinder face.

name
face
direction
radius
transform
comment
centre(aabb=None)
rotation()
geant4Solid(reg, aabb=None)
__repr__()
_withLengthSafety(safety, reg)
flukaFreeString()
hash()
class pyg4ometry.convert.REC(name, face, direction, semiminor, semimajor, transform=None, flukaregistry=None, comment='')

Bases: BodyMixin

Right Elliptical Cylinder

Parameters:
  • name (str) – of body

  • vertex (list) – position [x, y, z] of one of the faces of the cylinder.

  • semiminor (list) – vector [x, y, z] denoting the direction along the semiminor axis of the ellipse.

  • semimajor (list) – vector [x, y, z] denoting the direction along the semimajor axis of the ellipse.

name
face
direction
semiminor
semimajor
transform
comment
centre(aabb=None)
rotation()
geant4Solid(reg, aabb=None)
__repr__()
_withLengthSafety(safety, reg)
flukaFreeString()
hash()
class pyg4ometry.convert.TRC(name, major_centre, direction, major_radius, minor_radius, transform=None, flukaregistry=None, comment='')

Bases: BodyMixin

Truncated Right-angled Cone

Parameters:
  • name (str) – of body

  • major_centre (list) – vector [x, y, z] position of the centre of the larger face.

  • direction (list) – vector [x, y, z] pointing from the larger face to the smaller face.

  • major_radius (float) – radius of the larger face.

  • minor_radius (float) – radius of the smaller face.

name
major_centre
direction
major_radius
minor_radius
transform
comment
centre(aabb=None)
rotation()
geant4Solid(registry, aabb=None)
__repr__()
_withLengthSafety(safety, reg)
flukaFreeString()
hash()
class pyg4ometry.convert.ELL(name, focus1, focus2, length, transform=None, flukaregistry=None, comment='')

Bases: BodyMixin

Ellipsoid of Revolution

Parameters:
  • name (str) – of body

  • focus1 (list) – position [x, y, z] denoting of one of the foci.

  • focus2 (list) – position [x, y, z] denoting the other focus.

  • length (float) – length of the ellipse axis which the foci lie on.

name
focus1
focus2
length
transform
comment
semimajor
centre(aabb=None)
rotation()
_linearEccentricity()
_semiminor()
geant4Solid(greg, aabb=None)
__repr__()
_withLengthSafety(safety, reg)
flukaFreeString()
hash()
class pyg4ometry.convert.WED(name, vertex, edge1, edge2, edge3, transform=None, flukaregistry=None, comment='')

Bases: _WED_RAW

Right Angle Wedge

Parameters:
  • name (str) – of body

  • vertex (list) – position [x, y, z] of one of the the rectangular corners.

  • edge1 (list) – vector [x, y, z] denoting height of the wedge.

  • edge2 (list) – vector [x, y, z] denoting width of the wedge.

  • edge3 (list) – vector [x, y, z] denoting length of the wedge.

class pyg4ometry.convert.RAW(name, vertex, edge1, edge2, edge3, transform=None, flukaregistry=None, comment='')

Bases: _WED_RAW

Base class representing a body as defined in FLUKA

__doc__
class pyg4ometry.convert.ARB(name, vertices, facenumbers, transform=None, flukaregistry=None, comment='')

Bases: BodyMixin

Arbitrary Convex Polyhedron

Parameters:
  • name (str) – of body

  • vertices (list) – Eight vertices which make up the polyhedron as [[x1, y1, z1], [x2, y2, z2], …]. There must be eight even if only six or seven vertices are needed to make up the polydedron.

  • facenumbers (float) – The faces of the polyhedron expressed as floats where each digit of the float refers to one of the vertices which makes up that face. Six must always be provided as [1234,8765, …], even if only four or five faces are needed. Any unneeded faces must be set to 0 (no less than 4 sides). Note that the references to the vertices are not zero-counting. The order of the vertices denoted in the facenumbers must be either all clockwise or all anticlockwise, which if not obeyed will result in erroneous output without warning.

name
vertices
facenumbers
transform
comment
_nfaces = 6
zeros = []
centre(aabb=None)
rotation()
_faceNumbersToZeroCountingIndices()
_extent()
geant4Solid(greg, aabb=None)
_toTesselatedSolid(verticesAndPolygons, greg, addRegistry)
_getVerticesAndPolygons()
_toVerticesAndPolygons(reverse)
__repr__()
_withLengthSafety(safety, reg)
flukaFreeString()
hash()
class pyg4ometry.convert.XYP(name, z, transform=None, flukaregistry=None, comment='')

Bases: _HalfSpaceMixin

Infinite half-space delimited by the x-y plane (perpendicular to the z-axis)

Parameters:
  • name (str) – of body

  • z (float) – position of the x-y plane on the z-axis. All points less than z are considered to be part of this body.

name
z
transform
comment
__repr__()
_withLengthSafety(safety, reg)
flukaFreeString()
hash()
toPlane()
class pyg4ometry.convert.XZP(name, y, transform=None, flukaregistry=None, comment='')

Bases: _HalfSpaceMixin

Infinite half-space delimited by the x-y plane (perpendicular to the y-axis)

Parameters:
  • name (str) – of body

  • y (float) – position of the x-y plane on the y-axis. All points less than y are considered to be part of this body.

name
y
transform
comment
__repr__()
_withLengthSafety(safety, reg)
flukaFreeString()
hash()
toPlane()
class pyg4ometry.convert.YZP(name, x, transform=None, flukaregistry=None, comment='')

Bases: _HalfSpaceMixin

Infinite half-space delimited by the x-y plane (perpendicular to the x-axis)

Parameters:
  • name (str) – of body

  • x (float) – position of the x-y plane on the x-axis. All points less than x are considered to be part of this body.

name
x
transform
comment
__repr__()
_withLengthSafety(safety, reg)
flukaFreeString()
hash()
toPlane()
class pyg4ometry.convert.PLA(name, normal, point, transform=None, flukaregistry=None, comment='')

Bases: _HalfSpaceMixin

Infinite half-space delimited by the x-y plane (perpendicular to the z-axis) Generic infinite half-space.

Parameters:
  • name (str) – of body

  • normal (list) – position of a point on the plane

  • normal – vector perpendicular to the face of the plane, pointing away from the contents of the half space.

name
normal
point
transform
comment
rotation()
__repr__()
_withLengthSafety(safety, reg=None)
flukaFreeString()
hash()
toPlane()
class pyg4ometry.convert.XCC(name, y, z, radius, transform=None, flukaregistry=None, comment='')

Bases: _InfiniteCylinderMixin, _ShiftableCylinderMixin

Infinite Circular Cylinder parallel to the x-axis

Parameters:
  • name (str) – of body

  • y (float) – position of the centre on the

  • z (float) – position of the centre on the

  • radius (float) – position of the centre on the

name
y
z
radius
transform
comment
centre(aabb=None)
rotation()
__repr__()
_withLengthSafety(safety, reg=None)
flukaFreeString()
hash()
point()
direction()
class pyg4ometry.convert.YCC(name, z, x, radius, transform=None, flukaregistry=None, comment='')

Bases: _InfiniteCylinderMixin, _ShiftableCylinderMixin

Infinite Circular Cylinder parallel to the y-axis

Parameters:
  • name (str) – of body

  • z (float) – position of the centre on the

  • x (float) – position of the centre on the

  • radius (float) – position of the centre on the

name
z
x
radius
transform
comment
centre(aabb=None)
rotation()
__repr__()
_withLengthSafety(safety, reg=None)
flukaFreeString()
hash()
point()
direction()
class pyg4ometry.convert.ZCC(name, x, y, radius, transform=None, flukaregistry=None, comment='')

Bases: _InfiniteCylinderMixin, _ShiftableCylinderMixin

Infinite Circular Cylinder parallel to the z-axis

Parameters:
  • name (str) – of body

  • x (float) – position of the centre on the

  • y (float) – position of the centre on the

  • radius (float) – position of the centre on the

name
x
y
radius
transform
comment
centre(aabb=None)
rotation()
__repr__()
_withLengthSafety(safety, reg=None)
flukaFreeString()
hash()
point()
direction()
class pyg4ometry.convert.XEC(name, y, z, ysemi, zsemi, transform=None, flukaregistry=None, comment='')

Bases: BodyMixin, _ShiftableCylinderMixin

Infinite Elliptical Cylinder parallel to the x-axis

Parameters:
  • name (str) – of body

  • y (float) – position of the centre on the

  • z (float) – position of the centre on the

  • ysemi (float) – position of the centre on the

  • zsemi (float) – position of the centre on the

name
y
z
ysemi
zsemi
transform
comment
centre(aabb=None)
rotation()
geant4Solid(reg, aabb=None)
__repr__()
_withLengthSafety(safety, reg=None)
flukaFreeString()
hash()
class pyg4ometry.convert.YEC(name, z, x, zsemi, xsemi, transform=None, flukaregistry=None, comment='')

Bases: BodyMixin, _ShiftableCylinderMixin

Infinite Elliptical Cylinder parallel to the y-axis

Parameters:
  • name (str) – of body

  • z (float) – position of the centre on the

  • x (float) – position of the centre on the

  • zsemi (float) – position of the centre on the

  • xsemi (float) – position of the centre on the

name
z
x
zsemi
xsemi
transform
comment
centre(aabb=None)
rotation()
geant4Solid(reg, aabb=None)
__repr__()
_withLengthSafety(safety, reg=None)
flukaFreeString()
hash()
class pyg4ometry.convert.ZEC(name, x, y, xsemi, ysemi, transform=None, flukaregistry=None, comment='')

Bases: BodyMixin, _ShiftableCylinderMixin

Infinite Elliptical Cylinder parallel to the z-axis

Parameters:
  • name (str) – of body

  • x (float) – position of the centre on the

  • y (float) – position of the centre on the

  • xsemi (float) – position of the centre on the

  • ysemi (float) – position of the centre on the

name
x
y
xsemi
ysemi
transform
comment
centre(aabb=None)
rotation()
geant4Solid(reg, aabb=None)
__repr__()
_withLengthSafety(safety, reg=None)
flukaFreeString()
hash()
class pyg4ometry.convert.QUA(name, cxx, cyy, czz, cxy, cxz, cyz, cx, cy, cz, c, transform=None, flukaregistry=None, comment='', **kwargs)

Bases: BodyMixin

Generic quadric

Parameters:
  • name (str) – of body

  • cxx (float) – x^2 coefficient

  • cyy (float) – y^2 coefficient

  • czz (float) – z^2 coefficient

  • cxy (float) – xy coefficient

  • cxz (float) – xz coefficient

  • cyz (float) – yz coefficient

  • cx (float) – x coefficient

  • cy (float) – y coefficient

  • cz (float) – z coefficient

  • c (constant) – constant

name
cxx
cyy
czz
cxy
cxz
cyz
cx
cy
cz
c
transform
comment
centre(aabb=None)
rotation()
coefficientsMatrix()
static _quadricMatrixToCoefficients(matrix)
mesh(lower, upper, capping=True)
geant4Solid(reg, aabb=None)
_withLengthSafety(safety, reg=None)
__repr__()
flukaFreeString()
hash()
pyg4ometry.convert.freecadDoc2Fluka(fcd)
pyg4ometry.convert.part2Region(obj, trfm, fgreg, meshDeviation=0.05)
pyg4ometry.convert.stl2gdml(stlFileName, gdmlFileName='output.gdml', worldMaterial='G4_Galactic', solidMaterial='G4_Au')
pyg4ometry.convert.geant4Solid2Geant4Tessellated(solid)
pyg4ometry.convert.geant4Solid2Geant4Tessellated_NoVTK(solid)
pyg4ometry.convert.gdml2stl(gdmlFileName, stlFileName='output.gdml', solidName='ws')
pyg4ometry.convert.mkVtkIdList(it)
pyg4ometry.convert.pycsgMeshToVtkPolyData(mesh)
pyg4ometry.convert.vtkPolyDataToNumpy(data)
pyg4ometry.convert.pycsgMeshToObj(mesh, fileName)
pyg4ometry.convert.pyg42VtkTransformation(mtra, tra)
pyg4ometry.convert.vtkTransformation2PyG4(vt)
pyg4ometry.convert.pycsgMeshToStl(mesh, fileName)
pyg4ometry.convert.defaultLinDef = 0.5
pyg4ometry.convert.deftaulAngDef = 0.5
pyg4ometry.convert.oceShape_Geant4_LogicalVolume(name, solid, material, greg)

Make a logical volume from input or get from registry

Parameters:
pyg4ometry.convert.oceShape_Geant4_Assembly(name, greg)

Make a assembly volume from input or get from registry

Parameters:
pyg4ometry.convert.oceShape_Geant4_Tessellated(name, shape, greg, linDef=0.5, angDef=0.5)

Make a tessellated solid from a OpenCascade shape

Parameters:
  • name (str) – Name of logical volume

  • shape (TopoDS_Shape) – OpenCascade shape

  • greg (geant4.Registry) – Geant4 registry

pyg4ometry.convert._oce2Geant4_traverse(shapeTool, label, greg, materialMap, labelToSkipList, meshQualityMap, badCADLabels, addBoundingSolids=False, oceName=False)
pyg4ometry.convert.oce2Geant4(shapeTool, shapeName, materialMap={}, labelToSkipList=[], meshQualityMap={}, oceName=False)

Convert CAD geometry starting from shapeName

Parameters:
  • shapeTool (pyoce.TopoDS_Shape) – OpenCascade TopoDS_Shape

  • shapeName (str) – Name of the shape in the CAD file

  • materialMap (dict) – dictionary to map shape name to material shapeName:materialName or shapeName:Material

  • meshQualityMap (dict) – dictionary to map shape name to meshing quality str:[LinDef,AngDef]

pyg4ometry.convert.convertMeshToPolyTriangulation(m)
pyg4ometry.convert.convertMeshToShapeUsingMakeShapeOnMesh(m)
pyg4ometry.convert.convertMeshToShape(m)
pyg4ometry.convert.vis2oce(vis, stepFileName='output.step')