Import Geant4 3.1.0 source tree
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4OpAbsorption.cc,v 1.3 2000/09/19 03:19:17 gum Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Optical Photon Absorption Class Implementation
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4OpRayleigh.cc,v 1.2 1999/12/15 14:53:45 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4OpRayleigh.cc,v 1.5 2001/01/31 04:08:12 gum Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -19,7 +19,13 @@
|
||||
// Version: 1.0
|
||||
// Created: 1996-05-31
|
||||
// Author: Juliet Armstrong
|
||||
// Updated: 1997-04-09 by Peter Gumplinger
|
||||
// Updated: 2001-01-30 by Peter Gumplinger
|
||||
// > allow for positiv and negative CosTheta and force the
|
||||
// > new momentum direction to be in the same plane as the
|
||||
// > new and old polarization vectors
|
||||
// 2001-01-29 by Peter Gumplinger
|
||||
// > fix calculation of SinTheta (from CosTheta)
|
||||
// 1997-04-09 by Peter Gumplinger
|
||||
// > new physics/tracking scheme
|
||||
// mail: gum@triumf.ca
|
||||
//
|
||||
@@ -101,7 +107,9 @@ G4OpRayleigh::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
G4double rand = G4UniformRand();
|
||||
|
||||
G4double CosTheta = pow(rand, 1./3.);
|
||||
G4double SinTheta = 1.-CosTheta*CosTheta;
|
||||
G4double SinTheta = sqrt(1.-CosTheta*CosTheta);
|
||||
|
||||
if(G4UniformRand() < 0.5)CosTheta = -CosTheta;
|
||||
|
||||
// find azimuthal angle w.r.t old polarization vector
|
||||
|
||||
@@ -120,35 +128,24 @@ G4OpRayleigh::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
// Rotate new polarization direction into global reference system
|
||||
|
||||
G4ThreeVector OldPolarization = aParticle->GetPolarization();
|
||||
OldPolarization = OldPolarization.unit();
|
||||
|
||||
NewPolarization.rotateUz(OldPolarization);
|
||||
NewPolarization = NewPolarization.unit();
|
||||
|
||||
// -- new momentum direction is normal to the new polarization
|
||||
// vector (components below expressed in reference system where
|
||||
// new polarization vector is aligned with the z axis)
|
||||
// -- new momentum direction is normal to the new
|
||||
// polarization vector and in the same plane as the
|
||||
// old and new polarization vectors --
|
||||
|
||||
SinTheta = 1.0;
|
||||
CosTheta = 0.0;
|
||||
G4ThreeVector NewMomentumDirection =
|
||||
OldPolarization - NewPolarization * CosTheta;
|
||||
|
||||
rand = G4UniformRand();
|
||||
if(G4UniformRand() < 0.5)NewMomentumDirection = -NewMomentumDirection;
|
||||
NewMomentumDirection = NewMomentumDirection.unit();
|
||||
|
||||
Phi = twopi * rand;
|
||||
SinPhi = sin(Phi);
|
||||
CosPhi = cos(Phi);
|
||||
aParticleChange.SetPolarizationChange(NewPolarization);
|
||||
|
||||
unit_x = SinTheta*CosPhi;
|
||||
unit_y = SinTheta*SinPhi;
|
||||
unit_z = CosTheta;
|
||||
|
||||
G4ThreeVector NewMomentumDirection(unit_x,unit_y,unit_z);
|
||||
|
||||
// Rotate New momentum direction vector into global reference system
|
||||
|
||||
NewMomentumDirection.rotateUz(NewPolarization);
|
||||
|
||||
aParticleChange.SetPolarizationChange(NewPolarization.unit());
|
||||
|
||||
aParticleChange.SetMomentumChange(NewMomentumDirection.unit());
|
||||
aParticleChange.SetMomentumChange(NewMomentumDirection);
|
||||
|
||||
if (verboseLevel>0) {
|
||||
G4cout << "New Polarization: "
|
||||
@@ -215,14 +212,36 @@ G4double G4OpRayleigh::GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double thePhotonMomentum = aParticle->GetTotalMomentum();
|
||||
|
||||
G4double AttenuationLength = DBL_MAX;
|
||||
G4bool isOutRange;
|
||||
|
||||
if (aMaterial->GetName() == "Water")
|
||||
{
|
||||
AttenuationLength =
|
||||
if (aMaterial->GetName() == "Water") {
|
||||
|
||||
G4bool isOutRange;
|
||||
|
||||
AttenuationLength =
|
||||
(*thePhysicsTable)(aMaterial->GetIndex())->
|
||||
GetValue(thePhotonMomentum, isOutRange);
|
||||
GetValue(thePhotonMomentum, isOutRange);
|
||||
}
|
||||
else {
|
||||
|
||||
G4MaterialPropertiesTable* aMaterialPropertyTable =
|
||||
aMaterial->GetMaterialPropertiesTable();
|
||||
|
||||
if(aMaterialPropertyTable){
|
||||
G4MaterialPropertyVector* AttenuationLengthVector =
|
||||
aMaterialPropertyTable->GetProperty("RAYLEIGH");
|
||||
if(AttenuationLengthVector){
|
||||
AttenuationLength = AttenuationLengthVector ->
|
||||
GetProperty(thePhotonMomentum);
|
||||
}
|
||||
else{
|
||||
// G4cout << "No Rayleigh scattering length specified" << G4endl;
|
||||
}
|
||||
}
|
||||
else{
|
||||
// G4cout << "No Rayleigh scattering length specified" << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
return AttenuationLength;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user