Import Geant4 7.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 11:11:55 +02:00
parent e083ffb441
commit 516dbf1a58
5914 changed files with 202605 additions and 71141 deletions
+6 -2
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.2 2003/10/03 15:43:10 gcosmo Exp $
# $Id: GNUmakefile,v 1.3 2004/10/28 14:26:38 gcosmo Exp $
# ------------------------------------------------------------
# GNUmakefile for optical photons library. G.Folger 10-Dec-97.
# ------------------------------------------------------------
@@ -22,5 +22,9 @@ CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/materials/include
ifdef G4OPTICAL_DEBUG
CPPFLAGS += -DG4OPTICAL_DEBUG
endif
include $(G4INSTALL)/config/common.gmk
+33
View File
@@ -16,6 +16,39 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
10th December 2004 Gabriele Cosmo (op-V06-02-06)
replaced M_PI with CLHEP's pi
02nd December 2004 Peter Gumplinger (op-V06-02-05)
migration to cmath
28th October 2004 Gabriele Cosmo (op-V06-02-04)
Added G4OPTICAL_DEBUG flag for debug printout.
18th October 2004 Peter Gumplinger (op-V06-02-03)
Fix bug in DielectricMetal only GetFacetNormal for
LobeReflection.
Migrate files to 7.0 ParticleChange method names:
G4OpBoundaryProcess.hh, G4OpBoundaryProcess.cc,
G4OpWLS.cc, G4OpRayleigh.cc, G4OpAbsorption.cc
27th September 2004 Peter Gumplinger (op-V06-02-02)
Fix bug in G4PlaneVectorRand and resample
theFacetNormal for LobeReflection in DielectricMetal
12th August 2004 Peter Gumplinger (op-V06-02-01)
In G4OpBoundaryProcess.cc: use GetMaterial from
G4StepPoint directly; apply/sample reflectivity and
Unified model reflection parameters only once even
for rough dielectric/metal surfaces - i.e. not again
even when reflected ray still points toward the
surface - fixes problem report 654.
05th August 2004 Peter Gumplinger (op-V06-02-00)
Allow for unified model reflectivity parameters
to also work in case of dielectric_metal surfaces;
addresses in part problem report 654.
26th April 2004 Peter Gumplinger (op-V06-01-01)
Protect against NULL pointers in G4OpRayleigh.
Do not overwrite Rayleigh scattering length
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpAbsorption.hh,v 1.7 2001/08/31 16:43:32 gum Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
////////////////////////////////////////////////////////////////////////
// Optical Photon Absorption Class Definition
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpBoundaryProcess.hh,v 1.9 2004/02/19 20:41:34 gum Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4OpBoundaryProcess.hh,v 1.12 2004/12/02 23:10:36 gum Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
////////////////////////////////////////////////////////////////////////
@@ -307,10 +307,11 @@ G4ThreeVector G4OpBoundaryProcess::
G4ThreeVector vec2 = vec1.cross(normal);
G4double cost = 2.*G4UniformRand() - 1.0;
G4double sint = sqrt(1.0 - cost * cost);
G4double phi = twopi*G4UniformRand();
G4double cosphi = std::cos(phi);
G4double sinphi = std::sin(phi);
return cost * vec1 + sint * vec2;
return cosphi * vec1 + sinphi * vec2;
}
inline
@@ -368,17 +369,17 @@ void G4OpBoundaryProcess::DoAbsorption()
// EnergyDeposited =/= 0 means: photon has been detected
theStatus = Detection;
aParticleChange.SetLocalEnergyDeposit(thePhotonMomentum);
aParticleChange.ProposeLocalEnergyDeposit(thePhotonMomentum);
}
else {
aParticleChange.SetLocalEnergyDeposit(0.0);
aParticleChange.ProposeLocalEnergyDeposit(0.0);
}
NewMomentum = OldMomentum;
NewPolarization = OldPolarization;
// aParticleChange.SetEnergyChange(0.0);
aParticleChange.SetStatusChange(fStopAndKill);
// aParticleChange.ProposeEnergy(0.0);
aParticleChange.ProposeTrackStatus(fStopAndKill);
}
inline
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpRayleigh.hh,v 1.7 2004/04/27 00:26:34 gum Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
////////////////////////////////////////////////////////////////////////
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4OpWLS.hh,v 1.1 2003/09/23 22:23:57 gum Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
////////////////////////////////////////////////////////////////////////
// Optical Photon WaveLength Shifting (WLS) Class Definition
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpAbsorption.cc,v 1.4 2001/07/11 10:08:22 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4OpAbsorption.cc,v 1.5 2004/10/19 02:15:15 gum Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
////////////////////////////////////////////////////////////////////////
// Optical Photon Absorption Class Implementation
@@ -95,7 +95,7 @@ G4OpAbsorption::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
{
aParticleChange.Initialize(aTrack);
aParticleChange.SetStatusChange(fStopAndKill);
aParticleChange.ProposeTrackStatus(fStopAndKill);
if (verboseLevel>0) {
G4cout << "\n** Photon absorbed! **" << G4endl;
@@ -39,7 +39,7 @@
// method: GetLocalExitNormal(&valid) to get
// the surface normal in all cases
// 1998-11-07 - NULL OpticalSurface pointer before use
// comparison not sharp for: abs(cost1) < 1.0
// comparison not sharp for: std::abs(cost1) < 1.0
// remove sin1, sin2 in lines 556,567
// (thanks to Stefano Magni)
// 1999-10-10 - Accommodate changes done in DoAbsorption by
@@ -132,10 +132,8 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
Material1 = pPreStepPoint ->GetPhysicalVolume()->
GetLogicalVolume()->GetMaterial();
Material2 = pPostStepPoint->GetPhysicalVolume()->
GetLogicalVolume()->GetMaterial();
Material1 = pPreStepPoint -> GetMaterial();
Material2 = pPostStepPoint -> GetMaterial();
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
@@ -152,7 +150,7 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
}
else {
theStatus = NoRINDEX;
aParticleChange.SetStatusChange(fStopAndKill);
aParticleChange.ProposeTrackStatus(fStopAndKill);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
@@ -161,7 +159,7 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
}
else {
theStatus = NoRINDEX;
aParticleChange.SetStatusChange(fStopAndKill);
aParticleChange.ProposeTrackStatus(fStopAndKill);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
@@ -224,7 +222,7 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
}
else {
theStatus = NoRINDEX;
aParticleChange.SetStatusChange(fStopAndKill);
aParticleChange.ProposeTrackStatus(fStopAndKill);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
}
@@ -280,7 +278,7 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
}
else if (theFinish == polishedbackpainted ||
theFinish == groundbackpainted ) {
aParticleChange.SetStatusChange(fStopAndKill);
aParticleChange.ProposeTrackStatus(fStopAndKill);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
}
@@ -301,7 +299,7 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
}
else {
theStatus = NoRINDEX;
aParticleChange.SetStatusChange(fStopAndKill);
aParticleChange.ProposeTrackStatus(fStopAndKill);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
}
@@ -339,7 +337,14 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
theGlobalNormal = theNavigator->GetLocalToGlobalTransform().
TransformAxis(theLocalNormal);
if (OldMomentum * theGlobalNormal > 0.0) {
#ifdef G4DEBUG_OPTICAL
G4cerr << " G4OpBoundaryProcess/PostStepDoIt(): "
<< " theGlobalNormal points the wrong direction "
<< G4endl;
#endif
theGlobalNormal = -theGlobalNormal;
}
if (type == dielectric_metal) {
DielectricMetal();
@@ -395,10 +400,18 @@ G4OpBoundaryProcess::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
G4cout << " *** Absorption *** " << G4endl;
if ( theStatus == Detection )
G4cout << " *** Detection *** " << G4endl;
if ( theStatus == NotAtBoundary )
G4cout << " *** NotAtBoundary *** " << G4endl;
if ( theStatus == SameMaterial )
G4cout << " *** SameMaterial *** " << G4endl;
if ( theStatus == StepTooSmall )
G4cout << " *** StepTooSmall *** " << G4endl;
if ( theStatus == NoRINDEX )
G4cout << " *** NoRINDEX *** " << G4endl;
}
aParticleChange.SetMomentumChange(NewMomentum);
aParticleChange.SetPolarizationChange(NewPolarization);
aParticleChange.ProposeMomentumDirection(NewMomentum);
aParticleChange.ProposePolarization(NewPolarization);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
@@ -412,7 +425,7 @@ G4OpBoundaryProcess::GetFacetNormal(const G4ThreeVector& Momentum,
if (theModel == unified) {
/* This function code alpha to a random value taken from the
distribution p(alpha) = g(alpha; 0, sigma_alpha)*sin(alpha),
distribution p(alpha) = g(alpha; 0, sigma_alpha)*std::sin(alpha),
for alpha > 0 and alpha < 90, where g(alpha; 0, sigma_alpha)
is a gaussian distribution with mean 0 and standard deviation
sigma_alpha. */
@@ -427,14 +440,14 @@ G4OpBoundaryProcess::GetFacetNormal(const G4ThreeVector& Momentum,
do {
do {
alpha = G4RandGauss::shoot(0.0,sigma_alpha);
} while (G4UniformRand()*f_max > sin(alpha) || alpha >= halfpi );
} while (G4UniformRand()*f_max > std::sin(alpha) || alpha >= halfpi );
G4double phi = G4UniformRand()*twopi;
G4double SinAlpha = sin(alpha);
G4double CosAlpha = cos(alpha);
G4double SinPhi = sin(phi);
G4double CosPhi = cos(phi);
G4double SinAlpha = std::sin(alpha);
G4double CosAlpha = std::cos(alpha);
G4double SinPhi = std::sin(phi);
G4double CosPhi = std::cos(phi);
G4double unit_x = SinAlpha * CosPhi;
G4double unit_y = SinAlpha * SinPhi;
@@ -476,16 +489,48 @@ G4OpBoundaryProcess::GetFacetNormal(const G4ThreeVector& Momentum,
void G4OpBoundaryProcess::DielectricMetal()
{
do {
if( !G4BooleanRand(theReflectivity) ) {
G4int n = 0;
DoAbsorption();
do {
n++;
if( !G4BooleanRand(theReflectivity) && n == 1 ) {
DoAbsorption();
break;
}
else {
DoReflection();
if ( theModel == glisur || theFinish == polished ||
prob_ss+prob_sl+prob_bs == 0.0 ) {
DoReflection();
} else {
if ( n == 1 ) ChooseReflection();
if ( theStatus == LambertianReflection ) {
DoReflection();
}
else if ( theStatus == BackScattering ) {
NewMomentum = -OldMomentum;
NewPolarization = -OldPolarization;
}
else {
if(theStatus==LobeReflection)theFacetNormal =
GetFacetNormal(OldMomentum,theGlobalNormal);
G4double PdotN = OldMomentum * theFacetNormal;
NewMomentum = OldMomentum - (2.*PdotN)*theFacetNormal;
G4double EdotN = OldPolarization * theFacetNormal;
NewPolarization = -OldPolarization + (2.*EdotN)*theFacetNormal;
}
}
OldMomentum = NewMomentum;
OldPolarization = NewPolarization;
@@ -527,8 +572,8 @@ void G4OpBoundaryProcess::DielectricDielectric()
G4double EdotN = OldPolarization * theFacetNormal;
cost1 = - PdotN;
if (abs(cost1) < 1.0-kCarTolerance){
sint1 = sqrt(1-cost1*cost1);
if (std::abs(cost1) < 1.0-kCarTolerance){
sint1 = std::sqrt(1.-cost1*cost1);
sint2 = sint1*Rindex1/Rindex2; // *** Snell's Law ***
}
else {
@@ -568,10 +613,10 @@ void G4OpBoundaryProcess::DielectricDielectric()
// Calculate amplitude for transmission (Q = P x N)
if (cost1 > 0.0) {
cost2 = sqrt(1-sint2*sint2);
cost2 = std::sqrt(1.-sint2*sint2);
}
else {
cost2 = -sqrt(1-sint2*sint2);
cost2 = -std::sqrt(1.-sint2*sint2);
}
G4ThreeVector A_trans, A_paral, E1pp, E1pl;
@@ -618,6 +663,7 @@ void G4OpBoundaryProcess::DielectricDielectric()
if (Swap) Swap = !Swap;
theStatus = FresnelReflection;
if ( theModel == unified && theFinish != polished )
ChooseReflection();
@@ -640,7 +686,7 @@ void G4OpBoundaryProcess::DielectricDielectric()
E2_total = E2_perp*E2_perp + E2_parl*E2_parl;
A_paral = NewMomentum.cross(A_trans);
A_paral = A_paral.unit();
E2_abs = sqrt(E2_total);
E2_abs = std::sqrt(E2_total);
C_parl = E2_parl/E2_abs;
C_perp = E2_perp/E2_abs;
@@ -676,7 +722,7 @@ void G4OpBoundaryProcess::DielectricDielectric()
PdotN = -cost2;
A_paral = NewMomentum.cross(A_trans);
A_paral = A_paral.unit();
E2_abs = sqrt(E2_total);
E2_abs = std::sqrt(E2_total);
C_parl = E2_parl/E2_abs;
C_perp = E2_perp/E2_abs;
+12 -12
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpRayleigh.cc,v 1.10 2004/04/27 00:27:30 gum Exp $
// GEANT4 tag $Name: geant4-06-02 $
// $Id: G4OpRayleigh.cc,v 1.12 2004/12/02 23:10:57 gum Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
////////////////////////////////////////////////////////////////////////
@@ -127,8 +127,8 @@ G4OpRayleigh::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
G4double rand = G4UniformRand();
G4double CosTheta = pow(rand, 1./3.);
G4double SinTheta = sqrt(1.-CosTheta*CosTheta);
G4double CosTheta = std::pow(rand, 1./3.);
G4double SinTheta = std::sqrt(1.-CosTheta*CosTheta);
if(G4UniformRand() < 0.5)CosTheta = -CosTheta;
@@ -137,8 +137,8 @@ G4OpRayleigh::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
rand = G4UniformRand();
G4double Phi = twopi*rand;
G4double SinPhi = sin(Phi);
G4double CosPhi = cos(Phi);
G4double SinPhi = std::sin(Phi);
G4double CosPhi = std::cos(Phi);
G4double unit_x = SinTheta * CosPhi;
G4double unit_y = SinTheta * SinPhi;
@@ -164,19 +164,19 @@ G4OpRayleigh::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
if(G4UniformRand() < 0.5)NewMomentumDirection = -NewMomentumDirection;
NewMomentumDirection = NewMomentumDirection.unit();
aParticleChange.SetPolarizationChange(NewPolarization);
aParticleChange.ProposePolarization(NewPolarization);
aParticleChange.SetMomentumChange(NewMomentumDirection);
aParticleChange.ProposeMomentumDirection(NewMomentumDirection);
if (verboseLevel>0) {
G4cout << "New Polarization: "
<< NewPolarization << G4endl;
G4cout << "Polarization Change: "
<< *(aParticleChange.GetPolarizationChange()) << G4endl;
<< *(aParticleChange.GetPolarization()) << G4endl;
G4cout << "New Momentum Direction: "
<< NewMomentumDirection << G4endl;
G4cout << "Momentum Change: "
<< *(aParticleChange.GetMomentumChange()) << G4endl;
<< *(aParticleChange.GetMomentumDirection()) << G4endl;
}
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
@@ -332,8 +332,8 @@ G4OpRayleigh::RayleighAttenuationLengthGenerator(G4MaterialPropertiesTable *aMPT
}
c1 = 1 / (6.0 * pi);
c2 = pow((2.0 * pi / xlambda), 4);
c3 = pow( ( (refsq - 1.0) * (refsq + 2.0) / 3.0 ), 2);
c2 = std::pow((2.0 * pi / xlambda), 4);
c3 = std::pow( ( (refsq - 1.0) * (refsq + 2.0) / 3.0 ), 2);
c4 = betat * temp * kboltz;
Dist = 1.0 / (c1*c2*c3*c4);
+10 -10
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4OpWLS.cc,v 1.2 2003/12/01 15:20:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4OpWLS.cc,v 1.5 2004/12/10 18:53:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-05 $
//
////////////////////////////////////////////////////////////////////////
// Optical Photon WaveLength Shifting (WLS) Class Implementation
@@ -87,7 +87,7 @@ G4OpWLS::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
{
aParticleChange.Initialize(aTrack);
aParticleChange.SetStatusChange(fStopAndKill);
aParticleChange.ProposeTrackStatus(fStopAndKill);
if (verboseLevel>0) {
G4cout << "\n** Photon absorbed! **" << G4endl;
@@ -145,11 +145,11 @@ G4OpWLS::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
// Generate random photon direction
G4double cost = 1. - 2.*G4UniformRand();
G4double sint = sqrt((1.-cost)*(1.+cost));
G4double sint = std::sqrt((1.-cost)*(1.+cost));
G4double phi = 2*M_PI*G4UniformRand();
G4double sinp = sin(phi);
G4double cosp = cos(phi);
G4double phi = twopi*G4UniformRand();
G4double sinp = std::sin(phi);
G4double cosp = std::cos(phi);
G4double px = sint*cosp;
G4double py = sint*sinp;
@@ -169,9 +169,9 @@ G4OpWLS::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
G4ThreeVector perp = photonMomentum.cross(photonPolarization);
phi = 2*M_PI*G4UniformRand();
sinp = sin(phi);
cosp = cos(phi);
phi = twopi*G4UniformRand();
sinp = std::sin(phi);
cosp = std::cos(phi);
photonPolarization = cosp * photonPolarization + sinp * perp;