How to generate random direction for SetParticleMomentumDirection()

Hello everyone,
I’m trying to generate a photon source that emitted 4pi of angle. I used Particle Gun to create my photon beam but I only know set direction by using the ParticleMomentumDirection() method. Can anyone help me to get 4pi of angle for emission? Thanks in advance.

1 Like

would this help?

Thank you. I have implemented done.

Dear Sir,
I have another question.
If I want to shoot a lot of particles with different energy (the same as Am241 have 1 photon 59.5409 (I = 35.9%) keV and a photon 26.3446 (2.27%)). So how can I implement my simulation with them?

I would then switch to the general particle source, where you can have multiple sources at the same time and adjust the distribution via the intensity.

https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/html/GettingStarted/generalParticleSource.html#multiple-source-specification

1 Like