How to define the particle angle information

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

Geant4 Version:11.3.2
Operating System:linux
Compiler/Version:gcc9.4
CMake Version:3.16


Dear G4 experts:

I wonder how to define the particle angle information using GPS?

Here’s the full documentation for GPS:

The introductory section on angular distributions:

And the macro commands for angular distribution:

If the information you need isn’t in the documentation, you will need to be much more specific about what is missing.

Thank you for you’re reply.I would like to know if there exists an angle that can define the energy at any given point, similar to how an energy spectrum is defined, and then perform fitting procedures. The document contains a histogram related to angular distribution.

It is unclear what you want to do. Angle refers to the spatial domain, and the energy is not spatial. The plot you posted has no energy dependence.

sorry,I mean that how to define angular distribution and if can be fit?

If it is something special, use histograms. The interpolation is built in and can be selected. Please see the documentation. You can also run a cosine distribution or a uniform one without histograms. A dense histogram likely will be good with a linear interpolation, but you should be the expert on what is better. If none helps, you can write your own PrimaryGeneratorAction. It also works with the GPS in parts, such as a GPS-defined energy spectrum and a custom angular distribution.

You can see my app as an example instrument-simulation/src at main · phirippu/instrument-simulation · GitHub

OK,thank you for your advise.