176 const G4Step* pStep = &aStep;
180 if (hStep) pStep = hStep;
231 std::vector<G4Navigator*>::iterator iNav =
233 GetActiveNavigatorsIterator();
235 (iNav[hNavId])->GetGlobalExitNormal(theGlobalPoint,&valid);
243 ed <<
" G4OpBoundaryProcess/PostStepDoIt(): "
244 <<
" The Navigator reports that it returned an invalid normal"
246 G4Exception(
"G4OpBoundaryProcess::PostStepDoIt",
"OpBoun01",
248 "Invalid Surface Normal - Geometry must return valid surface normal");
252 #ifdef G4OPTICAL_DEBUG
254 ed <<
" G4OpBoundaryProcess/PostStepDoIt(): "
255 <<
" theGlobalNormal points in a wrong direction. "
257 ed <<
" The momentum of the photon arriving at interface (oldMomentum)"
258 <<
" must exit the volume cross in the step. " <<
G4endl;
259 ed <<
" So it MUST have dot < 0 with the normal that Exits the new volume (globalNormal)." <<
G4endl;
264 G4Exception(
"G4OpBoundaryProcess::PostStepDoIt",
"OpBoun02",
267 "Invalid Surface Normal - Geometry must return valid surface normal pointing in the right direction");
277 if (aMaterialPropertiesTable) {
278 Rindex = aMaterialPropertiesTable->
GetProperty(
"RINDEX");
317 if (Surface == NULL){
346 GetMaterialPropertiesTable();
348 if (aMaterialPropertiesTable) {
352 Rindex = aMaterialPropertiesTable->
GetProperty(
"RINDEX");
366 aMaterialPropertiesTable->
GetProperty(
"REFLECTIVITY");
368 aMaterialPropertiesTable->
GetProperty(
"REALRINDEX");
370 aMaterialPropertiesTable->
GetProperty(
"IMAGINARYRINDEX");
387 aMaterialPropertiesTable->
GetProperty(
"EFFICIENCY");
394 aMaterialPropertiesTable->
GetProperty(
"TRANSMITTANCE");
400 if (aMaterialPropertiesTable->
401 ConstPropertyExists(
"SURFACEROUGHNESS"))
403 GetConstProperty(
"SURFACEROUGHNESS");
407 aMaterialPropertiesTable->
GetProperty(
"SPECULARLOBECONSTANT");
416 aMaterialPropertiesTable->
GetProperty(
"SPECULARSPIKECONSTANT");
425 aMaterialPropertiesTable->
GetProperty(
"BACKSCATTERCONSTANT");
450 aMaterialPropertiesTable =
452 if (aMaterialPropertiesTable)
453 Rindex = aMaterialPropertiesTable->
GetProperty(
"RINDEX");
515 G4cerr <<
" Error: G4BoundaryProcess: illegal boundary type " <<
G4endl;
555 G4cout <<
" *** TotalInternalReflection *** " <<
G4endl;
565 G4cout <<
" *** PolishedLumirrorAirReflection *** " <<
G4endl;
567 G4cout <<
" *** PolishedLumirrorGlueReflection *** " <<
G4endl;
571 G4cout <<
" *** PolishedTeflonAirReflection *** " <<
G4endl;
573 G4cout <<
" *** PolishedTiOAirReflection *** " <<
G4endl;
575 G4cout <<
" *** PolishedTyvekAirReflection *** " <<
G4endl;
577 G4cout <<
" *** PolishedVM2000AirReflection *** " <<
G4endl;
579 G4cout <<
" *** PolishedVM2000GlueReflection *** " <<
G4endl;
581 G4cout <<
" *** EtchedLumirrorAirReflection *** " <<
G4endl;
583 G4cout <<
" *** EtchedLumirrorGlueReflection *** " <<
G4endl;
587 G4cout <<
" *** EtchedTeflonAirReflection *** " <<
G4endl;
591 G4cout <<
" *** EtchedTyvekAirReflection *** " <<
G4endl;
593 G4cout <<
" *** EtchedVM2000AirReflection *** " <<
G4endl;
595 G4cout <<
" *** EtchedVM2000GlueReflection *** " <<
G4endl;
597 G4cout <<
" *** GroundLumirrorAirReflection *** " <<
G4endl;
599 G4cout <<
" *** GroundLumirrorGlueReflection *** " <<
G4endl;
603 G4cout <<
" *** GroundTeflonAirReflection *** " <<
G4endl;
607 G4cout <<
" *** GroundTyvekAirReflection *** " <<
G4endl;
609 G4cout <<
" *** GroundVM2000AirReflection *** " <<
G4endl;
611 G4cout <<
" *** GroundVM2000GlueReflection *** " <<
G4endl;
647 if (sigma_alpha == 0.0)
return FacetNormal = Normal;
654 }
while (
G4UniformRand()*f_max > std::sin(alpha) || alpha >= halfpi );
658 G4double SinAlpha = std::sin(alpha);
659 G4double CosAlpha = std::cos(alpha);
663 G4double unit_x = SinAlpha * CosPhi;
664 G4double unit_y = SinAlpha * SinPhi;
667 FacetNormal.setX(unit_x);
668 FacetNormal.setY(unit_y);
669 FacetNormal.setZ(unit_z);
673 FacetNormal.rotateUz(tmpNormal);
674 }
while (Momentum * FacetNormal >= 0.0);
688 }
while (smear.mag()>1.0);
689 smear = (1.-polish) * smear;
690 FacetNormal = Normal + smear;
691 }
while (Momentum * FacetNormal >= 0.0);
692 FacetNormal = FacetNormal.unit();
695 FacetNormal = Normal;
765 A_trans = A_trans.unit();
770 A_paral = A_paral.unit();
795 G4int thetaIndex, phiIndex;
796 G4double AngularDistributionValue, thetaRad, phiRad, EdotN;
797 G4ThreeVector PerpendicularVectorTheta, PerpendicularVectorPhi;
822 G4int angleIncident =
G4int(std::floor(180/
pi*anglePhotonToNormal+0.5));
827 thetaIndex = G4RandFlat::shootInt(thetaIndexMax-1);
828 phiIndex = G4RandFlat::shootInt(phiIndexMax-1);
831 GetAngularDistributionValue(angleIncident,
836 thetaRad = (-90 + 4*thetaIndex)*
pi/180;
837 phiRad = (-90 + 5*phiIndex)*
pi/180;
842 PerpendicularVectorPhi =
846 PerpendicularVectorTheta =
NewMomentum.orthogonal();
847 PerpendicularVectorPhi =
852 PerpendicularVectorTheta);
868 G4double angleIncident = std::floor(180/
pi*anglePhotonToNormal+0.5);
886 ed <<
" G4OpBoundaryProcess/DielectricDichroic(): "
887 <<
" The dichroic surface has no G4Physics2DVector"
889 G4Exception(
"G4OpBoundaryProcess::DielectricDichroic",
"OpBoun03",
891 "A dichroic surface must have an associated G4Physics2DVector");
931 G4bool SurfaceRoughnessCriterionPass = 1;
934 G4double SurfaceRoughnessCriterion =
936 SurfaceRoughnessCriterionPass =
980 if (Swap) Swap = !Swap;
984 if ( !SurfaceRoughnessCriterionPass )
theStatus =
1006 else if (
sint2 < 1.0) {
1022 A_trans = A_trans.unit();
1024 E1pp = E1_perp * A_trans;
1026 E1_parl = E1pl.mag();
1040 G4double E2_total = E2_perp*E2_perp + E2_parl*E2_parl;
1046 else if (cost1 != 0.0) TransCoeff = s2/s1;
1047 else TransCoeff = 0.0;
1055 if (Swap) Swap = !Swap;
1059 if ( !SurfaceRoughnessCriterionPass )
theStatus =
1080 E2_perp = E2_perp - E1_perp;
1081 E2_total = E2_perp*E2_perp + E2_parl*E2_parl;
1083 A_paral = A_paral.unit();
1084 E2_abs = std::sqrt(E2_total);
1085 C_parl = E2_parl/E2_abs;
1086 C_perp = E2_perp/E2_abs;
1116 NewMomentum = NewMomentum.unit();
1118 A_paral = NewMomentum.cross(A_trans);
1119 A_paral = A_paral.unit();
1120 E2_abs = std::sqrt(E2_total);
1121 C_parl = E2_parl/E2_abs;
1122 C_perp = E2_perp/E2_abs;
1148 if (Inside && !Swap) {
1201 G4double magN= theFacetNormal.mag();
1202 G4double incidentangle =
pi - std::acos(PdotN/(magP*magN));
1204 return incidentangle;
1214 G4complex Reflectivity, Reflectivity_TE, Reflectivity_TM;
1215 G4complex N(RealRindex, ImaginaryRindex);
1228 CosPhi=std::sqrt(u-((std::sin(incidentangle)*std::sin(incidentangle))/(N*N)));
1230 numeratorTE = std::cos(incidentangle) - N*CosPhi;
1231 denominatorTE = std::cos(incidentangle) + N*CosPhi;
1232 rTE = numeratorTE/denominatorTE;
1234 numeratorTM = N*std::cos(incidentangle) - CosPhi;
1235 denominatorTM = N*std::cos(incidentangle) + CosPhi;
1236 rTM = numeratorTM/denominatorTM;
1243 Reflectivity_TE = (rTE*conj(rTE))*(E1_perp*E1_perp)
1244 / (E1_perp*E1_perp + E1_parl*E1_parl);
1245 Reflectivity_TM = (rTM*conj(rTM))*(E1_parl*E1_parl)
1246 / (E1_perp*E1_perp + E1_parl*E1_parl);
1247 Reflectivity = Reflectivity_TE + Reflectivity_TM;
1250 if(
G4UniformRand()*real(Reflectivity) > real(Reflectivity_TE))
1251 {
iTE = -1;}
else{
iTE = 1;}
1252 if(
G4UniformRand()*real(Reflectivity) > real(Reflectivity_TM))
1253 {
iTM = -1;}
else{
iTM = 1;}
1256 return real(Reflectivity);
1289 A_trans = A_trans.unit();
1291 E1pp = E1_perp * A_trans;
1293 E1_parl = E1pl.mag();
1312 RealRindex, ImaginaryRindex);
1322 if (sd)
return sd->
Hit(&aStep);
G4double condition(const G4ErrorSymMatrix &m)
void DielectricDielectric()
G4double theSurfaceRoughness
ThreeVector shoot(const G4int Ap, const G4int Af)
void G4SwapObj(T *a, T *b)
G4MaterialPropertyVector * GetProperty(const char *key)
G4OpticalSurfaceModel GetModel() const
G4double GetReflectivity(G4double E1_perp, G4double E1_parl, G4double incidentangle, G4double RealRindex, G4double ImaginaryRindex)
std::ostringstream G4ExceptionDescription
CLHEP::Hep3Vector G4ThreeVector
G4Physics2DVector * DichroicVector
G4double GetVelocity() const
const G4DynamicParticle * GetDynamicParticle() const
G4StepStatus GetStepStatus() const
G4Material * GetMaterial() const
G4OpticalSurface * OpticalSurface
G4double GetSurfaceTolerance() const
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
void ProposePolarization(G4double Px, G4double Py, G4double Pz)
const G4SurfaceType & GetType() const
G4OpBoundaryProcessStatus
G4OpBoundaryProcess(const G4String &processName="OpBoundary", G4ProcessType type=fOptical)
G4MaterialPropertyVector * PropertyPointer1
G4OpticalSurfaceFinish theFinish
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
static G4LogicalBorderSurface * GetSurface(const G4VPhysicalVolume *vol1, const G4VPhysicalVolume *vol2)
G4double GetTotalMomentum() const
G4ThreeVector NewPolarization
G4StepPoint * GetPreStepPoint() const
static G4int GetHypNavigatorID()
G4OpBoundaryProcessStatus theStatus
std::complex< G4double > G4complex
G4ThreeVector OldMomentum
G4GLOB_DLL std::ostream G4cout
G4double Value(G4double x, G4double y, size_t &lastidx, size_t &lastidy) const
G4double GetPolish() const
G4VPhysicalVolume * GetPhysicalVolume() const
const G4String & GetName() const
const G4ThreeVector & GetPosition() const
G4ThreeVector OldPolarization
G4int GetPhiIndexMax(void) const
G4bool G4BooleanRand(const G4double prob) const
const G4ThreeVector & GetMomentumDirection() const
G4double thePhotonMomentum
G4bool Hit(G4Step *aStep)
void SetProcessSubType(G4int)
G4double GetMeanFreePath(const G4Track &, G4double, G4ForceCondition *condition)
static const double perCent
G4double theTransmittance
void BoundaryProcessVerbose(void) const
G4LogicalVolume * GetMotherLogical() const
G4double Value(G4double theEnergy, size_t &lastidx) const
const G4String & GetProcessName() const
G4OpticalSurfaceFinish GetFinish() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4TransportationManager * GetTransportationManager()
G4OpticalSurfaceModel theModel
G4bool InvokeSD(const G4Step *step)
virtual void Initialize(const G4Track &)
G4ThreeVector NewMomentum
G4LogicalVolume * GetLogicalVolume() const
G4MaterialPropertyVector * PropertyPointer
G4Physics2DVector * GetDichroicVector()
void G4SwapPtr(T *&a, T *&b)
void DielectricDichroic()
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
G4StepPoint * GetPostStepPoint() const
void AddTotalEnergyDeposit(G4double value)
const G4ThreeVector & GetPolarization() const
G4ParticleChange aParticleChange
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4double GetIncidentAngle()
G4ThreeVector theFacetNormal
G4SurfaceProperty * GetSurfaceProperty() const
G4VSensitiveDetector * GetSensitiveDetector() const
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4MaterialPropertyVector * PropertyPointer2
G4ThreeVector theGlobalNormal
void ProposeTrackStatus(G4TrackStatus status)
G4double GetSigmaAlpha() const
static const G4double alpha
void ProposeVelocity(G4double finalVelocity)
void CalculateReflectivity(void)
G4int GetThetaIndexMax(void) const
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
G4double GetStepLength() const
static G4GeometryTolerance * GetInstance()
static const G4Step * GetHyperStep()
G4GLOB_DLL std::ostream G4cerr
G4ThreeVector GetFacetNormal(const G4ThreeVector &Momentum, const G4ThreeVector &Normal) const
static G4LogicalSkinSurface * GetSurface(const G4LogicalVolume *vol)