158 const G4Step* pStep = &aStep;
162 if (hStep) pStep = hStep;
209 std::vector<G4Navigator*>::iterator iNav =
211 theGlobalNormal = (iNav[hNavId])->GetGlobalExitNormal(theGlobalPoint, &valid);
219 ed <<
" G4OpBoundaryProcess/PostStepDoIt(): "
220 <<
" The Navigator reports that it returned an invalid normal"
222 G4Exception(
"G4OpBoundaryProcess::PostStepDoIt",
"OpBoun01",
224 "Invalid Surface Normal - Geometry must return valid surface normal");
228 #ifdef G4OPTICAL_DEBUG
230 ed <<
" G4OpBoundaryProcess/PostStepDoIt(): "
231 <<
" theGlobalNormal points in a wrong direction. "
233 ed <<
" The momentum of the photon arriving at interface (oldMomentum)"
234 <<
" must exit the volume cross in the step. " <<
G4endl;
235 ed <<
" So it MUST have dot < 0 with the normal that Exits the new volume (globalNormal)." <<
G4endl;
240 G4Exception(
"G4OpBoundaryProcess::PostStepDoIt",
"OpBoun02",
243 "Invalid Surface Normal - Geometry must return valid surface normal pointing in the right direction");
253 if (aMaterialPropertiesTable) {
292 if (Surface ==
nullptr) {
295 if (enteredDaughter) {
297 if (Surface ==
nullptr) {
303 if (Surface ==
nullptr) {
320 if (aMaterialPropertiesTable) {
343 if (PropertyPointer) {
350 if (PropertyPointer) {
355 if (PropertyPointer) {
365 if (PropertyPointer) {
372 if (PropertyPointer) {
379 if (PropertyPointer) {
402 if (aMaterialPropertiesTable) RindexMPV = aMaterialPropertiesTable->
GetProperty(
kRINDEX);
456 G4cerr <<
" Error: G4BoundaryProcess: illegal boundary type " <<
G4endl;
498 G4cout <<
" *** TotalInternalReflection *** " <<
G4endl;
508 G4cout <<
" *** PolishedLumirrorAirReflection *** " <<
G4endl;
510 G4cout <<
" *** PolishedLumirrorGlueReflection *** " <<
G4endl;
514 G4cout <<
" *** PolishedTeflonAirReflection *** " <<
G4endl;
516 G4cout <<
" *** PolishedTiOAirReflection *** " <<
G4endl;
518 G4cout <<
" *** PolishedTyvekAirReflection *** " <<
G4endl;
520 G4cout <<
" *** PolishedVM2000AirReflection *** " <<
G4endl;
522 G4cout <<
" *** PolishedVM2000GlueReflection *** " <<
G4endl;
524 G4cout <<
" *** EtchedLumirrorAirReflection *** " <<
G4endl;
526 G4cout <<
" *** EtchedLumirrorGlueReflection *** " <<
G4endl;
530 G4cout <<
" *** EtchedTeflonAirReflection *** " <<
G4endl;
534 G4cout <<
" *** EtchedTyvekAirReflection *** " <<
G4endl;
536 G4cout <<
" *** EtchedVM2000AirReflection *** " <<
G4endl;
538 G4cout <<
" *** EtchedVM2000GlueReflection *** " <<
G4endl;
540 G4cout <<
" *** GroundLumirrorAirReflection *** " <<
G4endl;
542 G4cout <<
" *** GroundLumirrorGlueReflection *** " <<
G4endl;
546 G4cout <<
" *** GroundTeflonAirReflection *** " <<
G4endl;
550 G4cout <<
" *** GroundTyvekAirReflection *** " <<
G4endl;
552 G4cout <<
" *** GroundVM2000AirReflection *** " <<
G4endl;
554 G4cout <<
" *** GroundVM2000GlueReflection *** " <<
G4endl;
592 if (sigma_alpha == 0.0)
return FacetNormal = Normal;
596 G4double phi, SinAlpha, CosAlpha, SinPhi, CosPhi, unit_x, unit_y, unit_z;
607 SinAlpha = std::sin(alpha);
608 CosAlpha = std::cos(alpha);
609 SinPhi = std::sin(phi);
610 CosPhi = std::cos(phi);
612 unit_x = SinAlpha * CosPhi;
613 unit_y = SinAlpha * SinPhi;
616 FacetNormal.
setX(unit_x);
617 FacetNormal.
setY(unit_y);
618 FacetNormal.
setZ(unit_z);
624 }
while (Momentum * FacetNormal >= 0.0);
638 }
while (smear.
mag() > 1.0);
639 smear = (1.-polish) * smear;
640 FacetNormal = Normal + smear;
642 }
while (Momentum * FacetNormal >= 0.0);
643 FacetNormal = FacetNormal.
unit();
646 FacetNormal = Normal;
711 A_trans = A_trans.
unit();
716 A_paral = A_paral.
unit();
720 }
else if (
iTE > 0) {
722 }
else if (
iTM >0 ) {
740 G4int thetaIndex, phiIndex;
741 G4double AngularDistributionValue, thetaRad, phiRad, EdotN;
742 G4ThreeVector PerpendicularVectorTheta, PerpendicularVectorPhi;
768 G4int angleIncident =
G4int(std::floor(180./
pi*anglePhotonToNormal+0.5));
773 thetaIndex = G4RandFlat::shootInt(thetaIndexMax-1);
774 phiIndex = G4RandFlat::shootInt(phiIndexMax-1);
777 GetAngularDistributionValue(angleIncident, thetaIndex, phiIndex);
781 thetaRad = (-90 + 4*thetaIndex)*
pi/180.;
782 phiRad = (-90 + 5*phiIndex)*
pi/180.;
807 G4int angindex, random, angleIncident;
808 G4double ReflectivityValue, elevation, azimuth, EdotN;
816 angleIncident =
G4int(std::floor(180./
pi*anglePhotonToNormal+0.5));
820 if (rand > ReflectivityValue) {
828 if (angleIncident <= 0.01) {
834 random = G4RandFlat::shootInt(1, LUTbin+1);
835 angindex = (((random*2)-1)) + angleIncident*LUTbin*2 + 3640000;
839 }
while (elevation == 0. && azimuth == 0.);
847 u = u *= (std::sin(elevation) * std::cos(azimuth));
848 v = vNorm *= (std::sin(elevation) * std::sin(azimuth));
861 if (angleIncident == 0) {
867 random = G4RandFlat::shootInt(1, LUTbin+1);
868 angindex = (((random*2)-1)) + (angleIncident-1) * LUTbin*2;
872 }
while (elevation == 0. && azimuth == 0.);
880 u = u *= (std::sin(elevation) * std::cos(azimuth));
881 v = vNorm *= (std::sin(elevation) * std::sin(azimuth));
900 G4double angleIncident = std::floor(180./
pi*anglePhotonToNormal+0.5);
916 ed <<
" G4OpBoundaryProcess/DielectricDichroic(): "
917 <<
" The dichroic surface has no G4Physics2DVector"
919 G4Exception(
"G4OpBoundaryProcess::DielectricDichroic",
"OpBoun03",
921 "A dichroic surface must have an associated G4Physics2DVector");
963 G4bool SurfaceRoughnessCriterionPass =
true;
966 G4double SurfaceRoughnessCriterion =
968 SurfaceRoughnessCriterionPass =
G4BooleanRand(SurfaceRoughnessCriterion);
980 G4double s1, s2, E2_perp, E2_parl, E2_total, TransCoeff;
1018 if (Swap) Swap = !Swap;
1041 else if (
sint2 < 1.0) {
1053 A_trans = A_trans.
unit();
1055 E1pp = E1_perp * A_trans;
1057 E1_parl = E1pl.
mag();
1071 E2_total = E2_perp*E2_perp + E2_parl*E2_parl;
1075 else if (cost1 != 0.0) TransCoeff = s2/
s1;
1076 else TransCoeff = 0.0;
1082 if (Swap) Swap = !Swap;
1103 E2_perp = E2_perp - E1_perp;
1104 E2_total = E2_perp*E2_perp + E2_parl*E2_parl;
1106 A_paral = A_paral.
unit();
1107 E2_abs = std::sqrt(E2_total);
1108 C_parl = E2_parl/E2_abs;
1109 C_perp = E2_perp/E2_abs;
1134 NewMomentum = NewMomentum.
unit();
1135 A_paral = NewMomentum.
cross(A_trans);
1136 A_paral = A_paral.
unit();
1137 E2_abs = std::sqrt(E2_total);
1138 C_parl = E2_parl/E2_abs;
1139 C_perp = E2_perp/E2_abs;
1163 if (Inside && !Swap) {
1213 G4double magN = theFacetNormal.mag();
1214 G4double incidentangle =
pi - std::acos(PdotN/(magP*magN));
1216 return incidentangle;
1227 G4complex Reflectivity, Reflectivity_TE, Reflectivity_TM;
1244 if (aPropertyPointerR && aPropertyPointerI) {
1253 CosPhi = std::sqrt(u-((std::sin(incidentangle)*std::sin(incidentangle))*(N1*N1)/(N2*N2)));
1255 numeratorTE = N1*std::cos(incidentangle) - N2*CosPhi;
1256 denominatorTE = N1*std::cos(incidentangle) + N2*CosPhi;
1257 rTE = numeratorTE/denominatorTE;
1259 numeratorTM = N2*std::cos(incidentangle) - N1*CosPhi;
1260 denominatorTM = N2*std::cos(incidentangle) + N1*CosPhi;
1261 rTM = numeratorTM/denominatorTM;
1268 Reflectivity_TE = (rTE*conj(rTE))*(E1_perp*E1_perp)
1269 / (E1_perp*E1_perp + E1_parl*E1_parl);
1270 Reflectivity_TM = (rTM*conj(rTM))*(E1_parl*E1_parl)
1271 / (E1_perp*E1_perp + E1_parl*E1_parl);
1272 Reflectivity = Reflectivity_TE + Reflectivity_TM;
1275 if (
G4UniformRand()*real(Reflectivity) > real(Reflectivity_TE)) {
1280 if (
G4UniformRand()*real(Reflectivity) > real(Reflectivity_TM)) {
1286 }
while (
iTE < 0 &&
iTM < 0);
1288 return real(Reflectivity);
1319 A_trans = A_trans.
unit();
1321 E1pp = E1_perp * A_trans;
1323 E1_parl = E1pl.
mag();
1340 RealRindex, ImaginaryRindex);
1351 if (sd)
return sd->
Hit(&aStep);