Ignore:
Timestamp:
May 28, 2009, 4:26:57 PM (15 years ago)
Author:
garnier
Message:

maj sur la beta de geant 4.9.3

File:
1 edited

Legend:

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

    r1007 r1055  
    178178        else {
    179179          G4cerr << " G4OpBoundaryProcess/PostStepDoIt(): "
    180                << " The Navigator reports that it returned an invalid normal"
    181                << G4endl;
     180                 << " The Navigator reports that it returned an invalid normal"
     181                 << G4endl;
     182          G4Exception("G4OpBoundaryProcess::PostStepDoIt",
     183                      "Invalid Surface Normal",
     184                      EventMustBeAborted,
     185                      "Geometry must return valid surface normal");
    182186        }
    183187
     
    282286              }
    283287
    284               G4MaterialPropertyVector* PropertyPointer;
    285               G4MaterialPropertyVector* PropertyPointer1;
    286               G4MaterialPropertyVector* PropertyPointer2;
    287 
    288288              PropertyPointer =
    289289                      aMaterialPropertiesTable->GetProperty("REFLECTIVITY");
     
    303303              } else if (PropertyPointer1 && PropertyPointer2) {
    304304
    305                  G4double RealRindex =
    306                           PropertyPointer1->GetProperty(thePhotonMomentum);
    307                  G4double ImaginaryRindex =
    308                           PropertyPointer2->GetProperty(thePhotonMomentum);
    309 
    310                  // calculate FacetNormal
    311                  if ( theFinish == ground ) {
    312                     theFacetNormal =
    313                               GetFacetNormal(OldMomentum, theGlobalNormal);
    314                  } else {
    315                     theFacetNormal = theGlobalNormal;
    316                  }
    317 
    318                  G4double PdotN = OldMomentum * theFacetNormal;
    319                  cost1 = -PdotN;
    320 
    321                  if (std::abs(cost1) < 1.0 - kCarTolerance) {
    322                     sint1 = std::sqrt(1. - cost1*cost1);
    323                  } else {
    324                     sint1 = 0.0;
    325                  }
    326 
    327                  G4ThreeVector A_trans, A_paral, E1pp, E1pl;
    328                  G4double E1_perp, E1_parl;
    329 
    330                  if (sint1 > 0.0 ) {
    331                     A_trans = OldMomentum.cross(theFacetNormal);
    332                     A_trans = A_trans.unit();
    333                     E1_perp = OldPolarization * A_trans;
    334                     E1pp    = E1_perp * A_trans;
    335                     E1pl    = OldPolarization - E1pp;
    336                     E1_parl = E1pl.mag();
    337                  }
    338                  else {
    339                     A_trans  = OldPolarization;
    340                     // Here we Follow Jackson's conventions and we set the
    341                     // parallel component = 1 in case of a ray perpendicular
    342                     // to the surface
    343                     E1_perp  = 0.0;
    344                     E1_parl  = 1.0;
    345                  }
    346 
    347                  //calculate incident angle
    348                  G4double incidentangle = GetIncidentAngle();
    349 
    350                  //calculate the reflectivity depending on incident angle,
    351                  //polarization and complex refractive
    352 
    353                  theReflectivity =
    354                             GetReflectivity(E1_perp, E1_parl, incidentangle,
    355                                                  RealRindex, ImaginaryRindex);
     305                 CalculateReflectivity();
    356306
    357307              } else {
     
    591541           if( !G4BooleanRand(theReflectivity) && n == 1 ) {
    592542
    593              // Comment out DoAbsorption if you wish to have
    594              //       Transmission instead of Absorption
     543             // Comment out DoAbsorption and uncomment theStatus = Absorption;
     544             // if you wish to have Transmission instead of Absorption
    595545
    596546             DoAbsorption();
    597              theStatus = Absorption;
     547             // theStatus = Absorption;
    598548             break;
    599549
    600550           }
    601551           else {
     552
     553             if (PropertyPointer1 && PropertyPointer2) {
     554                if ( n > 1 ) {
     555                   CalculateReflectivity();
     556                   if ( !G4BooleanRand(theReflectivity) ) {
     557                      DoAbsorption();
     558                      break;
     559                   }
     560                }
     561             }
    602562
    603563             if ( theModel == glisur || theFinish == polished ) {
     
    618578                else {
    619579
    620                    if(theStatus==LobeReflection)theFacetNormal =
    621                              GetFacetNormal(OldMomentum,theGlobalNormal);
     580                   if(theStatus==LobeReflection){
     581                     if ( PropertyPointer1 && PropertyPointer2 ){
     582                     } else {
     583                        theFacetNormal =
     584                            GetFacetNormal(OldMomentum,theGlobalNormal);
     585                     }
     586                   }
    622587
    623588                   G4double PdotN = OldMomentum * theFacetNormal;
     
    962927
    963928  do {
    964      if(G4UniformRand()*real(Reflectivity) > real(Reflectivity_TE))iTE = -1;
    965      if(G4UniformRand()*real(Reflectivity) > real(Reflectivity_TM))iTM = -1;
     929     if(G4UniformRand()*real(Reflectivity) > real(Reflectivity_TE))
     930       {iTE = -1;}else{iTE = 1;}
     931     if(G4UniformRand()*real(Reflectivity) > real(Reflectivity_TM))
     932       {iTM = -1;}else{iTM = 1;}
    966933  } while(iTE<0&&iTM<0);
    967934
     
    969936
    970937}
     938
     939void G4OpBoundaryProcess::CalculateReflectivity()
     940{
     941  G4double RealRindex =
     942           PropertyPointer1->GetProperty(thePhotonMomentum);
     943  G4double ImaginaryRindex =
     944           PropertyPointer2->GetProperty(thePhotonMomentum);
     945
     946  // calculate FacetNormal
     947  if ( theFinish == ground ) {
     948     theFacetNormal =
     949               GetFacetNormal(OldMomentum, theGlobalNormal);
     950  } else {
     951     theFacetNormal = theGlobalNormal;
     952  }
     953
     954  G4double PdotN = OldMomentum * theFacetNormal;
     955  cost1 = -PdotN;
     956
     957  if (std::abs(cost1) < 1.0 - kCarTolerance) {
     958     sint1 = std::sqrt(1. - cost1*cost1);
     959  } else {
     960     sint1 = 0.0;
     961  }
     962
     963  G4ThreeVector A_trans, A_paral, E1pp, E1pl;
     964  G4double E1_perp, E1_parl;
     965
     966  if (sint1 > 0.0 ) {
     967     A_trans = OldMomentum.cross(theFacetNormal);
     968     A_trans = A_trans.unit();
     969     E1_perp = OldPolarization * A_trans;
     970     E1pp    = E1_perp * A_trans;
     971     E1pl    = OldPolarization - E1pp;
     972     E1_parl = E1pl.mag();
     973  }
     974  else {
     975     A_trans  = OldPolarization;
     976     // Here we Follow Jackson's conventions and we set the
     977     // parallel component = 1 in case of a ray perpendicular
     978     // to the surface
     979     E1_perp  = 0.0;
     980     E1_parl  = 1.0;
     981  }
     982
     983  //calculate incident angle
     984  G4double incidentangle = GetIncidentAngle();
     985
     986  //calculate the reflectivity depending on incident angle,
     987  //polarization and complex refractive
     988
     989  theReflectivity =
     990             GetReflectivity(E1_perp, E1_parl, incidentangle,
     991                                                 RealRindex, ImaginaryRindex);
     992}
Note: See TracChangeset for help on using the changeset viewer.