GeomNav0003 error with G4.10.4.2 but not G4.10.6

Hello G4 developpers!

I have a piece of code in here that more or less reproduces the use we do of G4 for NOvA simulations. I get a GeomNav0003 and an aborted event when I compile and run this code against G4.10.4.p2, but I realised by luck that using a version equal or later than G4.10.6, works fine.
Note, this is not rare enough for us not to care and we have to sort this.

Upgrading G4 isn’t a trivial step, so I was wondering if there is a way to change a parameter in the version we use in production (G4.10.4.p2) to make it work?

I’ve tried to add little gaps between the volumes in the gdml file we use, and that didn’t work.
I’ve also added the following line at the top of my main: G4GeometryManager::GetInstance()->SetWorldMaximumExtent(423672);
to get a relative tolerance but that didn’t work either

  • G4ExtrudedSolid: fixed a bug in DistanceToOut(), affecting extruded solids defined off-center along the z-axis.

This is in the release notes of G4.10.6, could that cause this problem if the volume is extruded?

Answer is yes it does. If you have “xtru” volumes in your gdml or are using G4ExtrudedSolid on a G4 version < G4.10.6 you should change the file source/geometry/solids/specific/src/ (around line 1285) as such:

G4double G4ExtrudedSolid::DistanceToOut (const G4ThreeVector &p,
                                         const G4ThreeVector &v,
                                         const G4bool calcNorm,
                                               G4bool *validNorm,
                                               G4ThreeVector *n) const
  switch (fSolidType)
    case 1: // convex right prism
      // Intersection with Z planes
      G4double dz = (z1 - z0)*0.5;
      G4double pz = p.z() - 0.5 * (z0 + z1); // /!\ change this line /!\