150{
154
155
156
157
158 const G4Step* pStep = &aStep;
160 if(hStep != nullptr)
161 pStep = hStep;
162
164 {
167 }
168 else
169 {
172 BoundaryProcessVerbose();
174 }
175
178
180 {
182 if(thePrePV != nullptr)
184 if(thePostPV != nullptr)
186 }
187
189 if(stepLength <= fCarTolerance)
190 {
193 BoundaryProcessVerbose();
194
197 if(aMPT != nullptr)
198 {
200 }
201
202 if(groupvel != nullptr)
203 {
205 groupvel->
Value(fPhotonMomentum, idx_groupvel));
206 }
208 }
209 else if (stepLength <= 10.*fCarTolerance && fNumWarnings < 10)
210 {
211 ++fNumWarnings;
212 {
214 ed << "G4OpBoundaryProcess: "
215 <<
"Opticalphoton step length: " << stepLength/mm <<
" mm." <<
G4endl
216 << "This is larger than the threshold " << fCarTolerance/mm << " mm "
217 "to set status StepTooSmall." <<
G4endl
218 << "Boundary scattering may be incorrect. ";
219 if(fNumWarnings == 10)
220 {
221 ed <<
G4endl <<
"*** Step size warnings stopped.";
222 }
224 }
225 }
226
228
232
234 {
235 G4cout <<
" Old Momentum Direction: " << fOldMomentum <<
G4endl
236 <<
" Old Polarization: " << fOldPolarization <<
G4endl;
237 }
238
241
242
246 fGlobalNormal = (iNav[hNavId])->GetGlobalExitNormal(theGlobalPoint, &valid);
247
248 if(valid)
249 {
250 fGlobalNormal = -fGlobalNormal;
251 }
252 else
253 {
255 ed << " G4OpBoundaryProcess/PostStepDoIt(): "
256 <<
" The Navigator reports that it returned an invalid normal" <<
G4endl;
259 "Invalid Surface Normal - Geometry must return valid surface normal");
260 }
261
262 if(fOldMomentum * fGlobalNormal > 0.0)
263 {
264#ifdef G4OPTICAL_DEBUG
266 ed << " G4OpBoundaryProcess/PostStepDoIt(): fGlobalNormal points in a "
267 "wrong direction. "
269 << " The momentum of the photon arriving at interface (oldMomentum)"
270 <<
" must exit the volume cross in the step. " <<
G4endl
271 << " So it MUST have dot < 0 with the normal that Exits the new "
272 "volume (globalNormal)."
273 <<
G4endl <<
" >> The dot product of oldMomentum and global Normal is "
274 << fOldMomentum * fGlobalNormal <<
G4endl
275 <<
" Old Momentum (during step) = " << fOldMomentum <<
G4endl
276 <<
" Global Normal (Exiting New Vol) = " << fGlobalNormal <<
G4endl
278 G4Exception(
"G4OpBoundaryProcess::PostStepDoIt",
"OpBoun02",
280
281 ed,
282 "Invalid Surface Normal - Geometry must return valid surface "
283 "normal pointing in the right direction");
284#else
285 fGlobalNormal = -fGlobalNormal;
286#endif
287 }
288
291 if(MPT != nullptr)
292 {
294 }
295 if(rIndexMPV != nullptr)
296 {
297 fRindex1 = rIndexMPV->
Value(fPhotonMomentum, idx_rindex1);
298 }
299 else
300 {
303 BoundaryProcessVerbose();
307 }
308
309 fReflectivity = 1.;
310 fEfficiency = 0.;
311 fTransmittance = 0.;
312 fSurfaceRoughness = 0.;
316
317 rIndexMPV = nullptr;
318 fOpticalSurface = nullptr;
319
322 if(surface == nullptr)
323 {
325 {
327 if(surface == nullptr)
328 {
329 surface =
331 }
332 }
333 else
334 {
336 if(surface == nullptr)
337 {
338 surface =
340 }
341 }
342 }
343
344 if(surface != nullptr)
345 {
346 fOpticalSurface =
348 }
349 if(fOpticalSurface != nullptr)
350 {
351 type = fOpticalSurface->
GetType();
352 fModel = fOpticalSurface->
GetModel();
354
357 if(sMPT != nullptr)
358 {
360 {
362 if(rIndexMPV != nullptr)
363 {
364 fRindex2 = rIndexMPV->
Value(fPhotonMomentum, idx_rindex_surface);
365 }
366 else
367 {
370 BoundaryProcessVerbose();
374 }
375 }
376
379 f_iTE = f_iTM = 1;
380
383 {
384 fReflectivity =
pp->Value(fPhotonMomentum, idx_reflect);
385 }
386 else if(fRealRIndexMPV && fImagRIndexMPV)
387 {
388 CalculateReflectivity();
389 }
390
392 {
393 fEfficiency =
pp->Value(fPhotonMomentum, idx_eff);
394 }
396 {
397 fTransmittance =
pp->Value(fPhotonMomentum, idx_trans);
398 }
400 {
402 }
403
405 {
407 ?
pp->Value(fPhotonMomentum, idx_lobe)
408 : 0.;
410 ?
pp->Value(fPhotonMomentum, idx_spike)
411 : 0.;
413 ?
pp->Value(fPhotonMomentum, idx_back)
414 : 0.;
415 }
416 }
418 {
422 }
423 }
424
425
427 {
429 {
430 if(fMaterial1 == fMaterial2)
431 {
434 BoundaryProcessVerbose();
436 }
438 rIndexMPV = nullptr;
439 if(MPT != nullptr)
440 {
442 }
443 if(rIndexMPV != nullptr)
444 {
445 fRindex2 = rIndexMPV->
Value(fPhotonMomentum, idx_rindex2);
446 }
447 else
448 {
451 BoundaryProcessVerbose();
455 }
456 }
458 {
459 DielectricDielectric();
460 }
461 else
462 {
464 if(rand > fReflectivity + fTransmittance)
465 {
466 DoAbsorption();
467 }
468 else if(rand > fReflectivity)
469 {
471 fNewMomentum = fOldMomentum;
472 fNewPolarization = fOldPolarization;
473 }
474 else
475 {
477 {
478 DoReflection();
479 }
481 {
483 DoReflection();
484 }
485 else
486 {
487 DielectricDielectric();
488 }
489 }
490 }
491 }
493 {
494 DielectricMetal();
495 }
497 {
498 DielectricLUT();
499 }
501 {
502 DielectricLUTDAVIS();
503 }
505 {
506 DielectricDichroic();
507 }
509 {
510 CoatedDielectricDielectric();
511 }
512 else
513 {
515 ed <<
" PostStepDoIt(): Illegal boundary type." <<
G4endl;
518 }
519
520 fNewMomentum = fNewMomentum.
unit();
521 fNewPolarization = fNewPolarization.
unit();
522
524 {
525 G4cout <<
" New Momentum Direction: " << fNewMomentum <<
G4endl
526 <<
" New Polarization: " << fNewPolarization <<
G4endl;
527 BoundaryProcessVerbose();
528 }
529
532
534 {
535
538 if(aMPT != nullptr)
539 {
541 }
542 if(groupvel != nullptr)
543 {
545 groupvel->
Value(fPhotonMomentum, idx_groupvel));
546 }
547 }
548
550 InvokeSD(pStep);
552}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
const G4ThreeVector & GetMomentumDirection() const
G4double GetTotalMomentum() const
const G4ThreeVector & GetPolarization() const
static G4LogicalBorderSurface * GetSurface(const G4VPhysicalVolume *vol1, const G4VPhysicalVolume *vol2)
static G4LogicalSkinSurface * GetSurface(const G4LogicalVolume *vol)
G4SurfaceProperty * GetSurfaceProperty() const
G4bool ConstPropertyExists(const G4String &key) const
G4double GetConstProperty(const G4String &key) const
G4MaterialPropertyVector * GetProperty(const char *key) const
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
G4OpticalSurfaceModel GetModel() const
G4OpticalSurfaceFinish GetFinish() const
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
static const G4Step * GetHyperStep()
static G4int GetHypNavigatorID()
void ProposePolarization(G4double Px, G4double Py, G4double Pz)
void Initialize(const G4Track &) override
void ProposeVelocity(G4double finalVelocity)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4double Value(const G4double energy, std::size_t &lastidx) const
G4StepStatus GetStepStatus() const
G4Material * GetMaterial() const
const G4ThreeVector & GetPosition() const
G4VPhysicalVolume * GetPhysicalVolume() const
G4StepPoint * GetPreStepPoint() const
G4StepPoint * GetPostStepPoint() const
const G4SurfaceType & GetType() const
G4double GetVelocity() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetStepLength() const
std::vector< G4Navigator * >::iterator GetActiveNavigatorsIterator()
static G4TransportationManager * GetTransportationManager()
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4LogicalVolume * GetMotherLogical() const
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
G4ParticleChange aParticleChange