pygeomscarf package

Submodules

pygeomscarf.cavern module

pygeomscarf.cavern.construct_cavern(inner_radius, outer_radius, reg, mat, world_lv)

Construct the cavern geometry and place it in the world volume.

Warning

The cavern implementation is very simplified only consisting of an upper hemisphere representing the hill and a lower cylinder representing the ground.

Parameters:
  • inner_radius (float) – The inner radius of the upper hemisphere in mm.

  • outer_radius – The outer radius of the upper hemisphere in mm.

  • reg (Registry) – The registry to use for the geometry construction.

  • world_lv (LogicalVolume) – The world logical volume to place the cavern in.

  • mat (Material)

Return type:

Registry

pygeomscarf.cli module

pygeomscarf.cli._config_or_cli_arg(args, config, name, default)

Fallback of cli args, to config file, and to default value (in this order).

Parameters:
Return type:

None

pygeomscarf.cli._parse_cli_args(argv=None)
Parameters:

argv (list[str] | None)

Return type:

tuple[Namespace, dict]

pygeomscarf.cli.dump_gdml_cli(argv=None)
Parameters:

argv (list[str] | None)

Return type:

None

pygeomscarf.core module

pygeomscarf.core.construct(config=None, public_geometry=False, plot_cryostat=False, extra_detectors=None)

Construct the SCARF geometry and return the registry containing the world volume.

Parameters:
  • config (str | dict | None) –

    configuration dictionary (or file containing it) defining relevant parameters of the geometry.

    This should have the following structure:

    hpges:
        - name: "V09999A
            pplus_pos_from_lar_center: 120
        - name: "V09999B
            pplus_pos_from_lar_center: 230
    
    source:
        pos_from_lar_center: 150
    
    fiber_shroud:
        mode: "simplified"  # or "detailed"
        height_in_mm: 1200
        radius_in_mm: 200
        center_pos_from_lar_center: 120
    cavern:
        inner_radius_in_mm: 5000
        outer_radius_in_mm: 12000
    
    • If the hpges key is present, the geometry will include HPGe detectors, which will be placed at the specified positions (in mm) from the bottom of the cryostat.

    • The source key can be used to place a source at a specified position from the bottom of the cryostat.

    • Similarly, the fiber_shroud key can be used to include a fiber shroud in the geometry, with the specified mode (e.g. “simplified” or “detailed”), height, radius and position from the bottom of the cryostat.

  • plot_cryostat (bool) – if true, the cryostat will be plotted.

  • public_geometry (bool) – if true, uses the public geometry metadata instead of the LEGEND-internal legend-metadata.

  • extra_detectors (TextDB | None) – If provided, should be a TextDB object containing extra detector metadata, for example detectors not from LEGEND.

Return type:

Registry

pygeomscarf.cryo module

Construction of the SCARF cryostat and LAr.

The geometry is based on the CAD model of the SCARF cryostat, but is simplified to be a generic polycone.

  • The inner cryostat is almost cylindrical, with a slight tapering to account for the change in thickness.

  • The LAr volume fills the inner cryostat, and there is a gap between the LAr and the inner cryostat that is filled with gaseous argon.

  • The outer cryostat is also a simple cylinder, and there is a lead shield surrounding the entire cryostat.

The relevant dimensions are defined in the configuration file, which should have the following format:

inner:
    radius_in_mm: ...
    upper:
        thickness_in_mm: ...
        height_in_mm: ...
    lower:
        thickness_in_mm: ...
        height_in_mm: ...
outer:
    radius_in_mm: ...
    height_in_mm: ...
    thickness_in_mm: ...
top:
    height_in_mm: ...
    radius_in_mm: ...
gas_argon:
    height_in_mm: ...
lead:
    air_gap_in_mm: ...
    thickness_in_mm: ...
pygeomscarf.cryo._construct_polycone(name, radius, height, reg, color, material)

Construct a generic polycone and make its logical volume.

Parameters:
  • name (str)

  • radius (list)

  • height (list)

  • reg (geant4.Registry)

  • color (list)

  • material (str | geant4.material)

Return type:

geant4.LogicalVolume

pygeomscarf.cryo.build_cryostat(cryostat_meta, world_log, reg, mats, *, plot=False)

Construct the SCARF cryostat and LAr and add this to the geometry.

Warning

The geometry for the lower part of the cryostat and the lid is approximate.

Parameters:
Return type:

tuple[Registry, float, float]

pygeomscarf.cryo.cryostat_lid_profile(cryostat_meta)

Extract the profile of the cryostat lid.

The lid is a simple cylinder, so the profile is just two points.

Parameters:

cryostat_meta (AttrsDict) – The metadata containing the relevant dimensions of the cryostat, see pygeomscarf.cryo for more details.

Return type:

tuple[list, list]

pygeomscarf.cryo.gaseous_argon_profile(cryostat_meta)

Extract the profile of the gaseous argon volume.

The geometry is similar to extract_inner_cryostat_profile() but slightly shifted to account for the cryostat thickness and the LAr volume.

Parameters:

cryostat_meta (AttrsDict) – The metadata containing the relevant dimensions of the cryostat, see pygeomscarf.cryo for more details.

Return type:

list of radii, list of heights

pygeomscarf.cryo.inner_cryostat_profile(cryostat_meta)

Profile of the inner cryostat. See construct_inner_cryostat() for more details.

The geometry is constructed as a pyg4ometry.geant4.solid.genericPolycone, which is almost cylindrical with a slight tapering to account for the change in thickness.

Parameters:

cryostat_meta (AttrsDict) – The metadata containing the relevant dimensions of the cryostat, see pygeomscarf.cryo for more details.

Return type:

tuple[list, list]

Warning

The LAr must be placed as a daughter volume for this to make sense.

Return type:

list of radii, list of heights

Parameters:

cryostat_meta (AttrsDict)

pygeomscarf.cryo.lar_profile(cryostat_meta)

Extract the profile of the lar volume.

The geometry is similar to extract_inner_cryostat_profile() but slightly shifted to account for the cryostat thickness.

Parameters:

cryostat_meta (AttrsDict) – The metadata containing the relevant dimensions of the cryostat, see pygeomscarf.cryo for more details.

Return type:

list of radii, list of heights

pygeomscarf.cryo.lead_profile(cryostat_meta)

Extract the profile of the lead shield.

The lead shield is a simple cylinder, so the profile is just two points.

Parameters:

cryostat_meta (AttrsDict) – The metadata containing the relevant dimensions of the cryostat, see pygeomscarf.cryo for more details.

Return type:

tuple[list, list]

pygeomscarf.cryo.outer_cryostat_profile(cryostat_meta)

Extract the profile of the outer cryostat.

Defines the profile of the outer cryostat vessel.

Parameters:

cryostat_meta (AttrsDict) – The metadata containing the relevant dimensions of the cryostat, see pygeomscarf.cryo for more details.

Return type:

tuple[list, list]

pygeomscarf.cryo.plot_profiles(profiles)

Plot the profiles of the cryostat volumes.

Parameters:

profiles (dict) – Dictionary of profiles, where the keys are the volume names and the values are dictionaries with keys “radius”, “height”, “shift” and “kwargs” (the latter containing keyword arguments for the polygon patch).

pygeomscarf.cryo.set_steel_reflectivity(reg, cryostat_name, lar_name)

Set the reflectivity of the inner cryostat.

Warning

For now the reflectivity is set to that of copper, which should be similar.

Parameters:
  • reg (Registry) – The registry containing the logical volumes.

  • cryostat_name (str) – The name of the inner cryostat physical volume volume.

  • lar_name (str) – The name of the lar physical volume volume.

pygeomscarf.metadata module

class pygeomscarf.metadata.PublicMetadataProxy(dets)

Bases: object

Provides proxies to transparently replace legend hardware metadata with sample data.

pygeomscarf.metadata.diode_proxy(det_name, dummy_detectors)
Parameters:
Return type:

AttrsDict

pygeomscarf.source module

pygeomscarf.source.build_source(world_lv, radius, z_pos, reg, *, source_height=5, source_radius=1, material='G4_Fe')

Build the source holder and source for the SCARF geometry.

Warning

This is a very simplified source holder, which is not based on any technical drawings. It is only meant to provide the approximate source location.

Parameters:
  • world_lv (LogicalVolume) – The logical volume of the world, to place the source inside.

  • z_pos (float) – The position of the source in mm.

  • radius (float) – The radial position of the source in mm.

  • reg (Registry) – The registry to add the source to.

  • source_height (float) – The height of the source in mm.

  • source_radius (float) – The radius of the source in mm.

  • material (str)

Return type:

LogicalVolume

pygeomscarf.strings module

pygeomscarf.strings.build_fiber_shroud(mats, reg, shroud_height=1000, shroud_radius=115)

Build the fiber shroud.

Parameters:
  • shroud_height (float) – The height of the fiber shroud in mm.

  • shroud_radius (float) – The radius of the fiber shroud in mm.

  • reg (Registry) – The registry to add the fiber shroud to.

  • mats (LegendMaterialRegistry)

pygeomscarf.strings.build_individual_fiber(mats, reg, shroud_height=1000)

Build an individual fiber, with TPB coating.

Parameters:
  • shroud_height (float) – The height of the fiber shroud in mm.

  • shroud_radius – The radius of the fiber shroud in mm.

  • reg (Registry) – The registry to add the fiber shroud to.

  • core_name – The name of the fiber core physical volume.

  • mats (LegendMaterialRegistry)

pygeomscarf.strings.build_strings(lar_lv, hpges, mats, det_meta, reg, lar_height, fiber_shroud=None)

Build the strings and place them into the registry.

Parameters:
  • lar_lv (LogicalVolume) – The logical volume of the liquid argon, to place the strings inside.

  • hpges (list) –

    A mapping containing the HPGe detector information, including their names and positions.

    Should have the following structure:

    - name: "V09999A
        position_from_cryostat_bottom_in_mm: 120
    - name: "V09999B
        position_from_cryostat_bottom_in_mm: 230
    

  • mats (LegendMaterialRegistry) – The material registry to use for constructing the strings.

  • det_meta (TextDB) – The metadata containing the information on the detectors.

  • reg (Registry) – The registry to add the strings to.

  • fiber_shroud (dict | None) –

    A dictionary containing the fiber shroud information, including its mode (e.g. “simplified” or “detailed”), height, radius and position from the bottom of the cryostat. Should have the following structure:

    mode: "simplified"  # or "detailed"
    height_in_mm: 1200
    radius_in_mm: 200
    center_pos_from_cryostat_bottom_in_mm: 120
    

  • lar_height (float)

Return type:

Registry

pygeomscarf.strings.set_fiber_core_surface(tpb_name, core_name, reg)

Set the fiber core surface (to make sensitive).

This is important to allow the fiber core to act as a sensitive detector.

Parameters:
  • tpb_name (str) – The name of the TPB physical volume.

  • core_name (str) – The name of the fiber core physical volume.

  • reg (Registry) – The registry to add the optical properties to.

pygeomscarf.strings.set_germanium_reflectivity(hpge, reg, lar_name='lar')

Set the reflectivity of the germanium surfaces.

Parameters:
  • hpge (PhysicalVolume) – The physical volume of the HPGe detector, to set the reflectivity for.

  • reg (Registry) – The registry to add the reflectivity to.

  • lar_name (str) – The name of the liquid argon physical volume, to set the reflectivity with respect to.

pygeomscarf.strings.set_tpb_surface(tpb_name, lar_name, reg)

Set the tpb optical properties.

Parameters:
  • tpb_name (str) – The name of the TPB physical volume, to set the optical properties for.

  • lar_name (str) – The name of the liquid argon physical volume, to set the optical properties with respect to

  • reg (Registry) – The registry to add the optical properties to.

pygeomscarf.utils module

pygeomscarf.utils._place_pv(name, log, mother, z_pos, reg)

Place the polcyone (on-axis) into the registry.

Parameters:
pygeomscarf.utils._read_model(file, name, material, b)

Construct a logical volume for an STL mesh.

Note

This function honours the no_meshes runtime configuration, which can either be True to disable all meshes, or be a list of logical volume names to disable mesh loading.

Return type:

A geant4.LogicalVolume for the mesh or None, if loading of this mesh is disabled.

Parameters:
  • file (str)

  • name (str)

  • material (geant4.Material)

  • b (core.InstrumentationData)

pygeomscarf.utils.merge_configs(base, extra)

Merge two configuration dictionaries into a new one.

The returned configuration contains all entries from base with values from extra (if given) taking precedence. The input dictionaries are not mutated.

Parameters:
Return type:

AttrsDict