Ignore:
Timestamp:
Nov 25, 2009, 5:13:58 PM (15 years ago)
Author:
garnier
Message:

update CVS release candidate geant4.9.3.01

Location:
trunk/source/processes/optical/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/optical/src/G4OpAbsorption.cc

    r1007 r1196  
    2626//
    2727// $Id: G4OpAbsorption.cc,v 1.9 2008/10/24 19:52:28 gum Exp $
    28 // GEANT4 tag $Name: geant4-09-02 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030////////////////////////////////////////////////////////////////////////
  • trunk/source/processes/optical/src/G4OpBoundaryProcess.cc

    r1055 r1196  
    5959//                           of refraction - Thanks to Sehwook Lee and John
    6060//                           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.)
    6166//
    6267// Author:      Peter Gumplinger
     
    140145        G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
    141146
     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
    142155        if (pPostStepPoint->GetStepStatus() != fGeomBoundary){
    143156                theStatus = NotAtBoundary;
     157                if ( verboseLevel > 0) BoundaryProcessVerbose();
    144158                return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
    145159        }
    146160        if (aTrack.GetStepLength()<=kCarTolerance/2){
    147161                theStatus = StepTooSmall;
     162                if ( verboseLevel > 0) BoundaryProcessVerbose();
    148163                return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
    149164        }
     
    157172        OldMomentum       = aParticle->GetMomentumDirection();
    158173        OldPolarization   = aParticle->GetPolarization();
     174
     175        if ( verboseLevel > 0 ) {
     176           G4cout << " Old Momentum Direction: " << OldMomentum     << G4endl;
     177           G4cout << " Old Polarization:       " << OldPolarization << G4endl;
     178        }
    159179
    160180        G4ThreeVector theGlobalPoint = pPostStepPoint->GetPosition();
     
    207227        else {
    208228                theStatus = NoRINDEX;
     229                if ( verboseLevel > 0) BoundaryProcessVerbose();
    209230                aParticleChange.ProposeTrackStatus(fStopAndKill);
    210231                return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
     
    216237        else {
    217238                theStatus = NoRINDEX;
     239                if ( verboseLevel > 0) BoundaryProcessVerbose();
    218240                aParticleChange.ProposeTrackStatus(fStopAndKill);
    219241                return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
    220242        }
     243
     244        theReflectivity = 1.;
     245        theEfficiency   = 0.;
    221246
    222247        theModel = glisur;
     
    281306                  else {
    282307                     theStatus = NoRINDEX;
     308                     if ( verboseLevel > 0) BoundaryProcessVerbose();
    283309                     aParticleChange.ProposeTrackStatus(fStopAndKill);
    284310                     return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
     
    305331                 CalculateReflectivity();
    306332
    307               } else {
    308                  theReflectivity = 1.0;
    309333              }
    310334
     
    314338                      theEfficiency =
    315339                      PropertyPointer->GetProperty(thePhotonMomentum);
    316               } else {
    317                       theEfficiency = 0.0;
    318340              }
    319341
     
    359381              if (Material1 == Material2){
    360382                 theStatus = SameMaterial;
     383                 if ( verboseLevel > 0) BoundaryProcessVerbose();
    361384                 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
    362385              }
     
    370393              else {
    371394                 theStatus = NoRINDEX;
     395                 if ( verboseLevel > 0) BoundaryProcessVerbose();
    372396                 aParticleChange.ProposeTrackStatus(fStopAndKill);
    373397                 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
    374398              }
    375399           }
    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;
    382400        }
    383401
     
    393411
    394412        }
     413        else if (type == dielectric_LUT) {
     414
     415          DielectricLUT();
     416
     417        }
    395418        else if (type == dielectric_dielectric) {
    396419
    397420          if ( theFinish == polishedfrontpainted ||
    398421               theFinish == groundfrontpainted ) {
    399 
    400422                  if( !G4BooleanRand(theReflectivity) ) {
    401423                    DoAbsorption();
     
    408430          }
    409431          else {
    410                   DielectricDielectric();
     432                  if( !G4BooleanRand(theReflectivity) ) {
     433                    DoAbsorption();
     434                  }
     435                  else {
     436                    DielectricDielectric();
     437                  }
    411438          }
    412439        }
     
    422449
    423450        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();
    454454        }
    455455
     
    458458
    459459        return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
     460}
     461
     462void 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;
    460540}
    461541
     
    466546        G4ThreeVector FacetNormal;
    467547
    468         if (theModel == unified) {
     548        if (theModel == unified || theModel == LUT) {
    469549
    470550        /* This function code alpha to a random value taken from the
     
    622702}
    623703
     704void 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
    624764void G4OpBoundaryProcess::DielectricDielectric()
    625765{
  • trunk/source/processes/optical/src/G4OpRayleigh.cc

    r1007 r1196  
    2626//
    2727// $Id: G4OpRayleigh.cc,v 1.17 2008/10/24 19:51:12 gum Exp $
    28 // GEANT4 tag $Name: geant4-09-02 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/source/processes/optical/src/G4OpWLS.cc

    r1007 r1196  
    2626//
    2727// $Id: G4OpWLS.cc,v 1.13 2008/10/24 19:50:50 gum Exp $
    28 // GEANT4 tag $Name: geant4-09-02 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.