Problem 2611 - Anisotropic angle distribution in isotropic flux
Summary: Anisotropic angle distribution in isotropic flux
Status: CLOSED INVALID
Alias: None
Product: Geant4
Classification: Unclassified
Component: event (show other problems)
Version: 11.2
Hardware: All All
: P4 minor
Assignee: Makoto Asai
URL:
Depends on:
Blocks:
 
Reported: 2024-05-01 20:53 CEST by Yaroslav Strilchuk
Modified: 2024-05-01 23:49 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Yaroslav Strilchuk 2024-05-01 20:53:21 CEST
In G4SPSAngDistribution::GenerateIsotropicFlux(), cosine of a uniformly distributed random angle is not calculated in the proper way:

https://github.com/Geant4/geant4/blob/master/source/event/src/G4SPSAngDistribution.cc#L348

costheta = std::cos(MinTheta) - rndm * (std::cos(MinTheta) - std::cos(MaxTheta));

Suggested fix:

Theta = MinTheta - rndm * (MinTheta - MaxTheta);
costheta = std::cos(Theta);

The bug affects at least GPS's sources with angular distribution set to "iso" and results in primaries of the expected isotropic flux being less likely oriented towards the poles.
Comment 1 Makoto Asai 2024-05-01 21:17:29 CEST
Theta is azimuth angle. If it is not biased, it should distribute between 0 to pi/2, not evenly but in cosine shape. 

The current implementation is correct. If theta distributes evenly as you suggest, tracks would concentrate to the polar region.
Comment 2 Makoto Asai 2024-05-01 21:20:49 CEST
Sorry, "0 to pi/2" should read "0 to pi".
Comment 3 Yaroslav Strilchuk 2024-05-01 23:49:29 CEST
Thank you, my bad.