120 const G4Step* pStep = &aStep;
124 if (hStep) pStep = hStep;
145 GetMaterialPropertiesTable();
147 GetMaterialPropertiesTable();
154 G4cout <<
" vol1: " << volnam1 <<
", vol2: " << volnam2 <<
G4endl;
174 std::vector<G4Navigator*>::iterator iNav =
176 GetActiveNavigatorsIterator();
179 (iNav[hNavId])->GetGlobalExitNormal(theGlobalPoint,&valid);
182 theGlobalNormal = -theGlobalNormal;
187 ed <<
" G4UCNBoundaryProcess/PostStepDoIt(): "
188 <<
" The Navigator reports that it returned an invalid normal"
190 G4Exception(
"G4UCNBoundaryProcess::PostStepDoIt",
"UCNBoun01",
192 "Invalid Surface Normal - Geometry must return valid surface normal");
199 if (OldMomentum * theGlobalNormal > 0.0) {
200 #ifdef G4OPTICAL_DEBUG
202 ed <<
" G4UCNBoundaryProcess/PostStepDoIt(): "
203 <<
" theGlobalNormal points in a wrong direction. "
205 ed <<
" The momentum of the photon arriving at interface (oldMomentum)"
206 <<
" must exit the volume cross in the step. " <<
G4endl;
207 ed <<
" So it MUST have dot < 0 with the normal that Exits the new volume (globalNormal)." <<
G4endl;
208 ed <<
" >> The dot product of oldMomentum and global Normal is " << OldMomentum*theGlobalNormal <<
G4endl;
209 ed <<
" Old Momentum (during step) = " << OldMomentum <<
G4endl;
210 ed <<
" Global Normal (Exiting New Vol) = " << theGlobalNormal <<
G4endl;
212 G4Exception(
"G4UCNBoundaryProcess::PostStepDoIt",
"UCNBoun02",
215 "Invalid Surface Normal - Geometry must return valid surface normal pointing in the right direction");
217 theGlobalNormal = -theGlobalNormal;
223 G4double theMomentumNormal = theNeutronMomentum*theGlobalNormal;
225 (OldMomentum * theGlobalNormal);
246 G4double FermiPotDiff = FermiPot2 - FermiPot1;
249 G4cout <<
"UCNBoundaryProcess: new FermiPot: " << FermiPot2/
neV
250 <<
"neV, old FermiPot:" << FermiPot1/
neV <<
"neV" <<
G4endl;
279 theta_i = OldMomentum.
angle(-theGlobalNormal);
284 ConditionsValid(Energy, FermiPotDiff, theta_i)) {
304 GetMRIntProbability(theta_i, Energy);
309 GetMRIntTransProbability(theta_i, Energy);
313 G4cout <<
"Energy: " << Energy/
neV <<
"neV"
314 <<
", Enormal: " << Enormal/
neV <<
"neV" <<
G4endl;
316 G4cout <<
"Reflection_prob: " << MRpDiffuse
317 <<
", Transmission_prob: " << MRpDiffuseTrans <<
G4endl;
321 if (!
High(Enormal, FermiPotDiff)) {
329 if (
Loss(pUpScatter, theVelocityNormal, FermiPotDiff)) {
360 NewMomentum =
MRreflect(MRpDiffuse, OldMomentum, theGlobalNormal,
361 Energy, FermiPotDiff);
366 NewMomentum =
Reflect(pDiffuse, OldMomentum, theGlobalNormal);
390 theGlobalNormal, Energy, FermiPotDiff, Enew);
408 << reflectivity <<
G4endl;
414 NewMomentum =
Reflect(pDiffuse, OldMomentum, theGlobalNormal);
426 G4double mass = -std::sqrt(theMomentumNormal*theMomentumNormal -
432 theNeutronMomentum - (theMomentumNormal-mass)*theGlobalNormal;
444 G4cout <<
"Energy: " << Energy/
neV <<
"neV, Enormal: "
445 << Enormal/
neV <<
"neV, fpdiff " << FermiPotDiff/
neV
446 <<
"neV, Enew " << Enew/
neV <<
"neV" <<
G4endl;
447 G4cout <<
"UCNBoundaryProcess: Transmit and set the new Energy "
477 G4double vRatio = theVelocityNormal/vBound;
479 G4double pLoss = (2*pUpScatter*vRatio)/(std::sqrt(1-(vRatio*vRatio)));
491 pLoss *= std::sqrt(1+2*b*b*vBound*vBound/
492 (hdm*hdm+0.85*hdm*vBound*w+2*vBound*vBound*w*w));
506 G4double r = (std::sqrt(Enormal) - std::sqrt(Enormal - FermiPot)) /
507 (std::sqrt(Enormal) + std::sqrt(Enormal - FermiPot));
516 G4double PdotN = OldMomentum * Normal;
523 if (NewMomentum == OldMomentum ||
G4UniformRand() < pDiffuse) {
562 MRDiffRefl(Normal, Energy, FermiPot, OldMomentum, pDiffuse);
574 G4double PdotN = OldMomentum * Normal;
576 NewMomentum = OldMomentum - (2.*PdotN)*Normal;
598 G4double costheta = OldMomentum*Normal;
600 G4double Enormal = Energy * (costheta*costheta);
604 (1.-pDiffuse-pDiffuseTrans-pLoss);
610 if (decide < pSpecular) {
614 G4double PdotN = OldMomentum * Normal;
615 NewMomentum = OldMomentum - (2.*PdotN)*Normal;
627 if (decide < pSpecular + pDiffuse) {
634 MRDiffRefl(Normal, Energy, FermiPot, OldMomentum, pDiffuse);
637 <<
", " << NewMomentum <<
G4endl;
647 if (decide < pSpecular + pDiffuse + pDiffuseTrans) {
654 MRDiffTrans(Normal, Energy, FermiPot, OldMomentum, pDiffuseTrans);
656 Enew = Energy - FermiPot;
665 if (decide < pSpecular + pDiffuse + pDiffuseTrans + pLoss) {
680 Enew = Energy - FermiPot;
683 G4double produ = OldMomentum * Normal;
685 NewMomentum = palt*OldMomentum-
693 return NewMomentum.
unit();
723 GetMRMaxProbability(theta_i, Energy)/pDiffuse <=
725 GetMRProbability(theta_i,Energy,FermiPot,theta_o,phi_o)/pDiffuse)
732 GetMRProbability(theta_i, Energy, FermiPot, theta_o, phi_o)/
734 GetMRMaxProbability(theta_i, Energy)) > 1) {
735 G4cout <<
"MRMax Wahrscheinlichkeitsueberschreitung!" <<
G4endl;
737 GetMRProbability(theta_i, Energy, FermiPot, theta_o, phi_o)/
739 GetMRMaxProbability(theta_i, Energy)) << G4endl;
741 SetMRMaxProbability(theta_i, Energy,
743 GetMRProbability(theta_i, Energy,
744 FermiPot, theta_o, phi_o));
747 if(++count > 10000) { accepted =
true; }
769 if (momentum * Normal<0) {
772 G4cout <<
"G4UCNBoundaryProcess::MRDiffRefl: !" <<
G4endl;
775 return momentum.
unit();
805 GetMRMaxTransProbability(theta_i, Energy)/pDiffuseTrans <=
807 GetMRTransProbability(theta_i,Energy,FermiPot,theta_o,phi_o)/
815 GetMRTransProbability(theta_i, Energy, FermiPot, theta_o, phi_o)/
817 GetMRMaxTransProbability(theta_i, Energy)) > 1) {
818 G4cout <<
"MRMaxTrans Wahrscheinlichkeitsueberschreitung!" <<
G4endl;
820 GetMRTransProbability(theta_i, Energy, FermiPot, theta_o, phi_o)/
822 GetMRMaxTransProbability(theta_i, Energy)) << G4endl;
824 SetMRMaxTransProbability(theta_i, Energy,
826 GetMRTransProbability(theta_i, Energy,
827 FermiPot, theta_o, phi_o));
830 if(++count > 10000) { accepted =
true; }
847 if (momentum*Normal<0) {
850 G4cout <<
"G4UCNBoundaryProcess::MRDiffTrans: !" <<
G4endl;
853 return momentum.
unit();
858 return (Energy - FermiPot);
870 if (momentum*Normal < 0) {
872 G4cout <<
"G4UCNBoundaryProcess::LDiffRefl: !" <<
G4endl;
875 return momentum.
unit();
921 G4cout <<
" *** No G4UCNMaterialPropertiesTable *** " <<
G4endl;
923 G4cout <<
" *** No MicroRoughness Table *** " <<
G4endl;
925 G4cout <<
" *** MicroRoughness Condition not satisfied *** " <<
G4endl;
937 G4cout <<
" *** MR Model Diffuse Reflection *** " <<
G4endl;
941 G4cout <<
" *** MR Model Diffuse Transmission *** " <<
G4endl;
950 G4cout <<
"Sum NoMRCondition: "
952 G4cout <<
"Sum No. E < V Loss: "
954 G4cout <<
"Sum No. E > V Ezero: "
956 G4cout <<
"Sum No. E < V SpinFlip: "
958 G4cout <<
"Sum No. E > V Specular Reflection: "
960 G4cout <<
"Sum No. E < V Specular Reflection: "
962 G4cout <<
"Sum No. E < V Lambertian Reflection: "
964 G4cout <<
"Sum No. E > V MR DiffuseReflection: "
966 G4cout <<
"Sum No. E < V MR DiffuseReflection: "
968 G4cout <<
"Sum No. E > V SnellTransmit: "
970 G4cout <<
"Sum No. E > V MR SnellTransmit: "
972 G4cout <<
"Sum No. E > V DiffuseTransmit: "
984 if (sd)
return sd->
Hit(&aStep);
G4double GetKineticEnergy() const
G4bool Hit(G4Step *aStep)
G4UCNBoundaryProcessStatus theStatus
void ProposePolarization(G4double Px, G4double Py, G4double Pz)
std::ostringstream G4ExceptionDescription
G4double GetConstProperty(const char *key) const
Hep3Vector perpPart() const
static constexpr double hbar_Planck
double polarAngle(const Hep3Vector &v2) const
G4StepPoint * GetPreStepPoint() const
G4int aSpecularReflection
G4ThreeVector MRreflect(G4double, G4ThreeVector, G4ThreeVector, G4double, G4double)
G4UCNBoundaryProcess(const G4String &processName="UCNBoundaryProcess", G4ProcessType type=fUCN)
G4double GetStepLength() const
const G4ThreeVector & GetMomentumDirection() const
G4int bSpecularReflection
G4VSensitiveDetector * GetSensitiveDetector() const
void BoundaryProcessVerbose() const
G4ThreeVector MRDiffTrans(G4ThreeVector, G4double, G4double, G4ThreeVector, G4double)
void ProposeVelocity(G4double finalVelocity)
G4bool InvokeSD(const G4Step *step)
Hep3Vector & rotateUz(const Hep3Vector &)
G4VPhysicalVolume * GetPhysicalVolume() const
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
G4double condition(const G4ErrorSymMatrix &m)
G4int bMRDiffuseReflection
static const G4Step * GetHyperStep()
G4double GetCorrLen() const
G4ParticleChange aParticleChange
static constexpr double neutron_mass_c2
double angle(const Hep3Vector &) const
G4ThreeVector Reflect(G4double, G4ThreeVector, G4ThreeVector)
static constexpr double c_squared
G4ThreeVector GetMomentum() const
G4StepStatus GetStepStatus() const
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *condition)
G4Material * GetMaterial() const
virtual void Initialize(const G4Track &)
const G4ThreeVector & GetPosition() const
G4ThreeVector MRreflectHigh(G4double, G4double, G4double, G4ThreeVector, G4ThreeVector, G4double, G4double, G4double &)
G4UCNMaterialPropertiesTable * aMaterialPropertiesTable2
G4bool Loss(G4double, G4double, G4double)
G4int aMRDiffuseReflection
virtual ~G4UCNBoundaryProcess()
G4Track * GetTrack() const
const G4String & GetProcessName() const
G4UCNMaterialPropertiesTable * aMaterialPropertiesTable1
static constexpr double eV
G4StepPoint * GetPostStepPoint() const
void ProposeEnergy(G4double finalEnergy)
G4ThreeVector LDiffRefl(G4ThreeVector)
G4int bLambertianReflection
G4double GetVelocity() const
Hep3Vector & rotate(double, const Hep3Vector &)
static G4int GetHypNavigatorID()
void AddTotalEnergyDeposit(G4double value)
G4double * GetMicroRoughnessTable()
static G4TransportationManager * GetTransportationManager()
G4RotationMatrix GetCoordinateTransformMatrix(G4ThreeVector, G4ThreeVector)
G4bool SpinFlip(G4double)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
const G4ThreeVector & GetPolarization() const
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
void BoundaryProcessSummary() const
static constexpr double c_light
G4double Reflectivity(G4double, G4double)
void setRThetaPhi(double r, double theta, double phi)
G4bool DoMicroRoughnessReflection
G4bool High(G4double, G4double)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
void SetProcessSubType(G4int)
static constexpr double degree
G4GLOB_DLL std::ostream G4cout
static G4GeometryTolerance * GetInstance()
G4double Transmit(G4double, G4double)
static constexpr double pi
G4double GetEnergy() const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4UCNBoundaryProcessMessenger * fMessenger
const G4ThreeVector & GetMomentumDirection() const
G4ThreeVector MRDiffRefl(G4ThreeVector, G4double, G4double, G4ThreeVector, G4double)
void ProposeTrackStatus(G4TrackStatus status)
G4bool UseMicroRoughnessReflection
const G4DynamicParticle * GetDynamicParticle() const
G4double GetSurfaceTolerance() const
const G4String & GetName() const