Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/optical/include/G4OpBoundaryProcess.hh

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/optical/include/G4OpBoundaryProcess.hh (Version 11.3.0) and /processes/optical/include/G4OpBoundaryProcess.hh (Version 11.0.p2)


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