Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 // $Id: G4OpBoundaryProcess.hh 73616 2013-09-02 10:18:24Z gcosmo $
28 //
29 //
30 ////////////////////////////////////////////////////////////////////////
31 // Optical Photon Boundary Process Class Definition
32 ////////////////////////////////////////////////////////////////////////
33 //
34 // File: G4OpBoundaryProcess.hh
35 // Description: Discrete Process -- reflection/refraction at
36 // optical interfaces
37 // Version: 1.1
38 // Created: 1997-06-18
39 // Modified: 2005-07-28 add G4ProcessType to constructor
40 // 1999-10-29 add method and class descriptors
41 // 1999-10-10 - Fill NewMomentum/NewPolarization in
42 // DoAbsorption. These members need to be
43 // filled since DoIt calls
44 // aParticleChange.SetMomentumChange etc.
45 // upon return (thanks to: Clark McGrew)
46 // 2006-11-04 - add capability of calculating the reflectivity
47 // off a metal surface by way of a complex index
48 // of refraction - Thanks to Sehwook Lee and John
49 // Hauptman (Dept. of Physics - Iowa State Univ.)
50 // 2009-11-10 - add capability of simulating surface reflections
51 // with Look-Up-Tables (LUT) containing measured
52 // optical reflectance for a variety of surface
53 // treatments - Thanks to Martin Janecek and
54 // William Moses (Lawrence Berkeley National Lab.)
55 // 2013-06-01 - add the capability of simulating the transmission
56 // of a dichronic filter
57 //
58 // Author: Peter Gumplinger
59 // adopted from work by Werner Keil - April 2/96
60 // mail: gum@triumf.ca
61 //
62 ////////////////////////////////////////////////////////////////////////
63 
64 #ifndef G4OpBoundaryProcess_h
65 #define G4OpBoundaryProcess_h 1
66 
67 /////////////
68 // Includes
69 /////////////
70 
71 #include "globals.hh"
72 #include "templates.hh"
73 #include "geomdefs.hh"
74 #include "Randomize.hh"
75 
76 #include "G4RandomTools.hh"
77 #include "G4RandomDirection.hh"
78 
79 #include "G4Step.hh"
80 #include "G4VDiscreteProcess.hh"
81 #include "G4DynamicParticle.hh"
82 #include "G4Material.hh"
84 #include "G4LogicalSkinSurface.hh"
85 #include "G4OpticalSurface.hh"
86 #include "G4OpticalPhoton.hh"
88 
89 // Class Description:
90 // Discrete Process -- reflection/refraction at optical interfaces.
91 // Class inherits publicly from G4VDiscreteProcess.
92 // Class Description - End:
93 
94 /////////////////////
95 // Class Definition
96 /////////////////////
97 
130 
132 {
133 
134 public:
135 
136  ////////////////////////////////
137  // Constructors and Destructor
138  ////////////////////////////////
139 
140  G4OpBoundaryProcess(const G4String& processName = "OpBoundary",
141  G4ProcessType type = fOptical);
143 
144 private:
145 
147 
148  //////////////
149  // Operators
150  //////////////
151 
152  G4OpBoundaryProcess& operator=(const G4OpBoundaryProcess &right);
153 
154 public:
155 
156  ////////////
157  // Methods
158  ////////////
159 
160  G4bool IsApplicable(const G4ParticleDefinition& aParticleType);
161  // Returns true -> 'is applicable' only for an optical photon.
162 
164  G4double ,
166  // Returns infinity; i. e. the process does not limit the step,
167  // but sets the 'Forced' condition for the DoIt to be invoked at
168  // every step. However, only at a boundary will any action be
169  // taken.
170 
171  G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
172  const G4Step& aStep);
173  // This is the method implementing boundary processes.
174 
176  // Returns the current status.
177 
178 private:
179 
180  G4bool G4BooleanRand(const G4double prob) const;
181 
182  G4ThreeVector GetFacetNormal(const G4ThreeVector& Momentum,
183  const G4ThreeVector& Normal) const;
184 
185  void DielectricMetal();
186  void DielectricDielectric();
187  void DielectricLUT();
188  void DielectricDichroic();
189 
190  void ChooseReflection();
191  void DoAbsorption();
192  void DoReflection();
193 
194  G4double GetIncidentAngle();
195  // Returns the incident angle of optical photon
196 
197  G4double GetReflectivity(G4double E1_perp,
198  G4double E1_parl,
199  G4double incidentangle,
200  G4double RealRindex,
201  G4double ImaginaryRindex);
202  // Returns the Reflectivity on a metalic surface
203 
204  void CalculateReflectivity(void);
205 
206  void BoundaryProcessVerbose(void) const;
207 
208  // Invoke SD for post step point if the photon is 'detected'
209  G4bool InvokeSD(const G4Step* step);
210 
211 private:
212 
213  G4double thePhotonMomentum;
214 
215  G4ThreeVector OldMomentum;
216  G4ThreeVector OldPolarization;
217 
218  G4ThreeVector NewMomentum;
219  G4ThreeVector NewPolarization;
220 
221  G4ThreeVector theGlobalNormal;
222  G4ThreeVector theFacetNormal;
223 
224  G4Material* Material1;
225  G4Material* Material2;
226 
227  G4OpticalSurface* OpticalSurface;
228 
229  G4MaterialPropertyVector* PropertyPointer;
230  G4MaterialPropertyVector* PropertyPointer1;
231  G4MaterialPropertyVector* PropertyPointer2;
232 
233  G4double Rindex1;
234  G4double Rindex2;
235 
236  G4double cost1, cost2, sint1, sint2;
237 
238  G4OpBoundaryProcessStatus theStatus;
239 
240  G4OpticalSurfaceModel theModel;
241 
242  G4OpticalSurfaceFinish theFinish;
243 
244  G4double theReflectivity;
245  G4double theEfficiency;
246  G4double theTransmittance;
247  G4double prob_sl, prob_ss, prob_bs;
248 
249  G4int iTE, iTM;
250 
251  G4double kCarTolerance;
252 
253  size_t idx, idy;
254  G4Physics2DVector* DichroicVector;
255 };
256 
257 ////////////////////
258 // Inline methods
259 ////////////////////
260 
261 inline
262 G4bool G4OpBoundaryProcess::G4BooleanRand(const G4double prob) const
263 {
264  /* Returns a random boolean variable with the specified probability */
265 
266  return (G4UniformRand() < prob);
267 }
268 
269 inline
271  aParticleType)
272 {
273  return ( &aParticleType == G4OpticalPhoton::OpticalPhoton() );
274 }
275 
276 inline
278 {
279  return theStatus;
280 }
281 
282 inline
283 void G4OpBoundaryProcess::ChooseReflection()
284 {
285  G4double rand = G4UniformRand();
286  if ( rand >= 0.0 && rand < prob_ss ) {
287  theStatus = SpikeReflection;
288  theFacetNormal = theGlobalNormal;
289  }
290  else if ( rand >= prob_ss &&
291  rand <= prob_ss+prob_sl) {
292  theStatus = LobeReflection;
293  }
294  else if ( rand > prob_ss+prob_sl &&
295  rand < prob_ss+prob_sl+prob_bs ) {
296  theStatus = BackScattering;
297  }
298  else {
299  theStatus = LambertianReflection;
300  }
301 }
302 
303 inline
304 void G4OpBoundaryProcess::DoAbsorption()
305 {
306  theStatus = Absorption;
307 
308  if ( G4BooleanRand(theEfficiency) ) {
309 
310  // EnergyDeposited =/= 0 means: photon has been detected
311  theStatus = Detection;
312  aParticleChange.ProposeLocalEnergyDeposit(thePhotonMomentum);
313  }
314  else {
316  }
317 
318  NewMomentum = OldMomentum;
319  NewPolarization = OldPolarization;
320 
321 // aParticleChange.ProposeEnergy(0.0);
323 }
324 
325 inline
326 void G4OpBoundaryProcess::DoReflection()
327 {
328  if ( theStatus == LambertianReflection ) {
329 
330  NewMomentum = G4LambertianRand(theGlobalNormal);
331  theFacetNormal = (NewMomentum - OldMomentum).unit();
332 
333  }
334  else if ( theFinish == ground ) {
335 
336  theStatus = LobeReflection;
337  if ( PropertyPointer1 && PropertyPointer2 ){
338  } else {
339  theFacetNormal =
340  GetFacetNormal(OldMomentum,theGlobalNormal);
341  }
342  G4double PdotN = OldMomentum * theFacetNormal;
343  NewMomentum = OldMomentum - (2.*PdotN)*theFacetNormal;
344 
345  }
346  else {
347 
348  theStatus = SpikeReflection;
349  theFacetNormal = theGlobalNormal;
350  G4double PdotN = OldMomentum * theFacetNormal;
351  NewMomentum = OldMomentum - (2.*PdotN)*theFacetNormal;
352 
353  }
354  G4double EdotN = OldPolarization * theFacetNormal;
355  NewPolarization = -OldPolarization + (2.*EdotN)*theFacetNormal;
356 }
357 
358 #endif /* G4OpBoundaryProcess_h */
G4double condition(const G4ErrorSymMatrix &m)
G4ThreeVector G4LambertianRand(const G4ThreeVector &normal)
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
G4OpBoundaryProcessStatus
G4OpBoundaryProcess(const G4String &processName="OpBoundary", G4ProcessType type=fOptical)
G4OpBoundaryProcessStatus GetStatus() const
int G4int
Definition: G4Types.hh:78
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
#define G4UniformRand()
Definition: Randomize.hh:87
bool G4bool
Definition: G4Types.hh:79
G4double GetMeanFreePath(const G4Track &, G4double, G4ForceCondition *condition)
Definition: G4Step.hh:76
static G4OpticalPhoton * OpticalPhoton()
G4OpticalSurfaceFinish
G4ParticleChange aParticleChange
Definition: G4VProcess.hh:289
G4bool IsApplicable(const G4ParticleDefinition &aParticleType)
G4OpticalSurfaceModel
double G4double
Definition: G4Types.hh:76
void ProposeTrackStatus(G4TrackStatus status)
G4ForceCondition
G4ProcessType