I’m trying to create ellipsoid particle bunches with GPS, I’m using this macro,
/gps/particle e+
/gps/ene/mono 4 GeV
/gps/pos/type Volume
/gps/pos/shape Ellipsoid
/gps/pos/centre 530 0 -43.5 cm
/gps/pos/halfx 0.5 mm
/gps/pos/halfy 0.5 mm
/gps/pos/halfz 0.5 mm
/gps/ang/type beam2d
/gps/ang/rot1 0 0 -1
/gps/number 1000000
/gps/source/add 1
/gps/particle e-
/gps/ene/mono 7 GeV
/gps/pos/type Volume
/gps/pos/shape Ellipsoid
/gps/pos/centre -530 0 -43.5 cm
/gps/pos/halfx 0.5 mm
/gps/pos/halfy 0.5 mm
/gps/pos/halfz 0.5 mm
/gps/ang/type beam2d
/gps/ang/rot1 0 0 1
/gps/number 1000000
/gps/source/multiplevertex true
from what I understand, this should create an ellipsoidal volume of 0.5x0.5x0.5 mm^3 and put 1,000,000 particles in there, but once I run the simulation and run 1 event ("/run/beamOn 1") it seems like what the GPS does is choose 1 positions limited by the ellipsoidal volume and send all the particles from there instead of sending the particles from different positions inside the volume.
Can someone tell me what I’m doing wrong? Thanks in advance!
Geant4 is really “meant” to do one interaction per event. You accumulate high statistics by running many events and collecting data in histograms or N-tuples.
If you think you’re going to see interactions between the different particles in the event, you won’t. Tracks are entirely independent of one another – they only interact with the geometry (material, fields, etc.).
You can shoot as many primary particles as you want within an event. In your GeneratePrimaries() method of your UserPrimaryGeneratorAction, just make a loop.
That would be equivalent to doing a macro with 1,000,000 sources right? once the ellipsoidal volume is defined it will generate the vertex of the source within the volume? thanks!
This is correct. One invocation to GeneratePrimaryVertex() can generate only one vertex, i.e. staring point of the primary particle. But if you invoke this method multiple times, the vertex is sampled every time. If you want this hard-coded 1000000 to be a variable and controlled by a macro file, you should create your own UI command.