How to simulate a moving particle source?

Could the Geant4 simulate a moving particle source ,e,g. a neutron source? And any indirect method is also welcome.
Thank you in advance.

Do you mean something like a source capsule being pulled along a positioning chain? Or a radioactive beam?

For a source capsule with a speed much lower than the typical event duration, you could emulate this in your own PrimaryGeneratorAction by specifying (a) the speed and direction of your source, and (b) an average event rate. With those two, you can throw a Poisson time between events, compute the new source position, and generate your primaries at that position. Set the primary timestamp to correspond to “how long the source has been moving” for use in your analysis.

For a radioactive beam, you can use something as simple as G4ParticleGun. See the primary particle to the radioisotope, and give it the right kinetic energy.

Thanks for your answer!

How to set up the average event rates?

That’s up to you. You’ll be writing C++ code for your PrimaryGeneratorAction.

You could hardwire the rate, and use either CLHEP::RandPoissonQ or G4Poisson to throw randoms to compute the intervals between events.

If you want your application configurable, you could write a UI Messenger class to define a macro command to set the average rate.

Okay, thanks! I will try it.