How to emit particles with the position of a Gaussian distribution by using "gps" command


In the user guide, I didn’t find the “/gps/pos/…” command which can emit particles with the position of a Gaussian distribution, how can I achieve this function in a “.mac” file?
Thanks for your help.

Dear Jiechen_Jiang

Please check page 10 in this website:

Best regards,
Jaeyoung Jeong

Dear Jaeyoung Jeong,
Thanks for your reply, I tried the command as you mentioned, “/gps/pos/sigma_r”, the distribution is not Gaussion as you can see in the figure whatever I changed the parameters. In my opinion, this command
can only change the position of center of a circle rather than emit particles with a known distribution.

Best regards

Dear Jiechen_Jiang

I tried below command and I got gaussian distribution of vertex y position

/gps/particle gamma
/gps/pos/type Beam
/gps/energy 6 MeV
/gps/ang/type beam1d
/gps/pos/radius 0. mm
/gps/pos/sigma_y 1 mm

/run/beamOn 1000000

in EventAction source code…

void B1EventAction::EndOfEventAction(const G4Event* event)
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
G4double temp=event->GetPrimaryVertex()->GetY0();
analysisManager → FillH1(0,temp/cm,1.0);

I wonder what macros you used and what code you applied.

Best regards

Dear Jaeyoung Jeong

After I saw your code, I got my mistake. In the beginning, I set the radius with several micron meters which caused the spread of the position of center of a circle.
Thanks a lot again.
Best regards