eBremsstrahlung creates same gamma every time

Hello all,

I am developing an application called G4 Brems (GitHub - john9francis/G4-Brems: A Geant4 Model of Bremsstrahlung or "braking radiation." In this model I will mimic the production of Bremsstrahlung by shooting electrons at a tungsten target and detect the energies of the resulting x-ray photons.) aiming to model Bremsstrahlung. In the simulation I shoot 6 MeV electrons at a tungsten target and use the eBremsstrahlung physics process to create secondary gammas. I am using the Penelope physics list, which has included the eBremsstrahlung physics process, but I have tried with EMStandard, (all 4 options), and Livermore physics lists, with the same results.

The issue I am running into is that every run creates a gamma particle with very similar energy, around 88 keV. In reality, it should create a continuous spectrum of photon energies from 6 MeV all the way down to a couple keVs.

My best guess is that it has something to do with the datasets. It looks like eBremsstrahlung uses the G4SeltzerBergerModel to decide the energies of the produced gammas. Upon studying the G4SeltzerBergerModel.cc file, I saw this function:

const G4String& G4SeltzerBergerModel::FindDirectoryPath()
  // check environment variable
  // build the complete string identifying the file with the data set
  if(gDataDirectory.empty()) {
    const char* path = G4FindDataDir("G4LEDATA");
    if (path) {
      std::ostringstream ost;
      ost << path << "/brem_SB/br";
      gDataDirectory = ost.str();
    } else {
                  "Environment variable G4LEDATA not defined");
  return gDataDirectory;

And I looked at the brem_SB directory, it has a bunch of files like br1, br2, br3… I was wondering if maybe the model happens to use the same file every run? I’m not sure though…

If anyone has an idea what could be going on here, I would appreciate the help.

Attached files:

  1. The result of several events. It really seems to favor the 88.29 keV energy. The values around 176 and 264 are just multiples of ~88, which is caused when the electron undergoes multiple bremsstrahlung interactions in one event. (Some events produce more than one gamma.) There is also variation due to the way I have my detector set up, which would explain the slightly different values like 88.29 and 88.72, etc. Basically what I’m trying to say is that it seems like every gamma generated has around 88keV.
  2. On the energy graph you can see a very discrete distribution. I would expect a continuous spectrum from bremsstrahlung. NOTE: The target also gets bombarded with electrons, but those energies don’t register. The detector only generates data for a particle if it is a gamma.

Geant4 Version: 11.0.3
Operating System: Windows 11
Compiler/Version: Visual Studio 2022
CMake Version: 3.27.1

below, a gamma spectrum (linear and log), from example TestEm14

brems.mac.txt (441 Bytes)

1 Like

Hi @john9francis,

I have a simulation doing a similar thing at lower energies (keVs), and have not faced this issue (it is strange). It might be helpful to note the physics list I’m using in this case is:

    G4PhysListFactory factory;
    G4VModularPhysicsList* physList=factory.GetReferencePhysList("FTFP_BERT"); 
    physList->ReplacePhysics(new G4EmLivermorePhysics);

I chose Livermore in the end, though I did have the usual suspects all working without problem! The other thing I’d draw your attention to for this type of simulation is your range cuts and ensuring your deexcitations are enabled - I do this in my macro file, using /run/SetCut 5um (obviously this is a 5um range cut)

If those things are not yet implemented, maybe try them and see if they change the output - it seems a strange one! Hopefully that helps a little


The main advice: use physics list from Geant4 distribution like TestEm14 or method shown by @john9francis .


TestEm14 is ‘special’ : it is tailored to study a single interaction, alone (eg. isolated).
But you will get similar plot in more realistic situations.
I attach macros for TestEm1, TestEm5, TestEm18.
I let you run these examples and look at the plots.

francis1.mac.txt (425 Bytes)
francis5.mac.txt (590 Bytes)
francis18.mac.txt (467 Bytes)

Thank you everybody for the help. The issue turned out to be the way I was registering the energies. I was running the particles into a lead detector and recording the “Energy deposited” per step like so:

G4double energy = step->GetTotalEnergyDeposit();

Note: in the event action I summed up all the energy deposited, until the particle had stopped. I had assumed that while the particle was stopping it would deposit ALL it’s energy in the detector, thus giving me an accurate reading of the particle’s energy.

Once I switched it to register the particle’s energy instead of the energy deposited, it worked.

G4double energy = track->GetTotalEnergy();

I still find it weird that the energy deposited all added up isn’t equal to the particle’s total energy, but it must be something with how the program records the energy deposited into materials.

If you have secondaries created which escape out of your volume, then the total energy loss recorded (sum of GetTotalEnergyDeposit() from all steps in the volume) won’t equal the initial energy.


I would advice to study $G4INSTALL/examples/extended/electromagnetic/TestEm5

This simple example includes very detailed analysis in a layer of defined material.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.