I am trying to simulate the neutron beam shooting particle isotropically in all directions and filling the theta and phi in ntuple. For that I am following the recipe explained in the HAD04 example, which is as follows:
G4double cosTheta = 2G4UniformRand() - 1.,Phi = CLHEP::twopiG4UniformRand();
G4double sinTheta = sqrt(1. - cosTheta*cosTheta);
G4double Px = sinTheta * cos(Phi), Py = sinTheta * sin(Phi), Pz = cosTheta;
Filling theta and phi variable using the direction cosines as follow:
theta (deg) = acos (pz) * (180/pi);
phi (deg)= atan2(Py,Px)*(180/pi)
In theta ( 0 - 180 degrees), there is huge number of values between 0-2 degree in comparison to rest of values.
Similarly, for Phi(deg) values (-180 to 180 ) , there is dominant contribution for range 0-4 degree.
I can’t understand this behavior. I would like to know if i am doing any mistake in the procedure.
Thank you in advance.