tudo-astroparticlephysics / PROPOSAL

Monte Carlo Simulation propagating charged Leptons through Media as C++ Library
GNU Lesser General Public License v3.0
35 stars 21 forks source link

Moliere scattering generates non-normalized directional vectors for very large deflections #371

Open Jean1995 opened 1 year ago

Jean1995 commented 1 year ago

If one uses Moliere scattering with random numbers close to 1, it will create very large deflections.

However, is the random numbers becomes very close to 1, and the deflection becomes close to 90 degree, it actually creates unphysical directional changes (i.e. either tx or ty is larger 1). This generates directional vectors that are not normalized anymore.

This is a minimal working example

import proposal as pp
import numpy as np
import matplotlib.pyplot as plt

particle = pp.particle.EMinusDef()
medium = pp.medium.Air()

scattering = pp.make_multiple_scattering("moliere", particle, medium)

final_dir_list = []

rnd_list = [0.5, 0.999000, 0.999005, 0.999010, 0.999015, 0.9991]

color_list = iter(plt.cm.rainbow(np.linspace(0, 1, len(rnd_list))))

for rnd in rnd_list:
    deflection = scattering.scatter(0.97, 13.4, 13.2, [0.3, 0.6, 0.3, rnd]) 
    init_direction = pp.Cartesian3D(0, 0, 1)
    _, final_direction = pp.scattering.scatter_initial_direction(init_direction, deflection)
    print(final_direction.magnitude)
    final_dir_list.append(final_direction)

for final_dir, rnd, color in zip(final_dir_list, rnd_list, color_list):
    #print(final_dir)
    plt.arrow(0, 0, final_dir.y, final_dir.z, color=color, label=rnd)
plt.legend()
plt.xlabel('y')
plt.ylabel('z')

which generates the following plot:

image

The label shows the used random number. For random numbers going above 0.99901, the deflection angle becomes 90 degrees, but the directional vector becomes larger than 1.