Import Geant4 9.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:37:50 +02:00
parent a8e9364cea
commit 96c8bcd0af
6923 changed files with 198390 additions and 41849 deletions
+71 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.290 2007/06/20 12:43:54 vnivanch Exp $
$Id: History,v 1.307 2007/11/09 11:35:53 vnivanch Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,76 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
09 November 07: V.Ivant (emutils-V09-00-13)
- G4VMultipleScattering - set at initialisation that scattering may be
off lectrons (needed for single scattering)
- G4EmModelmanager - add pointers to G4Gamma and G4Positron at
initialisation
07 November 07: V.Ivant (emutils-V09-00-12)
- G4VEnergyLossProcess - simplify logic to switch on/off fluctuations
- G4EmProcessOptions - add forgoten initialisation of G4LossTableManager
parameters together with parameters of concrete
processes (fixed initialisation when options
defined before proceeses are instantiated)
29 October 07: V.Ivant (emutils-V09-00-11)
- G4VEmProcess, G4VEnergyLossProcess, G4VMultipleScattering
cleanup - move virtual method to the source code
- G4VMultipleScattering - use SamleScattering method PostStep
- G4VEmModel - added SampleScattering method for msc models
- G4VEnergyLossProcess - set default flags of fluctuation to "false"
they changed to "true" when first model
of fluctuations is added
08 October 07: V.Ivant (emutils-V09-00-10)
- G4VEmProcess - use cut in PostStepDoIt (before was zero)
04 October 07: V.Ivant (emutils-V09-00-09)
- G4VEnergyLossProcess - fixed problem at destruction
02 October 07: V.Ivant (emutils-V09-00-08)
- G4VEnergyLossProcess, G4VEmProcess, G4VMultipleScattering - fixed
memory leak - proper delete of G4PhysicsTables
27 September 07: V.Ivant (emutils-V09-00-07)
- G4ionEffectiveCharge - use Fermi energy from G4Material and not
recalculate at each step; reorganized formulas - less calls to
exp, log, pow
26 September 07: V.Ivant (emutils-V09-00-06)
- G4VEnergyLossProcess and G4VEmProcess - move virtual function
PostStepGetPhysicalInteractionLength from inline to body of classes
25 September 07: V.Ivant (emutils-V09-00-05)
- G4VEnergyLossProcess and G4VEmProcess - fixed handling zero cross
section in PostStepGetPhysicalInteractionLength method to avoid problem
happans in FanoCavity example when cross section inside cavity is zero
- G4VEmModel - compare cross section with DBL_MIN instead of zero
16 August 07: V.Ivant (emutils-V09-00-04)
- G4EmCalculator - fixed default region name
- G4VEnergyLossProcess - use prestep time for subcutoff secondaries
and do not use GetVelocity method
02 August 07: V.Ivant (emutils-V09-00-03)
- G4VEnergyLossProcess - simplify energy loss computation for the case
of big step (few % faster)
28 July 07: V.Ivant (emutils-V09-00-02)
- G4VEnergyLossProcess - use stl vector of G4VEmModel instead of array
- G4VEmProcess - added cut to ComputeCrossSectionPerAtom method;
added vector of cuts per material for secondaries,
which are needed for single scattering process
16 July 07: V.Ivant (emutils-V09-00-01)
- G4VEmProcess - integral option coupled with buildLambdaTable option:
integral cannot be true if buildLambdaTable is false
11 July 07: V.Ivant (emutils-V09-00-00)
- G4VEmModel - fixed SelectRandomAtom method (last element of compound
was never selected - instead first was taken)
20 June 07: V.Ivant (emutils-V08-03-06)
- G4VEnergyLossProcess add initialisation of preStepKinEnergy before
run in order to fix a problem of test14 reported by Valgrind
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4DummyModel.hh,v 1.3 2007/05/22 17:31:57 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4EmCalculator.hh,v 1.18 2007/03/15 12:34:46 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// -------------------------------------------------------------------
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4EmCorrections.hh,v 1.9 2007/05/18 18:39:54 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmModelManager.hh,v 1.21 2007/03/17 19:24:39 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4EmModelManager.hh,v 1.22 2007/11/09 11:35:54 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -190,6 +190,8 @@ private:
const G4ParticleDefinition* particle;
const G4ParticleDefinition* secondaryParticle;
const G4ParticleDefinition* theGamma;
const G4ParticleDefinition* thePositron;
G4int verboseLevel;
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4EmMultiModel.hh,v 1.6 2007/05/22 17:31:57 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4EmProcessOptions.hh,v 1.12 2007/05/18 18:39:54 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// -------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4EmTableType.hh,v 1.3 2007/01/15 17:27:40 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//---------------------------------------------------------------
//
@@ -25,7 +25,7 @@
//
//
// $Id: G4EnergyLossMessenger.hh,v 1.18 2007/05/18 18:39:54 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -25,7 +25,7 @@
//
//
// $Id: G4EnergyLossTables.hh,v 1.19 2006/06/29 19:54:35 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// $Id:
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4LossTableBuilder.hh,v 1.7 2006/06/29 19:54:37 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// -------------------------------------------------------------------
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableManager.hh,v 1.47 2007/05/18 18:39:54 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4LossTableManager.hh,v 1.48 2007/11/07 18:38:49 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// -------------------------------------------------------------------
@@ -104,37 +104,37 @@ public:
void Clear();
// get the DEDX or the range for a given particle/energy/material
G4double GetDEDX(
inline G4double GetDEDX(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple);
G4double GetSubDEDX(
inline G4double GetSubDEDX(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple);
G4double GetRange(
inline G4double GetRange(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple);
G4double GetCSDARange(
inline G4double GetCSDARange(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple);
G4double GetRangeFromRestricteDEDX(
inline G4double GetRangeFromRestricteDEDX(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple);
G4double GetEnergy(
inline G4double GetEnergy(
const G4ParticleDefinition *aParticle,
G4double range,
const G4MaterialCutsCouple *couple);
G4double GetDEDXDispersion(
inline G4double GetDEDXDispersion(
const G4MaterialCutsCouple *couple,
const G4DynamicParticle* dp,
G4double& length);
@@ -208,15 +208,15 @@ public:
G4double BremsstrahlungTh() const;
G4VEnergyLossProcess* GetEnergyLossProcess(const G4ParticleDefinition*);
const std::vector<G4VEnergyLossProcess*>& GetEnergyLossProcessVector();
const std::vector<G4VEmProcess*>& GetEmProcessVector();
const std::vector<G4VMultipleScattering*>& GetMultipleScatteringVector();
G4EmCorrections* EmCorrections() {return emCorrections;};
inline G4VEnergyLossProcess* GetEnergyLossProcess(const G4ParticleDefinition*);
inline G4EmCorrections* EmCorrections();
private:
@@ -417,5 +417,12 @@ inline G4VEnergyLossProcess* G4LossTableManager::GetEnergyLossProcess(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4EmCorrections* G4LossTableManager::EmCorrections()
{
return emCorrections;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -25,7 +25,7 @@
//
//
// $Id: G4MscStepLimitType.hh,v 1.2 2007/06/11 14:56:51 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//---------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4VEmFluctuationModel.hh,v 1.10 2006/06/29 19:54:41 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmModel.hh,v 1.46 2007/05/22 17:31:57 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4VEmModel.hh,v 1.48 2007/10/29 08:38:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -59,6 +59,7 @@
// 06-02-06 add method ComputeMeanFreePath() (mma)
// 07-03-06 Optimize msc methods (V.Ivanchenko)
// 29-06-06 Add member currentElement and Get/Set methods (V.Ivanchenko)
// 29-10-07 Added SampleScattering (V.Ivanchenko)
//
// Class Description:
//
@@ -113,7 +114,7 @@ public:
//------------------------------------------------------------------------
virtual G4double MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple*);
const G4MaterialCutsCouple*);
virtual G4double ComputeDEDX(const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
@@ -126,43 +127,48 @@ public:
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
virtual G4double ComputeDEDXPerVolume(
const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = DBL_MAX);
virtual G4double ComputeDEDXPerVolume(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = DBL_MAX);
virtual G4double ComputeCrossSectionPerAtom(
const G4ParticleDefinition*,
G4double kinEnergy,
G4double Z,
G4double A = 0.,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
G4double kinEnergy,
G4double Z,
G4double A = 0.,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
virtual G4double ComputeMeanFreePath(
const G4ParticleDefinition*,
G4double kineticEnergy,
const G4Material*,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
virtual G4double CrossSectionPerVolume(
const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
virtual G4double ComputeMeanFreePath(const G4ParticleDefinition*,
G4double kineticEnergy,
const G4Material*,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
virtual G4double CrossSectionPerVolume(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
// Methods for msc simulation
protected:
virtual G4double ComputeTruePathLengthLimit(
const G4Track& track,
G4PhysicsTable* theLambdaTable,
G4double currentMinimalStep);
virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kineticEnergy);
//------------------------------------------------------------------------
// Methods for msc simulation which needs to be overwritten
//------------------------------------------------------------------------
public:
virtual void SampleScattering(const G4DynamicParticle*,
G4double safety);
virtual G4double ComputeTruePathLengthLimit(const G4Track& track,
G4PhysicsTable* theLambdaTable,
G4double currentMinimalStep);
virtual G4double ComputeGeomPathLength(G4double truePathLength);
@@ -170,17 +176,10 @@ public:
virtual void DefineForRegion(const G4Region*);
protected:
virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kineticEnergy);
//------------------------------------------------------------------------
// Generic methods common to all models
//------------------------------------------------------------------------
public:
void SetParticleChange(G4VParticleChange*, G4VEmFluctuationModel*);
G4VEmFluctuationModel* GetModelOfFluctuations();
@@ -288,8 +287,8 @@ inline G4double G4VEmModel::MinEnergyCut(const G4ParticleDefinition*,
inline G4double G4VEmModel::ComputeDEDXPerVolume(
const G4Material*,
const G4ParticleDefinition*,
G4double,
G4double)
G4double,
G4double)
{
return 0.0;
}
@@ -298,8 +297,8 @@ inline G4double G4VEmModel::ComputeDEDXPerVolume(
inline G4double G4VEmModel::ComputeDEDX(const G4MaterialCutsCouple* c,
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double cutEnergy)
G4double kinEnergy,
G4double cutEnergy)
{
return ComputeDEDXPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy);
}
@@ -308,19 +307,20 @@ inline G4double G4VEmModel::ComputeDEDX(const G4MaterialCutsCouple* c,
inline G4double G4VEmModel::CrossSection(const G4MaterialCutsCouple* c,
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double cutEnergy,
G4double maxEnergy)
G4double kinEnergy,
G4double cutEnergy,
G4double maxEnergy)
{
return CrossSectionPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy,maxEnergy);
return
CrossSectionPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy,maxEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition*,
G4double, G4double, G4double,
G4double, G4double)
G4double, G4double, G4double,
G4double, G4double)
{
return 0.0;
}
@@ -330,14 +330,14 @@ inline G4double G4VEmModel::ComputeCrossSectionPerAtom(
inline const G4Element* G4VEmModel::SelectRandomAtom(
const G4Material* material,
const G4ParticleDefinition* pd,
G4double kinEnergy,
G4double tcut,
G4double tmax)
G4double kinEnergy,
G4double tcut,
G4double tmax)
{
const G4ElementVector* theElementVector = material->GetElementVector();
currentElement = (*theElementVector)[0];
G4int nelm = material->GetNumberOfElements() - 1;
if (nelm > 0) {
G4int nelm = material->GetNumberOfElements();
currentElement = (*theElementVector)[nelm-1];
if (nelm > 1) {
G4double x = G4UniformRand()*
CrossSectionPerVolume(material,pd,kinEnergy,tcut,tmax);
for(G4int i=0; i<nelm; i++) {
@@ -376,7 +376,7 @@ inline G4double G4VEmModel::MaxSecondaryKinEnergy(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kineticEnergy)
G4double kineticEnergy)
{
return kineticEnergy;
}
@@ -392,6 +392,11 @@ inline const G4String& G4VEmModel::GetName() const
// Methods for msc simulation
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SampleScattering(const G4DynamicParticle*, G4double)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::ComputeTruePathLengthLimit(
const G4Track&,
G4PhysicsTable*,
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmProcess.hh,v 1.37 2007/05/23 08:43:46 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4VEmProcess.hh,v 1.43 2007/10/29 08:38:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -51,6 +51,9 @@
// 01-02-06 put default value A=0. to keep compatibility with v5.2 (mma)
// 13-05-06 Add method to access model by index (V.Ivanchenko)
// 12-09-06 add SetModel() (mma)
// 25-09-07 More accurate handling zero xsect in
// PostStepGetPhysicalInteractionLength (V.Ivanchenko)
// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
//
// Class Description:
//
@@ -106,18 +109,18 @@ protected:
// Methods with standard implementation; may be overwritten if needed
//------------------------------------------------------------------------
inline virtual G4double RecalculateLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple);
inline G4double RecalculateLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple);
//------------------------------------------------------------------------
// Generic methods common to all processes
// Generic methods common to all Discrete processes
//------------------------------------------------------------------------
public:
void PrintInfoDefinition();
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
void PreparePhysicsTable(const G4ParticleDefinition&);
// Initialise for build of tables
@@ -126,42 +129,43 @@ public:
// Build physics table during initialisation
G4bool StorePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii = false);
// Store PhysicsTable in a file.
// Return false in case of failure at I/O
const G4String& directory,
G4bool ascii = false);
// Store PhysicsTable in a file.
// Return false in case of failure at I/O
G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii);
const G4String& directory,
G4bool ascii);
// Retrieve Physics from a file.
// (return true if the Physics Table can be build by using file)
// (return false if the process has no functionality or in case of failure)
// File name should is constructed as processName+particleName and the
// should be placed under the directory specifed by the argument.
G4double MicroscopicCrossSection(G4double kineticEnergy,
const G4MaterialCutsCouple* couple);
//------------------------------------------------------------------------
// Specific methods for Discrete EM post step simulation
//------------------------------------------------------------------------
inline G4double MicroscopicCrossSection(G4double kineticEnergy,
const G4MaterialCutsCouple* couple);
// It returns the cross section of the process for energy/ material
inline G4double ComputeCrossSectionPerAtom(G4double kineticEnergy,
G4double Z, G4double A=0.);
G4double Z, G4double A=0.,
G4double cut=0.0);
// It returns the cross section of the process per atom
inline G4double MeanFreePath(const G4Track& track);
//------------------------------------------------------------------------
// Specific methods for post step simulation
//------------------------------------------------------------------------
G4double PostStepGetPhysicalInteractionLength(
virtual G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
size_t& idxRegion) const;
size_t& idxRegion) const;
inline G4double GetLambda(G4double& kinEnergy,
const G4MaterialCutsCouple* couple);
@@ -196,7 +200,7 @@ public:
// Specific methods to set, access, modify models
//------------------------------------------------------------------------
void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
inline void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
// Add EM model coupled for the region
inline void SetModel(G4VEmModel*);
@@ -226,16 +230,16 @@ public:
protected:
G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*);
inline void SetParticle(const G4ParticleDefinition* p);
inline void SetSecondaryParticle(const G4ParticleDefinition* p);
inline G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
inline G4VEmModel* SelectModel(G4double& kinEnergy);
inline size_t CurrentMaterialCutsCoupleIndex() const;
@@ -297,6 +301,7 @@ private:
const G4ParticleDefinition* theElectron;
const G4ParticleDefinition* thePositron;
const std::vector<G4double>* theCuts;
const std::vector<G4double>* theCutsGamma;
const std::vector<G4double>* theCutsElectron;
const std::vector<G4double>* theCutsPositron;
@@ -384,7 +389,8 @@ inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)
G4VEmModel* currentModel = SelectModel(e);
G4double x = 0.0;
if(currentModel)
x = currentModel->CrossSectionPerVolume(currentMaterial,particle,e);
x = currentModel->CrossSectionPerVolume(currentMaterial,particle,
e,(*theCuts)[currentMaterialIndex]);
return x;
}
@@ -403,7 +409,7 @@ inline void G4VEmProcess::ComputeIntegralLambda(G4double e)
mfpKinEnergy = theEnergyOfCrossSectionMax[currentMaterialIndex];
if (e <= mfpKinEnergy) {
preStepLambda = GetLambdaFromTable(e);
// mfpKinEnergy = 0.0;
} else {
G4double e1 = e*lambdaFactor;
if(e1 > mfpKinEnergy) {
@@ -417,58 +423,6 @@ inline void G4VEmProcess::ComputeIntegralLambda(G4double e)
preStepLambda = theCrossSectionMax[currentMaterialIndex];
}
}
// theNumberOfInteractionLengthLeft = -1.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition)
{
// condition is set to "Not Forced"
*condition = NotForced;
G4double x = DBL_MAX;
if(previousStepSize <= DBL_MIN) theNumberOfInteractionLengthLeft = -1.0;
InitialiseStep(track);
if(preStepKinEnergy < mfpKinEnergy) {
if (integral) ComputeIntegralLambda(preStepKinEnergy);
else preStepLambda = GetCurrentLambda(preStepKinEnergy);
if(preStepLambda <= DBL_MIN) mfpKinEnergy = 0.0;
}
if(preStepLambda > DBL_MIN) {
if (theNumberOfInteractionLengthLeft < 0.0) {
// beggining of tracking (or just after DoIt of this process)
ResetNumberOfInteractionLengthLeft();
} else if(previousStepSize > DBL_MIN) {
// subtract NumberOfInteractionLengthLeft
SubtractNumberOfInteractionLengthLeft(previousStepSize);
if(theNumberOfInteractionLengthLeft<0.)
theNumberOfInteractionLengthLeft=perMillion;
}
// get mean free path
currentInteractionLength = 1.0/preStepLambda;
x = theNumberOfInteractionLengthLeft * currentInteractionLength;
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cout << "G4VEmProcess::PostStepGetPhysicalInteractionLength ";
G4cout << "[ " << GetProcessName() << "]" << G4endl;
G4cout << " for " << particle->GetParticleName()
<< " in Material " << currentMaterial->GetName()
<< " Ekin(MeV)= " << preStepKinEnergy/MeV
<<G4endl;
G4cout << "MeanFreePath = " << currentInteractionLength/cm << "[cm]"
<< "InteractionLength= " << x/cm <<"[cm] " <<G4endl;
}
#endif
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -484,16 +438,6 @@ inline G4double G4VEmProcess::MeanFreePath(const G4Track& track)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetMeanFreePath(const G4Track& track,
G4double,
G4ForceCondition* condition)
{
*condition = NotForced;
return G4VEmProcess::MeanFreePath(track);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEmProcess::SelectModel(G4double& kinEnergy)
{
return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
@@ -565,6 +509,16 @@ inline void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p,
const G4Region* region)
{
G4VEmFluctuationModel* fm = 0;
modelManager->AddEmModel(order, p, fm, region);
if(p) p->SetParticleChange(pParticleChange);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetModel(G4VEmModel* model)
{
selectedModel = model;
@@ -580,7 +534,7 @@ inline G4VEmModel* G4VEmProcess::Model()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::UpdateEmModel(const G4String& nam,
G4double emin, G4double emax)
G4double emin, G4double emax)
{
modelManager->UpdateEmModel(nam, emin, emax);
}
@@ -588,10 +542,10 @@ inline void G4VEmProcess::UpdateEmModel(const G4String& nam,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::ComputeCrossSectionPerAtom(
G4double kineticEnergy, G4double Z, G4double A)
G4double kineticEnergy, G4double Z, G4double A, G4double cut)
{
G4VEmModel* model = SelectModel(kineticEnergy);
return model->ComputeCrossSectionPerAtom(particle,kineticEnergy,Z,A);
return model->ComputeCrossSectionPerAtom(particle,kineticEnergy,Z,A,cut);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -668,6 +622,7 @@ inline G4bool G4VEmProcess::IsIntegral() const
inline void G4VEmProcess::SetBuildTableFlag(G4bool val)
{
buildLambdaTable = val;
if(!val) integral = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -25,7 +25,7 @@
//
//
// $Id: G4VEnergyLoss.hh,v 1.18 2006/06/29 19:54:47 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// ------------------------------------------------------------
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEnergyLossProcess.hh,v 1.68 2007/06/12 11:29:09 vnivanch Exp $
// $Id: G4VEnergyLossProcess.hh,v 1.76 2007/11/07 18:38:49 vnivanch Exp $
// GEANT4 tag $Name:
//
// -------------------------------------------------------------------
@@ -74,6 +74,10 @@
// 15-01-07 Add separate ionisation tables and reorganise get/set methods for
// dedx tables (V.Ivanchenko)
// 13-03-07 use SafetyHelper instead of navigator (V.Ivanchenko)
// 27-07-07 use stl vector for emModels instead of C-array (V.Ivanchenko)
// 25-09-07 More accurate handling zero xsect in
// PostStepGetPhysicalInteractionLength (V.Ivanchenko)
// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
//
// Class Description:
//
@@ -138,14 +142,13 @@ protected:
//------------------------------------------------------------------------
protected:
inline virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*, G4double cut);
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*, G4double cut);
inline virtual void CorrectionsAlongStep(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double& eloss,
G4double& length);
virtual void CorrectionsAlongStep(const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double& eloss,
G4double& length);
//------------------------------------------------------------------------
// Generic methods common to all ContinuousDiscrete processes
@@ -166,7 +169,7 @@ public:
// Return false in case of failure at I/O
G4bool StorePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii = false);
G4bool ascii = false);
// Retrieve Physics from a file.
// (return true if the Physics Table can be build by using file)
@@ -175,21 +178,21 @@ public:
// should be placed under the directory specifed by the argument.
G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii);
G4bool ascii);
protected:
inline G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
inline G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety);
G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety);
//------------------------------------------------------------------------
// Specific methods for along/post step simulation
// Specific methods for along/post step EM processes
//------------------------------------------------------------------------
public:
@@ -205,7 +208,7 @@ public:
G4double length);
inline G4double AlongStepGetPhysicalInteractionLength(
virtual G4double AlongStepGetPhysicalInteractionLength(
const G4Track&,
G4double previousStepSize,
G4double currentMinimumStep,
@@ -213,7 +216,7 @@ public:
G4GPILSelection* selection
);
inline G4double PostStepGetPhysicalInteractionLength(
virtual G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
@@ -419,7 +422,7 @@ protected:
private:
G4EmModelManager* modelManager;
G4VEmModel* emModel[5];
std::vector<G4VEmModel*> emModels;
G4VEmFluctuationModel* fluctModel;
std::vector<const G4Region*> scoffRegions;
G4int nSCoffRegions;
@@ -492,7 +495,6 @@ private:
G4GPILSelection aGPILSelection;
G4bool lossFluctuationFlag;
G4bool lossFluctuationArePossible;
G4bool rndmStepFlag;
G4bool tablesAreBuilt;
G4bool integral;
@@ -728,7 +730,7 @@ inline void G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e)
mfpKinEnergy = theEnergyOfCrossSectionMax[currentMaterialIndex];
if (e <= mfpKinEnergy) {
preStepLambda = GetLambdaForScaledEnergy(e);
// mfpKinEnergy = 0.0;
} else {
G4double e1 = e*lambdaFactor;
if(e1 > mfpKinEnergy) {
@@ -742,7 +744,6 @@ inline void G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e)
preStepLambda = chargeSqRatio*theCrossSectionMax[currentMaterialIndex];
}
}
// theNumberOfInteractionLengthLeft = -1.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -756,45 +757,6 @@ inline G4double G4VEnergyLossProcess::ContinuousStepLimit(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetContinuousStepLimit(
const G4Track&,
G4double, G4double, G4double&)
{
return DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::AlongStepGetPhysicalInteractionLength(
const G4Track&,
G4double,
G4double currentMinStep,
G4double&,
G4GPILSelection* selection)
{
G4double x = DBL_MAX;
*selection = aGPILSelection;
if(isIonisation) {
fRange = GetScaledRangeForScaledEnergy(preStepScaledEnergy)*reduceFactor;
x = fRange;
G4double y = x*dRoverRange;
// G4double safety = track.GetStep()->GetPreStepPoint()->GetSafety();
if(x > finalRange && y < currentMinStep) { // && x > safety) {
x = y + finalRange*(1.0 - dRoverRange)*(2.0 - finalRange/fRange);
} else if (rndmStepFlag) x = SampleRange();
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy
// <<" range= "<<fRange <<" cMinSt="<<currentMinStep
// <<" safety= " << safety<< " limit= " << x <<G4endl;
}
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy
// <<" stepLimit= "<<x<<G4endl;
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::SampleRange()
{
G4double e = amu_c2*preStepKinEnergy/particle->GetPDGMass();
@@ -807,56 +769,6 @@ inline G4double G4VEnergyLossProcess::SampleRange()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition)
{
// condition is set to "Not Forced"
*condition = NotForced;
G4double x = DBL_MAX;
if(previousStepSize <= DBL_MIN) theNumberOfInteractionLengthLeft = -1.0;
InitialiseStep(track);
if(preStepScaledEnergy < mfpKinEnergy) {
if (integral) ComputeLambdaForScaledEnergy(preStepScaledEnergy);
else preStepLambda = GetLambdaForScaledEnergy(preStepScaledEnergy);
if(preStepLambda <= DBL_MIN) mfpKinEnergy = 0.0;
}
if(preStepLambda > DBL_MIN) {
if (theNumberOfInteractionLengthLeft < 0.0) {
// beggining of tracking (or just after DoIt of this process)
ResetNumberOfInteractionLengthLeft();
} else if(previousStepSize > DBL_MIN) {
// subtract NumberOfInteractionLengthLeft
SubtractNumberOfInteractionLengthLeft(previousStepSize);
if(theNumberOfInteractionLengthLeft<0.)
theNumberOfInteractionLengthLeft=perMillion;
}
// get mean free path
currentInteractionLength = 1.0/preStepLambda;
x = theNumberOfInteractionLengthLeft * currentInteractionLength;
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cout << "G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength ";
G4cout << "[ " << GetProcessName() << "]" << G4endl;
G4cout << " for " << particle->GetParticleName()
<< " in Material " << currentMaterial->GetName()
<< " Ekin(MeV)= " << preStepKinEnergy/MeV
<<G4endl;
G4cout << "MeanFreePath = " << currentInteractionLength/cm << "[cm]"
<< "InteractionLength= " << x/cm <<"[cm] " <<G4endl;
}
#endif
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::MeanFreePath(const G4Track& track)
{
DefineMaterial(track.GetMaterialCutsCouple());
@@ -868,18 +780,6 @@ inline G4double G4VEnergyLossProcess::MeanFreePath(const G4Track& track)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetMeanFreePath(
const G4Track& track,
G4double,
G4ForceCondition* condition)
{
*condition = NotForced;
return MeanFreePath(track);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::MinPrimaryEnergy(
const G4ParticleDefinition*, const G4Material*, G4double cut)
{
@@ -1041,14 +941,10 @@ inline G4double G4VEnergyLossProcess::GetCurrentRange() const
void G4VEnergyLossProcess::AddEmModel(G4int order, G4VEmModel* p,
G4VEmFluctuationModel* fluc,
const G4Region* region)
const G4Region* region)
{
modelManager->AddEmModel(order, p, fluc, region);
if(p) p->SetParticleChange(pParticleChange, fluc);
if(!fluc) {
lossFluctuationFlag = false;
lossFluctuationArePossible = false;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1069,14 +965,18 @@ inline G4int G4VEnergyLossProcess::NumberOfModels()
inline void G4VEnergyLossProcess::SetEmModel(G4VEmModel* p, G4int index)
{
emModel[index] = p;
G4int n = emModels.size();
if(index >= n) for(G4int i=n; i<index+1; i++) {emModels.push_back(0);}
emModels[index] = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEnergyLossProcess::EmModel(G4int index)
{
return emModel[index];
G4VEmModel* p = 0;
if(index >= 0 && index < G4int(emModels.size())) p = emModels[index];
return p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1096,7 +996,7 @@ inline G4VEmFluctuationModel* G4VEnergyLossProcess::FluctModel()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::UpdateEmModel(const G4String& nam,
G4double emin, G4double emax)
G4double emin, G4double emax)
{
modelManager->UpdateEmModel(nam, emin, emax);
}
@@ -1140,7 +1040,7 @@ inline void G4VEnergyLossProcess::SetLinearLossLimit(G4double val)
inline void G4VEnergyLossProcess::SetLossFluctuations(G4bool val)
{
if(!val || lossFluctuationArePossible) lossFluctuationFlag = val;
lossFluctuationFlag = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VMultipleScattering.hh,v 1.46 2007/06/11 14:56:51 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4VMultipleScattering.hh,v 1.48 2007/10/29 08:38:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -61,6 +61,7 @@
// 07-03-06 Move step limit calculation to model (V.Ivanchenko)
// 13-05-06 Add method to access model by index (V.Ivanchenko)
// 12-02-07 Add get/set skin (V.Ivanchenko)
// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
//
// -------------------------------------------------------------------
@@ -120,17 +121,17 @@ public:
//------------------------------------------------------------------------
// Initialise for build of tables
virtual void PreparePhysicsTable(const G4ParticleDefinition&);
void PreparePhysicsTable(const G4ParticleDefinition&);
// Build physics table during initialisation
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
void BuildPhysicsTable(const G4ParticleDefinition&);
// Print out of generic class parameters
void PrintInfoDefinition();
inline virtual G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
inline virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
// Store PhysicsTable in a file.
// Return false in case of failure at I/O
@@ -148,16 +149,13 @@ public:
G4bool ascii);
//------------------------------------------------------------------------
// Specific methods for multiple scattering
// Specific methods for msc processes
//------------------------------------------------------------------------
// Build empty Physics Vector
G4PhysicsVector* PhysicsVector(const G4MaterialCutsCouple*);
// The function overloads the corresponding function of the base
// class.It limits the step near to boundaries only
// and invokes the method GetMscContinuousStepLimit at every step.
inline virtual G4double AlongStepGetPhysicalInteractionLength(
G4double AlongStepGetPhysicalInteractionLength(
const G4Track&,
G4double previousStepSize,
G4double currentMinimalStep,
@@ -166,21 +164,24 @@ public:
// The function overloads the corresponding function of the base
// class.
inline virtual G4double PostStepGetPhysicalInteractionLength(
G4double PostStepGetPhysicalInteractionLength(
const G4Track&,
G4double previousStepSize,
G4ForceCondition* condition);
// This method does not used for tracking, it is intended only for tests
inline virtual G4double ContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety);
inline G4double ContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety);
//------------------------------------------------------------------------
// Specific methods to build and access Physics Tables
//------------------------------------------------------------------------
// Build empty Physics Vector
G4PhysicsVector* PhysicsVector(const G4MaterialCutsCouple*);
inline void SetBinning(G4int nbins);
inline G4int Binning() const;
@@ -206,9 +207,10 @@ public:
// Specific methods to set, access, modify models
//------------------------------------------------------------------------
void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
inline void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idxRegion) const;
inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
size_t& idxRegion) const;
// Access to models
inline G4VEmModel* GetModelByIndex(G4int idx = 0);
@@ -235,27 +237,27 @@ public:
protected:
// This method is used for tracking, it returns mean free path value
inline virtual G4double GetMeanFreePath(const G4Track& track,
G4double,
G4ForceCondition* condition);
G4double GetMeanFreePath(const G4Track& track,
G4double,
G4ForceCondition* condition);
//------------------------------------------------------------------------
// Run time methods
//------------------------------------------------------------------------
// This method is not used for tracking, it returns step limit
G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety);
inline G4double GetLambda(const G4ParticleDefinition* p, G4double& kineticEnergy);
// This method is used for tracking, it returns step limit
inline G4double GetMscContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety);
// This method is not used for tracking, it returns step limit
inline virtual G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety);
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety);
inline G4VEmModel* SelectModel(G4double kinEnergy);
// Select concrete model
@@ -333,43 +335,6 @@ inline void G4VMultipleScattering::DefineMaterial(const G4MaterialCutsCouple* co
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::PostStepGetPhysicalInteractionLength(
const G4Track&, G4double, G4ForceCondition* condition)
{
*condition = Forced;
return DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::GetMeanFreePath(
const G4Track&, G4double, G4ForceCondition* condition)
{
*condition = Forced;
return DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VMultipleScattering::AlongStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety,
G4GPILSelection* selection)
{
// get Step limit proposed by the process
valueGPILSelectionMSC = NotCandidateForSelection;
G4double steplength = GetMscContinuousStepLimit(track,previousStepSize,
currentMinimalStep,currentSafety);
// G4cout << "StepLimit= " << steplength << G4endl;
// set return value for G4GPILSelection
*selection = valueGPILSelectionMSC;
return steplength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::GetMscContinuousStepLimit(
const G4Track& track,
G4double,
@@ -394,18 +359,6 @@ inline G4double G4VMultipleScattering::GetMscContinuousStepLimit(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::GetContinuousStepLimit(
const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety)
{
return GetMscContinuousStepLimit(track,previousStepSize,currentMinimalStep,
currentSafety);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::ContinuousStepLimit(
const G4Track& track,
G4double previousStepSize,
@@ -434,31 +387,6 @@ inline G4double G4VMultipleScattering::GetLambda(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VParticleChange* G4VMultipleScattering::AlongStepDoIt(
const G4Track&,
const G4Step& step)
{
fParticleChange.ProposeTrueStepLength(
currentModel->ComputeTrueStepLength(step.GetStepLength()));
return &fParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VParticleChange* G4VMultipleScattering::PostStepDoIt(const G4Track& track,
const G4Step& step)
{
fParticleChange.Initialize(track);
std::vector<G4DynamicParticle*>* p=0;
currentModel->SampleSecondaries(p, currentCouple,
track.GetDynamicParticle(),
step.GetStepLength(),
step.GetPostStepPoint()->GetSafety());
return &fParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VMultipleScattering::SelectModel(G4double kinEnergy)
{
return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
@@ -617,12 +545,26 @@ inline G4PhysicsTable* G4VMultipleScattering::LambdaTable() const
return theLambdaTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
const G4MaterialCutsCouple* G4VMultipleScattering::CurrentMaterialCutsCouple() const
{
return currentCouple;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* p,
const G4Region* region)
{
G4VEmFluctuationModel* fm = 0;
modelManager->AddEmModel(order, p, fm, region);
if(p)p->SetParticleChange(pParticleChange);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VMultipleScattering::GetModelByIndex(G4int idx)
{
return modelManager->GetModel(idx);
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ionEffectiveCharge.hh,v 1.8 2006/08/15 16:21:39 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4DummyModel.cc,v 1.3 2007/05/22 17:31:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCalculator.cc,v 1.36 2007/03/15 12:34:47 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4EmCalculator.cc,v 1.37 2007/08/16 15:55:42 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -797,7 +797,12 @@ const G4Material* G4EmCalculator::FindMaterial(const G4String& name)
const G4Region* G4EmCalculator::FindRegion(const G4String& reg)
{
return G4RegionStore::GetInstance()->GetRegion(reg);
const G4Region* r = 0;
if(reg != "" || reg != "world")
r = G4RegionStore::GetInstance()->GetRegion(reg);
else
r = G4RegionStore::GetInstance()->GetRegion("DefaultRegionForTheWorld");
return r;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4EmCorrections.cc,v 1.22 2007/05/18 18:39:55 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmModelManager.cc,v 1.39 2007/04/12 11:55:07 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4EmModelManager.cc,v 1.40 2007/11/09 11:35:54 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -74,18 +74,6 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4EmModelManager.hh"
#include "G4LossTableManager.hh"
#include "G4Step.hh"
#include "G4ParticleDefinition.hh"
#include "G4DataVector.hh"
#include "G4PhysicsVector.hh"
#include "G4Gamma.hh"
#include "G4Positron.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4ProductionCutsTable.hh"
#include "G4Region.hh"
#include "G4RegionStore.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -110,6 +98,21 @@ G4RegionModels::~G4RegionModels()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4LossTableManager.hh"
#include "G4Step.hh"
#include "G4ParticleDefinition.hh"
#include "G4PhysicsVector.hh"
#include "G4Gamma.hh"
#include "G4Positron.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4ProductionCutsTable.hh"
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4Gamma.hh"
#include "G4Positron.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmModelManager::G4EmModelManager():
nEmModels(0),
nRegions(0),
@@ -127,6 +130,8 @@ G4EmModelManager::G4EmModelManager():
upperEkin.clear();
maxCutInRange = 12.*cm;
maxSubCutInRange = 0.7*mm;
theGamma = G4Gamma::Gamma();
thePositron = G4Positron::Positron();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -408,9 +413,9 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
G4double subcut = DBL_MAX;
if(secondaryParticle) {
size_t idx = 1;
if( secondaryParticle == G4Gamma::Gamma() ) idx = 0;
if( secondaryParticle == theGamma ) idx = 0;
cut = (*theCoupleTable->GetEnergyCutsVector(idx))[i];
if( secondaryParticle == G4Positron::Positron() && cut < DBL_MAX )
if( secondaryParticle == thePositron && cut < DBL_MAX )
cut += (*theCoupleTable->GetEnergyCutsVector(2))[i] +
2.0*electron_mass_c2;
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4EmMultiModel.cc,v 1.6 2007/05/22 17:31:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmProcessOptions.cc,v 1.21 2007/05/18 18:39:55 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4EmProcessOptions.cc,v 1.22 2007/11/07 18:38:49 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -76,6 +76,7 @@ G4EmProcessOptions::~G4EmProcessOptions()
void G4EmProcessOptions::SetLossFluctuations(G4bool val)
{
theManager->SetLossFluctuations(val);
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
@@ -89,6 +90,7 @@ void G4EmProcessOptions::SetLossFluctuations(G4bool val)
void G4EmProcessOptions::SetSubCutoff(G4bool val, const G4Region* r)
{
theManager->SetSubCutoff(val);
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
@@ -102,6 +104,7 @@ void G4EmProcessOptions::SetSubCutoff(G4bool val, const G4Region* r)
void G4EmProcessOptions::SetIntegral(G4bool val)
{
theManager->SetIntegral(val);
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
@@ -115,6 +118,7 @@ void G4EmProcessOptions::SetIntegral(G4bool val)
void G4EmProcessOptions::SetMinSubRange(G4double val)
{
theManager->SetMinSubRange(val);
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
@@ -128,6 +132,7 @@ void G4EmProcessOptions::SetMinSubRange(G4double val)
void G4EmProcessOptions::SetMinEnergy(G4double val)
{
theManager->SetMinEnergy(val);
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
@@ -155,6 +160,7 @@ void G4EmProcessOptions::SetMinEnergy(G4double val)
void G4EmProcessOptions::SetMaxEnergy(G4double val)
{
theManager->SetMaxEnergy(val);
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
@@ -182,6 +188,7 @@ void G4EmProcessOptions::SetMaxEnergy(G4double val)
void G4EmProcessOptions::SetMaxEnergyForCSDARange(G4double val)
{
theManager->SetMaxEnergyForCSDARange(val);
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
@@ -195,6 +202,7 @@ void G4EmProcessOptions::SetMaxEnergyForCSDARange(G4double val)
void G4EmProcessOptions::SetMaxEnergyForMuons(G4double val)
{
theManager->SetMaxEnergyForMuons(val);
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
@@ -227,13 +235,13 @@ void G4EmProcessOptions::SetMaxEnergyForMuons(G4double val)
}
}
*/
theManager->SetMaxEnergyForMuons(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetDEDXBinning(G4int val)
{
theManager->SetDEDXBinning(val);
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
@@ -247,6 +255,7 @@ void G4EmProcessOptions::SetDEDXBinning(G4int val)
void G4EmProcessOptions::SetDEDXBinningForCSDARange(G4int val)
{
theManager->SetDEDXBinningForCSDARange(val);
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
@@ -260,6 +269,7 @@ void G4EmProcessOptions::SetDEDXBinningForCSDARange(G4int val)
void G4EmProcessOptions::SetLambdaBinning(G4int val)
{
theManager->SetLambdaBinning(val);
const std::vector<G4VEmProcess*>& w =
theManager->GetEmProcessVector();
std::vector<G4VEmProcess*>::const_iterator itp;
@@ -280,6 +290,7 @@ void G4EmProcessOptions::SetLambdaBinning(G4int val)
void G4EmProcessOptions::SetStepFunction(G4double v1, G4double v2)
{
theManager->SetStepFunction(v1, v2);
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
@@ -293,6 +304,7 @@ void G4EmProcessOptions::SetStepFunction(G4double v1, G4double v2)
void G4EmProcessOptions::SetRandomStep(G4bool val)
{
theManager->SetRandomStep(val);
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
@@ -25,7 +25,7 @@
//
//
// $Id: G4EnergyLossMessenger.cc,v 1.29 2007/06/11 14:56:51 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -25,7 +25,7 @@
//
//
// $Id: G4EnergyLossTables.cc,v 1.33 2006/06/29 19:55:09 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
// first version created by P.Urban , 06/04/1998
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4LossTableBuilder.cc,v 1.24 2007/02/16 11:59:35 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4LossTableManager.cc,v 1.84 2007/06/14 07:28:48 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4VEmFluctuationModel.cc,v 1.2 2006/06/29 19:55:15 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmModel.cc,v 1.6 2006/06/29 19:55:17 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4VEmModel.cc,v 1.8 2007/09/25 10:19:07 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -94,7 +94,7 @@ G4double G4VEmModel::ComputeMeanFreePath(const G4ParticleDefinition* p,
{
G4double mfp = DBL_MAX;
G4double cross = CrossSectionPerVolume(material,p,ekin,emin,emax);
if (cross >0.) mfp = 1./cross;
if (cross > DBL_MIN) mfp = 1./cross;
return mfp;
}
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmProcess.cc,v 1.40 2007/05/23 08:43:46 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4VEmProcess.cc,v 1.48 2007/10/29 08:38:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -50,6 +50,7 @@
// 11-01-06 add A to parameters of ComputeCrossSectionPerAtom (VI)
// 12-09-06 add SetModel() (mma)
// 12-04-07 remove double call to Clear model manager (V.Ivanchenko)
// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
//
// Class Description:
//
@@ -118,7 +119,10 @@ G4VEmProcess::~G4VEmProcess()
G4cout << "G4VEmProcess destruct " << GetProcessName()
<< G4endl;
Clear();
if(theLambdaTable) theLambdaTable->clearAndDestroy();
if(theLambdaTable) {
theLambdaTable->clearAndDestroy();
delete theLambdaTable;
}
delete modelManager;
(G4LossTableManager::Instance())->DeRegister(this);
}
@@ -139,8 +143,7 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
if(particle == &part) {
Clear();
InitialiseProcess(particle);
theCutsGamma =
modelManager->Initialise(particle,secondaryParticle,2.,verboseLevel);
theCuts = modelManager->Initialise(particle,secondaryParticle,2.,verboseLevel);
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
theCutsGamma = theCoupleTable->GetEnergyCutsVector(idxG4GammaCut);
@@ -229,11 +232,74 @@ void G4VEmProcess::BuildLambdaTable()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p,
const G4Region* region)
G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition)
{
modelManager->AddEmModel(order, p, 0, region);
if(p) p->SetParticleChange(pParticleChange);
// condition is set to "Not Forced"
*condition = NotForced;
G4double x = DBL_MAX;
if(previousStepSize <= DBL_MIN) theNumberOfInteractionLengthLeft = -1.0;
InitialiseStep(track);
if(preStepKinEnergy < mfpKinEnergy) {
if (integral) ComputeIntegralLambda(preStepKinEnergy);
else preStepLambda = GetCurrentLambda(preStepKinEnergy);
if(preStepLambda <= DBL_MIN) mfpKinEnergy = 0.0;
}
// non-zero cross section
if(preStepLambda > DBL_MIN) {
if (theNumberOfInteractionLengthLeft < 0.0) {
// beggining of tracking (or just after DoIt of this process)
ResetNumberOfInteractionLengthLeft();
} else if(currentInteractionLength < DBL_MAX) {
// subtract NumberOfInteractionLengthLeft
SubtractNumberOfInteractionLengthLeft(previousStepSize);
if(theNumberOfInteractionLengthLeft < 0.)
theNumberOfInteractionLengthLeft = perMillion;
}
// get mean free path and step limit
currentInteractionLength = 1.0/preStepLambda;
x = theNumberOfInteractionLengthLeft * currentInteractionLength;
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cout << "G4VEmProcess::PostStepGetPhysicalInteractionLength ";
G4cout << "[ " << GetProcessName() << "]" << G4endl;
G4cout << " for " << particle->GetParticleName()
<< " in Material " << currentMaterial->GetName()
<< " Ekin(MeV)= " << preStepKinEnergy/MeV
<<G4endl;
G4cout << "MeanFreePath = " << currentInteractionLength/cm << "[cm]"
<< "InteractionLength= " << x/cm <<"[cm] " <<G4endl;
}
#endif
// zero cross section case
} else {
if(theNumberOfInteractionLengthLeft > DBL_MIN &&
currentInteractionLength < DBL_MAX) {
// subtract NumberOfInteractionLengthLeft
SubtractNumberOfInteractionLengthLeft(previousStepSize);
if(theNumberOfInteractionLengthLeft < 0.)
theNumberOfInteractionLengthLeft = perMillion;
}
currentInteractionLength = DBL_MAX;
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VEmProcess::GetMeanFreePath(const G4Track& track,
G4double,
G4ForceCondition* condition)
{
*condition = NotForced;
return G4VEmProcess::MeanFreePath(track);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -283,7 +349,8 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
secParticles.clear();
currentModel->SampleSecondaries(&secParticles,
currentCouple,
track.GetDynamicParticle());
track.GetDynamicParticle(),
(*theCuts)[currentMaterialIndex]);
// save secondaries
G4int num = secParticles.size();
@@ -25,7 +25,7 @@
//
//
// $Id: G4VEnergyLoss.cc,v 1.46 2006/06/29 19:55:21 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// --------------------------------------------------------------
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEnergyLossProcess.cc,v 1.109 2007/06/20 12:43:55 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4VEnergyLossProcess.cc,v 1.122 2007/11/07 18:38:49 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -105,6 +105,7 @@
// 10-04-07 use unique SafetyHelper (V.Ivanchenko)
// 12-04-07 Add verbosity at destruction (V.Ivanchenko)
// 25-04-07 move initialisation of safety helper to BuildPhysicsTable (VI)
// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
//
// Class Description:
//
@@ -175,7 +176,6 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
lambdaFactor(0.8),
mfpKinEnergy(0.0),
lossFluctuationFlag(true),
lossFluctuationArePossible(true),
rndmStepFlag(false),
tablesAreBuilt(false),
integral(true),
@@ -205,7 +205,6 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
// initialise model
(G4LossTableManager::Instance())->Register(this);
emModel[0]=emModel[1]=emModel[2]=emModel[3]=emModel[4]=0;
fluctModel = 0;
scoffRegions.clear();
@@ -232,18 +231,48 @@ G4VEnergyLossProcess::~G4VEnergyLossProcess()
if ( !baseParticle ) {
if(theDEDXTable && theRangeTableForLoss) {
if(theIonisationTable == theDEDXTable) theIonisationTable = 0;
theDEDXTable->clearAndDestroy();
if(theDEDXSubTable) theDEDXSubTable->clearAndDestroy();
delete theDEDXTable;
if(theDEDXSubTable) {
if(theIonisationSubTable == theDEDXSubTable)
theIonisationSubTable = 0;
theDEDXSubTable->clearAndDestroy();
delete theDEDXSubTable;
}
}
if(theIonisationTable) theIonisationTable->clearAndDestroy();
if(theIonisationSubTable) theIonisationSubTable->clearAndDestroy();
if(theDEDXunRestrictedTable && theCSDARangeTable)
if(theIonisationTable) {
theIonisationTable->clearAndDestroy();
delete theIonisationTable;
}
if(theIonisationSubTable) {
theIonisationSubTable->clearAndDestroy();
delete theIonisationSubTable;
}
if(theDEDXunRestrictedTable && theCSDARangeTable) {
theDEDXunRestrictedTable->clearAndDestroy();
if(theCSDARangeTable) theCSDARangeTable->clearAndDestroy();
if(theRangeTableForLoss) theRangeTableForLoss->clearAndDestroy();
if(theInverseRangeTable) theInverseRangeTable->clearAndDestroy();
if(theLambdaTable) theLambdaTable->clearAndDestroy();
if(theSubLambdaTable) theSubLambdaTable->clearAndDestroy();
delete theDEDXunRestrictedTable;
}
if(theCSDARangeTable) {
theCSDARangeTable->clearAndDestroy();
delete theCSDARangeTable;
}
if(theRangeTableForLoss) {
theRangeTableForLoss->clearAndDestroy();
delete theRangeTableForLoss;
}
if(theInverseRangeTable) {
theInverseRangeTable->clearAndDestroy();
delete theInverseRangeTable;
}
if(theLambdaTable) {
theLambdaTable->clearAndDestroy();
delete theLambdaTable;
}
if(theSubLambdaTable) {
theSubLambdaTable->clearAndDestroy();
delete theSubLambdaTable;
}
}
delete modelManager;
@@ -585,6 +614,118 @@ G4PhysicsTable* G4VEnergyLossProcess::BuildLambdaTable(G4EmTableType tType)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VEnergyLossProcess::GetContinuousStepLimit(
const G4Track&,
G4double, G4double, G4double&)
{
return DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VEnergyLossProcess::AlongStepGetPhysicalInteractionLength(
const G4Track&,
G4double,
G4double currentMinStep,
G4double&,
G4GPILSelection* selection)
{
G4double x = DBL_MAX;
*selection = aGPILSelection;
if(isIonisation) {
fRange = GetScaledRangeForScaledEnergy(preStepScaledEnergy)*reduceFactor;
x = fRange;
G4double y = x*dRoverRange;
if(x > finalRange && y < currentMinStep) {
x = y + finalRange*(1.0 - dRoverRange)*(2.0 - finalRange/fRange);
} else if (rndmStepFlag) x = SampleRange();
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy
// <<" range= "<<fRange <<" cMinSt="<<currentMinStep
// <<" safety= " << safety<< " limit= " << x <<G4endl;
}
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy
// <<" stepLimit= "<<x<<G4endl;
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VEnergyLossProcess::GetMeanFreePath(
const G4Track& track,
G4double,
G4ForceCondition* condition)
{
*condition = NotForced;
return MeanFreePath(track);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition)
{
// condition is set to "Not Forced"
*condition = NotForced;
G4double x = DBL_MAX;
if(previousStepSize <= DBL_MIN) theNumberOfInteractionLengthLeft = -1.0;
InitialiseStep(track);
if(preStepScaledEnergy < mfpKinEnergy) {
if (integral) ComputeLambdaForScaledEnergy(preStepScaledEnergy);
else preStepLambda = GetLambdaForScaledEnergy(preStepScaledEnergy);
if(preStepLambda <= DBL_MIN) mfpKinEnergy = 0.0;
}
// non-zero cross section
if(preStepLambda > DBL_MIN) {
if (theNumberOfInteractionLengthLeft < 0.0) {
// beggining of tracking (or just after DoIt of this process)
ResetNumberOfInteractionLengthLeft();
} else if(currentInteractionLength < DBL_MAX) {
// subtract NumberOfInteractionLengthLeft
SubtractNumberOfInteractionLengthLeft(previousStepSize);
if(theNumberOfInteractionLengthLeft < 0.)
theNumberOfInteractionLengthLeft = perMillion;
}
// get mean free path and step limit
currentInteractionLength = 1.0/preStepLambda;
x = theNumberOfInteractionLengthLeft * currentInteractionLength;
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cout << "G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength ";
G4cout << "[ " << GetProcessName() << "]" << G4endl;
G4cout << " for " << particle->GetParticleName()
<< " in Material " << currentMaterial->GetName()
<< " Ekin(MeV)= " << preStepKinEnergy/MeV
<<G4endl;
G4cout << "MeanFreePath = " << currentInteractionLength/cm << "[cm]"
<< "InteractionLength= " << x/cm <<"[cm] " <<G4endl;
}
#endif
// zero cross section case
} else {
if(theNumberOfInteractionLengthLeft > DBL_MIN &&
currentInteractionLength < DBL_MAX) {
// subtract NumberOfInteractionLengthLeft
SubtractNumberOfInteractionLengthLeft(previousStepSize);
if(theNumberOfInteractionLengthLeft < 0.)
theNumberOfInteractionLengthLeft = perMillion;
}
currentInteractionLength = DBL_MAX;
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
const G4Step& step)
{
@@ -597,7 +738,7 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
if(length <= DBL_MIN) return &fParticleChange;
G4double eloss = 0.0;
/*
/*
if(-1 < verboseLevel) {
const G4ParticleDefinition* d = track.GetDefinition();
G4cout << "AlongStepDoIt for "
@@ -623,19 +764,17 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
// Short step
eloss = GetDEDXForScaledEnergy(preStepScaledEnergy)*length;
// if( length <= linLossLimit * fRange ) {
// eloss = GetDEDXForScaledEnergy(preStepScaledEnergy)*length;
// Long step
//} else {
if(eloss > preStepKinEnergy*linLossLimit) {
G4double r = GetScaledRangeForScaledEnergy(preStepScaledEnergy);
G4double x = r - length/reduceFactor;
eloss = (ScaledKinEnergyForLoss(r) - ScaledKinEnergyForLoss(x))/massRatio;
G4double x =
GetScaledRangeForScaledEnergy(preStepScaledEnergy) - length/reduceFactor;
eloss = preStepKinEnergy - ScaledKinEnergyForLoss(x)/massRatio;
/*
if(-1 < verboseLevel)
G4cout << "Long STEP: rPre(mm)= " << r/mm
G4cout << "Long STEP: rPre(mm)= "
<< GetScaledRangeForScaledEnergy(preStepScaledEnergy)/mm
<< " rPost(mm)= " << x/mm
<< " ePre(MeV)= " << preStepScaledEnergy/MeV
<< " eloss(MeV)= " << eloss/MeV
@@ -647,7 +786,7 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
G4VEmModel* currentModel = SelectModel(preStepScaledEnergy);
/*
/*
G4double eloss0 = eloss;
if(-1 < verboseLevel ) {
G4cout << "Before fluct: eloss(MeV)= " << eloss/MeV
@@ -657,7 +796,7 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
<< " fluct= " << lossFluctuationFlag
<< G4endl;
}
*/
*/
G4double cut = (*theCuts)[currentMaterialIndex];
G4double esec = 0.0;
@@ -712,7 +851,6 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
cut = (*theSubCuts)[currentMaterialIndex];
eloss -= GetSubDEDXForScaledEnergy(preStepScaledEnergy)*length;
if(eloss < 0.0) eloss = 0.0;
scTracks.clear();
SampleSubCutSecondaries(scTracks, step,
currentModel,currentMaterialIndex,
@@ -749,15 +887,16 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
CorrectionsAlongStep(currentCouple, dynParticle, eloss, length);
// Sample fluctuations
if (lossFluctuationFlag &&
if (lossFluctuationFlag) {
G4VEmFluctuationModel* fluc = currentModel->GetModelOfFluctuations();
if(fluc &&
(eloss + esec + esecdep + lowestKinEnergy) < preStepKinEnergy) {
G4double tmax =
std::min(currentModel->MaxSecondaryKinEnergy(dynParticle),cut);
eloss = currentModel->GetModelOfFluctuations()->
SampleFluctuations(currentMaterial,dynParticle,tmax,length,eloss);
/*
G4double tmax =
std::min(currentModel->MaxSecondaryKinEnergy(dynParticle),cut);
eloss = fluc->SampleFluctuations(currentMaterial,dynParticle,
tmax,length,eloss);
/*
if(-1 < verboseLevel)
G4cout << "After fluct: eloss(MeV)= " << eloss/MeV
<< " fluc= " << (eloss-eloss0)/MeV
@@ -765,10 +904,12 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
<< " massRatio= " << massRatio
<< " tmax= " << tmax
<< G4endl;
*/
*/
}
}
// add low-energy subcutoff particles
eloss += esecdep;
if(eloss < 0.0) eloss = 0.0;
// Energy balanse
G4double finalT = preStepKinEnergy - eloss - esec;
@@ -780,7 +921,7 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
fParticleChange.SetProposedKineticEnergy(finalT);
fParticleChange.ProposeLocalEnergyDeposit(eloss);
/*
/*
if(-1 < verboseLevel) {
G4cout << "Final value eloss(MeV)= " << eloss/MeV
<< " preStepKinEnergy= " << preStepKinEnergy
@@ -831,7 +972,7 @@ void G4VEnergyLossProcess::SampleSubCutSecondaries(
G4ThreeVector prepoint = preStepPoint->GetPosition();
G4ThreeVector dr = step.GetPostStepPoint()->GetPosition() - prepoint;
G4double pretime = preStepPoint->GetGlobalTime();
G4double dt = length/preStepPoint->GetVelocity();
// G4double dt = length/preStepPoint->GetVelocity();
G4double fragment = 0.0;
do {
@@ -841,7 +982,8 @@ void G4VEnergyLossProcess::SampleSubCutSecondaries(
// sample secondaries
secParticles.clear();
model->SampleSecondaries(&secParticles,track->GetMaterialCutsCouple(),dp,subcut,cut);
model->SampleSecondaries(&secParticles,track->GetMaterialCutsCouple(),
dp,subcut,cut);
// position of subcutoff particles
G4ThreeVector r = prepoint + fragment*dr;
@@ -862,7 +1004,8 @@ void G4VEnergyLossProcess::SampleSubCutSecondaries(
}
}
if(addSec) {
G4Track* t = new G4Track((*it), pretime + fragment*dt, r);
// G4Track* t = new G4Track((*it), pretime + fragment*dt, r);
G4Track* t = new G4Track((*it), pretime, r);
t->SetTouchableHandle(track->GetTouchableHandle());
tracks.push_back(t);
@@ -969,6 +1112,7 @@ void G4VEnergyLossProcess::PrintInfoDefinition()
G4cout << " Step function: finalRange(mm)= " << finalRange/mm
<< ", dRoverRange= " << dRoverRange
<< ", integral: " << integral
<< ", fluct: " << lossFluctuationFlag
<< G4endl;
if(theCSDARangeTable && isIonisation)
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VMultipleScattering.cc,v 1.43 2007/05/18 18:39:55 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4VMultipleScattering.cc,v 1.47 2007/11/09 11:35:54 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -53,6 +53,7 @@
// 15-04-05 remove boundary flag (V.Ivanchenko)
// 27-10-05 introduce virtual function MscStepLimitation() (V.Ivanchenko)
// 12-04-07 Add verbosity at destruction (V.Ivanchenko)
// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
//
// Class Description:
//
@@ -79,6 +80,7 @@
#include "G4RegionStore.hh"
#include "G4PhysicsTableHelper.hh"
#include "G4GenericIon.hh"
#include "G4Electron.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -115,7 +117,10 @@ G4VMultipleScattering::~G4VMultipleScattering()
G4cout << "G4VMultipleScattering destruct " << GetProcessName()
<< G4endl;
delete modelManager;
if (theLambdaTable) theLambdaTable->clearAndDestroy();
if (theLambdaTable) {
theLambdaTable->clearAndDestroy();
delete theLambdaTable;
}
(G4LossTableManager::Instance())->DeRegister(this);
}
@@ -197,7 +202,9 @@ void G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part
if(buildLambdaTable)
theLambdaTable = G4PhysicsTableHelper::PreparePhysicsTable(theLambdaTable);
const G4DataVector* theCuts =
modelManager->Initialise(firstParticle, 0, 10.0, verboseLevel);
modelManager->Initialise(firstParticle,
G4Electron::Electron(),
10.0, verboseLevel);
if(2 < verboseLevel) G4cout << theCuts << G4endl;
@@ -206,16 +213,6 @@ void G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* p,
const G4Region* region)
{
G4VEmFluctuationModel* fm = 0;
modelManager->AddEmModel(order, p, fm, region);
if(p)p->SetParticleChange(pParticleChange);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VMultipleScattering::PrintInfoDefinition()
{
if (0 < verboseLevel) {
@@ -240,6 +237,76 @@ void G4VMultipleScattering::PrintInfoDefinition()
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4VMultipleScattering::AlongStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety,
G4GPILSelection* selection)
{
// get Step limit proposed by the process
valueGPILSelectionMSC = NotCandidateForSelection;
G4double steplength = GetMscContinuousStepLimit(track,previousStepSize,
currentMinimalStep,currentSafety);
// G4cout << "StepLimit= " << steplength << G4endl;
// set return value for G4GPILSelection
*selection = valueGPILSelectionMSC;
return steplength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VMultipleScattering::PostStepGetPhysicalInteractionLength(
const G4Track&, G4double, G4ForceCondition* condition)
{
*condition = Forced;
return DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VMultipleScattering::GetContinuousStepLimit(
const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety)
{
return GetMscContinuousStepLimit(track,previousStepSize,currentMinimalStep,
currentSafety);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VMultipleScattering::GetMeanFreePath(
const G4Track&, G4double, G4ForceCondition* condition)
{
*condition = Forced;
return DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange* G4VMultipleScattering::AlongStepDoIt(const G4Track&,
const G4Step& step)
{
fParticleChange.ProposeTrueStepLength(
currentModel->ComputeTrueStepLength(step.GetStepLength()));
return &fParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange* G4VMultipleScattering::PostStepDoIt(const G4Track& track,
const G4Step& step)
{
fParticleChange.Initialize(track);
currentModel->SampleScattering(track.GetDynamicParticle(),
step.GetPostStepPoint()->GetSafety());
return &fParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4PhysicsVector* G4VMultipleScattering::PhysicsVector(const G4MaterialCutsCouple* couple)
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ionEffectiveCharge.cc,v 1.14 2006/08/15 16:21:39 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4ionEffectiveCharge.cc,v 1.17 2007/09/27 17:08:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -43,6 +43,7 @@
// 28.04.2006 Set upper energy limit to 50 MeV (V.Ivanchenko)
// 23.05.2006 Set upper energy limit to Z*10 MeV (V.Ivanchenko)
// 15.08.2006 Add protection for not defined material (V.Ivanchenko)
// 27-09-2007 Use Fermi energy from material, optimazed formulas (V.Ivanchenko)
//
// -------------------------------------------------------------------
@@ -92,70 +93,10 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
G4double reducedEnergy = kineticEnergy * proton_mass_c2/mass ;
if( reducedEnergy > Zi*energyHighLimit || Zi < 1.5 || !material) return charge;
static G4double vFermi[92] = {
1.0309, 0.15976, 0.59782, 1.0781, 1.0486, 1.0, 1.058, 0.93942, 0.74562, 0.3424,
0.45259, 0.71074, 0.90519, 0.97411, 0.97184, 0.89852, 0.70827, 0.39816, 0.36552, 0.62712,
0.81707, 0.9943, 1.1423, 1.2381, 1.1222, 0.92705, 1.0047, 1.2, 1.0661, 0.97411,
0.84912, 0.95, 1.0903, 1.0429, 0.49715, 0.37755, 0.35211, 0.57801, 0.77773, 1.0207,
1.029, 1.2542, 1.122, 1.1241, 1.0882, 1.2709, 1.2542, 0.90094, 0.74093, 0.86054,
0.93155, 1.0047, 0.55379, 0.43289, 0.32636, 0.5131, 0.695, 0.72591, 0.71202, 0.67413,
0.71418, 0.71453, 0.5911, 0.70263, 0.68049, 0.68203, 0.68121, 0.68532, 0.68715, 0.61884,
0.71801, 0.83048, 1.1222, 1.2381, 1.045, 1.0733, 1.0953, 1.2381, 1.2879, 0.78654,
0.66401, 0.84912, 0.88433, 0.80746, 0.43357, 0.41923, 0.43638, 0.51464, 0.73087, 0.81065,
1.9578, 1.0257} ;
static G4double lFactor[92] = {
1.0, 1.0, 1.1, 1.06, 1.01, 1.03, 1.04, 0.99, 0.95, 0.9,
0.82, 0.81, 0.83, 0.88, 1.0, 0.95, 0.97, 0.99, 0.98, 0.97,
0.98, 0.97, 0.96, 0.93, 0.91, 0.9, 0.88, 0.9, 0.9, 0.9,
0.9, 0.85, 0.9, 0.9, 0.91, 0.92, 0.9, 0.9, 0.9, 0.9,
0.9, 0.88, 0.9, 0.88, 0.88, 0.9, 0.9, 0.88, 0.9, 0.9,
0.9, 0.9, 0.96, 1.2, 0.9, 0.88, 0.88, 0.85, 0.9, 0.9,
0.92, 0.95, 0.99, 1.03, 1.05, 1.07, 1.08, 1.1, 1.08, 1.08,
1.08, 1.08, 1.09, 1.09, 1.1, 1.11, 1.12, 1.13, 1.14, 1.15,
1.17, 1.2, 1.18, 1.17, 1.17, 1.16, 1.16, 1.16, 1.16, 1.16,
1.16, 1.16} ;
static G4double c[6] = {0.2865, 0.1266, -0.001429,
0.02402,-0.01135, 0.001475} ;
// get elements in the actual material,
const G4ElementVector* theElementVector = material->GetElementVector() ;
const G4double* theAtomicNumDensityVector =
material->GetAtomicNumDensityVector() ;
const G4int NumberOfElements = material->GetNumberOfElements() ;
// loop for the elements in the material
// to find out average values Z, vF, lF
G4double z = 0.0, vF = 0.0, lF = 0.0, norm = 0.0 ;
if( 1 == NumberOfElements ) {
z = material->GetZ() ;
G4int iz = G4int(z) - 1 ;
if(iz < 0) iz = 0 ;
else if(iz > 91) iz = 91 ;
vF = vFermi[iz] ;
lF = lFactor[iz] ;
} else {
for (G4int iel=0; iel<NumberOfElements; iel++)
{
const G4Element* element = (*theElementVector)[iel] ;
G4double z2 = element->GetZ() ;
const G4double weight = theAtomicNumDensityVector[iel] ;
norm += weight ;
z += z2 * weight ;
G4int iz = G4int(z2) - 1 ;
if(iz < 0) iz = 0 ;
else if(iz > 91) iz =91 ;
vF += vFermi[iz] * weight ;
lF += lFactor[iz] * weight ;
}
z /= norm ;
vF /= norm ;
lF /= norm ;
}
G4double z = material->GetIonisation()->GetZeffective();
reducedEnergy = std::max(reducedEnergy,energyLowLimit);
G4double q;
@@ -169,28 +110,40 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
y *= Q;
x += y * c[i] ;
}
G4double ex;
if(x < 0.2) ex = x * (1 - 0.5*x);
else ex = 1. - std::exp(-x);
G4double tq = 7.6 - Q;
q = (1.0 + ( 0.007 + 0.00005 * z ) * std::exp( -tq*tq )) * std::sqrt(1.0 - std::exp(-x)) ;
G4double tq2= tq*tq;
G4double tt = ( 0.007 + 0.00005 * z );
if(tq2 < 0.2) tt *= (1.0 - tq2 + 0.5*tq2*tq2);
else tt *= std::exp(-tq2);
q = (1.0 + tt) * std::sqrt(ex);
// Heavy ion case
} else {
G4double z23 = std::pow(z, 0.666667);
G4double zi13 = std::pow(Zi, 0.33333);
G4double z23 = std::pow(z, 0.666666);
G4double zi13 = std::pow(Zi, 0.333333);
G4double zi23 = zi13*zi13;
G4double e = std::max(reducedEnergy,energyBohr/z23);
// v1 is ion velocity in vF unit
G4double v1 = std::sqrt( e / energyBohr )/ vF ;
G4double eF = material->GetIonisation()->GetFermiEnergy();
G4double v1sq = e/eF;
G4double vFsq = eF/energyBohr;
G4double vF = std::sqrt(vFsq);
G4double y ;
// Faster than Fermi velocity
if ( v1 > 1.0 ) {
y = vF * v1 * ( 1.0 + 0.2 / (v1*v1) ) / zi23 ;
if ( v1sq > 1.0 ) {
y = vF * std::sqrt(v1sq) * ( 1.0 + 0.2/v1sq ) / zi23 ;
// Slower than Fermi velocity
} else {
y = 0.6923 * vF * (1.0 + 2.0*v1*v1/3.0 + v1*v1*v1*v1/15.0) / zi23 ;
y = 0.6923 * vF * (1.0 + 0.666666*v1sq + v1sq*v1sq/15.0) / zi23 ;
}
G4double y3 = std::pow(y, 0.3) ;
@@ -204,16 +157,28 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
if(q < qmin) q = qmin;
G4double tq = 7.6 - std::log(reducedEnergy/keV);
G4double sq = 1.0 + ( 0.18 + 0.0015 * z ) * std::exp( -tq*tq )/ (Zi*Zi);
G4double tq2= tq*tq;
G4double sq = ( 0.18 + 0.0015 * z ) / (Zi*Zi);
if(tq2 < 0.2) sq *= (1.0 - tq2 + 0.5*tq2*tq2);
else sq *= std::exp(-tq2);
sq += 1.0;
// G4cout << "sq= " << sq << G4endl;
// Screen length according to
// J.F.Ziegler and J.M.Manoyan, The stopping of ions in compaunds,
// Nucl. Inst. & Meth. in Phys. Res. B35 (1988) 215-228.
G4double lambda = 10.0 * vF * std::pow(1.0-q, 0.6667) / (zi13 * (6.0 + q)) ;
chargeCorrection = sq * (1.0 + (0.5/q - 0.5)*std::log(1.0 + lambda*lambda)/(vF*vF) );
G4double lambda = 10.0 * vF / (zi13 * (6.0 + q));
if(q < 0.2) lambda *= (1.0 - 0.666666*q - 0.444444*q*q);
else lambda *= std::pow(1.0-q, 0.666666);
G4double lambda2 = lambda*lambda;
G4double xx = (0.5/q - 0.5)/vFsq;
if(lambda2 < 0.2) xx *= lambda2*(1.0 - 0.5*lambda2);
else xx *= std::log(1.0 + lambda2);
chargeCorrection = sq * (1.0 + xx);
}
// G4cout << "G4ionEffectiveCharge: charge= " << charge << " q= " << q
// << " chargeCor= " << chargeCorrection