Expand description
Multi-shot exposure: the energy density deposited by a list of shots, from
a fitted Gaussian-sum point-spread function (GaussianPsf).
§The model
A shot is a beam landing at (x, y) with a weight (the number of
primaries, or any relative dwell) and an optional spot shape and beam
blur. The deposited energy density at a point is the sum over shots of the
shot’s weight times the PSF, E f(r) (eV/m²), centred on the shot, where
E is GaussianPsf::total_ev, the energy one primary deposits in the
film. The PSF is the sum of Gaussians documented in
crate::tally::psf:
f(r) = 1/(π Σc) Σ_t (c_t / w_t²) exp(-r²/w_t²)with (w_t, c_t) = (α, 1), (β, η) and, for the triple form, (γ, ν).
Beam blur. A Gaussian beam profile of width b in the same
convention, exp(-r²/b²)/(π b²), is convolved with the PSF. The
convolution of two normalised 2D Gaussians is the normalised Gaussian
whose w² is the sum (the variances of independent Gaussians add; here
w² = 2σ², so the w² add too):
∫ exp(-|r-s|²/w²)/(π w²) · exp(-s²/b²)/(π b²) d²s = exp(-r²/(w²+b²))/(π (w²+b²))This is textbook (the convolution theorem for Gaussians; it follows from
completing the square in the exponent), so a blurred point shot needs no
numerical convolution: every term’s w_t² becomes w_t² + b², and the
weights c_t and the normalisation are unchanged. The blur of a shot is
b² = b_global² + b_shot².
Shaped spots. A uniform disc or rectangle is a fixed sub-sampling
into point shots: the bounding box of the spot is cut into
n × n equal cells (n is Exposure::subsamples, default
DEFAULT_SUBSAMPLES); each cell centre inside the spot becomes a point
shot with an equal share of the weight (the shares sum to the shot’s
weight). The rectangle is the midpoint rule on the exact shape, so its
error is O(h²) in the cell pitch h relative to the narrowest Gaussian
width sqrt(w_t² + b²); it is accurate when h is below that width. A
disc has the same quadrature error and, in addition, the boundary of the
sampled cells approximates the circle to O(h) in area; raise
subsamples for a spot that is large compared with the PSF’s α.
§Determinism
The dose at one point sums the point sources in list order (the shots in the order given, each shot’s sub-samples in row-major order). A grid parallelises over grid points only, so each point’s sum is the same fixed sequence of floating-point operations: the result is bit-identical at any thread count.
§Accuracy
The dose is only as good as the PSF it uses. A fit that does not describe
the simulated profile (see the reduced χ² of PsfFit) gives a dose
that does not describe the simulated exposure either; the fit’s validation
is tracked separately (issue #151). Superposition also assumes the film is
laterally uniform.
§Direct Monte Carlo exposure
direct_dose evaluates the same shot list by transport instead of by
superposition, which makes no assumption of a laterally uniform film. For
each shot the electron engine (Transport::run_beam) runs primaries from
the shot position with the shot’s spot shape, and the energy deposited in
the film slab depth_lo <= x < depth_hi is tallied per lateral cell of the
evaluation Grid (one voxel per grid point, the point at its centre,
through VoxelTallyGrid). The shot’s weight scales the per-primary
deposit, so the energy density at a point is
D(p) = Σ_shots w_s · (E_s(p) / N_s) / (dx · dy)with E_s(p) the energy deposited in the cell of p by the N_s
primaries of shot s. This is the cell average of the density that
Exposure::dose_at gives at the cell centre; the two agree when the
dose varies little over a cell (choose dx, dy below the narrowest PSF
width).
Frame. Exposure coordinates (x, y) are offsets from the geometry’s
entry point (the centre of the front face of a voxel grid), as for
BeamSpread::landing_m: exposure x is the geometry’s y and exposure
y its z. Depth is the geometry’s x.
Spots. A point shot is a Gaussian beam of the blur width (b in
exp(-r²/b²), i.e. σ = b/√2 per axis); a disc or rectangle is the
uniform profile of the same shape. A shaped spot with a nonzero blur is
rejected: the engine’s profiles do not convolve a shape with a Gaussian.
Statistical error. The run is made in R independent replicas
(DirectConfig::replicas), each with its own seeds and
histories_per_shot / R primaries per shot. The reported dose at a point
is the mean of the R replica doses and its standard error
sqrt(s² / R), with s² the sample variance of the replica doses
(Bessel-corrected). The error is statistical only (Monte Carlo noise); the
cross-section tables’ own uncertainty is not included.
Determinism. Replica r and shot s run with seed
point_seed(point_seed(seed, r), s) (a SplitMix64 mix, see
crate::tally::psf_scan), runs are made one after the other, each is
bit-identical at any thread count, and the sums over shots and replicas
are taken in index order, so the result does not depend on the thread
count.
Comparison with the convolution. compare_with_convolution puts the
two results side by side per point (the convolution averaged over the
same cell, as the tally measures a cell average) and flags the points where they differ
by more than a stated number of combined standard errors,
sqrt(σ_direct² + σ_conv²). The superposition has no sampling error of
its own; σ_conv is the stated relative uncertainty of the fitted PSF
times the convolution dose (0 if none is given).
Structs§
- Area
Dose - The dose far inside a large uniform exposure, split by PSF term.
- Direct
Config - Settings of
direct_dose. - Direct
Dose - The energy density of a shot list by transport, with its statistical
error, on a
Grid. - Dose
Grid - The dose on a
Grid, eV/m², row-major. - Exposure
- A list of shots on a PSF, ready to evaluate.
- Grid
- A regular grid of points: point
(i, j)is at(x0 + i dx, y0 + j dy), stored row-major (j * nx + i). - Point
Comparison - One evaluation point of
compare_with_convolution. - Shot
- One shot.
Enums§
- Exposure
Error - Errors of building or reading an exposure.
- Spot
Shape - The shape of a shot’s spot.
Constants§
- DEFAULT_
SUBSAMPLES - Default sub-sampling per axis of a shaped spot.
Functions§
- compare_
with_ convolution - The direct and convolution doses side by side at every point of
direct.grid; a point is flagged when the two differ by more thantolerance_sigmascombined standard errors (see the module docs).conv_rel_erris the relative uncertainty assigned to the convolution. - comparison_
csv - CSV of a comparison:
x_m,y_m,convolution_ev_per_m2,direct_ev_per_m2, combined_std_err_ev_per_m2,deviation_sigmas,flagged. - direct_
dose - The energy density of
shotsongridby electron transport; see the module docs (“Direct Monte Carlo exposure”) for the model, frame and error.global_blur_mis the exposure’s beam blurb. - parse_
shots_ csv - Reads a shot list.
- uniform_
area_ dose - The area dose of a uniform exposure of
weight_per_m2primaries per m² over an area much larger than the PSF’s longest width, with the forward-only part reported next to the total.