Message: Re: Particles with 3 different energies Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: Particles with 3 different energies 

Keywords: paricles energy
Forum: Particles
Re: None Particles with 3 different energies (Konstantinos Michael )
Re: Feedback Re: Particles with 3 different energies (Gumplinger Peter)
Re: None Re: Particles with 3 different energies (Areg)
Date: 09 Nov, 2007
From: Gumplinger Peter <Gumplinger Peter>

Another good question! It has me wondering too seeing that:


has anEvent as argument. It's not that by calling GeneratePrimaryVertex three times you have 'three mini-events'. The pointer anEvent is needed to attach a new vertex to the ONE event (anEvent). In:

void G4ParticleGun::GeneratePrimaryVertex(G4Event* evt)
  // create a new vertex
  G4PrimaryVertex* vertex =
    new G4PrimaryVertex(particle_position,particle_time);
  evt->AddPrimaryVertex( vertex );

What you are doing with each call to G4ParticleGun::GeneratePrimaryVertex is instantiate a new vertex (the location could be different from the previous invocation) and a new primary track. The method attaches the track to the vertex and the vertex to the event-pointer.

So, you can not only have one event with one vertex and multiple primary tracks, but one event with multiple vertexes, each of which may have one or more primary tracks originating from it.

To get more than one vertex location you need to change the position between calls to GeneratePrimaryVertex with:


If you want to off-set the time between primary tracks from the same or different vertex location, you need to call:


between calls to GeneratePrimaryVertex

> how many times will EndOfEventAction() be called?

Only once!

Note, each call to G4ParticleGun::GeneratePrimaryVertex instantiates a a new primary track AND a new vertex. So, the number of such vertexes is the same as the number of primary tracks. You only get more primary tracks than vertexes if you specify:

particleGun = new G4ParticleGun(n_particle);

with n_particle>1 but this is not particularly useful because each of these n_particles originating from the same vertex is identical in every respect.

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

1 None: Re: Particles with 3 different energies   (Areg - 09 Nov, 2007)
(_ More: Re: Particles with 3 different energies   (Peter Gumplinger - 12 Nov, 2007)
 Add Message Add Message
to: "Re: Particles with 3 different energies"

 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 ]