Problem 1059 - Rotation of G4Polyhedra causes improper optical photon reflection
Summary: Rotation of G4Polyhedra causes improper optical photon reflection
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: geometry/solids (show other problems)
Version: 9.2
Hardware: Apple Mac OS X
: P3 normal
Assignee: tatiana.nikitina
URL:
: 1071 (view as problem list)
Depends on:
Blocks:
 
Reported: 2009-04-21 18:26 CEST by Nathaniel
Modified: 2009-06-26 13:09 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 Nathaniel 2009-04-21 18:26:52 CEST
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);
Comment 1 tatiana.nikitina 2009-05-08 09:09:44 CEST
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
Comment 2 Gabriele Cosmo 2009-06-26 13:09:58 CEST
*** Problem 1071 has been marked as a duplicate of this problem. ***