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

Question random generation of particles in 3D 

Forum: Particles
Date: 14 Jul, 2003
From: valerie <valerie>

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

V

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

1 None: Re: random generation of particles in 3D   (Vladimir IVANTCHENKO - 14 Jul, 2003)
2 Idea: Re: random generation of particles in 3D   (Domingo Granero - 14 Jul, 2003)
3 None: Re: random generation of particles in 3D   (michel maire - 15 Jul, 2003)
1 Note: Re: random generation of particles in 3D   (Dan Xu - 23 Jul, 2003)
(_ None: Re: random generation of particles in 3D   (michel maire - 28 Jul, 2003)
 Add Message Add Message
to: "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 ]