#include "PrimaryGeneratorAction.hh" #include "globals.hh" #include "G4Event.hh" #include "G4ParticleDefinition.hh" #include "G4LogicalVolumeStore.hh" #include "G4LogicalVolume.hh" #include "G4Box.hh" #include "G4RunManager.hh" #include "G4GeneralParticleSource.hh" #include "G4ParticleTable.hh" #include "G4ParticleDefinition.hh" #include "G4SystemOfUnits.hh" #include "Randomize.hh" //----------------------------------------------------------------------------- // Creating an instance of primary particle generator //----------------------------------------------------------------------------- //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... PrimaryGeneratorAction::PrimaryGeneratorAction() : G4VUserPrimaryGeneratorAction(), fParticleGun(0) { // Use the GPS to generate primary particles, // Particle type, energy position, direction are specified in // macro files. fParticleGun = new G4GeneralParticleSource(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... PrimaryGeneratorAction::~PrimaryGeneratorAction() { delete fParticleGun; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) { // This function is called at the beginning of event fParticleGun -> GeneratePrimaryVertex(anEvent); }