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
@@ -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 $
//
// -------------------------------------------------------------------
//