ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4OpBoundaryProcess.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4OpBoundaryProcess.hh
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 //
30 // Optical Photon Boundary Process Class Definition
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 // mail: gum@triumf.ca
62 //
64 
65 #ifndef G4OpBoundaryProcess_h
66 #define G4OpBoundaryProcess_h 1
67 
68 #include "globals.hh"
69 #include "templates.hh"
70 #include "geomdefs.hh"
71 #include "Randomize.hh"
72 
73 #include "G4RandomTools.hh"
74 #include "G4RandomDirection.hh"
75 
76 #include "G4Step.hh"
77 #include "G4VDiscreteProcess.hh"
78 #include "G4DynamicParticle.hh"
79 #include "G4Material.hh"
81 #include "G4LogicalSkinSurface.hh"
82 #include "G4OpticalSurface.hh"
83 #include "G4OpticalPhoton.hh"
85 
86 // Class Description:
87 // Discrete Process -- reflection/refraction at optical interfaces.
88 // Class inherits publicly from G4VDiscreteProcess.
89 // Class Description - End:
90 
123 
125 {
126 
127 public:
128 
129  explicit G4OpBoundaryProcess(const G4String& processName = "OpBoundary",
130  G4ProcessType type = fOptical);
131  virtual ~G4OpBoundaryProcess();
132 
133  virtual G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
134  // Returns true -> 'is applicable' only for an optical photon.
135 
137  // Returns infinity; i. e. the process does not limit the step,
138  // but sets the 'Forced' condition for the DoIt to be invoked at
139  // every step. However, only at a boundary will any action be
140  // taken.
141 
142  G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
143  const G4Step& aStep) override;
144  // This is the method implementing boundary processes.
145 
146  virtual G4OpBoundaryProcessStatus GetStatus() const;
147  // Returns the current status.
148 
149  virtual void SetInvokeSD(G4bool);
150  // Set flag for call to InvokeSD method.
151 
152 private:
153 
155  G4OpBoundaryProcess& operator=(const G4OpBoundaryProcess &right) = delete;
156 
157  G4bool G4BooleanRand(const G4double prob) const;
158 
160  const G4ThreeVector& Normal) const;
161 
162  void DielectricMetal();
163  void DielectricDielectric();
164 
165  void DielectricLUT();
166  void DielectricLUTDAVIS();
167 
168  void DielectricDichroic();
169 
170  void ChooseReflection();
171  void DoAbsorption();
172  void DoReflection();
173 
175  // Returns the incident angle of optical photon
176 
178  G4double E1_parl,
179  G4double incidentangle,
180  G4double RealRindex,
181  G4double ImaginaryRindex);
182  // Returns the Reflectivity on a metalic surface
183 
184  void CalculateReflectivity(void);
185 
186  void BoundaryProcessVerbose(void) const;
187 
188  // Invoke SD for post step point if the photon is 'detected'
189  G4bool InvokeSD(const G4Step* step);
190 
192 
195 
198 
201 
204 
206 
209 
212 
214 
216 
218 
220 
224 
226 
228 
230 
232 
233  size_t idx, idy;
235 
237 };
238 
240 // Inline methods
242 
243 inline
245 {
246  /* Returns a random boolean variable with the specified probability */
247  return (G4UniformRand() < prob);
248 }
249 
250 inline
252  aParticleType)
253 {
254  return (&aParticleType == G4OpticalPhoton::OpticalPhoton());
255 }
256 
257 inline
259 {
260  return theStatus;
261 }
262 
263 inline
265 {
266  fInvokeSD = flag;
267 }
268 
269 inline
271 {
272  G4double rand = G4UniformRand();
273  if (rand >= 0.0 && rand < prob_ss) {
276  }
277  else if ( rand >= prob_ss && rand <= prob_ss+prob_sl) {
279  }
280  else if ( rand > prob_ss+prob_sl && rand < prob_ss+prob_sl+prob_bs ) {
282  }
283  else {
285  }
286 }
287 
288 inline
290 {
292 
294  // EnergyDeposited =/= 0 means: photon has been detected
297  }
298  else {
300  }
301 
304 
306 }
307 
308 inline
310 {
314  }
315  else if (theFinish == ground) {
318  //
319  } else {
321  }
323  NewMomentum = OldMomentum - (2.*PdotN)*theFacetNormal;
324  }
325  else {
329  NewMomentum = OldMomentum - (2.*PdotN)*theFacetNormal;
330  }
332  NewPolarization = -OldPolarization + (2.*EdotN)*theFacetNormal;
333 }
334 
335 #endif /* G4OpBoundaryProcess_h */