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