pyg4ometry.convert.fluka2Geant4

Attributes

Exceptions

NullModel

Common base class for all non-exit exceptions.

Functions

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

Convert a FLUKA registry to a Geant4 Registry.

_flukaRegistryToG4Registry(flukareg, regions, ...)

Convert a transformed fluka registry to a geant4 registry.

_filteredRegions(flukareg, regions)

_makeWorldVolume(dimensions, material, g4registry)

Make a world solid and logical volume with the given dimensions,

_makeLengthSafetyRegistry(flukareg, regions)

Make a new registry from a registry with length safety applied

_getRegionZoneAABBs(flukareg, regions, quadricRegionAABBs)

Loop over the regions, and for each region, get all the aabbs

_filterRegistryNullZones(flukareg, regionZoneAABBs)

_filterRegionNullZones(region, aabbs)

_filterNullAABBs(regionZoneAABBs)

_makeBodyMinimumAABBMap(flukareg, regionZoneAABBs, regions)

_getMaximalOfTwoAABBs(aabb1, aabb2)

Given two aabbs, returns the total aabb that tightly bounds

_filterBlackHoleRegions(flukareg, regions)

Returns a new FlukaRegistry instance with all regions with

_getOverlappingAABBs(aabb, aabbs)

_getContentsOfLatticeCells(flukaregistry, regionAABBs)

_getTransformedCellRegionAABB(lattice)

_isTransformedCellRegionIntersectingWithRegion(region, ...)

_checkQuadricRegionAABBs(flukareg, quadricRegionAABBs)

Loop over the regions looking for quadrics and for any quadrics we

_getWorldDimensions(worldDimensions)

Get world dimensinos and if None then return the global constant

_getSelectedRegions(flukareg, regions, omitRegions)

_filterHalfSpaces(flukareg, regionZoneAABBs)

Filter redundant half spaces from the regions of the

_distanceFromPointToPlane(normal, pointOnPlane, point)

_convertLatticeCells(greg, flukareg, wlv, ...)

_makeUniqueQuadricRegions(flukareg, quadricRegionAABBs)

_makeQuadricRegionBodyAABBMap(flukareg, quadricRegionAABBs)

Given a map of regions featuring quadrics to their aabbs, we

_getMaximalQuadricRegionAABBs(freg, quadricRegionAABBs)

_regionZoneAABBsToRegionAABBs(regionZoneAABBs)

Given a map of region names to zone aabbs, return a map of

_copyStructureToNewFlukaRegistry(freg, fregtarget)

Module Contents

pyg4ometry.convert.fluka2Geant4.logger
pyg4ometry.convert.fluka2Geant4.WORLD_DIMENSIONS = [10000, 10000, 10000]
exception pyg4ometry.convert.fluka2Geant4.NullModel

Bases: Exception

Common base class for all non-exit exceptions.

pyg4ometry.convert.fluka2Geant4.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.

pyg4ometry.convert.fluka2Geant4._flukaRegistryToG4Registry(flukareg, regions, worldinfo, aabbinfo)

Convert a transformed fluka registry to a geant4 registry.

pyg4ometry.convert.fluka2Geant4._filteredRegions(flukareg, regions)
pyg4ometry.convert.fluka2Geant4._makeWorldVolume(dimensions, material, g4registry)

Make a world solid and logical volume with the given dimensions, material, and size, and add it to the geant4 Registry provided

Parameters:

dimensions – list of 3 elements providing the dimensions in [x, y, z]

of the world box. :type dimension: list :param material: The name of the material to be used for the world volume. :type material: str :param g4registry: The geant4 Registry instance this world solid and logical volume is to be added to.

pyg4ometry.convert.fluka2Geant4._makeLengthSafetyRegistry(flukareg, regions)

Make a new registry from a registry with length safety applied to the zones and regions within.

Parameters:

flukareg – The FlukaRegistry from which the new registry

with length safety applied should be built. :type flukareg: FlukaRegistry :param regions: The names of the regions that are to be converted.

pyg4ometry.convert.fluka2Geant4._getRegionZoneAABBs(flukareg, regions, quadricRegionAABBs)

Loop over the regions, and for each region, get all the aabbs of the zones belonging to that region. Don’t do this for quadricRegionAABBs, instead, just continue to use the aabb provided by the user.

pyg4ometry.convert.fluka2Geant4._filterRegistryNullZones(flukareg, regionZoneAABBs)
pyg4ometry.convert.fluka2Geant4._filterRegionNullZones(region, aabbs)
pyg4ometry.convert.fluka2Geant4._filterNullAABBs(regionZoneAABBs)
pyg4ometry.convert.fluka2Geant4._makeBodyMinimumAABBMap(flukareg, regionZoneAABBs, regions)
pyg4ometry.convert.fluka2Geant4._getMaximalOfTwoAABBs(aabb1, aabb2)

Given two aabbs, returns the total aabb that tightly bounds the two given aabbs.

Parameters:
  • aabb1 (AABB) – The first aabb.

  • aabb2 (AABB) – The second aabb

pyg4ometry.convert.fluka2Geant4._filterBlackHoleRegions(flukareg, regions)

Returns a new FlukaRegistry instance with all regions with BLKCHOLE material removed.

Parameters:

flukareg – The FlukaRegistry instance from which the new

FlukaRegistry instance sans BLCKHOLE regions is built. :type flukareg: FlukaRegistry :param regions: The names of the regions to be copied to the new instance. :type regions: list

pyg4ometry.convert.fluka2Geant4._getOverlappingAABBs(aabb, aabbs)
pyg4ometry.convert.fluka2Geant4._getContentsOfLatticeCells(flukaregistry, regionAABBs)
pyg4ometry.convert.fluka2Geant4._getTransformedCellRegionAABB(lattice)
pyg4ometry.convert.fluka2Geant4._isTransformedCellRegionIntersectingWithRegion(region, lattice)
pyg4ometry.convert.fluka2Geant4._checkQuadricRegionAABBs(flukareg, quadricRegionAABBs)

Loop over the regions looking for quadrics and for any quadrics we find, make sure that the region has a defined region aabb in quadricRegionAABBs.

pyg4ometry.convert.fluka2Geant4._getWorldDimensions(worldDimensions)

Get world dimensinos and if None then return the global constant WORLD_DIMENSIONS.

pyg4ometry.convert.fluka2Geant4._getSelectedRegions(flukareg, regions, omitRegions)
pyg4ometry.convert.fluka2Geant4._filterHalfSpaces(flukareg, regionZoneAABBs)

Filter redundant half spaces from the regions of the FlukaRegistry instance. AABBs is a dictionary of region names to region aabbs.

pyg4ometry.convert.fluka2Geant4._distanceFromPointToPlane(normal, pointOnPlane, point)
pyg4ometry.convert.fluka2Geant4._convertLatticeCells(greg, flukareg, wlv, regionZoneAABBs, regionNamesToLVs)
pyg4ometry.convert.fluka2Geant4._makeUniqueQuadricRegions(flukareg, quadricRegionAABBs)
pyg4ometry.convert.fluka2Geant4._makeQuadricRegionBodyAABBMap(flukareg, quadricRegionAABBs)

Given a map of regions featuring quadrics to their aabbs, we loop over the bodies of the region and set their aabbs equal to the region aabb.

pyg4ometry.convert.fluka2Geant4._getMaximalQuadricRegionAABBs(freg, quadricRegionAABBs)
pyg4ometry.convert.fluka2Geant4._regionZoneAABBsToRegionAABBs(regionZoneAABBs)

Given a map of region names to zone aabbs, return a map of region names to a total region aabb.

pyg4ometry.convert.fluka2Geant4._copyStructureToNewFlukaRegistry(freg, fregtarget)