6MeV e-
This commit is contained in:
parent
d159c826e8
commit
4c5eee2b96
|
@ -0,0 +1,32 @@
|
|||
//
|
||||
// MedtechPrimaryGeneratorAction.hh
|
||||
// medtech
|
||||
//
|
||||
// Created by Baranyai David on 2018. 04. 01..
|
||||
//
|
||||
|
||||
#ifndef MedtechPrimaryGeneratorAction_hh
|
||||
#define MedtechPrimaryGeneratorAction_hh
|
||||
|
||||
#include <stdio.h>
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Types.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class MedtechPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
MedtechPrimaryGeneratorAction();
|
||||
virtual ~MedtechPrimaryGeneratorAction();
|
||||
virtual void GeneratePrimaries(G4Event* anEvent);
|
||||
|
||||
// method to access particle gun
|
||||
const G4ParticleGun* GetParticleGun() const { return particleGun; }
|
||||
private:
|
||||
G4ParticleGun *particleGun;
|
||||
};
|
||||
|
||||
#endif /* MedtechPrimaryGeneratorAction_hh */
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// MedtechPrimaryGeneratorAction.cc
|
||||
// medtech
|
||||
//
|
||||
// Created by Baranyai David on 2018. 04. 01..
|
||||
//
|
||||
|
||||
#include "MedtechPrimaryGeneratorAction.hh"
|
||||
|
||||
MedtechPrimaryGeneratorAction::MedtechPrimaryGeneratorAction()
|
||||
{
|
||||
G4int numberOfParticles = 1;
|
||||
particleGun = new G4ParticleGun(numberOfParticles);
|
||||
G4ParticleTable *particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4ParticleDefinition *particle = particleTable -> FindParticle("e-");
|
||||
particleGun -> SetParticleDefinition(particle);
|
||||
particleGun -> SetParticlePosition(G4ThreeVector(1,1,1));
|
||||
particleGun -> SetParticleMomentumDirection(G4ThreeVector(0, 0, 4*m));
|
||||
particleGun -> SetParticleEnergy(6*MeV);
|
||||
}
|
||||
|
||||
MedtechPrimaryGeneratorAction::~MedtechPrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
}
|
||||
|
||||
void MedtechPrimaryGeneratorAction::GeneratePrimaries(G4Event *anEvent)
|
||||
{
|
||||
particleGun -> SetParticlePosition(G4ThreeVector(0, 0, 0));
|
||||
particleGun -> GeneratePrimaryVertex(anEvent);
|
||||
}
|
Loading…
Reference in New Issue