Changeset 1196 for trunk/source/processes/optical/src
- Timestamp:
- Nov 25, 2009, 5:13:58 PM (15 years ago)
- Location:
- trunk/source/processes/optical/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/optical/src/G4OpAbsorption.cc
r1007 r1196 26 26 // 27 27 // $Id: G4OpAbsorption.cc,v 1.9 2008/10/24 19:52:28 gum Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2$28 // GEANT4 tag $Name: geant4-09-03-cand-01 $ 29 29 // 30 30 //////////////////////////////////////////////////////////////////////// -
trunk/source/processes/optical/src/G4OpBoundaryProcess.cc
r1055 r1196 59 59 // of refraction - Thanks to Sehwook Lee and John 60 60 // Hauptman (Dept. of Physics - Iowa State Univ.) 61 // 2009-11-10 - add capability of simulating surface reflections 62 // with Look-Up-Tables (LUT) containing measured 63 // optical reflectance for a variety of surface 64 // treatments - Thanks to Martin Janecek and 65 // William Moses (Lawrence Berkeley National Lab.) 61 66 // 62 67 // Author: Peter Gumplinger … … 140 145 G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint(); 141 146 147 if ( verboseLevel > 0 ) { 148 G4cout << " Photon at Boundary! " << G4endl; 149 G4VPhysicalVolume* thePrePV = pPreStepPoint->GetPhysicalVolume(); 150 G4VPhysicalVolume* thePostPV = pPostStepPoint->GetPhysicalVolume(); 151 if (thePrePV) G4cout << " thePrePV: " << thePrePV->GetName() << G4endl; 152 if (thePostPV) G4cout << " thePostPV: " << thePostPV->GetName() << G4endl; 153 } 154 142 155 if (pPostStepPoint->GetStepStatus() != fGeomBoundary){ 143 156 theStatus = NotAtBoundary; 157 if ( verboseLevel > 0) BoundaryProcessVerbose(); 144 158 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); 145 159 } 146 160 if (aTrack.GetStepLength()<=kCarTolerance/2){ 147 161 theStatus = StepTooSmall; 162 if ( verboseLevel > 0) BoundaryProcessVerbose(); 148 163 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); 149 164 } … … 157 172 OldMomentum = aParticle->GetMomentumDirection(); 158 173 OldPolarization = aParticle->GetPolarization(); 174 175 if ( verboseLevel > 0 ) { 176 G4cout << " Old Momentum Direction: " << OldMomentum << G4endl; 177 G4cout << " Old Polarization: " << OldPolarization << G4endl; 178 } 159 179 160 180 G4ThreeVector theGlobalPoint = pPostStepPoint->GetPosition(); … … 207 227 else { 208 228 theStatus = NoRINDEX; 229 if ( verboseLevel > 0) BoundaryProcessVerbose(); 209 230 aParticleChange.ProposeTrackStatus(fStopAndKill); 210 231 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); … … 216 237 else { 217 238 theStatus = NoRINDEX; 239 if ( verboseLevel > 0) BoundaryProcessVerbose(); 218 240 aParticleChange.ProposeTrackStatus(fStopAndKill); 219 241 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); 220 242 } 243 244 theReflectivity = 1.; 245 theEfficiency = 0.; 221 246 222 247 theModel = glisur; … … 281 306 else { 282 307 theStatus = NoRINDEX; 308 if ( verboseLevel > 0) BoundaryProcessVerbose(); 283 309 aParticleChange.ProposeTrackStatus(fStopAndKill); 284 310 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); … … 305 331 CalculateReflectivity(); 306 332 307 } else {308 theReflectivity = 1.0;309 333 } 310 334 … … 314 338 theEfficiency = 315 339 PropertyPointer->GetProperty(thePhotonMomentum); 316 } else {317 theEfficiency = 0.0;318 340 } 319 341 … … 359 381 if (Material1 == Material2){ 360 382 theStatus = SameMaterial; 383 if ( verboseLevel > 0) BoundaryProcessVerbose(); 361 384 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); 362 385 } … … 370 393 else { 371 394 theStatus = NoRINDEX; 395 if ( verboseLevel > 0) BoundaryProcessVerbose(); 372 396 aParticleChange.ProposeTrackStatus(fStopAndKill); 373 397 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); 374 398 } 375 399 } 376 }377 378 if ( verboseLevel > 0 ) {379 G4cout << " Photon at Boundary! " << G4endl;380 G4cout << " Old Momentum Direction: " << OldMomentum << G4endl;381 G4cout << " Old Polarization: " << OldPolarization << G4endl;382 400 } 383 401 … … 393 411 394 412 } 413 else if (type == dielectric_LUT) { 414 415 DielectricLUT(); 416 417 } 395 418 else if (type == dielectric_dielectric) { 396 419 397 420 if ( theFinish == polishedfrontpainted || 398 421 theFinish == groundfrontpainted ) { 399 400 422 if( !G4BooleanRand(theReflectivity) ) { 401 423 DoAbsorption(); … … 408 430 } 409 431 else { 410 DielectricDielectric(); 432 if( !G4BooleanRand(theReflectivity) ) { 433 DoAbsorption(); 434 } 435 else { 436 DielectricDielectric(); 437 } 411 438 } 412 439 } … … 422 449 423 450 if ( verboseLevel > 0) { 424 G4cout << " New Momentum Direction: " << NewMomentum << G4endl; 425 G4cout << " New Polarization: " << NewPolarization << G4endl; 426 if ( theStatus == Undefined ) 427 G4cout << " *** Undefined *** " << G4endl; 428 if ( theStatus == FresnelRefraction ) 429 G4cout << " *** FresnelRefraction *** " << G4endl; 430 if ( theStatus == FresnelReflection ) 431 G4cout << " *** FresnelReflection *** " << G4endl; 432 if ( theStatus == TotalInternalReflection ) 433 G4cout << " *** TotalInternalReflection *** " << G4endl; 434 if ( theStatus == LambertianReflection ) 435 G4cout << " *** LambertianReflection *** " << G4endl; 436 if ( theStatus == LobeReflection ) 437 G4cout << " *** LobeReflection *** " << G4endl; 438 if ( theStatus == SpikeReflection ) 439 G4cout << " *** SpikeReflection *** " << G4endl; 440 if ( theStatus == BackScattering ) 441 G4cout << " *** BackScattering *** " << G4endl; 442 if ( theStatus == Absorption ) 443 G4cout << " *** Absorption *** " << G4endl; 444 if ( theStatus == Detection ) 445 G4cout << " *** Detection *** " << G4endl; 446 if ( theStatus == NotAtBoundary ) 447 G4cout << " *** NotAtBoundary *** " << G4endl; 448 if ( theStatus == SameMaterial ) 449 G4cout << " *** SameMaterial *** " << G4endl; 450 if ( theStatus == StepTooSmall ) 451 G4cout << " *** StepTooSmall *** " << G4endl; 452 if ( theStatus == NoRINDEX ) 453 G4cout << " *** NoRINDEX *** " << G4endl; 451 G4cout << " New Momentum Direction: " << NewMomentum << G4endl; 452 G4cout << " New Polarization: " << NewPolarization << G4endl; 453 BoundaryProcessVerbose(); 454 454 } 455 455 … … 458 458 459 459 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); 460 } 461 462 void G4OpBoundaryProcess::BoundaryProcessVerbose() const 463 { 464 if ( theStatus == Undefined ) 465 G4cout << " *** Undefined *** " << G4endl; 466 if ( theStatus == FresnelRefraction ) 467 G4cout << " *** FresnelRefraction *** " << G4endl; 468 if ( theStatus == FresnelReflection ) 469 G4cout << " *** FresnelReflection *** " << G4endl; 470 if ( theStatus == TotalInternalReflection ) 471 G4cout << " *** TotalInternalReflection *** " << G4endl; 472 if ( theStatus == LambertianReflection ) 473 G4cout << " *** LambertianReflection *** " << G4endl; 474 if ( theStatus == LobeReflection ) 475 G4cout << " *** LobeReflection *** " << G4endl; 476 if ( theStatus == SpikeReflection ) 477 G4cout << " *** SpikeReflection *** " << G4endl; 478 if ( theStatus == BackScattering ) 479 G4cout << " *** BackScattering *** " << G4endl; 480 if ( theStatus == PolishedLumirrorAirReflection ) 481 G4cout << " *** PolishedLumirrorAirReflection *** " << G4endl; 482 if ( theStatus == PolishedLumirrorGlueReflection ) 483 G4cout << " *** PolishedLumirrorGlueReflection *** " << G4endl; 484 if ( theStatus == PolishedAirReflection ) 485 G4cout << " *** PolishedAirReflection *** " << G4endl; 486 if ( theStatus == PolishedTeflonAirReflection ) 487 G4cout << " *** PolishedTeflonAirReflection *** " << G4endl; 488 if ( theStatus == PolishedTiOAirReflection ) 489 G4cout << " *** PolishedTiOAirReflection *** " << G4endl; 490 if ( theStatus == PolishedTyvekAirReflection ) 491 G4cout << " *** PolishedTyvekAirReflection *** " << G4endl; 492 if ( theStatus == PolishedVM2000AirReflection ) 493 G4cout << " *** PolishedVM2000AirReflection *** " << G4endl; 494 if ( theStatus == PolishedVM2000GlueReflection ) 495 G4cout << " *** PolishedVM2000GlueReflection *** " << G4endl; 496 if ( theStatus == EtchedLumirrorAirReflection ) 497 G4cout << " *** EtchedLumirrorAirReflection *** " << G4endl; 498 if ( theStatus == EtchedLumirrorGlueReflection ) 499 G4cout << " *** EtchedLumirrorGlueReflection *** " << G4endl; 500 if ( theStatus == EtchedAirReflection ) 501 G4cout << " *** EtchedAirReflection *** " << G4endl; 502 if ( theStatus == EtchedTeflonAirReflection ) 503 G4cout << " *** EtchedTeflonAirReflection *** " << G4endl; 504 if ( theStatus == EtchedTiOAirReflection ) 505 G4cout << " *** EtchedTiOAirReflection *** " << G4endl; 506 if ( theStatus == EtchedTyvekAirReflection ) 507 G4cout << " *** EtchedTyvekAirReflection *** " << G4endl; 508 if ( theStatus == EtchedVM2000AirReflection ) 509 G4cout << " *** EtchedVM2000AirReflection *** " << G4endl; 510 if ( theStatus == EtchedVM2000GlueReflection ) 511 G4cout << " *** EtchedVM2000GlueReflection *** " << G4endl; 512 if ( theStatus == GroundLumirrorAirReflection ) 513 G4cout << " *** GroundLumirrorAirReflection *** " << G4endl; 514 if ( theStatus == GroundLumirrorGlueReflection ) 515 G4cout << " *** GroundLumirrorGlueReflection *** " << G4endl; 516 if ( theStatus == GroundAirReflection ) 517 G4cout << " *** GroundAirReflection *** " << G4endl; 518 if ( theStatus == GroundTeflonAirReflection ) 519 G4cout << " *** GroundTeflonAirReflection *** " << G4endl; 520 if ( theStatus == GroundTiOAirReflection ) 521 G4cout << " *** GroundTiOAirReflection *** " << G4endl; 522 if ( theStatus == GroundTyvekAirReflection ) 523 G4cout << " *** GroundTyvekAirReflection *** " << G4endl; 524 if ( theStatus == GroundVM2000AirReflection ) 525 G4cout << " *** GroundVM2000AirReflection *** " << G4endl; 526 if ( theStatus == GroundVM2000GlueReflection ) 527 G4cout << " *** GroundVM2000GlueReflection *** " << G4endl; 528 if ( theStatus == Absorption ) 529 G4cout << " *** Absorption *** " << G4endl; 530 if ( theStatus == Detection ) 531 G4cout << " *** Detection *** " << G4endl; 532 if ( theStatus == NotAtBoundary ) 533 G4cout << " *** NotAtBoundary *** " << G4endl; 534 if ( theStatus == SameMaterial ) 535 G4cout << " *** SameMaterial *** " << G4endl; 536 if ( theStatus == StepTooSmall ) 537 G4cout << " *** StepTooSmall *** " << G4endl; 538 if ( theStatus == NoRINDEX ) 539 G4cout << " *** NoRINDEX *** " << G4endl; 460 540 } 461 541 … … 466 546 G4ThreeVector FacetNormal; 467 547 468 if (theModel == unified ) {548 if (theModel == unified || theModel == LUT) { 469 549 470 550 /* This function code alpha to a random value taken from the … … 622 702 } 623 703 704 void G4OpBoundaryProcess::DielectricLUT() 705 { 706 G4int thetaIndex, phiIndex; 707 G4double AngularDistributionValue, thetaRad, phiRad, EdotN; 708 G4ThreeVector PerpendicularVectorTheta, PerpendicularVectorPhi; 709 710 theStatus = G4OpBoundaryProcessStatus(G4int(theFinish) + 711 (G4int(NoRINDEX)-G4int(groundbackpainted))); 712 713 G4int thetaIndexMax = OpticalSurface->GetThetaIndexMax(); 714 G4int phiIndexMax = OpticalSurface->GetPhiIndexMax(); 715 716 do { 717 if ( !G4BooleanRand(theReflectivity) ) // Not reflected, so Absorbed 718 DoAbsorption(); 719 else { 720 // Calculate Angle between Normal and Photon Momentum 721 G4double anglePhotonToNormal = 722 OldMomentum.angle(-theGlobalNormal); 723 // Round it to closest integer 724 G4int angleIncident = G4int(floor(180/pi*anglePhotonToNormal+0.5)); 725 726 // Take random angles THETA and PHI, 727 // and see if below Probability - if not - Redo 728 do { 729 thetaIndex = CLHEP::RandFlat::shootInt(thetaIndexMax-1); 730 phiIndex = CLHEP::RandFlat::shootInt(phiIndexMax-1); 731 // Find probability with the new indeces from LUT 732 AngularDistributionValue = OpticalSurface -> 733 GetAngularDistributionValue(angleIncident, 734 thetaIndex, 735 phiIndex); 736 } while ( !G4BooleanRand(AngularDistributionValue) ); 737 738 thetaRad = (-90 + 4*thetaIndex)*pi/180; 739 phiRad = (-90 + 5*phiIndex)*pi/180; 740 // Rotate Photon Momentum in Theta, then in Phi 741 NewMomentum = -OldMomentum; 742 PerpendicularVectorTheta = NewMomentum.cross(theGlobalNormal); 743 if (PerpendicularVectorTheta.mag() > kCarTolerance ) { 744 PerpendicularVectorPhi = 745 PerpendicularVectorTheta.cross(NewMomentum); 746 } 747 else { 748 PerpendicularVectorTheta = NewMomentum.orthogonal(); 749 PerpendicularVectorPhi = 750 PerpendicularVectorTheta.cross(NewMomentum); 751 } 752 NewMomentum = 753 NewMomentum.rotate(anglePhotonToNormal-thetaRad, 754 PerpendicularVectorTheta); 755 NewMomentum = NewMomentum.rotate(-phiRad,PerpendicularVectorPhi); 756 // Rotate Polarization too: 757 theFacetNormal = (NewMomentum - OldMomentum).unit(); 758 EdotN = OldPolarization * theFacetNormal; 759 NewPolarization = -OldPolarization + (2.*EdotN)*theFacetNormal; 760 } 761 } while (NewMomentum * theGlobalNormal <= 0.0); 762 } 763 624 764 void G4OpBoundaryProcess::DielectricDielectric() 625 765 { -
trunk/source/processes/optical/src/G4OpRayleigh.cc
r1007 r1196 26 26 // 27 27 // $Id: G4OpRayleigh.cc,v 1.17 2008/10/24 19:51:12 gum Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2$28 // GEANT4 tag $Name: geant4-09-03-cand-01 $ 29 29 // 30 30 // -
trunk/source/processes/optical/src/G4OpWLS.cc
r1007 r1196 26 26 // 27 27 // $Id: G4OpWLS.cc,v 1.13 2008/10/24 19:50:50 gum Exp $ 28 // GEANT4 tag $Name: geant4-09-0 2$28 // GEANT4 tag $Name: geant4-09-03-cand-01 $ 29 29 // 30 30 ////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.