156 const G4Step* pStep = &aStep;
180 if(thePrePV !=
nullptr)
182 if(thePostPV !=
nullptr)
198 if(groupvel !=
nullptr)
225 fGlobalNormal = (iNav[hNavId])->GetGlobalExitNormal(theGlobalPoint, &valid);
234 ed <<
" G4OpBoundaryProcess/PostStepDoIt(): "
235 <<
" The Navigator reports that it returned an invalid normal" <<
G4endl;
238 "Invalid Surface Normal - Geometry must return valid surface normal");
243#ifdef G4OPTICAL_DEBUG
245 ed <<
" G4OpBoundaryProcess/PostStepDoIt(): fGlobalNormal points in a "
248 <<
" The momentum of the photon arriving at interface (oldMomentum)"
249 <<
" must exit the volume cross in the step. " <<
G4endl
250 <<
" So it MUST have dot < 0 with the normal that Exits the new "
251 "volume (globalNormal)."
252 <<
G4endl <<
" >> The dot product of oldMomentum and global Normal is "
257 G4Exception(
"G4OpBoundaryProcess::PostStepDoIt",
"OpBoun02",
261 "Invalid Surface Normal - Geometry must return valid surface "
262 "normal pointing in the right direction");
274 if(rIndexMPV !=
nullptr)
301 if(surface ==
nullptr)
306 if(surface ==
nullptr)
315 if(surface ==
nullptr)
323 if(surface !=
nullptr)
341 if(rIndexMPV !=
nullptr)
422 if(rIndexMPV !=
nullptr)
490 ed <<
" PostStepDoIt(): Illegal boundary type." <<
G4endl;
517 if(groupvel !=
nullptr)
538 G4cout <<
"FresnelRefraction";
540 G4cout <<
"FresnelReflection";
542 G4cout <<
"TotalInternalReflection";
544 G4cout <<
"LambertianReflection";
546 G4cout <<
"LobeReflection";
548 G4cout <<
"SpikeReflection";
550 G4cout <<
"BackScattering";
552 G4cout <<
"PolishedLumirrorAirReflection";
554 G4cout <<
"PolishedLumirrorGlueReflection";
556 G4cout <<
"PolishedAirReflection";
558 G4cout <<
"PolishedTeflonAirReflection";
560 G4cout <<
"PolishedTiOAirReflection";
562 G4cout <<
"PolishedTyvekAirReflection";
564 G4cout <<
"PolishedVM2000AirReflection";
566 G4cout <<
"PolishedVM2000GlueReflection";
568 G4cout <<
"EtchedLumirrorAirReflection";
570 G4cout <<
"EtchedLumirrorGlueReflection";
572 G4cout <<
"EtchedAirReflection";
574 G4cout <<
"EtchedTeflonAirReflection";
576 G4cout <<
"EtchedTiOAirReflection";
578 G4cout <<
"EtchedTyvekAirReflection";
580 G4cout <<
"EtchedVM2000AirReflection";
582 G4cout <<
"EtchedVM2000GlueReflection";
584 G4cout <<
"GroundLumirrorAirReflection";
586 G4cout <<
"GroundLumirrorGlueReflection";
588 G4cout <<
"GroundAirReflection";
590 G4cout <<
"GroundTeflonAirReflection";
592 G4cout <<
"GroundTiOAirReflection";
594 G4cout <<
"GroundTyvekAirReflection";
596 G4cout <<
"GroundVM2000AirReflection";
598 G4cout <<
"GroundVM2000GlueReflection";
604 G4cout <<
"NotAtBoundary";
612 G4cout <<
"Dichroic Transmission";
631 if(sigma_alpha == 0.0)
644 sinAlpha = std::sin(
alpha);
648 facetNormal.
set(sinAlpha * std::cos(phi), sinAlpha * std::sin(phi),
651 }
while(momentum * facetNormal >= 0.0);
668 }
while(smear.
mag2() > 1.0);
669 facetNormal =
normal + (1. - polish) * smear;
670 }
while(momentum * facetNormal >= 0.0);
671 facetNormal = facetNormal.
unit();
780 G4int thetaIndex, phiIndex;
781 G4double angularDistVal, thetaRad, phiRad;
820 thetaIndex = G4RandFlat::shootInt(thetaIndexMax - 1);
821 phiIndex = G4RandFlat::shootInt(phiIndexMax - 1);
824 angleIncident, thetaIndex, phiIndex);
828 thetaRad =
G4double(-90 + 4 * thetaIndex) *
pi / 180.;
829 phiRad =
G4double(-90 + 5 * phiIndex) *
pi / 180.;
855 G4int angindex, random, angleIncident;
856 G4double reflectivityValue, elevation, azimuth;
872 std::floor(anglePhotonToNormal /
CLHEP::deg)), 89);
875 if(rand > reflectivityValue)
886 if(angleIncident <= 0.01)
894 random = G4RandFlat::shootInt(1, lutbin + 1);
896 (((random * 2) - 1)) + angleIncident * lutbin * 2 + 3640000;
901 }
while(elevation == 0. && azimuth == 0.);
903 sinEl = std::sin(elevation);
906 vNorm *= (sinEl * std::sin(azimuth));
921 if(angleIncident == 0)
929 random = G4RandFlat::shootInt(1, lutbin + 1);
930 angindex = (((random * 2) - 1)) + (angleIncident - 1) * lutbin * 2;
934 }
while(elevation == 0. && azimuth == 0.);
936 sinEl = std::sin(elevation);
939 vNorm *= (sinEl * std::sin(azimuth));
958 G4double angleIncident = std::floor(180. /
pi * anglePhotonToNormal + 0.5);
981 ed <<
" G4OpBoundaryProcess/DielectricDichroic(): "
982 <<
" The dichroic surface has no G4Physics2DVector" <<
G4endl;
983 G4Exception(
"G4OpBoundaryProcess::DielectricDichroic",
"OpBoun03",
985 "A dichroic surface must have an associated G4Physics2DVector");
1051 G4bool surfaceRoughnessCriterionPass =
true;
1055 G4double surfaceRoughnessCriterion = std::exp(-std::pow(
1057 surfaceRoughnessCriterionPass =
G4BooleanRand(surfaceRoughnessCriterion);
1067 G4double s1, s2, E2_perp, E2_parl, E2_total, transCoeff;
1094 fSint1 = std::sqrt(1. - cost1 * cost1);
1110 if(!surfaceRoughnessCriterionPass)
1132 else if(sint2 < 1.0)
1137 cost2 = std::sqrt(1. - sint2 * sint2);
1141 cost2 = -std::sqrt(1. - sint2 * sint2);
1148 E1pp = E1_perp * A_trans;
1150 E1_parl = E1pl.
mag();
1164 E2_total = E2_perp * E2_perp + E2_parl * E2_parl;
1169 else if(cost1 != 0.0)
1170 transCoeff = s2 / s1;
1180 if(!surfaceRoughnessCriterionPass)
1200 E2_perp = E2_perp - E1_perp;
1201 E2_total = E2_perp * E2_perp + E2_parl * E2_parl;
1203 E2_abs = std::sqrt(E2_total);
1204 C_parl = E2_parl / E2_abs;
1205 C_perp = E2_perp / E2_abs;
1234 E2_abs = std::sqrt(E2_total);
1235 C_parl = E2_parl / E2_abs;
1236 C_perp = E2_perp / E2_abs;
1325 G4complex reflectivity, reflectivity_TE, reflectivity_TM;
1348 cosPhi = std::sqrt(u - ((std::sin(incidentangle) * std::sin(incidentangle)) *
1349 (N1 * N1) / (N2 * N2)));
1351 numeratorTE = N1 * std::cos(incidentangle) - N2 * cosPhi;
1352 denominatorTE = N1 * std::cos(incidentangle) + N2 * cosPhi;
1353 rTE = numeratorTE / denominatorTE;
1355 numeratorTM = N2 * std::cos(incidentangle) - N1 * cosPhi;
1356 denominatorTM = N2 * std::cos(incidentangle) + N1 * cosPhi;
1357 rTM = numeratorTM / denominatorTM;
1364 reflectivity_TE = (rTE * conj(rTE)) * (E1_perp * E1_perp) /
1365 (E1_perp * E1_perp + E1_parl * E1_parl);
1366 reflectivity_TM = (rTM * conj(rTM)) * (E1_parl * E1_parl) /
1367 (E1_perp * E1_perp + E1_parl * E1_parl);
1368 reflectivity = reflectivity_TE + reflectivity_TM;
1372 if(
G4UniformRand() * real(reflectivity) > real(reflectivity_TE))
1380 if(
G4UniformRand() * real(reflectivity) > real(reflectivity_TM))
1391 return real(reflectivity);
1415 fSint1 = std::sqrt(1. - cost1 * cost1);
1429 E1pp = E1_perp * A_trans;
1431 E1_parl = E1pl.
mag();
1458 return sd->
Hit(&aStep);
G4double condition(const G4ErrorSymMatrix &m)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
static const G4double alpha
G4OpBoundaryProcessStatus
@ PolishedTiOAirReflection
@ GroundTeflonAirReflection
@ EtchedVM2000AirReflection
@ EtchedVM2000GlueReflection
@ GroundLumirrorGlueReflection
@ GroundTyvekAirReflection
@ PolishedVM2000GlueReflection
@ PolishedTeflonAirReflection
@ EtchedTyvekAirReflection
@ EtchedLumirrorGlueReflection
@ GroundVM2000AirReflection
@ PolishedTyvekAirReflection
@ PolishedVM2000AirReflection
@ EtchedTeflonAirReflection
@ GroundVM2000GlueReflection
@ PolishedLumirrorGlueReflection
@ TotalInternalReflection
@ PolishedLumirrorAirReflection
@ EtchedLumirrorAirReflection
@ GroundLumirrorAirReflection
static constexpr double perCent
static constexpr double twopi
static constexpr double nm
static constexpr double pi
static constexpr double halfpi
std::complex< G4double > G4complex
G4GLOB_DLL std::ostream G4cout
Hep3Vector orthogonal() const
Hep3Vector cross(const Hep3Vector &) const
double angle(const Hep3Vector &) const
void set(double x, double y, double z)
Hep3Vector & rotateUz(const Hep3Vector &)
Hep3Vector & rotate(double, const Hep3Vector &)
const G4ThreeVector & GetMomentumDirection() const
G4double GetTotalMomentum() const
const G4ThreeVector & GetPolarization() const
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
static G4LogicalBorderSurface * GetSurface(const G4VPhysicalVolume *vol1, const G4VPhysicalVolume *vol2)
static G4LogicalSkinSurface * GetSurface(const G4LogicalVolume *vol)
G4SurfaceProperty * GetSurfaceProperty() const
G4bool ConstPropertyExists(const G4String &key) const
G4double GetConstProperty(const G4String &key) const
G4MaterialPropertyVector * GetProperty(const char *key) const
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
G4double fSurfaceRoughness
G4OpticalSurfaceFinish fFinish
G4OpBoundaryProcessStatus fStatus
G4ThreeVector fNewPolarization
G4double GetReflectivity(G4double E1_perp, G4double E1_parl, G4double incidentangle, G4double RealRindex, G4double ImaginaryRindex)
virtual ~G4OpBoundaryProcess()
void BoundaryProcessVerbose(void) const
G4OpBoundaryProcess(const G4String &processName="OpBoundary", G4ProcessType type=fOptical)
void DielectricDichroic()
G4OpticalSurface * fOpticalSurface
G4ThreeVector fGlobalNormal
void DielectricLUTDAVIS()
G4ThreeVector fOldMomentum
virtual void Initialise()
G4ThreeVector fFacetNormal
G4OpticalSurfaceModel fModel
G4ThreeVector GetFacetNormal(const G4ThreeVector &Momentum, const G4ThreeVector &Normal) const
void SetVerboseLevel(G4int)
G4Physics2DVector * fDichroicVector
void CalculateReflectivity(void)
G4MaterialPropertyVector * fRealRIndexMPV
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep) override
G4double GetIncidentAngle()
G4ThreeVector fNewMomentum
size_t idx_rindex_surface
G4MaterialPropertyVector * fImagRIndexMPV
virtual void SetInvokeSD(G4bool)
virtual G4double GetMeanFreePath(const G4Track &, G4double, G4ForceCondition *condition) override
void DielectricDielectric()
G4bool G4BooleanRand(const G4double prob) const
virtual void PreparePhysicsTable(const G4ParticleDefinition &) override
G4bool InvokeSD(const G4Step *step)
G4ThreeVector fOldPolarization
G4bool GetBoundaryInvokeSD() const
void SetBoundaryInvokeSD(G4bool)
void SetBoundaryVerboseLevel(G4int)
G4int GetBoundaryVerboseLevel() const
static G4OpticalParameters * Instance()
G4double GetAngularDistributionValueLUT(G4int)
G4OpticalSurfaceModel GetModel() const
G4double GetSigmaAlpha() const
G4OpticalSurfaceFinish GetFinish() const
G4int GetThetaIndexMax(void) const
G4int GetPhiIndexMax(void) const
G4double GetPolish() const
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
G4Physics2DVector * GetDichroicVector()
G4double GetReflectivityLUTValue(G4int)
G4int GetLUTbins(void) const
G4double GetAngularDistributionValue(G4int, G4int, G4int)
static const G4Step * GetHyperStep()
static G4int GetHypNavigatorID()
void ProposePolarization(G4double Px, G4double Py, G4double Pz)
void ProposeVelocity(G4double finalVelocity)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
virtual void Initialize(const G4Track &)
G4double Value(G4double x, G4double y, std::size_t &lastidx, std::size_t &lastidy) const
G4double Value(const G4double energy, std::size_t &lastidx) const
G4StepStatus GetStepStatus() const
G4Material * GetMaterial() const
const G4ThreeVector & GetPosition() const
G4VSensitiveDetector * GetSensitiveDetector() const
G4VPhysicalVolume * GetPhysicalVolume() const
void AddTotalEnergyDeposit(G4double value)
G4StepPoint * GetPreStepPoint() const
G4StepPoint * GetPostStepPoint() const
const G4SurfaceType & GetType() const
G4double GetVelocity() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetStepLength() const
std::vector< G4Navigator * >::iterator GetActiveNavigatorsIterator()
static G4TransportationManager * GetTransportationManager()
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4LogicalVolume * GetMotherLogical() const
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
G4ParticleChange aParticleChange
void SetProcessSubType(G4int)
const G4String & GetProcessName() const
G4bool Hit(G4Step *aStep)
static constexpr double deg
static double normal(HepRandomEngine *eptr)
ThreeVector shoot(const G4int Ap, const G4int Af)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
void G4SwapObj(T *a, T *b)
void G4SwapPtr(T *&a, T *&b)