addOptical command not found, cannot generate optical photons (Gears)

I am trying to run optical photon problems with Gears, but can’t get them to work because the UI command /physics_lists/factory/addOptical is not found, no matter which physics list I select (code below). Everything else works fine, just no optical photon generation.

I am new to Geant4 and first trained with a tutorial where I was able to generate optical photons in a scintillator by coding in C++ and using G4EmStandardPhysics and G4OpticalPhysics but I would really like to use Gears. I have been having the same issue with the pre-compiled version and by compiling from source code.

Can someone help? Thanks.

Geant4 Version: 11.3.0
Operating System: Win10
Compiler/Version: Microsoft Visual Studio Community 2022 (64 bits) Version 17.12.3
CMake Version: 3.29.0-rc1


Hello @arsamie,

This is an external Geant4-based application, so it might be better/faster to reach out to the developers of Gears directly via GitHub issues:

Just tried this, thanks for the tip.

1 Like

Apparently the command /physics_lists/factory/addOptical was removed in a previous release of Geant4. Some commands about optical properties are supposed to be found in /process/optical/ according to the user guide but I don’t see them in my GUI… My question is, how can I activate scintillation with a UI command? Is it still even possible? Or should I install an older version of geant4?

Is the question about Gears, or Geant4? I don’t know about Gears.

In Geant4, scintillation is enabled by default, if the optical physics list is added.

Specifically which commands found in the user guide are not in your GUI?

1 Like

It is about Gears.

I could not find any way to activate scintillation with UI commands only, so as a workaround I forced the physics list selection in the main function of gears.cc and activated optical physics there. Otherwise, the /process/optical/ commands are simply not present.

Then in macros I removed the physics list selection and activated the optical processes as follows. It did the job.

As far as I understand some Geant4 UI commands were removed/replaced and Gears would need an update to handle scintillation with the newest versions of G4.