| Summary: | possible round off error in G4Nucleus::GetThermalNucleus | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | Artem Zontikov <zontikov.a> |
| Component: | processes/hadronic/util | Assignee: | dennis.herbert.wright |
| Status: | RESOLVED FIXED | ||
| Severity: | trivial | ||
| Priority: | P5 | ||
| Version: | 10.2 | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
Artem Zontikov
2016-11-14 11:36:27 CET
Hello.
Have a look at this if-block
if(1-tEtot/theTarget.GetMass()>0.001)
{
theTarget.SetTotalEnergy(tEtot);
}
The if-statement could be put as Etot<0.999*theTarget.GetMass() and when theTarget.SetTotalEnergy(tEtot) is called
inline void SetTotalEnergy( const G4double en )
{
totalEnergy = en;
kineticEnergy = totalEnergy - mass;
}
it will set totalEnergy less than mass and negative kineticEnergy which could possibly affect low energy neutron transport at low temperatures.
I have not checked if this behaviour really appears during the simulation but it would be better this way:
if(tEtot<theTarget.GetMass())
{
theTarget.SetKineticEnergy(0);
}
The bug is certainly there, but actually does not cause a round-off error. The conditional in the if statement is incorrect: it should be tEtot/theTarget.GetMass() - 1 > 0.001 . This way the relativistic energy is chosen at higher energies while the classical energy is chosen at lower energies. I believe the classical energy is used to maintain precision at low energies, as the sqrt would reduce the number of significant digits. A fix has been submitted. |