Question about time in Geant4

If I emit particles in a run,what is the time of this emission?
Or,how to define the time of a emission?

You generate particles in an event, not in a run. Every event starts at time t=0 (but see below).

G4PrimaryParticle::SetProperTime() if you are using your own generator, or /gun/time if you’re using macro commands.

Thanks for replying!
I can only emit one particle in an event.Does one event have to finish before the next event can start? This mean that I can 't control the emission rate of the source ?

No. You can generate as many particles as you want at the start of the event. Those particle(s) will then propagate through your geometry and might create other secondary particles along the way.

Yes. That’s what “event” means in the Geant4 documentation.

The “emission rate” is determined by the number of events you generate. You can translate that into a real-world exposure time by computing it based on the activity of whatever real-world source you are simulating.

So,if I want to generate 10000 particles in 1s,I should

/gun/time 1 s 
/run/beamOn 10000

in my .mac file?

Not at all. Please read the Geant4 Application Developers documentation. There are good detailed explanations of the event loop, of sources, of track timestamps, etc.

I read this from user guide:

 fParticleGun  = new G4ParticleGun(n_particle);
        fParticleGun->SetParticleTime(1*ns);

I guess this can set the launch time as 1ns?

Right. That’s exactly the same (as I noted earlier) as the /gun/time command. it sets the start “time” of the event at 1 ns, instead of at zero. Since you are specifying “n_particle” in the constructor, all of those particles will begin with a timestamp of 1 ns.

Now I understand,Thanks a lot!