Angular and energy distribution

Hi All,

I am fairly new to G4, sorry for the potentially basic question.

I have is a histogram of the intensity as a function of energy, which I understand can be included into GPS as a custom energy distribution. The problem is that this spectrum also varies as a function of zenith angle and I am unsure as to how to go about implementing this angular dependence.

Has anyone had any experience doing this or any advice on how to go with this?

Thanks in advance for any replies.

Best regards,

1 Like

you can use GPS and UI commands to asign the angular distribution. /gps/hist/type theta for theta distribution, and /gps/hist/type phi for phi distribution.
you can refer to this GPS examples. The example 23 can solve your problem.

Thank You @repan for your reply.
I have just another basic question about UI commands.
I have to use it in my mac file or in my Primary generator ?

Thanks in advance for your time.
Best regards,


Hi, just define particleGun = new G4GeneralParticleSource() in the ` file. The UI commands are expected to write into a mac file.
you can see the GPS UI mac examples and the whole codes of that example are available in your geant4 directory /examples/extended/eventgenerator/exgps/