Using probability distribution to generate neutrons with random selection

Hi all,

I have a neutron source defined in a text or binary file, with the probability P(r, theta, phi, E) where r is the position, (theta,phi) the direction and E the energy of a neutron . The idea is to use particleGun by assigning to the particle with random selection the parameters [(theta,phi), direction,E] accordingly to the probability P(r, theta, phi, E), by generating N neutrons (events). Do you have some suggestion to implement it, please?
Thanks in advance for your time.
Best regards,

Christian

1 Like

Hi Christian,

What if you store all the distributions in separate files and let the energy and angles being sampled via those files in a macro? If yes, see my response here.. This is implemented via GPS, which I highly suggest as it is straightforward to implement.

With ParticleGun I have always generated random numbers from 0 to 1 and defined the angular range using those numbers. For example, for each event a random number is sampled, hence a random angle.

1 Like

Dear @mksharma_iitk ,

thank you very much for your answer. As I see from here, the distribution of a particle is a single point or a sphere at x=20 cm. How do you store the distribution in a single file, in order to be used with GPS? You mean to define in these files the energy and the direction, in addition to the position?

About the adoption of ParticleGun, how did you generate the random number for the sample?

Thanks in advance for your time.
Best regards,

Christian