Message: Re: About G4ParticleGun Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: About G4ParticleGun 

Forum: Event and Track Management
Re: Question About G4ParticleGun (Evgenya)
Date: 25 Nov, 2009
From: Gumplinger Peter <Gumplinger Peter>

Hello Evgenia,

> particleGun = new G4ParticleGun(1);

This means you are shooting one particle per event loop.

> for (int i=0; i<50; i++)

For one primary particle in each event loop you should NOT have a loop inside your GeneratePrimaries method. This is taken care off instead with /run/beamOn 50

Hence, all you need to do is:

rnd = G4UniformRand();

E = 10/(std::sqrt(1.0-63.0*rnd/64.0));

particleGun->SetParticleEnergy(E*keV);

particleGun->SetParticlePosition(G4ThreeVector(Xc, Yc, -5.0*cm));

Your code, as it is written, will have all particles initially travel in the +z direction.

Peter

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

1 None: Re: About G4ParticleGun   (Evgenya - 26 Nov, 2009)
 Add Message Add Message
to: "Re: About G4ParticleGun"

 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 ]