Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4OpBoundaryProcess.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27//
28//
29////////////////////////////////////////////////////////////////////////
30// Optical Photon Boundary Process Class Definition
31////////////////////////////////////////////////////////////////////////
32//
33// File: G4OpBoundaryProcess.hh
34// Description: Discrete Process -- reflection/refraction at
35// optical interfaces
36// Version: 1.1
37// Created: 1997-06-18
38// Modified: 2005-07-28 add G4ProcessType to constructor
39// 1999-10-29 add method and class descriptors
40// 1999-10-10 - Fill NewMomentum/NewPolarization in
41// DoAbsorption. These members need to be
42// filled since DoIt calls
43// aParticleChange.SetMomentumChange etc.
44// upon return (thanks to: Clark McGrew)
45// 2006-11-04 - add capability of calculating the reflectivity
46// off a metal surface by way of a complex index
47// of refraction - Thanks to Sehwook Lee and John
48// Hauptman (Dept. of Physics - Iowa State Univ.)
49// 2009-11-10 - add capability of simulating surface reflections
50// with Look-Up-Tables (LUT) containing measured
51// optical reflectance for a variety of surface
52// treatments - Thanks to Martin Janecek and
53// William Moses (Lawrence Berkeley National Lab.)
54// 2013-06-01 - add the capability of simulating the transmission
55// of a dichronic filter
56// 2017-02-24 - add capability of simulating surface reflections
57// with Look-Up-Tables (LUT) developed in DAVIS
58//
59// Author: Peter Gumplinger
60// adopted from work by Werner Keil - April 2/96
61//
62////////////////////////////////////////////////////////////////////////
63
64#ifndef G4OpBoundaryProcess_h
65#define G4OpBoundaryProcess_h 1
66
67#include "G4OpticalPhoton.hh"
68#include "G4OpticalSurface.hh"
69#include "G4RandomTools.hh"
70#include "G4VDiscreteProcess.hh"
71
73{
118
120{
121 public:
122 explicit G4OpBoundaryProcess(const G4String& processName = "OpBoundary",
123 G4ProcessType type = fOptical);
125
126 virtual G4bool IsApplicable(
127 const G4ParticleDefinition& aParticleType) override;
128 // Returns true -> 'is applicable' only for an optical photon.
129
131 G4ForceCondition* condition) override;
132 // Returns infinity; i. e. the process does not limit the step, but sets the
133 // 'Forced' condition for the DoIt to be invoked at every step. However, only
134 // at a boundary will any action be taken.
135
137 const G4Step& aStep) override;
138 // This is the method implementing boundary processes.
139
140 virtual G4OpBoundaryProcessStatus GetStatus() const;
141 // Returns the current status.
142
143 virtual void SetInvokeSD(G4bool);
144 // Set flag for call to InvokeSD method.
145
146 virtual void PreparePhysicsTable(const G4ParticleDefinition&) override;
147
148 virtual void Initialise();
149
151
152 private:
153 G4OpBoundaryProcess(const G4OpBoundaryProcess& right) = delete;
154 G4OpBoundaryProcess& operator=(const G4OpBoundaryProcess& right) = delete;
155
156 G4bool G4BooleanRand(const G4double prob) const;
157
158 G4ThreeVector GetFacetNormal(const G4ThreeVector& Momentum,
159 const G4ThreeVector& Normal) const;
160
161 void DielectricMetal();
162 void DielectricDielectric();
163
164 void DielectricLUT();
165 void DielectricLUTDAVIS();
166
167 void DielectricDichroic();
168 void CoatedDielectricDielectric();
169
170 void ChooseReflection();
171 void DoAbsorption();
172 void DoReflection();
173
174 G4double GetIncidentAngle();
175 // Returns the incident angle of optical photon
176
177 G4double GetReflectivity(G4double E1_perp, G4double E1_parl,
178 G4double incidentangle, G4double RealRindex,
179 G4double ImaginaryRindex);
180 // Returns the Reflectivity on a metallic surface
181
182 G4double GetReflectivityThroughThinLayer(G4double sinTL, G4double E1_perp,
183 G4double E1_parl, G4double wavelength,
184 G4double cost1, G4double cost2);
185 // Returns the Reflectivity on a coated surface
186
187 void CalculateReflectivity();
188
189 void BoundaryProcessVerbose() const;
190
191 // Invoke SD for post step point if the photon is 'detected'
192 G4bool InvokeSD(const G4Step* step);
193
194 G4ThreeVector fOldMomentum;
195 G4ThreeVector fOldPolarization;
196
197 G4ThreeVector fNewMomentum;
198 G4ThreeVector fNewPolarization;
199
200 G4ThreeVector fGlobalNormal;
201 G4ThreeVector fFacetNormal;
202
203 const G4Material* fMaterial1;
204 const G4Material* fMaterial2;
205
206 G4OpticalSurface* fOpticalSurface;
207
208 G4MaterialPropertyVector* fRealRIndexMPV;
209 G4MaterialPropertyVector* fImagRIndexMPV;
210 G4Physics2DVector* fDichroicVector;
211
212 G4double fPhotonMomentum;
213 G4double fRindex1;
214 G4double fRindex2;
215
216 G4double fSint1;
217
218 G4double fReflectivity;
219 G4double fEfficiency;
220 G4double fTransmittance;
221 G4double fSurfaceRoughness;
222
223 G4double fProb_sl, fProb_ss, fProb_bs;
224 G4double fCarTolerance;
225
226 // Used by CoatedDielectricDielectric()
227 G4double fCoatedRindex, fCoatedThickness;
228
232
233 G4int f_iTE, f_iTM;
234
235 G4int fNumWarnings; // number of times small step warning printed
236
237 size_t idx_dichroicX = 0;
238 size_t idx_dichroicY = 0;
239 size_t idx_rindex1 = 0;
240 size_t idx_rindex_surface = 0;
241 size_t idx_reflect = 0;
242 size_t idx_eff = 0;
243 size_t idx_trans = 0;
244 size_t idx_lobe = 0;
245 size_t idx_spike = 0;
246 size_t idx_back = 0;
247 size_t idx_rindex2 = 0;
248 size_t idx_groupvel = 0;
249 size_t idx_rrindex = 0;
250 size_t idx_irindex = 0;
251 size_t idx_coatedrindex = 0;
252
253 // Used by CoatedDielectricDielectric()
254 G4bool fCoatedFrustratedTransmission = true;
255
256 G4bool fInvokeSD;
257};
258
259////////////////////
260// Inline methods
261////////////////////
262
263inline G4bool G4OpBoundaryProcess::G4BooleanRand(const G4double prob) const
264{
265 // Returns a random boolean variable with the specified probability
266 return (G4UniformRand() < prob);
267}
268
270 const G4ParticleDefinition& aParticleType)
271{
272 return (&aParticleType == G4OpticalPhoton::OpticalPhoton());
273}
274
276{
277 return fStatus;
278}
279
280inline void G4OpBoundaryProcess::ChooseReflection()
281{
282 G4double rand = G4UniformRand();
283 if(rand < fProb_ss)
284 {
285 fStatus = SpikeReflection;
286 fFacetNormal = fGlobalNormal;
287 }
288 else if(rand < fProb_ss + fProb_sl)
289 {
290 fStatus = LobeReflection;
291 }
292 else if(rand < fProb_ss + fProb_sl + fProb_bs)
293 {
294 fStatus = BackScattering;
295 }
296 else
297 {
298 fStatus = LambertianReflection;
299 }
300}
301
302inline void G4OpBoundaryProcess::DoAbsorption()
303{
304 fStatus = Absorption;
305
306 if(G4BooleanRand(fEfficiency))
307 {
308 // EnergyDeposited =/= 0 means: photon has been detected
309 fStatus = Detection;
311 }
312 else
313 {
315 }
316
317 fNewMomentum = fOldMomentum;
318 fNewPolarization = fOldPolarization;
319
321}
322
323inline void G4OpBoundaryProcess::DoReflection()
324{
325 if(fStatus == LambertianReflection)
326 {
327 fNewMomentum = G4LambertianRand(fGlobalNormal);
328 fFacetNormal = (fNewMomentum - fOldMomentum).unit();
329 }
330 else if(fFinish == ground)
331 {
332 fStatus = LobeReflection;
333 if(!fRealRIndexMPV || !fImagRIndexMPV)
334 {
335 fFacetNormal = GetFacetNormal(fOldMomentum, fGlobalNormal);
336 }
337 // else
338 // complex ref. index to be implemented
339 fNewMomentum =
340 fOldMomentum - (2. * fOldMomentum * fFacetNormal * fFacetNormal);
341 }
342 else
343 {
344 fStatus = SpikeReflection;
345 fFacetNormal = fGlobalNormal;
346 fNewMomentum =
347 fOldMomentum - (2. * fOldMomentum * fFacetNormal * fFacetNormal);
348 }
349 fNewPolarization =
350 -fOldPolarization + (2. * fOldPolarization * fFacetNormal * fFacetNormal);
351}
352
353#endif /* G4OpBoundaryProcess_h */
G4double condition(const G4ErrorSymMatrix &m)
G4ForceCondition
G4OpBoundaryProcessStatus
@ PolishedTiOAirReflection
@ GroundTeflonAirReflection
@ EtchedVM2000AirReflection
@ Undefined
@ NotAtBoundary
@ Transmission
@ CoatedDielectricReflection
@ EtchedVM2000GlueReflection
@ GroundLumirrorGlueReflection
@ LobeReflection
@ GroundTiOAirReflection
@ GroundTyvekAirReflection
@ FresnelReflection
@ NoRINDEX
@ GroundAirReflection
@ EtchedAirReflection
@ PolishedVM2000GlueReflection
@ PolishedAirReflection
@ PolishedTeflonAirReflection
@ SameMaterial
@ EtchedTyvekAirReflection
@ SpikeReflection
@ EtchedLumirrorGlueReflection
@ GroundVM2000AirReflection
@ PolishedTyvekAirReflection
@ PolishedVM2000AirReflection
@ EtchedTiOAirReflection
@ EtchedTeflonAirReflection
@ GroundVM2000GlueReflection
@ BackScattering
@ PolishedLumirrorGlueReflection
@ Absorption
@ TotalInternalReflection
@ StepTooSmall
@ CoatedDielectricFrustratedTransmission
@ PolishedLumirrorAirReflection
@ EtchedLumirrorAirReflection
@ GroundLumirrorAirReflection
@ LambertianReflection
@ CoatedDielectricRefraction
@ FresnelRefraction
@ Detection
G4OpticalSurfaceModel
G4OpticalSurfaceFinish
@ ground
G4ProcessType
@ fOptical
G4ThreeVector G4LambertianRand(const G4ThreeVector &normal)
@ fStopAndKill
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
#define G4UniformRand()
Definition: Randomize.hh:52
virtual ~G4OpBoundaryProcess()
virtual G4OpBoundaryProcessStatus GetStatus() const
virtual G4bool IsApplicable(const G4ParticleDefinition &aParticleType) override
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep) override
virtual void SetInvokeSD(G4bool)
virtual G4double GetMeanFreePath(const G4Track &, G4double, G4ForceCondition *condition) override
virtual void PreparePhysicsTable(const G4ParticleDefinition &) override
static G4OpticalPhoton * OpticalPhoton()
Definition: G4Step.hh:62
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4ParticleChange aParticleChange
Definition: G4VProcess.hh:331