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