Hi,
In my code, I’m trying to define particles as neutron in the PrimaryParticleGenerator.cc script through
G4ParticleDefinition* particle = G4Neutron::Definition();
In my PhysicsList.cc I have included a reference physics list through
RegisterPhysics( new G4HadronPhysicsQGSP_BERT_HP(verbose));
I don’t have anything further setup; i.e. no ConstructParticle(), etc. My code compiles fine. However, during the run I see the warning before it crashes (as the particle is being used)
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : PART101
issued by : G4ParticleDefintion::G4ParticleDefintion
G4ParticleDefinition should be created in PreInit state
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Hi, how come this error is being produced. I though that including the QGSP_BERT_HP library should suffice. Should I just initialize everything through the ConstructParticle() class as
void MyPhysicsList::ConstructParticle(){
// Construct all baryons
G4BaryonConstructor bConstructor;
bConstructor.ConstructParticle();
// Construct all leptons
G4LeptonConstructor lConstructor;
lConstructor.ConstructParticle();
// Construct all mesons
G4MesonConstructor mConstructor;
mConstructor.ConstructParticle();
// Construct all Boson
G4BosonConstructor bsConstructor;
bsConstructor.ConstructParticle();
// Construct all Shortlived
G4ShortLivedConstructor slConstructor;
slConstructor.ConstructParticle();
// Construct Ion
G4IonConstructor iConstructor;
iConstructor.ConstructParticle();
}
I’ve seen the warning disappear but I’m not sure if I’d be overlooking something.
Cheers,
Johan