Crashing at G4VEmModel::SetCurrentCouple()

My collegue is trying to estimate systematics associated with material budget. The person is using a module which calls G4VEmModel::ComputeDEDX from Geant4. However, the module crashes after we changed the Geant4 version from v10.1.2 to v10.6.3.

Could you help us to fix the problem? According to the trace log, the crash happened at G4VEmModel::SetCurrentCouple(). The following is a part of the trace log:

*** Break *** segmentation violation

There was a crash.
This is the entire stack trace of all threads:

#0 0x00007fa9a2ab9659 in waitpid () from /lib64/
#1 0x00007fa9a2a36f62 in do_system () from /lib64/
#2 0x00007fa9a2a37311 in system () from /lib64/
#3 0x00007fa9a1b52bf5 in TUnixSystem::Exec (shellcmd=, this=0x21c3570) at /cvmfs/
#4 TUnixSystem::StackTrace (this=0x21c3570) at /cvmfs/
#5 0x00007fa9a1b5016c in TUnixSystem::DispatchSignals (this=0x21c3570, sig=kSigSegmentationViolation) at /cvmfs/
#7 0x00007fa97e178f41 in G4VEmModel::SetCurrentCouple (ptr=0x2ce731b0, this=0x2da61210) at /cvmfs/
#8 G4VEmModel::ComputeDEDX (this=0x2da61210, couple=0x2ce731b0, part=0x2cc09ed0, kinEnergy=1.4263930942465761e+214, cutEnergy=9.0556387525520142e+164) at /cvmfs/
#9 0x00007fa97d4a3847 in Belle2::Simulation::EnergyLossForExtrapolator::ComputeElectronDEDX(G4ParticleDefinition const*, G4PhysicsTable*) () from /cvmfs/

Hello Doris,

A short answer: G4VEmModel interface does not assumed to be used for this purpose, because a model is expected to work in some energy interval. In order to use this one should be sure that the code is properly initialized for a G4 step.

G4VEnergyLossProcess is better prepared to be used in run time. It may be accessed via

G4double G4LossTableManager::GetDEDX(const G4ParticleDefinition *aParticle,
G4double kineticEnergy, const G4MaterialCutsCouple *couple);


If not restricted but full dEdx is needed better to use G4EmCalculator.


Dear Vladimir,

Thanks a lot for both fo the replies. I will discuss your suggestion with the person who sent me the inquiry.

Dear Vladimir,

 A colleague is looking for a solution, and found that using G4VEmModel::ComputeDEDXPerVolume() does not crash our program and produces expected results. Would this ComputeDEDXPerVolume() function be OK?