120 const G4Step* pStep = &aStep;
124 if (hStep) pStep = hStep;
145 GetMaterialPropertiesTable();
147 GetMaterialPropertiesTable();
154 G4cout <<
" vol1: " << volnam1 <<
", vol2: " << volnam2 <<
G4endl;
159 if (Material1 == Material2) {
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);
235 if (aMaterialPropertiesTable2) {
243 if (aMaterialPropertiesTable1)
246 G4double FermiPotDiff = FermiPot2 - FermiPot1;
249 G4cout <<
"UCNBoundaryProcess: new FermiPot: " << FermiPot2/neV
250 <<
"neV, old FermiPot:" << FermiPot1/neV <<
"neV" <<
G4endl;
254 DoMicroRoughnessReflection = UseMicroRoughnessReflection;
258 if (!aMaterialPropertiesTable2) {
263 DoMicroRoughnessReflection =
false;
273 DoMicroRoughnessReflection =
false;
279 theta_i = OldMomentum.
angle(-theGlobalNormal);
283 if (!aMaterialPropertiesTable2->
284 ConditionsValid(Energy, FermiPotDiff, theta_i)) {
290 DoMicroRoughnessReflection =
false;
299 if (DoMicroRoughnessReflection) {
303 MRpDiffuse = aMaterialPropertiesTable2->
304 GetMRIntProbability(theta_i, Energy);
308 MRpDiffuseTrans = aMaterialPropertiesTable2->
309 GetMRIntTransProbability(theta_i, Energy);
313 G4cout <<
"Energy: " << Energy/neV <<
"neV"
314 <<
", Enormal: " << Enormal/neV <<
"neV" <<
G4endl;
315 G4cout <<
"FermiPotDiff: " << FermiPotDiff/neV <<
"neV " <<
G4endl;
316 G4cout <<
"Reflection_prob: " << MRpDiffuse
317 <<
", Transmission_prob: " << MRpDiffuseTrans <<
G4endl;
321 if (!High(Enormal, FermiPotDiff)) {
329 if (Loss(pUpScatter, theVelocityNormal, FermiPotDiff)) {
344 if (SpinFlip(pSpinFlip)) {
359 if (DoMicroRoughnessReflection)
360 NewMomentum =
MRreflect(MRpDiffuse, OldMomentum, theGlobalNormal,
361 Energy, FermiPotDiff);
366 NewMomentum = Reflect(pDiffuse, OldMomentum, theGlobalNormal);
384 if (DoMicroRoughnessReflection) {
390 theGlobalNormal, Energy, FermiPotDiff, Enew);
405 G4double reflectivity = Reflectivity(FermiPotDiff, Enormal);
408 << reflectivity <<
G4endl;
414 NewMomentum = Reflect(pDiffuse, OldMomentum, theGlobalNormal);
421 G4double Enew = Transmit(FermiPotDiff, Energy);
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 "
double angle(const Hep3Vector &) const
std::ostringstream G4ExceptionDescription
G4double GetVelocity() const
const G4DynamicParticle * GetDynamicParticle() const
G4StepStatus GetStepStatus() const
G4Material * GetMaterial() const
void ProposePolarization(G4double Px, G4double Py, G4double Pz)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4StepPoint * GetPreStepPoint() const
static G4int GetHypNavigatorID()
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
G4VPhysicalVolume * GetPhysicalVolume() const
const G4String & GetName() const
static constexpr double degree
const G4ThreeVector & GetPosition() const
const G4ThreeVector & GetMomentumDirection() const
static constexpr double neutron_mass_c2
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4TransportationManager * GetTransportationManager()
G4ThreeVector MRreflect(G4double, G4ThreeVector, G4ThreeVector, G4double, G4double)
G4ThreeVector GetMomentum() const
virtual void Initialize(const G4Track &)
const G4ThreeVector & GetMomentumDirection() const
G4ThreeVector MRreflectHigh(G4double, G4double, G4double, G4ThreeVector, G4ThreeVector, G4double, G4double, G4double &)
G4double * GetMicroRoughnessTable()
G4StepPoint * GetPostStepPoint() const
static constexpr double c_light
const G4ThreeVector & GetPolarization() const
void ProposeEnergy(G4double finalEnergy)
G4ParticleChange aParticleChange
G4double GetEnergy() const
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeVelocity(G4double finalVelocity)
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
G4double GetStepLength() const
static const G4Step * GetHyperStep()
G4double GetConstProperty(const char *key) const