| Summary: | reflectivity is calculated twice when using groundbackpainted or polishedbackpainted | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | Akira Okumura <oxon> |
| Component: | processes/optical | Assignee: | gum |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | P5 | ||
| Version: | 9.3 | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: | test code for groundbackpainted and reflectivity | ||
|
Description
Akira Okumura
2010-04-17 14:30:29 CEST
Created attachment 72 [details]
test code for groundbackpainted and reflectivity
Thanks Akira,
for pointing this out. You are absolutely right. The bug was introduced when I allowed:
5th Nov 2009 Peter Gumplinger (op-V09-02-03)
G4OpBoundary::PostStepDoIt - all dielectric_dielectric
surfaces may now have a reflectivity <1; not only
'frontpainted' as was the case in the past.
most certainly upon a user's request to have a simple dielecric interface which was nevertheless not 'perfect'.
As you point out, not only 'frontpainted' surfaces have had historically a reflectivity attached to them but also 'backpainted' and the latter decision was/is implemented in the code of DielectricDielectric, while the calling code in G4OpBoundaryProcess.cc was changed to read:
else if (type == dielectric_dielectric) {
.....
else {
if( !G4BooleanRand(theReflectivity) ) {
DoAbsorption();
}
else {
DielectricDielectric();
}
when it simply read in the past:
else {
DielectricDielectric();
}
I don't want to change the code in DielectricDielectric(), instead (more spaghetti) I'll change to:
else if ( theFinish == polishedbackpainted ||
theFinish == groundbackpainted ) {
DielectricDielectric();
}
else {
if( !G4BooleanRand(theReflectivity) ) {
DoAbsorption();
}
else {
DielectricDielectric();
}
}
or a permutation which requires fewer else ifs.
Please, try it out.
Peter
There is a new tag op-V09-03-01 which will be included in an upcoming patch to 9.3. In the meantime, the new code for (type == dielectric_dielectric) reads:
else if (type == dielectric_dielectric) {
if ( theFinish == polishedbackpainted ||
theFinish == groundbackpainted ) {
DielectricDielectric();
}
else {
if ( !G4BooleanRand(theReflectivity) ) {
DoAbsorption();
}
else {
if ( theFinish == polishedfrontpainted ) {
DoReflection();
}
else if ( theFinish == groundfrontpainted ) {
theStatus = LambertianReflection;
DoReflection();
}
else {
DielectricDielectric();
}
}
}
|