70 likes | 277 Views
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
E N D
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 notusually be tracked by Geant4
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 Examples of experiment-specificgenerators. Control via text files More general purpose. Forvolume and surface sourcesAlso for beams. Can be used to produce a beam of particles
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
PrimaryGeneratorAction • Inherits from G4VUserPrimaryGeneratorAction • User should override GeneratePrimaries for particle generation 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
Class PrimaryGeneratorAction • Inherits from G4VUserPrimaryGeneratorAction • User should override GeneratePrimaries for particle generation PrimaryGeneratorAction::GeneratePrimaries(G4Event* evt){ //some additional random sampling here fParticleGun->GeneratePrimaryVertex(evt); }
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
Alternative Method: GPS • For full documentation:http://reat.space.qinetiq.com/gps/new_gps_sum_files/gps_sum.htm