Error running example B1

I am brand new to Geant4. Attempting to run example B1 run1.mac results in a fatal exception and core dump with the following error. I have not found other posts with this same error.

-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : had014
issued by : G4LevelReader::LevelManager(…)
for Z= 1 A= 1 is not opened!

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

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

In getting started I had other errors due to missing datasets, but the error indicated what data was missing so that I could fix the error…I don’t have any idea how to proceed from this point. I can post the entire output resulting from running run1.mac. The error showed up after the /run/beamOn command. I got the same error when stepping through the commands in exampleB1.in and giving the command /run/beamOn

Have you sourced the “geant4.sh” script before running the example? That script should set all of the envvars needed to find the datasets, including G4LEVELGAMMADATA.

When you did your G4 installation, did it download and install all of the datasets?

Thanks for the suggestions @mkelsey. To answer your questions. Yes, I did source the geant4.sh script, but my installation did not apparently install any of the datasets. As I attempted to run the example I would encounter errors that pointed to failure to find a specific dataset. I would then install that dataset. But the error I wrote about in my post did not seem to point to a specific dataset so it wasn’t clear that the problem was concerned with a missing dataset.

I have a general question related to datasets. I am running geant4 on a virtual Ubuntu 20 machine with a rather small disk. I can install all the datasets, but am concerned about filling up the disk. Would you recommend that I go ahead and install all the datasets or was the error I encountered, where it was not clear that it was a dataset-missing error, atypical so that I need only install the datasets, as indicated by an error I receive, needed to run my extremely simple simulation?

Ugh! That should mean that when you did the installation, you set -DGEANT4_INSTALL_DATA=OFF as a CMake option. You could go back to your build directory, re-run CMake with that option set to =ON, and then do make install. It will not recompile any code, just download the required datasets.

Yeah. Each error is written by the collaborator who wrote that bit of code, and some are more informative than others (we’re all physicists, not professional programmers :slight_smile: ).

The G4LevelReader is used to read and store the nuclear energy levels for isotopes, for use with the hadronic physics processes. In G4LevelReader.hh, there’s a comment line that tells you about the envvar:

// create run manager using G4LEVELGAMMADATA data for Z and A
const G4LevelManager* CreateLevelManager(G4int Z, G4int A);

I just ran du -csk on just the datasets for G4 10.6.p03. They take up 1.9 GB, of which the largest is RealSurface2.1.1 ($G4REALSURFACEDATA), at 800 MB. How “rather small” is your VM disk?

It really depends on your physics list. The datasets are read in during initialization, not on demand (so you don’t get into mutex/contention issues reading from multiple threads). If you are using a roll-your-own physics list where you’ve explicitly chosen just a few processes (or a few RegisterPhysics() calls), then your method would be fine.

If you’re using one of the Geant4 reference physics lists, as we recommend (e.g., FTFP_BERT, Shielding, etc.), then you’ll end up needing most or all of the datasets in order to get through /run/initialize successfully.

Thanks again Michael. You have once again been most helpful. First, the disk on my VM currently has about 8.5 GB still available and all I have on the disk is the OS and geant4. I have no idea how much disk will be required to run a simple model which is why I have so far not installed all the datasets.

Up till now I have just installed 5 of the datasets and after running geant4.sh I run an additional script to set the environment variables for the installed datasets. If you think that installing all the datasets will leave me enough disk space to simulate a rather simple model, I can go ahead and install all the datasets as you suggested.

I have been thinking about your latest suggestions but didn’t understand all that you said. I had never heard of these reference physics lists until you mentioned them in your reply. Can you provide a link where I can find more information on them? When I looked at the datasets for G4 10.7, there were several large datasets, some possibly larger than RealSurface, which was listed as optional. If I re-run cmake will all the datasets, including the optional ones get installed?

I must explain that I am not a physicist. I am a retired electrical engineer who has always been interested in physics and after retirement audited a few undergraduate and graduate particle physics courses at the local college. I volunteered to help the physics department in any way that the professor thought would be useful, which is why I am even involved with physics at this point.

The professor has a project looking at an approach to measure direction of arrival of charged particles and I was evaluating how we might verify that it was working using radioactive lab sources by collimating the source. I had initially evaluated the collimator using data from NIST. BNL, and others along with standard models of interaction of charged particles and photons with matter, but the professor suggested that I look into simulating the collimation with geant4 which is why I am looking at using geant4.

Mike

https://geant4-userdoc.web.cern.ch/UsersGuides/PhysicsListGuide/html/index.html

Looking ahead in your note, if you’re just dealing with a simple radioactive source with beta particles and gammas, The FTFP_BERT physics list should be more than sufficient for your needs. As you investigate it, you might decide to use one of the “EM options” (e.g., EM option4) to see some more detailed x-ray interactions. All that can be done with G4PhysListFactory in your main().

On my Mac, the RealSurface 2.2 is down to 130 MB, while G4EMLOW 7.13 is up from 362 MB to 504 MB. The total for all the datasets is 1.38 GB. There are probably a couple which I don’t have installed, but I have all the ones needed for the reference physics lists.

Your entry to Geant4 sounds really cool! I will warn you that it’s not nearly as “plug and play” as you might want, but it’s should be pretty easy to do what you’re planning. You should be able to set up a very simple geometry with the collimator as a disk with a hole in it, put a “GPS” (G4GeneralParticleSource) on one side and score hits on the other. You can make the source more complex if you want later.

Thanks once more Michael. I have a steep learning curve, but I will soldier on.

I have another question only peripherally related to the topic of getting B1 running. I did not have openGL installed on my computer when I built geant4. Is there some way to get the graphics OGL added without completely rebuilding the toolkit?

If you installed OpenGL, you can run cmake in the same directory to set the OpenGL option (personally, I like ccmake so I can navigate a menu of options), then repeat make install. It will only recompile the visualization stuff it needs to, and you don’t have to delete anything first. A good set of Makefiles take care of all that, and CMake generates good Makefiles.

Another thank you for all your help.

I am still having problems with the visualization on exampleB1. I installed openGL and re-built geant4 with the command

mike@mike-VirtualBox:~/geant4/geant4.10.07.p01-build$ cmake -DGEANT4_USE_OPENGL_X11=ON -DMAKE_INSTALL_PREFIX=/home/mike/geant4/geant4.10.07.p01-install /home/mike/geant4/geant4.10.07.p01

That seemed to go as expected with output
GEANT4_BUILD_CXXSTD: Compiling against C++ Standard ‘11’
GEANT4_USE_OPENGL_X11: Build Geant4 OpenGL driver with X11 support

I then ran make again with the command
mike@mike-VirtualBox:~/geant4/geant4.10.07.p01-build$ make -j2
and that seemed to run with no errors. I also looked at CMakeCache and found the line indicating that geant4 was built to use openGL. But running geant4-config -h returned opengl-x11[no]

Do you have any suggestions on what is the problem or where I should look for problems?

You also need to run make install. You built the new stuff successfully, but your install area still has the old version.

A nice feature of Make is that the “install” target depends on the build target, so you can do, e.g., make -j 2 install right after CMake, and it’ll build whatever is needed and then install it, in one action.

Thanks Michael. That finally did the trick. Now that I have been able to actually get an example to run I need to start understanding how to use the toolkit to evaluate my problem.

There is a tutorial on the geant4 web site. Do you recommend that as the best starting point to learn how to use the software?

Yes, the G4 tutorials are excellent, but can be somewhat overwhelming if you try to digest them all at once.

The examples can also be useful, if you already have an idea of what you want to do, but maybe don’t know how to implement the details. There’s documentation for each one in a separate Geant4 Examples Web area.