How do I generate photons?

Dear all,

I’m a beginner and I want to generate photons as if it were coming out of an LED, but I can’t figure out where to start. Anyone have any ideas?

Many thanks in advance.


You can actually use particle gun with optical photons. But you have to make sure you are using optical photons in your physics list

1 Like

Thanks for your information.

I would look at the Optical examples. You can also incorporate optical photons physics processes into B1 and change the particle gun particle to optical photon and go from there

1 Like

They don’t have to be optical photons. If you’re shooting the laser/LED to do photoelectric stuff, then you’ll want to shoot G4Gamma, and just set the energy appropriate for the color (e.g., a red 632 nm laser shoots 1.95 eV photons).

This gets tricky because G4OpticalPhoton does not participate in any of the EM processes (no ionization, no photoelectric), while G4Gamma does not participate in any of the optical-surface processes (reflection, refraction, skin-surface/border-surface, etc.).

So depending on what you’re modelling, you will need to choose the particle type appropriately.


Thanks a lot. Do you have an example of photon simulation, such as video tutorial or user manual?

Thanks for your information. I would like to detect photons emitted by an LED where I create a cube geometry and have photo sensors on one side of the cube. That means I have to choose G4Gamma, right?

If you want the photons to reflect or refract, you’ll have to use Optical photon.

If you just want say photoelectric absorption and scattering, you can use G4Gamma

1 Like

Thanks. Where can I find an example of using G4Gamma to generate photons?

Example B1 uses Particle gun to produce G4Gammas

1 Like

My opinion is that these photons can be modelled as Geant4 “optical photons” only. The G4 EM physics for gamma rays is modelled down to 1 keV (Standard model), 100 eV (Penelope physics list) and down to (by a software point of view) 10 eV for the Livermore physics list, so the models do not go down to 2 eV. In addition, I think that, among the processes modelled in Geant4 for “gamma” rays, only Rayleigh scattering is relevant at the energies studied. Interested to know how the study goes ahead…



Thank you very much.

Thanks Susanna for your interest in my work. I am currently building an LED and photo sensors, both of which are inside a cube. Next, I will generate the photons as if they were produced from the LED and use the photo sensor to detect those photons. Do you have any ideas for creating those photons?

Generate those photons as primary particles… as optical photons. Then, score them when they reach a plane of interest.

1 Like

Thanks a lot for your information.