remage
Simulation framework for HPGe-based experiments
Loading...
Searching...
No Matches
RMGVertexConfinement::DepthProfile Struct Reference

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

#include <RMGVertexConfinement.hh>

Public Types

enum class  Type { kNone , kExponential , kTruncatedGaussian , kUniform }
 Distribution type for the depth profile. More...

Public Member Functions

double Sample () const
 Sample a depth value from the configured distribution.
void Validate () const
 Validate the configured parameters, aborting with a fatal error on bad input.

Public Attributes

Type type = Type::kNone
 Distribution type. Defaults to kNone (no displacement).
double mean = 0
 Mean depth for the exponential and truncated-Gaussian distributions.
double sigma = 0
 Standard deviation for the truncated-Gaussian distribution.
double range_lo = 0
 Lower bound of the depth range for uniform and truncated-Gaussian distributions.
double range_hi = 0
 Upper bound of the depth range for uniform and truncated-Gaussian distributions.

Detailed Description

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.

Member Enumeration Documentation

◆ Type

Distribution type for the depth profile.

See also
DepthProfile for a description of each type.
Enumerator
kNone 

No depth profile: vertex remains on the surface.

kExponential 

Exponential distribution parametrised by mean.

kTruncatedGaussian 

Gaussian distribution truncated to [range_lo, range_hi].

kUniform 

Uniform distribution over [range_lo, range_hi].

Member Function Documentation

◆ Sample()

double RMGVertexConfinement::DepthProfile::Sample ( ) const
nodiscard

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).

◆ Validate()

void RMGVertexConfinement::DepthProfile::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.

Member Data Documentation

◆ mean

double RMGVertexConfinement::DepthProfile::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).

◆ range_hi

double RMGVertexConfinement::DepthProfile::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).

◆ range_lo

double RMGVertexConfinement::DepthProfile::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).

◆ sigma

double RMGVertexConfinement::DepthProfile::sigma = 0

Standard deviation for the truncated-Gaussian distribution.

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


The documentation for this struct was generated from the following files:
  • /home/docs/checkouts/readthedocs.org/user_builds/remage/checkouts/latest/include/RMGVertexConfinement.hh
  • /home/docs/checkouts/readthedocs.org/user_builds/remage/checkouts/latest/src/RMGVertexConfinement.cc