Message: Re: distribution uniform Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: distribution uniform 

Forum: Event and Track Management
Re: None distribution uniform (Chaw)
Date: 12 Jul, 2011
From: michel maire <michel maire>

On Mon, 11 Jul 2011 12:22:55 GMT, Chaw wrote:
> Hi,
> 
> I have a litle problem. I would like to have a distribution uniform
> between 0 and 4pi.
> 
>  G4double phi = 2*pi*G4UniformRand();
>   G4double cosTheta = G4UniformRand();
>   G4double sinTheta = std::sqrt(1. - cosTheta*cosTheta);
>   G4double ux = sinTheta*std::cos(phi),
>            uy = sinTheta*std::sin(phi),
>            uz = -cosTheta;
> It's distribution uniform in 2*pi?
> 

  G4double cosTheta = 2*G4UniformRand() - 1;  --> theta in (0,pi)
  (see TestEm4)

 Add Message Add Message
to: "Re: distribution uniform"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]