Hello everyone,
I’ve been writing a code that simulates the decay of a Rubidium-88 ion, but I can’t seem to solve this error while running the application:
Here is the code for the action generator, if anyone would be able to help locate where exactly the error in the code is, because I can’t seem to find it.
#include "PrimaryActionGenerator.hh"
#include "G4ParticleTable.hh"
#include "G4IonTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4RandomDirection.hh"
PrimaryActionGenerator::PrimaryActionGenerator()
{
// Create a new particle gun
fParticleGun = new G4ParticleGun();
//define Rb88 properties
G4int Z = 37, A = 88;
G4double ionCharge = 37.*eplus;
// Set the particle type to Rubidium-88
G4ParticleDefinition *ion = G4IonTable::GetIonTable()->GetIon(Z, A, 0);
fParticleGun->SetParticleDefinition(ion);
fParticleGun->SetParticleCharge(ionCharge);
// Set the particle energy to the Q value of Rubidium-88 decay (2.018 MeV)
G4double energy = ion->GetPDGMass() - 2.018 * MeV;
fParticleGun->SetParticleEnergy(energy);
// Set the particle position to the center of the detector
fParticleGun->SetParticlePosition(G4ThreeVector(0, 0, 0));
// Set the particle direction randomly
fParticleGun->SetParticleMomentumDirection(G4RandomDirection());
}
PrimaryActionGenerator::~PrimaryActionGenerator()
{
delete fParticleGun;
}
void PrimaryActionGenerator::GeneratePrimaries(G4Event* anEvent)
{
// Generate one primary particle for each event
fParticleGun->GeneratePrimaryVertex(anEvent);
}
I appreciate the time and help!