next up previous contents
Next: Status of this document Up: Introduction Previous: Status of this document   Contents


Monte Carlo Methods

The Geant4 toolkit uses a combination of the composition and rejection Monte Carlo methods. Only the basic formalism of these methods is outlined here. For a complete account of the Monte Carlo methods, the interested user is referred to the publications of Butcher and Messel, Messel and Crawford, or Ford and Nelson [#!m.butch!#,#!m.messel!#,#!m.egs4!#].

Suppose we wish to sample $ x$ in the interval $ [x_1, x_2]$ from the distribution $ f(x)$ and the normalised probability density function can be written as :

$\displaystyle f(x) = \sum_{i=1}^{n} N_{i} f_{i} (x) g_{i} (x)$ (2.1)

where $ N_i>0$, $ f_i(x)$ are normalised density functions on $ [x_1, x_2]$ , and $ 0 \leq g_i (x) \leq 1$.

According to this method, $ x$ can sampled in the following way:

  1. select a random integer $ i \in \{1,2,\cdots n\}$ with probability proportional to $ N_i $
  2. select a value $ x_0$ from the distribution $ f_i(x)$
  3. calculate $ g_i (x_0)$ and accept $ x = x_0$ with probability $ g_i (x_0)$;
  4. if $ x_0$ is rejected restart from step 1.
It can be shown that this scheme is correct and the mean number of tries to accept a value is $ \sum_{i} N_i $.

In practice, a good method of sampling from the distribution $ f(x)$ has the following properties:

Thus the different possible decompositions of the distribution $ f(x)$ are not equivalent from the practical point of view (e.g. they can be very different in computational speed) and it can be useful to optimise the decomposition.

A remark of practical importance : if our distribution is not normalised

$\displaystyle \int_{x_1}^{x_2} f(x)dx = C > 0$

the method can be used in the same manner; the mean number of tries in this case is $ \sum_ {i} N_i/C$.



Subsections
next up previous contents
Next: Status of this document Up: Introduction Previous: Status of this document   Contents