Changeset 963 for trunk/source/processes/optical/include
- Timestamp:
- Apr 6, 2009, 12:34:39 PM (15 years ago)
- Location:
- trunk/source/processes/optical/include
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/optical/include/G4OpAbsorption.hh
r819 r963 26 26 // 27 27 // $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 $ 29 29 // 30 30 //////////////////////////////////////////////////////////////////////// -
trunk/source/processes/optical/include/G4OpBoundaryProcess.hh
r819 r963 25 25 // 26 26 // 27 // $Id: G4OpBoundaryProcess.hh,v 1.1 6 2007/10/15 21:16:24gum 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 $ 29 29 // 30 30 // … … 68 68 #include "geomdefs.hh" 69 69 #include "Randomize.hh" 70 71 #include "G4RandomTools.hh" 72 #include "G4RandomDirection.hh" 73 70 74 #include "G4Step.hh" 71 75 #include "G4VDiscreteProcess.hh" … … 162 166 private: 163 167 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 170 168 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;177 169 178 170 G4ThreeVector GetFacetNormal(const G4ThreeVector& Momentum, … … 229 221 230 222 inline 231 void G4OpBoundaryProcess::G4Swap(G4double* a, G4double* b) const232 {233 // swaps the contents of the objects pointed234 // to by 'a' and 'b'!235 236 G4double temp;237 238 temp = *a;239 *a = *b;240 *b = temp;241 }242 243 inline244 void G4OpBoundaryProcess::G4Swap(G4Material* a, G4Material* b) const245 {246 // ONLY swaps the pointers; i.e. what used to be pointed247 // 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 inline256 void G4OpBoundaryProcess::G4VectorSwap(G4ThreeVector* vec1,257 G4ThreeVector* vec2) const258 {259 // swaps the contents of the objects pointed260 // to by 'vec1' and 'vec2'!261 262 G4ThreeVector temp;263 264 temp = *vec1;265 *vec1 = *vec2;266 *vec2 = temp;267 }268 269 inline270 223 G4bool G4OpBoundaryProcess::G4BooleanRand(const G4double prob) const 271 224 { … … 273 226 274 227 return (G4UniformRand() < prob); 275 }276 277 inline278 G4ThreeVector G4OpBoundaryProcess::G4IsotropicRand() const279 {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 inline299 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 inline322 G4ThreeVector G4OpBoundaryProcess::323 G4PlaneVectorRand(const G4ThreeVector& normal) const324 325 /* This function chooses a random vector within a plane given326 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;337 228 } 338 229 -
trunk/source/processes/optical/include/G4OpRayleigh.hh
r819 r963 26 26 // 27 27 // $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 $ 29 29 // 30 30 // -
trunk/source/processes/optical/include/G4OpWLS.hh
r819 r963 26 26 // 27 27 // $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 $ 29 29 // 30 30 ////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.