Problem 938

Summary: SetParticleDefinition fails after upgrading to geant4 ver8.2.p01
Product: Geant4 Reporter: Arun <aganguly>
Component: runAssignee: asai
Status: RESOLVED INVALID    
Severity: normal    
Priority: P1    
Version: 8.2   
Hardware: Other   
OS: Linux   

Description Arun 2007-04-25 00:27:54 CEST
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);
Comment 1 asai 2007-04-25 00:38:08 CEST
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.
Comment 2 asai 2007-05-03 20:27:58 CEST
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.