Problem 1294 - Points on Surface not generated uniformly for e.g. G4Tubs
Summary: Points on Surface not generated uniformly for e.g. G4Tubs
Status: RESOLVED DUPLICATE of problem 1074
Alias: None
Product: Geant4
Classification: Unclassified
Component: geometry/solids (show other problems)
Version: 9.4
Hardware: All All
: P5 normal
Assignee: tatiana.nikitina
URL:
Depends on:
Blocks:
 
Reported: 2012-03-11 16:56 CET by Tobias Koettig
Modified: 2012-04-04 09:50 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 Tobias Koettig 2012-03-11 16:56:39 CET
Hello,

I noticed that the points that are generated via the GetPointOnSurface() method are not distributed uniformily for several solids (e.g. G4Tubs, G4Sphere).
For example G4Tubs: As rRand (like phi, but that's o.k.) is generated just using a uniform distribution the points on the bottom and top of the cylinder cluster around r = 0. To obtain a uniform distribution I'd suggest to calculate the angle phi and radius r for the cylinder using the uniform (0,1) distributed random variables v1, v2 as follows

phi = v1 * (phi_max - phi_min) + phi_min (as already done by RandFlat::shoot(fSPhi, fSPhi+fDPhi))
r = sqrt(v2 * (Rmax^2 - Rmin^2) + Rmin^2))

and change the GetPointOnSurface() methods for the other solids accordingly (if possible). Or is there a reason that the points are not generated uniformily?

Thanks in advance,

Tobias
Comment 1 Gabriele Cosmo 2012-04-04 09:50:08 CEST
See comments in #1301 and #1074.

*** This problem has been marked as a duplicate of problem 1074 ***