Problem 2364 - Surface roughness check uses improperly initialised variable in G4OpBoundaryProcess
Summary: Surface roughness check uses improperly initialised variable in G4OpBoundaryP...
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/optical (show other problems)
Version: 10.7
Hardware: All All
: P4 minor
Assignee: Daren Sawkey
URL:
Depends on:
Blocks:
 
Reported: 2021-04-28 11:44 CEST by Thomas Blake
Modified: 2021-06-28 13:38 CEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Thomas Blake 2021-04-28 11:44:54 CEST
Looking at the source code for dielectric-dielectric optical boundary processes: 

https://gitlab.cern.ch/geant4/geant4/-/blob/master/source/processes/optical/src/G4OpBoundaryProcess.cc#L1036

it appears that the check on surface roughness uses the variable cost1 before it is properly initialised. The initialisation happens at line 1080.
Comment 1 Daren Sawkey 2021-05-26 20:13:26 CEST
Thanks for reporting this. It is now fixed and will be available in the next release.
Comment 2 Ahmed Moustafa 2021-06-25 23:16:34 CEST
(In reply to Daren Sawkey from comment #1)
> Thanks for reporting this. It is now fixed and will be available in the next
> release.

Hello,

With the edits in the new release, it looks like the "SurfaceRoughnessCriterionPass" will always be set to true since "cost1" is set to zero. This means that the following checks are always false:
https://gitlab.cern.ch/geant4/geant4/-/blob/master/source/processes/optical/src/G4OpBoundaryProcess.cc#L1112
and
https://gitlab.cern.ch/geant4/geant4/-/blob/master/source/processes/optical/src/G4OpBoundaryProcess.cc#L1183

What was the purpose of the "SurfaceRoughnessCriterion" in the first place? and what's the rationale behind its formula?
Comment 3 Thomas Blake 2021-06-28 11:40:53 CEST
Hi Ahmed, 

I believe the implementation originates from a scalar theory of scattering. The "SurfaceRoughnessCriterion" corresponds to the probability to reflect rather than scatter from the surface. This type of scattering is relevant for DIRC detectors (and e.g. the Belle II TOP), where there are large numbers of reflections and the surface roughness is sub-nm. 

Tom
Comment 4 Daren Sawkey 2021-06-28 13:38:41 CEST
I neglected to backport the fix to 10.7 patch2. It is fixed in the beta preview of version 11.