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: 15 Jul, 2003
From: michel maire <michel maire>

User valerie wrote:

>> 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??

   For spherical generation, see
 examples/extended/electromagnetic/TestEm4/Em4PrimaryGeneratorAction::GeneratePrimaries()
>> 
>> --------------------------------------------------
>>  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 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: "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 ]