How to set arbitrary position of source point in "PrimaryGeneratorAction.cc"

Dear experts,

I try to set arbitrary position of source point in “PrimaryGeneratorAction.cc” like “/gps/hist/type arb” in “.mac” file, but I had no idea about this. Could you help me?

Best regards,
Jiechen

Hi,

Welcome to the Geant4 forum!

The Geant4 examples cover the use cases of the GPS, you may find them together with the source code and with your local installation. You can also download them from here. Particularly interesting for this use case, the macro files 23, 24, 25, 26, 27.

Best,
Alvaro