Since I upgraded my Monte Carlo code to version 8.2 with path 01, a code for low energy x-ray simulation does not work anymore. The following error shows up when I try to run it. G4Exception : Event00003 issued by : G4ParticleGun::SetParticleDefinition() Null pointer is given. *** Fatal Exception *** core dump *** The PrimaryGeneratorAction file does have the following: G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); G4String particleName; G4ParticleDefinition* particle = particleTable->FindParticle(particleName="gamma"); particleGun->SetParticleDefinition(particle);
Could you provide the following information to understand your problem? 1) What was the version you used previously? 2) Is there any other warning message before the exception? 3) Check the order in your main() so that the construction of your primary generator action is AFTER the instantiation and registration of your physics list.
It turned out that the was no particle defined in the user's physics list. It might work for v6.1, but does not work since v7.0 when all particle definitions became dynamic. Defining all the necessary particles in the user's physics list fixed the problem.