Geant4 Cross Reference |
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 // $Id: G4OpBoundaryProcess.hh,v 1.22 2009-11-20 01:06:45 gum Exp $ >> 28 // GEANT4 tag $Name: not supported by cvs2svn $ 27 // 29 // 28 // << 30 // 29 ////////////////////////////////////////////// 31 //////////////////////////////////////////////////////////////////////// 30 // Optical Photon Boundary Process Class Defin 32 // Optical Photon Boundary Process Class Definition 31 ////////////////////////////////////////////// 33 //////////////////////////////////////////////////////////////////////// 32 // 34 // 33 // File: G4OpBoundaryProcess.hh 35 // File: G4OpBoundaryProcess.hh 34 // Description: Discrete Process -- reflection 36 // Description: Discrete Process -- reflection/refraction at 35 // optical in 37 // optical interfaces 36 // Version: 1.1 38 // Version: 1.1 37 // Created: 1997-06-18 39 // Created: 1997-06-18 38 // Modified: 2005-07-28 add G4ProcessType t 40 // Modified: 2005-07-28 add G4ProcessType to constructor 39 // 1999-10-29 add method and clas 41 // 1999-10-29 add method and class descriptors 40 // 1999-10-10 - Fill NewMomentum/ << 42 // 1999-10-10 - Fill NewMomentum/NewPolarization in 41 // DoAbsorption. The 43 // DoAbsorption. These members need to be 42 // filled since DoIt << 44 // filled since DoIt calls 43 // aParticleChange.S 45 // aParticleChange.SetMomentumChange etc. 44 // upon return (than 46 // upon return (thanks to: Clark McGrew) 45 // 2006-11-04 - add capability of 47 // 2006-11-04 - add capability of calculating the reflectivity 46 // off a metal surfa 48 // off a metal surface by way of a complex index 47 // of refraction - T 49 // of refraction - Thanks to Sehwook Lee and John 48 // Hauptman (Dept. o 50 // Hauptman (Dept. of Physics - Iowa State Univ.) 49 // 2009-11-10 - add capability of 51 // 2009-11-10 - add capability of simulating surface reflections 50 // with Look-Up-Tabl 52 // with Look-Up-Tables (LUT) containing measured 51 // optical reflectan 53 // optical reflectance for a variety of surface 52 // treatments - Than 54 // treatments - Thanks to Martin Janecek and 53 // William Moses (La 55 // William Moses (Lawrence Berkeley National Lab.) 54 // 2013-06-01 - add the capabilit << 55 // of a dichronic fi << 56 // 2017-02-24 - add capability of << 57 // with Look-Up-Tabl << 58 // 56 // 59 // Author: Peter Gumplinger 57 // Author: Peter Gumplinger 60 // adopted from work by Werner Ke 58 // adopted from work by Werner Keil - April 2/96 >> 59 // mail: gum@triumf.ca 61 // 60 // 62 ////////////////////////////////////////////// 61 //////////////////////////////////////////////////////////////////////// 63 62 64 #ifndef G4OpBoundaryProcess_h 63 #ifndef G4OpBoundaryProcess_h 65 #define G4OpBoundaryProcess_h 1 64 #define G4OpBoundaryProcess_h 1 66 65 67 #include "G4OpticalPhoton.hh" << 66 ///////////// 68 #include "G4OpticalSurface.hh" << 67 // Includes >> 68 ///////////// >> 69 >> 70 #include "globals.hh" >> 71 #include "templates.hh" >> 72 #include "geomdefs.hh" >> 73 #include "Randomize.hh" >> 74 69 #include "G4RandomTools.hh" 75 #include "G4RandomTools.hh" >> 76 #include "G4RandomDirection.hh" >> 77 >> 78 #include "G4Step.hh" 70 #include "G4VDiscreteProcess.hh" 79 #include "G4VDiscreteProcess.hh" >> 80 #include "G4DynamicParticle.hh" >> 81 #include "G4Material.hh" >> 82 #include "G4LogicalBorderSurface.hh" >> 83 #include "G4LogicalSkinSurface.hh" >> 84 #include "G4OpticalSurface.hh" >> 85 #include "G4OpticalPhoton.hh" >> 86 #include "G4TransportationManager.hh" 71 87 72 enum G4OpBoundaryProcessStatus << 88 // Class Description: 73 { << 89 // Discrete Process -- reflection/refraction at optical interfaces. 74 Undefined, << 90 // Class inherits publicly from G4VDiscreteProcess. 75 Transmission, << 91 // Class Description - End: 76 FresnelRefraction, << 92 77 FresnelReflection, << 93 ///////////////////// 78 TotalInternalReflection, << 94 // Class Definition 79 LambertianReflection, << 95 ///////////////////// 80 LobeReflection, << 96 81 SpikeReflection, << 97 enum G4OpBoundaryProcessStatus { Undefined, 82 BackScattering, << 98 FresnelRefraction, FresnelReflection, 83 Absorption, << 99 TotalInternalReflection, 84 Detection, << 100 LambertianReflection, LobeReflection, 85 NotAtBoundary, << 101 SpikeReflection, BackScattering, 86 SameMaterial, << 102 Absorption, Detection, NotAtBoundary, 87 StepTooSmall, << 103 SameMaterial, StepTooSmall, NoRINDEX, 88 NoRINDEX, << 104 PolishedLumirrorAirReflection, 89 PolishedLumirrorAirReflection, << 105 PolishedLumirrorGlueReflection, 90 PolishedLumirrorGlueReflection, << 106 PolishedAirReflection, 91 PolishedAirReflection, << 107 PolishedTeflonAirReflection, 92 PolishedTeflonAirReflection, << 108 PolishedTiOAirReflection, 93 PolishedTiOAirReflection, << 109 PolishedTyvekAirReflection, 94 PolishedTyvekAirReflection, << 110 PolishedVM2000AirReflection, 95 PolishedVM2000AirReflection, << 111 PolishedVM2000GlueReflection, 96 PolishedVM2000GlueReflection, << 112 EtchedLumirrorAirReflection, 97 EtchedLumirrorAirReflection, << 113 EtchedLumirrorGlueReflection, 98 EtchedLumirrorGlueReflection, << 114 EtchedAirReflection, 99 EtchedAirReflection, << 115 EtchedTeflonAirReflection, 100 EtchedTeflonAirReflection, << 116 EtchedTiOAirReflection, 101 EtchedTiOAirReflection, << 117 EtchedTyvekAirReflection, 102 EtchedTyvekAirReflection, << 118 EtchedVM2000AirReflection, 103 EtchedVM2000AirReflection, << 119 EtchedVM2000GlueReflection, 104 EtchedVM2000GlueReflection, << 120 GroundLumirrorAirReflection, 105 GroundLumirrorAirReflection, << 121 GroundLumirrorGlueReflection, 106 GroundLumirrorGlueReflection, << 122 GroundAirReflection, 107 GroundAirReflection, << 123 GroundTeflonAirReflection, 108 GroundTeflonAirReflection, << 124 GroundTiOAirReflection, 109 GroundTiOAirReflection, << 125 GroundTyvekAirReflection, 110 GroundTyvekAirReflection, << 126 GroundVM2000AirReflection, 111 GroundVM2000AirReflection, << 127 GroundVM2000GlueReflection }; 112 GroundVM2000GlueReflection, << 113 Dichroic, << 114 CoatedDielectricReflection, << 115 CoatedDielectricRefraction, << 116 CoatedDielectricFrustratedTransmission << 117 }; << 118 128 119 class G4OpBoundaryProcess : public G4VDiscrete 129 class G4OpBoundaryProcess : public G4VDiscreteProcess 120 { 130 { 121 public: << 122 explicit G4OpBoundaryProcess(const G4String& << 123 G4ProcessType t << 124 virtual ~G4OpBoundaryProcess(); << 125 131 126 virtual G4bool IsApplicable( << 132 private: 127 const G4ParticleDefinition& aParticleType) << 133 128 // Returns true -> 'is applicable' only for << 134 ////////////// >> 135 // Operators >> 136 ////////////// >> 137 >> 138 // G4OpBoundaryProcess& operator=(const G4OpBoundaryProcess &right); >> 139 >> 140 // G4OpBoundaryProcess(const G4OpBoundaryProcess &right); 129 141 130 virtual G4double GetMeanFreePath(const G4Tra << 142 public: // Without description 131 G4ForceCond << 132 // Returns infinity; i. e. the process does << 133 // 'Forced' condition for the DoIt to be inv << 134 // at a boundary will any action be taken. << 135 143 136 G4VParticleChange* PostStepDoIt(const G4Trac << 144 //////////////////////////////// 137 const G4Step << 145 // Constructors and Destructor 138 // This is the method implementing boundary << 146 //////////////////////////////// 139 147 140 virtual G4OpBoundaryProcessStatus GetStatus( << 148 G4OpBoundaryProcess(const G4String& processName = "OpBoundary", 141 // Returns the current status. << 149 G4ProcessType type = fOptical); 142 150 143 virtual void SetInvokeSD(G4bool); << 151 ~G4OpBoundaryProcess(); 144 // Set flag for call to InvokeSD method. << 145 152 146 virtual void PreparePhysicsTable(const G4Par << 153 //////////// >> 154 // Methods >> 155 //////////// 147 156 148 virtual void Initialise(); << 157 public: // With description 149 158 150 void SetVerboseLevel(G4int); << 159 G4bool IsApplicable(const G4ParticleDefinition& aParticleType); >> 160 // Returns true -> 'is applicable' only for an optical photon. 151 161 152 private: << 162 G4double GetMeanFreePath(const G4Track& , 153 G4OpBoundaryProcess(const G4OpBoundaryProces << 163 G4double , 154 G4OpBoundaryProcess& operator=(const G4OpBou << 164 G4ForceCondition* condition); >> 165 // Returns infinity; i. e. the process does not limit the step, >> 166 // but sets the 'Forced' condition for the DoIt to be invoked at >> 167 // every step. However, only at a boundary will any action be >> 168 // taken. 155 169 156 G4bool G4BooleanRand(const G4double prob) co << 170 G4VParticleChange* PostStepDoIt(const G4Track& aTrack, >> 171 const G4Step& aStep); >> 172 // This is the method implementing boundary processes. 157 173 158 G4ThreeVector GetFacetNormal(const G4ThreeVe << 174 G4OpticalSurfaceModel GetModel() const; 159 const G4ThreeVe << 175 // Returns the optical surface mode. 160 176 161 void DielectricMetal(); << 177 G4OpBoundaryProcessStatus GetStatus() const; 162 void DielectricDielectric(); << 178 // Returns the current status. 163 179 164 void DielectricLUT(); << 180 void SetModel(G4OpticalSurfaceModel model); 165 void DielectricLUTDAVIS(); << 181 // Set the optical surface model to be followed >> 182 // (glisur || unified || LUT). 166 183 167 void DielectricDichroic(); << 184 private: 168 void CoatedDielectricDielectric(); << 169 185 170 void ChooseReflection(); << 186 G4bool G4BooleanRand(const G4double prob) const; 171 void DoAbsorption(); << 172 void DoReflection(); << 173 187 174 G4double GetIncidentAngle(); << 188 G4ThreeVector GetFacetNormal(const G4ThreeVector& Momentum, 175 // Returns the incident angle of optical pho << 189 const G4ThreeVector& Normal) const; 176 190 177 G4double GetReflectivity(G4double E1_perp, G << 191 void DielectricMetal(); 178 G4double incidentan << 192 void DielectricDielectric(); 179 G4double ImaginaryR << 193 void DielectricLUT(); 180 // Returns the Reflectivity on a metallic su << 181 194 182 G4double GetReflectivityThroughThinLayer(G4d << 195 void ChooseReflection(); 183 G4d << 196 void DoAbsorption(); 184 G4d << 197 void DoReflection(); 185 // Returns the Reflectivity on a coated surf << 186 198 187 void CalculateReflectivity(); << 199 G4double GetIncidentAngle(); >> 200 // Returns the incident angle of optical photon 188 201 189 void BoundaryProcessVerbose() const; << 202 G4double GetReflectivity(G4double E1_perp, >> 203 G4double E1_parl, >> 204 G4double incidentangle, >> 205 G4double RealRindex, >> 206 G4double ImaginaryRindex); >> 207 // Returns the Reflectivity on a metalic surface 190 208 191 // Invoke SD for post step point if the phot << 209 void CalculateReflectivity(void); 192 G4bool InvokeSD(const G4Step* step); << 193 210 194 G4ThreeVector fOldMomentum; << 211 void BoundaryProcessVerbose(void) const; 195 G4ThreeVector fOldPolarization; << 196 212 197 G4ThreeVector fNewMomentum; << 213 private: 198 G4ThreeVector fNewPolarization; << 199 214 200 G4ThreeVector fGlobalNormal; << 215 G4double thePhotonMomentum; 201 G4ThreeVector fFacetNormal; << 202 216 203 const G4Material* fMaterial1; << 217 G4ThreeVector OldMomentum; 204 const G4Material* fMaterial2; << 218 G4ThreeVector OldPolarization; 205 219 206 G4OpticalSurface* fOpticalSurface; << 220 G4ThreeVector NewMomentum; >> 221 G4ThreeVector NewPolarization; 207 222 208 G4MaterialPropertyVector* fRealRIndexMPV; << 223 G4ThreeVector theGlobalNormal; 209 G4MaterialPropertyVector* fImagRIndexMPV; << 224 G4ThreeVector theFacetNormal; 210 G4Physics2DVector* fDichroicVector; << 211 225 212 G4double fPhotonMomentum; << 226 G4Material* Material1; 213 G4double fRindex1; << 227 G4Material* Material2; 214 G4double fRindex2; << 215 228 216 G4double fSint1; << 229 G4OpticalSurface* OpticalSurface; 217 230 218 G4double fReflectivity; << 231 G4MaterialPropertyVector* PropertyPointer; 219 G4double fEfficiency; << 232 G4MaterialPropertyVector* PropertyPointer1; 220 G4double fTransmittance; << 233 G4MaterialPropertyVector* PropertyPointer2; 221 G4double fSurfaceRoughness; << 222 234 223 G4double fProb_sl, fProb_ss, fProb_bs; << 235 G4double Rindex1; 224 G4double fCarTolerance; << 236 G4double Rindex2; 225 237 226 // Used by CoatedDielectricDielectric() << 238 G4double cost1, cost2, sint1, sint2; 227 G4double fCoatedRindex, fCoatedThickness; << 228 239 229 G4OpBoundaryProcessStatus fStatus; << 240 G4OpBoundaryProcessStatus theStatus; 230 G4OpticalSurfaceModel fModel; << 231 G4OpticalSurfaceFinish fFinish; << 232 241 233 G4int f_iTE, f_iTM; << 242 G4OpticalSurfaceModel theModel; 234 243 235 G4int fNumSmallStepWarnings = 0; // number o << 244 G4OpticalSurfaceFinish theFinish; 236 G4int fNumBdryTypeWarnings = 0; // number o << 237 245 238 size_t idx_dichroicX = 0; << 246 G4double theReflectivity; 239 size_t idx_dichroicY = 0; << 247 G4double theEfficiency; 240 size_t idx_rindex1 = 0; << 248 G4double theTransmittance; 241 size_t idx_rindex_surface = 0; << 249 G4double prob_sl, prob_ss, prob_bs; 242 size_t idx_reflect = 0; << 243 size_t idx_eff = 0; << 244 size_t idx_trans = 0; << 245 size_t idx_lobe = 0; << 246 size_t idx_spike = 0; << 247 size_t idx_back = 0; << 248 size_t idx_rindex2 = 0; << 249 size_t idx_groupvel = 0; << 250 size_t idx_rrindex = 0; << 251 size_t idx_irindex = 0; << 252 size_t idx_coatedrindex = 0; << 253 250 254 // Used by CoatedDielectricDielectric() << 251 G4int iTE, iTM; 255 G4bool fCoatedFrustratedTransmission = true; << 252 >> 253 G4double kCarTolerance; 256 254 257 G4bool fInvokeSD; << 258 }; 255 }; 259 256 260 //////////////////// 257 //////////////////// 261 // Inline methods 258 // Inline methods 262 //////////////////// 259 //////////////////// 263 260 264 inline G4bool G4OpBoundaryProcess::G4BooleanRa << 261 inline >> 262 G4bool G4OpBoundaryProcess::G4BooleanRand(const G4double prob) const 265 { 263 { 266 // Returns a random boolean variable with th << 264 /* Returns a random boolean variable with the specified probability */ >> 265 267 return (G4UniformRand() < prob); 266 return (G4UniformRand() < prob); 268 } 267 } 269 268 270 inline G4bool G4OpBoundaryProcess::IsApplicabl << 269 inline 271 const G4ParticleDefinition& aParticleType) << 270 G4bool G4OpBoundaryProcess::IsApplicable(const G4ParticleDefinition& >> 271 aParticleType) 272 { 272 { 273 return (&aParticleType == G4OpticalPhoton::O << 273 return ( &aParticleType == G4OpticalPhoton::OpticalPhoton() ); 274 } 274 } 275 275 276 inline G4OpBoundaryProcessStatus G4OpBoundaryP << 276 inline >> 277 G4OpticalSurfaceModel G4OpBoundaryProcess::GetModel() const 277 { 278 { 278 return fStatus; << 279 return theModel; 279 } 280 } 280 281 281 inline void G4OpBoundaryProcess::ChooseReflect << 282 inline >> 283 G4OpBoundaryProcessStatus G4OpBoundaryProcess::GetStatus() const 282 { 284 { 283 G4double rand = G4UniformRand(); << 285 return theStatus; 284 if(rand < fProb_ss) << 285 { << 286 fStatus = SpikeReflection; << 287 fFacetNormal = fGlobalNormal; << 288 } << 289 else if(rand < fProb_ss + fProb_sl) << 290 { << 291 fStatus = LobeReflection; << 292 } << 293 else if(rand < fProb_ss + fProb_sl + fProb_b << 294 { << 295 fStatus = BackScattering; << 296 } << 297 else << 298 { << 299 fStatus = LambertianReflection; << 300 } << 301 } 286 } 302 287 303 inline void G4OpBoundaryProcess::DoAbsorption( << 288 inline >> 289 void G4OpBoundaryProcess::SetModel(G4OpticalSurfaceModel model) 304 { 290 { 305 fStatus = Absorption; << 291 theModel = model; >> 292 } 306 293 307 if(G4BooleanRand(fEfficiency)) << 294 inline 308 { << 295 void G4OpBoundaryProcess::ChooseReflection() 309 // EnergyDeposited =/= 0 means: photon has << 296 { 310 fStatus = Detection; << 297 G4double rand = G4UniformRand(); 311 aParticleChange.ProposeLocalEnergyDeposit( << 298 if ( rand >= 0.0 && rand < prob_ss ) { 312 } << 299 theStatus = SpikeReflection; 313 else << 300 theFacetNormal = theGlobalNormal; 314 { << 301 } 315 aParticleChange.ProposeLocalEnergyDeposit( << 302 else if ( rand >= prob_ss && 316 } << 303 rand <= prob_ss+prob_sl) { >> 304 theStatus = LobeReflection; >> 305 } >> 306 else if ( rand > prob_ss+prob_sl && >> 307 rand < prob_ss+prob_sl+prob_bs ) { >> 308 theStatus = BackScattering; >> 309 } >> 310 else { >> 311 theStatus = LambertianReflection; >> 312 } >> 313 } 317 314 318 fNewMomentum = fOldMomentum; << 315 inline 319 fNewPolarization = fOldPolarization; << 316 void G4OpBoundaryProcess::DoAbsorption() >> 317 { >> 318 theStatus = Absorption; 320 319 321 aParticleChange.ProposeTrackStatus(fStopAndK << 320 if ( G4BooleanRand(theEfficiency) ) { >> 321 >> 322 // EnergyDeposited =/= 0 means: photon has been detected >> 323 theStatus = Detection; >> 324 aParticleChange.ProposeLocalEnergyDeposit(thePhotonMomentum); >> 325 } >> 326 else { >> 327 aParticleChange.ProposeLocalEnergyDeposit(0.0); >> 328 } >> 329 >> 330 NewMomentum = OldMomentum; >> 331 NewPolarization = OldPolarization; >> 332 >> 333 // aParticleChange.ProposeEnergy(0.0); >> 334 aParticleChange.ProposeTrackStatus(fStopAndKill); 322 } 335 } 323 336 324 inline void G4OpBoundaryProcess::DoReflection( << 337 inline >> 338 void G4OpBoundaryProcess::DoReflection() 325 { 339 { 326 if(fStatus == LambertianReflection) << 340 if ( theStatus == LambertianReflection ) { 327 { << 341 328 fNewMomentum = G4LambertianRand(fGlobalNor << 342 NewMomentum = G4LambertianRand(theGlobalNormal); 329 fFacetNormal = (fNewMomentum - fOldMomentu << 343 theFacetNormal = (NewMomentum - OldMomentum).unit(); 330 } << 344 331 else if(fFinish == ground) << 345 } 332 { << 346 else if ( theFinish == ground ) { 333 fStatus = LobeReflection; << 347 334 if(!fRealRIndexMPV || !fImagRIndexMPV) << 348 theStatus = LobeReflection; 335 { << 349 if ( PropertyPointer1 && PropertyPointer2 ){ 336 fFacetNormal = GetFacetNormal(fOldMoment << 350 } else { 337 } << 351 theFacetNormal = 338 // else << 352 GetFacetNormal(OldMomentum,theGlobalNormal); 339 // complex ref. index to be implemented << 353 } 340 fNewMomentum = << 354 G4double PdotN = OldMomentum * theFacetNormal; 341 fOldMomentum - (2. * fOldMomentum * fFac << 355 NewMomentum = OldMomentum - (2.*PdotN)*theFacetNormal; 342 } << 356 343 else << 357 } 344 { << 358 else { 345 fStatus = SpikeReflection; << 359 346 fFacetNormal = fGlobalNormal; << 360 theStatus = SpikeReflection; 347 fNewMomentum = << 361 theFacetNormal = theGlobalNormal; 348 fOldMomentum - (2. * fOldMomentum * fFac << 362 G4double PdotN = OldMomentum * theFacetNormal; 349 } << 363 NewMomentum = OldMomentum - (2.*PdotN)*theFacetNormal; 350 fNewPolarization = << 364 351 -fOldPolarization + (2. * fOldPolarization << 365 } >> 366 G4double EdotN = OldPolarization * theFacetNormal; >> 367 NewPolarization = -OldPolarization + (2.*EdotN)*theFacetNormal; 352 } 368 } 353 369 354 #endif /* G4OpBoundaryProcess_h */ 370 #endif /* G4OpBoundaryProcess_h */ 355 371