Message: Re: Update Geometry Before Run/BeamOn leads to Segfault Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Warning Re: Update Geometry Before Run/BeamOn leads to Segfault 

Forum: Geometry
Re: Question Update Geometry Before Run/BeamOn leads to Segfault (Yugeng He)
Date: 19 Jul, 2013
From: Michael H. Kelsey <Michael H. Kelsey>

On Fri, 19 Jul 2013 14:49:16 GMT, Yugeng He wrote:
> I'm working on the liquid xenon particle detector project and I'm trying
> to experiment with various parameters in my detector geometry to find
> the optimal setup.

When you modify your geometry, are you changing the structure, or changing materials? I notice that your traceback shows the crash happening in NeutronHP:

> #5  0x00007f2146751c8b in G4NeutronHPData::DoPhysicsVector(G4NeutronHPVector*) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/
> #6  0x00007f2146758aff in G4NeutronHPElasticData::BuildPhysicsTable(G4ParticleDefinition const&) () from /home/daranday/geant4/geant4.9.4.p04/lib/Linux-g++/

NeutronHP has an unfortunate "feature", that it preloads all of its material-dependent cross-section tables at the beginning of the job. You've surely seen those hundreds of lines of useless warning messages about different HP files not being found, blah, blah, blah...

Anyway, the problem is that if you create a new material _after_ NeutronHP has done its preloading, then the first time a neutron encounters that material, you'll get a segfault, because there won't be any table entries found. This is embedded deep in the guts of HP, and cannot be fixed in any straightforward way.

What you need to do is to pre-define all of your materials before you instantiate your physics list. If you are using the so-called "NIST" materials in G4, you also have to call GetMaterial() for all of them, so that they get instantiated and added to the table of pointers. In my own application, I do this by having a singleton "material table" class which gets instantiated at the beginning of the job, and creates all the materials.

     -- Michael Kelsey

 Add Message Add Message
to: "Re: Update Geometry Before Run/BeamOn leads to Segfault"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]