Import Geant4 6.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:56:29 +02:00
parent 1d812b78b1
commit e083ffb441
1415 changed files with 111223 additions and 21207 deletions
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4BohrFluctuations.hh,v 1.5 2003/10/16 13:06:39 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4BohrFluctuations.hh,v 1.6 2004/05/11 15:35:06 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// -------------------------------------------------------------------
//
@@ -106,6 +106,8 @@ inline G4double G4BohrFluctuations::Dispersion(
G4double& tmax,
G4double& length)
{
if(!particle) InitialiseMe(dp->GetDefinition());
G4double electronDensity = material->GetElectronDensity();
kineticEnergy = dp->GetKineticEnergy();
G4double gam = kineticEnergy/particleMass + 1.0;
@@ -0,0 +1,136 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4EmMultiModel.hh,v 1.1 2004/05/03 13:13:07 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4EmMultiModel
//
// Author: Vladimir Ivanchenko
//
// Creation date: 03.05.2004
//
// Modifications:
//
//
//
// Class Description:
//
// Energy loss model using several G4VEmModels
// -------------------------------------------------------------------
//
#ifndef G4EmMultiModel_h
#define G4EmMultiModel_h 1
#include "globals.hh"
#include "G4VEmModel.hh"
#include <vector>
class G4Region;
class G4PhysicsTable;
class G4DynamicParticle;
class G4EmMultiModel : public G4VEmModel
{
public:
G4EmMultiModel(const G4String& nam = "MultiModel");
~G4EmMultiModel();
void Initialise(const G4ParticleDefinition*, const G4DataVector&);
G4double HighEnergyLimit(const G4ParticleDefinition*) {return highKinEnergy;};
G4double LowEnergyLimit(const G4ParticleDefinition*) {return lowKinEnergy;};
void SetHighEnergyLimit(G4double e) {highKinEnergy = e;};
void SetLowEnergyLimit(G4double e) {lowKinEnergy = e;};
G4double MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple*);
G4bool IsInCharge(const G4ParticleDefinition*);
G4double ComputeDEDX(const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy);
G4double CrossSection(const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxEnergy);
G4DynamicParticle* SampleSecondary(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double tmax);
std::vector<G4DynamicParticle*>* SampleSecondaries(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double tmax);
G4double MaxSecondaryEnergy(const G4DynamicParticle* dynParticle);
void DefineForRegion(const G4Region*);
void SetDynamicParticle(const G4DynamicParticle*);
void AddModel(G4VEmModel*, G4double tmin, G4double tmax);
protected:
G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kineticEnergy);
private:
// hide assignment operator
G4EmMultiModel & operator=(const G4EmMultiModel &right);
G4EmMultiModel(const G4EmMultiModel&);
G4int nModels;
std::vector<G4VEmModel*> model;
G4DataVector tsecmin;
G4DataVector cross_section;
G4double highKinEnergy;
G4double lowKinEnergy;
};
#endif
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4EmProcessOptions.hh,v 1.1 2004/02/27 17:59:06 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4EmProcessOptions.hh,v 1.2 2004/05/17 09:46:55 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// -------------------------------------------------------------------
@@ -52,6 +52,7 @@
#include "globals.hh"
class G4LossTableManager;
class G4Region;
class G4EmProcessOptions
{
@@ -90,6 +91,12 @@ public:
void SetVerbose(G4int val, const G4String& name = "all");
void SetLambdaFactor(G4double val);
void ActivateFluorescence(G4bool val, const G4Region* r = 0);
void ActivateAugerElectronProduction(G4bool val, const G4Region* r = 0);
private:
G4EmProcessOptions & operator=(const G4EmProcessOptions &right);
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4LossTableManager.hh,v 1.21 2004/02/27 17:54:48 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4LossTableManager.hh,v 1.24 2004/05/12 12:25:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// -------------------------------------------------------------------
@@ -102,6 +102,11 @@ public:
G4double kineticEnergy,
const G4MaterialCutsCouple *couple);
G4double GetTrancatedRange(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple);
G4double GetEnergy(
const G4ParticleDefinition *aParticle,
G4double range,
@@ -259,7 +264,32 @@ inline G4double G4LossTableManager::GetDEDX(
if(currentLoss) x = currentLoss->GetDEDX(kineticEnergy, couple);
else x = G4EnergyLossTables::GetDEDX(currentParticle,kineticEnergy,couple,false);
return x;
// return currentLoss->GetDEDX(kineticEnergy, couple);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
inline G4double G4LossTableManager::GetTrancatedRange(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple)
{
if(aParticle != currentParticle) {
currentParticle = aParticle;
std::map<PD, G4VEnergyLossProcess*, std::less<PD> >::const_iterator pos;
if ((pos = loss_map.find(currentParticle)) != loss_map.end()) {
currentLoss = (*pos).second;
} else {
currentLoss = 0;
// ParticleHaveNoLoss(aParticle);
}
}
G4double x;
if(currentLoss) {
x = currentLoss->GetRangeForLoss(kineticEnergy, couple);
} else {
x = G4EnergyLossTables::GetRange(currentParticle,kineticEnergy,couple,false);
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -280,10 +310,12 @@ inline G4double G4LossTableManager::GetRange(
}
}
G4double x;
if(currentLoss) x = currentLoss->GetRange(kineticEnergy, couple);
else x = G4EnergyLossTables::GetRange(currentParticle,kineticEnergy,couple,false);
if(currentLoss) {
x = currentLoss->GetRange(kineticEnergy, couple);
} else {
x = G4EnergyLossTables::GetRange(currentParticle,kineticEnergy,couple,false);
}
return x;
// return currentLoss->GetRange(kineticEnergy, couple);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -305,9 +337,9 @@ inline G4double G4LossTableManager::GetEnergy(
}
G4double x;
if(currentLoss) x = currentLoss->GetKineticEnergy(range, couple);
else x = G4EnergyLossTables::GetPreciseEnergyFromRange(currentParticle,range,couple,false);
else x = G4EnergyLossTables::GetPreciseEnergyFromRange(currentParticle,
range,couple,false);
return x;
// return currentLoss->GetKineticEnergy(range, couple);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4MscModel.hh,v 1.9 2004/03/10 08:38:39 urban Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4MscModel.hh,v 1.11 2004/04/29 18:40:52 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// -------------------------------------------------------------------
//
@@ -44,6 +44,9 @@
// 26-11-03 new data member currentRange (L.Urban)
// 01-03-04 changes in data members + signature changed in SampleCosineTheta
// 11-03-04 changes in data members (L.Urban)
// 23-04-04 changes in data members and in signature of SampleCosineTheta
// (L.Urban)
//
// Class Description:
//
@@ -115,13 +118,14 @@ public:
G4double TrueStepLength(G4double geomStepLength);
G4double SampleCosineTheta(G4double trueStepLength,G4double KineticEnergy,
G4double lambda);
G4double SampleCosineTheta(G4double trueStepLength,G4double KineticEnergy);
G4double SampleDisplacement();
G4double MaxSecondaryEnergy(const G4DynamicParticle*) {return 0.0;};
void SetDynamicParticle(const G4DynamicParticle*);
protected:
G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
@@ -159,8 +163,8 @@ private:
G4double xsi;
G4double lambda0;
G4double parlowen ;
G4double tPathLength;
G4double par1,par2,par3 ;
G4bool samplez;
@@ -172,6 +176,13 @@ private:
};
inline void G4MscModel::SetDynamicParticle(const G4DynamicParticle* dp)
{
particle = dp->GetDefinition();
mass = dp->GetMass();
charge = dp->GetCharge()/eplus;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4UniversalFluctuation.hh,v 1.10 2003/11/06 17:18:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4UniversalFluctuation.hh,v 1.12 2004/05/11 15:35:07 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// -------------------------------------------------------------------
//
@@ -108,12 +108,10 @@ private:
G4double minNumberInteractionsBohr;
G4double theBohrBeta2;
G4double minLoss;
G4double problim;
G4double sumalim;
G4double alim;
G4double nmaxCont1;
G4double nmaxCont2;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4VEmModel.hh,v 1.17 2004/03/01 14:16:57 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4VEmModel.hh,v 1.19 2004/04/29 18:40:52 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// -------------------------------------------------------------------
//
@@ -43,8 +43,8 @@
// 23-07-03 Replace G4Material by G4MaterialCutCouple in dE/dx and CrossSection
// calculation (V.Ivanchenko)
// 01-03-04 L.Urban signature changed in SampleCosineTheta
// 23-04-04 L.urban signature of SampleCosineTheta changed back
//
//
// Class Description:
//
@@ -130,13 +130,15 @@ public:
virtual G4double TrueStepLength(G4double geomStepLength) {return geomStepLength;};
virtual G4double SampleCosineTheta(G4double,G4double,G4double ) {return 1.0;};
// trueStepLength + Tkin + lambda
virtual G4double SampleCosineTheta(G4double,G4double ) {return 1.0;};
// trueStepLength + Tkin
virtual G4double SampleDisplacement() {return 0.0;};
virtual void DefineForRegion(const G4Region*) {};
virtual void SetDynamicParticle(const G4DynamicParticle*) {};
protected:
virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4VEmProcess.hh,v 1.3 2004/03/06 13:47:20 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4VEmProcess.hh,v 1.4 2004/05/17 09:46:56 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// -------------------------------------------------------------------
//
@@ -101,12 +101,10 @@ public:
virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
// True for all charged particles
virtual
void BuildPhysicsTable(const G4ParticleDefinition&);
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
// Build physics table during initialisation
virtual void PrintInfoDefinition();
// Print out of the class parameters
G4PhysicsTable* BuildLambdaTable();
@@ -144,7 +142,7 @@ public:
void UpdateEmModel(const G4String&, G4double, G4double);
// Define new energy range for the model identified by the name
G4double GetLambda(G4double kineticEnergy, const G4MaterialCutsCouple* couple);
G4double GetLambda(G4double& kinEnergy, const G4MaterialCutsCouple* couple);
// It returns the Lambda of the process
G4double MicroscopicCrossSection(G4double kineticEnergy,
@@ -161,18 +159,21 @@ public:
const G4ParticleDefinition* Particle() const;
const G4ParticleDefinition* SecondaryParticle() const;
void ActivateFluorescence(G4bool, const G4Region* r = 0);
void ActivateAugerElectronProduction(G4bool, const G4Region* r = 0);
void SetLambdaFactor(G4double val);
protected:
void SetParticle(const G4ParticleDefinition* p);
void SetSecondaryParticle(const G4ParticleDefinition* p);
virtual
G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
virtual G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
virtual
G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*);
virtual G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*);
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*, G4double cut) = 0;
@@ -190,6 +191,10 @@ private:
void DefineMaterial(const G4MaterialCutsCouple* couple);
G4double GetLambda(G4double kinEnergy);
void ComputeLambda(G4double kinEnergy);
// hide assignment operator
G4VEmProcess(G4VEmProcess &);
@@ -203,6 +208,8 @@ private:
// tables and vectors
G4PhysicsTable* theLambdaTable;
G4double* theEnergyOfCrossSectionMax;
G4double* theCrossSectionMax;
const G4ParticleDefinition* particle;
const G4ParticleDefinition* baseParticle;
@@ -218,9 +225,12 @@ private:
G4double minKinEnergy;
G4double maxKinEnergy;
G4double lambdaFactor;
G4double preStepLambda;
G4double preStepMFP;
G4double preStepKinEnergy;
G4double mfpKinEnergy;
G4bool integral;
G4bool meanFreePath;
@@ -235,7 +245,44 @@ inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple)
currentCouple = couple;
currentMaterial = couple->GetMaterial();
currentMaterialIndex = couple->GetIndex();
if(integral && !meanFreePath) ResetNumberOfInteractionLengthLeft();
if(integral && (!meanFreePath || preStepKinEnergy < mfpKinEnergy))
ResetNumberOfInteractionLengthLeft();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
G4double x = 0.0;
if(theLambdaTable) x = GetLambda(kineticEnergy);
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambda(G4double e)
{
G4bool b;
return (((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::ComputeLambda(G4double e)
{
meanFreePath = false;
mfpKinEnergy = 0.0;
G4double emax = theEnergyOfCrossSectionMax[currentMaterialIndex];
if (e <= emax) preStepLambda = GetLambda(e);
else {
e *= lambdaFactor;
if(e > emax) {
mfpKinEnergy = e;
preStepLambda = GetLambda(e);
} else preStepLambda = theCrossSectionMax[currentMaterialIndex];
}
}
@@ -244,18 +291,16 @@ inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple)
inline G4double G4VEmProcess::GetMeanFreePath(const G4Track& track, G4double,
G4ForceCondition*)
{
DefineMaterial(track.GetMaterialCutsCouple());
preStepKinEnergy = track.GetKineticEnergy();
DefineMaterial(track.GetMaterialCutsCouple());
if (meanFreePath) {
G4bool b;
preStepLambda = (((*theLambdaTable)[currentMaterialIndex])->
GetValue(preStepKinEnergy, b));
if (integral) meanFreePath = false;
if (integral) ComputeLambda(preStepKinEnergy);
else preStepLambda = GetLambda(preStepKinEnergy);
if(0.0 < preStepLambda) preStepMFP = 1.0/preStepLambda;
else preStepMFP = DBL_MAX;
}
G4double x = DBL_MAX;
if(0.0 < preStepLambda) x = 1.0/preStepLambda;
// G4cout << GetProcessName() << ": e= " << preStepKinEnergy << " mfp= " << x << G4endl;
return x;
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy<<" mfp= "<<preStepMFP<<G4endl;
return preStepMFP;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -289,56 +334,6 @@ inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetLambdaBinning(G4int nbins)
{
nLambdaBins = nbins;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetMinKinEnergy(G4double e)
{
minKinEnergy = e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::MinKinEnergy() const
{
return minKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetMaxKinEnergy(G4double e)
{
maxKinEnergy = e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::MaxKinEnergy() const
{
return maxKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambda(G4double kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
G4double x = DBL_MAX;
G4bool b;
if(theLambdaTable) {
G4double y = (((*theLambdaTable)[currentMaterialIndex])->GetValue(kineticEnergy, b));
if(y > 0.0) x = 1.0/y;
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetMeanLifeTime(const G4Track&,
G4ForceCondition*)
{
@@ -347,7 +342,7 @@ inline G4double G4VEmProcess::GetMeanLifeTime(const G4Track&,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VParticleChange* G4VEmProcess::AtRestDoIt(const G4Track&,
inline G4VParticleChange* G4VEmProcess::AtRestDoIt(const G4Track&,
const G4Step&)
{
return 0;
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4VEnergyLossProcess.hh,v 1.9 2004/03/11 14:43:14 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4VEnergyLossProcess.hh,v 1.21 2004/05/17 09:46:56 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// -------------------------------------------------------------------
//
@@ -79,7 +79,6 @@ class G4ParticleDefinition;
class G4VEmModel;
class G4VEmFluctuationModel;
class G4DataVector;
//class G4VParticleChange;
class G4PhysicsTable;
class G4PhysicsVector;
class G4VSubCutoffProcessor;
@@ -118,8 +117,7 @@ public:
virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
// True for all charged particles
virtual
void BuildPhysicsTable(const G4ParticleDefinition&);
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
// Build physics table during initialisation
virtual void PrintInfoDefinition();
@@ -134,9 +132,6 @@ public:
G4PhysicsTable* BuildLambdaSubTable();
void SetParticles(const G4ParticleDefinition*,
const G4ParticleDefinition*);
void SetParticle(const G4ParticleDefinition* p);
void SetBaseParticle(const G4ParticleDefinition* p);
void SetSecondaryParticle(const G4ParticleDefinition* p);
@@ -191,62 +186,71 @@ public:
void AddSubCutoffProcessor(G4VSubCutoffProcessor*, const G4Region* region = 0);
// Add subcutoff processor for the region
virtual void SetSubCutoff(G4bool) {};
virtual void ActivateFluorescence(G4bool, const G4Region* region = 0);
virtual void ActivateAugerElectronProduction(G4bool, const G4Region* region = 0);
// Activate deexcitation code
virtual void SetSubCutoff(G4bool);
void SetDEDXTable(G4PhysicsTable* p);
G4PhysicsTable* DEDXTable() const {return theDEDXTable;};
G4PhysicsTable* DEDXTable() const;
void SetRangeTable(G4PhysicsTable* pRange);
G4PhysicsTable* RangeTable() const {return thePreciseRangeTable;};
void SetPreciseRangeTable(G4PhysicsTable* pRange);
G4PhysicsTable* PreciseRangeTable() const;
void SetRangeTableForLoss(G4PhysicsTable* p);
G4PhysicsTable* RangeTableForLoss() const {return theRangeTableForLoss;};
G4PhysicsTable* RangeTableForLoss() const;
void SetInverseRangeTable(G4PhysicsTable* p);
G4PhysicsTable* InverseRangeTable() const {return theInverseRangeTable;};
G4PhysicsTable* InverseRangeTable() const;
void SetSecondaryRangeTable(G4PhysicsTable* p);
void SetLambdaTable(G4PhysicsTable* p);
G4PhysicsTable* LambdaTable() {return theLambdaTable;};
G4PhysicsTable* LambdaTable();
void SetSubLambdaTable(G4PhysicsTable* p);
G4PhysicsTable* SubLambdaTable() {return theSubLambdaTable;};
G4PhysicsTable* SubLambdaTable();
G4double GetDEDX(G4double& kineticEnergy, const G4MaterialCutsCouple* couple);
G4double GetRange(G4double& kineticEnergy, const G4MaterialCutsCouple* couple);
G4double GetRangeForLoss(G4double& kineticEnergy, const G4MaterialCutsCouple* couple);
G4double GetKineticEnergy(G4double& range, const G4MaterialCutsCouple* couple);
G4double GetLambda(G4double kineticEnergy, const G4MaterialCutsCouple* couple);
G4double GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple* couple);
// It returns the MeanFreePath of the process
G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple,
const G4DynamicParticle* dp,
G4double& length);
G4double length);
G4double MicroscopicCrossSection(G4double kineticEnergy,
const G4MaterialCutsCouple* couple);
// It returns the MeanFreePath of the process for a (energy, material)
void SetLinearLossLimit(G4double val) {linLossLimit = val;};
void SetLinearLossLimit(G4double val);
void SetLossFluctuations(G4bool val) {lossFluctuationFlag = val;};
void SetLossFluctuations(G4bool val);
void SetIntegral(G4bool val);
G4bool IsIntegral() const {return integral;}
G4bool IsIntegral() const;
void SetRandomStep(G4bool val) {rndmStepFlag = val;};
void SetRandomStep(G4bool val);
void SetMinSubRange(G4double val) {minSubRange = val;};
void SetMinSubRange(G4double val);
void SetStepLimits(G4double v1, G4double v2);
void SetStepFunction(G4double v1, G4double v2);
G4bool TablesAreBuilt() const {return tablesAreBuilt;};
void SetLambdaFactor(G4double val);
G4int NumberOfSubCutoffRegions() const {return nSCoffRegions;};
G4bool TablesAreBuilt() const;
G4int NumberOfSubCutoffRegions() const;
G4double MeanFreePath(const G4Track& track,
G4double previousStepSize,
@@ -257,25 +261,22 @@ public:
G4double currentMinimumStep,
G4double& currentSafety);
void ResetNumberOfInteractionLengthLeft();
void ResetNumberOfInteractionLengthLeft();
// reset (determine the value of)NumberOfInteractionLengthLeft
protected:
virtual
G4double GetMeanFreePath(const G4Track& track,
virtual G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
virtual
G4double GetContinuousStepLimit(const G4Track& track,
virtual G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety);
virtual
const G4ParticleDefinition* DefineBaseParticle(
const G4ParticleDefinition*) {return 0;};
const G4ParticleDefinition* DefineBaseParticle(const G4ParticleDefinition*);
virtual
G4PhysicsVector* DEDXPhysicsVector(const G4MaterialCutsCouple*);
@@ -294,19 +295,21 @@ protected:
virtual G4double MaxSecondaryEnergy(const G4DynamicParticle* dp) = 0;
G4VEmModel* SelectModel(G4double& kinEnergy);
G4VEmModel* SelectModel(G4double kinEnergy);
G4VSubCutoffProcessor* SubCutoffProcessor(size_t index);
size_t CurrentMaterialCutsCoupleIndex() const {return currentMaterialIndex;};
size_t CurrentMaterialCutsCoupleIndex() const;
void SetMassRatio(G4double val) {massRatio = val;};
void SetMassRatio(G4double val);
void SetReduceFactor(G4double val) {reduceFactor = val;};
void SetReduceFactor(G4double val);
void SetChargeSquare(G4double val) {chargeSquare = val;};
void SetChargeSquare(G4double val);
void SetChargeSquareRatio(G4double val) {chargeSqRatio = val;};
void SetChargeSquareRatio(G4double val);
G4double GetCurrentRange() const;
private:
@@ -320,7 +323,11 @@ private:
G4double GetPreciseRange(G4double kineticEnergy);
G4double GetKineticEnergyForLoss(G4double range);
G4double GetLambda(G4double scaledKinEnergy);
void ComputeLambda(G4double scaledKinEnergy);
G4double ScaledKinEnergyForLoss(G4double range);
// hide assignment operator
@@ -342,15 +349,17 @@ private:
std::vector<G4int> idxSCoffRegions;
// tables and vectors
G4PhysicsTable* theDEDXTable;
G4PhysicsTable* theRangeTableForLoss;
G4PhysicsTable* thePreciseRangeTable;
G4PhysicsTable* theSecondaryRangeTable;
G4PhysicsTable* theInverseRangeTable;
G4PhysicsTable* theLambdaTable;
G4PhysicsTable* theSubLambdaTable;
G4double* theDEDXAtMaxEnergy;
G4double* theRangeAtMaxEnergy;
G4PhysicsTable* theDEDXTable;
G4PhysicsTable* theRangeTableForLoss;
G4PhysicsTable* thePreciseRangeTable;
G4PhysicsTable* theSecondaryRangeTable;
G4PhysicsTable* theInverseRangeTable;
G4PhysicsTable* theLambdaTable;
G4PhysicsTable* theSubLambdaTable;
G4double* theDEDXAtMaxEnergy;
G4double* theRangeAtMaxEnergy;
G4double* theEnergyOfCrossSectionMax;
G4double* theCrossSectionMax;
const G4DataVector* theCuts;
@@ -379,6 +388,7 @@ private:
G4double chargeSqRatio;
G4double preStepLambda;
G4double preStepMFP;
G4double fRange;
G4double preStepKinEnergy;
G4double preStepScaledEnergy;
@@ -388,13 +398,15 @@ private:
G4double finalRange;
G4double defaultRoverRange;
G4double defaultIntegralRange;
G4double lambdaFactor;
G4double mfpKinEnergy;
G4bool lossFluctuationFlag;
G4bool rndmStepFlag;
G4bool hasRestProcess;
G4bool tablesAreBuilt;
G4bool integral;
G4bool meanFreePath;
G4bool lossFluctuationFlag;
G4bool rndmStepFlag;
G4bool hasRestProcess;
G4bool tablesAreBuilt;
G4bool integral;
G4bool meanFreePath;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -408,7 +420,8 @@ inline void G4VEnergyLossProcess::DefineMaterial(const G4MaterialCutsCouple* cou
currentMaterialIndex = couple->GetIndex();
minStepLimit = std::min(finalRange,
currentCouple->GetProductionCuts()->GetProductionCut(idxG4ElectronCut));
if(integral && !meanFreePath) ResetNumberOfInteractionLengthLeft();
if(integral && (!meanFreePath || preStepScaledEnergy < mfpKinEnergy))
ResetNumberOfInteractionLengthLeft();
}
}
@@ -418,19 +431,15 @@ inline G4double G4VEnergyLossProcess::GetDEDX(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
G4bool b;
G4double e = kineticEnergy*massRatio;
G4double x = ((*theDEDXTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
if(e < minKinEnergy) x *= sqrt(e/minKinEnergy);
return x;
return GetDEDXForLoss(kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetDEDXForLoss(G4double kineticEnergy)
inline G4double G4VEnergyLossProcess::GetDEDXForLoss(G4double e)
{
G4bool b;
G4double e = kineticEnergy*massRatio;
e *= massRatio;
G4double x = ((*theDEDXTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
if(e < minKinEnergy) x *= sqrt(e/minKinEnergy);
return x;
@@ -443,18 +452,18 @@ inline G4double G4VEnergyLossProcess::GetRange(G4double& kineticEnergy,
{
DefineMaterial(couple);
G4double x = DBL_MAX;
if(thePreciseRangeTable) x = GetPreciseRange(kineticEnergy);
else if(theRangeTableForLoss) x = GetRangeForLoss(kineticEnergy);
if(thePreciseRangeTable) x = GetPreciseRange(kineticEnergy);
else if(theRangeTableForLoss) x = GetRangeForLoss(kineticEnergy);
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetPreciseRange(G4double kineticEnergy)
inline G4double G4VEnergyLossProcess::GetPreciseRange(G4double e)
{
G4bool b;
G4double x;
G4double e = kineticEnergy*massRatio;
e *= massRatio;
if (e < maxKinEnergyForRange) {
x = ((*thePreciseRangeTable)[currentMaterialIndex])->GetValue(e, b);
@@ -469,10 +478,21 @@ inline G4double G4VEnergyLossProcess::GetPreciseRange(G4double kineticEnergy)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetRangeForLoss(G4double kineticEnergy)
inline G4double G4VEnergyLossProcess::GetRangeForLoss(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
G4double x = DBL_MAX;
if(theRangeTableForLoss) x = GetRangeForLoss(kineticEnergy);
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetRangeForLoss(G4double e)
{
G4bool b;
G4double e = kineticEnergy*massRatio;
e *= massRatio;
G4double x = ((*theRangeTableForLoss)[currentMaterialIndex])->GetValue(e, b);
if(e < minKinEnergy) x *= sqrt(e/minKinEnergy);
return x*reduceFactor;
@@ -483,33 +503,16 @@ inline G4double G4VEnergyLossProcess::GetRangeForLoss(G4double kineticEnergy)
inline G4double G4VEnergyLossProcess::GetKineticEnergy(G4double& range,
const G4MaterialCutsCouple* couple)
{
G4double del = fRange - range;
G4double e = minKinEnergy;
if(couple == currentCouple && del > 0.0 && del < fRange*linLossLimit) {
e = preStepKinEnergy - del*GetDEDXForLoss(preStepKinEnergy);
if(e < 0.0) e = 0.0;
} else {
DefineMaterial(couple);
G4double r = range/reduceFactor;
G4PhysicsVector* v = (*theInverseRangeTable)[currentMaterialIndex];
G4double rmin = v->GetLowEdgeEnergy(0);
if(r <= rmin) {
r /= rmin;
e *= r*r;
} else {
G4bool b;
e = v->GetValue(r, b);
}
e /= massRatio;
}
DefineMaterial(couple);
G4double r = range/reduceFactor;
G4double e = ScaledKinEnergyForLoss(r)/massRatio;
return e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetKineticEnergyForLoss(G4double range)
inline G4double G4VEnergyLossProcess::ScaledKinEnergyForLoss(G4double r)
{
G4double r = range/reduceFactor;
G4PhysicsVector* v = (*theInverseRangeTable)[currentMaterialIndex];
G4double rmin = v->GetLowEdgeEnergy(0);
G4double e = minKinEnergy;
@@ -520,7 +523,7 @@ inline G4double G4VEnergyLossProcess::GetKineticEnergyForLoss(G4double range)
G4bool b;
e = v->GetValue(r, b);
}
return e/massRatio;
return e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -528,7 +531,7 @@ inline G4double G4VEnergyLossProcess::GetKineticEnergyForLoss(G4double range)
inline G4double G4VEnergyLossProcess::GetDEDXDispersion(
const G4MaterialCutsCouple *couple,
const G4DynamicParticle* dp,
G4double& length)
G4double length)
{
DefineMaterial(couple);
G4double tmax = MaxSecondaryEnergy(dp);
@@ -539,22 +542,56 @@ inline G4double G4VEnergyLossProcess::GetDEDXDispersion(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
G4double x = 0.0;
if(theLambdaTable) x = GetLambda(kineticEnergy*massRatio);
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetLambda(G4double e)
{
G4bool b;
return chargeSqRatio*(((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::ComputeLambda(G4double e)
{
meanFreePath = false;
mfpKinEnergy = 0.0;
G4double emax = theEnergyOfCrossSectionMax[currentMaterialIndex];
if (e <= emax) preStepLambda = GetLambda(e);
else {
e *= lambdaFactor;
if(e > emax) {
mfpKinEnergy = e;
preStepLambda = GetLambda(e);
} else preStepLambda = theCrossSectionMax[currentMaterialIndex];
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetMeanFreePath(const G4Track& track,
G4double, G4ForceCondition*)
{
DefineMaterial(track.GetMaterialCutsCouple());
preStepKinEnergy = track.GetKineticEnergy();
preStepScaledEnergy = preStepKinEnergy*massRatio;
DefineMaterial(track.GetMaterialCutsCouple());
if (meanFreePath) {
G4bool b;
preStepLambda = (((*theLambdaTable)[currentMaterialIndex])->
GetValue(preStepScaledEnergy, b)) * chargeSqRatio;
if (integral) meanFreePath = false;
if (integral) ComputeLambda(preStepScaledEnergy);
else preStepLambda = GetLambda(preStepScaledEnergy);
if(0.0 < preStepLambda) preStepMFP = 1.0/preStepLambda;
else preStepMFP = DBL_MAX;
}
G4double x = DBL_MAX;
if(0.0 < preStepLambda) x = 1.0/preStepLambda;
// G4cout << GetProcessName() << ": e= " << preStepKinEnergy << " mfp= " << x << G4endl;
return x;
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy<<" mfp= "<<preStepMFP<<G4endl;
return preStepMFP;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -572,8 +609,8 @@ inline G4double G4VEnergyLossProcess::GetContinuousStepLimit(const G4Track&,
if(x > minStepLimit && y < currentMinStep ) {
x = y + minStepLimit*(1.0 - dRoverRange)*(2.0 - minStepLimit/fRange);
if(x >fRange || x<minStepLimit) G4cout << "!!! StepLimit problem!!!" << G4endl;
if(rndmStepFlag) x = minStepLimit + G4UniformRand()*(x-minStepLimit);
//if(x >fRange || x<minStepLimit) G4cout << "!!! StepLimit problem!!!" << G4endl;
//if(rndmStepFlag) x = minStepLimit + G4UniformRand()*(x-minStepLimit);
}
}
return x;
@@ -590,7 +627,7 @@ inline void G4VEnergyLossProcess::ResetNumberOfInteractionLengthLeft()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEnergyLossProcess::SelectModel(G4double& kinEnergy)
inline G4VEmModel* G4VEnergyLossProcess::SelectModel(G4double kinEnergy)
{
return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
}
@@ -618,79 +655,6 @@ inline const G4ParticleDefinition* G4VEnergyLossProcess::SecondaryParticle() con
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetDEDXBinning(G4int nbins)
{
nDEDXBins = nbins;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetDEDXBinningForPreciseRange(G4int nbins)
{
nDEDXBinsForRange = nbins;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetLambdaBinning(G4int nbins)
{
nLambdaBins = nbins;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::MinKinEnergy() const
{
return minKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetMinKinEnergy(G4double e)
{
minKinEnergy = e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetMaxKinEnergy(G4double e)
{
maxKinEnergy = e;
if(e < maxKinEnergyForRange) maxKinEnergyForRange = e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetMaxKinEnergyForPreciseRange(G4double e)
{
maxKinEnergyForRange = e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::MaxKinEnergy() const
{
return maxKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetLambda(G4double kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
G4double x = DBL_MAX;
G4bool b;
if(theLambdaTable) {
G4double y = (((*theLambdaTable)[currentMaterialIndex])->
GetValue(kineticEnergy*massRatio, b));
if(y > 0.0) x = 1.0/y;
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VSubCutoffProcessor* G4VEnergyLossProcess::SubCutoffProcessor(size_t index)
{
G4VSubCutoffProcessor* p = 0;
@@ -698,6 +662,97 @@ inline G4VSubCutoffProcessor* G4VEnergyLossProcess::SubCutoffProcessor(size_t in
return p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTable() const
{
return theDEDXTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::PreciseRangeTable() const
{
return thePreciseRangeTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::RangeTableForLoss() const
{
return theRangeTableForLoss;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::InverseRangeTable() const
{
return theInverseRangeTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::LambdaTable()
{
return theLambdaTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::SubLambdaTable()
{
return theSubLambdaTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4VEnergyLossProcess::IsIntegral() const
{
return integral;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline size_t G4VEnergyLossProcess::CurrentMaterialCutsCoupleIndex() const
{
return currentMaterialIndex;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetMassRatio(G4double val)
{
massRatio = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetReduceFactor(G4double val)
{
reduceFactor = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetChargeSquare(G4double val)
{
chargeSquare = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetChargeSquareRatio(G4double val)
{
chargeSqRatio = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetCurrentRange() const
{
return fRange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4VMultipleScattering.hh,v 1.16 2004/01/21 18:05:07 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4VMultipleScattering.hh,v 1.19 2004/05/25 11:30:08 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// -------------------------------------------------------------------
//
@@ -45,6 +45,7 @@
// part of calculations for all charged particles
//
// 26-11-03 bugfix in AlongStepDoIt (L.Urban)
// 25-05-04 add protection against case when range is less than steplimit (V.Ivanchenko)
// -------------------------------------------------------------------
//
@@ -275,9 +276,11 @@ inline G4double G4VMultipleScattering::GetContinuousStepLimit(
DefineMaterial(track.GetMaterialCutsCouple());
G4double e = track.GetKineticEnergy();
SelectModel(e);
if(!theLambdaTable) currentModel->SetDynamicParticle(track.GetDynamicParticle());
const G4ParticleDefinition* p = track.GetDefinition();
lambda0 = GetLambda(p, e);
currentRange = G4LossTableManager::Instance()->GetRange(p,e,currentCouple);
currentRange = G4LossTableManager::Instance()->GetTrancatedRange(p,e,currentCouple);
if(currentRange < currentMinimalStep) currentRange = currentMinimalStep;
truePathLength = TruePathLengthLimit(track,lambda0,currentMinimalStep);
//G4cout << "StepLimit: tpl= " << truePathLength << " lambda0= "
// << lambda0 << " range= " << currentRange