148{
152
153
154
155
156 const G4Step* pStep = &aStep;
158 if(hStep != nullptr)
159 pStep = hStep;
160
162 {
165 }
166 else
167 {
170 BoundaryProcessVerbose();
172 }
173
176
178 {
180 if(thePrePV != nullptr)
182 if(thePostPV != nullptr)
184 }
185
187 if(stepLength <= fCarTolerance)
188 {
191 BoundaryProcessVerbose();
192
195 if(aMPT != nullptr)
196 {
198 }
199
200 if(groupvel != nullptr)
201 {
203 groupvel->
Value(fPhotonMomentum, idx_groupvel));
204 }
206 }
207 else if (stepLength <= 10.*fCarTolerance && fNumSmallStepWarnings < 10)
208 {
209 ++fNumSmallStepWarnings;
211 {
213 ed << "G4OpBoundaryProcess: "
214 <<
"Opticalphoton step length: " << stepLength/mm <<
" mm." <<
G4endl
215 << "This is larger than the threshold " << fCarTolerance/mm << " mm "
216 "to set status StepTooSmall." <<
G4endl
217 << "Boundary scattering may be incorrect. ";
218 if(fNumSmallStepWarnings == 10)
219 {
220 ed <<
G4endl <<
"*** Step size warnings stopped.";
221 }
223 }
224 }
225
227
231
233 {
234 G4cout <<
" Old Momentum Direction: " << fOldMomentum <<
G4endl
235 <<
" Old Polarization: " << fOldPolarization <<
G4endl;
236 }
237
240
241
245 fGlobalNormal = (iNav[hNavId])->GetGlobalExitNormal(theGlobalPoint, &valid);
246
247 if(valid)
248 {
249 fGlobalNormal = -fGlobalNormal;
250 }
251 else
252 {
254 ed << " G4OpBoundaryProcess/PostStepDoIt(): "
255 <<
" The Navigator reports that it returned an invalid normal" <<
G4endl;
258 "Invalid Surface Normal - Geometry must return valid surface normal");
259 }
260
261 if(fOldMomentum * fGlobalNormal > 0.0)
262 {
263#ifdef G4OPTICAL_DEBUG
265 ed << " G4OpBoundaryProcess/PostStepDoIt(): fGlobalNormal points in a "
266 "wrong direction. "
268 << " The momentum of the photon arriving at interface (oldMomentum)"
269 <<
" must exit the volume cross in the step. " <<
G4endl
270 << " So it MUST have dot < 0 with the normal that Exits the new "
271 "volume (globalNormal)."
272 <<
G4endl <<
" >> The dot product of oldMomentum and global Normal is "
273 << fOldMomentum * fGlobalNormal <<
G4endl
274 <<
" Old Momentum (during step) = " << fOldMomentum <<
G4endl
275 <<
" Global Normal (Exiting New Vol) = " << fGlobalNormal <<
G4endl
277 G4Exception(
"G4OpBoundaryProcess::PostStepDoIt",
"OpBoun02",
279
280 ed,
281 "Invalid Surface Normal - Geometry must return valid surface "
282 "normal pointing in the right direction");
283#else
284 fGlobalNormal = -fGlobalNormal;
285#endif
286 }
287
290 if(MPT != nullptr)
291 {
293 }
294 if(rIndexMPV != nullptr)
295 {
296 fRindex1 = rIndexMPV->
Value(fPhotonMomentum, idx_rindex1);
297 }
298 else
299 {
302 BoundaryProcessVerbose();
306 }
307
308 fReflectivity = 1.;
309 fEfficiency = 0.;
310 fTransmittance = 0.;
311 fSurfaceRoughness = 0.;
315
316 rIndexMPV = nullptr;
317 fOpticalSurface = nullptr;
318
321 if(surface == nullptr)
322 {
324 {
326 if(surface == nullptr)
327 {
328 surface =
330 }
331 }
332 else
333 {
335 if(surface == nullptr)
336 {
337 surface =
339 }
340 }
341 }
342
343 if(surface != nullptr)
344 {
345 fOpticalSurface =
347 }
348 if(fOpticalSurface != nullptr)
349 {
350 type = fOpticalSurface->
GetType();
351 fModel = fOpticalSurface->
GetModel();
353
356 if(sMPT != nullptr)
357 {
359 {
361 if(rIndexMPV != nullptr)
362 {
363 fRindex2 = rIndexMPV->
Value(fPhotonMomentum, idx_rindex_surface);
364 }
365 else
366 {
369 BoundaryProcessVerbose();
373 }
374 }
375
378 f_iTE = f_iTM = 1;
379
382 {
383 fReflectivity =
pp->Value(fPhotonMomentum, idx_reflect);
384 }
385 else if(fRealRIndexMPV && fImagRIndexMPV)
386 {
387 CalculateReflectivity();
388 }
389
391 {
392 fEfficiency =
pp->Value(fPhotonMomentum, idx_eff);
393 }
395 {
396 fTransmittance =
pp->Value(fPhotonMomentum, idx_trans);
397 }
399 {
401 }
402
404 {
406 ?
pp->Value(fPhotonMomentum, idx_lobe)
407 : 0.;
409 ?
pp->Value(fPhotonMomentum, idx_spike)
410 : 0.;
412 ?
pp->Value(fPhotonMomentum, idx_back)
413 : 0.;
414 }
415 }
417 {
421 }
422 }
423
424
426 {
428 {
429 if(fMaterial1 == fMaterial2)
430 {
433 BoundaryProcessVerbose();
435 }
437 rIndexMPV = nullptr;
438 if(MPT != nullptr)
439 {
441 }
442 if(rIndexMPV != nullptr)
443 {
444 fRindex2 = rIndexMPV->
Value(fPhotonMomentum, idx_rindex2);
445 }
446 else
447 {
450 BoundaryProcessVerbose();
454 }
455 }
457 {
458 DielectricDielectric();
459 }
460 else
461 {
463 if(rand > fReflectivity + fTransmittance)
464 {
465 DoAbsorption();
466 }
467 else if(rand > fReflectivity)
468 {
470 fNewMomentum = fOldMomentum;
471 fNewPolarization = fOldPolarization;
472 }
473 else
474 {
476 {
477 DoReflection();
478 }
480 {
482 DoReflection();
483 }
484 else
485 {
486 DielectricDielectric();
487 }
488 }
489 }
490 }
492 {
493 DielectricMetal();
494 }
496 {
497 DielectricLUT();
498 }
500 {
501 DielectricLUTDAVIS();
502 }
504 {
505 DielectricDichroic();
506 }
508 {
509 CoatedDielectricDielectric();
510 }
511 else
512 {
513 if(fNumBdryTypeWarnings <= 10)
514 {
515 ++fNumBdryTypeWarnings;
517 {
519 ed <<
" PostStepDoIt(): Illegal boundary type." <<
G4endl;
520 if(fNumBdryTypeWarnings == 10)
521 {
522 ed <<
"** Boundary type warnings stopped." <<
G4endl;
523 }
525 }
526 }
528 }
529
530 fNewMomentum = fNewMomentum.
unit();
531 fNewPolarization = fNewPolarization.
unit();
532
534 {
535 G4cout <<
" New Momentum Direction: " << fNewMomentum <<
G4endl
536 <<
" New Polarization: " << fNewPolarization <<
G4endl;
537 BoundaryProcessVerbose();
538 }
539
542
544 {
545
548 if(aMPT != nullptr)
549 {
551 }
552 if(groupvel != nullptr)
553 {
555 groupvel->
Value(fPhotonMomentum, idx_groupvel));
556 }
557 }
558
560 InvokeSD(pStep);
562}
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