Bug #387

Floating point comparison test doesn't allow tolerance (or should reduce into range)

Added by Reid, Ivan about 13 years ago. Updated almost 12 years ago.

Target version:
Start date:
22 March 2011
Due date:
% Done:


Estimated time:


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/ 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 about 13 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 about 13 years ago

  • Project changed from G4MICE to MAUS
  • Category deleted (EngModel)

Updated by Rogers, Chris about 13 years ago

  • Category set to Simulation
  • Target version set to Future MAUS release

Updated by Rogers, Chris almost 12 years ago

  • Status changed from Open to Rejected

Also available in: Atom PDF