Problem 1105 - Buggy DistanceToIn computation in G4TesselatedSolid and Facets
Summary: Buggy DistanceToIn computation in G4TesselatedSolid and Facets
Status: RESOLVED DUPLICATE of problem 1103
Alias: None
Product: Geant4
Classification: Unclassified
Component: geometry/solids (show other problems)
Version: other
Hardware: All All
: P5 trivial
Assignee: Gabriele Cosmo
URL:
Depends on:
Blocks:
 
Reported: 2010-02-19 12:42 CET by Oliver Merle
Modified: 2010-02-19 15:00 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Oliver Merle 2010-02-19 12:42:42 CET
** Bug Description:

DistanceToIn(G4ThreeVector&, G4ThreeVector&) returns kInfinity when point on facet. Should return zero.

Problem causes wrong navigation in case of boundary processes (eg. total internal reflection of optical photons).

** Affected geant4 versions:

4.9.3, 4.9.2 (approved) and most likely older ones. 

** How to reproduce the problem:
 
- Enable Cherenkov and optical processes in physics list.
- Create an extruded volume with optical properties (MPT, eg. Fused Silica) and shoot a charged particle, e.g 4GeV/c pion with an angle of 20 deg (relative to the extrusion direction / local z) through this volume.

The charged pion will cause Cherenkov radiation. Some of those photons will be totally reflected at the surface of the extruded volume. After this boundary process, the photons will not reenter the radiator. 

This is caused by the buggy DistanceToIn computation in G4TesselatedSolid and G4TriangleFacet.  


** Quick fix:

I added a quick and dirty fix to my geant version by changing "distFromSurface > 0.5*kCarTolerance" to "distFromSurface >= -0.5*kCarTolerance"  in G4TessellatedSolid::DistanceToIn(G4ThreeVector&, G4ThreeVector&)


PS:
Instead of using my example including Cherenkov photons you should be able to shoot optical-photons with the particle gun.
Comment 1 Oliver Merle 2010-02-19 12:54:17 CET
(In reply to comment #0)

> ** Quick fix:
> 
> I added a quick and dirty fix to my geant version by changing "distFromSurface
> > 0.5*kCarTolerance" to "distFromSurface >= -0.5*kCarTolerance"  in
> G4TessellatedSolid::DistanceToIn(G4ThreeVector&, G4ThreeVector&)

I think I made some additional changes to the triangular facet to fix the bug. I've done it some time ago and don't remember all changes. If requested, I download the original source again and run a diff. But as I mentioned, its just a dirty hack.
Comment 2 Gabriele Cosmo 2010-02-19 15:00:24 CET
Issue most likely correlated with report #1103.
Potential solution also proposed.

*** This problem has been marked as a duplicate of problem 1103 ***