Hadronic physics fails to work in my user physics list after migrating from Geant4 10.5.1 to 10.6.1

I have a program that worked properly under Geant4 10.5.1 as recently as February 2020. I use my own custom Physics List because I have to modify particle-specific aspects of scintillation. I have since upgraded to Geant4 10.6.1 and I recently recompiled and tried to execute the program without any changes. It now fails to work. It appears to fail to find proton cross sections and throws an exception in G4HadronicProcess. It outputs an error message and halts before even attempting ‘beam on’.

(The program models scintillation in different scintillator/PMT combinations irradiated by various hadronic particle and gamma ray beams of low energy (<20 MeV). It outputs a file of the number of scintillation and PMT photons for each event and it has been working for several years.)

With debugger on:

"-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : had001
issued by : G4CrossSectionDataStore::BuildPhysicsTable
No cross section is registered for proton

*** Fatal Exception *** core dump ***
**** Track information is not available at this moment
**** Step information is not available at this moment

-------- EEEE -------- G4Exception-END --------- EEEE -------

*** G4Exception: Aborting execution ***

Program received signal SIGABRT, Aborted.
0x00007ffff09a0a25 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: dnf debuginfo-install bzip2-libs-1.0.8-2.fc32.x86_64 expat-2.2.8-2.fc32.x86_64 freetype-2.10.1-2.fc32.x86_64 glib2-2.64.3-1.fc32.x86_64 graphite2-1.3.14-1.fc32.x86_64 harfbuzz-2.6.4-3.fc32.x86_64 libICE-1.0.10-3.fc32.x86_64 libSM-1.2.3-5.fc32.x86_64 libX11-1.6.9-3.fc32.x86_64 libXau-1.0.9-3.fc32.x86_64 libXext-1.3.4-3.fc32.x86_64 libXmu-1.1.3-3.fc32.x86_64 libXt-1.2.0-1.fc32.x86_64 libgcc-10.1.1-1.fc32.x86_64 libgcrypt-1.8.5-3.fc32.x86_64 libglvnd-1.3.1-1.fc32.x86_64 libglvnd-glx-1.3.1-1.fc32.x86_64 libgpg-error-1.36-3.fc32.x86_64 libicu-65.1-2.fc32.x86_64 libpng-1.6.37-3.fc32.x86_64 libstdc+±10.1.1-1.fc32.x86_64 libuuid-2.35.2-1.fc32.x86_64 libxcb-1.13.1-4.fc32.x86_64 lz4-libs-1.9.1-2.fc32.x86_64 mesa-libGLU-9.0.1-2.fc32.x86_64 pcre2-utf16-10.35-1.fc32.x86_64 qt5-qtbase-5.13.2-5.fc32.x86_64 qt5-qtbase-gui-5.13.2-5.fc32.x86_64 systemd-libs-245.4-1.fc32.x86_64 zlib-1.2.11-21.fc32.x86_64
(gdb) trace back
Tracepoint 1 at 0x7ffff0da3c00 (9 locations)
(gdb) where
#0 0x00007ffff09a0a25 in raise () from /lib64/libc.so.6
#1 0x00007ffff0989895 in abort () from /lib64/libc.so.6
#2 0x00007ffff0f779cd in G4Exception(char const*, char const*, G4ExceptionSeverity, char const*) ()
from /home/jmcfee/geant4/geant4.10.6.p01-install/lib64/libG4global.so
#3 0x00007ffff0f77b60 in G4Exception(char const*, char const*, G4ExceptionSeverity, std::__cxx11::basic_ostringstream<char, std::char_traits, std::allocator >&) ()
from /home/jmcfee/geant4/geant4.10.6.p01-install/lib64/libG4global.so
#4 0x00007ffff24b0bcc in G4CrossSectionDataStore::BuildPhysicsTable(G4ParticleDefinition const&) ()
from /home/jmcfee/geant4/geant4.10.6.p01-install/lib64/libG4processes.so
#5 0x00007ffff24f0448 in G4HadronicProcess::BuildPhysicsTable(G4ParticleDefinition const&) ()
from /home/jmcfee/geant4/geant4.10.6.p01-install/lib64/libG4processes.so
#6 0x00007ffff6365ca7 in G4VUserPhysicsList::BuildPhysicsTable(G4ParticleDefinition*) () from /home/jmcfee/geant4/geant4.10.6.p01-install/lib64/libG4run.so
#7 0x00007ffff636670e in G4VUserPhysicsList::BuildPhysicsTable() ()
from /home/jmcfee/geant4/geant4.10.6.p01-install/lib64/libG4run.so
#8 0x00007ffff634f3fe in G4RunManagerKernel::BuildPhysicsTables(bool) ()
from /home/jmcfee/geant4/geant4.10.6.p01-install/lib64/libG4run.so
#9 0x00007ffff634f90e in G4RunManagerKernel::RunInitialization(bool) ()
from /home/jmcfee/geant4/geant4.10.6.p01-install/lib64/libG4run.so
–Type for more, q to quit, c to continue without paging–
#10 0x00007ffff6340b24 in G4RunManager::RunInitialization() ()
from /home/jmcfee/geant4/geant4.10.6.p01-install/lib64/libG4run.so
#11 0x00007ffff633bd2d in G4RunManager::BeamOn(int, char const*, int) ()
from /home/jmcfee/geant4/geant4.10.6.p01-install/lib64/libG4run.so
#12 0x00007ffff6346dbb in G4MTRunManager::Initialize() ()
from /home/jmcfee/geant4/geant4.10.6.p01-install/lib64/libG4run.so
#13 0x000000000040815a in main (argc=3, argv=0x7fffffffcad8)
at /home/jmcfee/geant4_workdir/OpLaCl3AccumulateGPS/OpNovice.cc:147
(gdb) "

I have made no changes to the code between the 10.5.1 and 10.6.1 runs except to add a line “#include “G4Types.hh”” at the beginning of main to eliminate a compile error in the kernel initialization line in main: “runManager->Initialize();”:

“In function ‘int main(int, char**)’:
/home/jmcfee/geant4_workdir/OpLaCl3AccumulateGPS/OpNovice.cc:122:3: error: ‘G4MTRunManager’ was not declared in this scope; did you mean ‘G4RunManager’?
122 | G4MTRunManager * runManager = new G4MTRunManager;”

I have attached my Physicslist. I can find no obvious problem with it.

Any help is gratefully appreciated. Thanks.

OpNovicePhysicsList.cc (23.8 KB)

Could you please post the set of environment variables you have pointing to the datasets?
I have this for Geant4 10.6.2:

$ env | grep G4 | sort | sed 's/=/ /' | column -t
G4ABLADATA         /usr/share/geant4/data/G4ABLA3.1
G4ENSDFSTATEDATA   /usr/share/geant4/data/G4ENSDFSTATE2.2
G4INCLDATA         /usr/share/geant4/data/G4INCL1.0
G4LEDATA           /usr/share/geant4/data/G4EMLOW7.9.1
G4LEVELGAMMADATA   /usr/share/geant4/data/PhotonEvaporation5.5
G4NEUTRONHPDATA    /usr/share/geant4/data/G4NDL4.6
G4PARTICLEHPDATA   /usr/share/geant4/data/G4TENDL1.3.2
G4PARTICLEXSDATA   /usr/share/geant4/data/G4PARTICLEXS2.1
G4PIIDATA          /usr/share/geant4/data/G4PII1.3
G4RADIOACTIVEDATA  /usr/share/geant4/data/RadioactiveDecay5.4
G4REALSURFACEDATA  /usr/share/geant4/data/RealSurface2.1.1
G4SAIDXSDATA       /usr/share/geant4/data/G4SAIDDATA2.0

Do you notice any difference in datasets and versions?

The environment variables are listed below. In short, they are the same as yours except I have an entry for G4LENDDATA and I do NOT have an entry for G4PARTICLEHPDATA:

env | grep G4 | sort | sed ‘s/=/ /’ | column -t
G4ABLADATA pathtogeant4geant4.10.6.p01-install/share/Geant4-10.6.1/data/G4ABLA3.1
G4ENSDFSTATEDATA pathtogeant4geant4.10.6.p01-install/share/Geant4-10.6.1/data/G4ENSDFSTATE2.2
G4INCLDATA pathtogeant4/geant4.10.6.p01-install/share/Geant4-10.6.1/data/G4INCL1.0
G4LEDATA pathtogeant4/geant4.10.6.p01-install/share/Geant4-10.6.1/data/G4EMLOW7.9.1
G4LENDDATA pathtogeant4/geant4.10.6.p01-build/data/LEND_GND1.3_ENDF.BVII.1
G4LEVELGAMMADATA pathtogeant4/geant4.10.6.p01-install/share/Geant4-10.6.1/data/PhotonEvaporation5.5
G4NEUTRONHPDATA pathtogeant4/geant4.10.6.p01-install/share/Geant4-10.6.1/data/G4NDL4.6
G4PARTICLEXSDATA pathtogeant4/geant4.10.6.p01-install/share/Geant4-10.6.1/data/G4PARTICLEXS2.1
G4PIIDATA pathtogeant4/geant4.10.6.p01-install/share/Geant4-10.6.1/data/G4PII1.3
G4RADIOACTIVEDATA pathtogeant4/geant4.10.6.p01-install/share/Geant4-10.6.1/data/RadioactiveDecay5.4
G4REALSURFACEDATA pathtogeant4/geant4.10.6.p01-install/share/Geant4-10.6.1/data/RealSurface2.1.1
G4SAIDXSDATA pathtogeant4/geant4.10.6.p01-install/share/Geant4-10.6.1/data/G4SAIDDATA2.0

You may need the G4PARTICLEHPDATA for your physicslist. Can you try to add that?

Thank you. I successfully added G4PARTICLEHPDATA and it shows up as as G4TENDL1.3.2 in the same install/data directory as the others.

However, the original error is still there on execution.

Please try building Geant4 with debugging information, so we can have a more complete stack trace. Some data seems to be missing, but it’s hard to tell just from the function names alone.

I rebuilt Geant4 10.6.1 with debugging on as you requested. I ran my program in debugging mode with exactly the same code and parameters as before. The output is attached. I hope it is helpful. Thanks.

physicslist_stops_working_migrating_from_10p5to10p6_debug_traceback_output_physicslist_problem.txt (9.5 KB)

I still cannot trace exactly where the dataset for protons is failing to load, as it probably happens outside of this call stack. Is there a Proton directory under your G4PARTICLEHPDATA directory (i.e. .../G4TENDL1.3.2/Proton)? You may try to set G4PROTONHPDATA to that directory to see if the dataset is found that way. See examples/advanced/STCyclotron/README where some information is provided on setting up datasets for proton. The message is clear that the dataset is not found, but unfortunately I cannot track where the call to open the files is made.

Hi, There is a Proton directory under my G4PARTICLEHPDATA directory. It has two subdirectories; Elastic with nothing in it and Inelastic with files F01 to F36 and a subsubdirectory CrossSection having 361 files. I tried your suggestion from examples/advanced/…README and set G4PROTONHPDATA to /home/jmcfee/geant4/geant4.10.6.p01-install/share/Geant4-10.6.1/data/G4TENDL1.3.2/Proton. I get the same error as before.

As I said before, I have changed nothing in my Physicslist file (attached) OpNovicePhysicsList.cc (23.8 KB) between Geant4 10.5.1 where it worked and 10.6.1 where it does not. In fact, my entire program has not been changed between the two versions.

Interestingly, if I bypass the section in the hadronic physics construction section (ConstructHad) of my Physics list for protons, recompile and run, I don’t get the same error as before, but I now get the following. It is like before except now for an alpha.:

-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : had001
issued by : G4CrossSectionDataStore::BuildPhysicsTable
No cross section is registered for alpha

*** Fatal Exception *** core dump ***
**** Track information is not available at this moment
**** Step information is not available at this moment

-------- EEEE -------- G4Exception-END --------- EEEE -------

If I delete the section for alpha, I get the same error for deuterons. etc…

I think it’s clear that Geant4 is not finding cross sections it wants, but I also don’t know what’s wrong, as I could not find in the code which exact variable and files Geant4 is looking for. Maybe @ribon or @civanch know better what has changed between 10.5 and 10.6 to be able to help here.

Another thing that one could try is to run with strace and look for calls to the open syscall to check where Geant4 is looking for the files.

One change in 10.6 was the removal of ‘default’ cross sections for hadronic interactions, i.e. the cross section now needs to be explicitly set for all particles. Before 10.6, cross sections derived from the Gheisha model were added by default as inelastic cross section to all processes; for almost all processes physics lists then added more precise cross sections to replace the rather outdated default cross section.

In your custom physics list you now must have a AddDataSet call to add cross sections.

I ran strace and the only open calls were to (all files are in path-to-Geant-install/share/Geant4-10.6.1/data/ which is where all the data files are:

The rest of the strace means little to me, but I am attaching it in case it helps someone else.straceoutput.txt (211.8 KB)

Thanks, Gunter.
I would have expected to see something about this under items for migration of user code in the Release Notes fo 10.6. But, I think you are on to something. I explicitly call AddDataSet for inelastic reactions for all particles but I do not do it for elastic reactions for protons, deuterons, tritons and alphas. I will try to fix this and see what happens. I’ll check back in soon.

The removal of default, Gheisha based cross sections was done for elastic and inelastic hadronic preocesses. Discussing with a college, this change was missed to be mentioned in release notes.

I made the change and it compiled and ran successfully. I am now doing a longer run to compare to previous results to ensure that the program is working properly. I’ll let you know what happens.

The long run shows that the results of 10.6.1 are essentially the same as those of 10.5.1. There are a few minor discrepancies but I think these can be explained in a straightforward way. I will run more cases to confirm. Many thanks to Guillherme and Gunter for your help.

John, glad to see the problem is fixed. I’m curious as to the particle-specific scintillation parameters you use. Do you require multiple time constants with different yield ratios for each particle? This will be available in Geant4 version 10.7 (beta expected in a couple of weeks). Or is there something else that maybe could be added to the Geant4 distribution? Ideally, users would not have to build their own physics lists for these relatively straightforward applications.

Hi Daren,
I may have spoken a bit too soon, in that the 10.6.1 and 10.5.1 results do differ somewhat. For 10.6.1, results show x-ray escape peaks that were not shown in the 10.5.1 simulations using the (essentially) same code. That’s good, because the physics for the geometry and materials say that the escape peaks should be there. However, the escape-to-full-energy peak ratios do not seem to be correct when compared to Geant4 (10.6.1) spectra of simple energy deposited (i.e., no scintillation process involved). I am looking into this, so it’s a bit premature for me to post on it in detail just now in case I’ve just screwed up somehow. I can post it, however, if anyone is interested.

I mainly use my own physics list for the method SetScintillationExcitationRatio (set particle-dependent ratio of fast component/total component yield). There is also the SetScintillationYieldFactor method which provides a scale factor to the various SCINTILLATIONYIELD parameters in the G4MaterialPropertiesTable, but I do not normally use it, since I set my yields individually for each particle in the materials table for the scintillator material.

I could certainly make use of more than two time constants, since I have to get creative in which ones to ignore for some of the scintillators I’m dealing with.

Hello, John,

We included in the release notes, that the default GHEISHA cross section is removed but not emphasize this in the user code migration part. Sorry for the fault.

I would advice making your physics list from components provided in the distribution (G4EmStandardPhysics, G4EmExtraPhysics…) or using reference physics list. The specific part which you really customizing (like optical photons) can be added. This will make migration from one version to another easier.