177 const G4Step* pStep = &aStep;
181 if (hStep) pStep = hStep;
232 std::vector<G4Navigator*>::iterator iNav =
234 GetActiveNavigatorsIterator();
236 (iNav[hNavId])->GetGlobalExitNormal(theGlobalPoint,&valid);
244 ed <<
" G4OpBoundaryProcess/PostStepDoIt(): "
245 <<
" The Navigator reports that it returned an invalid normal"
247 G4Exception(
"G4OpBoundaryProcess::PostStepDoIt",
"OpBoun01",
249 "Invalid Surface Normal - Geometry must return valid surface normal");
253 #ifdef G4OPTICAL_DEBUG
255 ed <<
" G4OpBoundaryProcess/PostStepDoIt(): "
256 <<
" theGlobalNormal points in a wrong direction. "
258 ed <<
" The momentum of the photon arriving at interface (oldMomentum)"
259 <<
" must exit the volume cross in the step. " <<
G4endl;
260 ed <<
" So it MUST have dot < 0 with the normal that Exits the new volume (globalNormal)." <<
G4endl;
265 G4Exception(
"G4OpBoundaryProcess::PostStepDoIt",
"OpBoun02",
268 "Invalid Surface Normal - Geometry must return valid surface normal pointing in the right direction");
278 if (aMaterialPropertiesTable) {
279 Rindex = aMaterialPropertiesTable->
GetProperty(
"RINDEX");
318 if (Surface == NULL){
347 GetMaterialPropertiesTable();
349 if (aMaterialPropertiesTable) {
353 Rindex = aMaterialPropertiesTable->
GetProperty(
"RINDEX");
367 aMaterialPropertiesTable->
GetProperty(
"REFLECTIVITY");
369 aMaterialPropertiesTable->
GetProperty(
"REALRINDEX");
371 aMaterialPropertiesTable->
GetProperty(
"IMAGINARYRINDEX");
388 aMaterialPropertiesTable->
GetProperty(
"EFFICIENCY");
395 aMaterialPropertiesTable->
GetProperty(
"TRANSMITTANCE");
401 if (aMaterialPropertiesTable->
402 ConstPropertyExists(
"SURFACEROUGHNESS"))
404 GetConstProperty(
"SURFACEROUGHNESS");
408 aMaterialPropertiesTable->
GetProperty(
"SPECULARLOBECONSTANT");
417 aMaterialPropertiesTable->
GetProperty(
"SPECULARSPIKECONSTANT");
426 aMaterialPropertiesTable->
GetProperty(
"BACKSCATTERCONSTANT");
451 aMaterialPropertiesTable =
453 if (aMaterialPropertiesTable)
454 Rindex = aMaterialPropertiesTable->
GetProperty(
"RINDEX");
516 G4cerr <<
" Error: G4BoundaryProcess: illegal boundary type " <<
G4endl;
556 G4cout <<
" *** TotalInternalReflection *** " <<
G4endl;
566 G4cout <<
" *** PolishedLumirrorAirReflection *** " <<
G4endl;
568 G4cout <<
" *** PolishedLumirrorGlueReflection *** " <<
G4endl;
572 G4cout <<
" *** PolishedTeflonAirReflection *** " <<
G4endl;
574 G4cout <<
" *** PolishedTiOAirReflection *** " <<
G4endl;
576 G4cout <<
" *** PolishedTyvekAirReflection *** " <<
G4endl;
578 G4cout <<
" *** PolishedVM2000AirReflection *** " <<
G4endl;
580 G4cout <<
" *** PolishedVM2000GlueReflection *** " <<
G4endl;
582 G4cout <<
" *** EtchedLumirrorAirReflection *** " <<
G4endl;
584 G4cout <<
" *** EtchedLumirrorGlueReflection *** " <<
G4endl;
588 G4cout <<
" *** EtchedTeflonAirReflection *** " <<
G4endl;
592 G4cout <<
" *** EtchedTyvekAirReflection *** " <<
G4endl;
594 G4cout <<
" *** EtchedVM2000AirReflection *** " <<
G4endl;
596 G4cout <<
" *** EtchedVM2000GlueReflection *** " <<
G4endl;
598 G4cout <<
" *** GroundLumirrorAirReflection *** " <<
G4endl;
600 G4cout <<
" *** GroundLumirrorGlueReflection *** " <<
G4endl;
604 G4cout <<
" *** GroundTeflonAirReflection *** " <<
G4endl;
608 G4cout <<
" *** GroundTyvekAirReflection *** " <<
G4endl;
610 G4cout <<
" *** GroundVM2000AirReflection *** " <<
G4endl;
612 G4cout <<
" *** GroundVM2000GlueReflection *** " <<
G4endl;
648 if (sigma_alpha == 0.0)
return FacetNormal = Normal;
652 G4double phi, SinAlpha, CosAlpha, SinPhi, CosPhi, unit_x, unit_y, unit_z;
663 SinAlpha = std::sin(alpha);
664 CosAlpha = std::cos(alpha);
665 SinPhi = std::sin(phi);
666 CosPhi = std::cos(phi);
668 unit_x = SinAlpha * CosPhi;
669 unit_y = SinAlpha * SinPhi;
672 FacetNormal.setX(unit_x);
673 FacetNormal.setY(unit_y);
674 FacetNormal.setZ(unit_z);
678 FacetNormal.rotateUz(tmpNormal);
680 }
while (Momentum * FacetNormal >= 0.0);
695 }
while (smear.mag()>1.0);
696 smear = (1.-polish) * smear;
697 FacetNormal = Normal + smear;
699 }
while (Momentum * FacetNormal >= 0.0);
700 FacetNormal = FacetNormal.unit();
703 FacetNormal = Normal;
773 A_trans = A_trans.unit();
778 A_paral = A_paral.unit();
804 G4int thetaIndex, phiIndex;
805 G4double AngularDistributionValue, thetaRad, phiRad, EdotN;
806 G4ThreeVector PerpendicularVectorTheta, PerpendicularVectorPhi;
833 G4int angleIncident =
G4int(std::floor(180/
pi*anglePhotonToNormal+0.5));
838 thetaIndex = G4RandFlat::shootInt(thetaIndexMax-1);
839 phiIndex = G4RandFlat::shootInt(phiIndexMax-1);
842 GetAngularDistributionValue(angleIncident,
848 thetaRad = (-90 + 4*thetaIndex)*
pi/180;
849 phiRad = (-90 + 5*phiIndex)*
pi/180;
854 PerpendicularVectorPhi =
858 PerpendicularVectorTheta =
NewMomentum.orthogonal();
859 PerpendicularVectorPhi =
864 PerpendicularVectorTheta);
881 G4double angleIncident = std::floor(180/
pi*anglePhotonToNormal+0.5);
899 ed <<
" G4OpBoundaryProcess/DielectricDichroic(): "
900 <<
" The dichroic surface has no G4Physics2DVector"
902 G4Exception(
"G4OpBoundaryProcess::DielectricDichroic",
"OpBoun03",
904 "A dichroic surface must have an associated G4Physics2DVector");
946 G4bool SurfaceRoughnessCriterionPass = 1;
949 G4double SurfaceRoughnessCriterion =
951 SurfaceRoughnessCriterionPass =
964 G4double s1, s2, E2_perp, E2_parl, E2_total, TransCoeff;
1003 if (Swap) Swap = !Swap;
1007 if ( !SurfaceRoughnessCriterionPass )
theStatus =
1029 else if (
sint2 < 1.0) {
1042 A_trans = A_trans.unit();
1044 E1pp = E1_perp * A_trans;
1046 E1_parl = E1pl.mag();
1060 E2_total = E2_perp*E2_perp + E2_parl*E2_parl;
1064 else if (cost1 != 0.0) TransCoeff = s2/s1;
1065 else TransCoeff = 0.0;
1071 if (Swap) Swap = !Swap;
1075 if ( !SurfaceRoughnessCriterionPass )
theStatus =
1096 E2_perp = E2_perp - E1_perp;
1097 E2_total = E2_perp*E2_perp + E2_parl*E2_parl;
1099 A_paral = A_paral.unit();
1100 E2_abs = std::sqrt(E2_total);
1101 C_parl = E2_parl/E2_abs;
1102 C_perp = E2_perp/E2_abs;
1132 NewMomentum = NewMomentum.unit();
1134 A_paral = NewMomentum.cross(A_trans);
1135 A_paral = A_paral.unit();
1136 E2_abs = std::sqrt(E2_total);
1137 C_parl = E2_parl/E2_abs;
1138 C_perp = E2_perp/E2_abs;
1165 if (Inside && !Swap) {
1218 G4double magN= theFacetNormal.mag();
1219 G4double incidentangle =
pi - std::acos(PdotN/(magP*magN));
1221 return incidentangle;
1230 G4complex Reflectivity, Reflectivity_TE, Reflectivity_TM;
1244 aMaterialPropertiesTable->
GetProperty(
"REALRINDEX");
1246 aMaterialPropertiesTable->
GetProperty(
"IMAGINARYRINDEX");
1247 if (aPropertyPointerR && aPropertyPointerI) {
1256 CosPhi=std::sqrt(u-((std::sin(incidentangle)*std::sin(incidentangle))*(N1*N1)/(N2*N2)));
1258 numeratorTE = N1*std::cos(incidentangle) - N2*CosPhi;
1259 denominatorTE = N1*std::cos(incidentangle) + N2*CosPhi;
1260 rTE = numeratorTE/denominatorTE;
1262 numeratorTM = N2*std::cos(incidentangle) - N1*CosPhi;
1263 denominatorTM = N2*std::cos(incidentangle) + N1*CosPhi;
1264 rTM = numeratorTM/denominatorTM;
1271 Reflectivity_TE = (rTE*conj(rTE))*(E1_perp*E1_perp)
1272 / (E1_perp*E1_perp + E1_parl*E1_parl);
1273 Reflectivity_TM = (rTM*conj(rTM))*(E1_parl*E1_parl)
1274 / (E1_perp*E1_perp + E1_parl*E1_parl);
1275 Reflectivity = Reflectivity_TE + Reflectivity_TM;
1278 if(
G4UniformRand()*real(Reflectivity) > real(Reflectivity_TE))
1279 {
iTE = -1;}
else{
iTE = 1;}
1280 if(
G4UniformRand()*real(Reflectivity) > real(Reflectivity_TM))
1281 {
iTM = -1;}
else{
iTM = 1;}
1285 return real(Reflectivity);
1318 A_trans = A_trans.unit();
1320 E1pp = E1_perp * A_trans;
1322 E1_parl = E1pl.mag();
1341 RealRindex, ImaginaryRindex);
1351 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)
static const double halfpi
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
static const double twopi
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)