152{
156
157
158
160 const G4Step* pStep = (hStep != nullptr) ? hStep : &aStep;
161
163 {
166 }
167 else
168 {
171 BoundaryProcessVerbose();
173 }
174
177
179 {
181 if(thePrePV != nullptr)
183 if(thePostPV != nullptr)
185 }
186
188 if(stepLength <= fCarTolerance)
189 {
192 BoundaryProcessVerbose();
193
195 G4MaterialPropertiesTable* aMPT = fMaterial2->GetMaterialPropertiesTable();
196 if(aMPT != nullptr)
197 {
199 }
200
201 if(groupvel != nullptr)
202 {
204 groupvel->
Value(fPhotonMomentum, idx_groupvel));
205 }
207 }
208 else if (stepLength <= 10. * fCarTolerance && fNumSmallStepWarnings < 10)
209 {
210 ++fNumSmallStepWarnings;
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(fNumSmallStepWarnings == 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 a 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
290 G4MaterialPropertiesTable* MPT = fMaterial1->GetMaterialPropertiesTable();
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
320 G4LogicalSurface* surface =
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();
353 fFinish = fOpticalSurface->GetFinish();
354
355 G4MaterialPropertiesTable* sMPT =
356 fOpticalSurface->GetMaterialPropertiesTable();
357 if(sMPT != nullptr)
358 {
359 if(IsBackpainted(fFinish))
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 }
417 else if(IsBackpainted(fFinish))
418 {
422 }
423 }
424
425
427 {
429 {
430 if(fMaterial1 == fMaterial2)
431 {
434 BoundaryProcessVerbose();
436 }
437 MPT = fMaterial2->GetMaterialPropertiesTable();
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 }
457 if(IsBackpainted(fFinish))
458 {
459 DielectricDielectric();
460 }
461 else
462 {
464 if(rand > fReflectivity + fTransmittance)
465 {
466 DoAbsorption();
467 }
468 else if(rand > fReflectivity)
469 {
470 DoTransmission();
471 }
472 else
473 {
475 {
476 DoReflection();
477 }
479 {
481 DoReflection();
482 }
483 else
484 {
485 DielectricDielectric();
486 }
487 }
488 }
489 }
491 {
492 DielectricMetal();
493 }
495 {
496 DielectricLUT();
497 }
499 {
500 DielectricLUTDAVIS();
501 }
503 {
504 DielectricDichroic();
505 }
507 {
508 CoatedDielectricDielectric();
509 }
510 else
511 {
512 if(fNumBdryTypeWarnings <= 10)
513 {
514 ++fNumBdryTypeWarnings;
516 {
518 ed <<
" PostStepDoIt(): Illegal boundary type." <<
G4endl;
519 if(fNumBdryTypeWarnings == 10)
520 {
521 ed <<
"** Boundary type warnings stopped." <<
G4endl;
522 }
524 }
525 }
527 }
528
529 fNewMomentum = fNewMomentum.unit();
530 fNewPolarization = fNewPolarization.unit();
531
533 {
534 G4cout <<
" New Momentum Direction: " << fNewMomentum <<
G4endl
535 <<
" New Polarization: " << fNewPolarization <<
G4endl;
536 BoundaryProcessVerbose();
537 }
538
541
543 {
544
545 G4MaterialPropertiesTable* aMPT = fMaterial2->GetMaterialPropertiesTable();
547 if(aMPT != nullptr)
548 {
550 }
551 if(groupvel != nullptr)
552 {
554 groupvel->
Value(fPhotonMomentum, idx_groupvel));
555 }
556 }
557
559 InvokeSD(pStep);
561}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4PhysicsFreeVector G4MaterialPropertyVector
CLHEP::Hep3Vector G4ThreeVector
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
static const G4Step * GetHyperStep()
static G4int GetHypNavigatorID()
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
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 &)
G4LogicalVolume * GetMotherLogical() const
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
G4ParticleChange aParticleChange