[Gate-users] problem about the new version of GATE (V3.0) (bug?)

yuxuan.zhang at di.mdacc.tmc.edu yuxuan.zhang at di.mdacc.tmc.edu
Tue Aug 8 19:41:01 CEST 2006


Hi,

Recently I installed the new version of the GATE v3.0 into my computer
with Geant4.8.0.p01, CLHEP2.0.2.2, and the compiler is gcc4.0.1 and
the Linux version is Scientific Linux CERN.

After I installed the GATE, I ran the test bench of the PET and the result
is shown here as the attachment. From the result, you will see there are
only 7 sectors in the detector ring, which should be 8. 
Then I checked with my own camera geometry and every time the sector 
numbers
was short of 1 as what I have defined.

I checked the source code of GATE and find such code in 
GateAngularRepeater.cc
.
.
.
void GateAngularRepeater::PushMyPlacements(const G4RotationMatrix& 
currentRotationMatrix,
                                             const G4ThreeVector& 
currentPosition,
                                             G4double )
{
  G4double dphi ;
  if ( m_angularSpan == 360. *deg)
  dphi = GetAngularPitch_1();
  if ( m_angularSpan != 360. *deg)
  dphi = GetAngularPitch_2();
.
.
.


I think that the comparision of two float type like this ( m_angularSpan 
== 360. *deg)
is dangeous, sometimes it works fine but sometimes it may give wrong 
result based on what
kind of compiler, system or cpu are used.

So I changed the code as this:

  if ( m_angularSpan < 360.0005 *deg &&  m_angularSpan > 359.9995 *deg)
  dphi = GetAngularPitch_1();
  else
  dphi = GetAngularPitch_2();

After recompile the Gate, now the result seems ok.


I also checked the old versions of GATE, they were all coded in the same 
way and I didn't have
this problem before. So I think it mostly caused by the different compiler 
(gcc4). 
This just a reminder to you if you have the same proble in your computer.


Yuxuan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opengatecollaboration.org/mailman/private/gate-users/attachments/20060808/c4121359/attachment.htm>


More information about the Gate-users mailing list