[Gate-users] ion source timestamp bug, Gate 7.1

Gergely Patay gergely.patay at mediso.com
Tue Apr 14 15:13:32 CEST 2015


Dear Gaters,

to answer my own question: the problem is indeed deep inside Geant4, and as 
usual, originally this is "not a bug, but a feature".

In GateVSource.cc:268 we (try to) force life time of the source particle to zero:
// Force life time to 0, time is managed by GATE not G4
GetParticleDefinition()->SetPDGLifeTime(0);

However, from v10.0+ when Geant4 reads back the life time of a general ion 
source, it does *not* retrieve the previously set value, but an (otherwise 
physically correct) value from an external data file 
(G4ENSDFSTATE1.0/ENSDFSTATE.dat) :

G4ParticleDefinition.icc:45
inline
  G4double G4ParticleDefinition::GetPDGLifeTime() const
{
   if(IsGeneralIon())
   { return GetIonLifeTime(); }
   else
   { return thePDGLifeTime; }
}

Unfortunately, the underlying isGeneralIon variable is not directly accessible 
from outside (i.e. from Gate).

A minimal workaround might be as follows:

1) change visibility of isGeneralIon from protected to public:
geant4/particles/management/include/G4ParticleDefinition.hh:402
-   protected:
+   public:
        G4bool isGeneralIon;

(this might be modified *without* recompiling Geant4)

2) add the following line to gate/source/physics/src/GateVSource.cc:269
           GetParticleDefinition()->SetPDGLifeTime(0);
+         GetParticleDefinition()->isGeneralIon=false;

3) recompile Gate with the modified header file.

Since this modification affects Geant4 code too, I cannot provide a simple patch 
file yet.

best regards,
  Gergely

  --
Gergely Patay
Mediso Ltd.



On 2015-04-01 13:38, Gergely Patay wrote:
> Dear Gaters,
>
> I installed the latest version of Gate from git. Everything went fine
> (benchmarks etc), until I tried to use the 'generic ion' source for a PET
> simulation.
>
> The timestamps of the hits (and consequently, of the singles and coincidences)
> are weird. They should be distributed uniformly in the [0,1] s interval (as seen
> on the ion_timestamp_gate7.0.png figure), but in 7.1 they are distributed
> exponentially over a much-much larger time interval with an exponent which
> equals to the decay rate of the ion, in this case Na-22.
>
> The macro files were identical, and the corresponding software versions were
> - Gate7.0, Geant4.9.6.p03, root5.34.18
> - Gate7.1, Geant4.10.01, root5.34.26
>
> This bug is actually the very same to that was reported on March 31, 2011 for
> Gate 6.0.1
> (http://lists.opengatecollaboration.org/mailman/private/gate-users/2011-March/004895.html)
> which somehow disappeared from 7.0 but re-emerged in 7.1.
>
> The bug does not affect the backtoback or e+ sources, and energy spectra are fine.
> It might be buried somewhere deep in Geant4.
>
> Do you have any idea what went wrong?
>
> thanks,
>   Gergely
>
> --
> Gergely Patay
> Mediso Ltd.
>
>
> _______________________________________________
> Gate-users mailing list
> Gate-users at lists.opengatecollaboration.org
> http://lists.opengatecollaboration.org/mailman/listinfo/gate-users
>


More information about the Gate-users mailing list