API
Dictionaries
Types
SolidStateDetectors.ADLChargeDriftModel
SolidStateDetectors.AbstractChargeDensity
SolidStateDetectors.AbstractImpurityDensity
SolidStateDetectors.AbstractParticleSource
SolidStateDetectors.BoggsChargeTrappingModel
SolidStateDetectors.CarrierParameters
SolidStateDetectors.ConstantChargeDensity
SolidStateDetectors.ConstantImpurityDensity
SolidStateDetectors.ConstructiveSolidGeometry.Box
SolidStateDetectors.ConstructiveSolidGeometry.CSGDifference
SolidStateDetectors.ConstructiveSolidGeometry.CSGIntersection
SolidStateDetectors.ConstructiveSolidGeometry.CSGUnion
SolidStateDetectors.ConstructiveSolidGeometry.CartesianPoint
SolidStateDetectors.ConstructiveSolidGeometry.CartesianVector
SolidStateDetectors.ConstructiveSolidGeometry.Cone
SolidStateDetectors.ConstructiveSolidGeometry.ConeMantle
SolidStateDetectors.ConstructiveSolidGeometry.CylindricalPoint
SolidStateDetectors.ConstructiveSolidGeometry.CylindricalVector
SolidStateDetectors.ConstructiveSolidGeometry.Ellipsoid
SolidStateDetectors.ConstructiveSolidGeometry.EllipsoidMantle
SolidStateDetectors.ConstructiveSolidGeometry.EllipticalSurface
SolidStateDetectors.ConstructiveSolidGeometry.Plane
SolidStateDetectors.ConstructiveSolidGeometry.Polygon
SolidStateDetectors.ConstructiveSolidGeometry.RegularPrism
SolidStateDetectors.ConstructiveSolidGeometry.Torus
SolidStateDetectors.ConstructiveSolidGeometry.TorusMantle
SolidStateDetectors.Contact
SolidStateDetectors.CylindricalChargeDensity
SolidStateDetectors.CylindricalImpurityDensity
SolidStateDetectors.DeadVolume
SolidStateDetectors.DielectricDistribution
SolidStateDetectors.DiscreteAxis
SolidStateDetectors.DiscreteAxis
SolidStateDetectors.EffectiveChargeDensity
SolidStateDetectors.ElectricField
SolidStateDetectors.ElectricFieldChargeDriftModel
SolidStateDetectors.ElectricPotential
SolidStateDetectors.Event
SolidStateDetectors.GeometricalAzimutalAxisWeights
SolidStateDetectors.GeometricalCartesianAxisWeights
SolidStateDetectors.GeometricalRadialAxisWeights
SolidStateDetectors.Grid
SolidStateDetectors.Grid
SolidStateDetectors.ImpurityScale
SolidStateDetectors.IsotopeSource
SolidStateDetectors.IsotropicChargeDriftModel
SolidStateDetectors.LinearChargeDensity
SolidStateDetectors.LinearImpurityDensity
SolidStateDetectors.MonoenergeticSource
SolidStateDetectors.NBodyChargeCloud
SolidStateDetectors.NBodyChargeCloud
SolidStateDetectors.NBodyChargeCloud
SolidStateDetectors.NoChargeTrappingModel
SolidStateDetectors.ParticleType
SolidStateDetectors.Passive
SolidStateDetectors.PointCharge
SolidStateDetectors.PointType
SolidStateDetectors.PointTypes
SolidStateDetectors.PotentialCalculationSetup
SolidStateDetectors.SSDInterval
SolidStateDetectors.Semiconductor
SolidStateDetectors.Simulation
SolidStateDetectors.SolidStateDetector
SolidStateDetectors.VelocityParameters
SolidStateDetectors.WeightingPotential
SolidStateDetectors.World
Functions
SolidStateDetectors.ConstructiveSolidGeometry.extreme_points
SolidStateDetectors.ConstructiveSolidGeometry.intersection
SolidStateDetectors.ConstructiveSolidGeometry.intersection
SolidStateDetectors.ConstructiveSolidGeometry.intersection
SolidStateDetectors.ConstructiveSolidGeometry.intersection
SolidStateDetectors.add_baseline_and_extend_tail
SolidStateDetectors.add_fano_noise
SolidStateDetectors.apply_initial_state!
SolidStateDetectors.apply_initial_state!
SolidStateDetectors.calc_new_potential_by_neighbors_3D
SolidStateDetectors.calculate_capacitance_matrix
SolidStateDetectors.calculate_electric_field!
SolidStateDetectors.calculate_electric_potential!
SolidStateDetectors.calculate_mutual_capacitance
SolidStateDetectors.calculate_stored_energy
SolidStateDetectors.calculate_weighting_potential!
SolidStateDetectors.drift_charges!
SolidStateDetectors.estimate_depletion_voltage
SolidStateDetectors.get_active_volume
SolidStateDetectors.get_charge_density
SolidStateDetectors.get_electron_and_hole_contribution
SolidStateDetectors.get_impurity_density
SolidStateDetectors.get_path_to_example_config_files
SolidStateDetectors.get_signals!
SolidStateDetectors.get_sor_kernel
SolidStateDetectors.get_ticks_at_positions_of_edge_of_depleted_volumes
SolidStateDetectors.get_ticks_at_positions_of_large_gradient
SolidStateDetectors.handle_depletion
SolidStateDetectors.is_depleted
SolidStateDetectors.merge_second_order_important_ticks
SolidStateDetectors.parse_config_file
SolidStateDetectors.plot_electron_and_hole_contribution
SolidStateDetectors.readsiggen
SolidStateDetectors.refine!
SolidStateDetectors.refine!
SolidStateDetectors.run_geant4_simulation
SolidStateDetectors.scaling_factor_for_permittivity_in_undepleted_region
SolidStateDetectors.siggentodict
SolidStateDetectors.simulate!
SolidStateDetectors.simulate!
SolidStateDetectors.simulate_waveforms
SolidStateDetectors.ssd_read
SolidStateDetectors.ssd_write
SolidStateDetectors.update!
SolidStateDetectors.update_till_convergence!
SolidStateDetectors.update_till_convergence!
Documentation
SolidStateDetectors.SSD_examples
— ConstantSSD_examples::Dict{Symbol,String}
Dictionary with the paths to the example detector configuration files provided by the package.
Find the possible keys of the dictionary with keys(SSD_examples)
.
The example detector configuration files can be loaded via
path_to_config_file = SSD_examples[:InvertedCoax]
sim = Simulation(path_to_config_file)
SolidStateDetectors.ADLChargeDriftModel
— TypeADLChargeDriftModel{T <: SSDFloat, M <: AbstractDriftMaterial, N, TM <: AbstractTemperatureModel{T}} <: AbstractChargeDriftModel{T}
Charge drift model for electrons and holes based on the AGATA Detector Library. Find a detailed description of the calculations in ADL Charge Drift Model.
Fields
electrons::CarrierParameters{T}
: Parameters to describe the electron drift along the <100> and <111> axes.holes::CarrierParameters{T}
: Parameters to describe the hole drift along the <100> and <111> axes.crystal_orientation::SMatrix{3,3,T,9}
: Rotation matrix that transforms the global coordinate system to the crystal coordinate system given by the <100>, <010> and <001> axes of the crystal.γ::SVector{N,SMatrix{3,3,T,9}}
: Reciprocal mass tensors to theN
valleys of the conduction band.parameters::ADLParameters{T}
: Parameters needed for the calculation of the electron drift velocity.temperaturemodel::TM
: Models to scale the resulting drift velocities with respect to temperature
See also CarrierParameters
.
SolidStateDetectors.AbstractChargeDensity
— Typeabstract type AbstractChargeDensity{T <: SSDFloat} end
Struct defining the charge density inside a Passive
.
For each charge density, there should be a method get_charge_density
which returns the charge density in SI units (C/m³) at a given point pt
.
Examples
SolidStateDetectors.AbstractImpurityDensity
— Typeabstract type AbstractImpurityDensity{T <: SSDFloat} end
Struct defining an impurity density inside a Semiconductor
.
For each impurity density, there should be a method get_impurity_density
which returns the impurity density in SI units (1/m³) at a given point.
Examples
The sign of the impurity density is important. It is taken into account in the conversion to a charge density and, thus, defines where the semiconductor is n-type or p-type.
SolidStateDetectors.AbstractParticleSource
— Typeabstract type AbstractParticleSource
Type of a particle source that creates primary particles for Geant4 simulations. Currently defined are MonoenergeticSource
and IsotopeSource
.
SolidStateDetectors.BoggsChargeTrappingModel
— Typestruct BoggsChargeTrappingModel{T <: SSDFloat} <: AbstractChargeTrappingModel{T}
Charge trapping model presented in Boggs et al. (2023).
Fields
nσe::T
: Trapping product for electrons (default:(nσe)^-1 = 1020cm
).nσh::T
: Trapping product for holes (default:(nσh)^-1 = 2040cm
).temperature::T
: Temperature of the crystal (default:78K
).
See also Charge Trapping Models.
SolidStateDetectors.CarrierParameters
— Typestruct CarrierParameters{T <: SSDFloat}
Parameters needed to describe the electron or hole drift along the <100> and <111> axes.
Fields
axis100::VelocityParameters{T}
: Parameters to describe the charge drift along the <100> axis.axis111::VelocityParameters{T}
: Parameters to describe the charge drift along the <111> axis.
See also VelocityParameters
.
SolidStateDetectors.ConstantChargeDensity
— Typestruct ConstantChargeDensity{T <: SSDFloat} <: AbstractChargeDensity{T}
Charge density model that assumes a constant charge density everywhere.
Fields
ρ::T
: the constant value of the charge density.
Definition in Configuration File
A ConstantChargeDensity
is defined in the configuration file through the field charge_density
(of a passive
or surrounding
) with name: constant
and a value
for ρ
.
An example definition of a constant charge density looks like this:
charge_density:
name: constant
value: 1.0e-10 # C/m³
SolidStateDetectors.ConstantImpurityDensity
— Typestruct ConstantImpurityDensity{T <: SSDFloat} <: AbstractImpurityDensity{T}
Impurity density model that assumes a constant impurity density everywhere.
Fields
ρ::T
: the constant value of the impurity density.
Definition in Configuration File
A ConstantImpurityDensity
is defined in the configuration file through the field impurity_density
(of a semiconductor
) with name: constant
and a value
for ρ
.
An example definition of a constant impurity density looks like this:
impurity_density:
name: constant
value: 1.0e10 # 1/m³
SolidStateDetectors.Contact
— Typestruct Contact{T, G, MT} <: AbstractContact{T}
Contact of a SolidStateDetector
.
For the simulation of the ElectricPotential
, all contacts are fixed to a constant potential value.
Parametric types:
T
: Precision type.G
: Type ofgeometry
.MT
: Type ofmaterial
.
Fields
potential::T
: Potential (in V) to which the contact will be fixed during the calculation of theElectricPotential
.material::MT
: Material of the contact.id::Int
: Unique id that will unambiguously identify the contact.name::String
: Custom name for the contact, relevant for plotting.geometry::G
: Geometry of the contact, see Constructive Solid Geometry (CSG).
Definition in Configuration File
A Contact
is defined in the configuration file through an entry in the contacts
array of a detector. It needs id
, potential
and geometry
and can optionally be given a name
and material
.
An example definition of contacts looks like this:
contacts:
- name: "n+ contact"
id: 1
potential: 5000V
material: HPGe # optional
geometry: # ....
- name: "p+ contact"
id: 2
potential: 0
material: HPGe #optional
geometry: # ....
SolidStateDetectors.CylindricalChargeDensity
— Typestruct CylindricalChargeDensity{T <: SSDFloat} <: AbstractChargeDensity{T}
Charge density model which assumes a linear gradient in charge density in each spatial dimension of a cylindrical coordinate system.
Fields
offsets::NTuple{3,T}
: charge density values at the origin of each dimension.gradients::NTuple{3,T}
: linear slopes inr
andz
direction.
Definition in Configuration File
A CylindricalChargeDensity
is defined in the configuration file through the field charge_density
(of a passive
or surrounding
) with name: cylindrical
and optional fields r
and z
that can each contain init
for initial values at 0 and gradient
for gradients in that dimension.
An example definition of a cylindrical charge density looks like this:
charge_density:
name: cylindrical
r: # impurity profile with linear gradient in r
init: 1.0e-10 # C/m³
gradient: 1.0e-11 # C/m⁴
SolidStateDetectors.CylindricalImpurityDensity
— Typestruct CylindricalImpurityDensity{T <: SSDFloat} <: AbstractImpurityDensity{T}
Impurity density model which assumes a linear gradient in impurity density in each spatial dimension of a cylindrical coordinate system.
Fields
offsets::NTuple{3,T}
: impurity density values at the origin of each dimension.gradients::NTuple{3,T}
: linear slopes inr
andz
direction.
Definition in Configuration File
A CylindricalImpurityDensity
is defined in the configuration file through the field impurity_density
(of a passive
or surrounding
) with name: cylindrical
and optional fields r
and z
that can each contain init
for initial values at 0 and gradient
for gradients in that dimension.
An example definition of a cylindrical impurity density looks like this:
impurity_density:
name: cylindrical
r: # impurity profile with linear gradient in r
init: 1.0e10 # 1/m³
gradient: 1.0e11 # 1/m⁴
SolidStateDetectors.DeadVolume
— Typestruct DeadVolume{T, G} <: AbstractVirtualVolume{T}
Volume inside which the charge drift is set to zero.
Parametric types
T
: Precision type.G
: Type ofgeometry
.
Fields
name::String
: Name of the dead volume, relevant for plotting.geometry::G
: Geometry of the dead volume, see Constructive Solid Geometry (CSG).
Definition in Configuration File
A DeadVolume
is defined through an entry in the virtual_drift_volumes
array of a detector with model: dead
. It needs a geometry
and can optionally be given a name
.
An example definition of dead volumes looks like this:
virtual_drift_volume:
- name: Volume 1
model: dead
geometry: # ...
- name: Volume 2
model: dead
geometry: # ...
SolidStateDetectors.DielectricDistribution
— Typestruct DielectricDistribution{T, N, S, AT} <: AbstractArray{T, N}
Dielectric distribution, or distribution of the relative permittivity, $\epsilon_r$, needed to calculate the ElectricPotential
. The dielectric distribution is unitless.
Parametric types
T
: Element type ofdata
.N
: Dimension of thegrid
anddata
array.S
: Coordinate system (Cartesian
orCylindrical
).AT
: Axes type.
Fields
data::Array{T, N}
: Array containing the values of the dielectric distribution at the discrete points of thegrid
.grid::Grid{T, N, S, AT}
:Grid
defining the discrete points at which the electric potential is determined.
The data
array contains the values of the dielectric distribution at the discrete points between the points defined by the axes ticks of the extended grid of grid
.
Thus, size(data) == size(grid) .+ 1
!
SolidStateDetectors.DiscreteAxis
— Typestruct DiscreteAxis{T, BL, BR, I} <: AbstractAxis{T, BL, BR, I}
Axis with discrete ticks which is used to define a dimension of a Grid
.
Parametric types
T
: Type of ticksBL
: Boundary condition at the left endpoint.BR
: Boundary condition at the right endpoint.I
: IntervalSets.Interval (closed or open boundaries)
The boundary conditions of a DiscreteAxis
can be BL, BR ∈ {:periodic, :reflecting, :infinite, :r0, :fixed}
.
Fields
interval::I
: Interval that defines the range of the axis.ticks::Vector{T}
: Array of values that correspond to the discrete ticks of the axis.
See also Grid
.
SolidStateDetectors.DiscreteAxis
— MethodDiscreteAxis(left_endpoint::T, right_endpoint::T, BL::Symbol, BR::Symbol, L::Symbol, R::Symbol, ticks::AbstractVector{T}) where {T}
Constructor of a DiscreteAxis
.
Arguments
left_endpoint::T
: Left endpoint of the interval of theDiscreteAxis
.right_endpoint::T
: Right endpoint of the interval of theDiscreteAxis
.BL::Symbol
: Boundary condition at the left endpoint.BR::Symbol
: Boundary condition at the right endpoint.L::Symbol
: Boundary type of the left endpoint.R::Symbol
: Boundary type of the right endpoint.ticks::AbstractVector{T}
: Array of values that correspond to the discrete ticks of the axis.
The boundary conditions of a DiscreteAxis
can be BL, BR ∈ {:periodic, :reflecting, :infinite, :r0, :fixed}
.
The boundary types of a DiscreteAxis
can be L, R ∈ {:closed, :open}
.
Examples
DiscreteAxis(-2.0, 2.0, :infinite, :infinite, :closed, :closed, collect(-2:0.1:2))
SolidStateDetectors.EffectiveChargeDensity
— Typestruct EffectiveChargeDensity{T, N, S, AT} <: AbstractArray{T, N}
Effective charge density needed to calculate the ElectricPotential
. The effective charge density is the charge density (in C/m³) times the volume of the voxel of the respective grid point (in m³). Thus, the unit of the effective charge density is Coulomb (C).
Parametric types
T
: Element type ofdata
.N
: Dimension of thegrid
anddata
array.S
: Coordinate system (Cartesian
orCylindrical
).AT
: Axes type.
Fields
data::Array{T, N}
: Array containing the values of the effective charge density at the discrete points of thegrid
.grid::Grid{T, N, S, AT}
:Grid
defining the discrete points at which the electric potential is determined.
SolidStateDetectors.ElectricField
— Typestruct ElectricField{T, N, S, AT} <: AbstractArray{T, N}
Electric field of the simulation in units of volt per meter (V/m).
Parametric types
T
: Element type ofgrid.axes
.N
: Dimension of thegrid
anddata
array.S
: Coordinate system (Cartesian
orCylindrical
).AT
: Axes type.
Fields
data::Array{<:StaticArray{Tuple{N}, T}, N}
: Array containing the field vectors of the electric field at the discrete points of thegrid
.grid::Grid{T, N, S, AT}
:Grid
defining the discrete points for which the electric field is determined.
SolidStateDetectors.ElectricFieldChargeDriftModel
— Typestruct ElectricFieldChargeDriftModel{T <: SSDFloat} <: AbstractChargeDriftModel{T}
Charge drift model in which the electrons and holes drift along the electric field with a mobility of ± 1m²/Vs.
This model is the default when no charge drift model is defined in the configuration file.
SolidStateDetectors.ElectricPotential
— Typestruct ElectricPotential{T, N, S, AT} <: AbstractArray{T, N}
Electric potential of the simulation in units of volt (V).
Parametric types
T
: Element type ofdata
.N
: Dimension of thegrid
anddata
array.S
: Coordinate system (Cartesian
orCylindrical
).AT
: Axes type.
Fields
data::Array{T, N}
: Array containing the values of the electric potential at the discrete points of thegrid
.grid::Grid{T, N, S, AT}
:Grid
defining the discrete points for which the electric potential is determined.
SolidStateDetectors.Event
— Typemutable struct Event{T <: SSDFloat}
Collection struct for individual events. This (mutable) struct is meant to be used to look at individual events, not to process a huge amount of events.
Fields
locations::VectorOfArrays{CartesianPoint{T}}
: Vector of the positions of all hits of the event.energies::VectorOfArrays{T}
: Vector of energies corresponding to the hits of the event.drift_paths::Union{Vector{EHDriftPath{T}}, Missing}
: Calculated drift paths of each hit position.waveforms::Union{Vector{<:Any}, Missing}
: Generated signals (waveforms) of the event.
SolidStateDetectors.GeometricalAzimutalAxisWeights
— Typestruct GeometricalAzimutalAxisWeights{T} <: AbstractGeometricalAxisWeights{T}
GeometricalAzimutalAxisWeights
stores certain precalculated (in its construction) fixed values of the azimulal (or polar) axis, ax
, of an cylindrical grid on which the field calculation is performed. These precalculated values are further used in the field calculation to calculate the six weights for the neighboring grid points in the SOR.
GeometricalAzimutalAxisWeights
has only one field: weights::Array{T}, 2
, which is of size (4, length(ax.ticks))
. Each row holding the 4 precalculated values for one axis tick.
Axis ticks, t = ax.ticks
, and midpoints, mp = midpoints(get_extended_ticks(ax))
,
(the middle points between to axis ticks) inbetween:... t[i-1] --- mp[i] --- t[i] --- mp[i+1] --- t[i+1] ...
are required for the understanding of the precalculated values.
The columns store the following quantities:
weights[1, i]
:(mp[i+1] - t[i])
/weights[3, i]
weights[2, i]
:(t[i] - mp[i])
/weights[3, i]
weights[3, i]
:mp[i+1] - mp[i]
weights[4, i]
:inv(t[i] - t[i-1])
weights[5, i]
:normalize(wφ[3, 1:2:end], 1)
weights[6, i]
:normalize(wφ[3, 2:2:end], 1)
Developer note: This actually seems to be the same as GeometricalCartesianAxisWeights
. Thus, we actually could remove that. Or change this into an alias.
SolidStateDetectors.GeometricalCartesianAxisWeights
— Typestruct GeometricalCartesianAxisWeights{T} <: AbstractGeometricalAxisWeights{T}
GeometricalCartesianAxisWeights
stores certain precalculated (in its construction) fixed values of one of the cartesian (linear) axes, ax
, of the grid on which the field calculation is performed. These precalculated values are further used in the field calculation to calculate the six weights for the neighboring grid points in the SOR.
GeometricalCartesianAxisWeights
has only one field: weights::Array{T}, 2
, which is of size (4, length(ax.ticks))
. Each row holding the 4 precalculated values for one axis tick.
Axis ticks, t = ax.ticks
, and midpoints, mp = midpoints(get_extended_ticks(ax))
,
(the middle points between to axis ticks) inbetween:... t[i-1] --- mp[i] --- t[i] --- mp[i+1] --- t[i+1] ...
are required for the understanding of the precalculated values.
The columns store the following quantities:
weights[1, i]
:(mp[i+1] - t[i])
/weights[3, i]
weights[2, i]
:(t[i] - mp[i])
/weights[3, i]
weights[3, i]
:mp[i+1] - mp[i]
weights[4, i]
:inv(t[i] - t[i-1])
SolidStateDetectors.GeometricalRadialAxisWeights
— Typestruct GeometricalRadialAxisWeights{T} <: AbstractGeometricalAxisWeights{T}
GeometricalRadialAxisWeights
stores certain precalculated (in its construction) fixed values of the radial axis, ax
, of an cylindrical grid on which the field calculation is performed. These precalculated values are further used in the field calculation to calculate the six weights for the neighboring grid points in the SOR.
GeometricalRadialAxisWeights
has only one field: weights::Array{T}, 2
, which is of size (6, length(ax.ticks))
. Each row holding the 6 precalculated values for one axis tick.
Axis ticks, t = ax.ticks
, and midpoints, mp = midpoints(get_extended_ticks(ax))
,
(the middle points between to axis ticks) inbetween:... t[i-1] --- mp[i] --- t[i] --- mp[i+1] --- t[i+1] ...
are required for the understanding of the precalculated values.
The columns store the following quantities:
weights[1, i]
:(mp[i+1] - t[i])
/weights[3, i]
weights[2, i]
:(t[i] - mp[i])
/weights[3, i]
weights[3, i]
:(mp[i+1] - mp[i]) / t[i]
weights[4, i]
:mp[i+1] / (t[i+1] - t[i])
weights[5, i]
:mp[i] / (t[i] - t[i-1])
# Developer note: maybe this one could be removed as it basically stores the same asweights[4, i-1]
weights[6, i]
:(mp[i+1]^2 - mp[i]^2)/2
Developer note: Some of the weights for i == 1
are set manually as r = 0
requires some special treatment.
SolidStateDetectors.Grid
— Typestruct Grid{T, N, S <: AbstractCoordinateSystem, AT} <: AbstractGrid{T, N}
Collection of N
axes that define the dimensions of the grid needed to calculate ElectricPotential
, ElectricField
or WeightingPotential
.
Parametric types
T
: Tick type (element type) of the axes.N
: Dimension of the grid.S
: Coordinate system (Cartesian
orCylindrical
).AT
: Axes type.
Fields
axes::AT
: Tuple of lengthN
containingDiscreteAxis
for each dimension of the grid.
See also DiscreteAxis
.
SolidStateDetectors.Grid
— MethodGrid(sim::Simulation{T, Cartesian}; kwargs...)
Grid(sim::Simulation{T, Cylindrical}; kwargs...)
Initializes a Grid
based on the objects defined in a Simulation
.
The important points of all objects are sampled and added to the ticks of the grid. The grid initialization can be tuned using a set of keyword arguments listed below.
Arguments
sim::Simulation{T, S}
:Simulation
for which the grid will be defined.
Keywords
max_tick_distance = missing
: Maximum distance between neighbouring ticks of the grid. Additional grid ticks will be added if two neighbouring ticks are too far apart.max_tick_distance
can either be aQuantity
, e.g.1u"mm"
, or a Tuple ofQuantity
, e.g.(1u"mm", 15u"°", 3u"mm")
, to set it for each axis of theGrid
separately. Note that aCartesianGrid3D
requires aTuple{LengthQuantity, LengthQuantity, LengthQuantity}
while aCylindricalGrid
requires aTuple{LengthQuantity, AngleQuantity, LengthQuantity}
. Ifmax_tick_distance
ismissing
, one fourth of the axis length is used.max_distance_ratio::Real = 5
: If the ratio between a tick and its left and right neighbour is greater thanmax_distance_ratio
, additional ticks are added between the ticks that are further apart. This prevents the ticks from being too unevenly spaced.add_ticks_between_important_ticks::Bool = true
: If set totrue
, additional points will be added in between the important points obtained from sampling the objects of the simulation. If some objects are too close together, this will ensure a noticeable gap between them in the calculation of potentials and fields.for_weighting_potential::Bool = false
: Grid will be optimized for the calculation of anElectricPotential
if set totrue
, and of aWeightingPotential
if set tofalse
.
SolidStateDetectors.ImpurityScale
— Typestruct ImpurityScale{T, N, S, AT} <: AbstractArray{T, N}
Impurity scalar field of the simulation. It is kinda an alpha map for the impurity density of semiconductors. It can takes values between 0
and 1
:
1
: The impurity density has its full value. For grid points in depleted region of the semiconductor.]0,1[
: The impurity density is scaled down but not zero. For grid points at the edge of the depleted region which are partially depleted.0
: The impurity density is set to0
. For grid points in undepleted regions of the semiconductor.
Parametric types
T
: Element type ofdata
.N
: Dimension of thegrid
anddata
array.S
: Coordinate system (Cartesian
orCylindrical
).AT
: Axes type.
Fields
data::Array{T, N}
: Array containing the values of the impurity scale at the discrete points of thegrid
.grid::Grid{T, N, S, AT}
:Grid
defining the discrete points for which the impurity scale is determined.
SolidStateDetectors.IsotopeSource
— Typestruct IsotopeSource <: AbstractParticleSource
Particle source which emits particles based on a defined decay chain, in either isotropic, directed ray or directed cone emission.
Fields
Z::Int32
: Atomic number of the mother nucleus.A::Int32
: Mass number of the mother nucleus.ionCharge::Float64
: Charge of the mother nucleus.excitEnergy::Float64
: Excitation energy of the mother nucleus.position::CartesianPoint
: Location of the sourcedirection::CartesianVector
: Direction in which the source emits the particles.opening_angle::AngleQuantity
: Opening angle in case of directed cone emission.
Examples
# Isotropic emission when no direction is passed
i1 = IsotopeSource(82, 212, 0, 0, CartesianPoint(0.04, 0, 0.05))
# Directed ray emission when no opening_angle is passed
i2 = IsotopeSource(82, 212, 0, 0, CartesianPoint(0.04, 0, 0.05), CartesianVector(-1, 0, 0))
# Directed cone emission when opening_angle is passed
i3 = IsotopeSource(82, 212, 0, 0, CartesianPoint(0.04, 0, 0.05), CartesianVector(-1, 0, 0), 10u"°")
See also MonoenergeticSource
.
SolidStateDetectors.IsotropicChargeDriftModel
— Typestruct IsotropicChargeDriftModel{T <: SSDFloat} <: AbstractChargeDriftModel{T}
Charge drift model in which the electrons and holes drift along the electric field with a constant mobility in m²/Vs
Fields
μ_e::Union{RealQuantity, AbstractString}
: Mobility of the electrons in m²/Vs.μ_h::Union{RealQuantity, AbstractString}
: Mobility of the holes in m²/Vs.
SolidStateDetectors.LinearChargeDensity
— Typestruct LinearChargeDensity{T <: SSDFloat} <: AbstractChargeDensity{T}
Charge density model which assumes a linear gradient in charge density in each dimension of a Cartesian coordinate system.
Fields
offsets::NTuple{3,T}
: charge density values at the origin of each dimension.gradients::NTuple{3,T}
: linear slopes inx
,y
andz
direction.
Definition in Configuration File
A LinearChargeDensity
is defined in the configuration file through the field charge_density
(of a passive
or surrounding
) with name: linear
and optional fields x
, y
and z
that can each contain init
for initial values at 0 and gradient
for gradients in that dimension.
An example definition of a linear charge density looks like this:
charge_density:
name: cylindrical
x: # impurity profile with linear gradient in x
init: 1.0e-10 # C/m³
gradient: 1.0e-11 # C/m⁴
SolidStateDetectors.LinearImpurityDensity
— Typestruct LinearImpurityDensity{T <: SSDFloat} <: AbstractImpurityDensity{T}
Impurity density model which assumes a linear gradient in impurity density in each dimension of a Cartesian coordinate system.
Fields
offsets::NTuple{3,T}
: impurity density values at the origin of each dimension.gradients::NTuple{3,T}
: linear slopes inx
,y
andz
direction.
Definition in Configuration File
A LinearImpurityDensity
is defined in the configuration file through the field impurity_density
(of a passive
or surrounding
) with name: linear
and optional fields x
, y
and z
that can each contain init
for initial values at 0 and gradient
for gradients in that dimension.
An example definition of a linear impurity density looks like this:
impurity_density:
name: cylindrical
x: # impurity profile with linear gradient in x
init: 1.0e10 # 1/m³
gradient: 1.0e11 # 1/m⁴
SolidStateDetectors.MonoenergeticSource
— Typestruct MonoenergeticSource <: AbstractParticleSource
Particle source which emits monoenergetic particles, in either isotropic, directed ray or directed cone emission.
Fields
particle_type::String
: Particle type emitted by the source.energy::RealQuantity
: Energy of the particles emitted by the source.position::CartesianPoint
: Location of the sourcedirection::CartesianVector
: Direction in which the source emits the particles.opening_angle::AngleQuantity
: Opening angle in case of directed cone emission.
Examples
# Isotropic emission when no direction is passed
m1 = MonoenergeticSource("gamma", 2.615u"MeV", CartesianPoint(0.04, 0, 0.05))
# Directed ray emission when no opening_angle is passed
m2 = MonoenergeticSource("gamma", 2.615u"MeV", CartesianPoint(0.04, 0, 0.05), CartesianVector(-1, 0, 0))
# Directed cone emission when opening_angle is passed
m3 = MonoenergeticSource("gamma", 2.615u"MeV", CartesianPoint(0.04, 0, 0.05), CartesianVector(-1, 0, 0), 10u"°")
See also IsotopeSource
.
SolidStateDetectors.NBodyChargeCloud
— Typestruct NBodyChargeCloud{T, N, SH} <: AbstractChargeCloud
Struct which defines a charge cloud consisting of multiple point-like charge carriers, initially distributed around a given center.
Parametric Types
T
: Precision type.N
: Number of shells.SH
: Geometry of the shells.
Fields
locations::Vector{CartesianPoint{T}}
: Positions of the charge carriers that are part of the charge cloud.energies::Vector{T}
: Energies of the respective charge carriers, in the same order aslocations
.shell_structure::SH
: Initial geometry of the charge carriers around thecenter
point, relevant for plotting.
SolidStateDetectors.NBodyChargeCloud
— MethodNBodyChargeCloud(center::CartesianPoint{T}, energy::T, N::Integer, particle_type::Type{PT} = Gamma; kwargs...)
Returns an NBodyChargeCloud
for a given energy
deposition at a position that defines the center
of the charge cloud, given by a center charge surrounded by shells of approximately N
point charges equally distributed on the surface of a sphere. Find the algorithm to create the shells here.
Arguments
center::CartesianPoint{T}
: Center position of theNBodyChargeCloud
.energy::RealQuantity
: Deposited energy with units. If no units are given, the value is parsed in units of eV.N::Integer
: Approximate number of charges in theNBodyChargeCloud
(might vary by around 1%).particle_type
:ParticleType
of the particle that deposited the energy. Default isGamma
.
Keywords
radius::T
: Estimate for the radius of theNBodyChargeCloud
. Default is determined fromparticle_type
viaradius_guess
.number_of_shells::Int
: Number of shells around thecenter
point. Default is2
.
Example
center = CartesianPoint{T}([0,0,0])
energy = 1460u"keV"
NBodyChargeCloud(center, energy, 200, number_of_shells = 3)
Using values with units for energy
requires the package Unitful.jl.
SolidStateDetectors.NBodyChargeCloud
— MethodNBodyChargeCloud(center::CartesianPoint{T}, energy::T, particle_type::Type{PT} = Gamma; kwargs...)
Returns an NBodyChargeCloud
for a given energy
deposition at a position that defines the center
of the charge cloud, given by a center charge surrounded by shells consisting of platonic solids.
Arguments
center::CartesianPoint{T}
: Center position of theNBodyChargeCloud
.energy::RealQuantity
: Deposited energy with units. If no units are given, the value is parsed in units of eV.particle_type
:ParticleType
of the particle that deposited the energy. Default isGamma
.
Keywords
radius::T
: Estimate for the radius of theNBodyChargeCloud
. Default is determined fromparticle_type
viaradius_guess
.number_of_shells::Int
: Number of shells around thecenter
point. Default is2
.shell_structure
: Geometry with which the charges are distributed in the shells. Default isDodecahedron
.
Example
center = CartesianPoint{T}([0,0,0])
energy = 1460u"keV"
NBodyChargeCloud(center, energy, number_of_shells = 3, shell_structure = SolidStateDetectors.Icosahedron)
Using values with units for energy
requires the package Unitful.jl.
SolidStateDetectors.NoChargeTrappingModel
— Typestruct NoChargeTrappingModel{T <: SSDFloat} <: AbstractChargeTrappingModel{T}
Charge trapping model, in which no charges are trapped during the charge drift.
This model is the default when no charge trapping model is defined in the configuration file.
SolidStateDetectors.ParticleType
— Typeabstract type ParticleType
Type of a particle that deposits energy in a Semiconductor
. Currently defined are Alpha
, Beta
and Gamma
.
ParticleType
is used to determine the radius of an NBodyChargeCloud
, where the default radius for Alpha
is 0.1mm and the default radius for Beta
and Gamma
is 0.5mm.
SolidStateDetectors.Passive
— Typestruct Passive{T,G,MT,CDM} <: AbstractPassive{T}
Passive object, assigned to a SolidStateDetector
.
For the calculation of the ElectricPotential
and WeightingPotential
, passives can be fixed to a constant potential. They can additionally have a charge density profile that has an influence on the ElectricPotential
.
Parametric types
T
: Precision type.G
: Type ofgeometry
.MT
: Type ofmaterial
.CDM
: Type ofcharge_density_model
.
Fields
name::String
: Custom name for the passive, relevant for plotting.id::Int
: Unique id that will unambiguously identify the passive.potential::T
: Potential (in V) to which the passive will be fixed during the calculation of the electric potential. For floating passives, thepotential
value isNaN
.temperature::T
: Temperature (in K) of the passive.material::MT
: Material of the passive.charge_density_model::CDM
: Charge density model for the points inside the passive.geometry::G
: Geometry of the passive, see Constructive Solid Geometry (CSG).
Definition in Configuration File
A Passive
is defined through an entry in the passives
array of a detector or an entry in the surroundings
array in the configuration file. It needs material
and geometry
and can optionally be given a name
, id
, potential
, temperature
and charge_density
.
An example definition of passives looks like this:
passives:
- name: Passivated Surface
material: HPGe
charge_density: # ...
geometry: # ...
- name: Cryostat
id: 3
potential: 0
temperature: 293K
material: Al
geometry: # ...
SolidStateDetectors.PointCharge
— Typestruct PointCharge{T} <: AbstractChargeCloud
Struct which defines a single point-like charge carrier.
Fields
locations::SVector{1, CartesianPoint{T}}
: Position of the charge carrier, saved as single entry of aVector
.
Example
center = CartesianPoint{T}(0,0,0)
pc = PointCharge(center) # Constructor: creates a PointCharge around (0,0,0)
pc.locations # Array that only contains the center point
SolidStateDetectors.PointType
— Typeconst PointType = UInt8
Stores certain information about a grid point via bit-flags.
Right now, there are:
const update_bit = 0x01
const undepleted_bit = 0x02
const pn_junction_bit = 0x04
const bulk_bit = 0x08
Examples
How to get information out of a PointType
variable point_type
:
point_type & update_bit == 0
-> do not update this point (for fixed points)point_type & update_bit > 0
-> do update this pointpoint_type & undepleted_bit > 0
-> this point is undepletedpoint_type & pn_junction_bit > 0
-> this point belongs to the solid state detector, meaning that it is in the volume of the n-type or p-type material.point_type & bulk_bit > 0
-> this point is only surrounded by points marked aspn_junction_bit
SolidStateDetectors.PointTypes
— Typestruct PointTypes{T, N, S, AT} <: AbstractArray{T, N}
Information about the grid points used to calculate the ElectricPotential
stored via bit-flags. Data is stored as PointType
which is an UInt8
.
Parametric types
T
: Element type ofgrid.axes
.N
: Dimension of thegrid
anddata
array.S
: Coordinate system (Cartesian
orCylindrical
).AT
: Axes type.
Fields
data::Array{PointType, N}
: Array containing the point type values at the discrete points of thegrid
.grid::Grid{T, N, S, AT}
:Grid
defining the discrete points for which the point types are determined.
See also PointType
.
SolidStateDetectors.PotentialCalculationSetup
— Typestruct PotentialCalculationSetup
PotentialCalculationSetup
holds the grid, fields and certain precalculated fixed parameters for the field calculation. This struct will be calculated after each refinement as is depends on the grid.
grid
: The 3-dimensional grid, either Cartesian or cylindrical, on which the field will be calculated.
The fields:
potential
: This is the 4-dimensional array of the extended 3D potential array.
The fourth dimensions comes from the red-black (even-odd) division in order to parallelize the field calculation. Extended means that the grid holds one additional tick at both sides of all axes necessary for boundary handling (reflecting, fixed, ...) at the ends of the grid.
point_types
: Also a 4-dimensional array. Same structure as thepotential
-array.volume_weights
: Also a 4-dimensional array. Same structure as thepotential
-array.q_eff_imp
: Also a 4-dimensional array. Same structure as thepotential
-array.imp_scale
: Also a 4-dimensional array. Same structure as thepotential
-array.q_eff_fix
: Also a 4-dimensional array. Same structure as thepotential
-array.ϵ_r
: Normal 3-dimensional array! In order to calculate the final 6 weights for each grid point in the SOR,
the eight values of the dielectric permittivity (of each octant) around the grid point needs to be loaded. Here not special division is possible for the red-black (even-odd) division.
Precalculated parameters:
geom_weights
: The parts of the calculation of the six weights in the SOR can be precalculated. Those are stored here for each axis/dimension.sor_const
: Vector holding the SOR constants. In the cartesian case only the first entry is used. As the optimal value for the SOR constant
depends on the grid, the constant is linear increased and the array holds the respective value for each radial axis tick.
bias_voltage
:maximum_applied_potential - minimum_applied_potential
. Used for depletion handling, but might be obsolete by now.maximum_applied_potential
: Used for depletion handling, but might be obsolete by now.minimum_applied_potential
: Used for depletion handling, but might be obsolete by now.grid_boundary_factors
: Used in the application of boundary conditions in the field calculation for decaying (infinite) boundary conditions
to approximate the decay of the potential (depending on the grid).
SolidStateDetectors.SSDInterval
— Typestruct SSDInterval{T <: SSDFloat, L, R, BL, BR} <: IntervalSets.TypedEndpointsInterval{L,R,T}
Interval containing boundary conditions of left and right boundary as parametric type (BL
and BR
).
Parametric types
T
: Precision type.L
: Boundary type of the left endpoint.R
: Boundary type of the right endpoint.BL
: Boundary condition at the left endpoint.BR
: Boundary condition at the right endpoint.
The boundary types of an SSDInterval
can be L, R ∈ {:closed, :open}
.
The boundary conditions of an SSDInterval
can be BL, BR ∈ {:periodic, :reflecting, :infinite, :r0, :fixed}
.
Fields
left::T
: Value of the left endpoint.right::T
: Value of the right endpoint.
SolidStateDetectors.Semiconductor
— Typestruct Semiconductor{T,G,MT,CDM,IDM,CTM} <: AbstractSemiconductor{T}
Semiconductor bulk of a SolidStateDetector
.
This is the volume in which electrons and holes will drift during the signal development.
Parametric types
T
: Precision type.G
: Type ofgeometry
.MT
: Type ofmaterial
.CDM
: Type ofcharge_drift_model
.IDM
: Type ofimpurity_density_model
.CTM
: Type ofcharge_trapping_model
.
Fields
temperature::T
: Temperature (in K) of the semiconductor.material::MT
: Material of the semiconductor.impurity_density_model::IDM
: Impurity density model for the points inside the semiconductor.charge_drift_model::CDM
: Model that describes the drift of electrons and holes inside the semiconductor.charge_trapping_model::CTM
: Model that describes the trapping of electrons and holes inside the semiconductor.geometry::G
: Geometry of the semiconductor, see Constructive Solid Geometry (CSG).
Definition in Configuration File
A Semiconductor
is defined through the semiconductor
field of a detector. It needs material
and geometry
, and can optionally be given a temperature
, impurity_density
, charge_drift_model
and charge_trapping_model
.
An example definition of a semiconductor looks like this:
semiconductor:
material: HPGe
temperature: 78
impurity_density: # ...
charge_drift_model: # ...
charge_trapping_model: # ...
geometry: # ...
SolidStateDetectors.Simulation
— Typemutable struct Simulation{T <: SSDFloat, CS <: AbstractCoordinateSystem} <: AbstractSimulation{T}
Collection of all parts of a simulation of a SolidStateDetector
.
Parametric types
T
: Precision type.CS
: Coordinate system (Cartesian
orCylindrical
).
Fields
config_dict::AbstractDict
: Dictionary (parsed configuration file) which initialized the simulation.input_units::NamedTuple
: Units with which theconfig_dict
should be parsed.medium::NamedTuple
: Medium of the world.detector::Union{SolidStateDetector{T}, Missing}
: TheSolidStateDetector
of the simulation.world::World{T, 3, CS}
: TheWorld
of the simulation.q_eff_imp::Union{EffectiveChargeDensity{T}, Missing}
: Effective charge resulting from the impurites in theSemiconductor
of thedetector
.imp_scale::Union{ImpurityScale{T}, Missing}
: Scale (alpha channel) of the impurity density (for depletion handling).q_eff_fix::Union{EffectiveChargeDensity{T}, Missing}
: Fixed charge resulting from fixed space charges inPassive
of thedetector
.ϵ_r::Union{DielectricDistribution{T}, Missing}
: TheDielectricDistribution
of the simulation.point_types::Union{PointTypes{T}, Missing}
: ThePointTypes
of the simulation.electric_potential::Union{ElectricPotential{T}, Missing}
: TheElectricPotential
of the simulation.weighting_potentials::Vector{Any}
: TheWeightingPotential
for eachContact
of thedetector
in the simulation.electric_field::Union{ElectricField{T}, Missing}
: TheElectricField
of the simulation.
SolidStateDetectors.SolidStateDetector
— Typestruct SolidStateDetector{T,SC,CT,PT,VDM} <: AbstractConfig{T}
Struct to describe all parts of a solid state detector, i.e. the Semiconductor
, a set of Contact
and (optionally) Passive
and virtual drift volumes.
The properties of the parts (charge densities, fixed potentials, relative permittivity of the materials) will be used as input to the calculation of ElectricPotential
and WeightingPotential
in the Simulation
.
Parametric types
T
: Precision type.SC
: Type of thesemiconductor
.CT
: Type of thecontacts
.PT
: Type of thepassives
.VDM
: Type of thevirtual_drift_volumes
.
Fields
name::String
: Name of the detector.semiconductor::SC
:Semiconductor
of the detector.contacts::CT
: Vector ofContact
of the detector.passives::PT
: Vector ofPassive
objects, e.g. holding structures around the detector.virtual_drift_volumes::VDM
: Vector of virtual drift volumes in which the drift can be modulated by user-defined methods formodulate_driftvector
, e.g.DeadVolume
.
See also Semiconductor
, Contact
, Passive
and DeadVolume
.
SolidStateDetectors.VelocityParameters
— Typestruct VelocityParameters{T <: SSDFloat}
Values needed to parametrize the longitudinal drift velocity of electrons or hole along a crystal axis as a function of the electric field strength.
Background information
The parameterization for the longitudinal drift velocity, $v_l$, as a function of the electric field strength, $E$, was proposed by D.M. Caughey and R.E. Thomas and later expanded by L. Mihailescu et al.:
\[v_l = \frac{\mu_0 E}{(1 + (E/E_0 )^{\beta})^{1/ \beta}} - \mu_{n} E.\]
with the four parameters, $\mu_0$, $\beta$, $E_0$ and $\mu_n$, which are different for electrons and holes and for the different crystal axes.
The parameter $\mu_n$ accounts for the Gunn effects for electrons and should be 0 for holes.
Fields
mu0::T
: Parameter $\mu_0$ in the parameterization shown above.beta::T
: Parameter $\beta$ in the parameterization shown above.E0::T
: Parameter $E_0$ in the parameterization shown above.mun::T
: Parameter $\mu_n$ in the parameterization shown above.
SolidStateDetectors.WeightingPotential
— Typestruct WeightingPotential{T, N, S, AT} <: AbstractArray{T, N}
Weighting potential for a given Contact
which is a unitless potential.
Parametric types
T
: Element type ofdata
.N
: Dimension of thegrid
anddata
array.S
: Coordinate system (Cartesian
orCylindrical
).AT
: Axes type.
Fields
data::Array{T, N}
: Array containing the values of the weighting potential at the discrete points of thegrid
.grid::Grid{T, N, S, AT}
:Grid
defining the discrete points for which the weighting potential is determined.
SolidStateDetectors.World
— Typestruct World{T <: SSDFloat, N, S} <: AbstractWorld{T, N}
Definition of the finite volume on which a Simulation
is performed.
Parametric types
T
: Precision type.N
: Dimensions of the world.S
: Coordinate system (Cartesian
orCylindrical
).
Fields
intervals::NTuple{N, SSDInterval{T}}
: A set ofSSDInterval
defining the dimensions of the world.
SolidStateDetectors.add_baseline_and_extend_tail
— Methodadd_baseline_and_extend_tail(wv::RadiationDetectorSignals.RDWaveform{T,U,TV,UV}, n_baseline_samples::Int, total_waveform_length::Int) where {T,U,TV,UV}
Adds a zero-valued baseline in front of the waveform wv
and extends (or cuts off) the waveform at the end with the last value of wv
. A waveform of length total_waveform_length
is returned.
Arguments
wv::RadiationDetectorSignals.RDWaveform{T,U,TV,UV}
: A waveform (signal over time).n_baseline_samples::Int
: Number of samples added in front of the waveform with values 0.total_waveform_length::Int
: Number of samples of the extended waveform which is returned.
Examples
add_baseline_and_extend_tail(wv, 1000, 5000)
This functions assumes that the time steps between the samples of the input waveform wv
are the same. Thus, that the input waveform is sampled with a fixed frequency.
SolidStateDetectors.add_fano_noise
— Functionadd_fano_noise(E_dep::RealQuantity, E_ionisation::RealQuantity, f_fano::Real)::RealQuantity
Adds Fano noise to an energy deposition E_dep
, assuming a detector material ionisation energy E_ionisation
and a Fano factor f_fano
.
Arguments
E_dep::RealQuantity
: Energy deposited in a semiconductor material.E_ionisation
: Energy needed to create one electron-hole-pair in the semiconductor material.f_fano
: Fano factor of the material.
Example
add_fano_noise(100u"keV", 2.95u"eV", 0.129)
Some material properties are stored in SolidStateDetectors.material_properties
and can be used here:
material = SolidStateDetectors.material_properties[:HPGe]
add_fano_noise(100u"keV", material.E_ionisation, material.f_fano)
Using values with units for E_dep
or E_ionisation
requires the package Unitful.jl.
SolidStateDetectors.apply_initial_state!
— Methodapply_initial_state!(sim::Simulation{T}, ::Type{ElectricPotential}, grid::Grid{T} = Grid(sim);
not_only_paint_contacts::Bool = true, paint_contacts::Bool = true)::Nothing where {T <: SSDFloat}
Applies the initial state for the calculation of the ElectricPotential
. It overwrites sim.electric_potential
, sim.q_eff_imp
, sim.q_eff_fix
, sim.ϵ
and sim.point_types
with the material properties and fixed potentials defined in sim.detector
.
Arguments
sim::Simulation{T}
:Simulation
for which the initial state should be applied.grid::Grid{T}
:Grid
to apply the initial state on. If nogrid
is given, a defaultGrid
is determined fromsim
.
Keywords
not_only_paint_contacts::Bool = true
: Whether to only use the painting algorithm of the surfaces ofContact
without checking if points are actually inside them. Setting it tofalse
should improve the performance but the points inside ofContact
are not fixed anymore.paint_contacts::Bool = true
: Enable or disable the painting of the surfaces of theContact
onto thegrid
.
Examples
apply_initial_state!(sim, ElectricPotential, paint_contacts = false)
SolidStateDetectors.apply_initial_state!
— Methodapply_initial_state!(sim::Simulation{T}, ::Type{WeightingPotential}, contact_id::Int, grid::Grid{T} = Grid(sim))::Nothing
Applies the initial state for the calculation of the WeightingPotential
for the [Contact
}(@ref) with the id contact_id
. It overwrites sim.weighting_potentials[contact_id]
with the fixed values on the [Contact
}(@ref).
Arguments
sim::Simulation{T}
:Simulation
for which the initial state should be applied.contact_id::Int
: Theid
of theContact
for which theWeightingPotential
is to be calculated.grid::Grid{T}
:Grid
to apply the initial state on. If nogrid
is given, a defaultGrid
is determined fromsim
.
Keywords
not_only_paint_contacts::Bool = true
: Whether to only use the painting algorithm of the surfaces ofContact
without checking if points are actually inside them. Setting it tofalse
should improve the performance but the points inside ofContact
are not fixed anymore.paint_contacts::Bool = true
: Enable or disable the painting of the surfaces of theContact
onto thegrid
.
Examples
apply_initial_state!(sim, WeightingPotential, 1) # => applies initial state for weighting potential of contact with id 1
SolidStateDetectors.calc_new_potential_by_neighbors_3D
— Methodfunction calc_new_potential_by_neighbors_3D(
volume_weight::T,
weights::NTuple{6,T},
neighbor_potentials::NTuple{6,T},
) where {T}
Calculates and returns the new potential value of a grid point given the potential values of the six neighbouring grid points (2 in each dimension) neighbor_potentials
, the weights corresponding to those six potentials of the neighboring grid points, the weight due to the volume of the grid point itself (the voxel around it).
For more detailed information see Chapter 5.2.2 "Calculation of the Electric Potential" Eqs. 5.31 to 5.37 in https://mediatum.ub.tum.de/doc/1620954/1620954.pdf.
SolidStateDetectors.calculate_capacitance_matrix
— Methodcalculate_capacitance_matrix(sim::Simulation{T}; consider_multiplicity::Bool = true) where {T}
Calculates the Maxwell Capacitance N×N
-Matrix in units of pF, where N
is the number of contacts of sim.detector
. The individual elements, $c_{i,j}$, are calculated via calculate_mutual_capacitance(sim::Simulation, (i,j)::Tuple{Int,Int})
. The matrix should be symmetric. The difference of C[i,j]
and C[j,i]
are due to numerical precision in the integration due to the different grids of the two weighting potentials.
Arguments
sim::Simulation
:Simulation
for which the capacitance matrix is calculated.
Keywords
consider_multiplicity::Bool = true
: Whether symmetries of the system should be taken into account. For example, in case of true coaxial detector center around the origin and calculated on a cartesian grid with thex-axis
going from[0, x_max]
and they-axis
going from[0, y_max]
the multiplicity is 4 and, ifconsider_multiplicity == true
, the returned value is already multiplied by 4.
SolidStateDetectors.calculate_electric_field!
— Methodcalculate_electric_field!(sim::Simulation{T}; n_points_in_φ::Union{Missing, Int} = missing)::Nothing
Calculates the ElectricField
from the ElectricPotential
stored in sim.electric_potential
and stores it in sim.electric_field
.
Arguments
sim::Simulation{T}
:Simulation
for whichsim.electric_potential
has already been calculated.
Keywords
n_points_in_φ::Union{Missing, Int}
: For a 2DElectricPotential
(cylindrical coordinates and symmetric inφ
),sim.electric_potential
is extended ton_points_in_φ
"layers" inφ
in order to calculate a 3D [ElectricField
]. Ifn_points_in_φ
ismissing
, the default value is36
.
Examples
calculate_electric_field!(sim, n_points_in_φ = 32)
This method only works if sim.electric_potential
has already been calculated and is not missing
.
SolidStateDetectors.calculate_electric_potential!
— Methodcalculate_electric_potential!(sim::Simulation{T}; kwargs...)::Nothing
Calculates the ElectricPotential
for a given Simulation
sim
on an adaptive grid through successive over relaxation and stores it in sim.electric_potential
.
There are several keyword arguments which can be used to tune the calculation.
Arguments
sim::Simulation{T}
:Simulation
for which theElectricPotential
is calculated.
Keywords
convergence_limit::Real
:convergence_limit
times the bias voltage sets the convergence limit of the relaxation. The convergence value is the absolute maximum difference of the potential between two iterations of all grid points. Default ofconvergence_limit
is1e-7
(times bias voltage).refinement_limits
: Defines the maximum relative (to applied bias voltage) allowed differences of the potential value of neighbored grid points in each dimension for each refinement.rl::Real
-> One refinement withrl
equal in all 3 dimensions.rl::Tuple{<:Real,<:Real,<:Real}
-> One refinement withrl
set individual for each dimension.rl::Vector{<:Real}
->length(l)
refinements withrl[i]
being the limit for the i-th refinement.rl::Vector{<:Real,<:Real,<:Real}}
->length(rl)
refinements withrl[i]
being the limits for thei
-th refinement.
min_tick_distance::Tuple{<:Quantity, <:Quantity, <:Quantity}
: Tuple of the minimum allowed distance between two grid ticks for each dimension. It prevents the refinement to make the grid too fine. Default is1e-5
for linear axes and1e-5 / (0.25 * r_max)
for the polar axis in case of a cylindricalgrid
.max_tick_distance::Tuple{<:Quantity, <:Quantity, <:Quantity}
: Tuple of the maximum allowed distance between two grid ticks for each dimension used in the initialization of the grid. Default is 1/4 of size of the world of the respective dimension.max_distance_ratio::Real
: Maximum allowed ratio between the two distances in any dimension to the two neighbouring grid points. If the ratio is too large, additional ticks are generated such that the new ratios are smaller thanmax_distance_ratio
. Default is5
.grid::Grid
: Initial grid used to start the simulation. Default isGrid(sim)
.depletion_handling::Bool
: Enables the handling of undepleted regions. Default isfalse
.use_nthreads::Union{Int, Vector{Int}}
: If<:Int
,use_nthreads
defines the maximum number of threads to be used in the computation. Fewer threads might be used depending on the current grid size due to threading overhead. Default isBase.Threads.nthreads()
. If<:Vector{Int}
,use_nthreads[i]
defines the number of threads used for each grid (refinement) stage of the field simulation. The environment variableJULIA_NUM_THREADS
must be set appropriately before the Julia session was started (e.g.export JULIA_NUM_THREADS=8
in case of bash).sor_consts::Union{<:Real, NTuple{2, <:Real}}
: Two element tuple in case of cylindrical coordinates. First element contains the SOR constant forr
= 0. Second contains the constant at the outer most grid point inr
. A linear scaling is applied in between. First element should be smaller than the second one and both should be∈ [1.0, 2.0]
. Default is[1.4, 1.85]
. In case of Cartesian coordinates, only one value is taken.max_n_iterations::Int
: Set the maximum number of iterations which are performed after each grid refinement. Default is10000
. If set to-1
there will be no limit.not_only_paint_contacts::Bool = true
: Whether to only use the painting algorithm of the surfaces ofContact
without checking if points are actually inside them. Setting it tofalse
should improve the performance but the points inside ofContact
are not fixed anymore.paint_contacts::Bool = true
: Enable or disable the painting of the surfaces of theContact
onto thegrid
.verbose::Bool=true
: Boolean whether info output is produced or not.
Example
calculate_electric_potential!(sim, refinement_limits = [0.3, 0.1, 0.05], max_distance_ratio = 4, max_n_iterations = 20000)
SolidStateDetectors.calculate_mutual_capacitance
— Methodcalculate_mutual_capacitance(sim::Simulation, ij::Tuple{Int, Int}; consider_multiplicity::Bool = true)
Returns the mutual capacitance between the contacts with ID i = ij[1]
and j = ij[2]
. It is calculated via the weighting potentials of the contacts, $\Phi_i^w(\vec{r})$ and $\Phi_j^w(\vec{r})$:
\[c_{ij} = \epsilon_0 \int_{World} \nabla \Phi_i^w(\vec{r}) ϵ_r(\vec{r}) \nabla \Phi_j^w(\vec{r}) d\vec{r}\]
These are elements of the Mawell Capcitance Matrix. Look up Capacitances for more information.
The electric potential as well as the two weighting potentials of both contacts have to be calculated.
Arguments
sim::Simulation
:Simulation
for which the capacitance matrix is calculated.ij::Tuple{Int,Int}
: Tuple of indices of the contacts for which the capacitance should be calculated.
Keywords
consider_multiplicity::Bool = true
: Whether symmetries of the system should be taken into account. For example, in case of true coaxial detector center around the origin and calculated on a cartesian grid with thex-axis
going from[0, x_max]
and they-axis
going from[0, y_max]
the multiplicity is 4 and, ifconsider_multiplicity == true
, the returned value is already multiplied by 4.
SolidStateDetectors.calculate_stored_energy
— Methodcalculate_stored_energy(sim::Simulation; consider_multiplicity::Bool = true)
Calculates and returns the energy stored in the ElectricField
of a SolidStateDetector
in a given Simulation
in units of J.
Arguments
sim::Simulation{T}
:Simulation
withsim.detector
for which the stored energy is calculated.
Keywords
consider_multiplicity::Bool = true
: Whether symmetries of the system should be taken into account. For example, in case of true coaxial detector center around the origin and calculated on a cartesian grid with thex-axis
going from[0, x_max]
and they-axis
going from[0, y_max]
the multiplicity is 4 and, ifconsider_multiplicity == true
, the returned value is already multiplied by 4.
SolidStateDetectors.calculate_weighting_potential!
— Methodcalculate_weighting_potential!(sim::Simulation{T}, contact_id::Int; kwargs...)::Nothing
Calculates the WeightingPotential
for a Contact
with contact_id
given Simulation
sim
on an adaptive grid through successive over relaxation and stores it in sim.weighting_potentials[contact_id]
.
There are several keyword arguments which can be used to tune the calculation.
Keywords
convergence_limit::Real
:convergence_limit
sets the convergence limit of the relaxation. The convergence value is the absolute maximum difference of the potential between two iterations of all grid points. Default ofconvergence_limit
is1e-7
.refinement_limits
: Defines the maximum relative allowed differences of the potential value of neighbored grid points in each dimension for each refinement.rl::Real
-> One refinement withrl
equal in all 3 dimensions.rl::Tuple{<:Real,<:Real,<:Real}
-> One refinement withrl
set individual for each dimension.rl::Vector{<:Real}
->length(l)
refinements withrl[i]
being the limit for the i-th refinement.rl::Vector{<:Real,<:Real,<:Real}}
->length(rl)
refinements withrl[i]
being the limits for thei
-th refinement.
min_tick_distance::Tuple{<:Quantity, <:Quantity, <:Quantity}
: Tuple of the minimum allowed distance between two grid ticks for each dimension. It prevents the refinement to make the grid too fine. Default is1e-5
for linear axes and1e-5 / (0.25 * r_max)
for the polar axis in case of a cylindricalgrid
.max_tick_distance::Tuple{<:Quantity, <:Quantity, <:Quantity}
: Tuple of the maximum allowed distance between two grid ticks for each dimension used in the initialization of the grid. Default is 1/4 of size of the world of the respective dimension.max_distance_ratio::Real
: Maximum allowed ratio between the two distances in any dimension to the two neighbouring grid points. If the ratio is too large, additional ticks are generated such that the new ratios are smaller thanmax_distance_ratio
. Default is5
.grid::Grid
: Initial grid used to start the simulation. Default isGrid(sim)
.depletion_handling::Bool
: Enables the handling of undepleted regions. Default isfalse
. This is an experimental feature: In undepleted regions (determined incalculate_electric_potential!(sim; depletion_handling = true)
), the dielectric permittivity of the semiconductor is scaled up to mimic conductive behavior. The scale factor can be tuned via the functionscaling_factor_for_permittivity_in_undepleted_region
.use_nthreads::Union{Int, Vector{Int}}
: If<:Int
,use_nthreads
defines the maximum number of threads to be used in the computation. Fewer threads might be used depending on the current grid size due to threading overhead. Default isBase.Threads.nthreads()
. If<:Vector{Int}
,use_nthreads[i]
defines the number of threads used for each grid (refinement) stage of the field simulation. The environment variableJULIA_NUM_THREADS
must be set appropriately before the Julia session was started (e.g.export JULIA_NUM_THREADS=8
in case of bash).sor_consts::Union{<:Real, NTuple{2, <:Real}}
: Two element tuple in case of cylindrical coordinates. First element contains the SOR constant forr
= 0. Second contains the constant at the outer most grid point inr
. A linear scaling is applied in between. First element should be smaller than the second one and both should be∈ [1.0, 2.0]
. Default is[1.4, 1.85]
. In case of Cartesian coordinates, only one value is taken.max_n_iterations::Int
: Set the maximum number of iterations which are performed after each grid refinement. Default is10000
. If set to-1
there will be no limit.not_only_paint_contacts::Bool = true
: Whether to only use the painting algorithm of the surfaces ofContact
without checking if points are actually inside them. Setting it tofalse
should improve the performance but the points inside ofContact
are not fixed anymore.paint_contacts::Bool = true
: Enable or disable the painting of the surfaces of theContact
onto thegrid
.verbose::Bool=true
: Boolean whether info output is produced or not.
Example
calculate_weighting_potential!(sim, 1, refinement_limits = [0.3, 0.1, 0.05], max_distance_ratio = 4, max_n_iterations = 20000)
SolidStateDetectors.drift_charges!
— Methoddrift_charges!(evt::Event{T}, sim::Simulation{T}; kwargs...)::Nothing where {T <: SSDFloat}
Calculates the electron and hole drift paths for the given Event
and Simulation
and stores them in evt.drift_paths
.
Arguments
evt::Event{T}
:Event
for which the charges should be drifted.sim::Simulation{T}
:Simulation
which defines the setup in which the charges inevt
should drift.
Keywords
max_nsteps::Int = 1000
: Maximum number of steps in the drift of each hit.Δt::RealQuantity = 5u"ns"
: Time step used for the drift.diffusion::Bool = false
: Activate or deactive diffusion of charge carriers via random walk.self_repulsion::Bool = false
: Activate or deactive self-repulsion of charge carriers of the same type.verbose = true
: Activate or deactivate additional info output.
Example
drift_charges!(evt, sim, Δt = 1u"ns", verbose = false)
Using values with units for Δt
requires the package Unitful.jl.
SolidStateDetectors.estimate_depletion_voltage
— Methodestimate_depletion_voltage(sim::Simulation{T},
Umin::T = minimum(broadcast(c -> c.potential, sim.detector.contacts)),
Umax::T = maximum(broadcast(c -> c.potential, sim.detector.contacts));
contact_id::Int = determine_bias_voltage_contact_id(sim.detector),
tolerance::AbstractFloat = 1e-1,
verbose::Bool = true) where {T <: AbstractFloat}
Estimates the potential needed to fully deplete the detector in a given Simulation
at the Contact
with id contact_id
by bisection method. The default contact_id
is determined automatically via determine_bias_voltage_contact_id(sim.detector)
. The default searching range of potentials is set by the extrema of contact potentials.
Arguments
sim::Simulation{T}
:Simulation
for which the depletion voltage should be determined.Umin::T
: The minimum value of the searching range.Umax::T
: The maximum value of the searching range.
Keywords
contact_id::Int
: Theid
of theContact
at which the potential is applied.tolerance::AbstractFloat
: The acceptable accuracy of results. Default is 1e-1.verbose::Bool = true
: Activate or deactivate additional info output. Default istrue
.
Example
using SolidStateDetectors
sim = Simulation(SSD_examples[:InvertedCoax])
calculate_electric_potential!(sim)
estimate_depletion_voltage(sim)
The accuracy of the result depends on the precision of the initial simulation.
This function performs two 2D or 3D field calculations, depending on sim
.
Thus, keep in mind that is might consume some memory.
See also is_depleted
.
SolidStateDetectors.get_active_volume
— Methodget_active_volume(point_types::PointTypes{T}) where {T}
Returns an approximation of the active volume of the detector by summing up the cell volumes of all cells marked as depleted.
Arguments
point_types::PointTypes{T}
: Point types of aSimulation
.
Examples
get_active_volume(sim.point_types)
Only φ
-symmetries are taken into account.
SolidStateDetectors.get_charge_density
— Functionget_charge_density(cd::AbstractChargeDensity, pt::AbstractCoordinatePoint)
Returns the charge density at a given point, pt
, based on the charge density model cd
.
Arguments
cd::AbstractChargeDensity
: TheAbstractChargeDensity
defining the charge density inside aPassive
.pt::AbstractCoordinatePoint
: The point at whichcd
is to be evaluated.
The value returned by get_charge_density
is in units of C/m³ (SI units).
SolidStateDetectors.get_electron_and_hole_contribution
— Methodget_electron_and_hole_contribution(evt::Event{T}, sim::Simulation{T}, contact_id::Int)
Returns the electron and hole contribution to the waveform of a Contact
with a given contact_id
of an Event
as a NamedTuple
with two entries: electron_contribution
and hole_contribution
.
Arguments
evt::Event{T}
:Event
in which the charges have already been drifted.sim::Simulation{T}
:Simulation
which defines the setup in which the charges inevt
were drifted.contact_id::Int
: Theid
of theContact
for which the waveform should be split into electron and hole contribution.
Example
using Plots
using SolidStateDetector
T = Float32
simulation = Simulation{T}(SSD_examples[:InvertedCoax])
simulate!(simulation)
event = Event([CartesianPoint{T}(0.02,0.01,0.05)])
simulate!(event, simulation)
contact_id = 1
wf = get_electron_and_hole_contribution(evt, sim, contact_id)
The drift paths in evt
need to be calculated using drift_charges!
before calling this function.
See also plot_electron_and_hole_contribution
.
SolidStateDetectors.get_impurity_density
— Functionget_impurity_density(id::AbstractImpurityDensity, pt::AbstractCoordinatePoint)
Returns the impurity density at a given point, pt
, based on the impurity density model id
.
Arguments
id::AbstractImpurityDensity
: TheAbstractImpurityDensity
defining the impurity density inside aSemiconductor
.pt::AbstractCoordinatePoint
: The point at whichid
is to be evaluated.
The value returned by get_impurity_density
is in units of 1/m³ (SI Units).
SolidStateDetectors.get_path_to_example_config_files
— Methodget_path_to_example_config_files()::String
Returns the path to the example detector configuration files provided by the package.
See also SSD_examples
.
SolidStateDetectors.get_signals!
— Methodget_signals!(evt::Event{T}, sim::Simulation{T}; Δt::RealQuantity = 5u"ns")::Nothing where {T <: SSDFloat}
Generates the signals/waveforms from the drift paths of an Event
for each Contact
, for which a WeightingPotential
is specified in sim.weighting_potentials
.
The output is stored in evt.waveforms
.
Arguments
evt::Event{T}
:Event
for which the waveforms should be generated.sim::Simulation{T}
:Simulation
which defines the setup in which the waveforms are generated.
Keywords
Δt::RealQuantity = 5u"ns"
: Time steps with which the drift paths were calculated.
Example
get_signals!(evt, sim, Δt = 1u"ns") # if evt.drift_paths were calculated in time steps of 1ns
This method only works if evt.drift_paths
has already been calculated and is not missing
.
SolidStateDetectors.get_sor_kernel
— Methodfunction get_sor_kernel(::Type{S}, args...)
where S is either Cartesian or Cylindrical.
Developer notes: Currently (February 2022), there are some limitations to the @kernel
macro of the package KernelAbstractions.jl. Especially, regarding usage of dispatch.
Thus, we have to write two kernel functions right now for the Cartesian & Cylindrical case: sor_cyl_gpu!
and sor_car_gpu!
.
Inside kernel functions, everything is (and has to be) inlined and we can make use of multiple dispatch. So in the end we only have to write one function for the kernel, sor_kernel
, which is then inlined inside the two kernel functions.
We can also use most of the CPU functions with the restriction that all types have to be independent on the GPU-indices of the kernel. E.g., making use of i23_is_even_t = Val(iseven(i2 + i3))
and other similar statements is not possible, which are used in the CPU implementation for optimization. On the GPU (currently) those statements have to be calculated and booleans have to be passed. Maybe this will change in the future.
SolidStateDetectors.get_ticks_at_positions_of_edge_of_depleted_volumes
— Methodget_ticks_at_positions_of_edge_of_depleted_volumes(impscale::ImpurityScale{T, 3})
The impurity scale field is analyzed in order to find and return ticks where the gradient is strong, which is the case at the surface of the depleted volume of a semiconductor.
SolidStateDetectors.get_ticks_at_positions_of_large_gradient
— Methodget_ticks_at_positions_of_large_gradient(epot::ElectricPotential)
The electric potential is analyzed in order to find and return ticks where the gradient (electric field) is strong (relativ to its maximum).
In the 1D case of a pn-junction, the electric field strength is the largest at the position of the pn-junction. Thus, this function is likely to return ticks which are located close to the pn-junction of a semiconductor.
SolidStateDetectors.handle_depletion
— Methodfunction handle_depletion(
new_potential::T,
imp_scale::T,
neighbor_potentials::NTuple{6,T},
q_eff_imp::T,
volume_weight::T,
)::Tuple{T, PointType} where {T}
This function handles the grid points with volumes which are not fully depleted. The decision depends on the proposal for the new potential value, new_potential_proposal
, for the respective grid point in that iteration and the potential values of the neighboring grid points, neighbor_potentials
.
If vmin = minimum(neighbor_potentials) < new_potential_proposal < vmax = maximum(neighbor_potentials)
=> fully depleted => imp_scale = 1
If it undershoots or overshoots, the impurity density in the grid point is scaled down via reducing imp_scale ∈ [0, 1]
of this grid point.
This decision is based on the fact that the potential inside a solid-state detector increases monotonically from a p+
-contact towards an n+
-contact. Thus, there cannot be local extrema.
If a fixed charge impurity is present, e.g. due to a charged passivated surface, this handling is probably not valid anymore as the potential between a p+
-contact towards an n+
-contact is not required to change monotonically anymore.
SolidStateDetectors.is_depleted
— Methodis_depleted(point_types::PointTypes)::Bool
Returns true
if all PointType
values of the PointTypes
of a Simulation
are marked as depleted and false
if any point in the PointTypes
is marked as undepleted.
It can be used to determine whether the SolidStateDetector
is depleted at the provided bias voltage.
Arguments
point_types::PointTypes
:PointTypes
of aSimulation
.
Examples
is_depleted(sim.point_types)
SolidStateDetectors.merge_second_order_important_ticks
— Methodmerge_second_order_important_ticks(imp::Vector{T}, imp_second_order::Vector{T}; min_diff::T = T(1e-6)) where {T}
Merge all elements of the second vector, imp_second_order
, into the first vector, imp
, if they are not too close (via min_diff
) to elements of the first vector. Returns the merged vector sorted.
SolidStateDetectors.parse_config_file
— Methodparse_config_file(filename::AbstractString; dicttype::Type = Dict)::dicttype
Reads in a configuration file and returns a parsed dictionary which holds all the information specified in the configuration file.
Find detailed information on configuration files in Configuration Files.
Arguments
filename::AbstractString
: File name of the configuration file. If the file is not in the same directory, a path to the file is required.
Keywords
dicttype::Type
: Type of the dictionary returned.
SolidStateDetectors.plot_electron_and_hole_contribution
— Functionplot_electron_and_hole_contribution(evt::Event{T}, sim::Simulation{T}, contact_id::Int)
Plots the waveform as well as the electron and hole contribution to the waveform of a Contact
with a given contact_id
of an Event
.
Arguments
evt::Event{T}
:Event
in which the charges have already been drifted.sim::Simulation{T}
:Simulation
which defines the setup in which the charges inevt
were drifted.contact_id::Int
: Theid
of theContact
for which the waveform should be split into electron and hole contribution.
Keywords
n_samples::Int
: Number of samples with which the waveforms will be plotted. The default is the number of samples of the original waveform.
Example
using Plots
using SolidStateDetector
T = Float32
simulation = Simulation{T}(SSD_examples[:InvertedCoax])
simulate!(simulation)
event = Event([CartesianPoint{T}(0.02,0.01,0.05)])
simulate!(event, simulation)
contact_id = 1
plot_electron_and_hole_contribution(evt, sim, contact_id, n_samples = 300)
The drift paths in evt
need to be calculated using drift_charges!
before calling this function.
This method requires to load the package Plots.jl.
See also get_electron_and_hole_contribution
.
SolidStateDetectors.readsiggen
— Methodreadsiggen(file_path::String; T::Type)
Reads a SigGen configuration file (ending in .config
) in 'file_path' and returns a dictionary of all parameters. Non-existing parameteres are set to 0
.
Arguments
file_path::String
: File path leading to the SigGen configuration file.
Keywords
T::Type
: Type of the parameters in the output dictionary. Default isFloat64
.
SolidStateDetectors.refine!
— Methodrefine!(sim::Simulation{T}, ::Type{ElectricPotential}, max_diffs::Tuple, minimum_distances::Tuple, kwargs...)
Takes the current state of sim.electric_potential
and refines it with respect to the input arguments max_diffs
and minimum_distances
by
- extending the
grid
ofsim.electric_potential
to be a closed grid in all dimensions, - refining the axis of the grid based on
max_diffs
andminimum_distances
: Insert new ticks between two existing ticks such that the potential difference between each tick becomes smaller thanmax_diff[i]
(i
-> dimension) but that the distances between the ticks stays larger thanminimum_distances[i]
, and - creating the new data array for the refined grid and fill it by interpolation of the the initial
grid
.
Arguments
sim::Simulation{T}
:Simulation
for whichsim.electric_potential
will be refined.max_diffs::Tuple{<:Real,<:Real,<:Real}
: Maximum potential difference between two discrete ticks ofsim.electric_potential.grid
after refinement.minimum_distances::Tuple{<:Real,<:Real,<:Real}
: Minimum distance (in SI Units) between two discrete ticks ofsim.electric_potential.grid
after refinement.
Examples
SolidStateDetectors.refine!(sim, ElectricPotential, max_diffs = (100, 100, 100), minimum_distances = (0.01, 0.02, 0.01))
SolidStateDetectors.refine!
— Methodrefine!(sim::Simulation{T}, ::Type{WeightingPotential}, max_diffs::Tuple{<:Real,<:Real,<:Real}, minimum_distances::Tuple{<:Real,<:Real,<:Real})
Takes the current state of sim.weighting_potentials[contact_id]
and refines it with respect to the input arguments max_diffs
and minimum_distances
by
- extending the
grid
ofsim.weighting_potentials[contact_id]
to be a closed grid in all dimensions, - refining the axis of the grid based on
max_diffs
andminimum_distances
: Insert new ticks between two existing ticks such that the potential difference between each tick becomes smaller thanmax_diff[i]
(i
-> dimension) but that the distances between the ticks stays larger thanminimum_distances[i]
, and - creating the new data array for the refined grid and fill it by interpolation of the the initial
grid
.
Arguments
sim::Simulation{T}
:Simulation
for whichsim.weighting_potentials[contact_id]
will be refined.contact_id::Int
: Theid
of theContact
for which theWeightingPotential
is refined.max_diffs::Tuple{<:Real,<:Real,<:Real}
: Maximum potential difference between two discrete ticks ofsim.weighting_potentials[contact_id].grid
after refinement.minimum_distances::Tuple{<:Real,<:Real,<:Real}
: Minimum distance (in SI Units) between two discrete ticks ofsim.weighting_potentials[contact_id].grid
after refinement.
Examples
SolidStateDetectors.refine!(sim, WeightingPotential, 1, max_diffs = (0.01, 0.01, 0.01), minimum_distances = (0.01, 0.02, 0.01))
SolidStateDetectors.run_geant4_simulation
— Functionrun_geant4_simulation(app::Geant4.G4JLApplication, number_of_events::Int; energy_threshold::Unitful.Energy)
Simulates the given Geant4.G4JLApplication
until number_of_events
events with non-zero energy depositions have been generated.
Arguments
app::Geant4.G4JLApplication
: Contains information about the detector setup and the particle source.number_of_events::Int
: The amount of events inside of the detector that should be recorded.
Keywords
energy_threshold::Unitful.Energy
: Defines a lower threshold on the summed energy of an event to be recorded. Default iseps(Float64)*u"keV"
, i.e. all events with non-zero deposits are recorded. If set to0u"keV"
, all primary events will be recorded.
Examples
run_geant4_simulation(app, 1000)
# => returns all events in a `TypedTables.Table` with the fields `evtno`, `detno`, `thit, `edep` and `pos`
Since the function is running until enough events have been collected, setups in which the source does not irradiate the detector will run indefinitely.
SolidStateDetectors.scaling_factor_for_permittivity_in_undepleted_region
— Methodscaling_factor_for_permittivity_in_undepleted_region(sc::Semiconductor{T})::T where {T}
This function is called in the calculations of weighting potentials of undepleted detectors. The electric permittivity, $ϵ_{r}$, is scaled with this function in areas where the detector is undepleted. A value between [0, +Inf]
should be returned. However, Inf
should not be returned but instead a very high value should be returned in order to mimic perfect conductivity if that is desired.
Arguments
sc::Semiconductor{T}
: Semiconductor for which the dielectric permittivity should be scaled up.
This feature is under research. The goal is to study the properties / signal response of undepleted detector. This function is indented to be overwritten by the user to study the response.
SolidStateDetectors.siggentodict
— Methodsiggentodict(config::AbstractDict; dicttype::Type, units::AbstractDict)
Converts the dictionary containing the parameters from a SigGen configuration file to a dictionary that can be understood by SolidStateDetectors.jl.
Arguments
config::AbstractDict
: Dictionary containing SigGen parameters (output ofreadsiggen()
`).
Keywords
dicttype::Type
: Type of the dictionary returned.units::AbstractDict
: Units used in SigGen configuration file (set to"mm"
,"deg"
,"V"
and"K"
). The dictionary needs the fields"length"
,"angle"
,"potential"
and"temperature"
.
SolidStateDetectors.simulate!
— Methodsimulate!( sim::Simulation{T}; kwargs...) where {T, S}
Performs a full chain simulation for a given Simulation
by
- calculating the
ElectricPotential
, - calculating the
ElectricField
, - calculating the
WeightingPotential
for eachContact
.
The output is stored in sim.electric_potential
, sim.electric_field
and sim.weighting_potentials
, respectively.
There are several keyword arguments which can be used to tune the simulation.
Arguments
sim::Simulation{T}
:Simulation
for which the full chain simulation should be performed.
Keywords
convergence_limit::Real
:convergence_limit
times the bias voltage sets the convergence limit of the relaxation. The convergence value is the absolute maximum difference of the potential between two iterations of all grid points. Default ofconvergence_limit
is1e-7
(times bias voltage).refinement_limits
: Defines the maximum relative (to applied bias voltage) allowed differences of the potential value of neighboured grid points in each dimension for each refinement.rl::Real
-> One refinement withrl
equal in all 3 dimensions.rl::Tuple{<:Real,<:Real,<:Real}
-> One refinement withrl
set individual for each dimension.rl::Vector{<:Real}
->length(l)
refinements withrl[i]
being the limit for the i-th refinement.rl::Vector{<:Real,<:Real,<:Real}}
->length(rl)
refinements withrl[i]
being the limits for thei
-th refinement.
min_tick_distance::Tuple{<:Quantity, <:Quantity, <:Quantity}
: Tuple of the minimum allowed distance between two grid ticks for each dimension. It prevents the refinement to make the grid too fine. Default is1e-5
for linear axes and1e-5 / (0.25 * r_max)
for the polar axis in case of a cylindricalgrid
.max_tick_distance::Tuple{<:Quantity, <:Quantity, <:Quantity}
: Tuple of the maximum allowed distance between two grid ticks for each dimension used in the initialization of the grid. Default is 1/4 of size of the world of the respective dimension.max_distance_ratio::Real
: Maximum allowed ratio between the two distances in any dimension to the two neighbouring grid points. If the ratio is too large, additional ticks are generated such that the new ratios are smaller thanmax_distance_ratio
. Default is5
.depletion_handling::Bool
: Enables the handling of undepleted regions. Default isfalse
.use_nthreads::Int
: Number of threads to use in the computation. Default isBase.Threads.nthreads()
. The environment variableJULIA_NUM_THREADS
must be set appropriately before the Julia session was started (e.g.export JULIA_NUM_THREADS=8
in case of bash).sor_consts::Union{<:Real, NTuple{2, <:Real}}
: Two element tuple in case of cylindrical coordinates. First element contains the SOR constant forr
= 0. Second contains the constant at the outer most grid point inr
. A linear scaling is applied in between. First element should be smaller than the second one and both should be∈ [1.0, 2.0]
. Default is[1.4, 1.85]
. In case of Cartesian coordinates, only one value is taken.max_n_iterations::Int
: Set the maximum number of iterations which are performed after each grid refinement. Default is10000
. If set to-1
there will be no limit.not_only_paint_contacts::Bool = true
: Whether to only use the painting algorithm of the surfaces ofContact
without checking if points are actually inside them. Setting it tofalse
should improve the performance but the points inside ofContact
are not fixed anymore.paint_contacts::Bool = true
: Enable or disable the painting of the surfaces of theContact
onto thegrid
.verbose::Bool=true
: Boolean whether info output is produced or not.
See also calculate_electric_potential!
, calculate_electric_field!
and calculate_weighting_potential!
.
Example
simulate!(sim, refinement_limits = [0.3, 0.1, 0.05], max_distance_ratio = 4, max_n_iterations = 20000)
SolidStateDetectors.simulate!
— Methodsimulate!(evt::Event{T}, sim::Simulation{T}; kwargs...)::Nothing where {T <: SSDFloat}
Simulates the waveforms for the Event
for a given Simulation
by
- calculating the drift paths of all energy hits, at
evt.locations
and - generating the waveforms for each
Contact
, for which aWeightingPotential
is specified insim.weighting_potentials
.
The output is stored in evt.drift_paths
and evt.waveforms
.
Arguments
evt::Event{T}
:Event
for which the charges should be drifted.sim::Simulation{T}
:Simulation
which defines the setup in which the charges inevt
should drift.
Keywords
max_nsteps::Int = 1000
: Maximum number of steps in the drift of each hit.Δt::RealQuantity = 5u"ns"
: Time step used for the drift.diffusion::Bool = false
: Activate or deactive diffusion of charge carriers via random walk.self_repulsion::Bool = false
: Activate or deactive self-repulsion of charge carriers of the same type.verbose = true
: Activate or deactivate additional info output.
Example
simulate!(evt, sim, Δt = 1u"ns", verbose = false)
See also drift_charges!
and get_signals!
.
SolidStateDetectors.simulate_waveforms
— Methodsimulate_waveforms( mcevents::TypedTables.Table, sim::Simulation{T}; kwargs...)
simulate_waveforms( mcevents::TypedTables.Table, sim::Simulation{T}, output_dir::AbstractString, output_base_name::AbstractString; kwargs...)
Simulates the waveforms for all events defined in mcevents
for a given Simulation
by
- calculating the drift paths of all energy hits defined in
mcevents
, - determining the signal (waveforms) for each
Contact
, for which aWeightingPotential
is specified insim.weighting_potentials
.
Arguments
mcevents::TypedTables.Table
: Table with information about events in the simulated setup.sim::Simulation{T}
:Simulation
which defines the setup in which the charges inmcevents
should drift.
If LegendHDF5IO.jl is loaded, this function has additional arguments.
Additional Arguments (LegendHDF5IO
)
output_dir::AbstractString
: Directory where the HDF5 output file is saved.output_base_name::AbstractString
: Basename of the HDF5 output file, default is"generated_waveforms"
.
Keywords
max_nsteps::Int = 1000
: Maximum number of steps in the drift of each hit.Δt::RealQuantity = 4u"ns"
: Time step used for the drift.diffusion::Bool = false
: Activate or deactive diffusion of charge carriers via random walk.self_repulsion::Bool = false
: Activate or deactive self-repulsion of charge carriers of the same type.number_of_carriers::Int = 1
: Number of charge carriers to be used in the N-Body simulation of an energy deposition.number_of_shells::Int = 1
: Number of shells around thecenter
point of the energy deposition.verbose = false
: Activate or deactivate additional info output.chunk_n_physics_events::Int = 1000
(LegendHDF5IO
only): Number of events that should be saved in a single HDF5 output file.
Examples
simulate_waveforms(mcevents, sim, Δt = 1u"ns", verbose = false)
# => returns the input table `mcevents` with an additional column `waveform` in which the generated waveforms are stored
using LegendHDF5IO
simulate_waveforms(mcevents, sim, "output_dir", "my_basename", Δt = 1u"ns", verbose = false)
# => simulates the charge drift and saves the output to "output_dir/my_basename_evts_xx.h5"
The drift paths are just calculated temporarily and not returned.
Using values with units for Δt
requires the package Unitful.jl.
SolidStateDetectors.ssd_read
— Functionssd_read(filename::AbstractString, ::Type{Simulation})
Reads a Simulation
from a HDF5 file with a given filename
using LegendHDF5IO.jl.
Arguments
filename::AbstractString
: Filename of the HDF5 file.
Example
using SolidStateDetectors
using LegendHDF5IO
sim = ssd_read("example_sim.h5", Simulation)
In order to use this method, the package LegendHDF5IO.jl has to be loaded after loading SolidStateDetectors.jl.
See also ssd_write
.
SolidStateDetectors.ssd_write
— Functionssd_write(filename::AbstractString, sim::Simulation)
Converts a Simulation
to a NamedTuple
and writes it to a HDF5 file with a given filename
using LegendHDF5IO.jl.
Arguments
filename::AbstractString
: Filename of the HDF5 file.sim::Simulation
:Simulation
that should be written to the HDF5 file.
Example
using SolidStateDetectors
using LegendHDF5IO
sim = Simulation(SSD_examples[:InvertedCoax])
simulate!(sim)
ssd_write("example_sim.h5", sim)
If a file with filename
already exists, it will be overwritten by this method.
In order to use this method, the package LegendHDF5IO.jl has to be loaded after loading SolidStateDetectors.jl.
See also ssd_read
.
SolidStateDetectors.update!
— Methodfunction update!(
pcs::PotentialCalculationSetup{T};
::Nothing, # these two unused arguments are used such that the method
::Any; # is similar to the GPU method for it.
use_nthreads::Int = Base.Threads.nthreads(),
depletion_handling::Val{depletion_handling_enabled} = Val{false}(),
is_weighting_potential::Val{_is_weighting_potential} = Val{false}(),
only2d::Val{only_2d} = Val{false}()
)::Nothing where {T, depletionhandlingenabled, only2d, _isweighting_potential}
This function performs one iteration of the SOR. One iteration consists out of 4 steps:
1) Iterate in parallel over all even points and update their potential.
2) Apply the boundary conditions at the ends of the grid for all even points.
3) Iterate in parallel over all odd points and update their potential.
4) Apply the boundary conditions at the ends of the grid for all odd points.
SolidStateDetectors.update_till_convergence!
— Methodupdate_till_convergence!( sim::Simulation{T} ::Type{ElectricPotential}, convergence_limit::Real; kwargs...)::T
Takes the current state of sim.electric_potential
and updates it until it has converged.
There are several keyword arguments which can be used to tune the simulation.
Arguments
sim::Simulation{T}
:Simulation
for whichsim.electric_potential
will be updated.convergence_limit::Real
:convergence_limit
times the bias voltage sets the convergence limit of the relaxation. The convergence value is the absolute maximum difference of the potential between two iterations of all grid points. Default is1e-7
.
Keywords
n_iterations_between_checks::Int
: Number of iterations between checks. Default is set to500
.max_n_iterations::Int
: Set the maximum number of iterations which are performed after each grid refinement. Default is-1
. If set to-1
there will be no limit.depletion_handling::Bool
: Enables the handling of undepleted regions. Default isfalse
.use_nthreads::Int
: Number of threads to use in the computation. Default isBase.Threads.nthreads()
. The environment variableJULIA_NUM_THREADS
must be set appropriately before the Julia session was started (e.g.export JULIA_NUM_THREADS=8
in case of bash).not_only_paint_contacts::Bool = true
: Whether to only use the painting algorithm of the surfaces ofContact
without checking if points are actually inside them. Setting it tofalse
should improve the performance but the points inside ofContact
are not fixed anymore.paint_contacts::Bool = true
: Enable or disable the painting of the surfaces of theContact
onto thegrid
.sor_consts::Union{<:Real, NTuple{2, <:Real}}
: Two element tuple in case of cylindrical coordinates. First element contains the SOR constant forr
= 0. Second contains the constant at the outer most grid point inr
. A linear scaling is applied in between. First element should be smaller than the second one and both should be∈ [1.0, 2.0]
. Default is[1.4, 1.85]
. In case of Cartesian coordinates, only one value is taken.verbose::Bool=true
: Boolean whether info output is produced or not.
Example
SolidStateDetectors.update_till_convergence!(sim, ElectricPotential, 1e-6, depletion_handling = true)
SolidStateDetectors.update_till_convergence!
— Methodupdate_till_convergence!( sim::Simulation{T} ::Type{WeightingPotential}, contact_id::Int, convergence_limit::Real; kwargs...)::T
Takes the current state of sim.weighting_potentials[contact_id]
and updates it until it has converged.
There are several keyword arguments which can be used to tune the simulation.
Arguments
sim::Simulation{T}
:Simulation
for whichsim.weighting_potentials[contact_id]
will be updated.contact_id::Int
: Theid
of theContact
for which theWeightingPotential
is to be calculated.convergence_limit::Real
:convergence_limit
times the bias voltage sets the convergence limit of the relaxation. The convergence value is the absolute maximum difference of the potential between two iterations of all grid points. Default is1e-7
.
Keywords
n_iterations_between_checks::Int
: Number of iterations between checks. Default is set to500
.max_n_iterations::Int
: Set the maximum number of iterations which are performed after each grid refinement. Default is-1
. If set to-1
there will be no limit.depletion_handling::Bool
: Enables the handling of undepleted regions. Default isfalse
. This is an experimental feature: In undepleted regions (determined incalculate_electric_potential!(sim; depletion_handling = true)
), the dielectric permittivity of the semiconductor is scaled up to mimic conductive behavior. The scale factor can be tuned via the functionscaling_factor_for_permittivity_in_undepleted_region
.use_nthreads::Int
: Number of threads to use in the computation. Default isBase.Threads.nthreads()
. The environment variableJULIA_NUM_THREADS
must be set appropriately before the Julia session was started (e.g.export JULIA_NUM_THREADS=8
in case of bash).not_only_paint_contacts::Bool = true
: Whether to only use the painting algorithm of the surfaces ofContact
without checking if points are actually inside them. Setting it tofalse
should improve the performance but the points inside ofContact
are not fixed anymore.paint_contacts::Bool = true
: Enable or disable the painting of the surfaces of theContact
onto thegrid
.sor_consts::Union{<:Real, NTuple{2, <:Real}}
: Two element tuple in case of cylindrical coordinates. First element contains the SOR constant forr
= 0. Second contains the constant at the outer most grid point inr
. A linear scaling is applied in between. First element should be smaller than the second one and both should be∈ [1.0, 2.0]
. Default is[1.4, 1.85]
. In case of Cartesian coordinates, only one value is taken.verbose::Bool=true
: Boolean whether info output is produced or not.
Example
SolidStateDetectors.update_till_convergence!(sim, WeightingPotential, 1, 1e-6, use_nthreads = 4)
SolidStateDetectors.ConstructiveSolidGeometry.Box
— Typestruct Box{T, CO} <: AbstractVolumePrimitive{T}
Volume primitive describing a three-dimensional Box with its surfaces being parallel to the xy
, xy
and yz
plane.
Parametric types
T
: Precision type.CO
: Describes whether the surface belongs to the primitive. It can beClosedPrimitive
, i.e. the surface points belong to the primitive, orOpenPrimitive
, i.e. the surface points do not belong to the primitive.
Fields
hX::T
: Half of the width inx
dimension (in m).hY::T
: Half of the width iny
dimension (in m).hZ::T
: Half of the width inz
dimension (in m).origin::CartesianPoint{T}
: The position of the center of theBox
.rotation::SMatrix{3,3,T,9}
: Matrix that describes a rotation of theBox
around itsorigin
.
Definition in Configuration File
A Box
is defined in the configuration file as part of the geometry
field of an object through the field box
.
Example definitions of a Box
looks like this:
box:
widths: [2, 4, 6] # => hX = 1; hY = 2; hZ = 3;
origin: [0, 0, 0] # [x, y, z] - Optional; Default: [0, 0, 0]
rotate: # Optional; Default: no rotation
Z: 0
The halfwidths hX
, hY
and hZ
can also be defined directly in the configuration file:
box:
halfwidths: [1, 2, 3] # => hX = 1; hY = 2; hZ = 3;
or
box:
hX: 1
hY: 2
hZ: 3
See also Constructive Solid Geometry (CSG).
SolidStateDetectors.ConstructiveSolidGeometry.CSGDifference
— Typestruct CSGDifference{T, A <: AbstractGeometry{T}, B <: AbstractGeometry{T}} <: AbstractConstructiveGeometry{T}
A CSGDifference
of two geometries a
and b
is defined as the set of points that are in a
but not in b
(a && !b
).
Note that b
is treated as open primitive. This means that points which are in a
and on the surface of b
will still be in the CSGDifference
of a
and b
.
Parametric types
T
: Precision type.A
: Type of geometrya
.B
: Type of geometryb
.
Fields
a::A
: Main geometry.b::B
: Geometry to be subtracted froma
.
Definition in Configuration File
A CSGDifference
is defined in the configuration file as part of the geometry
field of an object through the field difference
, followed by an array of geometries from which the difference is constructed. The first entry of the array is the main geometry, from which all following geometry entries are subtracted.
An example definition of a CSGDifference
looks like this:
difference: # a && !b
- tube: # a
r: 2
h: 1
- tube: # b
r: 1
h: 1.1
If more than two geometries are passed, all entries starting from the second will be subtracted from the first.
Keep in mind that to discard the part of the surface of a
which is on the surface of b
, b
should be chosen slightly bigger than a
.
See also Constructive Solid Geometry (CSG).
SolidStateDetectors.ConstructiveSolidGeometry.CSGIntersection
— Typestruct CSGIntersection{T, A <: AbstractGeometry{T}, B <: AbstractGeometry{T}} <: AbstractConstructiveGeometry{T}
A CSGIntersection
of two geometries a
and b
is defined as the set of points that are both in a
and in b
(a && b
).
Parametric types
T
: Precision type.A
: Type of geometrya
.B
: Type of geometryb
.
Fields
a::A
: First geometry to build the intersection.b::B
: Second geometry to build the intersection.
Definition in Configuration File
A CSGIntersection
is defined in the configuration file as part of the geometry
field of an object through the field intersection
, followed by an array of geometries from which the intersection is constructed.
An example definition of a CSGIntersection
looks like this:
intersection: # a && b
- tube: # a
r: 2
h: 1
- tube: # b
r: 1
h: 1.5
origin:
z: 0.5
If more than two geometries are passed, the intersection
is constructed from all of them.
See also Constructive Solid Geometry (CSG).
SolidStateDetectors.ConstructiveSolidGeometry.CSGUnion
— Typestruct CSGUnion{T, A <: AbstractGeometry{T}, B <: AbstractGeometry{T}} <: AbstractConstructiveGeometry{T}
A CSGUnion
of two geometries a
and b
is defined as the set of points that are in at least one of either a
or b
(a || b
).
Parametric types
T
: Precision type.A
: Type of geometrya
.B
: Type of geometryb
.
Fields
a::A
: First geometry to build the union.b::B
: Second geometry to build the union.
Definition in Configuration File
A CSGUnion
is defined in the configuration file as part of the geometry
field of an object through the field union
, followed by an array of geometries from which the union is constructed.
An example definition of a CSGUnion
looks like this:
union: # a || b
- tube: # a
r: 2
h: 1
- tube: # b
r: 1
h: 1.5
origin:
z: 0.5
If more than two geometries are passed, the union
is constructed from all of them.
See also Constructive Solid Geometry (CSG).
SolidStateDetectors.ConstructiveSolidGeometry.CartesianPoint
— Typestruct CartesianPoint{T} <: AbstractCoordinatePoint{T, Cartesian}
Describes a three-dimensional point in Cartesian coordinates.
Fields
x
: x-coordinate (in m).y
: y-coordinate (in m).z
: z-coordinate (in m).
See also CylindricalPoint
.
SolidStateDetectors.ConstructiveSolidGeometry.CartesianVector
— Typestruct CartesianVector{T} <: AbstractCoordinateVector{T, Cartesian}
Describes a three-dimensional vector in Cartesian coordinates.
Fields
x
: x-coordinate (in m).y
: y-coordinate (in m).z
: z-coordinate (in m).
See also CylindricalVector
.
SolidStateDetectors.ConstructiveSolidGeometry.Cone
— Typestruct Cone{T,CO,TR,TP} <: AbstractVolumePrimitive{T, CO}
Volume primitive describing a Cone with its top and bottom circular base being aligned with the xy
plane (before possible rotations).
Parametric types
T
: Precision type.CO
: Describes whether the surface belongs to the primitive. It can beClosedPrimitive
, i.e. the surface points belong to the primitive, orOpenPrimitive
, i.e. the surface points do not belong to the primitive.TR
: Type of the radiusr
.TR == T
: Cylinder (constant radiusr
at allz
).TR == Tuple{T, T}
: Tube (inner radius atr[1]
, outer radius atr[2]
).TR == Tuple{Tuple{T}, Tuple{T}}
: Varying Cylinder (full cylinder with radius changing linearly inz
fromr[1][1]
at the bottom tor[2][1]
at the top).TR == Tuple{Tuple{T, T}, Tuple{T, T}}
: Varying Tube (inner radius changes linearly inz
fromr[1][1]
at the bottom tor[2][1]
at the top, outer radius changes linearly inz
fromr[1][2]
at the bottom tor[2][2]
at the top).TR == Tuple{Nothing, Tuple{T, T}}
: Cone (Tip at the bottom, top is a circular base with inner radiusr[2][1]
and outer radiusr[2][2]
).TR == Tuple{Tuple{T, T}, Nothing}
: Cone (Tip at the top, bottom is a circular base with inner radiusr[1][1]
and outer radiusr[1][2]
).
TP
: Type of the angular rangeφ
.TP == Nothing
: Full 2π Cone.TP == T
: Partial Cone ranging from0
toφ
.
Fields
r::TR
: Definition of the radius of theCone
(in m).φ::TP
: Range in polar angleφ
over which theCone
extends (in radians).hZ::T
: Half of the height of theCone
(in m).origin::CartesianPoint{T}
: The position of the center of theCone
at the middle height.rotation::SMatrix{3,3,T,9}
: Matrix that describes a rotation of theCone
around itsorigin
.
Definition in Configuration File
A Cone
is defined in the configuration file as part of the geometry
field of an object through the field cone
(or tube
).
Example definitions of a cylinder looks like this:
tube:
r:
from: 1.0
to: 2.0 # => r = (1.0, 2.0)
h: 2.0 # => hZ = 1.0
origin:
z: 1.0 # => origin = [0.0, 0.0, 1.0]
This is a hollow cylinder with inner radius 1 at outer radius 2 with a height of 2 and extending over full 2π (no phi
given), translated 1 along the z
axis.
If the radius is not constant over z
, the r
entries are divided into bottom
and top
, where bottom
describes the inner and outer radius at the bottom circular base and top
describes the inner and outer radius at the top circular base (before rotations)
cone:
r:
bottom:
from: 1.0
to: 2.0
top:
from: 1.0
to: 4.0 # => r = ((1.0, 2.0), (1.0, 4.0))
phi:
from: 0.0°
to: 180.0° # => φ = π
h: 2.0 # => hZ = 1.0
This is half a Cone (φ
goes from 0 to 180°, i.e. only positive y
are allowed) with a height of 2, constant inner radius of 1 and an outer radius which increases from 2 at the bottom to 4 at the top circular base.
The names tube
and cone
in the configuration files are interchangeable.
See also Constructive Solid Geometry (CSG).
SolidStateDetectors.ConstructiveSolidGeometry.ConeMantle
— Typestruct ConeMantle{T,TR,TP,D} <: AbstractCurvedSurfacePrimitive{T}
Surface primitive describing the mantle of a Cone
.
Parametric types
T
: Precision type.TR
: Type of the radiusr
.TR == T
: CylinderMantle (constant radiusr
at allz
).TR == Tuple{T, T}
: VaryingCylinderMantle (bottom radius atr[1]
, top radius atr[2]
).
TP
: Type of the angular rangeφ
.TP == Nothing
: Full 2π Cone.TP == T
: Partial ConeMantle ranging from0
toφ
.
D
: Direction in which the normal vector points (:inwards
or:outwards
).
Fields
r::TR
: Definition of the radius of theConeMantle
(in m).φ::TP
: Range in polar angleφ
over which theConeMantle
extends (in radians).hZ::T
: Half of the height of theConeMantle
(in m).origin::CartesianPoint{T}
: Origin of theCone
which has thisConeMantle
as surface.rotation::SMatrix{3,3,T,9}
: Rotation matrix of theCone
which has thisConeMantle
as surface.
SolidStateDetectors.ConstructiveSolidGeometry.CylindricalPoint
— Typestruct CylindricalPoint{T} <: AbstractCoordinatePoint{T, Cylindrical}
Describes a three-dimensional point in cylindrical coordinates.
Fields
r
: Radius (in m).φ
: Polar angle (in rad).z
:z
-coordinate (in m).
φ == 0
corresponds to the x
-axis in the Cartesian coordinate system.
See also CartesianPoint
.
SolidStateDetectors.ConstructiveSolidGeometry.CylindricalVector
— Typestruct CylindricalVector{T} <: AbstractCoordinateVector{T, Cylindrical}
Describes a three-dimensional vector in cylindrical coordinates.
Fields
r
: Radius (in m).φ
: Polar angle (in rad).z
:z
-coordinate (in m).
φ == 0
corresponds to the x
-axis in the Cartesian coordinate system.
See also CartesianVector
.
SolidStateDetectors.ConstructiveSolidGeometry.Ellipsoid
— Typestruct Ellipsoid{T,CO,TR,TP,TT} <: AbstractVolumePrimitive{T, CO}
Volume primitive describing an Ellipsoid.
Parametric types
T
: Precision type.CO
: Describes whether the surface belongs to the primitive. It can beClosedPrimitive
, i.e. the surface points belong to the primitive, orOpenPrimitive
, i.e. the surface points do not belong to the primitive.TR
: Type of the radiusr
.TR == T
: Sphere (constant radiusr
along all axes).
TP
: Type of the azimuthial angleφ
.TP == Nothing
: Full 2π inφ
.
TT
: Type of the polar angleθ
.TT == Nothing
: Full 2π inθ
.
Fields
r::TR
: Definition of the radius of theEllipsoid
(in m).φ::TP
: Range in azimuthial angleφ
of theEllipsoid
.θ::TT
: Range in polar angleθ
of theEllipsoid
.origin::CartesianPoint{T}
: The position of the center of theEllipsoid
.rotation::SMatrix{3,3,T,9}
: Matrix that describes a rotation of theEllipsoid
around itsorigin
.
Definition in Configuration File
So far, the only Ellipsoid
implemented so far is a FullSphere
. A FullSphere
is defined in the configuration file as part of the geometry
field of an object through the field sphere
.
Example definitions of a FullSphere
looks like this:
sphere:
r: 2
This is a full sphere with radius 2.
To define a sphere with inner cut-out, use CSGDifference
:
difference:
- sphere:
r: 2
- sphere:
r: 1
This is a sphere with inner radius 1 and outer radius 2.
See also Constructive Solid Geometry (CSG).
SolidStateDetectors.ConstructiveSolidGeometry.EllipsoidMantle
— Typestruct EllipsoidMantle{T,TR,TP,TT,D} <: AbstractCurvedSurfacePrimitive{T}
Surface primitive describing the surface of an Ellipsoid
.
Parametric types
T
: Precision type.TR
: Type of the radiusr
.TR == T
: SphereMantle (constant radiusr
along all axes).
TP
: Type of the azimuthial angleφ
.TP == Nothing
: Full 2π inφ
.
TT
: Type of the polar angleθ
.TT == Nothing
: Full 2π inθ
.
D
: Direction in which the normal vector points (:inwards
or:outwards
).
Fields
r::TR
: Definition of the radius of theEllipsoidMantle
(in m).φ::TP
: Range in azimuthial angleφ
of theEllipsoidMantle
.θ::TT
: Range in polar angleθ
of theEllipsoidMantle
.origin::CartesianPoint{T}
: Origin of theEllipsoid
which has thisEllipsoidMantle
as surface.rotation::SMatrix{3,3,T,9}
: Rotation matrix of theEllipsoid
which has thisEllipsoidMantle
as surface.
SolidStateDetectors.ConstructiveSolidGeometry.EllipticalSurface
— Typestruct EllipticalSurface{T,TR,TP} <: AbstractPlanarSurfacePrimitive{T}
Surface primitive describing circular bases, e.g. the top or bottom base of a Cone
.
Parametric types
T
: Precision type.TR
: Type of the radiusr
.TR == T
: Full Circle (constant radiusr
, no cut-out).TR == Tuple{T, T}
: Circular Annulus (inner radius atr[1]
, outer radius atr[2]
).
TP
: Type of the angular rangeφ
.TP == Nothing
: Full 2π Cone.TP == T
: Partial Elliptical Surface ranging from0
toφ
.
Fields
r::TR
: Definition of the radius of theEllipticalSurface
(in m).φ::TP
: Range in polar angleφ
over which theEllipticalSurface
extends (in radians).origin::CartesianPoint{T}
: The position of the center of theEllipticalSurface
.rotation::SMatrix{3,3,T,9}
: Matrix that describes a rotation of theEllipticalSurface
around itsorigin
.
SolidStateDetectors.ConstructiveSolidGeometry.Plane
— Typestruct Plane{T} <: AbstractPlanarSurfacePrimitive{T}
Surface primitive describing a two-dimensional flat plane in three-dimensional space.
Fields
origin::CartesianPoint{T}
: Point in thePlane
.normal::CartesianVector{T}
: Normal vector of thePlane
, normalized to length 1.
SolidStateDetectors.ConstructiveSolidGeometry.Polygon
— Typestruct Polygon{N,T} <: AbstractPlanarSurfacePrimitive{T}
Surface primitive describing a planar polygon, e.g. the base of a RegularPrism
.
Parametric types
T
: Precision type.N
: Number of vertices of thePolygon
.
Fields
points::SVector{N, CartesianPoint{T}}
: Vertices of the polygon in the order with which they are connected.
SolidStateDetectors.ConstructiveSolidGeometry.RegularPrism
— Typestruct RegularPrism{T,CO,N,TR} <: AbstractVolumePrimitive{T, CO}
Volume primitive describing a Prism with base plates are regular polygons which are parallel to the xy
plane. If the regular polygon base plate is projected to the xy
plane, one of the vertices lays on the x
axis.
Parametric types
T
: Precision type.CO
: Describes whether the surface belongs to the primitive. It can beClosedPrimitive
, i.e. the surface points belong to the primitive, orOpenPrimitive
, i.e. the surface points do not belong to the primitive.N
: Number of vertices of the regular polygon that defines the base of the prism.TR
: Type ofr
.TR == T
: Regular polygon base (all vertices have the same distance to the center).
Fields
r::TR
: Distance of the vertices to the center of the regular polygon base (in m).hZ::T
: Half of the width inz
dimension (in m).origin::CartesianPoint{T}
: The position of the center of theRegularPrism
.rotation::SMatrix{3,3,T,9}
: Matrix that describes a rotation of theRegularPrism
around itsorigin
.
Definition in Configuration File
So far, only HexagonalPrism
can be defined in the configuration files. A HexagonalPrism
is defined in the configuration file as part of the geometry
field of an object through the field HexagonalPrism
.
An example definition of a HexagonalPrism
looks like this:
HexagonalPrism:
r: 1.0 # => r = 1.0
h: 2.0 # => hZ = 1.0
See also Constructive Solid Geometry (CSG).
SolidStateDetectors.ConstructiveSolidGeometry.Torus
— Typestruct Torus{T,CO,TR,TP,TT,TT1,TT2} <: AbstractVolumePrimitive{T,CO}
Volume primitive describing a Torus. It is defined as all points that are within a given radius to a circle, parallel to the xy
plane, with constant radius around a given origin.
Parametric types
T
: Precision type.CO
: Describes whether the surface belongs to the primitive. It can beClosedPrimitive
, i.e. the surface points belong to the primitive, orOpenPrimitive
, i.e. the surface points do not belong to the primitive.TR
: Type ofr_tube
.TR == T
: Full tube without cutout (constant radiusr_tube
).TR == Tuple{T,T}
: Hollow tube with cutout (inner radiusr_tube[1]
, outer radiusr_tube[2]
).
TP
: Type of the azimuthial angleφ
.TP == Nothing
: Full 2π inφ
.TP == T
: Partial Torus ranging from0
toφ
.
TT
: Type of the polar angleθ
.TT == Nothing
: Full 2π inθ
.TP == Tuple{T,T}
: Partial Torus ranging fromθ[1]
toθ[2]
.
TT1
: Type of the surface atθ[1]
(:inwards
,:outwards
or:flat
).TT2
: Type of the surface atθ[2]
(:inwards
,:outwards
or:flat
).
Fields
r_torus::T
: Distance of the center of theTorus
to the center of the tube (in m).r_tube::TR
: Radius of the tube of theTorus
(in m).φ::TP
: Range in azimuthial angleφ
of theTorus
.θ::TT
: Range in polar angleθ
of theTorus
.origin::CartesianPoint{T}
: The position of the center of theTorus
.rotation::SMatrix{3,3,T,9}
: Matrix that describes a rotation of theTorus
around itsorigin
.
Definition in Configuration File
A Torus
is defined in the configuration file as part of the geometry
field of an object through the field torus
.
Example definitions of a Torus
looks like this:
torus:
r_torus: 10.0 # => r_torus = 10.0
r_tube: 2 # => r_tube = 2.0
phi:
from: 0.0°
to: 360.0° # => φ = nothing
theta:
from: 0.0°
to: 360.0° # => θ = nothing
The fields phi
and theta
do not need to defined if they are full 2π.
Example definition of a Torus
with an inner cut-out:
torus:
r_torus: 10.0 # => r_torus = 10.0
r_tube:
from: 1.0
to: 2.0 # => r_tube = (1.0, 2.0)
phi:
from: 0.0°
to: 360.0° # => φ = nothing
theta:
from: 0.0°
to: 360.0° # => θ = nothing
This is a Torus
with r_tube
having an inner radius of 1 and an outer radius of 2.
See also Constructive Solid Geometry (CSG).
SolidStateDetectors.ConstructiveSolidGeometry.TorusMantle
— Typestruct TorusMantle{T,TP,TT,D} <: AbstractCurvedSurfacePrimitive{T}
Surface primitive describing the mantle of a Torus
.
Parametric types
T
: Precision type.TP
: Type of the azimuthial angleφ
.TP == Nothing
: Full 2π inφ
.TP == T
: Partial Torus Mantle ranging from0
toφ
.
TT
: Type of the polar angleθ
.TT == Nothing
: Full 2π inθ
.TP == Tuple{T,T}
: Partial Torus Mantle ranging fromθ[1]
toθ[2]
.
D
: Direction in which the normal vector points (:inwards
or:outwards
).
Fields
r_torus::T
: Distance of the center of theTorusMantle
to the center of the tube (in m).r_tube::T
: Radius of the tube of theTorusMantle
(in m).φ::TP
: Range in azimuthial angleφ
of theTorusMantle
.θ::TT
: Range in polar angleθ
of theTorusMantle
.origin::CartesianPoint{T}
: The position of the center of theTorusMantle
.rotation::SMatrix{3,3,T,9}
: Matrix that describes a rotation of theTorusMantle
around itsorigin
.
SolidStateDetectors.ConstructiveSolidGeometry.extreme_points
— Methodextreme_points(es::AbstractPrimitive{T}) where {T}
Generic fallback of extreme_points
for any primitive. Returns 6 CartesianPoint
s in both directions of each cartesian axes (x, y and z) around the origin of the primitive with distance determined by extremum(es)
, which returns the maximum distance of an primitive to its origin.
Arguments
es::AbstractPrimitive{T}
: Any primitive, e.g. aBox
.
SolidStateDetectors.ConstructiveSolidGeometry.intersection
— Methodintersection(cm::ConeMantle{T,Tuple{T,T}}, l::Line{T}) where {T}
Calculates the intersections of a Line
with a ConeMantle
.
Arguments
cm::ConeMantle{T,Tuple{T,T}}
: TheConeMantle
.l::Line{T}
: TheLine
.
The function will always return 2 CartesianPoint's. If the line just touches the mantle, the two points will be the same. If the line does not touch the mantle at all, the two points will have NaN's as there coordinates. If the line crosses the mantle only once, two points will be returned. The two points will be the same point (the intersection). If the line lies inside the mantle and is parallel to it. The same point will be returned which is the origin of the line.
SolidStateDetectors.ConstructiveSolidGeometry.intersection
— Methodintersection(em::EllipsoidMantle{T}, l::Line{T}) where {T}
Calculates the intersections of a Line
with a EllipsoidMantle
.
Arguments
cm::EllipsoidMantle{T}
: TheEllipsoidMantle
.l::Line{T}
: TheLine
.
The function will always return 2 CartesianPoint's. If the line just touches the mantle, the two points will be the same. If the line does not touch the mantle at all, the two points will have NaN's as there coordinates.
SolidStateDetectors.ConstructiveSolidGeometry.intersection
— Methodintersection(p::Plane{T}, line::Line{T}) where {T}
Calculates the intersections of a Line
with a Plane
.
Arguments
cm::Plane{T}
: ThePlane
.l::Line{T}
: TheLine
.
The function will always return one Point as a Tuple. If the line is parallel to the plane, the point will have NaN
's/Inf
's as values.
SolidStateDetectors.ConstructiveSolidGeometry.intersection
— Methodintersection(tm::TorusMantle{T}, l::Line{T}) where {T}
Calculates the intersections of a Line
with a TorusMantle
.
Arguments
cm::TorusMantle{T}
: TheTorusMantle
.l::Line{T}
: TheLine
.
The function will always return 4 CartesianPoint's. If the line just touches the mantle, the points will be the same. If the line does not touch the mantle at all, the points will have NaN's as there coordinates.