Hello! In my task free sodium ions, as well as non-bridge oxygen atoms, arise in glass under the influence of proton radiation. Sodium ions also drift under the influence of the electric field of protons induced into the sample. So, I’m trying to understand how to
implement these facts in my PhysicsList. That is how I’ve tried make this (шt didn’t work out). In constructor a standart electromagnetic physics was registered. And in ConstructParticle() I tried to create a sodium ion. A G4GenericIon::GenericIonDefinition() command is included because it necessary to declare an ions possible occurrence (or not?)
#include "physics.hh"
MyPhysicsList::MyPhysicsList()
{
RegisterPhysics(new G4EmStandardPhysics());
//RegisterPhysics(new G4OpticalPhysics());
}
MyPhysicsList::~MyPhysicsList()
{}
void MyPhysicsList::ConstructParticle()
{
//G4Electron::ElectronDefinition();
//G4Proton::ProtonDefinition();
//G4Gamma::GammaDefinition();
G4GenericIon::GenericIonDefinition();
G4IonTable *ionTable = G4IonTable::GetIonTable();
G4ParticleDefinition *na_ion = ionTable->GetIon(11, 23, 0);
G4String ion_name = ionTable->GetIonName(11, 23, 0);
std::ofstream file("/home/ivantozavr/Geant_Projects/output/mytext.txt");
if (file.is_open())
{
file << na_ion->GetParticleName () << G4endl;
file.close();
}
}
At program startup a “*** G4Exception : PART105
issued by : G4IonTable::CreateIon()
Can not create ions because GenericIon is not ready” error occurs. That’s my first project and it looks like I’m not realize how PhisicsList works in Geant4. Some examples was viewed but I have not met projects where particular ions were created.
I will be glad of any help!
_Geant4 Version:_11.2.2
_Operating System:_Linux Mint 21.3
_Compiler/Version:_gcc 11.4.0
_CMake Version:_3.22.1