| Summary: | Rotation of G4Polyhedra causes improper optical photon reflection | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | Nathaniel <nathaniel.cunningham> |
| Component: | geometry/solids | Assignee: | tatiana.nikitina |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | abe |
| Priority: | P3 | ||
| Version: | 9.2 | ||
| Hardware: | Apple | ||
| OS: | Mac OS X | ||
Dear Nathaniel, Thank you for pointing out the problem and for the test case. By examinating this problem, an error in using Rotation Matrix for the SurfaceNormal was found. This error affects only optical photons on the specific surfaces, when DistanceToOut retuns non-valid normal and SurfaceNormal is called for calculation of Normal. The fix is under testing. If you have your local instalation of Geant4, I can provide you the fix to try out. Best Regards, Tatiana Nikitina *** Problem 1071 has been marked as a duplicate of this problem. *** |
I create a 8x8cm hexagonal prism using G4Polyhedra (embedded in a larger World box). I give the prism optical surface properties, and generate optical photons within the prism. Without any rotation of the prism within the world volume, photons behave as expected at prism boundaries. If I rotate the prism by 90 degrees about x or y, however, in its placement within the world volume, some of the reflections go awry. I get "reflections" that penetrate the surface, even for the case of a "painted" or dielectric_metal surface. The same problems do NOT occur for rotations about the z axis, nor for a similar rotated cylinder defined using G4Tubs. Smaller rotations about x or y appear to exhibit the same problem to a smaller degree; this is not limited to angles of exactly 90 degrees. The example code below is an excerpt that exhibits the problem. Thanks, Nathaniel // =================================== // parameters of hexagonal prism G4double hexEdgeToEdge = 8.*cm; G4double hexHeight = 8.*cm; // definition of Polyhedron parameters G4double startAngleOfPoly = 0.*deg; G4double spanningAnglePoly = 360.*deg; G4int numSidePoly = 6; G4int numZPlanes = 2; //number of slices where we specify radius & Z const G4double polyInnerRadii[] = {0., 0.}; const G4double polyOuterRadii[] = {hexEdgeToEdge/2., hexEdgeToEdge/2.}; const G4double polyZPlanes[] = {-hexHeight/2., hexHeight/2.}; G4Polyhedra* scintBlock_hex = new G4Polyhedra("scintillator_block", startAngleOfPoly, spanningAnglePoly, numSidePoly, numZPlanes, polyZPlanes, polyInnerRadii, polyOuterRadii); scintBlock_log = new G4LogicalVolume(scintBlock_hex, Water,"scintBlock_log",0,0,0); G4double blockPos_x = 0.0*m; G4double blockPos_y = 0.0*m; G4double blockPos_z = 0.0*m; G4double blockXRotation = 90.0*deg; G4RotationMatrix rotMatrix; rotMatrix.rotateX(blockXRotation); scintBlock_phys = new G4PVPlacement(G4Transform3D(rotMatrix, G4ThreeVector(blockPos_x,blockPos_y, blockPos_z)), scintBlock_log,"scintBlock", experimentalHall_log,false,0); // ------------- Surfaces -------------- // // Scintillator block G4OpticalSurface* OpScintSurface = new G4OpticalSurface("ScintSurface"); G4double sigma_alpha = 0.05; OpScintSurface->SetType(dielectric_metal); OpScintSurface->SetFinish(ground); OpScintSurface->SetModel(unified); OpScintSurface->SetSigmaAlpha(sigma_alpha); G4LogicalBorderSurface* ScintSurface = new G4LogicalBorderSurface("ScintSurface", scintBlock_phys,experimentalHall_phys,OpScintSurface); // Generate & Add Material Properties Table attached to the Optical surfaces const G4int num = 2; G4double Ephoton[num] = {2.038*eV, 4.144*eV}; //OpticalScintSurface G4double SpecularLobe[num] = {1.0, 1.0}; G4double SpecularSpike[num] = {0.0, 0.0}; G4double Backscatter[num] = {0.0, 0.0}; G4double Reflectivity[num] = {0.9, 0.9}; G4MaterialPropertiesTable* myST1 = new G4MaterialPropertiesTable(); myST1->AddProperty("SPECULARLOBECONSTANT", Ephoton, SpecularLobe, num); myST1->AddProperty("SPECULARSPIKECONSTANT", Ephoton, SpecularSpike, num); myST1->AddProperty("BACKSCATTERCONSTANT", Ephoton, Backscatter, num); myST1->AddProperty("REFLECTIVITY", Ephoton, Reflectivity, num); OpScintSurface->SetMaterialPropertiesTable(myST1);