Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
+13
View File
@@ -16,6 +16,19 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
29 May 20: D. Sawkey (op-V10-06-03)
- all files - thorough cleaning; shorten temporary variable names;
improve readability
26 May 20: A. Howard (op-V10-06-02)
- Add second wavelength shifting process - G4OpWLS2
15 Feb 20: V. Ivanchenko (op-V10-06-01)
- G4OpRayleigh - avoid double deletion of property vectors
21 Jan 20: D. Sawkey (op-V10-06-00)
- use new ConstPropertyExists(G4int) rather than (G4String)
28 Oct 19: D. Sawkey (op-V10-05-02)
- G4OpWLS.cc - call G4VParticleChange->SetNumberOfSecondaries only once
- address bug 2200
@@ -40,65 +40,45 @@
// > new physics/tracking scheme
// 1998-08-25 by Stefano Magni
// > Change process to use G4MaterialPropertiesTables
// mail: gum@triumf.ca
// magni@mi.infn.it
//
////////////////////////////////////////////////////////////////////////
#ifndef G4OpAbsorption_h
#define G4OpAbsorption_h 1
/////////////
// Includes
/////////////
#include "globals.hh"
#include "templates.hh"
#include "Randomize.hh"
#include "G4Step.hh"
#include "G4VDiscreteProcess.hh"
#include "G4DynamicParticle.hh"
#include "G4Material.hh"
#include "G4OpticalPhoton.hh"
// Class Description:
// Discrete Process -- Bulk absorption of Optical Photons.
// Class inherits publicly from G4VDiscreteProcess
// Class Description - End:
class G4OpAbsorption : public G4VDiscreteProcess
{
public:
explicit G4OpAbsorption(const G4String& processName = "OpAbsorption",
G4ProcessType type = fOptical);
virtual ~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.
// 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.
// Method implementing bulk absorption of optical photons.
private:
G4OpAbsorption(const G4OpAbsorption &right) = delete;
G4OpAbsorption& operator=(const G4OpAbsorption &right) = delete;
size_t idx_absorption = 0;
};
////////////////////
// Inline methods
////////////////////
inline
G4bool G4OpAbsorption::IsApplicable(const G4ParticleDefinition& aParticleType)
@@ -58,68 +58,39 @@
//
// Author: Peter Gumplinger
// adopted from work by Werner Keil - April 2/96
// mail: gum@triumf.ca
//
////////////////////////////////////////////////////////////////////////
#ifndef G4OpBoundaryProcess_h
#define G4OpBoundaryProcess_h 1
#include "globals.hh"
#include "templates.hh"
#include "geomdefs.hh"
#include "Randomize.hh"
#include "G4RandomTools.hh"
#include "G4RandomDirection.hh"
#include "G4Step.hh"
#include "G4VDiscreteProcess.hh"
#include "G4DynamicParticle.hh"
#include "G4Material.hh"
#include "G4LogicalBorderSurface.hh"
#include "G4LogicalSkinSurface.hh"
#include "G4OpticalSurface.hh"
#include "G4OpticalPhoton.hh"
#include "G4TransportationManager.hh"
// Class Description:
// Discrete Process -- reflection/refraction at optical interfaces.
// Class inherits publicly from G4VDiscreteProcess.
// Class Description - End:
enum G4OpBoundaryProcessStatus { Undefined,
Transmission, FresnelRefraction,
FresnelReflection, TotalInternalReflection,
LambertianReflection, LobeReflection,
SpikeReflection, BackScattering,
Absorption, Detection, NotAtBoundary,
SameMaterial, StepTooSmall, NoRINDEX,
PolishedLumirrorAirReflection,
PolishedLumirrorGlueReflection,
PolishedAirReflection,
PolishedTeflonAirReflection,
PolishedTiOAirReflection,
PolishedTyvekAirReflection,
PolishedVM2000AirReflection,
PolishedVM2000GlueReflection,
EtchedLumirrorAirReflection,
EtchedLumirrorGlueReflection,
EtchedAirReflection,
EtchedTeflonAirReflection,
EtchedTiOAirReflection,
EtchedTyvekAirReflection,
EtchedVM2000AirReflection,
EtchedVM2000GlueReflection,
GroundLumirrorAirReflection,
GroundLumirrorGlueReflection,
GroundAirReflection,
GroundTeflonAirReflection,
GroundTiOAirReflection,
GroundTyvekAirReflection,
GroundVM2000AirReflection,
GroundVM2000GlueReflection,
Dichroic };
enum G4OpBoundaryProcessStatus {
Undefined,
Transmission, FresnelRefraction,
FresnelReflection, TotalInternalReflection,
LambertianReflection, LobeReflection,
SpikeReflection, BackScattering,
Absorption, Detection,
NotAtBoundary, SameMaterial,
StepTooSmall, NoRINDEX,
PolishedLumirrorAirReflection, PolishedLumirrorGlueReflection,
PolishedAirReflection, PolishedTeflonAirReflection,
PolishedTiOAirReflection, PolishedTyvekAirReflection,
PolishedVM2000AirReflection, PolishedVM2000GlueReflection,
EtchedLumirrorAirReflection, EtchedLumirrorGlueReflection,
EtchedAirReflection, EtchedTeflonAirReflection,
EtchedTiOAirReflection, EtchedTyvekAirReflection,
EtchedVM2000AirReflection, EtchedVM2000GlueReflection,
GroundLumirrorAirReflection, GroundLumirrorGlueReflection,
GroundAirReflection, GroundTeflonAirReflection,
GroundTiOAirReflection, GroundTyvekAirReflection,
GroundVM2000AirReflection, GroundVM2000GlueReflection,
Dichroic };
class G4OpBoundaryProcess : public G4VDiscreteProcess
{
@@ -134,10 +105,9 @@ public:
// 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.
// 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;
@@ -234,6 +204,20 @@ private:
G4Physics2DVector* DichroicVector;
G4bool fInvokeSD;
size_t idx_rindex1 = 0;
size_t idx_rindex_surface = 0;
size_t idx_reflect = 0;
size_t idx_eff = 0;
size_t idx_trans = 0;
size_t idx_lobe = 0;
size_t idx_spike = 0;
size_t idx_back = 0;
size_t idx_rindex2 = 0;
size_t idx_groupvel = 0;
size_t idx_rrindex = 0;
size_t idx_irindex = 0;
};
////////////////////
@@ -274,10 +258,10 @@ void G4OpBoundaryProcess::ChooseReflection()
theStatus = SpikeReflection;
theFacetNormal = theGlobalNormal;
}
else if ( rand >= prob_ss && rand <= prob_ss+prob_sl) {
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 ) {
else if (rand > prob_ss+prob_sl && rand < prob_ss+prob_sl+prob_bs) {
theStatus = BackScattering;
}
else {
@@ -317,7 +301,7 @@ void G4OpBoundaryProcess::DoReflection()
if (fRealRIndexMPV && fImagRIndexMPV) {
//
} else {
theFacetNormal = GetFacetNormal(OldMomentum,theGlobalNormal);
theFacetNormal = GetFacetNormal(OldMomentum, theGlobalNormal);
}
G4double PdotN = OldMomentum * theFacetNormal;
NewMomentum = OldMomentum - (2.*PdotN)*theFacetNormal;
@@ -35,8 +35,6 @@
// Henyey-Greenstein phase function
// Forward and backward angles are treated separately.
//
// mail: gum@triumf.ca
//
////////////////////////////////////////////////////////////////////////
#ifndef G4OpMieHG_h
@@ -54,8 +52,6 @@ public:
G4ProcessType type = fOptical);
virtual ~G4OpMieHG();
public:
virtual G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
// Returns true -> 'is applicable' only for an optical photon.
@@ -73,6 +69,7 @@ private:
G4OpMieHG(const G4OpMieHG &right) = delete;
G4OpMieHG& operator=(const G4OpMieHG &right) = delete;
size_t idx_mie = 0;
};
inline
@@ -43,10 +43,11 @@
enum G4OpProcessSubType
{
fOpAbsorption = 31,
fOpBoundary = 32,
fOpRayleigh = 33,
fOpWLS = 34,
fOpMieHG = 35
fOpBoundary = 32,
fOpRayleigh = 33,
fOpWLS = 34,
fOpMieHG = 35,
fOpWLS2 = 36,
};
#endif
@@ -40,42 +40,24 @@
// 1999-10-29 add method and class descriptors
// 1997-04-09 by Peter Gumplinger
// > new physics/tracking scheme
// mail: gum@triumf.ca
//
////////////////////////////////////////////////////////////////////////
#ifndef G4OpRayleigh_h
#define G4OpRayleigh_h 1
#include "globals.hh"
#include "templates.hh"
#include "Randomize.hh"
#include "G4ThreeVector.hh"
#include "G4ParticleMomentum.hh"
#include "G4Step.hh"
#include "G4VDiscreteProcess.hh"
#include "G4DynamicParticle.hh"
#include "G4Material.hh"
#include "G4OpticalPhoton.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsOrderedFreeVector.hh"
// Class Description:
// Discrete Process -- Rayleigh scattering of optical photons.
// Class inherits publicly from G4VDiscreteProcess.
// Class Description - End:
class G4OpRayleigh : public G4VDiscreteProcess
{
public:
explicit G4OpRayleigh(const G4String& processName = "OpRayleigh",
G4ProcessType type = fOptical);
virtual ~G4OpRayleigh();
public:
virtual G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
// Returns true -> 'is applicable' only for an optical photon.
@@ -100,9 +82,6 @@ public:
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).
private:
@@ -112,7 +91,9 @@ private:
/// Calculates the mean free paths for a material as a function of
/// photon energy
G4PhysicsOrderedFreeVector*
CalculateRayleighMeanFreePaths( const G4Material* material ) const;
CalculateRayleighMeanFreePaths(const G4Material* material) const;
size_t idx_rslength = 0;
};
////////////////////
@@ -128,13 +109,9 @@ G4bool G4OpRayleigh::IsApplicable(const G4ParticleDefinition& aParticleType)
inline
void G4OpRayleigh::DumpPhysicsTable() const
{
G4int PhysicsTableSize = thePhysicsTable->entries();
G4PhysicsOrderedFreeVector *v;
for (G4int i = 0; i < PhysicsTableSize; ++i)
for (size_t i=0; i<thePhysicsTable->entries(); ++i)
{
v = (G4PhysicsOrderedFreeVector*)(*thePhysicsTable)[i];
v->DumpValues();
((G4PhysicsOrderedFreeVector*)(*thePhysicsTable)[i])->DumpValues();
}
}
+5 -25
View File
@@ -37,40 +37,19 @@
// (Adaptation of G4Scintillation and G4OpAbsorption)
// Updated: 2005-07-28 add G4ProcessType to constructor
// 2006-05-07 - add G4VWLSTimeGeneratorProfile
// mail: gum@triumf.ca
// jparcham@phys.ualberta.ca
//
////////////////////////////////////////////////////////////////////////
#ifndef G4OpWLS_h
#define G4OpWLS_h 1
#include "globals.hh"
#include "templates.hh"
#include "Randomize.hh"
#include "G4Poisson.hh"
#include "G4ThreeVector.hh"
#include "G4ParticleMomentum.hh"
#include "G4Step.hh"
#include "G4VDiscreteProcess.hh"
#include "G4DynamicParticle.hh"
#include "G4Material.hh"
#include "G4OpticalPhoton.hh"
#include "G4PhysicsTable.hh"
#include "G4MaterialPropertiesTable.hh"
#include "G4PhysicsOrderedFreeVector.hh"
#include "G4VWLSTimeGeneratorProfile.hh"
// Class Description:
// Discrete Process -- Bulk absorption of Optical Photons.
// Class inherits publicly from G4VDiscreteProcess
// Class Description - End:
class G4VWLSTimeGeneratorProfile;
class G4OpWLS : public G4VDiscreteProcess
{
public:
explicit G4OpWLS(const G4String& processName = "OpWLS",
@@ -86,13 +65,12 @@ public:
virtual G4double GetMeanFreePath(const G4Track& aTrack,
G4double,
G4ForceCondition*) override;
// Returns the absorption length for bulk absorption of optical
// Returns the absorption length for WLS 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.
// This is the method implementing WLS for optical photons.
virtual G4PhysicsTable* GetIntegralTable() const;
// Returns the address of the WLS integral table.
@@ -112,6 +90,8 @@ private:
G4OpWLS(const G4OpWLS &right) = delete;
G4OpWLS& operator=(const G4OpWLS &right) = delete;
size_t idx_wls = 0;
};
////////////////////
@@ -136,7 +116,7 @@ void G4OpWLS::DumpPhysicsTable() const
G4int PhysicsTableSize = theIntegralTable->entries();
G4PhysicsOrderedFreeVector *v;
for (G4int i = 0; i < PhysicsTableSize; i++)
for (G4int i=0; i<PhysicsTableSize; ++i)
{
v = (G4PhysicsOrderedFreeVector*)(*theIntegralTable)[i];
v->DumpValues();
@@ -0,0 +1,126 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
////////////////////////////////////////////////////////////////////////
// Optical Photon WaveLength Shifting (WLS) Class Definition
////////////////////////////////////////////////////////////////////////
//
// File: G4OpWLS2.hh
// Description: Discrete Process -- Wavelength Shifting of Optical Photons
// Version: 1.0
// Created: 2003-05-13
// Author: John Paul Archambault
// (Adaptation of G4Scintillation and G4OpAbsorption)
// Updated: 2005-07-28 add G4ProcessType to constructor
// 2006-05-07 - add G4VWLSTimeGeneratorProfile
//
////////////////////////////////////////////////////////////////////////
#ifndef G4OpWL2S_h
#define G4OpWLS2_h 1
#include "G4VDiscreteProcess.hh"
#include "G4OpticalPhoton.hh"
class G4VWLSTimeGeneratorProfile;
class G4OpWLS2 : public G4VDiscreteProcess
{
public:
explicit G4OpWLS2(const G4String& processName = "OpWLS2",
G4ProcessType type = fOptical);
virtual ~G4OpWLS2();
virtual G4bool IsApplicable(const G4ParticleDefinition& aParticleType) override;
// Returns true -> 'is applicable' only for an optical photon.
virtual void BuildPhysicsTable(const G4ParticleDefinition& aParticleType) override;
// Build the WLS2 integral table at the right time
virtual G4double GetMeanFreePath(const G4Track& aTrack,
G4double,
G4ForceCondition*) override;
// Returns the absorption length for WLS2 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 WLS2 for optical photons.
virtual G4PhysicsTable* GetIntegralTable() const;
// Returns the address of the WLS2 integral table.
virtual void DumpPhysicsTable() const;
// Prints the WLS2 integral table.
void UseTimeProfile(const G4String name);
// Selects the time profile generator
protected:
G4VWLSTimeGeneratorProfile* WLSTimeGeneratorProfile;
G4PhysicsTable* theIntegralTable;
private:
G4OpWLS2(const G4OpWLS2 &right) = delete;
G4OpWLS2& operator=(const G4OpWLS2 &right) = delete;
size_t idx_wls2 = 0;
};
////////////////////
// Inline methods
////////////////////
inline
G4bool G4OpWLS2::IsApplicable(const G4ParticleDefinition& aParticleType)
{
return (&aParticleType == G4OpticalPhoton::OpticalPhoton());
}
inline
G4PhysicsTable* G4OpWLS2::GetIntegralTable() const
{
return theIntegralTable;
}
inline
void G4OpWLS2::DumpPhysicsTable() const
{
G4int PhysicsTableSize = theIntegralTable->entries();
G4PhysicsOrderedFreeVector *v;
for (G4int i=0; i<PhysicsTableSize; ++i)
{
v = (G4PhysicsOrderedFreeVector*)(*theIntegralTable)[i];
v->DumpValues();
}
}
#endif /* G4OpWLS2_h */
@@ -49,8 +49,9 @@
#define G4VWLSTimeGeneratorProfile_h 1
#include "G4ios.hh"
#include "globals.hh"
//#include "globals.hh"
#include "G4MaterialPropertiesTable.hh"
//class G4MaterialPropertiesTable;
class G4VWLSTimeGeneratorProfile
{
+2
View File
@@ -46,6 +46,7 @@ GEANT4_DEFINE_MODULE(NAME G4optical
G4OpProcessSubType.hh
G4OpRayleigh.hh
G4OpWLS.hh
G4OpWLS2.hh
G4VWLSTimeGeneratorProfile.hh
G4WLSTimeGeneratorProfileDelta.hh
G4WLSTimeGeneratorProfileExponential.hh
@@ -55,6 +56,7 @@ GEANT4_DEFINE_MODULE(NAME G4optical
G4OpMieHG.cc
G4OpRayleigh.cc
G4OpWLS.cc
G4OpWLS2.cc
G4VWLSTimeGeneratorProfile.cc
G4WLSTimeGeneratorProfileDelta.cc
G4WLSTimeGeneratorProfileExponential.cc
+9 -31
View File
@@ -43,8 +43,6 @@
// > Change process to use G4MaterialPropertiesTables
// 1998-09-03 by Peter Gumplinger
// > Protect G4MaterialPropertyVector* AttenuationLengthVector
// mail: gum@triumf.ca
// magni@mi.infn.it
//
////////////////////////////////////////////////////////////////////////
@@ -54,24 +52,20 @@
#include "G4OpAbsorption.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4OpAbsorption::G4OpAbsorption(const G4String& processName, G4ProcessType type)
: G4VDiscreteProcess(processName, type)
{
if (verboseLevel >0 ) {
G4cout << GetProcessName() << " is created " << G4endl;
}
SetProcessSubType(fOpAbsorption);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4OpAbsorption::~G4OpAbsorption()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VParticleChange*
G4OpAbsorption::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
{
@@ -81,45 +75,29 @@ G4OpAbsorption::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
G4double thePhotonMomentum = aParticle->GetTotalMomentum();
aParticleChange.ProposeLocalEnergyDeposit(thePhotonMomentum);
aParticleChange.ProposeTrackStatus(fStopAndKill);
if (verboseLevel>0) {
G4cout << "\n** Photon absorbed! **" << G4endl;
if (verboseLevel>1) {
G4cout << "\n** OpAbsorption: Photon absorbed! **" << G4endl;
}
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4OpAbsorption::GetMeanFreePath(const G4Track& aTrack,
G4double,
G4ForceCondition*)
{
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
const G4Material* aMaterial = aTrack.GetMaterial();
G4MaterialPropertiesTable* MPT = aTrack.GetMaterial()->GetMaterialPropertiesTable();
G4double attLength = DBL_MAX;
G4double thePhotonMomentum = aParticle->GetTotalMomentum();
G4MaterialPropertiesTable* aMaterialPropertyTable;
G4MaterialPropertyVector* AttenuationLengthVector;
G4double AttenuationLength = DBL_MAX;
aMaterialPropertyTable = aMaterial->GetMaterialPropertiesTable();
if (aMaterialPropertyTable) {
AttenuationLengthVector = aMaterialPropertyTable->GetProperty(kABSLENGTH);
if (AttenuationLengthVector) {
AttenuationLength = AttenuationLengthVector->Value(thePhotonMomentum);
if (MPT) {
G4MaterialPropertyVector* attVector = MPT->GetProperty(kABSLENGTH);
if (attVector) {
attLength = attVector->Value(aParticle->GetTotalMomentum(), idx_absorption);
}
// else {
// G4cout << "No Absorption length specified" << G4endl;
// }
}
// else {
// G4cout << "No Absorption length specified" << G4endl;
// }
return AttenuationLength;
return attLength;
}
File diff suppressed because it is too large Load Diff
+48 -84
View File
@@ -36,8 +36,6 @@
// Henyey-Greenstein phase function
// Forward and backward angles are treated separately.
//
// mail: gum@triumf.ca
//
////////////////////////////////////////////////////////////////////////
#include "G4OpMieHG.hh"
@@ -45,140 +43,106 @@
#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;
}
SetProcessSubType(fOpMieHG);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4OpMieHG::~G4OpMieHG(){}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4OpMieHG::~G4OpMieHG() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VParticleChange*
G4OpMieHG::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
{
aParticleChange.Initialize(aTrack);
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
const G4Material* aMaterial = aTrack.GetMaterial();
G4MaterialPropertiesTable* aMaterialPropertyTable =
aMaterial->GetMaterialPropertiesTable();
const G4MaterialPropertiesTable* MPT = aTrack.GetMaterial()->GetMaterialPropertiesTable();
G4double forward_g =
aMaterialPropertyTable->GetConstProperty(kMIEHG_FORWARD);
G4double backward_g =
aMaterialPropertyTable->GetConstProperty(kMIEHG_BACKWARD);
G4double ForwardRatio =
aMaterialPropertyTable->GetConstProperty(kMIEHG_FORWARD_RATIO);
G4double forwardRatio = MPT->GetConstProperty(kMIEHG_FORWARD_RATIO);
if (verboseLevel >0 ) {
G4cout << "MIE Scattering Photon!" << G4endl;
G4cout << "MIE Old Momentum Direction: "
<< aParticle->GetMomentumDirection() << G4endl;
G4cout << "MIE Old Polarization: "
<< aParticle->GetPolarization() << G4endl;
if (verboseLevel > 1) {
G4cout << "OpMie Scattering Photon!" << G4endl
<< " Old Momentum Direction: "
<< aParticle->GetMomentumDirection() << G4endl
<< " MIE Old Polarization: "
<< aParticle->GetPolarization() << G4endl;
}
G4double gg;
G4int direction;
if (G4UniformRand() <= ForwardRatio){
gg = forward_g;
if (G4UniformRand() <= forwardRatio) {
gg = MPT->GetConstProperty(kMIEHG_FORWARD);
direction = 1;
} else {
gg = backward_g;
gg = MPT->GetConstProperty(kMIEHG_BACKWARD);
direction = -1;
}
G4double r = G4UniformRand();
G4double Theta;
//sample the direction
G4double theta;
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.);
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.);
theta = std::acos(2.*r-1.);
}
G4double Phi = G4UniformRand()*twopi;
//G4double Phi = G4UniformRand()*2*pi;
G4double phi = G4UniformRand()*twopi;
if (direction == -1) Theta = pi - Theta; //backward scattering
if (direction == -1) theta = pi - theta; //backward scattering
G4ThreeVector NewMomentumDirection, OldMomentumDirection;
G4ThreeVector OldPolarization, NewPolarization;
G4ThreeVector newMomDir, oldMomDir;
G4ThreeVector newPol, oldPol;
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();
G4double sinth = std::sin(theta);
newMomDir.set(sinth*std::cos(phi), sinth*std::sin(phi), std::cos(theta));
oldMomDir = aParticle->GetMomentumDirection();
newMomDir.rotateUz(oldMomDir);
newMomDir = newMomDir.unit();
OldPolarization = aParticle->GetPolarization();
G4double constant = -1./NewMomentumDirection.dot(OldPolarization);
oldPol = aParticle->GetPolarization();
newPol = newMomDir - oldPol/newMomDir.dot(oldPol);
newPol = newPol.unit();
NewPolarization = NewMomentumDirection + constant*OldPolarization;
NewPolarization = NewPolarization.unit();
if (NewPolarization.mag() == 0.) {
if (newPol.mag() == 0.) {
r = G4UniformRand()*twopi;
NewPolarization.set(std::cos(r),std::sin(r),0.);
NewPolarization.rotateUz(NewMomentumDirection);
newPol.set(std::cos(r), std::sin(r), 0.);
newPol.rotateUz(newMomDir);
} else {
// There are two directions which perpendicular
// new momentum direction
if (G4UniformRand() < 0.5) NewPolarization = -NewPolarization;
// There are two directions perpendicular to new momentum direction
if (G4UniformRand() < 0.5) newPol = -newPol;
}
aParticleChange.ProposePolarization(NewPolarization);
aParticleChange.ProposeMomentumDirection(NewMomentumDirection);
aParticleChange.ProposePolarization(newPol);
aParticleChange.ProposeMomentumDirection(newMomDir);
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 > 1) {
G4cout << "OpMie New Polarization: " << newPol << G4endl
<< " Polarization Change: " << *(aParticleChange.GetPolarization()) << G4endl
<< " New Momentum Direction: " << newMomDir << G4endl
<< " Momentum Change: " << *(aParticleChange.GetMomentumDirection()) << G4endl;
}
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4OpMieHG::GetMeanFreePath(const G4Track& aTrack,
G4double,
G4ForceCondition*)
G4double, G4ForceCondition*)
{
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
const G4Material* aMaterial = aTrack.GetMaterial();
G4double thePhotonEnergy = aParticle->GetTotalEnergy();
G4double AttenuationLength = DBL_MAX;
G4MaterialPropertiesTable* aMaterialPropertyTable =
aMaterial->GetMaterialPropertiesTable();
if (aMaterialPropertyTable) {
G4MaterialPropertyVector* AttenuationLengthVector =
aMaterialPropertyTable->GetProperty(kMIEHG);
if (AttenuationLengthVector) {
AttenuationLength = AttenuationLengthVector->Value(thePhotonEnergy);
G4double attLength = DBL_MAX;
G4MaterialPropertiesTable* MPT = aTrack.GetMaterial()->GetMaterialPropertiesTable();
if (MPT) {
G4MaterialPropertyVector* attVector = MPT->GetProperty(kMIEHG);
if (attVector) {
attLength = attVector->Value(aTrack.GetDynamicParticle()->GetTotalEnergy(), idx_mie);
}
// 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 attLength;
}
+68 -98
View File
@@ -48,7 +48,7 @@
// 2001-10-18 by Peter Gumplinger
// eliminate unused variable warning on Linux (gcc-2.95.2)
// 2001-09-18 by mma
// >numOfMaterials=G4Material::GetNumberOfMaterials() in BuildPhy
// >numOfMaterials=G4Material::GetNumberOfMaterials() in BuildPhy
// 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
@@ -57,24 +57,20 @@
// > fix calculation of SinTheta (from CosTheta)
// 1997-04-09 by Peter Gumplinger
// > new physics/tracking scheme
// mail: gum@triumf.ca
//
////////////////////////////////////////////////////////////////////////
#include "G4OpRayleigh.hh"
#include "G4ios.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4OpProcessSubType.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4OpRayleigh::G4OpRayleigh(const G4String& processName, G4ProcessType type)
: G4VDiscreteProcess(processName, type)
{
SetProcessSubType(fOpRayleigh);
thePhysicsTable = nullptr;
if (verboseLevel > 0) {
@@ -83,154 +79,131 @@ G4OpRayleigh::G4OpRayleigh(const G4String& processName, G4ProcessType type)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4OpRayleigh::~G4OpRayleigh()
{
// VI: inside this PhysicsTable all properties are unique
// it is not possible to destroy
if (thePhysicsTable) {
thePhysicsTable->clearAndDestroy();
delete thePhysicsTable;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VParticleChange*
G4OpRayleigh::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
{
aParticleChange.Initialize(aTrack);
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
if (verboseLevel >0 ) {
G4cout << "Scattering Photon!" << G4endl;
G4cout << "Old Momentum Direction: "
<< aParticle->GetMomentumDirection() << G4endl;
G4cout << "Old Polarization: "
if (verboseLevel > 1) {
G4cout << "OpRayleigh: Scattering Photon!" << G4endl
<< "Old Momentum Direction: "
<< aParticle->GetMomentumDirection() << G4endl
<< "Old Polarization: "
<< aParticle->GetPolarization() << G4endl;
}
G4double cosTheta;
G4ThreeVector OldMomentumDirection, NewMomentumDirection;
G4ThreeVector OldPolarization, NewPolarization;
G4double rand, constant;
G4double CosTheta, SinTheta, SinPhi, CosPhi, unit_x, unit_y, unit_z;
G4ThreeVector oldMomDir, newMomDir;
G4ThreeVector oldPol, newPol;
G4double rand;
G4double cost, sint, sinphi, cosphi;
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);
cost = G4UniformRand();
sint = std::sqrt(1.-cost*cost);
// consider for the angle 90-180 degrees
if (G4UniformRand() < 0.5) CosTheta = -CosTheta;
if (G4UniformRand() < 0.5) cost = -cost;
// simulate the phi angle
rand = twopi*G4UniformRand();
SinPhi = std::sin(rand);
CosPhi = std::cos(rand);
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;
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();
// construct the new momentum direction
newMomDir.set(sint*cosphi, sint*sinphi, cost);
oldMomDir = aParticle->GetMomentumDirection();
newMomDir.rotateUz(oldMomDir);
// 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);
oldPol = aParticle->GetPolarization();
newPol = (oldPol - newMomDir.dot(oldPol) * newMomDir).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.) {
// There is a corner case, where the new momentum direction
// is the same as old polarization direction:
// random generate the azimuthal angle w.r.t. new momentum direction
if (newPol.mag() == 0.) {
rand = G4UniformRand()*twopi;
NewPolarization.set(std::cos(rand),std::sin(rand),0.);
NewPolarization.rotateUz(NewMomentumDirection);
newPol.set(std::cos(rand), std::sin(rand), 0.);
newPol.rotateUz(newMomDir);
} else {
// There are two directions which are perpendicular
// to the new momentum direction
if (G4UniformRand() < 0.5) NewPolarization = -NewPolarization;
// There are two directions perpendicular to the new momentum direction
if (G4UniformRand() < 0.5) newPol = -newPol;
}
// simulate according to the distribution cos^2(theta)
cosTheta = NewPolarization.dot(OldPolarization);
cosTheta = newPol.dot(oldPol);
// Loop checking, 13-Aug-2015, Peter Gumplinger
} while (std::pow(cosTheta,2) < G4UniformRand());
aParticleChange.ProposePolarization(NewPolarization);
aParticleChange.ProposeMomentumDirection(NewMomentumDirection);
aParticleChange.ProposePolarization(newPol);
aParticleChange.ProposeMomentumDirection(newMomDir);
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 > 1) {
G4cout << "New Polarization: " << newPol << G4endl
<< "Polarization Change: "
<< *(aParticleChange.GetPolarization()) << G4endl
<< "New Momentum Direction: " << newMomDir << G4endl
<< "Momentum Change: " << *(aParticleChange.GetMomentumDirection())
<< G4endl;
}
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4OpRayleigh::BuildPhysicsTable(const G4ParticleDefinition&)
{
if (thePhysicsTable) {
thePhysicsTable->clearAndDestroy();
//thePhysicsTable->clearAndDestroy();
delete thePhysicsTable;
thePhysicsTable = nullptr;
}
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
const G4int numOfMaterials = G4Material::GetNumberOfMaterials();
const size_t numOfMaterials = G4Material::GetNumberOfMaterials();
thePhysicsTable = new G4PhysicsTable(numOfMaterials);
for (G4int iMaterial = 0; iMaterial < numOfMaterials; ++iMaterial)
{
G4Material* material = (*theMaterialTable)[iMaterial];
G4MaterialPropertiesTable* materialProperties =
material->GetMaterialPropertiesTable();
for (size_t i=0; i<numOfMaterials; ++i) {
G4Material* material = (*theMaterialTable)[i];
G4MaterialPropertiesTable* matProp = material->GetMaterialPropertiesTable();
G4PhysicsOrderedFreeVector* rayleigh = nullptr;
if (materialProperties) {
rayleigh = materialProperties->GetProperty(kRAYLEIGH);
if (matProp) {
rayleigh = matProp->GetProperty(kRAYLEIGH);
if (rayleigh == nullptr) rayleigh = CalculateRayleighMeanFreePaths(material);
}
thePhysicsTable->insertAt(iMaterial, rayleigh);
thePhysicsTable->insertAt(i, rayleigh);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4OpRayleigh::GetMeanFreePath(const G4Track& aTrack,
G4double ,
G4ForceCondition*)
{
const G4DynamicParticle* particle = aTrack.GetDynamicParticle();
const G4double photonMomentum = particle->GetTotalMomentum();
const G4Material* material = aTrack.GetMaterial();
G4PhysicsOrderedFreeVector* rayleigh =
static_cast<G4PhysicsOrderedFreeVector*>
((*thePhysicsTable)(material->GetIndex()));
static_cast<G4PhysicsOrderedFreeVector*>
((*thePhysicsTable)(aTrack.GetMaterial()->GetIndex()));
G4double rsLength = DBL_MAX;
if (rayleigh) rsLength = rayleigh->Value(photonMomentum);
if (rayleigh) {
rsLength =rayleigh->Value(aTrack.GetDynamicParticle()->GetTotalMomentum(),
idx_rslength);
}
return rsLength;
}
@@ -238,8 +211,7 @@ G4double G4OpRayleigh::GetMeanFreePath(const G4Track& aTrack,
G4PhysicsOrderedFreeVector*
G4OpRayleigh::CalculateRayleighMeanFreePaths(const G4Material* material) const
{
G4MaterialPropertiesTable* materialProperties =
material->GetMaterialPropertiesTable();
G4MaterialPropertiesTable* MPT = material->GetMaterialPropertiesTable();
// Retrieve the beta_T or isothermal compressibility value. For backwards
// compatibility use a constant if the material is "Water". If the material
@@ -248,21 +220,21 @@ G4OpRayleigh::CalculateRayleighMeanFreePaths(const G4Material* material) const
if (material->GetName() == "Water") {
betat = 7.658e-23*m3/MeV;
}
else if (materialProperties->ConstPropertyExists("ISOTHERMAL_COMPRESSIBILITY")) {
betat = materialProperties->GetConstProperty(kISOTHERMAL_COMPRESSIBILITY);
else if (MPT->ConstPropertyExists(kISOTHERMAL_COMPRESSIBILITY)) {
betat = MPT->GetConstProperty(kISOTHERMAL_COMPRESSIBILITY);
}
else {
return nullptr;
}
// If the material doesn't have a RINDEX property vector then return
G4MaterialPropertyVector* rIndex = materialProperties->GetProperty(kRINDEX);
G4MaterialPropertyVector* rIndex = MPT->GetProperty(kRINDEX);
if (rIndex == nullptr) return nullptr;
// Retrieve the optional scale factor, (this just scales the scattering length
// Retrieve the optional scale factor (scales the scattering length)
G4double scaleFactor = 1.0;
if (materialProperties->ConstPropertyExists("RS_SCALE_FACTOR")) {
scaleFactor = materialProperties->GetConstProperty(kRS_SCALE_FACTOR);
if (MPT->ConstPropertyExists(kRS_SCALE_FACTOR)) {
scaleFactor = MPT->GetConstProperty(kRS_SCALE_FACTOR);
}
// Retrieve the material temperature. For backwards compatibility use a
@@ -275,11 +247,9 @@ G4OpRayleigh::CalculateRayleighMeanFreePaths(const G4Material* material) const
temperature = material->GetTemperature();
}
G4PhysicsOrderedFreeVector* rayleighMeanFreePaths =
new G4PhysicsOrderedFreeVector();
G4PhysicsOrderedFreeVector* rayleighMFPs = new G4PhysicsOrderedFreeVector();
// This calculates the meanFreePath via the Einstein-Smoluchowski formula
const G4double c1 = scaleFactor * betat * temperature * k_Boltzmann /
( 6.0 * pi );
const G4double c1 = scaleFactor * betat * temperature * k_Boltzmann / (6.0*pi);
for (size_t uRIndex = 0; uRIndex < rIndex->GetVectorLength(); ++uRIndex)
{
@@ -288,16 +258,16 @@ G4OpRayleigh::CalculateRayleighMeanFreePaths(const G4Material* material) const
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);
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;
}
rayleighMeanFreePaths->InsertValues(energy, meanFreePath);
rayleighMFPs->InsertValues(energy, meanFreePath);
}
return rayleighMeanFreePaths;
return rayleighMFPs;
}
+124 -286
View File
@@ -37,39 +37,24 @@
// (Adaptation of G4Scintillation and G4OpAbsorption)
// Updated: 2005-07-28 - add G4ProcessType to constructor
// 2006-05-07 - add G4VWLSTimeGeneratorProfile
// mail: gum@triumf.ca
// jparcham@phys.ualberta.ca
//
////////////////////////////////////////////////////////////////////////
#include "G4OpWLS.hh"
#include "G4ios.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4OpProcessSubType.hh"
#include "G4Poisson.hh"
#include "G4WLSTimeGeneratorProfileDelta.hh"
#include "G4WLSTimeGeneratorProfileExponential.hh"
/////////////////////////
// Class Implementation
/////////////////////////
//////////////////////
// static data members
//////////////////////
/////////////////
// Constructors
/////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4OpWLS::G4OpWLS(const G4String& processName, G4ProcessType type)
: G4VDiscreteProcess(processName, type)
{
SetProcessSubType(fOpWLS);
theIntegralTable = NULL;
theIntegralTable = nullptr;
WLSTimeGeneratorProfile =
new G4WLSTimeGeneratorProfileDelta("WLSTimeGeneratorProfileDelta");
@@ -77,10 +62,7 @@ G4OpWLS::G4OpWLS(const G4String& processName, G4ProcessType type)
if (verboseLevel>0) G4cout << GetProcessName() << " is created " << G4endl;
}
////////////////
// Destructors
////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4OpWLS::~G4OpWLS()
{
if (theIntegralTable) {
@@ -90,357 +72,213 @@ G4OpWLS::~G4OpWLS()
delete WLSTimeGeneratorProfile;
}
////////////
// Methods
////////////
// PostStepDoIt
// -------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VParticleChange*
G4OpWLS::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
{
std::vector<G4Track*> proposedSecondaries;
aParticleChange.Initialize(aTrack);
aParticleChange.ProposeTrackStatus(fStopAndKill);
if (verboseLevel>0) {
if (verboseLevel>1) {
G4cout << "\n** G4OpWLS: Photon absorbed! **" << G4endl;
}
const G4Material* aMaterial = aTrack.GetMaterial();
G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
G4MaterialPropertiesTable* aMaterialPropertiesTable =
aMaterial->GetMaterialPropertiesTable();
if (!aMaterialPropertiesTable)
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
const G4MaterialPropertyVector* WLS_Intensity =
aMaterialPropertiesTable->GetProperty(kWLSCOMPONENT);
if (!WLS_Intensity)
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
G4MaterialPropertiesTable* MPT = aTrack.GetMaterial()->GetMaterialPropertiesTable();
if (!MPT) { return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); }
if (!MPT->GetProperty(kWLSCOMPONENT)) { return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); }
G4int NumPhotons = 1;
if (aMaterialPropertiesTable->ConstPropertyExists("WLSMEANNUMBERPHOTONS")) {
G4double MeanNumberOfPhotons = aMaterialPropertiesTable->
GetConstProperty(kWLSMEANNUMBERPHOTONS);
if (MPT->ConstPropertyExists(kWLSMEANNUMBERPHOTONS)) {
G4double MeanNumberOfPhotons = MPT->GetConstProperty(kWLSMEANNUMBERPHOTONS);
NumPhotons = G4int(G4Poisson(MeanNumberOfPhotons));
if (NumPhotons <= 0) {
// return unchanged particle and no secondaries
aParticleChange.SetNumberOfSecondaries(0);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
}
G4double primaryEnergy = aTrack.GetDynamicParticle()->GetKineticEnergy();
G4int materialIndex = aMaterial->GetIndex();
// Retrieve the WLS Integral for this material
// new G4PhysicsOrderedFreeVector allocated to hold CII's
G4double primaryEnergy = aTrack.GetDynamicParticle()->GetKineticEnergy();
G4double WLSTime = 0.;
G4PhysicsOrderedFreeVector* WLSIntegral = nullptr;
G4double WLSTime = 0.*ns;
G4PhysicsOrderedFreeVector* WLSIntegral = 0;
WLSTime = aMaterialPropertiesTable->
GetConstProperty(kWLSTIMECONSTANT);
WLSTime = MPT->GetConstProperty(kWLSTIMECONSTANT);
WLSIntegral =
(G4PhysicsOrderedFreeVector*)((*theIntegralTable)(materialIndex));
(G4PhysicsOrderedFreeVector*)((*theIntegralTable)(aTrack.GetMaterial()->GetIndex()));
// Max WLS Integral
G4double CIImax = WLSIntegral->GetMaxValue();
G4int NumberOfPhotons = NumPhotons;
for (G4int i = 0; i < NumPhotons; i++) {
for (G4int i=0; i<NumPhotons; ++i) {
G4double sampledEnergy;
// Make sure the energy of the secondary is less than that of the primary
for (G4int j = 1; j <= 100; j++) {
// Determine photon energy
G4double CIIvalue = G4UniformRand()*CIImax;
sampledEnergy = WLSIntegral->GetEnergy(CIIvalue);
//if (verboseLevel>1) {
// G4cout << "G4OpWLS: sampledEnergy = " << sampledEnergy << G4endl;
// G4cout << "G4OpWLS: CIIvalue = " << CIIvalue << G4endl;
//}
if (sampledEnergy <= primaryEnergy) break;
for (G4int j=1; j<=100; ++j) {
// Determine photon energy
G4double CIIvalue = G4UniformRand()*CIImax;
sampledEnergy = WLSIntegral->GetEnergy(CIIvalue);
if (sampledEnergy <= primaryEnergy) break;
}
// If no such energy can be sampled, return one less secondary, or none
if (sampledEnergy > primaryEnergy) {
if (verboseLevel>1) {
G4cout << " *** G4OpWLS: One less WLS photon will be returned ***" << G4endl;
}
NumberOfPhotons--;
if (NumberOfPhotons == 0) {
if (verboseLevel>1) {
G4cout << " *** G4OpWLS: No WLS photon can be sampled for this primary ***"
<< G4endl;
}
// return unchanged particle and no secondaries
aParticleChange.SetNumberOfSecondaries(0);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
continue;
} else if (verboseLevel > 1) {
G4cout << "G4OpWLS: Created photon with energy: " << sampledEnergy
<< G4endl;
}
// If no such energy can be sampled, return one less secondary, or none
if (sampledEnergy > primaryEnergy) {
if (verboseLevel>1) {
G4cout << " *** G4OpWLS: One less WLS photon will be returned ***"
<< G4endl;
}
NumberOfPhotons--;
if (NumberOfPhotons == 0) {
if (verboseLevel>1) {
G4cout <<
" *** G4OpWLS: No WLS photon can be sampled for this primary ***"
<< G4endl;
}
// return unchanged particle and no secondaries
aParticleChange.SetNumberOfSecondaries(0);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
continue;
} else if (verboseLevel > 0) {
G4cout << "G4OpWLS: Created photon with energy: " << sampledEnergy
<< G4endl;
}
// Generate random photon direction
G4double cost = 1. - 2.*G4UniformRand();
G4double sint = std::sqrt((1.-cost)*(1.+cost));
G4double phi = twopi*G4UniformRand();
G4double sinp = std::sin(phi);
G4double cosp = std::cos(phi);
G4ParticleMomentum photonMomentum(sint*cosp, sint*sinp, cost);
G4double px = sint*cosp;
G4double py = sint*sinp;
G4double pz = cost;
// Create photon momentum direction vector
G4ParticleMomentum photonMomentum(px, py, pz);
// Determine polarization of new photon
G4double sx = cost*cosp;
G4double sy = cost*sinp;
G4double sz = -sint;
G4ThreeVector photonPolarization(sx, sy, sz);
G4ThreeVector photonPolarization(cost*cosp, cost*sinp, -sint);
G4ThreeVector perp = photonMomentum.cross(photonPolarization);
phi = twopi*G4UniformRand();
sinp = std::sin(phi);
cosp = std::cos(phi);
photonPolarization = cosp * photonPolarization + sinp * perp;
photonPolarization = photonPolarization.unit();
photonPolarization = (cosp*photonPolarization + sinp*perp).unit();
// Generate a new photon:
G4DynamicParticle* sec_dp =
new G4DynamicParticle(G4OpticalPhoton::OpticalPhoton(), photonMomentum);
sec_dp->SetPolarization(photonPolarization);
sec_dp->SetKineticEnergy(sampledEnergy);
G4DynamicParticle* aWLSPhoton =
new G4DynamicParticle(G4OpticalPhoton::OpticalPhoton(),
photonMomentum);
aWLSPhoton->SetPolarization
(photonPolarization.x(),
photonPolarization.y(),
photonPolarization.z());
aWLSPhoton->SetKineticEnergy(sampledEnergy);
// Generate new G4Track object:
// Must give position of WLS optical photon
G4double TimeDelay = WLSTimeGeneratorProfile->GenerateTime(WLSTime);
G4double aSecondaryTime = (pPostStepPoint->GetGlobalTime()) + TimeDelay;
G4ThreeVector aSecondaryPosition = pPostStepPoint->GetPosition();
G4Track* aSecondaryTrack =
new G4Track(aWLSPhoton,aSecondaryTime,aSecondaryPosition);
G4double secTime = pPostStepPoint->GetGlobalTime() +
WLSTimeGeneratorProfile->GenerateTime(WLSTime);
G4ThreeVector secPos = pPostStepPoint->GetPosition();
G4Track* secTrack = new G4Track(sec_dp, secTime, secPos);
aSecondaryTrack->SetTouchableHandle(aTrack.GetTouchableHandle());
// aSecondaryTrack->SetTouchableHandle((G4VTouchable*)0);
aSecondaryTrack->SetParentID(aTrack.GetTrackID());
secTrack->SetTouchableHandle(aTrack.GetTouchableHandle());
secTrack->SetParentID(aTrack.GetTrackID());
proposedSecondaries.push_back(aSecondaryTrack);
proposedSecondaries.push_back(secTrack);
}
aParticleChange.SetNumberOfSecondaries(proposedSecondaries.size());
for (auto sec : proposedSecondaries) {
aParticleChange.AddSecondary(sec);
}
if (verboseLevel>0) {
if (verboseLevel>1) {
G4cout << "\n Exiting from G4OpWLS::DoIt -- NumberOfSecondaries = "
<< aParticleChange.GetNumberOfSecondaries() << G4endl;
<< aParticleChange.GetNumberOfSecondaries() << G4endl;
}
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
// BuildPhysicsTable for the wavelength shifting process
// --------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4OpWLS::BuildPhysicsTable(const G4ParticleDefinition&)
{
if (theIntegralTable) {
theIntegralTable->clearAndDestroy();
delete theIntegralTable;
theIntegralTable = NULL;
theIntegralTable->clearAndDestroy();
delete theIntegralTable;
theIntegralTable = nullptr;
}
const G4MaterialTable* theMaterialTable =
G4Material::GetMaterialTable();
const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
// create new physics table
theIntegralTable = new G4PhysicsTable(numOfMaterials);
// loop for materials
for (G4int i=0 ; i < numOfMaterials; i++)
{
G4PhysicsOrderedFreeVector* aPhysicsOrderedFreeVector =
new G4PhysicsOrderedFreeVector();
for (G4int i=0; i<numOfMaterials; ++i) {
G4PhysicsOrderedFreeVector* physVector = new G4PhysicsOrderedFreeVector();
// Retrieve vector of WLS wavelength intensity for
// the material from the material's optical properties table.
G4Material* aMaterial = (*theMaterialTable)[i];
G4MaterialPropertiesTable* aMaterialPropertiesTable =
aMaterial->GetMaterialPropertiesTable();
if (aMaterialPropertiesTable) {
G4MaterialPropertyVector* theWLSVector =
aMaterialPropertiesTable->GetProperty(kWLSCOMPONENT);
if (theWLSVector) {
// Retrieve the first intensity point in vector
// of (photon energy, intensity) pairs
G4double currentIN = (*theWLSVector)[0];
if (currentIN >= 0.0) {
// Create first (photon energy)
G4double currentPM = theWLSVector->Energy(0);
G4double currentCII = 0.0;
aPhysicsOrderedFreeVector->
InsertValues(currentPM , currentCII);
// Set previous values to current ones prior to loop
G4double prevPM = currentPM;
G4double prevCII = currentCII;
G4double prevIN = currentIN;
// loop over all (photon energy, intensity)
// pairs stored for this material
for (size_t j = 1;
j < theWLSVector->GetVectorLength();
j++)
{
currentPM = theWLSVector->Energy(j);
currentIN = (*theWLSVector)[j];
currentCII = 0.5 * (prevIN + currentIN);
currentCII = prevCII +
(currentPM - prevPM) * currentCII;
aPhysicsOrderedFreeVector->
InsertValues(currentPM, currentCII);
prevPM = currentPM;
prevCII = currentCII;
prevIN = currentIN;
}
}
}
// Retrieve vector of WLS wavelength intensity for
// the material from the material's optical properties table.
G4MaterialPropertiesTable* MPT = (*materialTable)[i]->GetMaterialPropertiesTable();
if (MPT) {
G4MaterialPropertyVector* wlsVector = MPT->GetProperty(kWLSCOMPONENT);
if (wlsVector) {
// Retrieve the first intensity point in vector
// of (photon energy, intensity) pairs
G4double currentIN = (*wlsVector)[0];
if (currentIN >= 0.0) {
// Create first (photon energy)
G4double currentPM = wlsVector->Energy(0);
G4double currentCII = 0.0;
physVector->InsertValues(currentPM, currentCII);
// Set previous values to current ones prior to loop
G4double prevPM = currentPM;
G4double prevCII = currentCII;
G4double prevIN = currentIN;
// loop over all (photon energy, intensity)
// pairs stored for this material
for (size_t j=1; j<wlsVector->GetVectorLength(); ++j) {
currentPM = wlsVector->Energy(j);
currentIN = (*wlsVector)[j];
currentCII = prevCII + 0.5*(currentPM - prevPM)* (prevIN + currentIN);
physVector->InsertValues(currentPM, currentCII);
prevPM = currentPM;
prevCII = currentCII;
prevIN = currentIN;
}
}
}
// The WLS integral for a given material
// will be inserted in the table according to the
// position of the material in the material table.
theIntegralTable->insertAt(i,aPhysicsOrderedFreeVector);
}
theIntegralTable->insertAt(i,physVector);
}
}
// GetMeanFreePath
// ---------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4OpWLS::GetMeanFreePath(const G4Track& aTrack,
G4double ,
G4ForceCondition* )
{
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
const G4Material* aMaterial = aTrack.GetMaterial();
G4double thePhotonEnergy = aTrack.GetDynamicParticle()->GetTotalEnergy();
G4double attLength = DBL_MAX;
G4MaterialPropertiesTable* MPT = aTrack.GetMaterial()->GetMaterialPropertiesTable();
G4double thePhotonEnergy = aParticle->GetTotalEnergy();
G4MaterialPropertiesTable* aMaterialPropertyTable;
G4MaterialPropertyVector* AttenuationLengthVector;
G4double AttenuationLength = DBL_MAX;
aMaterialPropertyTable = aMaterial->GetMaterialPropertiesTable();
if ( aMaterialPropertyTable ) {
AttenuationLengthVector = aMaterialPropertyTable->
GetProperty(kWLSABSLENGTH);
if ( AttenuationLengthVector ){
AttenuationLength = AttenuationLengthVector->
Value(thePhotonEnergy);
}
else {
// G4cout << "No WLS absorption length specified" << G4endl;
if (MPT) {
G4MaterialPropertyVector* attVector = MPT->GetProperty(kWLSABSLENGTH);
if (attVector) {
attLength = attVector->Value(thePhotonEnergy, idx_wls);
}
}
else {
// G4cout << "No WLS absortion length specified" << G4endl;
}
return AttenuationLength;
return attLength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4OpWLS::UseTimeProfile(const G4String name)
{
if (name == "delta")
{
delete WLSTimeGeneratorProfile;
WLSTimeGeneratorProfile =
new G4WLSTimeGeneratorProfileDelta("delta");
}
else if (name == "exponential")
{
delete WLSTimeGeneratorProfile;
WLSTimeGeneratorProfile =
new G4WLSTimeGeneratorProfileExponential("exponential");
}
if (name.compare("delta") == 0) {
delete WLSTimeGeneratorProfile;
WLSTimeGeneratorProfile = new G4WLSTimeGeneratorProfileDelta("delta");
}
else if (name.compare("exponential") == 0) {
delete WLSTimeGeneratorProfile;
WLSTimeGeneratorProfile = new G4WLSTimeGeneratorProfileExponential("exponential");
}
else
{
G4Exception("G4OpWLS::UseTimeProfile", "em0202",
FatalException,
"generator does not exist");
}
{
G4Exception("G4OpWLS::UseTimeProfile", "em0202",
FatalException,
"generator does not exist");
}
}
+284
View File
@@ -0,0 +1,284 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
////////////////////////////////////////////////////////////////////////
// Optical Photon WaveLength Shifting (WLS) Class Implementation
////////////////////////////////////////////////////////////////////////
//
// File: G4OpWLS2.cc
// Description: Discrete Process -- Wavelength Shifting of Optical Photons
// Version: 1.0
// Created: 2003-05-13
// Author: John Paul Archambault
// (Adaptation of G4Scintillation and G4OpAbsorption)
// Updated: 2005-07-28 - add G4ProcessType to constructor
// 2006-05-07 - add G4VWLSTimeGeneratorProfile
//
////////////////////////////////////////////////////////////////////////
#include "G4OpWLS2.hh"
#include "G4ios.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4OpProcessSubType.hh"
#include "G4Poisson.hh"
#include "G4WLSTimeGeneratorProfileDelta.hh"
#include "G4WLSTimeGeneratorProfileExponential.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4OpWLS2::G4OpWLS2(const G4String& processName, G4ProcessType type)
: G4VDiscreteProcess(processName, type)
{
SetProcessSubType(fOpWLS);
theIntegralTable = nullptr;
WLSTimeGeneratorProfile =
new G4WLSTimeGeneratorProfileDelta("WLSTimeGeneratorProfileDelta");
if (verboseLevel>0) G4cout << GetProcessName() << " is created " << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4OpWLS2::~G4OpWLS2()
{
if (theIntegralTable) {
theIntegralTable->clearAndDestroy();
delete theIntegralTable;
}
delete WLSTimeGeneratorProfile;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VParticleChange*
G4OpWLS2::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
{
std::vector<G4Track*> proposedSecondaries;
aParticleChange.Initialize(aTrack);
aParticleChange.ProposeTrackStatus(fStopAndKill);
if (verboseLevel>1) {
G4cout << "\n** G4OpWLS2: Photon absorbed! **" << G4endl;
}
G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
G4MaterialPropertiesTable* MPT = aTrack.GetMaterial()->GetMaterialPropertiesTable();
if (!MPT) { return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); }
if (!MPT->GetProperty(kWLSCOMPONENT2)) { return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep); }
G4int NumPhotons = 1;
if (MPT->ConstPropertyExists(kWLSMEANNUMBERPHOTONS2)) {
G4double MeanNumberOfPhotons = MPT->GetConstProperty(kWLSMEANNUMBERPHOTONS2);
NumPhotons = G4int(G4Poisson(MeanNumberOfPhotons));
if (NumPhotons <= 0) {
// return unchanged particle and no secondaries
aParticleChange.SetNumberOfSecondaries(0);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
}
// Retrieve the WLS Integral for this material
// new G4PhysicsOrderedFreeVector allocated to hold CII's
G4double primaryEnergy = aTrack.GetDynamicParticle()->GetKineticEnergy();
G4double WLSTime = 0.;
G4PhysicsOrderedFreeVector* WLSIntegral = nullptr;
WLSTime = MPT->GetConstProperty(kWLSTIMECONSTANT2);
WLSIntegral =
(G4PhysicsOrderedFreeVector*)((*theIntegralTable)(aTrack.GetMaterial()->GetIndex()));
// Max WLS Integral
G4double CIImax = WLSIntegral->GetMaxValue();
G4int NumberOfPhotons = NumPhotons;
for (G4int i=0; i<NumPhotons; ++i) {
G4double sampledEnergy;
// Make sure the energy of the secondary is less than that of the primary
for (G4int j=1; j<=100; ++j) {
// Determine photon energy
G4double CIIvalue = G4UniformRand()*CIImax;
sampledEnergy = WLSIntegral->GetEnergy(CIIvalue);
if (sampledEnergy <= primaryEnergy) break;
}
// If no such energy can be sampled, return one less secondary, or none
if (sampledEnergy > primaryEnergy) {
if (verboseLevel>1) {
G4cout << " *** G4OpWLS2: One less WLS2 photon will be returned ***" << G4endl;
}
NumberOfPhotons--;
if (NumberOfPhotons == 0) {
if (verboseLevel>1) {
G4cout << " *** G4OpWLS2: No WLS2 photon can be sampled for this primary ***"
<< G4endl;
}
// return unchanged particle and no secondaries
aParticleChange.SetNumberOfSecondaries(0);
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
continue;
} else if (verboseLevel > 1) {
G4cout << "G4OpWLS2: Created photon with energy: " << sampledEnergy
<< G4endl;
}
// Generate random photon direction
G4double cost = 1. - 2.*G4UniformRand();
G4double sint = std::sqrt((1.-cost)*(1.+cost));
G4double phi = twopi*G4UniformRand();
G4double sinp = std::sin(phi);
G4double cosp = std::cos(phi);
G4ParticleMomentum photonMomentum(sint*cosp, sint*sinp, cost);
G4ThreeVector photonPolarization(cost*cosp, cost*sinp, -sint);
G4ThreeVector perp = photonMomentum.cross(photonPolarization);
phi = twopi*G4UniformRand();
sinp = std::sin(phi);
cosp = std::cos(phi);
photonPolarization = (cosp*photonPolarization + sinp*perp).unit();
// Generate a new photon:
G4DynamicParticle* sec_dp =
new G4DynamicParticle(G4OpticalPhoton::OpticalPhoton(), photonMomentum);
sec_dp->SetPolarization(photonPolarization);
sec_dp->SetKineticEnergy(sampledEnergy);
G4double secTime = pPostStepPoint->GetGlobalTime() +
WLSTimeGeneratorProfile->GenerateTime(WLSTime);
G4ThreeVector secPos = pPostStepPoint->GetPosition();
G4Track* secTrack = new G4Track(sec_dp, secTime, secPos);
secTrack->SetTouchableHandle(aTrack.GetTouchableHandle());
secTrack->SetParentID(aTrack.GetTrackID());
proposedSecondaries.push_back(secTrack);
}
aParticleChange.SetNumberOfSecondaries(proposedSecondaries.size());
for (auto sec : proposedSecondaries) {
aParticleChange.AddSecondary(sec);
}
if (verboseLevel>1) {
G4cout << "\n Exiting from G4OpWLS2::DoIt -- NumberOfSecondaries = "
<< aParticleChange.GetNumberOfSecondaries() << G4endl;
}
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4OpWLS2::BuildPhysicsTable(const G4ParticleDefinition&)
{
if (theIntegralTable) {
theIntegralTable->clearAndDestroy();
delete theIntegralTable;
theIntegralTable = nullptr;
}
const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
theIntegralTable = new G4PhysicsTable(numOfMaterials);
// loop for materials
for (G4int i=0; i<numOfMaterials; ++i) {
G4PhysicsOrderedFreeVector* physVector = new G4PhysicsOrderedFreeVector();
// Retrieve vector of WLS2 wavelength intensity for
// the material from the material's optical properties table.
G4MaterialPropertiesTable* MPT = (*materialTable)[i]->GetMaterialPropertiesTable();
if (MPT) {
G4MaterialPropertyVector* wlsVector = MPT->GetProperty(kWLSCOMPONENT2);
if (wlsVector) {
// Retrieve the first intensity point in vector
// of (photon energy, intensity) pairs
G4double currentIN = (*wlsVector)[0];
if (currentIN >= 0.0) {
// Create first (photon energy)
G4double currentPM = wlsVector->Energy(0);
G4double currentCII = 0.0;
physVector->InsertValues(currentPM, currentCII);
// Set previous values to current ones prior to loop
G4double prevPM = currentPM;
G4double prevCII = currentCII;
G4double prevIN = currentIN;
// loop over all (photon energy, intensity)
// pairs stored for this material
for (size_t j=1; j<wlsVector->GetVectorLength(); ++j) {
currentPM = wlsVector->Energy(j);
currentIN = (*wlsVector)[j];
currentCII = prevCII + 0.5*(currentPM - prevPM)* (prevIN + currentIN);
physVector->InsertValues(currentPM, currentCII);
prevPM = currentPM;
prevCII = currentCII;
prevIN = currentIN;
}
}
}
}
theIntegralTable->insertAt(i,physVector);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4OpWLS2::GetMeanFreePath(const G4Track& aTrack,
G4double ,
G4ForceCondition* )
{
G4double thePhotonEnergy = aTrack.GetDynamicParticle()->GetTotalEnergy();
G4double attLength = DBL_MAX;
G4MaterialPropertiesTable* MPT = aTrack.GetMaterial()->GetMaterialPropertiesTable();
if (MPT) {
G4MaterialPropertyVector* attVector = MPT->GetProperty(kWLSABSLENGTH2);
if (attVector) {
attLength = attVector->Value(thePhotonEnergy, idx_wls2);
}
}
return attLength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4OpWLS2::UseTimeProfile(const G4String name)
{
if (name.compare("delta") == 0) {
delete WLSTimeGeneratorProfile;
WLSTimeGeneratorProfile = new G4WLSTimeGeneratorProfileDelta("delta");
}
else if (name.compare("exponential") == 0) {
delete WLSTimeGeneratorProfile;
WLSTimeGeneratorProfile = new G4WLSTimeGeneratorProfileExponential("exponential");
}
else
{
G4Exception("G4OpWLS::UseTimeProfile", "em0202",
FatalException,
"generator does not exist");
}
}
@@ -61,9 +61,7 @@ G4WLSTimeGeneratorProfileExponential::~G4WLSTimeGeneratorProfileExponential()
G4double G4WLSTimeGeneratorProfileExponential::GenerateTime(const G4double time_constant)
{
G4double time = 0;
time = -std::log(G4UniformRand())*time_constant;
return time;
return -std::log(G4UniformRand())*time_constant;
}
G4double G4WLSTimeGeneratorProfileExponential::GenerateTime(const G4MaterialPropertiesTable*){