Define isotropic source radiation

As far as I know I have to specify the directions the particle source can emit particles on my own.
I’m doing this via

SetParticleMomentumDirection(x, y, z)

and to provide an isotropic emission behaviour I’m using


for all parameters. I’d say this works but I don’t understand why. For example, when I use only


for the z-direction, then the source emits particles only in one half of 4*Pi. But with -0.5 it emits in all directions. According to What is the range of numbers generated by G4UniformRand()? the function G4UniformRand selects numbers between {0, 1} so when I subtract 0.5 I’d expect that I’d change only the angle of emission and not the angle range itself.

Could someone please shed some light on me? Thank you!

I also need to know how I can specify the emission angle. Now, I’m using

G4double cosTheta = 2G4UniformRand()-1., phi = 23.14159265359G4UniformRand();
G4double sinTheta = std::sqrt(1. - cosTheta
G4double ux = sinThetastd::cos(phi),
uz = sinTheta
uy = cosTheta;
G4ThreeVector orient(ux, uy, uz);

which is what I was looking for, at least, it looks like. But how can I restrict the emission angle to, e.g., 40 ° - 60 ° for uy?
As far as I can see, I cannot tilt the source, only position it in x, y, z?