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