G4Scintillation does not implement the virtual BuildPhysicsTable(const G4ParticleDefinition &), probably because it would be redundant to build it again and again for every charged particle. However, the substitute function BuildThePhysicsTable() is called only once: in the constructor of G4Scintillation. Therefore, if we add a new G4Material with material properties such as "SCINTILLATIONYIELD", "FASTCOMPONENT" and "FASTTIMECONSTANT" defined, they will never be translated to entries in theFastIntegralTable. The result is a segmentation fault, when the non-existent entry is queried. There are two possible fixes: 1) call BuildThePhysicsTable() in BuildPhysicsTable(const G4ParticleDefinition &), but only once per instance. That could work by counting with how many particles the process is registered, and then actually build the table only every nth time. 2) make BuildThePhysicsTable() public, transferring the responsibility to check whether it is necessary to the user (a cheap solution imo). I have version 9.10 of Geant4 installed, so I don't know whether this problem has been fixed in the current version.
Hello, Please, be more precise in the description: 1) Geant4 version 9.10 does not exist, please, specify is it 9.6 or 9.6+patch, or what? 2) Please, be more specific - do you have several runs per job and you change materials between run, you add a material during the run, or what? 3) ideally you need to attach a tar with the application which crashes and with instructions how to get the crash; if you cannot do that try to use existing Geant4 examples where you reproduce the crash. This will speed up the fix or at least make a possibility to figure out how to get your application running without the crash. VI
Thanks for the fast reply. 1) This is the output of geant: ************************************************************* Geant4 version Name: geant4-09-06 (30-November-2012) Copyright : Geant4 Collaboration Reference : NIM A 506 (2003), 250-303 WWW : http://cern.ch/geant4 ************************************************************* So, I guess it is indeed 9.6 and not 9.10. 2) The problem arises when a previously non-scintillating material becomes scintillating (i.e. the required entries are made in its G4MaterialPropertiesTable) or a scintillating material is created AFTER the G4Scintillation constructor is called. This does not depend on whether it happens during a run or in between runs, since G4Scintillation objects are usually created with all other processes. The reason behind creating new scintillating materials is, that it is not possible to change a material's density. If I want to set the density via UI, the program has to create a new material with the exact properties as the old, except the density. 3) I got my application running by adding virtual void BuildPhysicsTable(const G4ParticleDefinition &) { if(theFastIntegralTable != NULL) theFastIntegralTable->clearAndDestroy(); delete theFastIntegralTable; theFastIntegralTable = NULL; if(theSlowIntegralTable != NULL) theSlowIntegralTable->clearAndDestroy(); delete theSlowIntegralTable; theSlowIntegralTable = NULL; BuildThePhysicsTable(); } // build the physics table every time the physics get modified. to the header file of G4Scintillation: source/processes/electromagnetic/xrays/include/G4Scintillation.hh This dirty fix overrides the BuildPhysicsTable() method, which gets called every time the physics have been modified before a run. It deletes the old integral tables and then calls the protected void BuildThePhysicsTable() to create new tables, which then incorporate any new materials.
Thank you for reporting this! I have adopted your fix with tag xrays-V10-00-05.