Celeritas is a new Monte Carlo transport code designed to accelerate scientific discovery in high energy physics by improving detector simulation throughput and energy efficiency using GPUs.
This defines a RejectionSampler class that can be used as a more intuitive replacement for BernoulliDistribution during rejection sampling loops. Instead of "accepting" when the sample is within bounds (necessitating an easy-to-miss negation in the while condition) we "reject" by returning true unless the sampled value is accepted.
This defines a
RejectionSampler
class that can be used as a more intuitive replacement forBernoulliDistribution
during rejection sampling loops. Instead of "accepting" when the sample is within bounds (necessitating an easy-to-miss negation in thewhile
condition) we "reject" by returning true unless the sampled value is accepted.