Import Geant4 10.6.0.beta source tree
This commit is contained in:
@@ -16,6 +16,10 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
23 May 19: D. Sawkey (op-v10-05-00)
|
||||
- most files: format indentation, parentheses; add C++11 keywords;
|
||||
- some changes to if/else loops and variable names
|
||||
|
||||
25 May 18: D. Sawkey (op-V10-04-00)
|
||||
- G4OpMieHG: change GetProperty from string to enum
|
||||
|
||||
|
||||
@@ -66,53 +66,34 @@
|
||||
// Class inherits publicly from G4VDiscreteProcess
|
||||
// Class Description - End:
|
||||
|
||||
/////////////////////
|
||||
// Class Definition
|
||||
/////////////////////
|
||||
|
||||
class G4OpAbsorption : public G4VDiscreteProcess
|
||||
class G4OpAbsorption : public G4VDiscreteProcess
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////
|
||||
// Constructors and Destructor
|
||||
////////////////////////////////
|
||||
explicit G4OpAbsorption(const G4String& processName = "OpAbsorption",
|
||||
G4ProcessType type = fOptical);
|
||||
virtual ~G4OpAbsorption();
|
||||
|
||||
G4OpAbsorption(const G4String& processName = "OpAbsorption",
|
||||
G4ProcessType type = fOptical);
|
||||
~G4OpAbsorption();
|
||||
|
||||
virtual G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
|
||||
// Returns true -> 'is applicable' only for an optical photon.
|
||||
|
||||
virtual G4double GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double ,
|
||||
G4ForceCondition*) override;
|
||||
// Returns the absorption length for bulk absorption of optical
|
||||
// photons in media with a specified attenuation length.
|
||||
|
||||
virtual G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep) override;
|
||||
// This is the method implementing bulk absorption of optical
|
||||
// photons.
|
||||
|
||||
private:
|
||||
|
||||
G4OpAbsorption(const G4OpAbsorption &right);
|
||||
|
||||
//////////////
|
||||
// Operators
|
||||
//////////////
|
||||
|
||||
G4OpAbsorption& operator=(const G4OpAbsorption &right);
|
||||
|
||||
public:
|
||||
|
||||
////////////
|
||||
// Methods
|
||||
////////////
|
||||
|
||||
G4bool IsApplicable(const G4ParticleDefinition& aParticleType);
|
||||
// Returns true -> 'is applicable' only for an optical photon.
|
||||
|
||||
G4double GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double ,
|
||||
G4ForceCondition* );
|
||||
// Returns the absorption length for bulk absorption of optical
|
||||
// photons in media with a specified attenuation length.
|
||||
|
||||
G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep);
|
||||
// This is the method implementing bulk absorption of optical
|
||||
// photons.
|
||||
|
||||
G4OpAbsorption(const G4OpAbsorption &right) = delete;
|
||||
G4OpAbsorption& operator=(const G4OpAbsorption &right) = delete;
|
||||
};
|
||||
|
||||
////////////////////
|
||||
@@ -122,7 +103,7 @@ public:
|
||||
inline
|
||||
G4bool G4OpAbsorption::IsApplicable(const G4ParticleDefinition& aParticleType)
|
||||
{
|
||||
return ( &aParticleType == G4OpticalPhoton::OpticalPhoton() );
|
||||
return (&aParticleType == G4OpticalPhoton::OpticalPhoton());
|
||||
}
|
||||
|
||||
#endif /* G4OpAbsorption_h */
|
||||
|
||||
@@ -65,10 +65,6 @@
|
||||
#ifndef G4OpBoundaryProcess_h
|
||||
#define G4OpBoundaryProcess_h 1
|
||||
|
||||
/////////////
|
||||
// Includes
|
||||
/////////////
|
||||
|
||||
#include "globals.hh"
|
||||
#include "templates.hh"
|
||||
#include "geomdefs.hh"
|
||||
@@ -92,10 +88,6 @@
|
||||
// Class inherits publicly from G4VDiscreteProcess.
|
||||
// Class Description - End:
|
||||
|
||||
/////////////////////
|
||||
// Class Definition
|
||||
/////////////////////
|
||||
|
||||
enum G4OpBoundaryProcessStatus { Undefined,
|
||||
Transmission, FresnelRefraction,
|
||||
FresnelReflection, TotalInternalReflection,
|
||||
@@ -134,136 +126,114 @@ class G4OpBoundaryProcess : public G4VDiscreteProcess
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////
|
||||
// Constructors and Destructor
|
||||
////////////////////////////////
|
||||
explicit G4OpBoundaryProcess(const G4String& processName = "OpBoundary",
|
||||
G4ProcessType type = fOptical);
|
||||
virtual ~G4OpBoundaryProcess();
|
||||
|
||||
G4OpBoundaryProcess(const G4String& processName = "OpBoundary",
|
||||
G4ProcessType type = fOptical);
|
||||
~G4OpBoundaryProcess();
|
||||
virtual G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
|
||||
// Returns true -> 'is applicable' only for an optical photon.
|
||||
|
||||
virtual G4double GetMeanFreePath(const G4Track&, G4double, G4ForceCondition* condition) override;
|
||||
// Returns infinity; i. e. the process does not limit the step,
|
||||
// but sets the 'Forced' condition for the DoIt to be invoked at
|
||||
// every step. However, only at a boundary will any action be
|
||||
// taken.
|
||||
|
||||
G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep) override;
|
||||
// This is the method implementing boundary processes.
|
||||
|
||||
virtual G4OpBoundaryProcessStatus GetStatus() const;
|
||||
// Returns the current status.
|
||||
|
||||
virtual void SetInvokeSD(G4bool);
|
||||
// Set flag for call to InvokeSD method.
|
||||
|
||||
private:
|
||||
|
||||
G4OpBoundaryProcess(const G4OpBoundaryProcess &right);
|
||||
G4OpBoundaryProcess(const G4OpBoundaryProcess &right) = delete;
|
||||
G4OpBoundaryProcess& operator=(const G4OpBoundaryProcess &right) = delete;
|
||||
|
||||
//////////////
|
||||
// Operators
|
||||
//////////////
|
||||
G4bool G4BooleanRand(const G4double prob) const;
|
||||
|
||||
G4OpBoundaryProcess& operator=(const G4OpBoundaryProcess &right);
|
||||
G4ThreeVector GetFacetNormal(const G4ThreeVector& Momentum,
|
||||
const G4ThreeVector& Normal) const;
|
||||
|
||||
public:
|
||||
void DielectricMetal();
|
||||
void DielectricDielectric();
|
||||
|
||||
////////////
|
||||
// Methods
|
||||
////////////
|
||||
void DielectricLUT();
|
||||
void DielectricLUTDAVIS();
|
||||
|
||||
G4bool IsApplicable(const G4ParticleDefinition& aParticleType);
|
||||
// Returns true -> 'is applicable' only for an optical photon.
|
||||
void DielectricDichroic();
|
||||
|
||||
G4double GetMeanFreePath(const G4Track& ,
|
||||
G4double ,
|
||||
G4ForceCondition* condition);
|
||||
// Returns infinity; i. e. the process does not limit the step,
|
||||
// but sets the 'Forced' condition for the DoIt to be invoked at
|
||||
// every step. However, only at a boundary will any action be
|
||||
// taken.
|
||||
void ChooseReflection();
|
||||
void DoAbsorption();
|
||||
void DoReflection();
|
||||
|
||||
G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep);
|
||||
// This is the method implementing boundary processes.
|
||||
G4double GetIncidentAngle();
|
||||
// Returns the incident angle of optical photon
|
||||
|
||||
G4OpBoundaryProcessStatus GetStatus() const;
|
||||
// Returns the current status.
|
||||
G4double GetReflectivity(G4double E1_perp,
|
||||
G4double E1_parl,
|
||||
G4double incidentangle,
|
||||
G4double RealRindex,
|
||||
G4double ImaginaryRindex);
|
||||
// Returns the Reflectivity on a metalic surface
|
||||
|
||||
void SetInvokeSD(G4bool );
|
||||
// Set flag for call to InvokeSD method.
|
||||
void CalculateReflectivity(void);
|
||||
|
||||
private:
|
||||
void BoundaryProcessVerbose(void) const;
|
||||
|
||||
G4bool G4BooleanRand(const G4double prob) const;
|
||||
// Invoke SD for post step point if the photon is 'detected'
|
||||
G4bool InvokeSD(const G4Step* step);
|
||||
|
||||
G4ThreeVector GetFacetNormal(const G4ThreeVector& Momentum,
|
||||
const G4ThreeVector& Normal) const;
|
||||
G4double thePhotonMomentum;
|
||||
|
||||
void DielectricMetal();
|
||||
void DielectricDielectric();
|
||||
G4ThreeVector OldMomentum;
|
||||
G4ThreeVector OldPolarization;
|
||||
|
||||
void DielectricLUT();
|
||||
void DielectricLUTDAVIS();
|
||||
G4ThreeVector NewMomentum;
|
||||
G4ThreeVector NewPolarization;
|
||||
|
||||
void DielectricDichroic();
|
||||
G4ThreeVector theGlobalNormal;
|
||||
G4ThreeVector theFacetNormal;
|
||||
|
||||
void ChooseReflection();
|
||||
void DoAbsorption();
|
||||
void DoReflection();
|
||||
G4Material* Material1;
|
||||
G4Material* Material2;
|
||||
|
||||
G4double GetIncidentAngle();
|
||||
// Returns the incident angle of optical photon
|
||||
G4OpticalSurface* OpticalSurface;
|
||||
|
||||
G4double GetReflectivity(G4double E1_perp,
|
||||
G4double E1_parl,
|
||||
G4double incidentangle,
|
||||
G4double RealRindex,
|
||||
G4double ImaginaryRindex);
|
||||
// Returns the Reflectivity on a metalic surface
|
||||
G4MaterialPropertyVector* fRealRIndexMPV;
|
||||
G4MaterialPropertyVector* fImagRIndexMPV;
|
||||
|
||||
void CalculateReflectivity(void);
|
||||
G4double Rindex1;
|
||||
G4double Rindex2;
|
||||
|
||||
void BoundaryProcessVerbose(void) const;
|
||||
G4double cost1, cost2, sint1, sint2;
|
||||
|
||||
// Invoke SD for post step point if the photon is 'detected'
|
||||
G4bool InvokeSD(const G4Step* step);
|
||||
G4OpBoundaryProcessStatus theStatus;
|
||||
|
||||
private:
|
||||
G4OpticalSurfaceModel theModel;
|
||||
|
||||
G4double thePhotonMomentum;
|
||||
G4OpticalSurfaceFinish theFinish;
|
||||
|
||||
G4ThreeVector OldMomentum;
|
||||
G4ThreeVector OldPolarization;
|
||||
G4double theReflectivity;
|
||||
G4double theEfficiency;
|
||||
G4double theTransmittance;
|
||||
|
||||
G4ThreeVector NewMomentum;
|
||||
G4ThreeVector NewPolarization;
|
||||
G4double theSurfaceRoughness;
|
||||
|
||||
G4ThreeVector theGlobalNormal;
|
||||
G4ThreeVector theFacetNormal;
|
||||
G4double prob_sl, prob_ss, prob_bs;
|
||||
|
||||
G4Material* Material1;
|
||||
G4Material* Material2;
|
||||
G4int iTE, iTM;
|
||||
|
||||
G4OpticalSurface* OpticalSurface;
|
||||
G4double kCarTolerance;
|
||||
|
||||
G4MaterialPropertyVector* PropertyPointer;
|
||||
G4MaterialPropertyVector* PropertyPointer1;
|
||||
G4MaterialPropertyVector* PropertyPointer2;
|
||||
size_t idx, idy;
|
||||
G4Physics2DVector* DichroicVector;
|
||||
|
||||
G4double Rindex1;
|
||||
G4double Rindex2;
|
||||
|
||||
G4double cost1, cost2, sint1, sint2;
|
||||
|
||||
G4OpBoundaryProcessStatus theStatus;
|
||||
|
||||
G4OpticalSurfaceModel theModel;
|
||||
|
||||
G4OpticalSurfaceFinish theFinish;
|
||||
|
||||
G4double theReflectivity;
|
||||
G4double theEfficiency;
|
||||
G4double theTransmittance;
|
||||
|
||||
G4double theSurfaceRoughness;
|
||||
|
||||
G4double prob_sl, prob_ss, prob_bs;
|
||||
|
||||
G4int iTE, iTM;
|
||||
|
||||
G4double kCarTolerance;
|
||||
|
||||
size_t idx, idy;
|
||||
G4Physics2DVector* DichroicVector;
|
||||
|
||||
G4bool fInvokeSD;
|
||||
G4bool fInvokeSD;
|
||||
};
|
||||
|
||||
////////////////////
|
||||
@@ -274,21 +244,20 @@ inline
|
||||
G4bool G4OpBoundaryProcess::G4BooleanRand(const G4double prob) const
|
||||
{
|
||||
/* Returns a random boolean variable with the specified probability */
|
||||
|
||||
return (G4UniformRand() < prob);
|
||||
}
|
||||
|
||||
inline
|
||||
G4bool G4OpBoundaryProcess::IsApplicable(const G4ParticleDefinition&
|
||||
G4bool G4OpBoundaryProcess::IsApplicable(const G4ParticleDefinition&
|
||||
aParticleType)
|
||||
{
|
||||
return ( &aParticleType == G4OpticalPhoton::OpticalPhoton() );
|
||||
return (&aParticleType == G4OpticalPhoton::OpticalPhoton());
|
||||
}
|
||||
|
||||
inline
|
||||
G4OpBoundaryProcessStatus G4OpBoundaryProcess::GetStatus() const
|
||||
{
|
||||
return theStatus;
|
||||
return theStatus;
|
||||
}
|
||||
|
||||
inline
|
||||
@@ -300,77 +269,67 @@ void G4OpBoundaryProcess::SetInvokeSD(G4bool flag)
|
||||
inline
|
||||
void G4OpBoundaryProcess::ChooseReflection()
|
||||
{
|
||||
G4double rand = G4UniformRand();
|
||||
if ( rand >= 0.0 && rand < prob_ss ) {
|
||||
theStatus = SpikeReflection;
|
||||
theFacetNormal = theGlobalNormal;
|
||||
}
|
||||
else if ( rand >= prob_ss &&
|
||||
rand <= prob_ss+prob_sl) {
|
||||
theStatus = LobeReflection;
|
||||
}
|
||||
else if ( rand > prob_ss+prob_sl &&
|
||||
rand < prob_ss+prob_sl+prob_bs ) {
|
||||
theStatus = BackScattering;
|
||||
}
|
||||
else {
|
||||
theStatus = LambertianReflection;
|
||||
}
|
||||
G4double rand = G4UniformRand();
|
||||
if (rand >= 0.0 && rand < prob_ss) {
|
||||
theStatus = SpikeReflection;
|
||||
theFacetNormal = theGlobalNormal;
|
||||
}
|
||||
else if ( rand >= prob_ss && rand <= prob_ss+prob_sl) {
|
||||
theStatus = LobeReflection;
|
||||
}
|
||||
else if ( rand > prob_ss+prob_sl && rand < prob_ss+prob_sl+prob_bs ) {
|
||||
theStatus = BackScattering;
|
||||
}
|
||||
else {
|
||||
theStatus = LambertianReflection;
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
void G4OpBoundaryProcess::DoAbsorption()
|
||||
{
|
||||
theStatus = Absorption;
|
||||
theStatus = Absorption;
|
||||
|
||||
if ( G4BooleanRand(theEfficiency) ) {
|
||||
if (G4BooleanRand(theEfficiency)) {
|
||||
// EnergyDeposited =/= 0 means: photon has been detected
|
||||
theStatus = Detection;
|
||||
aParticleChange.ProposeLocalEnergyDeposit(thePhotonMomentum);
|
||||
}
|
||||
else {
|
||||
aParticleChange.ProposeLocalEnergyDeposit(0.0);
|
||||
}
|
||||
|
||||
// EnergyDeposited =/= 0 means: photon has been detected
|
||||
theStatus = Detection;
|
||||
aParticleChange.ProposeLocalEnergyDeposit(thePhotonMomentum);
|
||||
}
|
||||
else {
|
||||
aParticleChange.ProposeLocalEnergyDeposit(0.0);
|
||||
}
|
||||
NewMomentum = OldMomentum;
|
||||
NewPolarization = OldPolarization;
|
||||
|
||||
NewMomentum = OldMomentum;
|
||||
NewPolarization = OldPolarization;
|
||||
|
||||
// aParticleChange.ProposeEnergy(0.0);
|
||||
aParticleChange.ProposeTrackStatus(fStopAndKill);
|
||||
aParticleChange.ProposeTrackStatus(fStopAndKill);
|
||||
}
|
||||
|
||||
inline
|
||||
void G4OpBoundaryProcess::DoReflection()
|
||||
{
|
||||
if ( theStatus == LambertianReflection ) {
|
||||
|
||||
NewMomentum = G4LambertianRand(theGlobalNormal);
|
||||
theFacetNormal = (NewMomentum - OldMomentum).unit();
|
||||
|
||||
}
|
||||
else if ( theFinish == ground ) {
|
||||
|
||||
theStatus = LobeReflection;
|
||||
if ( PropertyPointer1 && PropertyPointer2 ){
|
||||
} else {
|
||||
theFacetNormal =
|
||||
GetFacetNormal(OldMomentum,theGlobalNormal);
|
||||
}
|
||||
G4double PdotN = OldMomentum * theFacetNormal;
|
||||
NewMomentum = OldMomentum - (2.*PdotN)*theFacetNormal;
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
theStatus = SpikeReflection;
|
||||
theFacetNormal = theGlobalNormal;
|
||||
G4double PdotN = OldMomentum * theFacetNormal;
|
||||
NewMomentum = OldMomentum - (2.*PdotN)*theFacetNormal;
|
||||
|
||||
}
|
||||
G4double EdotN = OldPolarization * theFacetNormal;
|
||||
NewPolarization = -OldPolarization + (2.*EdotN)*theFacetNormal;
|
||||
if (theStatus == LambertianReflection) {
|
||||
NewMomentum = G4LambertianRand(theGlobalNormal);
|
||||
theFacetNormal = (NewMomentum - OldMomentum).unit();
|
||||
}
|
||||
else if (theFinish == ground) {
|
||||
theStatus = LobeReflection;
|
||||
if (fRealRIndexMPV && fImagRIndexMPV) {
|
||||
//
|
||||
} else {
|
||||
theFacetNormal = GetFacetNormal(OldMomentum,theGlobalNormal);
|
||||
}
|
||||
G4double PdotN = OldMomentum * theFacetNormal;
|
||||
NewMomentum = OldMomentum - (2.*PdotN)*theFacetNormal;
|
||||
}
|
||||
else {
|
||||
theStatus = SpikeReflection;
|
||||
theFacetNormal = theGlobalNormal;
|
||||
G4double PdotN = OldMomentum * theFacetNormal;
|
||||
NewMomentum = OldMomentum - (2.*PdotN)*theFacetNormal;
|
||||
}
|
||||
G4double EdotN = OldPolarization * theFacetNormal;
|
||||
NewPolarization = -OldPolarization + (2.*EdotN)*theFacetNormal;
|
||||
}
|
||||
|
||||
#endif /* G4OpBoundaryProcess_h */
|
||||
|
||||
@@ -50,48 +50,35 @@ class G4OpMieHG : public G4VDiscreteProcess
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////
|
||||
// Constructors and Destructor
|
||||
////////////////////////////////
|
||||
|
||||
G4OpMieHG(const G4String& processName = "OpMieHG",
|
||||
explicit G4OpMieHG(const G4String& processName = "OpMieHG",
|
||||
G4ProcessType type = fOptical);
|
||||
~G4OpMieHG();
|
||||
|
||||
private:
|
||||
|
||||
G4OpMieHG(const G4OpMieHG &right);
|
||||
|
||||
//////////////
|
||||
// Operators
|
||||
//////////////
|
||||
|
||||
G4OpMieHG& operator=(const G4OpMieHG &right);
|
||||
virtual ~G4OpMieHG();
|
||||
|
||||
public:
|
||||
|
||||
////////////
|
||||
// Methods
|
||||
////////////
|
||||
virtual G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
|
||||
// Returns true -> 'is applicable' only for an optical photon.
|
||||
|
||||
G4bool IsApplicable(const G4ParticleDefinition& aParticleType);
|
||||
// Returns true -> 'is applicable' only for an optical photon.
|
||||
virtual G4double GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double,
|
||||
G4ForceCondition*) override;
|
||||
// Return the mean free path of Mie scattering
|
||||
|
||||
G4double GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double,
|
||||
G4ForceCondition* );
|
||||
// Return the mean free path of Mie scattering
|
||||
virtual G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep) override;
|
||||
// This is the method implementing Mie scattering.
|
||||
|
||||
private:
|
||||
|
||||
G4OpMieHG(const G4OpMieHG &right) = delete;
|
||||
G4OpMieHG& operator=(const G4OpMieHG &right) = delete;
|
||||
|
||||
G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep);
|
||||
// This is the method implementing Mie scattering.
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
G4bool G4OpMieHG::IsApplicable(const G4ParticleDefinition& aParticleType)
|
||||
{
|
||||
return ( &aParticleType == G4OpticalPhoton::OpticalPhoton() );
|
||||
return (&aParticleType == G4OpticalPhoton::OpticalPhoton());
|
||||
}
|
||||
|
||||
#endif /* G4OpMieHG_h */
|
||||
|
||||
@@ -47,10 +47,6 @@
|
||||
#ifndef G4OpRayleigh_h
|
||||
#define G4OpRayleigh_h 1
|
||||
|
||||
/////////////
|
||||
// Includes
|
||||
/////////////
|
||||
|
||||
#include "globals.hh"
|
||||
#include "templates.hh"
|
||||
#include "Randomize.hh"
|
||||
@@ -69,87 +65,54 @@
|
||||
// Class inherits publicly from G4VDiscreteProcess.
|
||||
// Class Description - End:
|
||||
|
||||
/////////////////////
|
||||
// Class Definition
|
||||
/////////////////////
|
||||
|
||||
class G4OpRayleigh : public G4VDiscreteProcess
|
||||
class G4OpRayleigh : public G4VDiscreteProcess
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////
|
||||
// Constructors and Destructor
|
||||
////////////////////////////////
|
||||
|
||||
G4OpRayleigh(const G4String& processName = "OpRayleigh",
|
||||
explicit G4OpRayleigh(const G4String& processName = "OpRayleigh",
|
||||
G4ProcessType type = fOptical);
|
||||
~G4OpRayleigh();
|
||||
|
||||
private:
|
||||
|
||||
G4OpRayleigh(const G4OpRayleigh &right);
|
||||
|
||||
//////////////
|
||||
// Operators
|
||||
//////////////
|
||||
|
||||
G4OpRayleigh& operator=(const G4OpRayleigh &right);
|
||||
virtual ~G4OpRayleigh();
|
||||
|
||||
public:
|
||||
|
||||
////////////
|
||||
// Methods
|
||||
////////////
|
||||
virtual G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
|
||||
// Returns true -> 'is applicable' only for an optical photon.
|
||||
|
||||
G4bool IsApplicable(const G4ParticleDefinition& aParticleType);
|
||||
// Returns true -> 'is applicable' only for an optical photon.
|
||||
virtual void BuildPhysicsTable(const G4ParticleDefinition& aParticleType) override;
|
||||
// Build thePhysicsTable at a right time
|
||||
|
||||
void BuildPhysicsTable(const G4ParticleDefinition& aParticleType);
|
||||
// Build thePhysicsTable at a right time
|
||||
virtual G4double GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double,
|
||||
G4ForceCondition*) override;
|
||||
// Returns the mean free path for Rayleigh scattering
|
||||
|
||||
G4double GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double ,
|
||||
G4ForceCondition* );
|
||||
// Returns the mean free path for Rayleigh scattering in water.
|
||||
// --- Not yet implemented for other materials! ---
|
||||
virtual G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep) override;
|
||||
// This is the method implementing Rayleigh scattering.
|
||||
|
||||
G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep);
|
||||
// This is the method implementing Rayleigh scattering.
|
||||
virtual G4PhysicsTable* GetPhysicsTable() const;
|
||||
// Returns the address of the physics table.
|
||||
|
||||
G4PhysicsTable* GetPhysicsTable() const;
|
||||
// Returns the address of the physics table.
|
||||
|
||||
void DumpPhysicsTable() const;
|
||||
// Prints the physics table.
|
||||
|
||||
private:
|
||||
|
||||
/////////////////////
|
||||
// Helper Functions
|
||||
/////////////////////
|
||||
|
||||
/// Calculates the mean free paths for a material as a function of
|
||||
/// photon energy
|
||||
///
|
||||
/// @param[in] material information
|
||||
/// @return the mean free path vector
|
||||
G4PhysicsOrderedFreeVector*
|
||||
CalculateRayleighMeanFreePaths( const G4Material* material ) const;
|
||||
|
||||
///////////////////////
|
||||
// Class Data Members
|
||||
///////////////////////
|
||||
virtual void DumpPhysicsTable() const;
|
||||
// Prints the physics table.
|
||||
|
||||
protected:
|
||||
|
||||
G4PhysicsTable* thePhysicsTable;
|
||||
// A Physics Table can be either a cross-sections table or
|
||||
// an energy table (or can be used for other specific
|
||||
// purposes).
|
||||
G4PhysicsTable* thePhysicsTable;
|
||||
// A Physics Table can be either a cross-sections table or
|
||||
// an energy table (or can be used for other specific
|
||||
// purposes).
|
||||
|
||||
private:
|
||||
|
||||
G4OpRayleigh(const G4OpRayleigh &right) = delete;
|
||||
G4OpRayleigh& operator=(const G4OpRayleigh &right) = delete;
|
||||
|
||||
/// Calculates the mean free paths for a material as a function of
|
||||
/// photon energy
|
||||
G4PhysicsOrderedFreeVector*
|
||||
CalculateRayleighMeanFreePaths( const G4Material* material ) const;
|
||||
};
|
||||
|
||||
////////////////////
|
||||
@@ -159,21 +122,20 @@ private:
|
||||
inline
|
||||
G4bool G4OpRayleigh::IsApplicable(const G4ParticleDefinition& aParticleType)
|
||||
{
|
||||
return ( &aParticleType == G4OpticalPhoton::OpticalPhoton() );
|
||||
return (&aParticleType == G4OpticalPhoton::OpticalPhoton());
|
||||
}
|
||||
|
||||
inline
|
||||
void G4OpRayleigh::DumpPhysicsTable() const
|
||||
|
||||
{
|
||||
G4int PhysicsTableSize = thePhysicsTable->entries();
|
||||
G4PhysicsOrderedFreeVector *v;
|
||||
G4int PhysicsTableSize = thePhysicsTable->entries();
|
||||
G4PhysicsOrderedFreeVector *v;
|
||||
|
||||
for (G4int i = 0 ; i < PhysicsTableSize ; i++ )
|
||||
{
|
||||
v = (G4PhysicsOrderedFreeVector*)(*thePhysicsTable)[i];
|
||||
v->DumpValues();
|
||||
}
|
||||
for (G4int i = 0; i < PhysicsTableSize; ++i)
|
||||
{
|
||||
v = (G4PhysicsOrderedFreeVector*)(*thePhysicsTable)[i];
|
||||
v->DumpValues();
|
||||
}
|
||||
}
|
||||
|
||||
inline G4PhysicsTable* G4OpRayleigh::GetPhysicsTable() const
|
||||
@@ -181,5 +143,4 @@ inline G4PhysicsTable* G4OpRayleigh::GetPhysicsTable() const
|
||||
return thePhysicsTable;
|
||||
}
|
||||
|
||||
|
||||
#endif /* G4OpRayleigh_h */
|
||||
|
||||
@@ -45,10 +45,6 @@
|
||||
#ifndef G4OpWLS_h
|
||||
#define G4OpWLS_h 1
|
||||
|
||||
/////////////
|
||||
// Includes
|
||||
/////////////
|
||||
|
||||
#include "globals.hh"
|
||||
#include "templates.hh"
|
||||
#include "Randomize.hh"
|
||||
@@ -70,72 +66,52 @@
|
||||
// Class inherits publicly from G4VDiscreteProcess
|
||||
// Class Description - End:
|
||||
|
||||
/////////////////////
|
||||
// Class Definition
|
||||
/////////////////////
|
||||
|
||||
class G4VWLSTimeGeneratorProfile;
|
||||
|
||||
class G4OpWLS : public G4VDiscreteProcess
|
||||
class G4OpWLS : public G4VDiscreteProcess
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////
|
||||
// Constructors and Destructor
|
||||
////////////////////////////////
|
||||
explicit G4OpWLS(const G4String& processName = "OpWLS",
|
||||
G4ProcessType type = fOptical);
|
||||
virtual ~G4OpWLS();
|
||||
|
||||
G4OpWLS(const G4String& processName = "OpWLS",
|
||||
G4ProcessType type = fOptical);
|
||||
~G4OpWLS();
|
||||
virtual G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
|
||||
// Returns true -> 'is applicable' only for an optical photon.
|
||||
|
||||
private:
|
||||
virtual void BuildPhysicsTable(const G4ParticleDefinition& aParticleType) override;
|
||||
// Build the WLS integral table at the right time
|
||||
|
||||
G4OpWLS(const G4OpWLS &right);
|
||||
virtual G4double GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double,
|
||||
G4ForceCondition*) override;
|
||||
// Returns the absorption length for bulk absorption of optical
|
||||
// photons in media with a specified attenuation length.
|
||||
|
||||
//////////////
|
||||
// Operators
|
||||
//////////////
|
||||
virtual G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep) override;
|
||||
// This is the method implementing bulk absorption of optical
|
||||
// photons.
|
||||
|
||||
G4OpWLS& operator=(const G4OpWLS &right);
|
||||
virtual G4PhysicsTable* GetIntegralTable() const;
|
||||
// Returns the address of the WLS integral table.
|
||||
|
||||
public:
|
||||
virtual void DumpPhysicsTable() const;
|
||||
// Prints the WLS integral table.
|
||||
|
||||
////////////
|
||||
// Methods
|
||||
////////////
|
||||
|
||||
G4bool IsApplicable(const G4ParticleDefinition& aParticleType);
|
||||
// Returns true -> 'is applicable' only for an optical photon.
|
||||
|
||||
void BuildPhysicsTable(const G4ParticleDefinition& aParticleType);
|
||||
// Build the WLS integral table at the right time
|
||||
|
||||
G4double GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double ,
|
||||
G4ForceCondition* );
|
||||
// Returns the absorption length for bulk absorption of optical
|
||||
// photons in media with a specified attenuation length.
|
||||
|
||||
G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep);
|
||||
// This is the method implementing bulk absorption of optical
|
||||
// photons.
|
||||
|
||||
G4PhysicsTable* GetIntegralTable() const;
|
||||
// Returns the address of the WLS integral table.
|
||||
|
||||
void DumpPhysicsTable() const;
|
||||
// Prints the WLS integral table.
|
||||
|
||||
void UseTimeProfile(const G4String name);
|
||||
// Selects the time profile generator
|
||||
void UseTimeProfile(const G4String name);
|
||||
// Selects the time profile generator
|
||||
|
||||
protected:
|
||||
|
||||
G4VWLSTimeGeneratorProfile* WLSTimeGeneratorProfile;
|
||||
G4PhysicsTable* theIntegralTable;
|
||||
G4VWLSTimeGeneratorProfile* WLSTimeGeneratorProfile;
|
||||
G4PhysicsTable* theIntegralTable;
|
||||
|
||||
private:
|
||||
|
||||
G4OpWLS(const G4OpWLS &right) = delete;
|
||||
G4OpWLS& operator=(const G4OpWLS &right) = delete;
|
||||
};
|
||||
|
||||
////////////////////
|
||||
@@ -145,7 +121,7 @@ protected:
|
||||
inline
|
||||
G4bool G4OpWLS::IsApplicable(const G4ParticleDefinition& aParticleType)
|
||||
{
|
||||
return ( &aParticleType == G4OpticalPhoton::OpticalPhoton() );
|
||||
return (&aParticleType == G4OpticalPhoton::OpticalPhoton());
|
||||
}
|
||||
|
||||
inline
|
||||
@@ -159,12 +135,12 @@ void G4OpWLS::DumpPhysicsTable() const
|
||||
{
|
||||
G4int PhysicsTableSize = theIntegralTable->entries();
|
||||
G4PhysicsOrderedFreeVector *v;
|
||||
|
||||
for (G4int i = 0 ; i < PhysicsTableSize ; i++ )
|
||||
{
|
||||
v = (G4PhysicsOrderedFreeVector*)(*theIntegralTable)[i];
|
||||
v->DumpValues();
|
||||
}
|
||||
|
||||
for (G4int i = 0; i < PhysicsTableSize; i++)
|
||||
{
|
||||
v = (G4PhysicsOrderedFreeVector*)(*theIntegralTable)[i];
|
||||
v->DumpValues();
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* G4OpWLS_h */
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
#include "globals.hh"
|
||||
#include "G4MaterialPropertiesTable.hh"
|
||||
|
||||
class G4VWLSTimeGeneratorProfile
|
||||
class G4VWLSTimeGeneratorProfile
|
||||
{
|
||||
|
||||
public:
|
||||
@@ -64,15 +64,13 @@ public:
|
||||
virtual G4double GenerateTime(const G4double time_constant) = 0;
|
||||
virtual G4double GenerateTime(const G4MaterialPropertiesTable*) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
// hide assignment operator
|
||||
|
||||
G4VWLSTimeGeneratorProfile & operator=
|
||||
(const G4VWLSTimeGeneratorProfile &right);
|
||||
G4VWLSTimeGeneratorProfile(const G4VWLSTimeGeneratorProfile&);
|
||||
G4VWLSTimeGeneratorProfile & operator=
|
||||
(const G4VWLSTimeGeneratorProfile &right) = delete;
|
||||
G4VWLSTimeGeneratorProfile(const G4VWLSTimeGeneratorProfile&) = delete;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -52,23 +52,23 @@ class G4WLSTimeGeneratorProfileDelta : public G4VWLSTimeGeneratorProfile
|
||||
|
||||
public:
|
||||
|
||||
G4WLSTimeGeneratorProfileDelta(const G4String& name);
|
||||
explicit G4WLSTimeGeneratorProfileDelta(const G4String& name);
|
||||
|
||||
~G4WLSTimeGeneratorProfileDelta();
|
||||
virtual ~G4WLSTimeGeneratorProfileDelta();
|
||||
|
||||
G4double GenerateTime(const G4double time_constant);
|
||||
virtual G4double GenerateTime(const G4double time_constant) override;
|
||||
|
||||
G4double GenerateTime(const G4MaterialPropertiesTable*);
|
||||
virtual G4double GenerateTime(const G4MaterialPropertiesTable*) override;
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
// hide assignment operator
|
||||
|
||||
G4WLSTimeGeneratorProfileDelta & operator=
|
||||
(const G4WLSTimeGeneratorProfileDelta &right);
|
||||
G4WLSTimeGeneratorProfileDelta(const G4WLSTimeGeneratorProfileDelta&);
|
||||
|
||||
G4WLSTimeGeneratorProfileDelta & operator=
|
||||
(const G4WLSTimeGeneratorProfileDelta &right) = delete;
|
||||
G4WLSTimeGeneratorProfileDelta(const G4WLSTimeGeneratorProfileDelta&) = delete;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -53,23 +53,23 @@ class G4WLSTimeGeneratorProfileExponential : public G4VWLSTimeGeneratorProfile
|
||||
|
||||
public:
|
||||
|
||||
G4WLSTimeGeneratorProfileExponential(const G4String& name);
|
||||
explicit G4WLSTimeGeneratorProfileExponential(const G4String& name);
|
||||
|
||||
~G4WLSTimeGeneratorProfileExponential();
|
||||
virtual ~G4WLSTimeGeneratorProfileExponential();
|
||||
|
||||
G4double GenerateTime(const G4double time_constant);
|
||||
virtual G4double GenerateTime(const G4double time_constant) override;
|
||||
|
||||
G4double GenerateTime(const G4MaterialPropertiesTable*);
|
||||
virtual G4double GenerateTime(const G4MaterialPropertiesTable*) override;
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
// hide assignment operator
|
||||
|
||||
G4WLSTimeGeneratorProfileExponential & operator=
|
||||
(const G4WLSTimeGeneratorProfileExponential &right);
|
||||
G4WLSTimeGeneratorProfileExponential(const G4WLSTimeGeneratorProfileExponential&);
|
||||
|
||||
G4WLSTimeGeneratorProfileExponential & operator=
|
||||
(const G4WLSTimeGeneratorProfileExponential &right) = delete;
|
||||
G4WLSTimeGeneratorProfileExponential(const G4WLSTimeGeneratorProfileExponential&) = delete;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -53,101 +53,73 @@
|
||||
|
||||
#include "G4OpAbsorption.hh"
|
||||
|
||||
/////////////////////////
|
||||
// Class Implementation
|
||||
/////////////////////////
|
||||
|
||||
//////////////
|
||||
// Operators
|
||||
//////////////
|
||||
|
||||
// G4OpAbsorption::operator=(const G4OpAbsorption &right)
|
||||
// {
|
||||
// }
|
||||
|
||||
/////////////////
|
||||
// Constructors
|
||||
/////////////////
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4OpAbsorption::G4OpAbsorption(const G4String& processName, G4ProcessType type)
|
||||
: G4VDiscreteProcess(processName, type)
|
||||
: G4VDiscreteProcess(processName, type)
|
||||
{
|
||||
if (verboseLevel>0) {
|
||||
G4cout << GetProcessName() << " is created " << G4endl;
|
||||
}
|
||||
if (verboseLevel >0 ) {
|
||||
G4cout << GetProcessName() << " is created " << G4endl;
|
||||
}
|
||||
|
||||
SetProcessSubType(fOpAbsorption);
|
||||
SetProcessSubType(fOpAbsorption);
|
||||
}
|
||||
|
||||
// G4OpAbsorption::G4OpAbsorption(const G4OpAbsorpton &right)
|
||||
// {
|
||||
// }
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
////////////////
|
||||
// Destructors
|
||||
////////////////
|
||||
G4OpAbsorption::~G4OpAbsorption()
|
||||
{}
|
||||
|
||||
G4OpAbsorption::~G4OpAbsorption(){}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
////////////
|
||||
// Methods
|
||||
////////////
|
||||
|
||||
// PostStepDoIt
|
||||
// -------------
|
||||
//
|
||||
G4VParticleChange*
|
||||
G4OpAbsorption::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
{
|
||||
aParticleChange.Initialize(aTrack);
|
||||
aParticleChange.Initialize(aTrack);
|
||||
|
||||
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
|
||||
G4double thePhotonMomentum = aParticle->GetTotalMomentum();
|
||||
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
|
||||
G4double thePhotonMomentum = aParticle->GetTotalMomentum();
|
||||
|
||||
aParticleChange.ProposeLocalEnergyDeposit(thePhotonMomentum);
|
||||
aParticleChange.ProposeLocalEnergyDeposit(thePhotonMomentum);
|
||||
|
||||
aParticleChange.ProposeTrackStatus(fStopAndKill);
|
||||
aParticleChange.ProposeTrackStatus(fStopAndKill);
|
||||
|
||||
if (verboseLevel>0) {
|
||||
G4cout << "\n** Photon absorbed! **" << G4endl;
|
||||
}
|
||||
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
|
||||
if (verboseLevel>0) {
|
||||
G4cout << "\n** Photon absorbed! **" << G4endl;
|
||||
}
|
||||
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// GetMeanFreePath
|
||||
// ---------------
|
||||
//
|
||||
G4double G4OpAbsorption::GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double ,
|
||||
G4ForceCondition* )
|
||||
G4double,
|
||||
G4ForceCondition*)
|
||||
{
|
||||
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
|
||||
const G4Material* aMaterial = aTrack.GetMaterial();
|
||||
const G4Material* aMaterial = aTrack.GetMaterial();
|
||||
|
||||
G4double thePhotonMomentum = aParticle->GetTotalMomentum();
|
||||
|
||||
G4MaterialPropertiesTable* aMaterialPropertyTable;
|
||||
G4MaterialPropertyVector* AttenuationLengthVector;
|
||||
|
||||
G4double AttenuationLength = DBL_MAX;
|
||||
|
||||
G4double AttenuationLength = DBL_MAX;
|
||||
|
||||
aMaterialPropertyTable = aMaterial->GetMaterialPropertiesTable();
|
||||
|
||||
if ( aMaterialPropertyTable ) {
|
||||
AttenuationLengthVector = aMaterialPropertyTable->
|
||||
GetProperty(kABSLENGTH);
|
||||
if ( AttenuationLengthVector ){
|
||||
AttenuationLength = AttenuationLengthVector->
|
||||
Value(thePhotonMomentum);
|
||||
}
|
||||
else {
|
||||
// G4cout << "No Absorption length specified" << G4endl;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// G4cout << "No Absorption length specified" << G4endl;
|
||||
}
|
||||
if (aMaterialPropertyTable) {
|
||||
AttenuationLengthVector = aMaterialPropertyTable->GetProperty(kABSLENGTH);
|
||||
if (AttenuationLengthVector) {
|
||||
AttenuationLength = AttenuationLengthVector->Value(thePhotonMomentum);
|
||||
}
|
||||
// else {
|
||||
// G4cout << "No Absorption length specified" << G4endl;
|
||||
// }
|
||||
}
|
||||
// else {
|
||||
// G4cout << "No Absorption length specified" << G4endl;
|
||||
// }
|
||||
|
||||
return AttenuationLength;
|
||||
return AttenuationLength;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -44,31 +44,29 @@
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4OpProcessSubType.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4OpMieHG::G4OpMieHG(const G4String& processName, G4ProcessType type)
|
||||
: G4VDiscreteProcess(processName, type)
|
||||
{
|
||||
if (verboseLevel>0) {
|
||||
G4cout << GetProcessName() << " is created " << G4endl;
|
||||
}
|
||||
if (verboseLevel>0) {
|
||||
G4cout << GetProcessName() << " is created " << G4endl;
|
||||
}
|
||||
|
||||
SetProcessSubType(fOpMieHG);
|
||||
SetProcessSubType(fOpMieHG);
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4OpMieHG::~G4OpMieHG(){}
|
||||
|
||||
////////////
|
||||
// Methods
|
||||
////////////
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// PostStepDoIt
|
||||
// -------------
|
||||
//
|
||||
G4VParticleChange*
|
||||
G4VParticleChange*
|
||||
G4OpMieHG::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
{
|
||||
aParticleChange.Initialize(aTrack);
|
||||
aParticleChange.Initialize(aTrack);
|
||||
|
||||
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
|
||||
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
|
||||
const G4Material* aMaterial = aTrack.GetMaterial();
|
||||
G4MaterialPropertiesTable* aMaterialPropertyTable =
|
||||
aMaterial->GetMaterialPropertiesTable();
|
||||
@@ -80,7 +78,7 @@ G4OpMieHG::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
G4double ForwardRatio =
|
||||
aMaterialPropertyTable->GetConstProperty(kMIEHG_FORWARD_RATIO);
|
||||
|
||||
if (verboseLevel>0) {
|
||||
if (verboseLevel >0 ) {
|
||||
G4cout << "MIE Scattering Photon!" << G4endl;
|
||||
G4cout << "MIE Old Momentum Direction: "
|
||||
<< aParticle->GetMomentumDirection() << G4endl;
|
||||
@@ -88,102 +86,99 @@ G4OpMieHG::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
<< aParticle->GetPolarization() << G4endl;
|
||||
}
|
||||
|
||||
G4double gg;
|
||||
G4int direction;
|
||||
if (G4UniformRand()<=ForwardRatio){
|
||||
gg = forward_g;
|
||||
direction = 1;
|
||||
} else {
|
||||
gg = backward_g;
|
||||
direction = -1;
|
||||
G4double gg;
|
||||
G4int direction;
|
||||
if (G4UniformRand() <= ForwardRatio){
|
||||
gg = forward_g;
|
||||
direction = 1;
|
||||
} else {
|
||||
gg = backward_g;
|
||||
direction = -1;
|
||||
}
|
||||
|
||||
G4double r = G4UniformRand();
|
||||
G4double r = G4UniformRand();
|
||||
|
||||
G4double Theta;
|
||||
//sample the direction
|
||||
if (gg!=0) {
|
||||
Theta = std::acos(2*r*(1+gg)*(1+gg)*(1-gg+gg*r)/((1-gg+2*gg*r)*(1-gg+2*gg*r)) -1);
|
||||
} else {
|
||||
Theta = std::acos(2*r-1.);
|
||||
G4double Theta;
|
||||
//sample the direction
|
||||
if (gg != 0.) {
|
||||
Theta = std::acos(2.*r*(1.+gg)*(1.+gg)*(1.-gg+gg*r)/((1.-gg+2.*gg*r)*(1.-gg+2.*gg*r)) -1.);
|
||||
} else {
|
||||
Theta = std::acos(2.*r-1.);
|
||||
}
|
||||
G4double Phi = G4UniformRand()*2*pi;
|
||||
G4double Phi = G4UniformRand()*twopi;
|
||||
//G4double Phi = G4UniformRand()*2*pi;
|
||||
|
||||
if (direction==-1) Theta = pi - Theta; //backward scattering
|
||||
if (direction == -1) Theta = pi - Theta; //backward scattering
|
||||
|
||||
G4ThreeVector NewMomentumDirection, OldMomentumDirection;
|
||||
G4ThreeVector OldPolarization, NewPolarization;
|
||||
G4ThreeVector NewMomentumDirection, OldMomentumDirection;
|
||||
G4ThreeVector OldPolarization, NewPolarization;
|
||||
|
||||
NewMomentumDirection.set
|
||||
(std::sin(Theta)*std::cos(Phi), std::sin(Theta)*std::sin(Phi), std::cos(Theta));
|
||||
OldMomentumDirection = aParticle->GetMomentumDirection();
|
||||
NewMomentumDirection.rotateUz(OldMomentumDirection);
|
||||
NewMomentumDirection = NewMomentumDirection.unit();
|
||||
NewMomentumDirection.set
|
||||
(std::sin(Theta)*std::cos(Phi), std::sin(Theta)*std::sin(Phi), std::cos(Theta));
|
||||
OldMomentumDirection = aParticle->GetMomentumDirection();
|
||||
NewMomentumDirection.rotateUz(OldMomentumDirection);
|
||||
NewMomentumDirection = NewMomentumDirection.unit();
|
||||
|
||||
OldPolarization = aParticle->GetPolarization();
|
||||
G4double constant = -1./NewMomentumDirection.dot(OldPolarization);
|
||||
OldPolarization = aParticle->GetPolarization();
|
||||
G4double constant = -1./NewMomentumDirection.dot(OldPolarization);
|
||||
|
||||
NewPolarization = NewMomentumDirection + constant*OldPolarization;
|
||||
NewPolarization = NewPolarization.unit();
|
||||
NewPolarization = NewMomentumDirection + constant*OldPolarization;
|
||||
NewPolarization = NewPolarization.unit();
|
||||
|
||||
if (NewPolarization.mag()==0) {
|
||||
r = G4UniformRand()*twopi;
|
||||
NewPolarization.set(std::cos(r),std::sin(r),0.);
|
||||
NewPolarization.rotateUz(NewMomentumDirection);
|
||||
} else {
|
||||
// There are two directions which perpendicular
|
||||
// new momentum direction
|
||||
if (G4UniformRand() < 0.5) NewPolarization = -NewPolarization;
|
||||
}
|
||||
if (NewPolarization.mag() == 0.) {
|
||||
r = G4UniformRand()*twopi;
|
||||
NewPolarization.set(std::cos(r),std::sin(r),0.);
|
||||
NewPolarization.rotateUz(NewMomentumDirection);
|
||||
} else {
|
||||
// There are two directions which perpendicular
|
||||
// new momentum direction
|
||||
if (G4UniformRand() < 0.5) NewPolarization = -NewPolarization;
|
||||
}
|
||||
|
||||
aParticleChange.ProposePolarization(NewPolarization);
|
||||
aParticleChange.ProposeMomentumDirection(NewMomentumDirection);
|
||||
aParticleChange.ProposePolarization(NewPolarization);
|
||||
aParticleChange.ProposeMomentumDirection(NewMomentumDirection);
|
||||
|
||||
if (verboseLevel>0) {
|
||||
G4cout << "MIE New Polarization: "
|
||||
<< NewPolarization << G4endl;
|
||||
G4cout << "MIE Polarization Change: "
|
||||
<< *(aParticleChange.GetPolarization()) << G4endl;
|
||||
G4cout << "MIE New Momentum Direction: "
|
||||
<< NewMomentumDirection << G4endl;
|
||||
G4cout << "MIE Momentum Change: "
|
||||
<< *(aParticleChange.GetMomentumDirection()) << G4endl;
|
||||
}
|
||||
if (verboseLevel > 0) {
|
||||
G4cout << "MIE New Polarization: " << NewPolarization << G4endl;
|
||||
G4cout << "MIE Polarization Change: " << *(aParticleChange.GetPolarization()) << G4endl;
|
||||
G4cout << "MIE New Momentum Direction: " << NewMomentumDirection << G4endl;
|
||||
G4cout << "MIE Momentum Change: " << *(aParticleChange.GetMomentumDirection()) << G4endl;
|
||||
}
|
||||
|
||||
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
|
||||
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
|
||||
}
|
||||
|
||||
// GetMeanFreePath()
|
||||
// -----------------
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4OpMieHG::GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double ,
|
||||
G4ForceCondition* )
|
||||
G4double,
|
||||
G4ForceCondition*)
|
||||
{
|
||||
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
|
||||
const G4Material* aMaterial = aTrack.GetMaterial();
|
||||
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
|
||||
const G4Material* aMaterial = aTrack.GetMaterial();
|
||||
|
||||
G4double thePhotonEnergy = aParticle->GetTotalEnergy();
|
||||
G4double thePhotonEnergy = aParticle->GetTotalEnergy();
|
||||
|
||||
G4double AttenuationLength = DBL_MAX;
|
||||
G4double AttenuationLength = DBL_MAX;
|
||||
|
||||
G4MaterialPropertiesTable* aMaterialPropertyTable =
|
||||
aMaterial->GetMaterialPropertiesTable();
|
||||
G4MaterialPropertiesTable* aMaterialPropertyTable =
|
||||
aMaterial->GetMaterialPropertiesTable();
|
||||
|
||||
if (aMaterialPropertyTable) {
|
||||
G4MaterialPropertyVector* AttenuationLengthVector =
|
||||
aMaterialPropertyTable->GetProperty(kMIEHG);
|
||||
if (AttenuationLengthVector) {
|
||||
AttenuationLength = AttenuationLengthVector ->
|
||||
Value(thePhotonEnergy);
|
||||
} else {
|
||||
// G4cout << "No Mie scattering length specified" << G4endl;
|
||||
}
|
||||
} else {
|
||||
// G4cout << "No Mie scattering length specified" << G4endl;
|
||||
}
|
||||
if (aMaterialPropertyTable) {
|
||||
G4MaterialPropertyVector* AttenuationLengthVector =
|
||||
aMaterialPropertyTable->GetProperty(kMIEHG);
|
||||
if (AttenuationLengthVector) {
|
||||
AttenuationLength = AttenuationLengthVector->Value(thePhotonEnergy);
|
||||
}
|
||||
// else {
|
||||
// G4cout << "No Mie scattering length specified" << G4endl;
|
||||
// }
|
||||
}
|
||||
//else {
|
||||
// G4cout << "No Mie scattering length specified" << G4endl;
|
||||
// }
|
||||
|
||||
// G4cout << thePhotonEnergy/GeV << " \t" << AttenuationLength/m << G4endl;
|
||||
|
||||
return AttenuationLength;
|
||||
return AttenuationLength;
|
||||
}
|
||||
|
||||
@@ -68,257 +68,235 @@
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4OpProcessSubType.hh"
|
||||
|
||||
/////////////////////////
|
||||
// Class Implementation
|
||||
/////////////////////////
|
||||
|
||||
//////////////
|
||||
// Operators
|
||||
//////////////
|
||||
|
||||
// G4OpRayleigh::operator=(const G4OpRayleigh &right)
|
||||
// {
|
||||
// }
|
||||
|
||||
/////////////////
|
||||
// Constructors
|
||||
/////////////////
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4OpRayleigh::G4OpRayleigh(const G4String& processName, G4ProcessType type)
|
||||
: G4VDiscreteProcess(processName, type)
|
||||
: G4VDiscreteProcess(processName, type)
|
||||
{
|
||||
SetProcessSubType(fOpRayleigh);
|
||||
SetProcessSubType(fOpRayleigh);
|
||||
|
||||
thePhysicsTable = NULL;
|
||||
thePhysicsTable = nullptr;
|
||||
|
||||
if (verboseLevel>0) {
|
||||
G4cout << GetProcessName() << " is created " << G4endl;
|
||||
}
|
||||
if (verboseLevel > 0) {
|
||||
G4cout << GetProcessName() << " is created " << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
// G4OpRayleigh::G4OpRayleigh(const G4OpRayleigh &right)
|
||||
// {
|
||||
// }
|
||||
|
||||
////////////////
|
||||
// Destructors
|
||||
////////////////
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4OpRayleigh::~G4OpRayleigh()
|
||||
{
|
||||
if (thePhysicsTable) {
|
||||
thePhysicsTable->clearAndDestroy();
|
||||
delete thePhysicsTable;
|
||||
}
|
||||
if (thePhysicsTable) {
|
||||
thePhysicsTable->clearAndDestroy();
|
||||
delete thePhysicsTable;
|
||||
}
|
||||
}
|
||||
|
||||
////////////
|
||||
// Methods
|
||||
////////////
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// PostStepDoIt
|
||||
// -------------
|
||||
//
|
||||
G4VParticleChange*
|
||||
G4OpRayleigh::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
|
||||
{
|
||||
aParticleChange.Initialize(aTrack);
|
||||
aParticleChange.Initialize(aTrack);
|
||||
|
||||
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
|
||||
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
|
||||
|
||||
if (verboseLevel>0) {
|
||||
G4cout << "Scattering Photon!" << G4endl;
|
||||
G4cout << "Old Momentum Direction: "
|
||||
<< aParticle->GetMomentumDirection() << G4endl;
|
||||
G4cout << "Old Polarization: "
|
||||
<< aParticle->GetPolarization() << G4endl;
|
||||
}
|
||||
if (verboseLevel >0 ) {
|
||||
G4cout << "Scattering Photon!" << G4endl;
|
||||
G4cout << "Old Momentum Direction: "
|
||||
<< aParticle->GetMomentumDirection() << G4endl;
|
||||
G4cout << "Old Polarization: "
|
||||
<< aParticle->GetPolarization() << G4endl;
|
||||
}
|
||||
|
||||
G4double cosTheta;
|
||||
G4ThreeVector OldMomentumDirection, NewMomentumDirection;
|
||||
G4ThreeVector OldPolarization, NewPolarization;
|
||||
G4double cosTheta;
|
||||
G4ThreeVector OldMomentumDirection, NewMomentumDirection;
|
||||
G4ThreeVector OldPolarization, NewPolarization;
|
||||
|
||||
G4double rand, constant;
|
||||
G4double CosTheta, SinTheta, SinPhi, CosPhi, unit_x, unit_y, unit_z;
|
||||
G4double rand, constant;
|
||||
G4double CosTheta, SinTheta, SinPhi, CosPhi, unit_x, unit_y, unit_z;
|
||||
|
||||
do {
|
||||
// Try to simulate the scattered photon momentum direction
|
||||
// w.r.t. the initial photon momentum direction
|
||||
do {
|
||||
// Try to simulate the scattered photon momentum direction
|
||||
// w.r.t. the initial photon momentum direction
|
||||
|
||||
CosTheta = G4UniformRand();
|
||||
SinTheta = std::sqrt(1.-CosTheta*CosTheta);
|
||||
// consider for the angle 90-180 degrees
|
||||
if (G4UniformRand() < 0.5) CosTheta = -CosTheta;
|
||||
CosTheta = G4UniformRand();
|
||||
SinTheta = std::sqrt(1.-CosTheta*CosTheta);
|
||||
// consider for the angle 90-180 degrees
|
||||
if (G4UniformRand() < 0.5) CosTheta = -CosTheta;
|
||||
|
||||
// simulate the phi angle
|
||||
rand = twopi*G4UniformRand();
|
||||
SinPhi = std::sin(rand);
|
||||
CosPhi = std::cos(rand);
|
||||
// simulate the phi angle
|
||||
rand = twopi*G4UniformRand();
|
||||
SinPhi = std::sin(rand);
|
||||
CosPhi = std::cos(rand);
|
||||
|
||||
// start constructing the new momentum direction
|
||||
unit_x = SinTheta * CosPhi;
|
||||
unit_y = SinTheta * SinPhi;
|
||||
unit_z = CosTheta;
|
||||
// start constructing the new momentum direction
|
||||
unit_x = SinTheta * CosPhi;
|
||||
unit_y = SinTheta * SinPhi;
|
||||
unit_z = CosTheta;
|
||||
NewMomentumDirection.set (unit_x,unit_y,unit_z);
|
||||
|
||||
// Rotate the new momentum direction into global reference system
|
||||
OldMomentumDirection = aParticle->GetMomentumDirection();
|
||||
OldMomentumDirection = OldMomentumDirection.unit();
|
||||
NewMomentumDirection.rotateUz(OldMomentumDirection);
|
||||
NewMomentumDirection = NewMomentumDirection.unit();
|
||||
// Rotate the new momentum direction into global reference system
|
||||
OldMomentumDirection = aParticle->GetMomentumDirection();
|
||||
OldMomentumDirection = OldMomentumDirection.unit();
|
||||
NewMomentumDirection.rotateUz(OldMomentumDirection);
|
||||
NewMomentumDirection = NewMomentumDirection.unit();
|
||||
|
||||
// calculate the new polarization direction
|
||||
// The new polarization needs to be in the same plane as the new
|
||||
// momentum direction and the old polarization direction
|
||||
OldPolarization = aParticle->GetPolarization();
|
||||
constant = -NewMomentumDirection.dot(OldPolarization);
|
||||
// calculate the new polarization direction
|
||||
// The new polarization needs to be in the same plane as the new
|
||||
// momentum direction and the old polarization direction
|
||||
OldPolarization = aParticle->GetPolarization();
|
||||
constant = -NewMomentumDirection.dot(OldPolarization);
|
||||
|
||||
NewPolarization = OldPolarization + constant*NewMomentumDirection;
|
||||
NewPolarization = NewPolarization.unit();
|
||||
NewPolarization = OldPolarization + constant*NewMomentumDirection;
|
||||
NewPolarization = NewPolarization.unit();
|
||||
|
||||
// There is a corner case, where the Newmomentum direction
|
||||
// is the same as oldpolariztion direction:
|
||||
// random generate the azimuthal angle w.r.t. Newmomentum direction
|
||||
if (NewPolarization.mag() == 0.) {
|
||||
rand = G4UniformRand()*twopi;
|
||||
NewPolarization.set(std::cos(rand),std::sin(rand),0.);
|
||||
NewPolarization.rotateUz(NewMomentumDirection);
|
||||
} else {
|
||||
// There are two directions which are perpendicular
|
||||
// to the new momentum direction
|
||||
if (G4UniformRand() < 0.5) NewPolarization = -NewPolarization;
|
||||
}
|
||||
|
||||
// There is a corner case, where the Newmomentum direction
|
||||
// is the same as oldpolariztion direction:
|
||||
// random generate the azimuthal angle w.r.t. Newmomentum direction
|
||||
if (NewPolarization.mag() == 0.) {
|
||||
rand = G4UniformRand()*twopi;
|
||||
NewPolarization.set(std::cos(rand),std::sin(rand),0.);
|
||||
NewPolarization.rotateUz(NewMomentumDirection);
|
||||
} else {
|
||||
// There are two directions which are perpendicular
|
||||
// to the new momentum direction
|
||||
if (G4UniformRand() < 0.5) NewPolarization = -NewPolarization;
|
||||
}
|
||||
|
||||
// simulate according to the distribution cos^2(theta)
|
||||
cosTheta = NewPolarization.dot(OldPolarization);
|
||||
// Loop checking, 13-Aug-2015, Peter Gumplinger
|
||||
} while (std::pow(cosTheta,2) < G4UniformRand());
|
||||
cosTheta = NewPolarization.dot(OldPolarization);
|
||||
// Loop checking, 13-Aug-2015, Peter Gumplinger
|
||||
} while (std::pow(cosTheta,2) < G4UniformRand());
|
||||
|
||||
aParticleChange.ProposePolarization(NewPolarization);
|
||||
aParticleChange.ProposeMomentumDirection(NewMomentumDirection);
|
||||
aParticleChange.ProposePolarization(NewPolarization);
|
||||
aParticleChange.ProposeMomentumDirection(NewMomentumDirection);
|
||||
|
||||
if (verboseLevel>0) {
|
||||
G4cout << "New Polarization: "
|
||||
<< NewPolarization << G4endl;
|
||||
G4cout << "Polarization Change: "
|
||||
<< *(aParticleChange.GetPolarization()) << G4endl;
|
||||
G4cout << "New Momentum Direction: "
|
||||
<< NewMomentumDirection << G4endl;
|
||||
G4cout << "Momentum Change: "
|
||||
<< *(aParticleChange.GetMomentumDirection()) << G4endl;
|
||||
}
|
||||
if (verboseLevel > 0) {
|
||||
G4cout << "New Polarization: "
|
||||
<< NewPolarization << G4endl;
|
||||
G4cout << "Polarization Change: "
|
||||
<< *(aParticleChange.GetPolarization()) << G4endl;
|
||||
G4cout << "New Momentum Direction: "
|
||||
<< NewMomentumDirection << G4endl;
|
||||
G4cout << "Momentum Change: "
|
||||
<< *(aParticleChange.GetMomentumDirection()) << G4endl;
|
||||
}
|
||||
|
||||
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
|
||||
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
|
||||
}
|
||||
|
||||
// BuildPhysicsTable for the Rayleigh Scattering process
|
||||
// --------------------------------------------------------
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4OpRayleigh::BuildPhysicsTable(const G4ParticleDefinition&)
|
||||
{
|
||||
if (thePhysicsTable) {
|
||||
thePhysicsTable->clearAndDestroy();
|
||||
delete thePhysicsTable;
|
||||
thePhysicsTable = NULL;
|
||||
thePhysicsTable->clearAndDestroy();
|
||||
delete thePhysicsTable;
|
||||
thePhysicsTable = nullptr;
|
||||
}
|
||||
|
||||
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
|
||||
const G4int numOfMaterials = G4Material::GetNumberOfMaterials();
|
||||
|
||||
thePhysicsTable = new G4PhysicsTable( numOfMaterials );
|
||||
|
||||
for( G4int iMaterial = 0; iMaterial < numOfMaterials; iMaterial++ )
|
||||
thePhysicsTable = new G4PhysicsTable(numOfMaterials);
|
||||
|
||||
for (G4int iMaterial = 0; iMaterial < numOfMaterials; ++iMaterial)
|
||||
{
|
||||
G4Material* material = (*theMaterialTable)[iMaterial];
|
||||
G4MaterialPropertiesTable* materialProperties =
|
||||
material->GetMaterialPropertiesTable();
|
||||
G4PhysicsOrderedFreeVector* rayleigh = NULL;
|
||||
if ( materialProperties != NULL ) {
|
||||
rayleigh = materialProperties->GetProperty( kRAYLEIGH );
|
||||
if ( rayleigh == NULL ) rayleigh =
|
||||
CalculateRayleighMeanFreePaths( material );
|
||||
}
|
||||
thePhysicsTable->insertAt( iMaterial, rayleigh );
|
||||
G4Material* material = (*theMaterialTable)[iMaterial];
|
||||
G4MaterialPropertiesTable* materialProperties =
|
||||
material->GetMaterialPropertiesTable();
|
||||
G4PhysicsOrderedFreeVector* rayleigh = nullptr;
|
||||
if (materialProperties) {
|
||||
rayleigh = materialProperties->GetProperty(kRAYLEIGH);
|
||||
if (rayleigh == nullptr) rayleigh = CalculateRayleighMeanFreePaths(material);
|
||||
}
|
||||
thePhysicsTable->insertAt(iMaterial, rayleigh);
|
||||
}
|
||||
}
|
||||
|
||||
// GetMeanFreePath()
|
||||
// -----------------
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4OpRayleigh::GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double ,
|
||||
G4ForceCondition* )
|
||||
G4ForceCondition*)
|
||||
{
|
||||
const G4DynamicParticle* particle = aTrack.GetDynamicParticle();
|
||||
const G4double photonMomentum = particle->GetTotalMomentum();
|
||||
const G4Material* material = aTrack.GetMaterial();
|
||||
|
||||
G4PhysicsOrderedFreeVector* rayleigh =
|
||||
G4PhysicsOrderedFreeVector* rayleigh =
|
||||
static_cast<G4PhysicsOrderedFreeVector*>
|
||||
((*thePhysicsTable)(material->GetIndex()));
|
||||
|
||||
|
||||
G4double rsLength = DBL_MAX;
|
||||
if( rayleigh != NULL ) rsLength = rayleigh->Value( photonMomentum );
|
||||
if (rayleigh) rsLength = rayleigh->Value(photonMomentum);
|
||||
return rsLength;
|
||||
}
|
||||
|
||||
// CalculateRayleighMeanFreePaths()
|
||||
// --------------------------------
|
||||
// Private method to compute Rayleigh Scattering Lengths
|
||||
G4PhysicsOrderedFreeVector*
|
||||
G4OpRayleigh::CalculateRayleighMeanFreePaths( const G4Material* material ) const
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4PhysicsOrderedFreeVector*
|
||||
G4OpRayleigh::CalculateRayleighMeanFreePaths(const G4Material* material) const
|
||||
{
|
||||
G4MaterialPropertiesTable* materialProperties =
|
||||
G4MaterialPropertiesTable* materialProperties =
|
||||
material->GetMaterialPropertiesTable();
|
||||
|
||||
// Retrieve the beta_T or isothermal compressibility value. For backwards
|
||||
// compatibility use a constant if the material is "Water". If the material
|
||||
// doesn't have an ISOTHERMAL_COMPRESSIBILITY constant then return
|
||||
G4double betat;
|
||||
if ( material->GetName() == "Water" )
|
||||
if (material->GetName() == "Water") {
|
||||
betat = 7.658e-23*m3/MeV;
|
||||
else if(materialProperties->ConstPropertyExists("ISOTHERMAL_COMPRESSIBILITY"))
|
||||
}
|
||||
else if (materialProperties->ConstPropertyExists("ISOTHERMAL_COMPRESSIBILITY")) {
|
||||
betat = materialProperties->GetConstProperty(kISOTHERMAL_COMPRESSIBILITY);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// If the material doesn't have a RINDEX property vector then return
|
||||
G4MaterialPropertyVector* rIndex = materialProperties->GetProperty(kRINDEX);
|
||||
if ( rIndex == NULL ) return NULL;
|
||||
if (rIndex == nullptr) return nullptr;
|
||||
|
||||
// Retrieve the optional scale factor, (this just scales the scattering length
|
||||
G4double scaleFactor = 1.0;
|
||||
if( materialProperties->ConstPropertyExists( "RS_SCALE_FACTOR" ) )
|
||||
scaleFactor= materialProperties->GetConstProperty(kRS_SCALE_FACTOR );
|
||||
if (materialProperties->ConstPropertyExists("RS_SCALE_FACTOR")) {
|
||||
scaleFactor = materialProperties->GetConstProperty(kRS_SCALE_FACTOR);
|
||||
}
|
||||
|
||||
// Retrieve the material temperature. For backwards compatibility use a
|
||||
// Retrieve the material temperature. For backwards compatibility use a
|
||||
// constant if the material is "Water"
|
||||
G4double temperature;
|
||||
if( material->GetName() == "Water" )
|
||||
if (material->GetName() == "Water") {
|
||||
temperature = 283.15*kelvin; // Temperature of water is 10 degrees celsius
|
||||
else
|
||||
}
|
||||
else {
|
||||
temperature = material->GetTemperature();
|
||||
}
|
||||
|
||||
G4PhysicsOrderedFreeVector* rayleighMeanFreePaths =
|
||||
new G4PhysicsOrderedFreeVector();
|
||||
// This calculates the meanFreePath via the Einstein-Smoluchowski formula
|
||||
const G4double c1 = scaleFactor * betat * temperature * k_Boltzmann /
|
||||
const G4double c1 = scaleFactor * betat * temperature * k_Boltzmann /
|
||||
( 6.0 * pi );
|
||||
|
||||
for( size_t uRIndex = 0; uRIndex < rIndex->GetVectorLength(); uRIndex++ )
|
||||
for (size_t uRIndex = 0; uRIndex < rIndex->GetVectorLength(); ++uRIndex)
|
||||
{
|
||||
const G4double energy = rIndex->Energy( uRIndex );
|
||||
const G4double rIndexSquared = (*rIndex)[uRIndex] * (*rIndex)[uRIndex];
|
||||
const G4double xlambda = h_Planck * c_light / energy;
|
||||
const G4double c2 = std::pow(twopi/xlambda,4);
|
||||
const G4double c3 =
|
||||
std::pow(((rIndexSquared-1.0)*(rIndexSquared+2.0 )/3.0),2);
|
||||
const G4double energy = rIndex->Energy(uRIndex);
|
||||
const G4double rIndexSquared = (*rIndex)[uRIndex] * (*rIndex)[uRIndex];
|
||||
const G4double xlambda = h_Planck * c_light / energy;
|
||||
const G4double c2 = std::pow(twopi/xlambda,4);
|
||||
const G4double c3 =
|
||||
std::pow(((rIndexSquared-1.0)*(rIndexSquared+2.0 )/3.0),2);
|
||||
|
||||
const G4double meanFreePath = 1.0 / ( c1 * c2 * c3 );
|
||||
const G4double meanFreePath = 1.0 / ( c1 * c2 * c3 );
|
||||
|
||||
if( verboseLevel>0 )
|
||||
G4cout << energy << "MeV\t" << meanFreePath << "mm" << G4endl;
|
||||
if( verboseLevel > 0) {
|
||||
G4cout << energy << "MeV\t" << meanFreePath << "mm" << G4endl;
|
||||
}
|
||||
|
||||
rayleighMeanFreePaths->InsertValues( energy, meanFreePath );
|
||||
rayleighMeanFreePaths->InsertValues(energy, meanFreePath);
|
||||
}
|
||||
|
||||
return rayleighMeanFreePaths;
|
||||
|
||||
Reference in New Issue
Block a user