22.05.2014 Views

CERN Program Library Long Writeup W5013 - CERNLIB ...

CERN Program Library Long Writeup W5013 - CERNLIB ...

CERN Program Library Long Writeup W5013 - CERNLIB ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.3 Sampling of the distribution function<br />

The component distribution functions (2) are given by<br />

f r (0) (η) = 2e −η2 = 2D 0 (1, 1, −η 2 )<br />

f r (1) (η) = 2D 1 (2, 1, −η 2 )<br />

f r (2) (η) = D 2 (3, 1, −η 2 ),<br />

where D n (a, b, z) =d n [Γ(a)M(a, b, z)]/da n , with M(a, b, z) the Kummers hypergeometric function.<br />

Integrals of the functions f r (1) and f r<br />

(2) needed for the Monte Carlo can be written down directly in terms of<br />

the D functions<br />

∫ ∞<br />

ηf r (1) ηdη = D 1 (2, 1, −η 2 ) − D 1 (1, 1, −η 2 ) − D 0 (1, 1, −η 2 )<br />

η<br />

∫ ∞<br />

η<br />

ηf (2)<br />

r ηdη = 1 2 D 2(3, 1, −η 2 ) − D 2 (2, 1, −η 2 ) − D 1 (2, 1, −η 2 )<br />

We note that the first term is just the Gaussian part and it dominates for large B, that is, for large number of<br />

scatters, as it has to be expected. Recalling the definition of η in (2) we can say that the half-width of the<br />

Gaussian part of the Molière distribution is σ 2 = χ 2 cB/2. Routine GMOLIE performs the sampling of the<br />

Molière distribution via the following steps:<br />

1. the value of B is calculated recursively. If we set f(B) =B with f(B) =lnΩ 0 +lnB the relation<br />

used is B n = B n−1 +∆B = B n−1 +(f(B n−1 ) − B n−1 )/(1 − 1/B n−1 ). Convergence is assumed<br />

when |∆B| ≤10 −4 .<br />

2. a random number r 1 is sampled and a table of four values F r (η i ) is built with i = j − 2,j− 1,j,j+1<br />

and F r (η j ) ≥ r 1 . F is the distribution function derived from (2):<br />

F r (η) =<br />

=<br />

∫ η<br />

0<br />

∫ η<br />

0<br />

f r (t) dt =<br />

∫ η<br />

∫ η<br />

f r<br />

(0) (t) dt + B −1 0<br />

= F (0)<br />

r (η)+B −1 F (1)<br />

40 values of the functions F (n)<br />

r<br />

0<br />

f r (0) (t)+f r (1) (t)B −1 + f r<br />

(2) (t)B −2 dt<br />

∫ η<br />

f r<br />

(1) (t) dt + B −2 0<br />

r (η)+B −2 F r<br />

(2) (η)<br />

are tabulated.<br />

f r<br />

(2) (t) dt<br />

3. using a four-points continued-fraction interpolation method (GMOL4) a table of ηi 2 is interpolated using<br />

the values of r 1 and F tabulated in the previous step. This is similar to the inversion of the distribution<br />

function, but instead of obtaining directly the random variable, we interpolate a table of its squares.<br />

This provides a better fit to the inverse function;<br />

4. the value of θ = χ c<br />

√<br />

Bη 2 is calculated;<br />

5. a random number r 2 is extracted, and the rejection function g(θ) = √ sin θ/θ is computed. If r 2 ><br />

g(θ) resampling begins from step 2, otherwise the value is accepted.<br />

The Molière distribution gives the space scattering angle. A similar expression may be written for the<br />

lateral displacement of the scattered particles. However, the problem of joint angle lateral displacement in<br />

the Molière approximation has not been solved, and, for small step size, lateral displacement is of second<br />

order and may be neglected. This introduces a problem when large step sizes are taken. The step size can<br />

be artificially limited via the use of the variable STEMAX, which is an argument to the routine GSTMED. For<br />

more information on this point the user is invited to consult chapter [CONS200].<br />

PHYS325 – 6 247

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!