Hi all,
I want to access the primary particle information in the RunAction as I am storing initial energy and some other stuff as run metadata. I am doing it the following way in the EndOfRunAction, where the GetGeneralParticleSource() function returns the gps object from the PrimaryGeneratorAction and fInpEne is a global variable defined in the RunAction.cc.
const DetBoxPrimaryGeneratorAction* generatorAction
= static_cast<const DetBoxPrimaryGeneratorAction*>(
G4MTRunManager::GetRunManager()->GetUserPrimaryGeneratorAction());
if (generatorAction)
{
const G4GeneralParticleSource* gps = generatorAction->GetGeneralParticleSource();
fInpEne = gps->GetCurrentSource()->GetParticleEnergy() / keV;
}
This works fine for the sequential mode but for the MT mode the fInpEne doesn’t return correct value for the master thread. I suppose this is because for master thread the gps is not initialized?
If so, is there a better way to access this information in the master thread?
Thanks,
Sujay