Problem 2118

Summary: Total internal reflection when using polishedbackpainted
Product: Geant4 Reporter: Rok Dolenec <rok.dolenec>
Component: processes/opticalAssignee: Daren Sawkey <daren.sawkey>
Status: RESOLVED INVALID    
Severity: normal CC: rok.dolenec
Priority: P4    
Version: 10.4   
Hardware: All   
OS: All   

Description Rok Dolenec 2019-01-17 13:13:57 CET
We are simulating optical photon propagation in GEANT4 and have found that a problem reported already on hypernews:

http://hypernews.slac.stanford.edu/HyperNews/geant4/get/opticalphotons/313/1/1.html

is still present in the code. The bug results in total internal reflection not properly applied when polishedbackpainted surface is used.

After many tests we believe this would be important to fix for all users that use UNIFIED model and polishedbackpainted surfaces.
Comment 1 Daren Sawkey 2019-01-30 21:37:09 CET
Thanks for reporting this. We'll investigate.
Comment 2 Daren Sawkey 2019-03-21 23:04:54 CET
Hi,

Can you please provide more details. To me it looks like the interaction follows the figure in the Application guide:
http://geant4-userdoc.web.cern.ch/geant4-userdoc/UsersGuides/ForApplicationDeveloper/html/TrackingAndPhysics/physicsProcess.html#fig-unified-surface-model

What specifically do you think is not happening correctly?

Thanks.
Comment 3 Rok Dolenec 2019-04-01 10:28:50 CEST
Thank you for investigating!

When using UNIFIED model and polishedbackpainted surface, the optical photons that should undergo total internal reflection are reflected under some random angle.

We are simulating PET detectors with great interest in the optical photon propagation, and have noticed strange results when using the polishedbackpainted surface. A toy simulation with optical photon source with defined original directions showed the behaviour described above - photons that should reflect totally, i.e. under the same angle as is the incidence angle, are reflected under random angles. After applying the changes to the code described in the hypernews link and recompiling Geant, the toy simulation showed the expected behaviour as did the full simulation results.

The change to the code applied is, in "geant4.10.04.p03/src/source/processes/optical/src/G4OpBoundaryProcess.cc", lines 1110 and 1178:

//original:
//if ( theModel == unified && theFinish != polished )
//manual fix:
if ( theModel == unified && theFinish != polished && theFinish != polishedbackpainted )
    ChooseReflection();
Comment 4 Daren Sawkey 2019-04-19 00:55:13 CEST
The existing code seems to agree with the documentation. It sounds like you expect the first surface to be polished. Actually it is ground. The 'polished' in 'polishedbackpainted' refers to the back paint ("wrapper" in the manual). If you want photons undergoing total internal reflection to have the same angle as the angle of incidence, the surface needs to be specified appropriately. Try the macro below with example extended/optical/OpNovice2 and look at the first boundary scattering for each event.

Please let me know if I misunderstand your post.

/control/verbose 2
/tracking/verbose 2

/opnovice2/boxProperty RINDEX 0.000002 1.31 0.000008 1.32
/opnovice2/boxProperty ABSLENGTH 0.000002 1000000 0.000005 2000000 0.000008 3000000

/opnovice2/worldProperty RINDEX 0.000002 1.01 0.000008 1.01
/opnovice2/worldProperty ABSLENGTH 0.000002 1000000 0.000005 2000000 0.000008 3000000

/opnovice2/surfaceModel unified
/opnovice2/surfaceType dielectric_dielectric

#### try each in turn
/opnovice2/surfaceFinish polished
#/opnovice2/surfaceFinish ground
#/opnovice2/surfaceFinish groundbackpainted

/opnovice2/surfaceSigmaAlpha 0.0
/opnovice2/surfaceProperty SPECULARSPIKECONSTANT 1.0
/opnovice2/surfaceProperty RINDEX 1.01

/run/initialize

/gun/particle opticalphoton
/gun/energy 3 eV 
/gun/position 99 0 0 cm
/gun/direction .1 .9 0
/opnovice2/gun/optPhotonPolar
/run/beamOn 10
Comment 5 Rok Dolenec 2019-04-25 14:00:18 CEST
(In reply to Daren Sawkey from comment #4)
> The existing code seems to agree with the documentation. It sounds like you
> expect the first surface to be polished. Actually it is ground. The
> 'polished' in 'polishedbackpainted' refers to the back paint ("wrapper" in
> the manual). If you want photons undergoing total internal reflection to
> have the same angle as the angle of incidence, the surface needs to be
> specified appropriately. Try the macro below with example
> extended/optical/OpNovice2 and look at the first boundary scattering for
> each event.
> 
> Please let me know if I misunderstand your post.
> 
> /control/verbose 2
> /tracking/verbose 2
> 
> /opnovice2/boxProperty RINDEX 0.000002 1.31 0.000008 1.32
> /opnovice2/boxProperty ABSLENGTH 0.000002 1000000 0.000005 2000000 0.000008
> 3000000
> 
> /opnovice2/worldProperty RINDEX 0.000002 1.01 0.000008 1.01
> /opnovice2/worldProperty ABSLENGTH 0.000002 1000000 0.000005 2000000
> 0.000008 3000000
> 
> /opnovice2/surfaceModel unified
> /opnovice2/surfaceType dielectric_dielectric
> 
> #### try each in turn
> /opnovice2/surfaceFinish polished
> #/opnovice2/surfaceFinish ground
> #/opnovice2/surfaceFinish groundbackpainted
> 
> /opnovice2/surfaceSigmaAlpha 0.0
> /opnovice2/surfaceProperty SPECULARSPIKECONSTANT 1.0
> /opnovice2/surfaceProperty RINDEX 1.01
> 
> /run/initialize
> 
> /gun/particle opticalphoton
> /gun/energy 3 eV 
> /gun/position 99 0 0 cm
> /gun/direction .1 .9 0
> /opnovice2/gun/optPhotonPolar
> /run/beamOn 10

Dear Daren,

many thanks for your dedicated investigation and explanation.

Your explanation makes sense and the total reflection behaves as expected in our code when defining the SPECULARSPIKECONSTANT=1.0 constant of the surface. This is also exactly as specified in the manual. 

The reason I presumed this is a bug was the hypernews link in my original comment, where the maintainer of the  G4OpBoundaryProcess.cc at the time referred to this as a bug. In any case your explanation solves the issue in a way consistent with the manual, so I believe this can be considered solved.