65#include "G4OpticalPhoton.hh"
66#include "G4OpticalSurface.hh"
67#include "G4RandomTools.hh"
68#include "G4VDiscreteProcess.hh"
69#include "G4VUserTrackInformation.hh"
70#include <G4AutoLock.hh>
71#include <G4Threading.hh>
79 void addVolume(G4MaterialPropertiesTable* mpt) {
80 if (mVolumeHistory.empty() || mpt != mVolumeHistory.back()) {
81 mVolumeHistory.push_back(mpt);
85 G4MaterialPropertiesTable* getNthPreviousVolume(G4int n) {
86 if (n < mVolumeHistory.size())
87 return mVolumeHistory[mVolumeHistory.size() - 1 - n];
91 G4int getVolumeHistorySize()
const {
return mVolumeHistory.size(); }
94 std::vector<G4MaterialPropertiesTable*> mVolumeHistory;
99 G4double Reflectivity;
100 G4double Transmittance;
111enum G4OpBoundaryProcessStatus
117 TotalInternalReflection,
118 LambertianReflection,
128 PolishedLumirrorAirReflection,
129 PolishedLumirrorGlueReflection,
130 PolishedAirReflection,
131 PolishedTeflonAirReflection,
132 PolishedTiOAirReflection,
133 PolishedTyvekAirReflection,
134 PolishedVM2000AirReflection,
135 PolishedVM2000GlueReflection,
136 EtchedLumirrorAirReflection,
137 EtchedLumirrorGlueReflection,
139 EtchedTeflonAirReflection,
140 EtchedTiOAirReflection,
141 EtchedTyvekAirReflection,
142 EtchedVM2000AirReflection,
143 EtchedVM2000GlueReflection,
144 GroundLumirrorAirReflection,
145 GroundLumirrorGlueReflection,
147 GroundTeflonAirReflection,
148 GroundTiOAirReflection,
149 GroundTyvekAirReflection,
150 GroundVM2000AirReflection,
151 GroundVM2000GlueReflection,
153 CoatedDielectricReflection,
154 CoatedDielectricRefraction,
155 CoatedDielectricFrustratedTransmission
162 G4ProcessType type = fOptical);
165 virtual G4bool IsApplicable(
166 const G4ParticleDefinition &aParticleType)
override;
169 virtual G4double GetMeanFreePath(
const G4Track &, G4double,
170 G4ForceCondition *condition)
override;
175 G4VParticleChange *PostStepDoIt(
const G4Track &aTrack,
176 const G4Step &aStep)
override;
179 virtual G4OpBoundaryProcessStatus GetStatus()
const;
182 virtual void SetInvokeSD(G4bool);
185 virtual void PreparePhysicsTable(
const G4ParticleDefinition &)
override;
187 virtual void Initialise();
189 void SetVerboseLevel(G4int);
195 G4bool G4BooleanRand(
const G4double prob)
const;
197 G4ThreeVector GetFacetNormal(
const G4ThreeVector &Momentum,
198 const G4ThreeVector &Normal)
const;
199 G4Mutex boundaryProcessMutex;
200 void DielectricMetal();
201 void DielectricDielectric();
203 void DielectricLUT();
204 void DielectricLUTDAVIS();
206 void DielectricDichroic();
207 void PhotocathodeCoatedComplex(
const G4Track* pTrack);
209 void ChooseReflection();
213 G4double GetIncidentAngle();
216 G4double GetReflectivity(G4double E1_perp, G4double E1_parl,
217 G4double incidentangle, G4double RealRindex,
218 G4double ImaginaryRindex);
226 OpticalLayerResult CalculateThinLayerCoefficientsComplex(G4double sinTL, G4double wavelength,
227 G4complex cost1, G4complex cost2, G4Track pTrack);
229 G4complex pComplexRindex2,
236 G4double pImagRIndex1,
237 G4double pImagRIndex2,
241 void CalculateReflectivity();
243 void BoundaryProcessVerbose()
const;
246 G4bool InvokeSD(
const G4Step *step);
248 G4ThreeVector fOldMomentum;
249 G4ThreeVector fOldPolarization;
251 G4ThreeVector fNewMomentum;
252 G4ThreeVector fNewPolarization;
254 G4ThreeVector fGlobalNormal;
255 G4ThreeVector fFacetNormal;
257 const G4Material *fMaterial1;
258 const G4Material *fMaterial2;
260 G4OpticalSurface *fOpticalSurface;
262 G4MaterialPropertyVector *fRealRIndexMPV;
263 G4MaterialPropertyVector *fImagRIndexMPV;
264 G4Physics2DVector *fDichroicVector;
266 G4double fPhotonMomentum;
270 G4double fAbsorptionLength1;
271 G4double fAbsorptionLength2;
275 G4double fReflectivity;
276 G4double fEfficiency;
277 G4double fTransmittance;
278 G4double fSurfaceRoughness;
280 G4double fProb_sl, fProb_ss, fProb_bs;
281 G4double fCarTolerance;
284 G4double fCoatedRindex, fCoatedThickness;
286 G4OpBoundaryProcessStatus fStatus;
287 G4OpticalSurfaceModel fModel;
288 G4OpticalSurfaceFinish fFinish;
294 size_t idx_dichroicX = 0;
295 size_t idx_dichroicY = 0;
296 size_t idx_rindex1 = 0;
297 size_t idx_rindex_surface = 0;
298 size_t idx_reflect = 0;
300 size_t idx_trans = 0;
302 size_t idx_spike = 0;
304 size_t idx_rindex2 = 0;
305 size_t idx_groupvel = 0;
306 size_t idx_rrindex = 0;
307 size_t idx_irindex = 0;
308 size_t idx_coatedrindex = 0;
310 size_t idx_abslength1 = 0;
311 size_t idx_abslength2 = 0;
312 size_t idx_coatedimagindex = 0;
313 size_t idx_coatedabslength = 0;
322inline G4bool G4OpBoundaryProcess::G4BooleanRand(
const G4double prob)
const
325 return (G4UniformRand() < prob);
328inline G4bool G4OpBoundaryProcess::IsApplicable(
329 const G4ParticleDefinition &aParticleType)
331 return (&aParticleType == G4OpticalPhoton::OpticalPhoton());
334inline G4OpBoundaryProcessStatus G4OpBoundaryProcess::GetStatus()
const
340inline void G4OpBoundaryProcess::ChooseReflection()
342 G4double rand = G4UniformRand();
345 fStatus = SpikeReflection;
346 fFacetNormal = fGlobalNormal;
348 else if (rand < fProb_ss + fProb_sl)
350 fStatus = LobeReflection;
352 else if (rand < fProb_ss + fProb_sl + fProb_bs)
354 fStatus = BackScattering;
358 fStatus = LambertianReflection;
362inline void G4OpBoundaryProcess::DoAbsorption()
364 fStatus = Absorption;
366 if (G4BooleanRand(fEfficiency))
370 aParticleChange.ProposeLocalEnergyDeposit(fPhotonMomentum);
374 aParticleChange.ProposeLocalEnergyDeposit(0.0);
377 fNewMomentum = fOldMomentum;
378 fNewPolarization = fOldPolarization;
380 aParticleChange.ProposeTrackStatus(fStopAndKill);
383inline void G4OpBoundaryProcess::DoReflection()
385 if (fStatus == LambertianReflection)
387 fNewMomentum = G4LambertianRand(fGlobalNormal);
388 fFacetNormal = (fNewMomentum - fOldMomentum).unit();
390 else if (fFinish == ground)
392 fStatus = LobeReflection;
393 if (!fRealRIndexMPV || !fImagRIndexMPV)
395 fFacetNormal = GetFacetNormal(fOldMomentum, fGlobalNormal);
400 fOldMomentum - (2. * fOldMomentum * fFacetNormal * fFacetNormal);
404 fStatus = SpikeReflection;
405 fFacetNormal = fGlobalNormal;
407 fOldMomentum - (2. * fOldMomentum * fFacetNormal * fFacetNormal);
410 -fOldPolarization + (2. * fOldPolarization * fFacetNormal * fFacetNormal);
Definition OMSimOpBoundaryProcess.hh:159
Definition OMSimOpBoundaryProcess.hh:74
Definition OMSimOpBoundaryProcess.hh:104
Definition OMSimOpBoundaryProcess.hh:98