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