Import Geant4 9.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:16:48 +02:00
parent 75c7fd177d
commit a8e9364cea
6592 changed files with 84274 additions and 69292 deletions
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmProcess.hh,v 1.34 2006/09/13 10:34:32 maire Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VEmProcess.hh,v 1.37 2007/05/23 08:43:46 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// -------------------------------------------------------------------
//
@@ -102,16 +102,11 @@ protected:
virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
virtual std::vector<G4DynamicParticle*>* SecondariesPostStep(
G4VEmModel*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*) = 0;
//------------------------------------------------------------------------
// Methods with standard implementation; may be overwritten if needed
//------------------------------------------------------------------------
virtual G4double RecalculateLambda(G4double kinEnergy,
inline virtual G4double RecalculateLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple);
//------------------------------------------------------------------------
@@ -130,20 +125,6 @@ public:
void BuildPhysicsTable(const G4ParticleDefinition&);
// Build physics table during initialisation
void SetLambdaBinning(G4int nbins);
G4int LambdaBinning() const;
// Binning for lambda table
void SetMinKinEnergy(G4double e);
G4double MinKinEnergy() const;
// Min kinetic energy for tables
void SetMaxKinEnergy(G4double e);
G4double MaxKinEnergy() const;
// Max kinetic energy for tables
void SetLambdaFactor(G4double val);
G4bool StorePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii = false);
@@ -158,95 +139,135 @@ public:
// (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.
void SetModel(G4VEmModel*);
// Assign a model to a process
G4VEmModel* Model();
// return the assigned model
void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
// Add EM model coupled for the region
void UpdateEmModel(const G4String&, G4double, G4double);
// Define new energy range for the model identified by the name
G4double GetLambda(G4double& kinEnergy, const G4MaterialCutsCouple* couple);
// It returns the Lambda of the process
const G4PhysicsTable* LambdaTable() const;
G4double MicroscopicCrossSection(G4double kineticEnergy,
const G4MaterialCutsCouple* couple);
// It returns the cross section of the process for energy/ material
G4double ComputeCrossSectionPerAtom(G4double kineticEnergy,
G4double Z, G4double A=0.);
inline G4double ComputeCrossSectionPerAtom(G4double kineticEnergy,
G4double Z, G4double A=0.);
// It returns the cross section of the process per atom
G4double MeanFreePath( const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
inline G4double MeanFreePath(const G4Track& track);
const G4ParticleDefinition* Particle() const;
const G4ParticleDefinition* SecondaryParticle() const;
//------------------------------------------------------------------------
// Specific methods for post step simulation
//------------------------------------------------------------------------
void ActivateDeexcitation(G4bool, const G4Region* r = 0);
G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
size_t& idxRegion) const;
void SetIntegral(G4bool val);
G4bool IsIntegral() const;
inline G4double GetLambda(G4double& kinEnergy,
const G4MaterialCutsCouple* couple);
// It returns the Lambda of the process
void SetApplyCuts(G4bool val);
//------------------------------------------------------------------------
// Specific methods to build and access Physics Tables
//------------------------------------------------------------------------
inline void SetLambdaBinning(G4int nbins);
inline G4int LambdaBinning() const;
// Binning for lambda table
inline void SetMinKinEnergy(G4double e);
inline G4double MinKinEnergy() const;
// Min kinetic energy for tables
inline void SetMaxKinEnergy(G4double e);
inline G4double MaxKinEnergy() const;
// Max kinetic energy for tables
inline const G4PhysicsTable* LambdaTable() const;
//------------------------------------------------------------------------
// Define and access particle type
//------------------------------------------------------------------------
inline const G4ParticleDefinition* Particle() const;
inline const G4ParticleDefinition* SecondaryParticle() const;
//------------------------------------------------------------------------
// Specific methods to set, access, modify models
//------------------------------------------------------------------------
void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
// Add EM model coupled for the region
inline void SetModel(G4VEmModel*);
// Assign a model to a process
inline G4VEmModel* Model();
// return the assigned model
inline void UpdateEmModel(const G4String&, G4double, G4double);
// Define new energy range for the model identified by the name
// Access to models
G4VEmModel* GetModelByIndex(G4int idx = 0);
inline G4VEmModel* GetModelByIndex(G4int idx = 0);
//------------------------------------------------------------------------
// Get/set parameters used for simulation of energy loss
//------------------------------------------------------------------------
inline void ActivateDeexcitation(G4bool, const G4Region* r = 0);
inline void SetLambdaFactor(G4double val);
inline void SetIntegral(G4bool val);
inline G4bool IsIntegral() const;
inline void SetApplyCuts(G4bool val);
protected:
void SetParticle(const G4ParticleDefinition* p);
void SetSecondaryParticle(const G4ParticleDefinition* p);
G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*);
G4VEmModel* SelectModel(G4double& kinEnergy);
inline void SetParticle(const G4ParticleDefinition* p);
inline void SetSecondaryParticle(const G4ParticleDefinition* p);
size_t CurrentMaterialCutsCoupleIndex() const {return currentMaterialIndex;};
inline G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
void ResetNumberOfInteractionLengthLeft();
inline G4VEmModel* SelectModel(G4double& kinEnergy);
G4double GetGammaEnergyCut();
G4double GetElectronEnergyCut();
inline size_t CurrentMaterialCutsCoupleIndex() const;
void SetBuildTableFlag(G4bool val);
inline G4double GetGammaEnergyCut();
void SetStartFromNullFlag(G4bool val);
inline G4double GetElectronEnergyCut();
inline void SetBuildTableFlag(G4bool val);
inline void SetStartFromNullFlag(G4bool val);
private:
void Clear();
void DefineMaterial(const G4MaterialCutsCouple* couple);
void ComputeIntegralLambda(G4double kinEnergy);
G4double GetLambdaFromTable(G4double kinEnergy);
G4double GetCurrentLambda(G4double kinEnergy);
G4double ComputeCurrentLambda(G4double kinEnergy);
void BuildLambdaTable();
void FindLambdaMax();
inline void InitialiseStep(const G4Track&);
inline void DefineMaterial(const G4MaterialCutsCouple* couple);
inline void ComputeIntegralLambda(G4double kinEnergy);
inline G4double GetLambdaFromTable(G4double kinEnergy);
inline G4double GetCurrentLambda(G4double kinEnergy);
inline G4double ComputeCurrentLambda(G4double kinEnergy);
// hide assignment operator
G4VEmProcess(G4VEmProcess &);
@@ -260,6 +281,8 @@ protected:
private:
std::vector<G4DynamicParticle*> secParticles;
G4EmModelManager* modelManager;
G4VEmModel* selectedModel;
@@ -292,11 +315,8 @@ private:
G4double mfpKinEnergy;
G4double preStepKinEnergy;
G4double preStepLambda;
G4double preStepMFP;
G4bool integral;
G4bool meanFreePath;
G4bool aboveCSmax;
G4bool buildLambdaTable;
G4bool applyCuts;
G4bool startFromNull;
@@ -316,12 +336,21 @@ inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple)
currentCouple = couple;
currentMaterial = couple->GetMaterial();
currentMaterialIndex = couple->GetIndex();
if(!meanFreePath) ResetNumberOfInteractionLengthLeft();
mfpKinEnergy = DBL_MAX;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::InitialiseStep(const G4Track& track)
{
preStepKinEnergy = track.GetKineticEnergy();
DefineMaterial(track.GetMaterialCutsCouple());
if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
{
@@ -341,7 +370,8 @@ inline G4double G4VEmProcess::GetCurrentLambda(G4double e)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::RecalculateLambda(G4double e, const G4MaterialCutsCouple* couple)
inline G4double G4VEmProcess::RecalculateLambda(G4double e,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
return ComputeCurrentLambda(e);
@@ -353,7 +383,8 @@ inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)
{
G4VEmModel* currentModel = SelectModel(e);
G4double x = 0.0;
if(currentModel) x = currentModel->CrossSectionPerVolume(currentMaterial,particle,e);
if(currentModel)
x = currentModel->CrossSectionPerVolume(currentMaterial,particle,e);
return x;
}
@@ -369,13 +400,11 @@ inline G4double G4VEmProcess::GetLambdaFromTable(G4double e)
inline void G4VEmProcess::ComputeIntegralLambda(G4double e)
{
meanFreePath = false;
aboveCSmax = false;
mfpKinEnergy = theEnergyOfCrossSectionMax[currentMaterialIndex];
if (e <= mfpKinEnergy) {
preStepLambda = GetLambdaFromTable(e);
// mfpKinEnergy = 0.0;
} else {
aboveCSmax = true;
G4double e1 = e*lambdaFactor;
if(e1 > mfpKinEnergy) {
preStepLambda = GetLambdaFromTable(e);
@@ -388,6 +417,69 @@ 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....
inline G4double G4VEmProcess::MeanFreePath(const G4Track& track)
{
DefineMaterial(track.GetMaterialCutsCouple());
preStepLambda = GetCurrentLambda(track.GetKineticEnergy());
G4double x = DBL_MAX;
if(DBL_MIN < preStepLambda) x = 1.0/preStepLambda;
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -397,18 +489,7 @@ inline G4double G4VEmProcess::GetMeanFreePath(const G4Track& track,
G4ForceCondition* condition)
{
*condition = NotForced;
preStepKinEnergy = track.GetKineticEnergy();
DefineMaterial(track.GetMaterialCutsCouple());
if( aboveCSmax && preStepKinEnergy < mfpKinEnergy ) ResetNumberOfInteractionLengthLeft();
if (meanFreePath) {
if(integral) ComputeIntegralLambda(preStepKinEnergy);
else preStepLambda = GetCurrentLambda(preStepKinEnergy);
if(0.0 < preStepLambda) preStepMFP = 1.0/preStepLambda;
else preStepMFP = DBL_MAX;
}
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy<< " eCSmax= "
// <<mfpKinEnergy<< " mfp= "<<preStepMFP<<G4endl;
return preStepMFP;
return G4VEmProcess::MeanFreePath(track);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -428,15 +509,6 @@ inline G4VEmModel* G4VEmProcess::SelectModelForMaterial(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::ResetNumberOfInteractionLengthLeft()
{
meanFreePath = true;
aboveCSmax = false;
G4VProcess::ResetNumberOfInteractionLengthLeft();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VEmProcess::Particle() const
{
return particle;
@@ -479,4 +551,146 @@ inline G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetParticle(const G4ParticleDefinition* p)
{
particle = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
{
secondaryParticle = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetModel(G4VEmModel* model)
{
selectedModel = model;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEmProcess::Model()
{
return selectedModel;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::UpdateEmModel(const G4String& nam,
G4double emin, G4double emax)
{
modelManager->UpdateEmModel(nam, emin, emax);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::ComputeCrossSectionPerAtom(
G4double kineticEnergy, G4double Z, G4double A)
{
G4VEmModel* model = SelectModel(kineticEnergy);
return model->ComputeCrossSectionPerAtom(particle,kineticEnergy,Z,A);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetLambdaBinning(G4int nbins)
{
nLambdaBins = nbins;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4int G4VEmProcess::LambdaBinning() const
{
return nLambdaBins;
}
//....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 void G4VEmProcess::ActivateDeexcitation(G4bool, const G4Region*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4PhysicsTable* G4VEmProcess::LambdaTable() const
{
return theLambdaTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetIntegral(G4bool val)
{
if(particle && particle != theGamma) integral = val;
if(integral) buildLambdaTable = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4VEmProcess::IsIntegral() const
{
return integral;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetBuildTableFlag(G4bool val)
{
buildLambdaTable = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetStartFromNullFlag(G4bool val)
{
startFromNull = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetApplyCuts(G4bool val)
{
applyCuts = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline size_t G4VEmProcess::CurrentMaterialCutsCoupleIndex() const
{
return currentMaterialIndex;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif