pyg4ometry.geant4.LogicalVolume¶
Classes¶
LogicalVolume : G4LogicalVolume |
Functions¶
|
Module Contents¶
- pyg4ometry.geant4.LogicalVolume._solid2tessellated(solid)¶
- class pyg4ometry.geant4.LogicalVolume.LogicalVolume(solid, material, name, registry=None, addRegistry=True, **kwargs)¶
LogicalVolume : G4LogicalVolume
- type = 'logical'¶
- solid¶
- name¶
- daughterVolumes = []¶
- _daughterVolumesDict¶
- bdsimObjects = []¶
- auxiliary = []¶
- registry¶
- overlapChecked = False¶
- __repr__()¶
- reMesh(recursive=False)¶
Regenerate the visualisation for this logical volume. Required if the geometry is modified and overlap checking is subsequently required or revisualisation.
- add(physicalVolume)¶
Add physical volume to this logicalVolume
- Parameters:
physicalVolume (PhysicalVolume, ReplicaVolume, ParameterisedVolume, DivisionVolume) – physical volume to add
- addBDSIMObject(bdsimobject)¶
- _getPhysicalDaughterMesh(pv, warn=True)¶
Return a (cloned from the lv) mesh of a given pv with rotation,scale, translation evaluated.
- cullDaughtersOutsideSolid(solid, rotation=None, position=None)¶
Given a solid with a placement rotation and position inside this logical volume, remove (cull) any daughters that would not lie entirely within it. The rotation and position are applied to the solid w.r.t. the frame of this logical volume.
- transformDaughters(rotation=(0, 0, 0), position=(0, 0, 0), runit='rad', punit='mm')¶
Transform the daugter volumes (without clipping)
- Parameters:
rotation (list(float, float, float) or None - 3 values in radians) – Tait-Bryan angles for rotation of the solid w.r.t. this lv
position (list(float, float, float) or None - 3 values in mm) – translation of the solid w.r.t. this lv
runit (str) – angular unit for rotation (rad,deg)
punit (str) – length unit for position (m,mm,km)
- replaceSolid(newSolid, rotation=(0, 0, 0), position=(0, 0, 0), runit='rad', punit='mm')¶
Replace the outer solid with optional position and rotation
- Parameters:
newSolid (pyg4ometry.geant4.solid) – object to clip the geometry to
rotation (list(float, float, float) or None - 3 values in radians) – Tait-Bryan angles for rotation of the solid w.r.t. this lv
position (list(float, float, float) or None - 3 values in mm) – translation of the solid w.r.t. this lv
runit (str) – angular unit for rotation (rad,deg)
punit (str) – length unit for position (m,mm,km)
- clipGeometry(newSolid, rotation=(0, 0, 0), position=(0, 0, 0), runit='rad', punit='mm', replace=False, depth=0, solidUsageCount=_defaultdict(int), lvUsageCount=_defaultdict(int))¶
Clip the geometry to newSolid, placed with rotation and position.
- Parameters:
newSolid (pyg4ometry.geant4.solid) – object to clip the geometry to
rotation (list(float, float, float) or None - 3 values in radians) – Tait-Bryan angles for rotation of the solid w.r.t. this lv
position (list(float, float, float) or None - 3 values in mm) – translation of the solid w.r.t. this lv
runit (str) – angular unit for rotation (rad,deg)
punit (str) – length unit for position (m,mm,km)
replace (bool) – replace the outer solid or not
depth (int) – recursion depth (DO NOT USE)
solidUsageCount (defaultdict) – solid name dictionary for replacement recursion (DO NOT USE)
lvUsageCount (defaultdict) – lv name dictionary for replacement recursion (DO NOT USE)
- changeSolidAndTrimGeometry(newSolid, rotation=(0, 0, 0), position=(0, 0, 0), runit='rad', punit='mm')¶
Change the solid of this logical volume, remove any daughters that will lie outside it, and form new Boolean intersection solids for any daughters that cross the boundary (intersect) it. The rotation and translation are with respect to the original frame and all daughters will now be replaced with respect to the new frame. Therefore, that same rotation and translation should be use to re-place this logical volume if desired. The default is none though, so the frame would nominally remain the same.
- Parameters:
newSolid (any of pyg4ometry.geant4.solid) – new solid to use for this logical volume
rotation (list(float, float, float) or None - 3 values in radians) – Tait-Bryan rotation for the new solid w.r.t. old frame (i.e. current lv)
position (list(float, float, float) or None - 3 values in mm) – translation for the new solid w.r.t. old frame (i.e. current lv)
- checkOverlaps(recursive=False, coplanar=False, debugIO=False, printOut=True, nOverlapsDetected=[0])¶
Check based on the meshes in each logical volume if there are any geometrical overlaps. By default, overlaps are checked between daughter volumes and with the mother volume itself (protrusion). Coplanar overlaps may also be checked (default on).
Print out will be given for any overlaps detected and the visualiser will show the colour coded overlaps.
- Parameters:
recursive – bool - Whether to descend into the daughter volumes and check their contents also.
coplanar – bool - Whether to check for coplanar overlaps
debugIO – bool - Print out for every check made
printOut – bool - (internal) Whether to print out a summary of N overlaps detected
nOverlapsDetected – [int] - (internal) counter for recursion - ignore
- setSolid(solid)¶
Set (replace) the outer solid. Does not change the placement of the daughters in the volume. If there is a transformation then use replaceSolid
- makeSolidTessellated()¶
Make solid tesselated. Sometimes useful when a boolean cannot be visualised in Geant4
- addAuxiliaryInfo(auxiliary)¶
Add auxilary information to logical volume :param auxiliary: auxiliary information for the logical volume :type auxiliary: tuple or list
- extent(includeBoundingSolid=False)¶
Compute the axis aligned extent of the logical volume.
- Parameters:
includeBoundingSolid (bool) – Include the bounding solid or not
- depth(depth=0)¶
Depth for LV-PV tree
- clipSolid(lengthSafety=1e-06)¶
Assuming the solid of this LV is a Box, reduce its dimensions and re-placement all daughters to reduce the box to the minimum (axis-aligned) bounding box. This updates the dimensions of the box and the translation of each daughter physical volume.
- Parameters:
lengthSafety (float) – safety length
- makeLogicalPhysicalNameSets()¶
Return a set of logical names and physical names used in this logical volume and any daughters. This is built up recursively by checking all daughters etc.
- findLogicalByName(name)¶
Return a list of LogicalVolume instances used inside this logical volume as daughters (at any level inside) with the given name.
- Parameters:
name (str) – lv name
- makeMaterialNameSet()¶
Return a set of material names used in this logical volume and any daughters. This is built up recursively by checking all daughters etc etc.
- assemblyVolume(materialName='G4_AIR0x7f8441173ac0')¶
Return an assembly volume of this logical volume, in effect removing the solid and material of this logical volume, but retaining all of the relative daughter placements.
- makeWorldVolume(worldMaterial='G4_Galactic')¶
This will create a container box according to the extents of this logical volume: an axis-aligned bounding-box. It will be filled with the given material (predefined by name) and assigned as the world volume (outermost) of the registry according to this logical volume.
- dumpStructure(depth=0)¶