Source_newgen.f for a synchrotron spectrum

Dear Ted,

the sampling in the source_newgen routine works correctly, but the probability of getting a primary with more than 100 keV is infinitesimally low.

It would help to use biased sampling, where the particle energy is sampled uniformly, while the particle weight is set according to the spectrum. Unfortunately, this is not available in source_newgen.

You can find a script capable of doing biased sampling here: Sampling from energy spectra
However, this script only samples the particle energy, anything else is taken from the BEAM and BEAMPOS card only.

Cheers,
David

1 Like