Different processes for different regions

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version:_11.0.2
_Operating System:_Windows11 and Linux
_Compiler/Version:_VS studio 2022
_CMake Version:_3.24.1

Hello, there!

I want build up an application like SRIM to calculate proton induced displacemt damage of multilayer film which is made of two materials: G4_Si and G4_W. The core process is G4ScreenedNuclearRecoil.

G4ScreenedNuclearRecoil* nucr = new G4ScreenedNuclearRecoil(“ScreenedElastic”, “zbl”, true, 0.1269 * eV, 10* eV);
// 0.1269*eV is the displacement energy per nucleon. //

G4ScreendNuclearRecoil can be register to the whole defaul world region.

But G4_Si and G4_W should have different displacement energy. So I have to register different G4ScreendNuclearRecoil object with different displacement energy to G4_Si and G4_W respectively.

I have tried G4EmConfigurator like the following code, but it didn’t work :sob::

G4ScreenedNuclearRecoil* nucr1 = new G4ScreenedNuclearRecoil(“ScreenedElasticSi”, “zbl”, true, 0.5357 * eV, 10 * eV);
G4ProductionCuts* cuts = new G4ProductionCuts;
cuts->SetProductionCut(0.01 * nm);
G4Region* RegionMatSi = G4RegionStore::GetInstance()->GetRegion(“RegionMatSi”);
G4EmConfigurator* em_config = G4LossTableManager::Instance()->EmConfigurator();
// G4ScreenedNuclearRecoil is a process, so I set the mod to nullptr.
G4VEmModel* mod = nullptr;
em_config->SetExtraEmModel(“proton”, “nucr1”, mod, “RegionMatSi”, 0.0, 100 * MeV);
em_config->SetExtraEmModel(“GenericIon”, “nucr1”, mod, “RegionMatSi”, 0.0, 100 * MeV);

Is there any way to make this work? Waiting for your reply! Thank you!