Bug #387
Floating point comparison test doesn't allow tolerance (or should reduce into range)
0%
Description
I get this error when trying to run a simulation from a geometry stored in the ConfigDBL:
Phi out of range in sphere module Stage6.dat/BeamLine.dat/Cherenkov.dat/Vessel1.dat/PMT0.dat Error at MiceModToG4Solid::buildSphere Stack trace
The code in question (in EngModel/src/MiceModToG4Solid.cc
) is:
if(phi.x() < 0.*deg || phi.x() > 360.*deg || phi.y() < 0.*deg || phi.y() > 360.*deg) throw(Squeal(Squeal::recoverable, "Phi out of range in sphere module "+mod->fullName(), "MiceModToG4Solid::buildSphere") );
The line in the MiceModule file is
PropertyHep3Vector Phi 0.0 360.0 -1.0 deg
and the line in the pseudo-GDML is
<auxiliary auxtype="vec_Phi" auxvalue="0 6.28319 -0.0174533"/>
As you can see the conversion to an ASCII string when writing the pseudo-GDML rounds upwards from 6.283185307... so the number read back in exceeds this number. Floating-point comparisons should have a tolerance or, in the case of angles, a reduction into the primary range for the trigonometric function(s) which would be affected by the out-of-range value, to allow for the imprecision of expressing FP numbers.
Updated by Rogers, Chris over 12 years ago
- Assignee set to Rogers, Chris
- Priority changed from Normal to Low
Just FYI, I catch this because if I don't GEANT4 will and the error messages are not always nice (e.g. don't say which module the error was in). Fine, will have a look.
Updated by Rogers, Chris over 12 years ago
- Project changed from G4MICE to MAUS
- Category deleted (
EngModel)
Updated by Rogers, Chris over 12 years ago
- Category set to Simulation
- Target version set to Future MAUS release