Import Geant4 9.3.0 source tree
This commit is contained in:
@@ -58,6 +58,11 @@
|
||||
// off a metal surface by way of a complex index
|
||||
// of refraction - Thanks to Sehwook Lee and John
|
||||
// Hauptman (Dept. of Physics - Iowa State Univ.)
|
||||
// 2009-11-10 - add capability of simulating surface reflections
|
||||
// with Look-Up-Tables (LUT) containing measured
|
||||
// optical reflectance for a variety of surface
|
||||
// treatments - Thanks to Martin Janecek and
|
||||
// William Moses (Lawrence Berkeley National Lab.)
|
||||
//
|
||||
// Author: Peter Gumplinger
|
||||
// adopted from work by Werner Keil - April 2/96
|
||||
@@ -139,12 +144,22 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
G4StepPoint* pPreStepPoint = aStep.GetPreStepPoint();
|
||||
G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
|
||||
|
||||
if ( verboseLevel > 0 ) {
|
||||
G4cout << " Photon at Boundary! " << G4endl;
|
||||
G4VPhysicalVolume* thePrePV = pPreStepPoint->GetPhysicalVolume();
|
||||
G4VPhysicalVolume* thePostPV = pPostStepPoint->GetPhysicalVolume();
|
||||
if (thePrePV) G4cout << " thePrePV: " << thePrePV->GetName() << G4endl;
|
||||
if (thePostPV) G4cout << " thePostPV: " << thePostPV->GetName() << G4endl;
|
||||
}
|
||||
|
||||
if (pPostStepPoint->GetStepStatus() != fGeomBoundary){
|
||||
theStatus = NotAtBoundary;
|
||||
if ( verboseLevel > 0) BoundaryProcessVerbose();
|
||||
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
|
||||
}
|
||||
if (aTrack.GetStepLength()<=kCarTolerance/2){
|
||||
theStatus = StepTooSmall;
|
||||
if ( verboseLevel > 0) BoundaryProcessVerbose();
|
||||
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
|
||||
}
|
||||
|
||||
@@ -157,6 +172,11 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
OldMomentum = aParticle->GetMomentumDirection();
|
||||
OldPolarization = aParticle->GetPolarization();
|
||||
|
||||
if ( verboseLevel > 0 ) {
|
||||
G4cout << " Old Momentum Direction: " << OldMomentum << G4endl;
|
||||
G4cout << " Old Polarization: " << OldPolarization << G4endl;
|
||||
}
|
||||
|
||||
G4ThreeVector theGlobalPoint = pPostStepPoint->GetPosition();
|
||||
|
||||
G4Navigator* theNavigator =
|
||||
@@ -177,8 +197,12 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
}
|
||||
else {
|
||||
G4cerr << " G4OpBoundaryProcess/PostStepDoIt(): "
|
||||
<< " The Navigator reports that it returned an invalid normal"
|
||||
<< G4endl;
|
||||
<< " The Navigator reports that it returned an invalid normal"
|
||||
<< G4endl;
|
||||
G4Exception("G4OpBoundaryProcess::PostStepDoIt",
|
||||
"Invalid Surface Normal",
|
||||
EventMustBeAborted,
|
||||
"Geometry must return valid surface normal");
|
||||
}
|
||||
|
||||
theGlobalNormal = theNavigator->GetLocalToGlobalTransform().
|
||||
@@ -202,6 +226,7 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
}
|
||||
else {
|
||||
theStatus = NoRINDEX;
|
||||
if ( verboseLevel > 0) BoundaryProcessVerbose();
|
||||
aParticleChange.ProposeTrackStatus(fStopAndKill);
|
||||
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
|
||||
}
|
||||
@@ -211,10 +236,14 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
}
|
||||
else {
|
||||
theStatus = NoRINDEX;
|
||||
if ( verboseLevel > 0) BoundaryProcessVerbose();
|
||||
aParticleChange.ProposeTrackStatus(fStopAndKill);
|
||||
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
|
||||
}
|
||||
|
||||
theReflectivity = 1.;
|
||||
theEfficiency = 0.;
|
||||
|
||||
theModel = glisur;
|
||||
theFinish = polished;
|
||||
|
||||
@@ -276,15 +305,12 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
}
|
||||
else {
|
||||
theStatus = NoRINDEX;
|
||||
if ( verboseLevel > 0) BoundaryProcessVerbose();
|
||||
aParticleChange.ProposeTrackStatus(fStopAndKill);
|
||||
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
|
||||
}
|
||||
}
|
||||
|
||||
G4MaterialPropertyVector* PropertyPointer;
|
||||
G4MaterialPropertyVector* PropertyPointer1;
|
||||
G4MaterialPropertyVector* PropertyPointer2;
|
||||
|
||||
PropertyPointer =
|
||||
aMaterialPropertiesTable->GetProperty("REFLECTIVITY");
|
||||
PropertyPointer1 =
|
||||
@@ -302,60 +328,8 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
|
||||
} else if (PropertyPointer1 && PropertyPointer2) {
|
||||
|
||||
G4double RealRindex =
|
||||
PropertyPointer1->GetProperty(thePhotonMomentum);
|
||||
G4double ImaginaryRindex =
|
||||
PropertyPointer2->GetProperty(thePhotonMomentum);
|
||||
CalculateReflectivity();
|
||||
|
||||
// calculate FacetNormal
|
||||
if ( theFinish == ground ) {
|
||||
theFacetNormal =
|
||||
GetFacetNormal(OldMomentum, theGlobalNormal);
|
||||
} else {
|
||||
theFacetNormal = theGlobalNormal;
|
||||
}
|
||||
|
||||
G4double PdotN = OldMomentum * theFacetNormal;
|
||||
cost1 = -PdotN;
|
||||
|
||||
if (std::abs(cost1) < 1.0 - kCarTolerance) {
|
||||
sint1 = std::sqrt(1. - cost1*cost1);
|
||||
} else {
|
||||
sint1 = 0.0;
|
||||
}
|
||||
|
||||
G4ThreeVector A_trans, A_paral, E1pp, E1pl;
|
||||
G4double E1_perp, E1_parl;
|
||||
|
||||
if (sint1 > 0.0 ) {
|
||||
A_trans = OldMomentum.cross(theFacetNormal);
|
||||
A_trans = A_trans.unit();
|
||||
E1_perp = OldPolarization * A_trans;
|
||||
E1pp = E1_perp * A_trans;
|
||||
E1pl = OldPolarization - E1pp;
|
||||
E1_parl = E1pl.mag();
|
||||
}
|
||||
else {
|
||||
A_trans = OldPolarization;
|
||||
// Here we Follow Jackson's conventions and we set the
|
||||
// parallel component = 1 in case of a ray perpendicular
|
||||
// to the surface
|
||||
E1_perp = 0.0;
|
||||
E1_parl = 1.0;
|
||||
}
|
||||
|
||||
//calculate incident angle
|
||||
G4double incidentangle = GetIncidentAngle();
|
||||
|
||||
//calculate the reflectivity depending on incident angle,
|
||||
//polarization and complex refractive
|
||||
|
||||
theReflectivity =
|
||||
GetReflectivity(E1_perp, E1_parl, incidentangle,
|
||||
RealRindex, ImaginaryRindex);
|
||||
|
||||
} else {
|
||||
theReflectivity = 1.0;
|
||||
}
|
||||
|
||||
PropertyPointer =
|
||||
@@ -363,8 +337,6 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
if (PropertyPointer) {
|
||||
theEfficiency =
|
||||
PropertyPointer->GetProperty(thePhotonMomentum);
|
||||
} else {
|
||||
theEfficiency = 0.0;
|
||||
}
|
||||
|
||||
if ( theModel == unified ) {
|
||||
@@ -408,6 +380,7 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
|
||||
if (Material1 == Material2){
|
||||
theStatus = SameMaterial;
|
||||
if ( verboseLevel > 0) BoundaryProcessVerbose();
|
||||
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
|
||||
}
|
||||
aMaterialPropertiesTable =
|
||||
@@ -419,18 +392,13 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
}
|
||||
else {
|
||||
theStatus = NoRINDEX;
|
||||
if ( verboseLevel > 0) BoundaryProcessVerbose();
|
||||
aParticleChange.ProposeTrackStatus(fStopAndKill);
|
||||
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( verboseLevel > 0 ) {
|
||||
G4cout << " Photon at Boundary! " << G4endl;
|
||||
G4cout << " Old Momentum Direction: " << OldMomentum << G4endl;
|
||||
G4cout << " Old Polarization: " << OldPolarization << G4endl;
|
||||
}
|
||||
|
||||
if (type == dielectric_metal) {
|
||||
|
||||
DielectricMetal();
|
||||
@@ -442,11 +410,15 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
// }
|
||||
|
||||
}
|
||||
else if (type == dielectric_LUT) {
|
||||
|
||||
DielectricLUT();
|
||||
|
||||
}
|
||||
else if (type == dielectric_dielectric) {
|
||||
|
||||
if ( theFinish == polishedfrontpainted ||
|
||||
theFinish == groundfrontpainted ) {
|
||||
|
||||
if( !G4BooleanRand(theReflectivity) ) {
|
||||
DoAbsorption();
|
||||
}
|
||||
@@ -457,7 +429,12 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
}
|
||||
}
|
||||
else {
|
||||
DielectricDielectric();
|
||||
if( !G4BooleanRand(theReflectivity) ) {
|
||||
DoAbsorption();
|
||||
}
|
||||
else {
|
||||
DielectricDielectric();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -471,36 +448,9 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
NewPolarization = NewPolarization.unit();
|
||||
|
||||
if ( verboseLevel > 0) {
|
||||
G4cout << " New Momentum Direction: " << NewMomentum << G4endl;
|
||||
G4cout << " New Polarization: " << NewPolarization << G4endl;
|
||||
if ( theStatus == Undefined )
|
||||
G4cout << " *** Undefined *** " << G4endl;
|
||||
if ( theStatus == FresnelRefraction )
|
||||
G4cout << " *** FresnelRefraction *** " << G4endl;
|
||||
if ( theStatus == FresnelReflection )
|
||||
G4cout << " *** FresnelReflection *** " << G4endl;
|
||||
if ( theStatus == TotalInternalReflection )
|
||||
G4cout << " *** TotalInternalReflection *** " << G4endl;
|
||||
if ( theStatus == LambertianReflection )
|
||||
G4cout << " *** LambertianReflection *** " << G4endl;
|
||||
if ( theStatus == LobeReflection )
|
||||
G4cout << " *** LobeReflection *** " << G4endl;
|
||||
if ( theStatus == SpikeReflection )
|
||||
G4cout << " *** SpikeReflection *** " << G4endl;
|
||||
if ( theStatus == BackScattering )
|
||||
G4cout << " *** BackScattering *** " << G4endl;
|
||||
if ( theStatus == Absorption )
|
||||
G4cout << " *** Absorption *** " << G4endl;
|
||||
if ( theStatus == Detection )
|
||||
G4cout << " *** Detection *** " << G4endl;
|
||||
if ( theStatus == NotAtBoundary )
|
||||
G4cout << " *** NotAtBoundary *** " << G4endl;
|
||||
if ( theStatus == SameMaterial )
|
||||
G4cout << " *** SameMaterial *** " << G4endl;
|
||||
if ( theStatus == StepTooSmall )
|
||||
G4cout << " *** StepTooSmall *** " << G4endl;
|
||||
if ( theStatus == NoRINDEX )
|
||||
G4cout << " *** NoRINDEX *** " << G4endl;
|
||||
G4cout << " New Momentum Direction: " << NewMomentum << G4endl;
|
||||
G4cout << " New Polarization: " << NewPolarization << G4endl;
|
||||
BoundaryProcessVerbose();
|
||||
}
|
||||
|
||||
aParticleChange.ProposeMomentumDirection(NewMomentum);
|
||||
@@ -509,13 +459,93 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
|
||||
}
|
||||
|
||||
void G4OpBoundaryProcess::BoundaryProcessVerbose() const
|
||||
{
|
||||
if ( theStatus == Undefined )
|
||||
G4cout << " *** Undefined *** " << G4endl;
|
||||
if ( theStatus == FresnelRefraction )
|
||||
G4cout << " *** FresnelRefraction *** " << G4endl;
|
||||
if ( theStatus == FresnelReflection )
|
||||
G4cout << " *** FresnelReflection *** " << G4endl;
|
||||
if ( theStatus == TotalInternalReflection )
|
||||
G4cout << " *** TotalInternalReflection *** " << G4endl;
|
||||
if ( theStatus == LambertianReflection )
|
||||
G4cout << " *** LambertianReflection *** " << G4endl;
|
||||
if ( theStatus == LobeReflection )
|
||||
G4cout << " *** LobeReflection *** " << G4endl;
|
||||
if ( theStatus == SpikeReflection )
|
||||
G4cout << " *** SpikeReflection *** " << G4endl;
|
||||
if ( theStatus == BackScattering )
|
||||
G4cout << " *** BackScattering *** " << G4endl;
|
||||
if ( theStatus == PolishedLumirrorAirReflection )
|
||||
G4cout << " *** PolishedLumirrorAirReflection *** " << G4endl;
|
||||
if ( theStatus == PolishedLumirrorGlueReflection )
|
||||
G4cout << " *** PolishedLumirrorGlueReflection *** " << G4endl;
|
||||
if ( theStatus == PolishedAirReflection )
|
||||
G4cout << " *** PolishedAirReflection *** " << G4endl;
|
||||
if ( theStatus == PolishedTeflonAirReflection )
|
||||
G4cout << " *** PolishedTeflonAirReflection *** " << G4endl;
|
||||
if ( theStatus == PolishedTiOAirReflection )
|
||||
G4cout << " *** PolishedTiOAirReflection *** " << G4endl;
|
||||
if ( theStatus == PolishedTyvekAirReflection )
|
||||
G4cout << " *** PolishedTyvekAirReflection *** " << G4endl;
|
||||
if ( theStatus == PolishedVM2000AirReflection )
|
||||
G4cout << " *** PolishedVM2000AirReflection *** " << G4endl;
|
||||
if ( theStatus == PolishedVM2000GlueReflection )
|
||||
G4cout << " *** PolishedVM2000GlueReflection *** " << G4endl;
|
||||
if ( theStatus == EtchedLumirrorAirReflection )
|
||||
G4cout << " *** EtchedLumirrorAirReflection *** " << G4endl;
|
||||
if ( theStatus == EtchedLumirrorGlueReflection )
|
||||
G4cout << " *** EtchedLumirrorGlueReflection *** " << G4endl;
|
||||
if ( theStatus == EtchedAirReflection )
|
||||
G4cout << " *** EtchedAirReflection *** " << G4endl;
|
||||
if ( theStatus == EtchedTeflonAirReflection )
|
||||
G4cout << " *** EtchedTeflonAirReflection *** " << G4endl;
|
||||
if ( theStatus == EtchedTiOAirReflection )
|
||||
G4cout << " *** EtchedTiOAirReflection *** " << G4endl;
|
||||
if ( theStatus == EtchedTyvekAirReflection )
|
||||
G4cout << " *** EtchedTyvekAirReflection *** " << G4endl;
|
||||
if ( theStatus == EtchedVM2000AirReflection )
|
||||
G4cout << " *** EtchedVM2000AirReflection *** " << G4endl;
|
||||
if ( theStatus == EtchedVM2000GlueReflection )
|
||||
G4cout << " *** EtchedVM2000GlueReflection *** " << G4endl;
|
||||
if ( theStatus == GroundLumirrorAirReflection )
|
||||
G4cout << " *** GroundLumirrorAirReflection *** " << G4endl;
|
||||
if ( theStatus == GroundLumirrorGlueReflection )
|
||||
G4cout << " *** GroundLumirrorGlueReflection *** " << G4endl;
|
||||
if ( theStatus == GroundAirReflection )
|
||||
G4cout << " *** GroundAirReflection *** " << G4endl;
|
||||
if ( theStatus == GroundTeflonAirReflection )
|
||||
G4cout << " *** GroundTeflonAirReflection *** " << G4endl;
|
||||
if ( theStatus == GroundTiOAirReflection )
|
||||
G4cout << " *** GroundTiOAirReflection *** " << G4endl;
|
||||
if ( theStatus == GroundTyvekAirReflection )
|
||||
G4cout << " *** GroundTyvekAirReflection *** " << G4endl;
|
||||
if ( theStatus == GroundVM2000AirReflection )
|
||||
G4cout << " *** GroundVM2000AirReflection *** " << G4endl;
|
||||
if ( theStatus == GroundVM2000GlueReflection )
|
||||
G4cout << " *** GroundVM2000GlueReflection *** " << G4endl;
|
||||
if ( theStatus == Absorption )
|
||||
G4cout << " *** Absorption *** " << G4endl;
|
||||
if ( theStatus == Detection )
|
||||
G4cout << " *** Detection *** " << G4endl;
|
||||
if ( theStatus == NotAtBoundary )
|
||||
G4cout << " *** NotAtBoundary *** " << G4endl;
|
||||
if ( theStatus == SameMaterial )
|
||||
G4cout << " *** SameMaterial *** " << G4endl;
|
||||
if ( theStatus == StepTooSmall )
|
||||
G4cout << " *** StepTooSmall *** " << G4endl;
|
||||
if ( theStatus == NoRINDEX )
|
||||
G4cout << " *** NoRINDEX *** " << G4endl;
|
||||
}
|
||||
|
||||
G4ThreeVector
|
||||
G4OpBoundaryProcess::GetFacetNormal(const G4ThreeVector& Momentum,
|
||||
const G4ThreeVector& Normal ) const
|
||||
{
|
||||
G4ThreeVector FacetNormal;
|
||||
|
||||
if (theModel == unified) {
|
||||
if (theModel == unified || theModel == LUT) {
|
||||
|
||||
/* This function code alpha to a random value taken from the
|
||||
distribution p(alpha) = g(alpha; 0, sigma_alpha)*std::sin(alpha),
|
||||
@@ -590,16 +620,26 @@ void G4OpBoundaryProcess::DielectricMetal()
|
||||
|
||||
if( !G4BooleanRand(theReflectivity) && n == 1 ) {
|
||||
|
||||
// Comment out DoAbsorption if you wish to have
|
||||
// Transmission instead of Absorption
|
||||
// Comment out DoAbsorption and uncomment theStatus = Absorption;
|
||||
// if you wish to have Transmission instead of Absorption
|
||||
|
||||
DoAbsorption();
|
||||
theStatus = Absorption;
|
||||
// theStatus = Absorption;
|
||||
break;
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
if (PropertyPointer1 && PropertyPointer2) {
|
||||
if ( n > 1 ) {
|
||||
CalculateReflectivity();
|
||||
if ( !G4BooleanRand(theReflectivity) ) {
|
||||
DoAbsorption();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( theModel == glisur || theFinish == polished ) {
|
||||
|
||||
DoReflection();
|
||||
@@ -617,8 +657,13 @@ void G4OpBoundaryProcess::DielectricMetal()
|
||||
}
|
||||
else {
|
||||
|
||||
if(theStatus==LobeReflection)theFacetNormal =
|
||||
GetFacetNormal(OldMomentum,theGlobalNormal);
|
||||
if(theStatus==LobeReflection){
|
||||
if ( PropertyPointer1 && PropertyPointer2 ){
|
||||
} else {
|
||||
theFacetNormal =
|
||||
GetFacetNormal(OldMomentum,theGlobalNormal);
|
||||
}
|
||||
}
|
||||
|
||||
G4double PdotN = OldMomentum * theFacetNormal;
|
||||
NewMomentum = OldMomentum - (2.*PdotN)*theFacetNormal;
|
||||
@@ -656,6 +701,66 @@ void G4OpBoundaryProcess::DielectricMetal()
|
||||
} while (NewMomentum * theGlobalNormal < 0.0);
|
||||
}
|
||||
|
||||
void G4OpBoundaryProcess::DielectricLUT()
|
||||
{
|
||||
G4int thetaIndex, phiIndex;
|
||||
G4double AngularDistributionValue, thetaRad, phiRad, EdotN;
|
||||
G4ThreeVector PerpendicularVectorTheta, PerpendicularVectorPhi;
|
||||
|
||||
theStatus = G4OpBoundaryProcessStatus(G4int(theFinish) +
|
||||
(G4int(NoRINDEX)-G4int(groundbackpainted)));
|
||||
|
||||
G4int thetaIndexMax = OpticalSurface->GetThetaIndexMax();
|
||||
G4int phiIndexMax = OpticalSurface->GetPhiIndexMax();
|
||||
|
||||
do {
|
||||
if ( !G4BooleanRand(theReflectivity) ) // Not reflected, so Absorbed
|
||||
DoAbsorption();
|
||||
else {
|
||||
// Calculate Angle between Normal and Photon Momentum
|
||||
G4double anglePhotonToNormal =
|
||||
OldMomentum.angle(-theGlobalNormal);
|
||||
// Round it to closest integer
|
||||
G4int angleIncident = G4int(std::floor(180/pi*anglePhotonToNormal+0.5));
|
||||
|
||||
// Take random angles THETA and PHI,
|
||||
// and see if below Probability - if not - Redo
|
||||
do {
|
||||
thetaIndex = CLHEP::RandFlat::shootInt(thetaIndexMax-1);
|
||||
phiIndex = CLHEP::RandFlat::shootInt(phiIndexMax-1);
|
||||
// Find probability with the new indeces from LUT
|
||||
AngularDistributionValue = OpticalSurface ->
|
||||
GetAngularDistributionValue(angleIncident,
|
||||
thetaIndex,
|
||||
phiIndex);
|
||||
} while ( !G4BooleanRand(AngularDistributionValue) );
|
||||
|
||||
thetaRad = (-90 + 4*thetaIndex)*pi/180;
|
||||
phiRad = (-90 + 5*phiIndex)*pi/180;
|
||||
// Rotate Photon Momentum in Theta, then in Phi
|
||||
NewMomentum = -OldMomentum;
|
||||
PerpendicularVectorTheta = NewMomentum.cross(theGlobalNormal);
|
||||
if (PerpendicularVectorTheta.mag() > kCarTolerance ) {
|
||||
PerpendicularVectorPhi =
|
||||
PerpendicularVectorTheta.cross(NewMomentum);
|
||||
}
|
||||
else {
|
||||
PerpendicularVectorTheta = NewMomentum.orthogonal();
|
||||
PerpendicularVectorPhi =
|
||||
PerpendicularVectorTheta.cross(NewMomentum);
|
||||
}
|
||||
NewMomentum =
|
||||
NewMomentum.rotate(anglePhotonToNormal-thetaRad,
|
||||
PerpendicularVectorTheta);
|
||||
NewMomentum = NewMomentum.rotate(-phiRad,PerpendicularVectorPhi);
|
||||
// Rotate Polarization too:
|
||||
theFacetNormal = (NewMomentum - OldMomentum).unit();
|
||||
EdotN = OldPolarization * theFacetNormal;
|
||||
NewPolarization = -OldPolarization + (2.*EdotN)*theFacetNormal;
|
||||
}
|
||||
} while (NewMomentum * theGlobalNormal <= 0.0);
|
||||
}
|
||||
|
||||
void G4OpBoundaryProcess::DielectricDielectric()
|
||||
{
|
||||
G4bool Inside = false;
|
||||
@@ -961,10 +1066,67 @@ G4double G4OpBoundaryProcess::GetReflectivity(G4double E1_perp,
|
||||
Reflectivity = Reflectivity_TE + Reflectivity_TM;
|
||||
|
||||
do {
|
||||
if(G4UniformRand()*real(Reflectivity) > real(Reflectivity_TE))iTE = -1;
|
||||
if(G4UniformRand()*real(Reflectivity) > real(Reflectivity_TM))iTM = -1;
|
||||
if(G4UniformRand()*real(Reflectivity) > real(Reflectivity_TE))
|
||||
{iTE = -1;}else{iTE = 1;}
|
||||
if(G4UniformRand()*real(Reflectivity) > real(Reflectivity_TM))
|
||||
{iTM = -1;}else{iTM = 1;}
|
||||
} while(iTE<0&&iTM<0);
|
||||
|
||||
return real(Reflectivity);
|
||||
|
||||
}
|
||||
|
||||
void G4OpBoundaryProcess::CalculateReflectivity()
|
||||
{
|
||||
G4double RealRindex =
|
||||
PropertyPointer1->GetProperty(thePhotonMomentum);
|
||||
G4double ImaginaryRindex =
|
||||
PropertyPointer2->GetProperty(thePhotonMomentum);
|
||||
|
||||
// calculate FacetNormal
|
||||
if ( theFinish == ground ) {
|
||||
theFacetNormal =
|
||||
GetFacetNormal(OldMomentum, theGlobalNormal);
|
||||
} else {
|
||||
theFacetNormal = theGlobalNormal;
|
||||
}
|
||||
|
||||
G4double PdotN = OldMomentum * theFacetNormal;
|
||||
cost1 = -PdotN;
|
||||
|
||||
if (std::abs(cost1) < 1.0 - kCarTolerance) {
|
||||
sint1 = std::sqrt(1. - cost1*cost1);
|
||||
} else {
|
||||
sint1 = 0.0;
|
||||
}
|
||||
|
||||
G4ThreeVector A_trans, A_paral, E1pp, E1pl;
|
||||
G4double E1_perp, E1_parl;
|
||||
|
||||
if (sint1 > 0.0 ) {
|
||||
A_trans = OldMomentum.cross(theFacetNormal);
|
||||
A_trans = A_trans.unit();
|
||||
E1_perp = OldPolarization * A_trans;
|
||||
E1pp = E1_perp * A_trans;
|
||||
E1pl = OldPolarization - E1pp;
|
||||
E1_parl = E1pl.mag();
|
||||
}
|
||||
else {
|
||||
A_trans = OldPolarization;
|
||||
// Here we Follow Jackson's conventions and we set the
|
||||
// parallel component = 1 in case of a ray perpendicular
|
||||
// to the surface
|
||||
E1_perp = 0.0;
|
||||
E1_parl = 1.0;
|
||||
}
|
||||
|
||||
//calculate incident angle
|
||||
G4double incidentangle = GetIncidentAngle();
|
||||
|
||||
//calculate the reflectivity depending on incident angle,
|
||||
//polarization and complex refractive
|
||||
|
||||
theReflectivity =
|
||||
GetReflectivity(E1_perp, E1_parl, incidentangle,
|
||||
RealRindex, ImaginaryRindex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user