pyg4ometry.geant4.solid

Submodules

Classes

TwoVector

_SolidBase

Base class for all solids

Plane

Constructs a infinite plane. Should not be used to construct geant4 geometry.

_SolidBase

Base class for all solids

Wedge

Constructs a infinite wedge. Should not be used to construct geant4 geometry.

_SolidBase

Base class for all solids

Box

Constructs a box. Note the lengths are full lengths and not half lengths as in Geant4

_SolidBase

Base class for all solids

Tubs

Constructs a cylindrical section.

_SolidBase

Base class for all solids

CutTubs

Constructs a cylindrical section with end face cuts. Note pLowNorm and pHighNorm can be

_SolidBase

Base class for all solids

Sphere

Constructs a section of a spherical shell.

_SolidBase

Base class for all solids

Cons

Constructs a conical section.

_SolidBase

Base class for all solids

Ellipsoid

Constructs an ellipsoid optinoally cut by planes perpendicular to the z-axis.

_SolidBase

Base class for all solids

Trd

Constructs a trapezoid.

_SolidBase

Base class for all solids

Torus

Constructs a torus.

_SolidBase

Base class for all solids

_GenericPolyhedra

Constructs a solid of rotation using an arbitrary 2D surface defined by a series of (r,z) coordinates.

Polycone

Constructs a solid of rotation using an arbitrary 2D surface.

_GenericPolyhedra

Constructs a solid of rotation using an arbitrary 2D surface defined by a series of (r,z) coordinates.

_SolidBase

Base class for all solids

Polyhedra

Constructs a polyhedra.

_SolidBase

Base class for all solids

_Expression

General expression, does not have an analogue in GDML

ExtrudedSolid

Construct an extruded solid

_SolidBase

Base class for all solids

Union

Union between two solids

_SolidBase

Base class for all solids

Intersection

Intersection between two solids

_SolidBase

Base class for all solids

Subtraction

Subtraction between two solids

_SolidBase

Base class for all solids

OpticalSurface

_SolidBase

Base class for all solids

Para

Constructs a parallelepiped.

_SolidBase

Base class for all solids

Trap

Constructs a general trapezoid.

_SolidBase

Base class for all solids

Orb

Constructs a solid sphere.

_SolidBase

Base class for all solids

EllipticalTube

Constructs a tube of elliptical cross-section.

_SolidBase

Base class for all solids

EllipticalCone

Constructs a cone with elliptical cross-section and an

_SolidBase

Base class for all solids

Paraboloid

Constructs a paraboloid with possible cuts along the z axis.

_SolidBase

Base class for all solids

Hype

Constructs a tube with hyperbolic profile.

_SolidBase

Base class for all solids

Tet

Constructs a tetrahedra.

_SolidBase

Base class for all solids

_TwistedSolid

_TwoVector

_Layer

TwistedBox

Constructs a box that is twisted though angle twisted angle

_SolidBase

Base class for all solids

_TwistedSolid

_TwoVector

_Layer

TwistedTrap

Constructs a general trapezoid with a twist around one axis.

_SolidBase

Base class for all solids

_TwoVector

_Layer

_TwistedSolid

TwistedTrd

Constructs a twisted general trapezoid.

_SolidBase

Base class for all solids

TwistedTubs

Creates a twisted tube segement. Note that only 1 constructor is supprted.

_SolidBase

Base class for all solids

_GenericPolyhedra

Constructs a solid of rotation using an arbitrary 2D surface defined by a series of (r,z) coordinates.

GenericPolycone

Constructs a solid of rotation using an arbitrary 2D surface defined by a series of (r,z) coordinates.

_SolidBase

Base class for all solids

GenericPolyhedra

Constructs a solid of rotation using an arbitrary 2D surface defined by a series of (r,z) coordinates.

_SolidBase

Base class for all solids

GenericTrap

Constructs an arbitrary trapezoid using two quadrilaterals sitting

_SolidBase

Base class for all solids

TessellatedSolid

Constructs a tessellated solid

_SolidBase

Base class for all solids

MultiUnion

Union between two or more solids.

_SolidBase

Base class for all solids

Scaled

Constructs a scaled sold.

_SolidBase

Base class for all solids

HalfSpace

SolidBase

Base class for all solids

Functions

cubeNet(vecList)

rad2deg(rad)

Convert rad in radians into degrees

deg2rad(deg)

Convert deg in degrees into radians

grad2rad(gradians)

Convert rad in gradians into radians

tbxyz2axisangle(rv)

Tait-Bryan x-y-z rotation to axis-angle representation

matrix2axisangle(matrix)

Convert 3x3 transformation matrix to axis angle representation

axisangle2matrix(axis, angle)

Convert axis angle to transformation matrix

matrix2tbxyz(matrix)

Convert rotation matrix to Tait-Bryan angles.

axisangle2tbxyz(axis, angle)

Convert axis and angle to tait bryan angles

tbxyz2matrix(angles)

Convert tait bryan angles to a single passive rotation matrix.

tbzyx2matrix(angles)

Convert Tait-Bryan angles to a single passive rotation matrix.

matrix_from(v_from, v_to)

Returns the rotation matrix that rotates v_from to parallel to

_rodrigues_anti_parallel(v_from, v_to)

v_from = vector FROM

are_parallel(vector_1, vector_2[, tolerance])

Check if vector vector_1 is parallel to vector vector_2 down to

are_anti_parallel(vector_1, vector_2[, tolerance])

Check if vector vector_1 is parallel to vector vector_2 down to

reverse(angles)

Invert the rotation represented by these angles.

two_fold_orientation(v1, v2, e1, e2)

matrix_from will align one vector with another, but there are

rad2deg(rad)

Convert rad in radians into degrees

deg2rad(deg)

Convert deg in degrees into radians

grad2rad(gradians)

Convert rad in gradians into radians

tbxyz2axisangle(rv)

Tait-Bryan x-y-z rotation to axis-angle representation

matrix2axisangle(matrix)

Convert 3x3 transformation matrix to axis angle representation

axisangle2matrix(axis, angle)

Convert axis angle to transformation matrix

matrix2tbxyz(matrix)

Convert rotation matrix to Tait-Bryan angles.

axisangle2tbxyz(axis, angle)

Convert axis and angle to tait bryan angles

tbxyz2matrix(angles)

Convert tait bryan angles to a single passive rotation matrix.

tbzyx2matrix(angles)

Convert Tait-Bryan angles to a single passive rotation matrix.

matrix_from(v_from, v_to)

Returns the rotation matrix that rotates v_from to parallel to

_rodrigues_anti_parallel(v_from, v_to)

v_from = vector FROM

are_parallel(vector_1, vector_2[, tolerance])

Check if vector vector_1 is parallel to vector vector_2 down to

are_anti_parallel(vector_1, vector_2[, tolerance])

Check if vector vector_1 is parallel to vector vector_2 down to

reverse(angles)

Invert the rotation represented by these angles.

two_fold_orientation(v1, v2, e1, e2)

matrix_from will align one vector with another, but there are

rad2deg(rad)

Convert rad in radians into degrees

deg2rad(deg)

Convert deg in degrees into radians

grad2rad(gradians)

Convert rad in gradians into radians

tbxyz2axisangle(rv)

Tait-Bryan x-y-z rotation to axis-angle representation

matrix2axisangle(matrix)

Convert 3x3 transformation matrix to axis angle representation

axisangle2matrix(axis, angle)

Convert axis angle to transformation matrix

matrix2tbxyz(matrix)

Convert rotation matrix to Tait-Bryan angles.

axisangle2tbxyz(axis, angle)

Convert axis and angle to tait bryan angles

tbxyz2matrix(angles)

Convert tait bryan angles to a single passive rotation matrix.

tbzyx2matrix(angles)

Convert Tait-Bryan angles to a single passive rotation matrix.

matrix_from(v_from, v_to)

Returns the rotation matrix that rotates v_from to parallel to

_rodrigues_anti_parallel(v_from, v_to)

v_from = vector FROM

are_parallel(vector_1, vector_2[, tolerance])

Check if vector vector_1 is parallel to vector vector_2 down to

are_anti_parallel(vector_1, vector_2[, tolerance])

Check if vector vector_1 is parallel to vector vector_2 down to

reverse(angles)

Invert the rotation represented by these angles.

two_fold_orientation(v1, v2, e1, e2)

matrix_from will align one vector with another, but there are

_cubeNet(vecList)

_cubeNet(vecList)

createTessellatedSolid(name, polygons, reg)

Args:

rad2deg(rad)

Convert rad in radians into degrees

deg2rad(deg)

Convert deg in degrees into radians

grad2rad(gradians)

Convert rad in gradians into radians

tbxyz2axisangle(rv)

Tait-Bryan x-y-z rotation to axis-angle representation

matrix2axisangle(matrix)

Convert 3x3 transformation matrix to axis angle representation

axisangle2matrix(axis, angle)

Convert axis angle to transformation matrix

matrix2tbxyz(matrix)

Convert rotation matrix to Tait-Bryan angles.

axisangle2tbxyz(axis, angle)

Convert axis and angle to tait bryan angles

tbxyz2matrix(angles)

Convert tait bryan angles to a single passive rotation matrix.

tbzyx2matrix(angles)

Convert Tait-Bryan angles to a single passive rotation matrix.

matrix_from(v_from, v_to)

Returns the rotation matrix that rotates v_from to parallel to

_rodrigues_anti_parallel(v_from, v_to)

v_from = vector FROM

are_parallel(vector_1, vector_2[, tolerance])

Check if vector vector_1 is parallel to vector vector_2 down to

are_anti_parallel(vector_1, vector_2[, tolerance])

Check if vector vector_1 is parallel to vector vector_2 down to

reverse(angles)

Invert the rotation represented by these angles.

two_fold_orientation(v1, v2, e1, e2)

matrix_from will align one vector with another, but there are

Package Contents

class pyg4ometry.geant4.solid.TwoVector(xIn, yIn)
x
y
Rotated(angle)
__repr__()
__getitem__(index)
__add__(other)
__sub__(other)
__mul__(other)
__rmul__(other)
__truediv__(other)
__abs__()
dot(other)
cross(other)
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Plane(name, normal, dist, zlength=10000)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a infinite plane. Should not be used to construct geant4 geometry.

Parameters:
  • name (str) – of object in registry

  • normal (tuple) – normal [x,y,z]

  • dist (float) – distance from origin to plane

  • zlength (float) – large transverse box size to emulate infinite plane

normal
dist
pDz
mesh = None
__repr__()
pycsgmesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Wedge(name, pRMax=1000, pSPhi=0, pDPhi=1.5, halfzlength=10000, nslice=None)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a infinite wedge. Should not be used to construct geant4 geometry.

Parameters:
  • name (str) – of object in registry

  • normal (tuple) – normal [x,y,z]

  • dist (float) – distance from origin to plane

  • zlength (float) – large transverse box size to emulate infinite plane

pRMax
pSPhi
pDPhi
pDz
nslice
mesh = None
__repr__()
pycsgmesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

pyg4ometry.geant4.solid.cubeNet(vecList)
class pyg4ometry.geant4.solid.Box(name, pX, pY, pZ, registry, lunit='mm', addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a box. Note the lengths are full lengths and not half lengths as in Geant4

Parameters:
lunit
dependents = []
varNames = ['pX', 'pY', 'pZ']
varUnits = ['lunit', 'lunit', 'lunit']
__repr__()
__str__()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Tubs(name, pRMin, pRMax, pDz, pSPhi, pDPhi, registry, lunit='mm', aunit='rad', nslice=None, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a cylindrical section.

Parameters:
lunit
aunit
dependents = []
varNames = ['pRMin', 'pRMax', 'pDz', 'pSPhi', 'pDPhi', 'nslice']
varUnits = ['lunit', 'lunit', 'lunit', 'aunit', 'aunit', None]
__repr__()
__str__()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.CutTubs(name, pRMin, pRMax, pDz, pSPhi, pDPhi, pLowNorm, pHighNorm, registry, lunit='mm', aunit='rad', nslice=None, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a cylindrical section with end face cuts. Note pLowNorm and pHighNorm can be lists of floats, Constants, Quantities or Variables.

Parameters:
lunit
aunit
dependents = []
varNames = ['pRMin', 'pRMax', 'pDz', 'pSPhi', 'pDPhi', 'pLowNorm', 'pHighNorm', 'nslice']
varUnits = ['lunit', 'lunit', 'lunit', 'aunit', 'aunit', 'lunit', 'lunit', None]
__repr__()
__str__()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Sphere(name, pRmin, pRmax, pSPhi, pDPhi, pSTheta, pDTheta, registry, lunit='mm', aunit='rad', nslice=None, nstack=None, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a section of a spherical shell.

Parameters:
pRmin
pRmax
pSPhi
pDPhi
pSTheta
pDTheta
nslice
nstack
lunit
aunit
dependents = []
varNames = ['pRmin', 'pRmax', 'pSPhi', 'pDPhi', 'pSTheta', 'pDTheta']
varUnits = ['lunit', 'lunit', 'aunit', 'aunit', 'aunit', 'aunit']
checkParameters()
__repr__()
__str__()
mesh()

working off 0 < phi < 2pi 0 < theta < pi

class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Cons(name, pRmin1, pRmax1, pRmin2, pRmax2, pDz, pSPhi, pDPhi, registry, lunit='mm', aunit='rad', nslice=None, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a conical section.

Parameters:
pRmin1
pRmax1
pRmin2
pRmax2
pDz
pSPhi
pDPhi
nslice
lunit
aunit
dependents = []
varNames = ['pRmin1', 'pRmin2', 'pRmax1', 'pRmax2', 'pDz', 'pSPhi', 'pDPhi', 'nslice']
varUnits = ['lunit', 'lunit', 'lunit', 'lunit', 'lunit', 'aunit', 'aunit', None]
checkParameters()
__repr__()
__str__()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Ellipsoid(name, pxSemiAxis, pySemiAxis, pzSemiAxis, pzBottomCut, pzTopCut, registry, lunit='mm', nslice=None, nstack=None, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs an ellipsoid optinoally cut by planes perpendicular to the z-axis.

Parameters:
pxSemiAxis
pySemiAxis
pzSemiAxis
pzBottomCut
pzTopCut
lunit
nslice
nstack
dependents = []
varNames = ['pxSemiAxis', 'pySemiAxis', 'pzSemiAxis', 'pzBottomCut', 'pzTopCut']
varUnits = ['lunit', 'lunit', 'lunit', 'lunit', 'lunit']
__repr__()
__str__()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Trd(name, pDx1, pDx2, pDy1, pDy2, pDz, registry, lunit='mm', addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a trapezoid.

Parameters:
pX1
pX2
pY1
pY2
pZ
lunit
dependents = []
varNames = ['pX1', 'pX2', 'pY1', 'pY2', 'pZ']
varUnits = ['lunit', 'lunit', 'lunit', 'lunit', 'lunit']
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Torus(name, pRmin, pRmax, pRtor, pSPhi, pDPhi, registry, lunit='mm', aunit='rad', nslice=None, nstack=None, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a torus.

Parameters:
pRmin
pRmax
pRtor
pSPhi
pDPhi
nslice
nstack
lunit
aunit
dependents = []
varNames = ['pRmin', 'pRmax', 'pRtor', 'pSPhi', 'pDPhi', 'nslice', 'nstack']
varUnits = ['lunit', 'lunit', 'lunit', 'aunit', 'aunit', None, None]
__repr__()
__str__()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid._GenericPolyhedra(name, pSPhi, pDPhi, numSide, pR, pZ, registry, lunit='mm', aunit='rad', addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a solid of rotation using an arbitrary 2D surface defined by a series of (r,z) coordinates.

Parameters:
pSPhi
pDPhi
numSide
pR
pZ
lunit
aunit
varNames = ['pSPhi', 'pDPhi', 'numSide', 'pR', 'pZ']
varUnits = ['aunit', 'aunit', None, 'lunit', 'lunit']
dependents = []
__repr__()
__str__()
checkParameters()
mesh()
class pyg4ometry.geant4.solid.Polycone(name, pSPhi, pDPhi, pZpl, pRMin, pRMax, registry, lunit='mm', aunit='rad', nslice=None, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a solid of rotation using an arbitrary 2D surface.

Parameters:

Optional registration as this solid is used as a temporary solid in Polyhedra and needn’t be always registered.

pSPhi
pDPhi
pZpl
pRMin
pRMax
lunit
aunit
nslice
dependents = []
varNames = ['pSPhi', 'pDPhi', 'pZpl', 'pRMin', 'pRMax']
varUnits = ['aunit', 'aunit', 'lunit', 'lunit', 'lunit']
__repr__()
__str__()
mesh()
class pyg4ometry.geant4.solid._GenericPolyhedra(name, pSPhi, pDPhi, numSide, pR, pZ, registry, lunit='mm', aunit='rad', addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a solid of rotation using an arbitrary 2D surface defined by a series of (r,z) coordinates.

Parameters:
pSPhi
pDPhi
numSide
pR
pZ
lunit
aunit
varNames = ['pSPhi', 'pDPhi', 'numSide', 'pR', 'pZ']
varUnits = ['aunit', 'aunit', None, 'lunit', 'lunit']
dependents = []
__repr__()
__str__()
checkParameters()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Polyhedra(name, pSPhi, pDPhi, numSide, numZPlanes, zPlane, rInner, rOuter, registry, lunit='mm', aunit='rad', addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a polyhedra.

Parameters:
pSPhi
pDPhi
numSide
numZPlanes
zPlane
rInner
rOuter
lunit
aunit
varNames = ['pSPhi', 'pDPhi', 'numSide', 'numZPlanes', 'zPlane', 'rInner', 'rOuter']
varUnits = ['aunit', 'aunit', None, None, 'lunit', 'lunit', 'lunit']
dependents = []
__repr__()
__str__()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid._Expression(name, value, registry, addRegistry=False)

Bases: ScalarBase

General expression, does not have an analogue in GDML

Parameters:
expression
__int__()
class pyg4ometry.geant4.solid.ExtrudedSolid(name, pPolygon, pZslices, registry, lunit='mm', addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Construct an extruded solid

Parameters:
  • name (str) – of solid

  • pPolygon (list of lists) – x-y coordinates of vertices for the polygon.

  • pZslices (list of lists) – z-coordinates of a slice, slice offsets in x-y and scaling

  • registry (Registry) – for storing solid

  • lunit (str) – length unit (nm,um,mm,m,km) for solid

Example: Triangular prism with 2 slices pPoligon = [[x1,y1],[x2,y2],[x3,y3]] - vertices of polygon in clockwise order zSlices = [[z1,[offsx1, offsy1],scale1],[z2,[offsx2, offsy2],scale2]]

lunit
dependents = []
varNames = ['pPolygon', 'pZslices']
varUnits = ['lunit', 'lunit']
__repr__()
__str__()
polygon_area(vertices)
evaluateParameterWithUnits(varName)
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Union(name, obj1, obj2, tra2, registry, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Union between two solids

Parameters:
  • name (str) – of solid

  • obj1 (pyg4ometry.geant4.solid) – unrotated, untranslated solid

  • obj2 (pyg4ometry.geant4.solid) – solid rotated and translated according to tra2

  • tra2 (list) – [rot,tra] = [[a,b,g],[dx,dy,dz]]

  • registry (Registry) – for storing solid

obj1
obj2
tra2
varNames = ['tra2']
varUnits = [None]
dependents = []
__repr__()
__str__()
mesh()
translation()
rotation()
object1()
object2()
pyg4ometry.geant4.solid.rad2deg(rad)

Convert rad in radians into degrees

Parameters:

rad (float) – Input in radians

Returns:

rad in degrees

Return type:

float

pyg4ometry.geant4.solid.deg2rad(deg)

Convert deg in degrees into radians

Parameters:

deg (float) – Input in degrees

Returns:

deg in radians

Return type:

float

pyg4ometry.geant4.solid.grad2rad(gradians)

Convert rad in gradians into radians

Parameters:

gradians (float) – Input in gradians

Returns:

gradians in radians

Return type:

float

pyg4ometry.geant4.solid.tbxyz2axisangle(rv)

Tait-Bryan x-y-z rotation to axis-angle representation Algorithm from http://www.sedris.org/wg8home/Documents/WG80485.pdf

For converting rotation angles to an active axis/angle pair for use in pycsg. Order of rotation: x->y->z.

Parameters:

rv (float(3)) – rotation angles

Returns:

[axis,angle]

Return type:

list(list(3),float)

pyg4ometry.geant4.solid.matrix2axisangle(matrix)

Convert 3x3 transformation matrix to axis angle representation

Parameters:

matrix (array(3,3)) – 3x3 rotation matrix array

Returns:

[axis,angle]

Return type:

list(list(3),float)

pyg4ometry.geant4.solid.axisangle2matrix(axis, angle)

Convert axis angle to transformation matrix

Parameters:
  • axis (list/array(3)) – axis for rotation

  • angle (float) – rotation angle

Returns:

transformation matrix

Return type:

array(3,3)

pyg4ometry.geant4.solid.matrix2tbxyz(matrix)

Convert rotation matrix to Tait-Bryan angles. Order of rotation is x -> y -> z.

Parameters:

matrix – active (positive angle = anti-clockwise rotation about that axis when looking at the axis) matrix.

Returns:

[x, y, z] Tait-Bryan angles in a list.

Return type:

list(3)

pyg4ometry.geant4.solid.axisangle2tbxyz(axis, angle)

Convert axis and angle to tait bryan angles

Parameters:
  • axis (list/array(3)) – axis for rotation

  • angle (float) – rotation angle

Returns:

tait bryan angles (x-y-z)

Return type:

array(3)

pyg4ometry.geant4.solid.tbxyz2matrix(angles)

Convert tait bryan angles to a single passive rotation matrix. rotation order = x -> y -> z.

Parameters:

angles – list of angles: x, y, z

Returns:

rotation matrix

Return type:

array(3,3)

pyg4ometry.geant4.solid.tbzyx2matrix(angles)

Convert Tait-Bryan angles to a single passive rotation matrix. rotation order = x -> y -> z.

Parameters:

angles – list of angles: x, y, z

Returns:

rotation matrix

Return type:

array(3,3)

pyg4ometry.geant4.solid.matrix_from(v_from, v_to)

Returns the rotation matrix that rotates v_from to parallel to v_to.

Useful for ensuring a given face points in a certain direction.

v_from and v_to should be array-like three-vectors.

pyg4ometry.geant4.solid._rodrigues_anti_parallel(v_from, v_to)

v_from = vector FROM v_to = vector TO

source: http://en.citizendium.org/wiki/Rotation_matrix#Case_that_.22from.22_and_.22to.22_vectors_are_anti-parallel

pyg4ometry.geant4.solid.are_parallel(vector_1, vector_2, tolerance=1e-10)

Check if vector vector_1 is parallel to vector vector_2 down to some tolerance.

Parameters:
  • vector_1 (array) – First input vector

  • vector_2 (array) – Second input vector

  • tolerance (float) – Tolerance for calculation

Returns:

if vectors are parallel

Return type:

bool

pyg4ometry.geant4.solid.are_anti_parallel(vector_1, vector_2, tolerance=1e-10)

Check if vector vector_1 is parallel to vector vector_2 down to some tolerance.

Parameters:
  • vector_1 (array) – First input vector

  • vector_2 (array) – Second input vector

  • tolerance (float) – Tolerance for calculation

Returns:

if vectors are antiparallel

Return type:

bool

pyg4ometry.geant4.solid.reverse(angles)

Invert the rotation represented by these angles.

pyg4ometry.geant4.solid.two_fold_orientation(v1, v2, e1, e2)

matrix_from will align one vector with another, but there are an infinite number of such matrices that align two vectors. This further contrains the rotation by introducing a second pair of vectors.

v1 start v v2 end v e1 start e e2 end v

class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Intersection(name, obj1, obj2, tra2, registry, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Intersection between two solids

Parameters:
  • name (str) – of solid

  • obj1 (pyg4ometry.geant4.solid) – unrotated, untranslated solid

  • obj2 (pyg4ometry.geant4.solid) – solid rotated and translated according to tra

  • tra2 (list) – [rot,tra] = [[a,b,g],[dx,dy,dz]]

  • registry (Registry) – for storing solid

obj1
obj2
tra2
varNames = ['tra2']
varUnits = [None]
dependents = []
__repr__()
__str__()
mesh()
translation()
rotation()
object1()
object2()
pyg4ometry.geant4.solid.rad2deg(rad)

Convert rad in radians into degrees

Parameters:

rad (float) – Input in radians

Returns:

rad in degrees

Return type:

float

pyg4ometry.geant4.solid.deg2rad(deg)

Convert deg in degrees into radians

Parameters:

deg (float) – Input in degrees

Returns:

deg in radians

Return type:

float

pyg4ometry.geant4.solid.grad2rad(gradians)

Convert rad in gradians into radians

Parameters:

gradians (float) – Input in gradians

Returns:

gradians in radians

Return type:

float

pyg4ometry.geant4.solid.tbxyz2axisangle(rv)

Tait-Bryan x-y-z rotation to axis-angle representation Algorithm from http://www.sedris.org/wg8home/Documents/WG80485.pdf

For converting rotation angles to an active axis/angle pair for use in pycsg. Order of rotation: x->y->z.

Parameters:

rv (float(3)) – rotation angles

Returns:

[axis,angle]

Return type:

list(list(3),float)

pyg4ometry.geant4.solid.matrix2axisangle(matrix)

Convert 3x3 transformation matrix to axis angle representation

Parameters:

matrix (array(3,3)) – 3x3 rotation matrix array

Returns:

[axis,angle]

Return type:

list(list(3),float)

pyg4ometry.geant4.solid.axisangle2matrix(axis, angle)

Convert axis angle to transformation matrix

Parameters:
  • axis (list/array(3)) – axis for rotation

  • angle (float) – rotation angle

Returns:

transformation matrix

Return type:

array(3,3)

pyg4ometry.geant4.solid.matrix2tbxyz(matrix)

Convert rotation matrix to Tait-Bryan angles. Order of rotation is x -> y -> z.

Parameters:

matrix – active (positive angle = anti-clockwise rotation about that axis when looking at the axis) matrix.

Returns:

[x, y, z] Tait-Bryan angles in a list.

Return type:

list(3)

pyg4ometry.geant4.solid.axisangle2tbxyz(axis, angle)

Convert axis and angle to tait bryan angles

Parameters:
  • axis (list/array(3)) – axis for rotation

  • angle (float) – rotation angle

Returns:

tait bryan angles (x-y-z)

Return type:

array(3)

pyg4ometry.geant4.solid.tbxyz2matrix(angles)

Convert tait bryan angles to a single passive rotation matrix. rotation order = x -> y -> z.

Parameters:

angles – list of angles: x, y, z

Returns:

rotation matrix

Return type:

array(3,3)

pyg4ometry.geant4.solid.tbzyx2matrix(angles)

Convert Tait-Bryan angles to a single passive rotation matrix. rotation order = x -> y -> z.

Parameters:

angles – list of angles: x, y, z

Returns:

rotation matrix

Return type:

array(3,3)

pyg4ometry.geant4.solid.matrix_from(v_from, v_to)

Returns the rotation matrix that rotates v_from to parallel to v_to.

Useful for ensuring a given face points in a certain direction.

v_from and v_to should be array-like three-vectors.

pyg4ometry.geant4.solid._rodrigues_anti_parallel(v_from, v_to)

v_from = vector FROM v_to = vector TO

source: http://en.citizendium.org/wiki/Rotation_matrix#Case_that_.22from.22_and_.22to.22_vectors_are_anti-parallel

pyg4ometry.geant4.solid.are_parallel(vector_1, vector_2, tolerance=1e-10)

Check if vector vector_1 is parallel to vector vector_2 down to some tolerance.

Parameters:
  • vector_1 (array) – First input vector

  • vector_2 (array) – Second input vector

  • tolerance (float) – Tolerance for calculation

Returns:

if vectors are parallel

Return type:

bool

pyg4ometry.geant4.solid.are_anti_parallel(vector_1, vector_2, tolerance=1e-10)

Check if vector vector_1 is parallel to vector vector_2 down to some tolerance.

Parameters:
  • vector_1 (array) – First input vector

  • vector_2 (array) – Second input vector

  • tolerance (float) – Tolerance for calculation

Returns:

if vectors are antiparallel

Return type:

bool

pyg4ometry.geant4.solid.reverse(angles)

Invert the rotation represented by these angles.

pyg4ometry.geant4.solid.two_fold_orientation(v1, v2, e1, e2)

matrix_from will align one vector with another, but there are an infinite number of such matrices that align two vectors. This further contrains the rotation by introducing a second pair of vectors.

v1 start v v2 end v e1 start e e2 end v

class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Subtraction(name, obj1, obj2, tra2, registry, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Subtraction between two solids

Parameters:
  • name (str) – of solid

  • obj1 (pyg4ometry.geant4.solid) – unrotated, untranslated solid

  • obj2 (pyg4ometry.geant4.solid) – solid rotated and translated according to tra2

  • tra2 (list) – [rot,tra] = [[a,b,g],[dx,dy,dz]]

  • registry (Registry) – for storing solid

obj1
obj2
tra2
varNames = ['tra2']
varUnits = [None]
dependents = []
__repr__()
__str__()
mesh()
translation()
rotation()
object1()
object2()
pyg4ometry.geant4.solid.rad2deg(rad)

Convert rad in radians into degrees

Parameters:

rad (float) – Input in radians

Returns:

rad in degrees

Return type:

float

pyg4ometry.geant4.solid.deg2rad(deg)

Convert deg in degrees into radians

Parameters:

deg (float) – Input in degrees

Returns:

deg in radians

Return type:

float

pyg4ometry.geant4.solid.grad2rad(gradians)

Convert rad in gradians into radians

Parameters:

gradians (float) – Input in gradians

Returns:

gradians in radians

Return type:

float

pyg4ometry.geant4.solid.tbxyz2axisangle(rv)

Tait-Bryan x-y-z rotation to axis-angle representation Algorithm from http://www.sedris.org/wg8home/Documents/WG80485.pdf

For converting rotation angles to an active axis/angle pair for use in pycsg. Order of rotation: x->y->z.

Parameters:

rv (float(3)) – rotation angles

Returns:

[axis,angle]

Return type:

list(list(3),float)

pyg4ometry.geant4.solid.matrix2axisangle(matrix)

Convert 3x3 transformation matrix to axis angle representation

Parameters:

matrix (array(3,3)) – 3x3 rotation matrix array

Returns:

[axis,angle]

Return type:

list(list(3),float)

pyg4ometry.geant4.solid.axisangle2matrix(axis, angle)

Convert axis angle to transformation matrix

Parameters:
  • axis (list/array(3)) – axis for rotation

  • angle (float) – rotation angle

Returns:

transformation matrix

Return type:

array(3,3)

pyg4ometry.geant4.solid.matrix2tbxyz(matrix)

Convert rotation matrix to Tait-Bryan angles. Order of rotation is x -> y -> z.

Parameters:

matrix – active (positive angle = anti-clockwise rotation about that axis when looking at the axis) matrix.

Returns:

[x, y, z] Tait-Bryan angles in a list.

Return type:

list(3)

pyg4ometry.geant4.solid.axisangle2tbxyz(axis, angle)

Convert axis and angle to tait bryan angles

Parameters:
  • axis (list/array(3)) – axis for rotation

  • angle (float) – rotation angle

Returns:

tait bryan angles (x-y-z)

Return type:

array(3)

pyg4ometry.geant4.solid.tbxyz2matrix(angles)

Convert tait bryan angles to a single passive rotation matrix. rotation order = x -> y -> z.

Parameters:

angles – list of angles: x, y, z

Returns:

rotation matrix

Return type:

array(3,3)

pyg4ometry.geant4.solid.tbzyx2matrix(angles)

Convert Tait-Bryan angles to a single passive rotation matrix. rotation order = x -> y -> z.

Parameters:

angles – list of angles: x, y, z

Returns:

rotation matrix

Return type:

array(3,3)

pyg4ometry.geant4.solid.matrix_from(v_from, v_to)

Returns the rotation matrix that rotates v_from to parallel to v_to.

Useful for ensuring a given face points in a certain direction.

v_from and v_to should be array-like three-vectors.

pyg4ometry.geant4.solid._rodrigues_anti_parallel(v_from, v_to)

v_from = vector FROM v_to = vector TO

source: http://en.citizendium.org/wiki/Rotation_matrix#Case_that_.22from.22_and_.22to.22_vectors_are_anti-parallel

pyg4ometry.geant4.solid.are_parallel(vector_1, vector_2, tolerance=1e-10)

Check if vector vector_1 is parallel to vector vector_2 down to some tolerance.

Parameters:
  • vector_1 (array) – First input vector

  • vector_2 (array) – Second input vector

  • tolerance (float) – Tolerance for calculation

Returns:

if vectors are parallel

Return type:

bool

pyg4ometry.geant4.solid.are_anti_parallel(vector_1, vector_2, tolerance=1e-10)

Check if vector vector_1 is parallel to vector vector_2 down to some tolerance.

Parameters:
  • vector_1 (array) – First input vector

  • vector_2 (array) – Second input vector

  • tolerance (float) – Tolerance for calculation

Returns:

if vectors are antiparallel

Return type:

bool

pyg4ometry.geant4.solid.reverse(angles)

Invert the rotation represented by these angles.

pyg4ometry.geant4.solid.two_fold_orientation(v1, v2, e1, e2)

matrix_from will align one vector with another, but there are an infinite number of such matrices that align two vectors. This further contrains the rotation by introducing a second pair of vectors.

v1 start v v2 end v e1 start e e2 end v

class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.OpticalSurface(name, finish, model, surf_type, value, registry, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

allowed_models = ['glisur', 'unified', 'LUT', 'DAVIS', 'dichroic']
allowed_types = ['dielectric_metal', 'dielectric_dielectric', 'dielectric_LUT', 'dielectric_LUTDAVIS',...
allowed_finishes = ['polished', 'polishedfrontpainted', 'polishedbackpainted', 'ground', 'groundfrontpainted',...
finish
model
osType
value
properties
__repr__()
__str__()
addProperty(name, matrix)

Add a property to this surface from a matrix.

Parameters:
  • name (str) – key of the surface property

  • matrix (Matrix) – matrix defining the value(s) of the property

addVecProperty(name, e, v, eunit='eV', vunit='')

Add a property from an energy and a value vector to this object.

Parameters:
  • name (str) – key of property

  • e (list or numpy.array - shape (1,)) – energy list/vector in units of eunit

  • v (list or numpy.array - shape (1,)) – value list/vector in units of vunit

  • eunit (str) – unit for the energy vector (default: eV)

  • vunit (str) – unit for the value vector (default: unitless)

addConstProperty(name, value, vunit='')

Add a constant scalar property to this object.

Parameters:
  • name (str) – key of property

  • value (str,float,int) – constant value for this property

  • vunit (str) – unit for the value vector (default: unitless)

class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

pyg4ometry.geant4.solid._cubeNet(vecList)
class pyg4ometry.geant4.solid.Para(name, pDx, pDy, pDz, pAlpha, pTheta, pPhi, registry, lunit='mm', aunit='rad', addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a parallelepiped.

Parameters:
pX
pY
pZ
pAlpha
pTheta
pPhi
lunit
aunit
dependents = []
varNames = ['pX', 'pY', 'pZ', 'pAlpha', 'pPhi', 'pTheta']
varUnits = ['lunit', 'lunit', 'lunit', 'aunit', 'aunit', 'aunit']
__repr__()
__str__()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

pyg4ometry.geant4.solid._cubeNet(vecList)
class pyg4ometry.geant4.solid.Trap(name, pDz, pTheta, pDPhi, pDy1, pDx1, pDx2, pAlp1, pDy2, pDx3, pDx4, pAlp2, registry, lunit='mm', aunit='rad', addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a general trapezoid.

Parameters:
pDz
pTheta
pDPhi
pDy1
pDx1
pDx2
pAlp1
pDy2
pDx3
pDx4
pAlp2
lunit
aunit
dependents = []
varNames = ['pDz', 'pTheta', 'pDPhi', 'pDy1', 'pDx1', 'pDx2', 'pAlp1', 'pDy2', 'pDx3', 'pDx4', 'pAlp2']
varUnits = ['lunit', 'aunit', 'aunit', 'lunit', 'lunit', 'lunit', 'aunit', 'lunit', 'lunit', 'lunit', 'aunit']
__repr__()
__str__()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Orb(name, pRMax, registry, lunit='mm', nslice=None, nstack=None, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a solid sphere.

Parameters:
  • name (str) – of the sold

  • pRMax (float, Constant, Quantity, Variable, Expression) – outer radius

  • registry (Registry) – for storing solid

  • lunit (str) – length unit (nm,um,mm,m,km) for solid

  • nslice (int) – number of phi elements for meshing

  • nstack (int) – number of theta elements for meshing

pRMax
lunit
nslice
nstack
dependents = []
varNames = ['pRMax']
varUnits = ['lunit']
__repr__()
__str__()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.EllipticalTube(name, pDx, pDy, pDz, registry, lunit='mm', nstack=None, nslice=None, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a tube of elliptical cross-section.

Parameters:
pDx
pDy
pDz
lunit
nslice
nstack
dependents = []
varNames = ['pDx', 'pDy', 'pDz']
varUnits = ['lunit', 'lunit', 'lunit']
__repr__()
__str__()
mesh()

new meshing based of Tubs meshing

class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.EllipticalCone(name, pxSemiAxis, pySemiAxis, zMax, pzTopCut, registry, lunit='mm', nslice=None, nstack=None, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a cone with elliptical cross-section and an optional cut. Both zMax and pzTopCut are half lengths extending from the centre of the cone, at z=0.

Parameters:
pxSemiAxis
pySemiAxis
zMax
pzTopCut
lunit
nslice
nstack
dependents = []
varNames = ['pxSemiAxis', 'pySemiAxis', 'zMax', 'pzTopCut']
varUnits = ['lunit', 'lunit', 'lunit', 'lunit']
__repr__()
__str__()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Paraboloid(name, pDz, pR1, pR2, registry, lunit='mm', nslice=16, nstack=8, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a paraboloid with possible cuts along the z axis.

Parameters:
pDz
pR1
pR2
lunit
nstack
nslice
dependents = []
varNames = ['pDz', 'pR1', 'pR2']
varUnits = ['lunit', 'lunit', 'lunit']
__repr__()
__str__()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Hype(name, innerRadius, outerRadius, innerStereo, outerStereo, lenZ, registry, lunit='mm', aunit='rad', nslice=None, nstack=None, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a tube with hyperbolic profile.

Parameters:
innerRadius
outerRadius
innerStereo
outerStereo
lenZ
lunit
aunit
nslice
nstack
dependents = []
varNames = ['innerRadius', 'outerRadius', 'innerStereo', 'outerStereo', 'lenZ']
varUnits = ['lunit', 'lunit', 'aunit', 'aunit', 'lunit']
__repr__()
__str__()
checkParameters()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Tet(name, anchor, p2, p3, p4, registry, lunit='mm', degeneracyFlag=False, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a tetrahedra.

Parameters:
  • name – of the solid

  • anchor (list) – point 1 (anchor point)

  • p2 (list) – point 2

  • p3 (list) – point 3

  • p4 (list) – point 4

  • registry (Registry) – for storing solid

  • lunit (str) – length unit (nm,um,mm,m,km) for solid

  • degeneracyFlag – bool, indicates degeneracy of points

anchor
p2
p3
p4
lunit
degen
dependents = []
varNames = ['anchor', 'p2', 'p3', 'p4']
varUnits = ['lunit', 'lunit', 'lunit', 'lunit']
__repr__()
__str__()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid._TwistedSolid
makeFaceFromLayer(layer, reverse=False)
makeSide(pal, pbl, pau, pbu, zl, zu, nsl)

p = point a = first b = second u = upper l = lower

meshFromLayers(layers, nsl)
class pyg4ometry.geant4.solid._TwoVector(xIn, yIn)
x
y
Rotated(angle)
__repr__()
__getitem__(index)
__add__(other)
__sub__(other)
__mul__(other)
__rmul__(other)
__truediv__(other)
__abs__()
dot(other)
cross(other)
class pyg4ometry.geant4.solid._Layer(p1, p2, p3, p4, z)
p1
p2
p3
p4
z
__getitem__(index)
Rotated(angle)
__repr__()
class pyg4ometry.geant4.solid.TwistedBox(name, twistedangle, pDx, pDy, pDz, registry, lunit='mm', aunit='rad', nstack=None, refine=0, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase, pyg4ometry.geant4.solid.TwistedSolid.TwistedSolid

Constructs a box that is twisted though angle twisted angle

Parameters:
twistedAngle
pDx
pDy
pDz
lunit
aunit
nstack
refine
dependents = []
varNames = ['twistedAngle', 'pDx', 'pDy', 'pDz']
varUnits = ['aunit', 'lunit', 'lunit', 'lunit']
__repr__()
__str__()
checkParameters()
makeLayers(p1, p2, p3, p4, pDz, theta, nstack)
mesh_old()
makeLayerEdge(pDx, pDy, pTwistedAngle=0, nx=20, ny=20)
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid._TwistedSolid
makeFaceFromLayer(layer, reverse=False)
makeSide(pal, pbl, pau, pbu, zl, zu, nsl)

p = point a = first b = second u = upper l = lower

meshFromLayers(layers, nsl)
class pyg4ometry.geant4.solid._TwoVector(xIn, yIn)
x
y
Rotated(angle)
__repr__()
__getitem__(index)
__add__(other)
__sub__(other)
__mul__(other)
__rmul__(other)
__truediv__(other)
__abs__()
dot(other)
cross(other)
class pyg4ometry.geant4.solid._Layer(p1, p2, p3, p4, z)
p1
p2
p3
p4
z
__getitem__(index)
Rotated(angle)
__repr__()
class pyg4ometry.geant4.solid.TwistedTrap(name, twistedAngle, pDz, pTheta, pDPhi, pDy1, pDx1, pDx2, pDy2, pDx3, pDx4, pAlp, registry, lunit='mm', aunit='rad', nstack=None, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase, pyg4ometry.geant4.solid.TwistedSolid.TwistedSolid

Constructs a general trapezoid with a twist around one axis.

Parameters:
twistedAngle
pDz
pTheta
pDPhi
pDy1
pDx1
pDx2
pDy2
pDx3
pDx4
pAlp
lunit
aunit
nstack
dependents = []
varNames = ['twistedAngle', 'pDz', 'pTheta', 'pDPhi', 'pDy1', 'pDx1', 'pDx2', 'pDy2', 'pDx3', 'pDx4', 'pAlp']
varUnits = ['aunit', 'lunit', 'aunit', 'aunit', 'lunit', 'lunit', 'lunit', 'lunit', 'lunit', 'lunit', 'aunit']
checkParameters()
__repr__()
__str__()
makeLayers(pl1, pl2, pl3, pl4, pu1, pu2, pu3, pu4, pDz, twist, theta, nsl)
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid._TwoVector(xIn, yIn)
x
y
Rotated(angle)
__repr__()
__getitem__(index)
__add__(other)
__sub__(other)
__mul__(other)
__rmul__(other)
__truediv__(other)
__abs__()
dot(other)
cross(other)
class pyg4ometry.geant4.solid._Layer(p1, p2, p3, p4, z)
p1
p2
p3
p4
z
__getitem__(index)
Rotated(angle)
__repr__()
class pyg4ometry.geant4.solid._TwistedSolid
makeFaceFromLayer(layer, reverse=False)
makeSide(pal, pbl, pau, pbu, zl, zu, nsl)

p = point a = first b = second u = upper l = lower

meshFromLayers(layers, nsl)
class pyg4ometry.geant4.solid.TwistedTrd(name, twistedangle, pDx1, pDx2, pDy1, pDy2, pDz, registry, lunit='mm', aunit='rad', nstack=None, refine=0, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase, pyg4ometry.geant4.solid.TwistedSolid.TwistedSolid

Constructs a twisted general trapezoid.

Parameters:
twistedAngle
pDx1
pDx2
pDy1
pDy2
pDz
lunit
aunit
nstack
refine
dependents = []
varNames = ['twistedAngle', 'pDx1', 'pDx2', 'pDy1', 'pDy2', 'pDz']
varUnits = ['aunit', 'lunit', 'lunit', 'lunit', 'lunit', 'lunit']
__repr__()
__str__()
checkParameters()
makeLayers(pl1, pl2, pl3, pl4, pu1, pu2, pu3, pu4, pDz, theta, nsl)
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.TwistedTubs(name, endinnerrad, endouterrad, zlen, phi, twistedangle, registry, lunit='mm', aunit='rad', nslice=None, nstack=None, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Creates a twisted tube segement. Note that only 1 constructor is supprted.

Parameters:
endinnerrad
endouterrad
zlen
phi
twistedangle
lunit
aunit
nslice
nstack
dependents = []
varNames = ['endinnerrad', 'endouterrad', 'zlen', 'phi', 'twistedangle']
varUnits = ['lunit', 'lunit', 'lunit', 'aunit', 'aunit']
__repr__()
__str__()
makeLayers(verts_bot, verts_top)
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid._GenericPolyhedra(name, pSPhi, pDPhi, numSide, pR, pZ, registry, lunit='mm', aunit='rad', addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a solid of rotation using an arbitrary 2D surface defined by a series of (r,z) coordinates.

Parameters:
pSPhi
pDPhi
numSide
pR
pZ
lunit
aunit
varNames = ['pSPhi', 'pDPhi', 'numSide', 'pR', 'pZ']
varUnits = ['aunit', 'aunit', None, 'lunit', 'lunit']
dependents = []
__repr__()
__str__()
checkParameters()
mesh()
class pyg4ometry.geant4.solid.GenericPolycone(name, pSPhi, pDPhi, pR, pZ, registry, lunit='mm', aunit='rad', nslice=None, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a solid of rotation using an arbitrary 2D surface defined by a series of (r,z) coordinates.

Parameters:
pSPhi
pDPhi
pR
pZ
lunit
aunit
nslice
varNames = ['pSPhi', 'pDPhi', 'pR', 'pZ']
varUnits = ['aunit', 'aunit', 'lunit', 'lunit']
dependents = []
__repr__()
__str__()
checkParameters()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.GenericPolyhedra(name, pSPhi, pDPhi, numSide, pR, pZ, registry, lunit='mm', aunit='rad', addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a solid of rotation using an arbitrary 2D surface defined by a series of (r,z) coordinates.

Parameters:
pSPhi
pDPhi
numSide
pR
pZ
lunit
aunit
varNames = ['pSPhi', 'pDPhi', 'numSide', 'pR', 'pZ']
varUnits = ['aunit', 'aunit', None, 'lunit', 'lunit']
dependents = []
__repr__()
__str__()
checkParameters()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.GenericTrap(name, v1x, v1y, v2x, v2y, v3x, v3y, v4x, v4y, v5x, v5y, v6x, v6y, v7x, v7y, v8x, v8y, dz, registry, nstack=20, lunit='mm', addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs an arbitrary trapezoid using two quadrilaterals sitting on two parallel planes. Vertices 1-4 define the quadrilateral at -dz and vertices 5-8 define the quadrilateral at +dz. This solid is called Arb8 in GDML notation.

Parameters:
  • name – string, name of the volume

  • v1x – vertex 1 x position

  • v1y – vertex 1 y position

  • v2x – vertex 2 x position

  • v2y – vertex 2 y position

  • v3x – vertex 3 x position

  • v3y – vertex 3 y position

  • v4x – vertex 4 x position

  • v4y – vertex 4 y position

  • v5x – vertex 5 x position

  • v5y – vertex 5 y position

  • v6x – vertex 6 x position

  • v6y – vertex 6 y position

  • v7x – vertex 7 x position

  • v7y – vertex 7 y position

  • v8x – vertex 8 x position

  • v8y – vertex 8 y position

  • dz – half length along z

  • registry (Registry) – for storing solid

dz
lunit
nstack
vars_in
dependents = []
varNames = ['v1x', 'v1y', 'v2x', 'v2y', 'v3x', 'v3y', 'v4x', 'v4y', 'v5x', 'v5y', 'v6x', 'v6y', 'v7x',...
varUnits
__repr__()
__str__()
polygon_area(vertices)
get_vertex(index)
makeLayers(verts_bot, verts_top)
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.TessellatedSolid(name, meshTess, registry, meshtype=MeshType.Freecad, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a tessellated solid

Parameters:
  • name (str) – of solid

  • mesh (Freecad, Gdml or Stl) – mesh

  • registry (Registry) – for storing solid

  • meshtype (MeshType.Freecad) – type of mesh

class MeshType
Freecad = 1
Gdml = 2
Stl = 3
meshtype
dependents = []
varNames = []
varUnits = []
__repr__()
__str__()
addVertex(vertex)
addTriangle(triangle)
removeDuplicateVertices()
mesh()
pyg4ometry.geant4.solid.createTessellatedSolid(name, polygons, reg)
Args:

name: Name of the tessallated solid polygons: list of polygons (list of points given in clockwise order). All polygons should have the same number of points. reg: registry

Returns: TessellatedSolid

class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.MultiUnion(name, objects, transformations, registry, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Union between two or more solids.

Parameters:
  • name (str) – of solid

  • objects – unrotated, untranslated solid objects to form union

  • transformations – [[rot1,tra1],[rot2,tra2], [rot3,tra3] .. ] or [[[a,b,g],[dx,dy,dz]], [[a,b,g],[dx,dy,dz]], [[a,b,g],[dx,dy,dz]], …]

  • registry (Registry) – for storing solid

  • addRegistry – Add solid to registry

objects
transformations
varNames = ['transformations']
varUnits = [None]
dependents = []
__repr__()
__str__()
mesh()
pyg4ometry.geant4.solid.rad2deg(rad)

Convert rad in radians into degrees

Parameters:

rad (float) – Input in radians

Returns:

rad in degrees

Return type:

float

pyg4ometry.geant4.solid.deg2rad(deg)

Convert deg in degrees into radians

Parameters:

deg (float) – Input in degrees

Returns:

deg in radians

Return type:

float

pyg4ometry.geant4.solid.grad2rad(gradians)

Convert rad in gradians into radians

Parameters:

gradians (float) – Input in gradians

Returns:

gradians in radians

Return type:

float

pyg4ometry.geant4.solid.tbxyz2axisangle(rv)

Tait-Bryan x-y-z rotation to axis-angle representation Algorithm from http://www.sedris.org/wg8home/Documents/WG80485.pdf

For converting rotation angles to an active axis/angle pair for use in pycsg. Order of rotation: x->y->z.

Parameters:

rv (float(3)) – rotation angles

Returns:

[axis,angle]

Return type:

list(list(3),float)

pyg4ometry.geant4.solid.matrix2axisangle(matrix)

Convert 3x3 transformation matrix to axis angle representation

Parameters:

matrix (array(3,3)) – 3x3 rotation matrix array

Returns:

[axis,angle]

Return type:

list(list(3),float)

pyg4ometry.geant4.solid.axisangle2matrix(axis, angle)

Convert axis angle to transformation matrix

Parameters:
  • axis (list/array(3)) – axis for rotation

  • angle (float) – rotation angle

Returns:

transformation matrix

Return type:

array(3,3)

pyg4ometry.geant4.solid.matrix2tbxyz(matrix)

Convert rotation matrix to Tait-Bryan angles. Order of rotation is x -> y -> z.

Parameters:

matrix – active (positive angle = anti-clockwise rotation about that axis when looking at the axis) matrix.

Returns:

[x, y, z] Tait-Bryan angles in a list.

Return type:

list(3)

pyg4ometry.geant4.solid.axisangle2tbxyz(axis, angle)

Convert axis and angle to tait bryan angles

Parameters:
  • axis (list/array(3)) – axis for rotation

  • angle (float) – rotation angle

Returns:

tait bryan angles (x-y-z)

Return type:

array(3)

pyg4ometry.geant4.solid.tbxyz2matrix(angles)

Convert tait bryan angles to a single passive rotation matrix. rotation order = x -> y -> z.

Parameters:

angles – list of angles: x, y, z

Returns:

rotation matrix

Return type:

array(3,3)

pyg4ometry.geant4.solid.tbzyx2matrix(angles)

Convert Tait-Bryan angles to a single passive rotation matrix. rotation order = x -> y -> z.

Parameters:

angles – list of angles: x, y, z

Returns:

rotation matrix

Return type:

array(3,3)

pyg4ometry.geant4.solid.matrix_from(v_from, v_to)

Returns the rotation matrix that rotates v_from to parallel to v_to.

Useful for ensuring a given face points in a certain direction.

v_from and v_to should be array-like three-vectors.

pyg4ometry.geant4.solid._rodrigues_anti_parallel(v_from, v_to)

v_from = vector FROM v_to = vector TO

source: http://en.citizendium.org/wiki/Rotation_matrix#Case_that_.22from.22_and_.22to.22_vectors_are_anti-parallel

pyg4ometry.geant4.solid.are_parallel(vector_1, vector_2, tolerance=1e-10)

Check if vector vector_1 is parallel to vector vector_2 down to some tolerance.

Parameters:
  • vector_1 (array) – First input vector

  • vector_2 (array) – Second input vector

  • tolerance (float) – Tolerance for calculation

Returns:

if vectors are parallel

Return type:

bool

pyg4ometry.geant4.solid.are_anti_parallel(vector_1, vector_2, tolerance=1e-10)

Check if vector vector_1 is parallel to vector vector_2 down to some tolerance.

Parameters:
  • vector_1 (array) – First input vector

  • vector_2 (array) – Second input vector

  • tolerance (float) – Tolerance for calculation

Returns:

if vectors are antiparallel

Return type:

bool

pyg4ometry.geant4.solid.reverse(angles)

Invert the rotation represented by these angles.

pyg4ometry.geant4.solid.two_fold_orientation(v1, v2, e1, e2)

matrix_from will align one vector with another, but there are an infinite number of such matrices that align two vectors. This further contrains the rotation by introducing a second pair of vectors.

v1 start v v2 end v e1 start e e2 end v

class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.Scaled(name, solid, pX, pY, pZ, registry, addRegistry=True)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

Constructs a scaled sold.

Parameters:
Poram solid:

reference for scaling

solid
pX
pY
pZ
varNames = ['pX', 'pY', 'pZ']
varUnits = [None, None, None]
dependents = []
__repr__()
__str__()
mesh()
class pyg4ometry.geant4.solid._SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.

class pyg4ometry.geant4.solid.HalfSpace(name, registry=None)

Bases: pyg4ometry.geant4.solid.SolidBase.SolidBase

pgons = []
addPolygon(pgonVertex)
mesh()
class pyg4ometry.geant4.solid.SolidBase(name, type, registry=None)

Base class for all solids

property name
type
registry
evaluateParameter(obj)
evaluateParameterWithUnits(varName)
_addProperty(attribute)
_setProperty(attribute, value)
_getProperty(attribute)
_twoPiValueCheck(attribute, aunit='rad')

Raises a ValueError if the attribute is over pyg4ometry.config.twoPiComparisonTolerance over 2 x pi.

conver2Tessellated()

return a TessellatedSolid instance based on the mesh of this solid.