Download presentation
Presentation is loading. Please wait.
Published byCori Miller Modified over 9 years ago
1
Generating Primary Particles Each Geant4 Event starts with generation of one or multiple primary particles It is up to the user to define primary particle properties Particle type, e.g. electron, gamma, ion Initial kinetics, e.g. energy, momentum, origin and direction Additional properties, e.g. polarization These properties can be divided into a primary vertex: starting point in space and time Primary particle: initial momentum, polarization, PDG code, list of daughters for decay chains A primary particle can be a particle which can not usually be tracked by Geant4 1
2
The PrimaryGenerator A primary generator is a class derived from G4VPrimaryGenerator which implements a GeneratePrimaryVertex() method In this method the primary vertex and the primary particle are added to a Geant4 Event Often it is practical to use an existing generator: G4HEPEvtInterface G4HEPMCInterface G4GeneralParticleSource G4ParticleGun 2 Examples of experiment-specific generators. Control via text files More general purpose. For volume and surface sources Also for beams. Can be used to produce a beam of particles
3
PrimaryGeneratorAction Mandatory user action which controls the generation of primary particles It should not generate primaries itself. The primary generator does this. Implement your particle “shot”, “rail”, or machine gun here. It can also be a particle bomb if you like. By using e.g. the G4ParticleGun Repeatedly for a single event Sampling particle type and direction randomly Or using one of the other event generators 3
4
PrimaryGeneratorAction PrimaryGeneratorAction Inherits from G4VUserPrimaryGeneratorAction User should override GeneratePrimaries for particle generation 4 PrimaryGeneratorAction::PrimaryGeneratorAction(const G4String & parName, G4double energy, G4ThreeVector pos, G4ThreeVector momDirection){ const G4int nParticles = 1; fParticleGun = new G4ParticleGun(nParticles); G4ParticleTable* parTable = G4ParticleTable::GetParticleTable(); G4ParticleDefinition* parDefinition = parTable- >FindParticle(parName); fParticleGun->SetParticleDefinition(parDefinition); fParticleGun->SetParticleEnergy(energy); fParticleGun->SetParticlePosition(pos); fParticleGun->SetParticleMomentumDirection(momDirection); } The primary generator
5
Class PrimaryGeneratorAction Inherits from G4VUserPrimaryGeneratorAction User should override GeneratePrimaries for particle generation 5 PrimaryGeneratorAction::GeneratePrimaries(G4Event* evt){ //some additional random sampling here fParticleGun->GeneratePrimaryVertex(evt); }
6
Alternative Method: GPS The General Particle Source (GPS) 1 provides a high- level interface to G4ParticleGun, mainly using macros Define source types: point, beam, plane, surface, volume Define angular distribution: isotropic, cosine-law, planar, 1d/2d beams, user defined Define energy distribution: mono-energetic, linear, power-law, exponential, gaussian, Bremsstrahlung-spectrum, black body spectrum, cosmic diffuse gamma ray, user defined Angular and energy distributions can be interpolated from histogrammed distributions To use simply replace G4ParticleGun in PrimaryGeneratorAction with G4GeneralParticleSource 6
7
Alternative Method: GPS For full documentation: http://reat.space.qinetiq.com/gps/new_gps_sum_fi les/gps_sum.htm http://reat.space.qinetiq.com/gps/new_gps_sum_fi les/gps_sum.htm 7
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.