Problem 2264 - General Particle Source /ang/type appears not to be set correctly by SetDefaulValue (isotropic)
Summary: General Particle Source /ang/type appears not to be set correctly by SetDefau...
Status: RESOLVED WONTFIX
Alias: None
Product: Geant4
Classification: Unclassified
Component: event (show other problems)
Version: 10.6
Hardware: All All
: P4 minor
Assignee: asai
URL:
Depends on:
Blocks:
 
Reported: 2020-08-07 15:38 CEST by Fabio Zeiser
Modified: 2020-08-10 07:20 CEST (History)
1 user (show)

See Also:


Attachments
visualization_output (10.54 KB, image/png)
2020-08-07 15:38 CEST, Fabio Zeiser
Details

Note You need to log in before you can comment on or make changes to this problem.
Description Fabio Zeiser 2020-08-07 15:38:04 CEST
Created attachment 638 [details]
visualization_output

The general particle source (gps) should by default be set to isotropic. This can be seen in the source code by the `SetDefaulValue` method:

https://github.com/Geant4/geant4/blob/67ba86d073ec6366df0de75a0f5b5d57920d0b7e/source/event/src/G4GeneralParticleSourceMessenger.cc#L394-L398

and is documented this way e.g. in: 
http://geant4-userdoc.web.cern.ch/geant4-userdoc/UsersGuides/ForApplicationDeveloper/html/GettingStarted/generalParticleSource.html?highlight=general%20particle%20source#g4gps-config-histograms

However, this does not seem to be the case. The particles seem to be emitted along the z-axis, or planar. I've experienced this in my own simulations, but I will refer to following example instead:
Geant4-10.6.2/examples/extended/eventgenerator/exgps/

I looked at the visualization when I use eg. macro commands:
```
/gps/particle geantino
/run/beamOn 10
```

see screenshot.
Comment 1 Fabio Zeiser 2020-08-07 15:40:30 CEST
So whilst the default should be set to be `iso` when looking in the source code, it appears to be set to beam1D or something like this.
Comment 2 asai 2020-08-07 19:06:04 CEST
Default value of the UI command means it is used when you issue this command without specifying the parameter value. 

   /gps/ang/typ

It does not necessarily mean the initial value of the program has that "default" value, and actually it is initialized to "planar" as you see here.

https://geant4.kek.jp/lxr/source/event/src/G4SPSAngDistribution.cc#L62

I admit it would nice to coincide the initial value and the default value of the command. But changing the initial value may affect to the other users who innocently rely on the initial value, so this initial value won't be changed.

I'm sorry for your inconvenience but please use /gps/ang/typ command to specify the angle distribution you need.

Regards,
Makoto Asai
Comment 3 Fabio Zeiser 2020-08-10 07:20:24 CEST
Thank you very much for the quick response. Indeed I did not realize that there was this distinction as I usually explicitly specified the type for /gps/ang/type.

I agree that it would be less confusing if the default value would coincide with the initial value. Is it reasonable to open up a "feature request" for that?