181 const G4Step* pStep = &aStep;
185 if (hStep) pStep = hStep;
236 std::vector<G4Navigator*>::iterator iNav =
238 GetActiveNavigatorsIterator();
240 (iNav[hNavId])->GetGlobalExitNormal(theGlobalPoint,&valid);
248 ed <<
" G4OpBoundaryProcess/PostStepDoIt(): "
249 <<
" The Navigator reports that it returned an invalid normal"
251 G4Exception(
"G4OpBoundaryProcess::PostStepDoIt",
"OpBoun01",
253 "Invalid Surface Normal - Geometry must return valid surface normal");
257 #ifdef G4OPTICAL_DEBUG
259 ed <<
" G4OpBoundaryProcess/PostStepDoIt(): "
260 <<
" theGlobalNormal points in a wrong direction. "
262 ed <<
" The momentum of the photon arriving at interface (oldMomentum)"
263 <<
" must exit the volume cross in the step. " <<
G4endl;
264 ed <<
" So it MUST have dot < 0 with the normal that Exits the new volume (globalNormal)." <<
G4endl;
269 G4Exception(
"G4OpBoundaryProcess::PostStepDoIt",
"OpBoun02",
272 "Invalid Surface Normal - Geometry must return valid surface normal pointing in the right direction");
282 if (aMaterialPropertiesTable) {
322 if (Surface == NULL){
351 GetMaterialPropertiesTable();
353 if (aMaterialPropertiesTable) {
405 if (aMaterialPropertiesTable->
406 ConstPropertyExists(
"SURFACEROUGHNESS"))
455 aMaterialPropertiesTable =
457 if (aMaterialPropertiesTable)
525 G4cerr <<
" Error: G4BoundaryProcess: illegal boundary type " <<
G4endl;
565 G4cout <<
" *** TotalInternalReflection *** " <<
G4endl;
575 G4cout <<
" *** PolishedLumirrorAirReflection *** " <<
G4endl;
577 G4cout <<
" *** PolishedLumirrorGlueReflection *** " <<
G4endl;
581 G4cout <<
" *** PolishedTeflonAirReflection *** " <<
G4endl;
583 G4cout <<
" *** PolishedTiOAirReflection *** " <<
G4endl;
585 G4cout <<
" *** PolishedTyvekAirReflection *** " <<
G4endl;
587 G4cout <<
" *** PolishedVM2000AirReflection *** " <<
G4endl;
589 G4cout <<
" *** PolishedVM2000GlueReflection *** " <<
G4endl;
591 G4cout <<
" *** EtchedLumirrorAirReflection *** " <<
G4endl;
593 G4cout <<
" *** EtchedLumirrorGlueReflection *** " <<
G4endl;
597 G4cout <<
" *** EtchedTeflonAirReflection *** " <<
G4endl;
601 G4cout <<
" *** EtchedTyvekAirReflection *** " <<
G4endl;
603 G4cout <<
" *** EtchedVM2000AirReflection *** " <<
G4endl;
605 G4cout <<
" *** EtchedVM2000GlueReflection *** " <<
G4endl;
607 G4cout <<
" *** GroundLumirrorAirReflection *** " <<
G4endl;
609 G4cout <<
" *** GroundLumirrorGlueReflection *** " <<
G4endl;
613 G4cout <<
" *** GroundTeflonAirReflection *** " <<
G4endl;
617 G4cout <<
" *** GroundTyvekAirReflection *** " <<
G4endl;
619 G4cout <<
" *** GroundVM2000AirReflection *** " <<
G4endl;
621 G4cout <<
" *** GroundVM2000GlueReflection *** " <<
G4endl;
657 if (sigma_alpha == 0.0)
return FacetNormal = Normal;
661 G4double phi, SinAlpha, CosAlpha, SinPhi, CosPhi, unit_x, unit_y, unit_z;
672 SinAlpha = std::sin(alpha);
673 CosAlpha = std::cos(alpha);
674 SinPhi = std::sin(phi);
675 CosPhi = std::cos(phi);
677 unit_x = SinAlpha * CosPhi;
678 unit_y = SinAlpha * SinPhi;
681 FacetNormal.
setX(unit_x);
682 FacetNormal.
setY(unit_y);
683 FacetNormal.
setZ(unit_z);
689 }
while (Momentum * FacetNormal >= 0.0);
704 }
while (smear.
mag()>1.0);
705 smear = (1.-polish) * smear;
706 FacetNormal = Normal + smear;
708 }
while (Momentum * FacetNormal >= 0.0);
709 FacetNormal = FacetNormal.
unit();
712 FacetNormal = Normal;
782 A_trans = A_trans.
unit();
787 A_paral = A_paral.
unit();
813 G4int thetaIndex, phiIndex;
814 G4double AngularDistributionValue, thetaRad, phiRad, EdotN;
815 G4ThreeVector PerpendicularVectorTheta, PerpendicularVectorPhi;
842 G4int angleIncident =
G4int(std::floor(180/
pi*anglePhotonToNormal+0.5));
847 thetaIndex = G4RandFlat::shootInt(thetaIndexMax-1);
848 phiIndex = G4RandFlat::shootInt(phiIndexMax-1);
851 GetAngularDistributionValue(angleIncident,
857 thetaRad = (-90 + 4*thetaIndex)*
pi/180;
858 phiRad = (-90 + 5*phiIndex)*
pi/180;
867 PerpendicularVectorTheta);
868 PerpendicularVectorPhi =
883 G4int angindex, random, angleIncident;
884 G4double ReflectivityValue, elevation, azimuth, EdotN;
894 angleIncident =
G4int(std::floor(180/
pi*anglePhotonToNormal+0.5));
896 ReflectivityValue =
OpticalSurface -> GetReflectivityLUTValue(angleIncident);
898 if ( rand > ReflectivityValue ) {
908 if (angleIncident <= 0.01) {
915 random = G4RandFlat::shootInt(1,LUTbin+1);
916 angindex = (((random*2)-1))+angleIncident*LUTbin*2 + 3640000;
918 azimuth =
OpticalSurface -> GetAngularDistributionValueLUT(angindex-1);
919 elevation=
OpticalSurface -> GetAngularDistributionValueLUT(angindex);
921 }
while ( elevation == 0 && azimuth == 0);
929 u = u *= (std::sin(elevation) * std::cos(azimuth));
930 v = vNorm *= (std::sin(elevation) * std::sin(azimuth));
944 if (angleIncident == 0) {
950 random = G4RandFlat::shootInt(1,LUTbin+1);
951 angindex = (((random*2)-1))+(angleIncident-1)*LUTbin*2;
953 azimuth =
OpticalSurface -> GetAngularDistributionValueLUT(angindex-1);
954 elevation =
OpticalSurface -> GetAngularDistributionValueLUT(angindex);
955 }
while (elevation == 0 && azimuth == 0);
963 u = u *= (std::sin(elevation) * std::cos(azimuth));
964 v = vNorm *= (std::sin(elevation) * std::sin(azimuth));
981 G4double angleIncident = std::floor(180/
pi*anglePhotonToNormal+0.5);
999 ed <<
" G4OpBoundaryProcess/DielectricDichroic(): "
1000 <<
" The dichroic surface has no G4Physics2DVector"
1002 G4Exception(
"G4OpBoundaryProcess::DielectricDichroic",
"OpBoun03",
1004 "A dichroic surface must have an associated G4Physics2DVector");
1046 G4bool SurfaceRoughnessCriterionPass = 1;
1049 G4double SurfaceRoughnessCriterion =
1051 SurfaceRoughnessCriterionPass =
1064 G4double s1, s2, E2_perp, E2_parl, E2_total, TransCoeff;
1103 if (Swap) Swap = !Swap;
1107 if ( !SurfaceRoughnessCriterionPass )
theStatus =
1129 else if (
sint2 < 1.0) {
1142 A_trans = A_trans.
unit();
1144 E1pp = E1_perp * A_trans;
1146 E1_parl = E1pl.
mag();
1160 E2_total = E2_perp*E2_perp + E2_parl*E2_parl;
1164 else if (cost1 != 0.0) TransCoeff = s2/s1;
1165 else TransCoeff = 0.0;
1171 if (Swap) Swap = !Swap;
1175 if ( !SurfaceRoughnessCriterionPass )
theStatus =
1196 E2_perp = E2_perp - E1_perp;
1197 E2_total = E2_perp*E2_perp + E2_parl*E2_parl;
1199 A_paral = A_paral.
unit();
1200 E2_abs = std::sqrt(E2_total);
1201 C_parl = E2_parl/E2_abs;
1202 C_perp = E2_perp/E2_abs;
1232 NewMomentum = NewMomentum.
unit();
1234 A_paral = NewMomentum.
cross(A_trans);
1235 A_paral = A_paral.
unit();
1236 E2_abs = std::sqrt(E2_total);
1237 C_parl = E2_parl/E2_abs;
1238 C_perp = E2_perp/E2_abs;
1265 if (Inside && !Swap) {
1318 G4double magN= theFacetNormal.mag();
1319 G4double incidentangle =
pi - std::acos(PdotN/(magP*magN));
1321 return incidentangle;
1330 G4complex Reflectivity, Reflectivity_TE, Reflectivity_TM;
1347 if (aPropertyPointerR && aPropertyPointerI) {
1356 CosPhi=std::sqrt(u-((std::sin(incidentangle)*std::sin(incidentangle))*(N1*N1)/(N2*N2)));
1358 numeratorTE = N1*std::cos(incidentangle) - N2*CosPhi;
1359 denominatorTE = N1*std::cos(incidentangle) + N2*CosPhi;
1360 rTE = numeratorTE/denominatorTE;
1362 numeratorTM = N2*std::cos(incidentangle) - N1*CosPhi;
1363 denominatorTM = N2*std::cos(incidentangle) + N1*CosPhi;
1364 rTM = numeratorTM/denominatorTM;
1371 Reflectivity_TE = (rTE*conj(rTE))*(E1_perp*E1_perp)
1372 / (E1_perp*E1_perp + E1_parl*E1_parl);
1373 Reflectivity_TM = (rTM*conj(rTM))*(E1_parl*E1_parl)
1374 / (E1_perp*E1_perp + E1_parl*E1_parl);
1375 Reflectivity = Reflectivity_TE + Reflectivity_TM;
1378 if(
G4UniformRand()*real(Reflectivity) > real(Reflectivity_TE))
1379 {
iTE = -1;}
else{
iTE = 1;}
1380 if(
G4UniformRand()*real(Reflectivity) > real(Reflectivity_TM))
1381 {
iTM = -1;}
else{
iTM = 1;}
1385 return real(Reflectivity);
1418 A_trans = A_trans.
unit();
1420 E1pp = E1_perp * A_trans;
1422 E1_parl = E1pl.
mag();
1441 RealRindex, ImaginaryRindex);
1451 if (sd)
return sd->
Hit(&aStep);
G4bool Hit(G4Step *aStep)
void CalculateReflectivity(void)
G4OpticalSurfaceModel theModel
void G4SwapObj(T *a, T *b)
G4OpBoundaryProcessStatus
CLHEP::Hep3Vector G4ThreeVector
void ProposePolarization(G4double Px, G4double Py, G4double Pz)
std::ostringstream G4ExceptionDescription
G4int GetPhiIndexMax(void) const
G4LogicalVolume * GetLogicalVolume() const
G4double GetIncidentAngle()
G4ThreeVector OldMomentum
G4ThreeVector theFacetNormal
G4int GetThetaIndexMax(void) const
G4StepPoint * GetPreStepPoint() const
G4ThreeVector NewPolarization
static constexpr double nm
G4double GetPolish() const
G4double GetStepLength() const
const G4ThreeVector & GetMomentumDirection() const
G4double thePhotonMomentum
static constexpr double perCent
G4double GetReflectivity(G4double E1_perp, G4double E1_parl, G4double incidentangle, G4double RealRindex, G4double ImaginaryRindex)
G4VSensitiveDetector * GetSensitiveDetector() const
void ProposeVelocity(G4double finalVelocity)
static G4LogicalBorderSurface * GetSurface(const G4VPhysicalVolume *vol1, const G4VPhysicalVolume *vol2)
Hep3Vector & rotateUz(const Hep3Vector &)
G4VPhysicalVolume * GetPhysicalVolume() const
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
G4double Value(G4double theEnergy, size_t &lastidx) const
G4double condition(const G4ErrorSymMatrix &m)
static constexpr double h_Planck
G4OpBoundaryProcess(const G4String &processName="OpBoundary", G4ProcessType type=fOptical)
G4MaterialPropertyVector * PropertyPointer2
static const G4Step * GetHyperStep()
G4double GetMeanFreePath(const G4Track &, G4double, G4ForceCondition *condition)
static G4LogicalSkinSurface * GetSurface(const G4LogicalVolume *vol)
G4ParticleChange aParticleChange
double angle(const Hep3Vector &) const
G4ThreeVector NewMomentum
G4Physics2DVector * DichroicVector
std::complex< G4double > G4complex
G4MaterialPropertyVector * PropertyPointer
G4StepStatus GetStepStatus() const
G4LogicalVolume * GetMotherLogical() const
G4Material * GetMaterial() const
G4Physics2DVector * GetDichroicVector()
virtual void Initialize(const G4Track &)
G4OpticalSurfaceFinish theFinish
G4OpticalSurfaceModel GetModel() const
const G4ThreeVector & GetPosition() const
void DielectricLUTDAVIS()
G4OpticalSurface * OpticalSurface
static const G4double alpha
static constexpr double twopi
const G4String & GetProcessName() const
static constexpr double halfpi
G4SurfaceProperty * GetSurfaceProperty() const
G4StepPoint * GetPostStepPoint() const
G4OpBoundaryProcessStatus theStatus
G4double GetVelocity() const
ThreeVector shoot(const G4int Ap, const G4int Af)
G4GLOB_DLL std::ostream G4cerr
Hep3Vector & rotate(double, const Hep3Vector &)
static G4int GetHypNavigatorID()
void AddTotalEnergyDeposit(G4double value)
G4double Value(G4double x, G4double y, size_t &lastidx, size_t &lastidy) const
Hep3Vector cross(const Hep3Vector &) const
static G4TransportationManager * GetTransportationManager()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4double GetSigmaAlpha() const
const G4ThreeVector & GetPolarization() const
void G4SwapPtr(T *&a, T *&b)
static constexpr double c_light
G4ThreeVector OldPolarization
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4double theSurfaceRoughness
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
void SetProcessSubType(G4int)
G4bool G4BooleanRand(const G4double prob) const
G4GLOB_DLL std::ostream G4cout
void DielectricDichroic()
G4MaterialPropertyVector * GetProperty(const char *key, G4bool warning=false)
void DielectricDielectric()
G4OpticalSurfaceFinish GetFinish() const
static G4GeometryTolerance * GetInstance()
Hep3Vector orthogonal() const
G4MaterialPropertyVector * PropertyPointer1
G4double GetTotalMomentum() const
static constexpr double pi
G4double theTransmittance
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
const G4SurfaceType & GetType() const
G4ThreeVector GetFacetNormal(const G4ThreeVector &Momentum, const G4ThreeVector &Normal) const
G4ThreeVector theGlobalNormal
void ProposeTrackStatus(G4TrackStatus status)
G4bool InvokeSD(const G4Step *step)
const G4DynamicParticle * GetDynamicParticle() const
G4double GetSurfaceTolerance() const
void BoundaryProcessVerbose(void) const
const G4String & GetName() const
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4int GetLUTbins(void) const