56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
// This code implementation is the intellectual property of
|
|
// the GEANT4 collaboration.
|
|
//
|
|
// By copying, distributing or modifying the Program (or any work
|
|
// based on the Program) you indicate your acceptance of this statement,
|
|
// and all its terms.
|
|
//
|
|
// $Id: Em1PrimaryGeneratorAction.cc,v 1.1.4.1 1999/12/07 20:46:55 gunter Exp $
|
|
// GEANT4 tag $Name: geant4-01-00 $
|
|
//
|
|
//
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
|
|
#include "Em1PrimaryGeneratorAction.hh"
|
|
|
|
#include "G4Event.hh"
|
|
#include "G4ParticleGun.hh"
|
|
#include "G4ParticleTable.hh"
|
|
#include "G4ParticleDefinition.hh"
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
|
|
Em1PrimaryGeneratorAction::Em1PrimaryGeneratorAction()
|
|
{
|
|
G4int n_particle = 1;
|
|
particleGun = new G4ParticleGun(n_particle);
|
|
|
|
// default particle kinematic
|
|
|
|
G4ParticleDefinition* particle
|
|
= G4ParticleTable::GetParticleTable()->FindParticle("e-");
|
|
particleGun->SetParticleDefinition(particle);
|
|
particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
|
|
particleGun->SetParticleEnergy(100*MeV);
|
|
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,0.*cm));
|
|
}
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
|
|
Em1PrimaryGeneratorAction::~Em1PrimaryGeneratorAction()
|
|
{
|
|
delete particleGun;
|
|
}
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
|
|
void Em1PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
|
{
|
|
particleGun->GeneratePrimaryVertex(anEvent);
|
|
}
|
|
|
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|
|