Message: Re: random generation of particles in 3D Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: random generation of particles in 3D 

Forum: Particles
Re: Question random generation of particles in 3D (valerie)
Date: 14 Jul, 2003
From: Vladimir Ivanchenko <Vladimir Ivanchenko>

On Mon, 14 Jul 2003, valerie wrote:

> *** Discussion title: Particles
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/particles/31"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Would like to send particles randomly in space. I tried these options
> and only the latter seemed to, in short, agree with the experimental
> results.
> 
> --------------------------------------------------
>  G4double theta = (twopi)*G4UniformRand(), phi = pi*G4UniformRand();
>  G4double ux = cos(theta)*sin(phi),
>           uy = sin(theta)*sin(phi),
>           uz = cos(phi);
>  particleGun->SetParticleMomentumDirection(G4ThreeVector(ux,uy,uz));
> --------------------------------------------------
> 
> or is it valid??
> 
> --------------------------------------------------
>  G4double ux = 2.*(G4UniformRand()-0.5),
>           uy = 2.*(G4UniformRand()-0.5),
>           uz = 2.*(G4UniformRand()-0.5); 
> particleGun->SetParticleMomentumDirection(G4ThreeVector(ux,uy,uz));
> --------------------------------------------------
> 
> simply it is a question of coordinates, which one is the standard,
> cartesian or spherical?
> 
> ciao
> 

It is correct. Try command "/tracking/verbose 1" to see the history.

VI

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

 Add Message Add Message
to: "Re: random generation of particles in 3D"

 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 ]