Problem 2172 - kCarTolerance in G4VFacet should not be constant
Summary: kCarTolerance in G4VFacet should not be constant
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: geometry/solids (show other problems)
Version: 10.5
Hardware: All All
: P4 normal
Assignee: Gabriele Cosmo
URL:
Depends on:
Blocks:
 
Reported: 2019-07-03 18:36 CEST by Pete Truscott
Modified: 2019-07-04 16:11 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Pete Truscott 2019-07-03 18:36:01 CEST
In G4VFacet.cc the variable kCarTolerance has been set to a static const since v9.6 of Geant4 (lines 47 & 48):

 const G4double G4VFacet::kCarTolerance =
       G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();

During the geometry construction process ti is possible to change the tolerances in G4GeometryTolerance using the member function:

  G4GeometryManager::GetInstance()->SetWorldMaximumExtent(worldExtent);

Obviously this will not modify the value of kCarTolerance used by G4VFact and its derivd classes.  The consequence can be incorrect calculations and erroneous tracking of particles in the G4TessellatedSolid for small (microelectronics-scale) geometries.

Since kCarTolerance is used by the constructors of G4VFacet and its derived classes, the brute-force approach is have kCarTolerance as non-const and initialised it in the G4VFacet constructor (with a warning if the SetWorldMaximumExtent(worldExtent) member function is executed after any facets are instantiated.  An alternative (and more complicated) approach would be to modify the facet initialisation process and move it into a member function of G4VFacet/G4TriangularFacet/G4QuadrangularFacet, so that if the worldExtent is changed, the geometry manager knows to reinitialise the facets just before the geometry is closed.
Comment 1 Pete Truscott 2019-07-03 18:44:38 CEST
Sorry, a correction to my initial description:

kCarTolerance is used in the constructors of G4TriangularFact and G4QuadrangularFacet; there is no base contructor.
Comment 2 Gabriele Cosmo 2019-07-04 16:11:41 CEST
Thanks for reporting this.
The fix is now under testing and will be available in a next patch release.