Message: MomentumDirection not-completely random behaviour Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question MomentumDirection not-completely random behaviour 

Forum: Particles
Date: 26 Jun, 2016
From: <Dmytro>

Dear All,

I'm using G4ParticleGun to create a source isotropically emtting gammas with energy randomly sampled from 0 to 661 keV range.
The code is following:

  G4double cosTheta1 = 2.0*G4UniformRand() - 1.0, phi1 = twopi*G4UniformRand();
  G4double sinTheta1 = sqrt(1.0 - cosTheta1*cosTheta1);
  G4double ux1 = sinTheta1*cos(phi1),
           uy1 = sinTheta1*sin(phi1)
            uz1 = cosTheta1;

 G4double energy1= 661*G4UniformRand();

  particleGun->SetParticlePosition(G4ThreeVector(0., 0., 0.));


The problem is - momentum distribution is not flat, but has a peak at 0 for all projections (x,y,z).
If I switch to momoenergy ( G4double energy1= 661;) momentum distributions are flat as expected.
Could someone, please, comment why it"s happening and how to make itisotropic in my case?

 Add Message Add Message
to: "MomentumDirection not-completely random behaviour"

 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 ]