Struct RMGVertexConfinement::DepthProfile

Nested Relationships

This struct is a nested type of Class RMGVertexConfinement.

Struct Documentation

struct DepthProfile

Depth profile for displacing surface-sampled vertices into the material.

When surface sampling is enabled, an optional depth can be sampled from a statistical distribution. The vertex is then displaced inward from the surface by that depth along the outward surface normal, i.e.:

vertex -= depth * solid->SurfaceNormal(vertex);
Three distributions are supported in addition to the default of no depth offset:
  • Exponential: physically motivated model for e.g. alpha/beta surface contamination, characterised by a mean implantation depth.

  • Truncated Gaussian: Gaussian distribution restricted to a finite range, suitable when a peak depth with physical cut-offs is needed.

  • Uniform: flat distribution over a user-defined range.

Note

The depth profile is applied in the local coordinate system of the solid before the global rotation and translation are applied. The sampled depth is clamped to the distance from the surface point to the far boundary along the inward normal (via G4VSolid::DistanceToOut), so the displaced vertex can never cross to the other side of the solid or leave it. For thin volumes this means an over-large sampled depth is silently reduced; choose parameters consistent with the local thickness to keep the resulting depth distribution meaningful.

Public Types

enum class Type

Distribution type for the depth profile.

See also

DepthProfile for a description of each type.

Values:

enumerator kNone

No depth profile: vertex remains on the surface.

enumerator kExponential

Exponential distribution parametrised by mean.

enumerator kTruncatedGaussian

Gaussian distribution truncated to [range_lo, range_hi].

enumerator kUniform

Uniform distribution over [range_lo, range_hi].

Public Functions

double Sample() const

Sample a depth value from the configured distribution.

  • kNone: always returns 0.

  • kExponential: inverse-CDF sampling from Exp(mean), all returned values ≥ 0.

  • kTruncatedGaussian: Box-Muller Gaussian with rejection outside [range_lo, range_hi]. Aborts with a warning if 10000 consecutive attempts all fall outside the range (mis-configured parameters).

  • kUniform: uniform over [range_lo, range_hi].

Returns:

The sampled depth in Geant4 length units (mm by default).

void Validate() const

Validate the configured parameters, aborting with a fatal error on bad input.

Enforces the invariants each distribution needs for Sample to be well-defined: mean > 0 for kExponential; range_hi > range_lo >= 0 for kUniform; and additionally sigma > 0 for kTruncatedGaussian. Should be called once, before sampling starts. kNone always validates.

Public Members

Type type = Type::kNone

Distribution type. Defaults to kNone (no displacement).

double mean = 0

Mean depth for the exponential and truncated-Gaussian distributions.

For kExponential this is the sole parameter (1/λ). For kTruncatedGaussian it is the centre of the underlying Gaussian before truncation. Value is in Geant4 length units (mm by default).

double sigma = 0

Standard deviation for the truncated-Gaussian distribution.

Only used when type is kTruncatedGaussian. Value is in Geant4 length units (mm by default).

double range_lo = 0

Lower bound of the depth range for uniform and truncated-Gaussian distributions.

For kUniform: minimum sampled depth. For kTruncatedGaussian: values below this bound are rejected. Value is in Geant4 length units (mm by default).

double range_hi = 0

Upper bound of the depth range for uniform and truncated-Gaussian distributions.

For kUniform: maximum sampled depth. For kTruncatedGaussian: values above this bound are rejected. Value is in Geant4 length units (mm by default).