Message: Re: G4ParticleChange::CheckIt Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: G4ParticleChange::CheckIt 

Forum: Event and Track Management
Re: Question G4ParticleChange::CheckIt (Derek Mackay)
Date: 19 Aug, 2010
From: Michael H. Kelsey <Michael H. Kelsey>

On Thu, 19 Aug 2010 18:06:32 GMT, Derek Mackay wrote:
> Hello,
> 
> I'm creating photons in a PostStepDoIt. I define my photon as follows:
> 
> G4DynamicParticle* aPhoton = new G4DynamicParticle
> (G4OpticalPhoton::OpticalPhoton(),photon_direction,electron_kinetic);
> 
> I define a photon direction G4ThreeVector and then I normalize it as
> follows:
> 
> photon_direction = 1./photon_direction.mag()*photon_direction;

If "photon_direction" is really just a momentum vector, you can use

  photon_direction.unit()

directly in the constructor, no math required. Let the vector do it for you.

-- Michael Kelsey

 Add Message Add Message
to: "Re: G4ParticleChange::CheckIt"

 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 ]