Problem 807

Summary: NAN at G4BraggModel
Product: Geant4 Reporter: nanjo
Component: processes/electromagneticAssignee: Michel.Maire
Status: RESOLVED FIXED    
Severity: normal CC: nanjo
Priority: P2    
Version: 7.1   
Hardware: PC   
OS: Linux   

Description nanjo 2005-10-23 04:00:22 CEST
Dear GEANT4 developer,

In a method, G4BraggModel::SampleSecondaries,
a negative value can be passed to sqrt()
at the line number of 213 in G4BraggModel.cc.

213   G4double sint = sqrt(1.0 - cost*cost);

It makes a new momentum direction of a particle after the step NAN.

For my case,
the tracked particle is Ar40[0,0] in the standard air,
and its momentum vector is (116,258,-25.3),
and 1.0-cost*cost = -6.85e-13.

Is it due to the precision of the calculation?

Anyway, I think it can be fixed by
adding some check against the negative value before sqrt().

Could you fix this problem?

Best Regards,
Hajime
--------------------------------------------------
High Energy Physics Group, Department of Physics,
Kyoto University
Hajime Nanjo
---------------------------------------------------
Comment 1 Vladimir.Ivantchenko 2005-10-24 03:44:59 CEST
The bug have been fixed and the fix will be available with Geant4 7.1 patch 01