Ignore:
Timestamp:
Apr 6, 2009, 12:34:39 PM (15 years ago)
Author:
garnier
Message:

update processes

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

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/optical/include/G4OpAbsorption.hh

    r819 r963  
    2626//
    2727// $Id: G4OpAbsorption.hh,v 1.9 2006/06/29 21:08:36 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030////////////////////////////////////////////////////////////////////////
  • trunk/source/processes/optical/include/G4OpBoundaryProcess.hh

    r819 r963  
    2525//
    2626//
    27 // $Id: G4OpBoundaryProcess.hh,v 1.16 2007/10/15 21:16:24 gum Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4OpBoundaryProcess.hh,v 1.18 2008/11/07 17:59:37 gum Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    6868#include "geomdefs.hh"
    6969#include "Randomize.hh"
     70
     71#include "G4RandomTools.hh"
     72#include "G4RandomDirection.hh"
     73
    7074#include "G4Step.hh"
    7175#include "G4VDiscreteProcess.hh"
     
    162166private:
    163167
    164         void G4Swap(G4double* a, G4double* b) const;
    165 
    166         void G4Swap(G4Material* a, G4Material* b) const;
    167 
    168         void G4VectorSwap(G4ThreeVector* vec1, G4ThreeVector* vec2) const;
    169 
    170168        G4bool G4BooleanRand(const G4double prob) const;
    171 
    172         G4ThreeVector G4IsotropicRand() const;
    173 
    174         G4ThreeVector G4LambertianRand(const G4ThreeVector& normal);
    175 
    176         G4ThreeVector G4PlaneVectorRand(const G4ThreeVector& normal) const;
    177169
    178170        G4ThreeVector GetFacetNormal(const G4ThreeVector& Momentum,
     
    229221
    230222inline
    231 void G4OpBoundaryProcess::G4Swap(G4double* a, G4double* b) const
    232 {
    233         // swaps the contents of the objects pointed
    234         // to by 'a' and 'b'!
    235 
    236   G4double temp;
    237 
    238   temp = *a;
    239   *a = *b;
    240   *b = temp;
    241 }
    242 
    243 inline
    244 void G4OpBoundaryProcess::G4Swap(G4Material* a, G4Material* b) const
    245 {
    246         // ONLY swaps the pointers; i.e. what used to be pointed
    247         // to by 'a' is now pointed to by 'b' and vice versa!
    248 
    249    G4Material* temp = a;
    250 
    251    a = b;
    252    b = temp;
    253 }
    254 
    255 inline
    256 void G4OpBoundaryProcess::G4VectorSwap(G4ThreeVector* vec1,
    257                                        G4ThreeVector* vec2) const
    258 {
    259         // swaps the contents of the objects pointed
    260         // to by 'vec1' and 'vec2'!
    261 
    262   G4ThreeVector temp;
    263 
    264   temp = *vec1;
    265   *vec1 = *vec2;
    266   *vec2 = temp;
    267 }
    268 
    269 inline
    270223G4bool G4OpBoundaryProcess::G4BooleanRand(const G4double prob) const
    271224{
     
    273226
    274227  return (G4UniformRand() < prob);
    275 }
    276 
    277 inline
    278 G4ThreeVector G4OpBoundaryProcess::G4IsotropicRand() const
    279 {
    280   /* Returns a random isotropic unit vector. */
    281 
    282   G4ThreeVector vect;
    283   G4double len2;
    284 
    285   do {
    286 
    287     vect.setX(G4UniformRand() - 0.5);
    288     vect.setY(G4UniformRand() - 0.5);
    289     vect.setZ(G4UniformRand() - 0.5);
    290 
    291     len2 = vect.mag2();
    292 
    293   } while (len2 < 0.01 || len2 > 0.25);
    294 
    295   return vect.unit();
    296 }
    297 
    298 inline
    299 G4ThreeVector G4OpBoundaryProcess::
    300               G4LambertianRand(const G4ThreeVector& normal)
    301 {
    302   /* Returns a random lambertian unit vector. */
    303 
    304   G4ThreeVector vect;
    305   G4double ndotv;
    306 
    307   do {
    308     vect = G4IsotropicRand();
    309 
    310     ndotv = normal * vect;
    311 
    312     if (ndotv < 0.0) {
    313       vect = -vect;
    314       ndotv = -ndotv;
    315     }
    316 
    317   } while (!G4BooleanRand(ndotv));
    318   return vect;
    319 }
    320 
    321 inline
    322 G4ThreeVector G4OpBoundaryProcess::
    323               G4PlaneVectorRand(const G4ThreeVector& normal) const
    324 
    325   /* This function chooses a random vector within a plane given
    326      by the unit normal */
    327 {
    328   G4ThreeVector vec1 = normal.orthogonal();
    329 
    330   G4ThreeVector vec2 = vec1.cross(normal);
    331 
    332   G4double phi = twopi*G4UniformRand();
    333   G4double cosphi = std::cos(phi);
    334   G4double sinphi = std::sin(phi);
    335 
    336   return cosphi * vec1 + sinphi * vec2;
    337228}
    338229
  • trunk/source/processes/optical/include/G4OpRayleigh.hh

    r819 r963  
    2626//
    2727// $Id: G4OpRayleigh.hh,v 1.9 2006/06/29 21:08:40 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/optical/include/G4OpWLS.hh

    r819 r963  
    2626//
    2727// $Id: G4OpWLS.hh,v 1.4 2006/06/29 21:08:42 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.