Import Geant4 9.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:15:05 +02:00
parent b79225fb37
commit 74cad5e589
3877 changed files with 234205 additions and 167127 deletions
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmProcess.hh,v 1.47 2008/07/31 13:01:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VEmProcess.hh,v 1.55 2009/09/23 14:42:47 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// -------------------------------------------------------------------
//
@@ -107,28 +107,29 @@ protected:
virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
//------------------------------------------------------------------------
// Methods with standard implementation; may be overwritten if needed
//------------------------------------------------------------------------
inline G4double RecalculateLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple);
//------------------------------------------------------------------------
// Generic methods common to all Discrete processes
// Implementation of virtual methods common to all Discrete processes
//------------------------------------------------------------------------
public:
void PrintInfoDefinition();
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
// Initialise for build of tables
void PreparePhysicsTable(const G4ParticleDefinition&);
// Build physics table during initialisation
void BuildPhysicsTable(const G4ParticleDefinition&);
void PrintInfoDefinition();
// implementation of virtual method, specific for G4VEmProcess
G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
// implementation of virtual method, specific for G4VEmProcess
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
// Store PhysicsTable in a file.
// Return false in case of failure at I/O
G4bool StorePhysicsTable(const G4ParticleDefinition*,
@@ -144,6 +145,9 @@ public:
const G4String& directory,
G4bool ascii);
// deexcitation activated per G4Region
void ActivateDeexcitation(G4bool, const G4Region* r = 0);
//------------------------------------------------------------------------
// Specific methods for Discrete EM post step simulation
//------------------------------------------------------------------------
@@ -152,13 +156,6 @@ public:
G4double CrossSectionPerVolume(G4double kineticEnergy,
const G4MaterialCutsCouple* couple);
// implementation of virtual method
virtual G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
// It returns the cross section of the process per atom
inline G4double ComputeCrossSectionPerAtom(G4double kineticEnergy,
G4double Z, G4double A=0.,
@@ -166,9 +163,6 @@ public:
inline G4double MeanFreePath(const G4Track& track);
inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
size_t& idxRegion) const;
// It returns cross section per volume
inline G4double GetLambda(G4double& kinEnergy,
const G4MaterialCutsCouple* couple);
@@ -202,29 +196,33 @@ public:
inline const G4ParticleDefinition* SecondaryParticle() const;
//------------------------------------------------------------------------
// Specific methods to set, access, modify models
// Specific methods to set, access, modify models and basic parameters
//------------------------------------------------------------------------
// Add EM model coupled for the region
inline void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
protected:
// Select model in run time
inline G4VEmModel* SelectModel(G4double& kinEnergy, size_t index);
public:
// Select model by energy and region index
inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
size_t& idxRegion) const;
// Add model for region, smaller value of order defines which
// model will be selected for a given energy interval
void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
// Assign a model to a process
inline void SetModel(G4VEmModel*);
void SetModel(G4VEmModel*, G4int index = 1);
// return the assigned model
inline G4VEmModel* Model();
G4VEmModel* Model(G4int index = 1);
// Define new energy range for the model identified by the name
inline void UpdateEmModel(const G4String&, G4double, G4double);
void UpdateEmModel(const G4String&, G4double, G4double);
// Access to models
inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false);
//------------------------------------------------------------------------
// Get/set parameters used for simulation of energy loss
//------------------------------------------------------------------------
inline void ActivateDeexcitation(G4bool, const G4Region* r = 0);
G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false);
inline void SetLambdaFactor(G4double val);
@@ -232,6 +230,10 @@ public:
inline G4bool IsIntegral() const;
inline void SetApplyCuts(G4bool val);
//------------------------------------------------------------------------
// Other generic methods
//------------------------------------------------------------------------
protected:
@@ -241,14 +243,15 @@ protected:
G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*);
inline G4double RecalculateLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple);
inline G4ParticleChangeForGamma* GetParticleChange();
inline void SetParticle(const G4ParticleDefinition* p);
inline void SetSecondaryParticle(const G4ParticleDefinition* p);
inline G4VEmModel* SelectModel(G4double& kinEnergy);
inline size_t CurrentMaterialCutsCoupleIndex() const;
inline G4double GetGammaEnergyCut();
@@ -279,8 +282,7 @@ private:
inline G4double ComputeCurrentLambda(G4double kinEnergy);
// hide assignment operator
// copy constructor and hide assignment operator
G4VEmProcess(G4VEmProcess &);
G4VEmProcess & operator=(const G4VEmProcess &right);
@@ -296,6 +298,8 @@ private:
// ======== Parameters of the class fixed at initialisation =======
std::vector<G4VEmModel*> emModels;
// tables and vectors
G4PhysicsTable* theLambdaTable;
G4double* theEnergyOfCrossSectionMax;
@@ -316,10 +320,11 @@ private:
G4bool integral;
G4bool applyCuts;
G4bool startFromNull;
G4bool useDeexcitation;
G4int nRegions;
std::vector<G4Region*> regions;
std::vector<G4bool> flagsDeexcitation;
G4int nDERegions;
std::vector<const G4Region*> deRegions;
G4bool* idxDERegions;
// ======== Cashed values - may be state dependent ================
@@ -331,14 +336,14 @@ private:
std::vector<G4DynamicParticle*> secParticles;
G4VEmModel* selectedModel;
G4VEmModel* currentModel;
const G4ParticleDefinition* particle;
// cash
const G4Material* currentMaterial;
const G4MaterialCutsCouple* currentCouple;
size_t currentMaterialIndex;
size_t currentCoupleIndex;
G4double mfpKinEnergy;
G4double preStepKinEnergy;
@@ -349,94 +354,16 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple)
{
if(couple != currentCouple) {
currentCouple = couple;
currentMaterial = couple->GetMaterial();
currentMaterialIndex = couple->GetIndex();
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)
{
DefineMaterial(couple);
return GetCurrentLambda(kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetCurrentLambda(G4double e)
inline G4double G4VEmProcess::ComputeCrossSectionPerAtom(
G4double kineticEnergy, G4double Z, G4double A, G4double cut)
{
SelectModel(kineticEnergy, currentCoupleIndex);
G4double x = 0.0;
if(theLambdaTable) x = GetLambdaFromTable(e);
else x = ComputeCurrentLambda(e);
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::RecalculateLambda(G4double e,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
return ComputeCurrentLambda(e);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)
{
G4VEmModel* currentModel = SelectModel(e);
G4double x = 0.0;
if(currentModel)
x = currentModel->CrossSectionPerVolume(currentMaterial,particle,
e,(*theCuts)[currentMaterialIndex]);
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambdaFromTable(G4double e)
{
G4bool b;
return (((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::ComputeIntegralLambda(G4double e)
{
mfpKinEnergy = theEnergyOfCrossSectionMax[currentMaterialIndex];
if (e <= mfpKinEnergy) {
preStepLambda = GetLambdaFromTable(e);
} else {
G4double e1 = e*lambdaFactor;
if(e1 > mfpKinEnergy) {
preStepLambda = GetLambdaFromTable(e);
G4double preStepLambda1 = GetLambdaFromTable(e1);
if(preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
preStepLambda = preStepLambda1;
}
} else {
preStepLambda = theCrossSectionMax[currentMaterialIndex];
}
if(currentModel) {
x = currentModel->ComputeCrossSectionPerAtom(particle,kineticEnergy,
Z,A,cut);
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -452,121 +379,11 @@ inline G4double G4VEmProcess::MeanFreePath(const G4Track& track)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEmProcess::SelectModel(G4double& kinEnergy)
inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
{
return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEmProcess::SelectModelForMaterial(
G4double kinEnergy, size_t& idxRegion) const
{
return modelManager->SelectModel(kinEnergy, idxRegion);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VEmProcess::Particle() const
{
return particle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const
{
return secondaryParticle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetGammaEnergyCut()
{
return (*theCutsGamma)[currentMaterialIndex];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetElectronEnergyCut()
{
return (*theCutsElectron)[currentMaterialIndex];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetLambdaFactor(G4double val)
{
if(val > 0.0 && val <= 1.0) lambdaFactor = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx, G4bool ver)
{
return modelManager->GetModel(idx, ver);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4ParticleChangeForGamma* G4VEmProcess::GetParticleChange()
{
return &fParticleChange;
}
//....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::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;
}
//....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, G4double cut)
{
G4VEmModel* model = SelectModel(kineticEnergy);
return model->ComputeCrossSectionPerAtom(particle,kineticEnergy,Z,A,cut);
DefineMaterial(couple);
return GetCurrentLambda(kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -629,11 +446,6 @@ inline G4double G4VEmProcess::PolarAngleLimit() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::ActivateDeexcitation(G4bool, const G4Region*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4PhysicsTable* G4VEmProcess::LambdaTable() const
{
return theLambdaTable;
@@ -641,6 +453,46 @@ inline const G4PhysicsTable* G4VEmProcess::LambdaTable() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VEmProcess::Particle() const
{
return particle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const
{
return secondaryParticle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
G4VEmModel* G4VEmProcess::SelectModel(G4double& kinEnergy, size_t index)
{
currentModel = modelManager->SelectModel(kinEnergy, index);
currentModel->SetCurrentCouple(currentCouple);
return currentModel;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
G4VEmModel* G4VEmProcess::SelectModelForMaterial(G4double kinEnergy,
size_t& idxRegion) const
{
return modelManager->SelectModel(kinEnergy, idxRegion);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetLambdaFactor(G4double val)
{
if(val > 0.0 && val <= 1.0) lambdaFactor = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetIntegral(G4bool val)
{
if(particle && particle != theGamma) integral = val;
@@ -656,6 +508,64 @@ inline G4bool G4VEmProcess::IsIntegral() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetApplyCuts(G4bool val)
{
applyCuts = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::RecalculateLambda(G4double e,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
return ComputeCurrentLambda(e);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4ParticleChangeForGamma* G4VEmProcess::GetParticleChange()
{
return &fParticleChange;
}
//....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 size_t G4VEmProcess::CurrentMaterialCutsCoupleIndex() const
{
return currentCoupleIndex;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetGammaEnergyCut()
{
return (*theCutsGamma)[currentCoupleIndex];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetElectronEnergyCut()
{
return (*theCutsElectron)[currentCoupleIndex];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetBuildTableFlag(G4bool val)
{
buildLambdaTable = val;
@@ -671,16 +581,73 @@ inline void G4VEmProcess::SetStartFromNullFlag(G4bool val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetApplyCuts(G4bool val)
inline void G4VEmProcess::InitialiseStep(const G4Track& track)
{
applyCuts = val;
preStepKinEnergy = track.GetKineticEnergy();
DefineMaterial(track.GetMaterialCutsCouple());
SelectModel(preStepKinEnergy, currentCoupleIndex);
if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline size_t G4VEmProcess::CurrentMaterialCutsCoupleIndex() const
inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple)
{
return currentMaterialIndex;
if(couple != currentCouple) {
currentCouple = couple;
currentMaterial = couple->GetMaterial();
currentCoupleIndex = couple->GetIndex();
mfpKinEnergy = DBL_MAX;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::ComputeIntegralLambda(G4double e)
{
mfpKinEnergy = theEnergyOfCrossSectionMax[currentCoupleIndex];
if (e <= mfpKinEnergy) {
preStepLambda = GetLambdaFromTable(e);
} else {
G4double e1 = e*lambdaFactor;
if(e1 > mfpKinEnergy) {
preStepLambda = GetLambdaFromTable(e);
G4double preStepLambda1 = GetLambdaFromTable(e1);
if(preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
preStepLambda = preStepLambda1;
}
} else {
preStepLambda = theCrossSectionMax[currentCoupleIndex];
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambdaFromTable(G4double e)
{
return (((*theLambdaTable)[currentCoupleIndex])->Value(e));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetCurrentLambda(G4double e)
{
G4double x = 0.0;
if(theLambdaTable) { x = GetLambdaFromTable(e); }
else { x = ComputeCurrentLambda(e); }
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)
{
SelectModel(e, currentCoupleIndex);
return currentModel->CrossSectionPerVolume(currentMaterial,particle,
e,(*theCuts)[currentCoupleIndex]);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....