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: G4DummyModel.hh,v 1.2 2006/06/29 19:54:19 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4DummyModel.hh,v 1.3 2007/05/22 17:31:57 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// -------------------------------------------------------------------
//
@@ -63,11 +63,11 @@ public:
void Initialise(const G4ParticleDefinition*, const G4DataVector&);
std::vector<G4DynamicParticle*>* SampleSecondaries(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double tmax);
void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double tmax);
private:
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4EmCalculator.hh,v 1.18 2007/03/15 12:34:46 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// -------------------------------------------------------------------
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCorrections.hh,v 1.8 2006/06/29 19:54:23 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4EmCorrections.hh,v 1.9 2007/05/18 18:39:54 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// -------------------------------------------------------------------
//
@@ -58,9 +58,10 @@
#include "G4Material.hh"
#include "G4ParticleDefinition.hh"
class G4NistManager;
class G4VEmModel;
class G4PhysicsVector;
class G4IonTable;
class G4NistManager;
class G4EmCorrections
{
@@ -229,8 +230,9 @@ private:
G4AtomicShells shells;
G4ionEffectiveCharge effCharge;
G4NistManager* nist;
G4VEmModel* ionModel;
G4NistManager* nist;
const G4IonTable* ionTable;
G4VEmModel* ionModel;
// Ion stopping data
G4int nIons;
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4EmModelManager.hh,v 1.21 2007/03/17 19:24:39 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
// GEANT4 tag $Name: geant4-09-00 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmMultiModel.hh,v 1.5 2006/06/29 19:54:27 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4EmMultiModel.hh,v 1.6 2007/05/22 17:31:57 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// -------------------------------------------------------------------
//
@@ -84,11 +84,11 @@ public:
G4double cutEnergy,
G4double maxEnergy);
std::vector<G4DynamicParticle*>* SampleSecondaries(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double tmax);
void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double tmax);
void DefineForRegion(const G4Region*);
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmProcessOptions.hh,v 1.11 2007/02/12 12:31:50 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
// $Id: G4EmProcessOptions.hh,v 1.12 2007/05/18 18:39:54 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// -------------------------------------------------------------------
@@ -56,6 +56,7 @@
#include <vector>
#include "globals.hh"
#include "G4MscStepLimitType.hh"
class G4LossTableManager;
class G4Region;
@@ -105,16 +106,20 @@ public:
void SetLinearLossLimit(G4double val);
void SetSkin(G4double val);
void ActivateDeexcitation(G4bool val, const G4Region* r = 0);
void SetMscStepLimitation(G4bool algorithm, G4double factor = -1.);
void SetLPMFlag(G4bool val);
void SetMscStepLimitation(G4MscStepLimitType val);
void SetMscLateralDisplacement(G4bool val);
void SetSkin(G4double val);
void SetMscRangeFactor(G4double val);
void SetMscGeomFactor(G4double val);
void SetLPMFlag(G4bool val);
void SetBremsstrahlungTh(G4double val);
private:
@@ -25,7 +25,7 @@
//
//
// $Id: G4EmTableType.hh,v 1.3 2007/01/15 17:27:40 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
// GEANT4 tag $Name: geant4-09-00 $
//
//---------------------------------------------------------------
//
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4EnergyLossMessenger.hh,v 1.17 2007/03/17 19:24:39 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
// $Id: G4EnergyLossMessenger.hh,v 1.18 2007/05/18 18:39:54 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// -------------------------------------------------------------------
//
@@ -43,6 +43,7 @@
// 10-11-06 Add command binsDEDX (V.Ivantchenko)
// 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko)
// 16-03-07 modify /process/eLoss/minsubsec command (V.Ivanchenko)
// 18-05-07 add /process/msc directory and commands (V.Ivanchenko)
//
// -------------------------------------------------------------------
//
@@ -78,6 +79,8 @@ class G4UIcmdWithABool;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADouble;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithAString;
class G4EmProcessOptions;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -92,13 +95,16 @@ public: // with description
private:
G4EmProcessOptions* opt;
G4UIdirectory* eLossDirectory;
G4UIdirectory* mscDirectory;
G4UIcmdWithABool* RndmStepCmd;
G4UIcmdWithABool* EnlossFlucCmd;
G4UIcmdWithABool* SubSecCmd;
G4UIcmdWithADouble* MinSubSecCmd;
G4UIcommand* StepFuncCmd;
G4UIcommand* mscCmd;
G4UIcmdWithAString* mscCmd;
G4UIcmdWithADoubleAndUnit* MinEnCmd;
G4UIcmdWithADoubleAndUnit* MaxEnCmd;
G4UIcmdWithABool* IntegCmd;
@@ -107,9 +113,12 @@ private:
G4UIcmdWithABool* latCmd;
G4UIcmdWithAnInteger* verCmd;
G4UIcmdWithAnInteger* dedxCmd;
G4UIcmdWithAnInteger* lbCmd;
G4UIcmdWithAnInteger* lamCmd;
G4UIcmdWithADouble* lllCmd;
G4UIcmdWithADouble* labCmd;
G4UIcmdWithADouble* skinCmd;
G4UIcmdWithADouble* frCmd;
G4UIcmdWithADouble* fgCmd;
};
#endif
@@ -25,7 +25,7 @@
//
//
// $Id: G4EnergyLossTables.hh,v 1.19 2006/06/29 19:54:35 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
// $Id:
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4LossTableBuilder.hh,v 1.7 2006/06/29 19:54:37 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// -------------------------------------------------------------------
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableManager.hh,v 1.46 2007/02/12 12:31:50 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
// $Id: G4LossTableManager.hh,v 1.47 2007/05/18 18:39:54 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// -------------------------------------------------------------------
@@ -59,6 +59,7 @@
// 10-05-06 Add methods SetMscStepLimitation, FacRange and MscFlag (VI)
// 22-05-06 Add methods Set/Get bremsTh (VI)
// 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko)
// 18-06-07 Move definition of msc parameters to G4EmProcessOptions (V.Ivanchenko)
//
// Class Description:
//
@@ -193,10 +194,6 @@ public:
void SetLPMFlag(G4bool val);
void SetMscLateralDisplacement(G4bool val);
void SetSkin(G4double val);
void SetLinearLossLimit(G4double val);
void SetBremsstrahlungTh(G4double val);
@@ -209,14 +206,6 @@ public:
G4bool LPMFlag() const;
void SetMscStepLimitation(G4bool algorithm, G4double factor = -1.);
G4bool MscFlag() const;
G4bool MscLateralDisplacementFlag() const;
G4double FacRange() const;
G4double BremsstrahlungTh() const;
G4VEnergyLossProcess* GetEnergyLossProcess(const G4ParticleDefinition*);
@@ -284,9 +273,6 @@ private:
G4bool maxEnergyForMuonsActive;
G4bool stepFunctionActive;
G4bool flagLPM;
G4bool flagMSC;
G4bool flagMSCLateral;
G4bool mscActive;
G4double minSubRange;
G4double maxRangeVariation;
@@ -294,7 +280,6 @@ private:
G4double minKinEnergy;
G4double maxKinEnergy;
G4double maxKinEnergyForMuons;
G4double facRange;
G4double bremsTh;
G4LossTableBuilder* tableBuilder;
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4MscStepLimitType.hh,v 1.2 2007/06/11 14:56:51 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//---------------------------------------------------------------
//
// G4MscStepLimitType.hh
//
// Class Description:
// This is an enumerator to define type of multiple scattering
// step limitation
//
// Author: Vladimir Ivanchenko
//
// Creation date: 18.05.2007
// Modifications:
//
//---------------------------------------------------------------
#ifndef G4MscStepLimitType_h
#define G4MscStepLimitType_h 1
enum G4MscStepLimitType
{
fMinimal = 0,
fUseSafety,
fUseDistanceToBoundary
};
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4VEmFluctuationModel.hh,v 1.10 2006/06/29 19:54:41 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmModel.hh,v 1.45 2006/08/29 19:18:54 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VEmModel.hh,v 1.46 2007/05/22 17:31:57 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// -------------------------------------------------------------------
//
@@ -102,11 +102,11 @@ public:
virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&) = 0;
virtual std::vector<G4DynamicParticle*>* SampleSecondaries(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin = 0.0,
G4double tmax = DBL_MAX) = 0;
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin = 0.0,
G4double tmax = DBL_MAX) = 0;
//------------------------------------------------------------------------
// Methods with standard implementation; may be overwritten if needed
@@ -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
@@ -25,7 +25,7 @@
//
//
// $Id: G4VEnergyLoss.hh,v 1.18 2006/06/29 19:54:47 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// ------------------------------------------------------------
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEnergyLossProcess.hh,v 1.62 2007/03/17 19:24:39 vnivanch Exp $
// $Id: G4VEnergyLossProcess.hh,v 1.68 2007/06/12 11:29:09 vnivanch Exp $
// GEANT4 tag $Name:
//
// -------------------------------------------------------------------
@@ -130,12 +130,6 @@ public:
protected:
virtual std::vector<G4DynamicParticle*>* SecondariesPostStep(
G4VEmModel*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double& tcut) = 0;
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
const G4ParticleDefinition*) = 0;
@@ -144,26 +138,17 @@ protected:
//------------------------------------------------------------------------
protected:
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
inline virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*, G4double cut);
virtual void CorrectionsAlongStep(
inline virtual void CorrectionsAlongStep(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double& eloss,
G4double& length);
virtual G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
virtual G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety);
//------------------------------------------------------------------------
// Generic methods common to all processes
// Generic methods common to all ContinuousDiscrete processes
//------------------------------------------------------------------------
public:
@@ -177,36 +162,6 @@ public:
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
G4double SampleRange();
G4PhysicsTable* BuildDEDXTable(G4EmTableType tType = fRestricted);
G4PhysicsTable* BuildLambdaTable(G4EmTableType tType = fRestricted);
void SetBaseParticle(const G4ParticleDefinition* p);
const G4ParticleDefinition* Particle() const;
const G4ParticleDefinition* BaseParticle() const;
const G4ParticleDefinition* SecondaryParticle() const;
// Binning for dEdx, range, and inverse range tables
void SetDEDXBinning(G4int nbins);
void SetLambdaBinning(G4int nbins);
// Binning for dEdx, range, and inverse range tables
void SetDEDXBinningForCSDARange(G4int nbins);
// Min kinetic energy for tables
void SetMinKinEnergy(G4double e);
G4double MinKinEnergy() const;
// Max kinetic energy for tables
void SetMaxKinEnergy(G4double e);
G4double MaxKinEnergy() const;
// Max kinetic energy for tables
void SetMaxKinEnergyForCSDARange(G4double e);
// Store PhysicsTable in a file.
// Return false in case of failure at I/O
G4bool StorePhysicsTable(const G4ParticleDefinition*,
@@ -222,155 +177,233 @@ public:
const G4String& directory,
G4bool ascii);
// Assign a model to a process
void SetEmModel(G4VEmModel*, G4int index=1);
// return the assigned model
G4VEmModel* EmModel(G4int index=1);
// Assign a fluctuation model to a process
void SetFluctModel(G4VEmFluctuationModel*);
// return the assigned fluctuation model
G4VEmFluctuationModel* FluctModel();
// Add EM model coupled with fluctuation model for the region
void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel* fluc = 0,
const G4Region* region = 0);
protected:
// Define new energy range for the model identified by the name
void UpdateEmModel(const G4String&, G4double, G4double);
inline G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
// Add subcutoff processor for the region
void ActivateSubCutoff(G4bool val, const G4Region* region = 0);
inline G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety);
// Activate deexcitation code
virtual void ActivateDeexcitation(G4bool, const G4Region* region = 0);
//------------------------------------------------------------------------
// Specific methods for along/post step simulation
//------------------------------------------------------------------------
void SetDEDXTable(G4PhysicsTable* p, G4EmTableType tType);
G4PhysicsTable* DEDXTable() const;
G4PhysicsTable* DEDXTableForSubsec() const;
G4PhysicsTable* DEDXunRestrictedTable() const;
G4PhysicsTable* IonisationTable() const;
G4PhysicsTable* IonisationTableForSubsec() const;
void SetCSDARangeTable(G4PhysicsTable* pRange);
G4PhysicsTable* CSDARangeTable() const;
void SetRangeTableForLoss(G4PhysicsTable* p);
G4PhysicsTable* RangeTableForLoss() const;
void SetInverseRangeTable(G4PhysicsTable* p);
G4PhysicsTable* InverseRangeTable() const;
void SetSecondaryRangeTable(G4PhysicsTable* p);
void SetLambdaTable(G4PhysicsTable* p);
G4PhysicsTable* LambdaTable();
void SetSubLambdaTable(G4PhysicsTable* p);
G4PhysicsTable* SubLambdaTable();
// Return values for given G4MaterialCutsCouple
G4double GetDEDX(G4double& kineticEnergy, const G4MaterialCutsCouple*);
G4double GetDEDXForSubsec(G4double& kineticEnergy,
const G4MaterialCutsCouple*);
G4double GetRange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
G4double GetCSDARange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
G4double GetRangeForLoss(G4double& kineticEnergy, const G4MaterialCutsCouple*);
G4double GetKineticEnergy(G4double& range, const G4MaterialCutsCouple*);
G4double GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple*);
G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple,
const G4DynamicParticle* dp,
G4double length);
G4double MicroscopicCrossSection(G4double kineticEnergy,
const G4MaterialCutsCouple* couple);
void SetLossFluctuations(G4bool val);
void SetRandomStep(G4bool val);
void SetIntegral(G4bool val);
G4bool IsIntegral() const;
// Redefine parameteters for stepping control
//
void SetLinearLossLimit(G4double val);
void SetMinSubRange(G4double val);
void SetStepFunction(G4double v1, G4double v2);
void SetLambdaFactor(G4double val);
G4bool TablesAreBuilt() const;
G4int NumberOfSubCutoffRegions() const;
// Helper functions
G4double MeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
G4double ContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety);
// reset NumberOfInteractionLengthLeft
void ResetNumberOfInteractionLengthLeft();
G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idx) const;
// Set/Get flag "isIonisation"
void SetIonisation(G4bool val);
G4bool IsIonisationProcess() const;
public:
void AddCollaborativeProcess(G4VEnergyLossProcess*);
void SampleSubCutSecondaries(std::vector<G4Track*>&, const G4Step&,
G4VEmModel* model, G4int matIdx);
G4VEmModel* model, G4int matIdx,
G4double& extraEdep);
// Set scaling parameters
void SetDynamicMassCharge(G4double massratio, G4double charge2ratio);
G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple,
const G4DynamicParticle* dp,
G4double length);
inline G4double AlongStepGetPhysicalInteractionLength(
const G4Track&,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety,
G4GPILSelection* selection
);
inline G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
//------------------------------------------------------------------------
// Specific methods to build and access Physics Tables
//------------------------------------------------------------------------
G4double MicroscopicCrossSection(G4double kineticEnergy,
const G4MaterialCutsCouple* couple);
G4PhysicsTable* BuildDEDXTable(G4EmTableType tType = fRestricted);
G4PhysicsTable* BuildLambdaTable(G4EmTableType tType = fRestricted);
void SetDEDXTable(G4PhysicsTable* p, G4EmTableType tType);
void SetCSDARangeTable(G4PhysicsTable* pRange);
void SetRangeTableForLoss(G4PhysicsTable* p);
void SetInverseRangeTable(G4PhysicsTable* p);
void SetSecondaryRangeTable(G4PhysicsTable* p);
void SetLambdaTable(G4PhysicsTable* p);
void SetSubLambdaTable(G4PhysicsTable* p);
// Binning for dEdx, range, inverse range and labda tables
inline void SetDEDXBinning(G4int nbins);
inline void SetLambdaBinning(G4int nbins);
// Binning for dEdx, range, and inverse range tables
inline void SetDEDXBinningForCSDARange(G4int nbins);
// Min kinetic energy for tables
inline void SetMinKinEnergy(G4double e);
inline G4double MinKinEnergy() const;
// Max kinetic energy for tables
inline void SetMaxKinEnergy(G4double e);
inline G4double MaxKinEnergy() const;
// Max kinetic energy for tables
inline void SetMaxKinEnergyForCSDARange(G4double e);
// Access to specific tables
inline G4PhysicsTable* DEDXTable() const;
inline G4PhysicsTable* DEDXTableForSubsec() const;
inline G4PhysicsTable* DEDXunRestrictedTable() const;
inline G4PhysicsTable* IonisationTable() const;
inline G4PhysicsTable* IonisationTableForSubsec() const;
inline G4PhysicsTable* CSDARangeTable() const;
inline G4PhysicsTable* RangeTableForLoss() const;
inline G4PhysicsTable* InverseRangeTable() const;
inline G4PhysicsTable* LambdaTable();
inline G4PhysicsTable* SubLambdaTable();
// Return values for given G4MaterialCutsCouple
inline G4double GetDEDX(G4double& kineticEnergy, const G4MaterialCutsCouple*);
inline G4double GetDEDXForSubsec(G4double& kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetRange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
inline G4double GetCSDARange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
inline G4double GetRangeForLoss(G4double& kineticEnergy, const G4MaterialCutsCouple*);
inline G4double GetKineticEnergy(G4double& range, const G4MaterialCutsCouple*);
inline G4double GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple*);
inline G4bool TablesAreBuilt() const;
//------------------------------------------------------------------------
// Define and access particle type
//------------------------------------------------------------------------
inline void SetBaseParticle(const G4ParticleDefinition* p);
inline const G4ParticleDefinition* Particle() const;
inline const G4ParticleDefinition* BaseParticle() const;
inline const G4ParticleDefinition* SecondaryParticle() const;
//------------------------------------------------------------------------
// Specific methods to set, access, modify models
//------------------------------------------------------------------------
// Add EM model coupled with fluctuation model for the region
inline void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel* fluc = 0,
const G4Region* region = 0);
// Assign a model to a process
inline void SetEmModel(G4VEmModel*, G4int index=1);
// return the assigned model
inline G4VEmModel* EmModel(G4int index=1);
// Assign a fluctuation model to a process
inline void SetFluctModel(G4VEmFluctuationModel*);
// return the assigned fluctuation model
inline G4VEmFluctuationModel* FluctModel();
// Define new energy range for the model identified by the name
inline void UpdateEmModel(const G4String&, G4double, G4double);
// Access to models
G4VEmModel* GetModelByIndex(G4int idx = 0);
inline G4VEmModel* GetModelByIndex(G4int idx = 0);
G4int NumberOfModels();
inline G4int NumberOfModels();
//------------------------------------------------------------------------
// Get/set parameters used for simulation of energy loss
//------------------------------------------------------------------------
inline void SetLossFluctuations(G4bool val);
inline void SetRandomStep(G4bool val);
inline void SetIntegral(G4bool val);
inline G4bool IsIntegral() const;
// Set/Get flag "isIonisation"
inline void SetIonisation(G4bool val);
inline G4bool IsIonisationProcess() const;
// Redefine parameteters for stepping control
//
inline void SetLinearLossLimit(G4double val);
inline void SetMinSubRange(G4double val);
inline void SetStepFunction(G4double v1, G4double v2);
inline void SetLambdaFactor(G4double val);
// Add subcutoff option for the region
void ActivateSubCutoff(G4bool val, const G4Region* region = 0);
inline G4int NumberOfSubCutoffRegions() const;
// Activate deexcitation code
virtual void ActivateDeexcitation(G4bool, const G4Region* region = 0);
//------------------------------------------------------------------------
// Run time method for simulation of ionisation
//------------------------------------------------------------------------
inline G4double SampleRange();
inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idx) const;
// Set scaling parameters
inline void SetDynamicMassCharge(G4double massratio, G4double charge2ratio);
// Helper functions
inline G4double MeanFreePath(const G4Track& track);
inline G4double ContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety);
protected:
void SetParticle(const G4ParticleDefinition* p);
void SetSecondaryParticle(const G4ParticleDefinition* p);
G4VEmModel* SelectModel(G4double kinEnergy);
size_t CurrentMaterialCutsCoupleIndex() const;
G4double GetCurrentRange() const;
G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*,
G4double cut);
G4double cut);
inline virtual void InitialiseMassCharge(const G4Track&);
inline void SetParticle(const G4ParticleDefinition* p);
inline void SetSecondaryParticle(const G4ParticleDefinition* p);
inline G4VEmModel* SelectModel(G4double kinEnergy);
inline size_t CurrentMaterialCutsCoupleIndex() const;
inline G4double GetCurrentRange() const;
private:
// Clear tables
void Clear();
void DefineMaterial(const G4MaterialCutsCouple* couple);
inline void InitialiseStep(const G4Track&);
inline void DefineMaterial(const G4MaterialCutsCouple* couple);
// Returnd values for scaled energy and base particles mass
//
G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy);
G4double GetSubDEDXForScaledEnergy(G4double scaledKinEnergy);
G4double GetIonisationForScaledEnergy(G4double scaledKinEnergy);
G4double GetSubIonisationForScaledEnergy(G4double scaledKinEnergy);
G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy);
G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy);
G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy);
G4double ScaledKinEnergyForLoss(G4double range);
void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetSubDEDXForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetIonisationForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetSubIonisationForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy);
inline G4double ScaledKinEnergyForLoss(G4double range);
inline void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy);
// hide assignment operator
@@ -391,6 +424,7 @@ private:
std::vector<const G4Region*> scoffRegions;
G4int nSCoffRegions;
G4int* idxSCoffRegions;
std::vector<G4DynamicParticle*> secParticles;
std::vector<G4Track*> scTracks;
std::vector<G4VEnergyLossProcess*> scProcesses;
G4int nProcesses;
@@ -420,6 +454,7 @@ private:
const G4ParticleDefinition* particle;
const G4ParticleDefinition* baseParticle;
const G4ParticleDefinition* secondaryParticle;
const G4ParticleDefinition* theElectron;
const G4ParticleDefinition* thePositron;
G4PhysicsVector* vstrag;
@@ -444,7 +479,6 @@ private:
G4double chargeSqRatio;
G4double preStepLambda;
G4double preStepMFP;
G4double fRange;
G4double preStepKinEnergy;
G4double preStepScaledEnergy;
@@ -455,13 +489,13 @@ private:
G4double lambdaFactor;
G4double mfpKinEnergy;
G4GPILSelection aGPILSelection;
G4bool lossFluctuationFlag;
G4bool lossFluctuationArePossible;
G4bool rndmStepFlag;
G4bool tablesAreBuilt;
G4bool integral;
G4bool meanFreePath;
G4bool aboveCSmax;
G4bool isIonisation;
G4bool useSubCutoff;
};
@@ -476,12 +510,28 @@ inline void G4VEnergyLossProcess::DefineMaterial(
currentCouple = couple;
currentMaterial = couple->GetMaterial();
currentMaterialIndex = couple->GetIndex();
if(!meanFreePath) ResetNumberOfInteractionLengthLeft();
mfpKinEnergy = DBL_MAX;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::InitialiseStep(const G4Track& track)
{
InitialiseMassCharge(track);
preStepKinEnergy = track.GetKineticEnergy();
preStepScaledEnergy = preStepKinEnergy*massRatio;
DefineMaterial(track.GetMaterialCutsCouple());
if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::InitialiseMassCharge(const G4Track&)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetDEDX(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
{
@@ -526,11 +576,11 @@ inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(G4double e)
{
G4bool b;
G4double x = 0.0;
if(theIonisationTable) {
x = ((*theIonisationTable)[currentMaterialIndex]->GetValue(e, b))
*chargeSqRatio;
if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
}
// if(theIonisationTable) {
x = ((*theIonisationTable)[currentMaterialIndex]->GetValue(e, b))
*chargeSqRatio;
if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
//}
return x;
}
@@ -541,11 +591,11 @@ G4double G4VEnergyLossProcess::GetSubIonisationForScaledEnergy(G4double e)
{
G4bool b;
G4double x = 0.0;
if(theIonisationSubTable) {
x = ((*theIonisationSubTable)[currentMaterialIndex]->GetValue(e, b))
*chargeSqRatio;
if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
}
//if(theIonisationSubTable) {
x = ((*theIonisationSubTable)[currentMaterialIndex]->GetValue(e, b))
*chargeSqRatio;
if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
//}
return x;
}
@@ -640,39 +690,21 @@ inline G4double G4VEnergyLossProcess::ScaledKinEnergyForLoss(G4double r)
{
G4PhysicsVector* v = (*theInverseRangeTable)[currentMaterialIndex];
G4double rmin = v->GetLowEdgeEnergy(0);
G4double e = minKinEnergy;
if(r <= rmin) {
r /= rmin;
e *= r*r;
} else {
G4double e = 0.0;
if(r >= rmin) {
G4bool b;
e = v->GetValue(r, b);
} else if(r > 0.0) {
G4double x = r/rmin;
e = minKinEnergy*x*x;
}
return e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetDEDXDispersion(
const G4MaterialCutsCouple *couple,
const G4DynamicParticle* dp,
G4double length)
{
DefineMaterial(couple);
G4double ekin = dp->GetKineticEnergy();
G4VEmModel* currentModel = SelectModel(ekin*massRatio);
G4double tmax = currentModel->MaxSecondaryKinEnergy(dp);
tmax = std::min(tmax,(*theCuts)[currentMaterialIndex]);
G4double d = 0.0;
G4VEmFluctuationModel* fm = currentModel->GetModelOfFluctuations();
if(fm) d = fm->Dispersion(currentMaterial,dp,tmax,length);
return d;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
G4double x = 0.0;
@@ -693,13 +725,11 @@ inline G4double G4VEnergyLossProcess::GetLambdaForScaledEnergy(G4double e)
inline void G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e)
{
meanFreePath = false;
aboveCSmax = false;
mfpKinEnergy = theEnergyOfCrossSectionMax[currentMaterialIndex];
if (e <= mfpKinEnergy) {
preStepLambda = GetLambdaForScaledEnergy(e);
// mfpKinEnergy = 0.0;
} else {
aboveCSmax = true;
G4double e1 = e*lambdaFactor;
if(e1 > mfpKinEnergy) {
preStepLambda = GetLambdaForScaledEnergy(e);
@@ -712,47 +742,51 @@ inline void G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e)
preStepLambda = chargeSqRatio*theCrossSectionMax[currentMaterialIndex];
}
}
// theNumberOfInteractionLengthLeft = -1.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetMeanFreePath(
const G4Track& track, G4double, G4ForceCondition* condition)
inline G4double G4VEnergyLossProcess::ContinuousStepLimit(
const G4Track& track, G4double x, G4double y, G4double& z)
{
*condition = NotForced;
preStepKinEnergy = track.GetKineticEnergy();
preStepScaledEnergy = preStepKinEnergy*massRatio;
if(aboveCSmax && preStepScaledEnergy < mfpKinEnergy)
ResetNumberOfInteractionLengthLeft();
DefineMaterial(track.GetMaterialCutsCouple());
if (meanFreePath) {
if (integral) ComputeLambdaForScaledEnergy(preStepScaledEnergy);
else preStepLambda = GetLambdaForScaledEnergy(preStepScaledEnergy);
if(0.0 < preStepLambda) preStepMFP = 1.0/preStepLambda;
else preStepMFP = DBL_MAX;
}
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy<< " eCSmax= "
//<<mfpKinEnergy<< " mfp= "<<preStepMFP<<G4endl;
return preStepMFP;
G4GPILSelection sel;
return AlongStepGetPhysicalInteractionLength(track, x, y, z, &sel);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetContinuousStepLimit(const G4Track&,
G4double, G4double currentMinStep, G4double&)
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;
if(x > finalRange && y < currentMinStep ) {
// G4double safety = track.GetStep()->GetPreStepPoint()->GetSafety();
if(x > finalRange && y < currentMinStep) { // && x > safety) {
x = y + finalRange*(1.0 - dRoverRange)*(2.0 - finalRange/fRange);
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy
// <<" range= "<<fRange <<" cMinSt="<<currentMinStep<< G4endl;
} 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;
@@ -773,11 +807,75 @@ inline G4double G4VEnergyLossProcess::SampleRange()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::ResetNumberOfInteractionLengthLeft()
inline G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition)
{
meanFreePath = true;
aboveCSmax = false;
G4VProcess::ResetNumberOfInteractionLengthLeft();
// 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());
preStepLambda = GetLambdaForScaledEnergy(track.GetKineticEnergy()*massRatio);
G4double x = DBL_MAX;
if(DBL_MIN < preStepLambda) x = 1.0/preStepLambda;
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetMeanFreePath(
const G4Track& track,
G4double,
G4ForceCondition* condition)
{
*condition = NotForced;
return MeanFreePath(track);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -819,8 +917,7 @@ inline const G4ParticleDefinition* G4VEnergyLossProcess::BaseParticle() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition*
G4VEnergyLossProcess::SecondaryParticle() const
inline const G4ParticleDefinition* G4VEnergyLossProcess::SecondaryParticle() const
{
return secondaryParticle;
}
@@ -930,7 +1027,7 @@ inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio,
massRatio = massratio;
chargeSqRatio = charge2ratio;
chargeSquare = charge2ratio*eplus*eplus;
reduceFactor = 1.0/(chargeSqRatio*massRatio);
if(chargeSqRatio > 0.0) reduceFactor = 1.0/(chargeSqRatio*massRatio);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -942,6 +1039,20 @@ inline G4double G4VEnergyLossProcess::GetCurrentRange() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLossProcess::AddEmModel(G4int order, G4VEmModel* p,
G4VEmFluctuationModel* fluc,
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....
inline G4VEmModel* G4VEnergyLossProcess::GetModelByIndex(G4int idx)
{
return modelManager->GetModel(idx);
@@ -956,4 +1067,201 @@ inline G4int G4VEnergyLossProcess::NumberOfModels()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetEmModel(G4VEmModel* p, G4int index)
{
emModel[index] = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEnergyLossProcess::EmModel(G4int index)
{
return emModel[index];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetFluctModel(G4VEmFluctuationModel* p)
{
fluctModel = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmFluctuationModel* G4VEnergyLossProcess::FluctModel()
{
return fluctModel;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::UpdateEmModel(const G4String& nam,
G4double emin, G4double emax)
{
modelManager->UpdateEmModel(nam, emin, emax);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetIntegral(G4bool val)
{
integral = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetParticle(const G4ParticleDefinition* p)
{
particle = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetBaseParticle(const G4ParticleDefinition* p)
{
baseParticle = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
{
secondaryParticle = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetLinearLossLimit(G4double val)
{
linLossLimit = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetLossFluctuations(G4bool val)
{
if(!val || lossFluctuationArePossible) lossFluctuationFlag = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetRandomStep(G4bool val)
{
rndmStepFlag = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetMinSubRange(G4double val)
{
minSubRange = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4VEnergyLossProcess::TablesAreBuilt() const
{
return tablesAreBuilt;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4int G4VEnergyLossProcess::NumberOfSubCutoffRegions() const
{
return nSCoffRegions;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetDEDXBinning(G4int nbins)
{
nBins = nbins;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetLambdaBinning(G4int nbins)
{
nBins = nbins;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetDEDXBinningForCSDARange(G4int nbins)
{
nBinsCSDA = 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 < maxKinEnergyCSDA) maxKinEnergyCSDA = e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetMaxKinEnergyForCSDARange(G4double e)
{
maxKinEnergyCSDA = e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::MaxKinEnergy() const
{
return maxKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetLambdaFactor(G4double val)
{
if(val > 0.0 && val <= 1.0) lambdaFactor = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetIonisation(G4bool val)
{
isIonisation = val;
if(val) aGPILSelection = CandidateForSelection;
else aGPILSelection = NotCandidateForSelection;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4VEnergyLossProcess::IsIonisationProcess() const
{
return isIonisation;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLossProcess::SetStepFunction(G4double v1, G4double v2)
{
dRoverRange = v1;
finalRange = v2;
if (dRoverRange > 0.999) dRoverRange = 1.0;
currentCouple = 0;
mfpKinEnergy = DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VMultipleScattering.hh,v 1.42 2007/03/15 12:33:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-03 $
// $Id: G4VMultipleScattering.hh,v 1.46 2007/06/11 14:56:51 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// -------------------------------------------------------------------
//
@@ -79,6 +79,7 @@
#include "G4Step.hh"
#include "G4EmModelManager.hh"
#include "G4VEmModel.hh"
#include "G4MscStepLimitType.hh"
class G4ParticleDefinition;
class G4DataVector;
@@ -114,50 +115,22 @@ protected:
//------------------------------------------------------------------------
public:
//------------------------------------------------------------------------
// Generic methods common to all ContinuousDiscrete processes
//------------------------------------------------------------------------
// Initialise for build of tables
virtual void PreparePhysicsTable(const G4ParticleDefinition&);
// Build physics table during initialisation
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
// set boolean flag steppingAlgorithm
// ( true/false : standard or 7.1 style process)
virtual void MscStepLimitation(G4bool algorithm, G4double factor = -1.);
//------------------------------------------------------------------------
// Generic methods common to all models
//------------------------------------------------------------------------
virtual G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
// The function overloads the corresponding function of the base
// class.It limits the step near to boundaries only
// and invokes the method GetContinuousStepLimit at every step.
G4double AlongStepGetPhysicalInteractionLength(
const G4Track&,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety,
G4GPILSelection* selection);
// Print out of generic class parameters
void PrintInfoDefinition();
void SetBinning(G4int nbins);
G4int Binning() const;
// Print out of the class parameters
inline virtual G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
void SetMinKinEnergy(G4double e);
G4double MinKinEnergy() const;
// Print out of the class parameters
void SetMaxKinEnergy(G4double e);
G4double MaxKinEnergy() const;
// Build empty Physics Vector
G4PhysicsVector* PhysicsVector(const G4MaterialCutsCouple*);
inline virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
// Store PhysicsTable in a file.
// Return false in case of failure at I/O
@@ -174,59 +147,139 @@ public:
const G4String& directory,
G4bool ascii);
void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
//------------------------------------------------------------------------
// Specific methods for multiple scattering
//------------------------------------------------------------------------
// 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(
const G4Track&,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety,
G4GPILSelection* selection);
// The function overloads the corresponding function of the base
// class.
inline virtual G4double PostStepGetPhysicalInteractionLength(
const G4Track&,
G4double previousStepSize,
G4ForceCondition* condition);
// This method does not used for tracking, it is intended only for tests
virtual G4double ContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety);
inline virtual G4double ContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety);
G4bool LateralDisplasmentFlag() const;
void SetLateralDisplasmentFlag(G4bool val);
// lateral displacement to be/not to be computed
//------------------------------------------------------------------------
// Specific methods to build and access Physics Tables
//------------------------------------------------------------------------
G4double Skin() const;
void SetSkin(G4double val);
// skin parameter
inline void SetBinning(G4int nbins);
inline G4int Binning() const;
void SetBuildLambdaTable(G4bool val);
inline void SetMinKinEnergy(G4double e);
inline G4double MinKinEnergy() const;
// Print out of the class parameters
G4PhysicsTable* LambdaTable() const;
inline void SetMaxKinEnergy(G4double e);
inline G4double MaxKinEnergy() const;
G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idxRegion) const;
inline void SetBuildLambdaTable(G4bool val);
// Define particle definition
const G4ParticleDefinition* Particle() const;
void SetParticle(const G4ParticleDefinition*);
inline G4PhysicsTable* LambdaTable() const;
//------------------------------------------------------------------------
// Define and access particle type
//------------------------------------------------------------------------
inline const G4ParticleDefinition* Particle() const;
inline void SetParticle(const G4ParticleDefinition*);
//------------------------------------------------------------------------
// Specific methods to set, access, modify models
//------------------------------------------------------------------------
void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idxRegion) const;
// Access to models
G4VEmModel* GetModelByIndex(G4int idx = 0);
inline G4VEmModel* GetModelByIndex(G4int idx = 0);
//------------------------------------------------------------------------
// Parameters for simulation of multiple scattering
//------------------------------------------------------------------------
inline void SetLateralDisplasmentFlag(G4bool val);
// lateral displacement to be/not to be computed
inline void SetSkin(G4double val);
// skin parameter
inline void SetRangeFactor(G4double val);
// FactorRange parameter
inline void SetGeomFactor(G4double val);
// FactorRange parameter
inline void SetStepLimitType(G4MscStepLimitType val);
// FactorRange parameter
protected:
// This method is used for tracking, it returns mean free path value
G4double GetMeanFreePath(const G4Track& track,
G4double,
G4ForceCondition* condition);
inline virtual G4double GetMeanFreePath(const G4Track& track,
G4double,
G4ForceCondition* condition);
G4double GetLambda(const G4ParticleDefinition* p, G4double& kineticEnergy);
//------------------------------------------------------------------------
// Run time methods
//------------------------------------------------------------------------
inline G4double GetLambda(const G4ParticleDefinition* p, G4double& kineticEnergy);
// This method is used for tracking, it returns step limit
virtual G4double GetContinuousStepLimit(const G4Track& track,
inline G4double GetMscContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety);
G4VEmModel* SelectModel(G4double kinEnergy);
// This method is not used for tracking, it returns step limit
inline virtual G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety);
inline G4VEmModel* SelectModel(G4double kinEnergy);
// Select concrete model
const G4MaterialCutsCouple* CurrentMaterialCutsCouple() const;
inline const G4MaterialCutsCouple* CurrentMaterialCutsCouple() const;
// Return current G4MaterialCutsCouple
void DefineMaterial(const G4MaterialCutsCouple* couple);
inline void DefineMaterial(const G4MaterialCutsCouple* couple);
// define current material
//------------------------------------------------------------------------
// Parameters for simulation of multiple scattering
//------------------------------------------------------------------------
inline G4double Skin() const;
inline G4double RangeFactor() const;
inline G4double GeomFactor() const;
inline G4MscStepLimitType StepLimitType() const;
inline G4bool LateralDisplasmentFlag() const;
private:
// hide assignment operator
@@ -255,9 +308,13 @@ private:
G4int nBins;
G4MscStepLimitType stepLimit;
G4double minKinEnergy;
G4double maxKinEnergy;
G4double skin;
G4double facrange;
G4double facgeom;
G4bool latDisplasment;
G4bool buildLambdaTable;
@@ -276,11 +333,19 @@ inline void G4VMultipleScattering::DefineMaterial(const G4MaterialCutsCouple* co
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::GetMeanFreePath(const G4Track&,
G4double,
G4ForceCondition* cond)
inline G4double G4VMultipleScattering::PostStepGetPhysicalInteractionLength(
const G4Track&, G4double, G4ForceCondition* condition)
{
*cond = Forced;
*condition = Forced;
return DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::GetMeanFreePath(
const G4Track&, G4double, G4ForceCondition* condition)
{
*condition = Forced;
return DBL_MAX;
}
@@ -295,7 +360,7 @@ inline G4double G4VMultipleScattering::AlongStepGetPhysicalInteractionLength(
{
// get Step limit proposed by the process
valueGPILSelectionMSC = NotCandidateForSelection;
G4double steplength = GetContinuousStepLimit(track,previousStepSize,
G4double steplength = GetMscContinuousStepLimit(track,previousStepSize,
currentMinimalStep,currentSafety);
// G4cout << "StepLimit= " << steplength << G4endl;
// set return value for G4GPILSelection
@@ -305,7 +370,7 @@ inline G4double G4VMultipleScattering::AlongStepGetPhysicalInteractionLength(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::GetContinuousStepLimit(
inline G4double G4VMultipleScattering::GetMscContinuousStepLimit(
const G4Track& track,
G4double,
G4double currentMinimalStep,
@@ -329,13 +394,25 @@ inline G4double G4VMultipleScattering::GetContinuousStepLimit(
//....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,
G4double currentMinimalStep,
G4double& currentSafety)
{
return GetContinuousStepLimit(track,previousStepSize,currentMinimalStep,
return GetMscContinuousStepLimit(track,previousStepSize,currentMinimalStep,
currentSafety);
}
@@ -372,8 +449,11 @@ inline G4VParticleChange* G4VMultipleScattering::PostStepDoIt(const G4Track& tra
const G4Step& step)
{
fParticleChange.Initialize(track);
currentModel->SampleSecondaries(currentCouple,track.GetDynamicParticle(),
step.GetStepLength(),step.GetPostStepPoint()->GetSafety());
std::vector<G4DynamicParticle*>* p=0;
currentModel->SampleSecondaries(p, currentCouple,
track.GetDynamicParticle(),
step.GetStepLength(),
step.GetPostStepPoint()->GetSafety());
return &fParticleChange;
}
@@ -459,14 +539,68 @@ inline G4double G4VMultipleScattering::Skin() const
inline void G4VMultipleScattering::SetSkin(G4double val)
{
skin = val;
if(val <= 0.99999) {
skin = 0.0;
stepLimit = fUseSafety;
} else {
skin = val;
stepLimit = fUseDistanceToBoundary;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::RangeFactor() const
{
return facrange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::SetRangeFactor(G4double val)
{
if(val > 0.0) facrange = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::GeomFactor() const
{
return facgeom;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::SetGeomFactor(G4double val)
{
if(val > 0.0) facgeom = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4MscStepLimitType G4VMultipleScattering::StepLimitType() const
{
return stepLimit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::SetStepLimitType(G4MscStepLimitType val)
{
stepLimit = val;
if(val == fMinimal) {
skin = 0;
facrange = 0.2;
} else if(val == fUseSafety) {
skin = 0;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::SetBuildLambdaTable(G4bool val)
{
buildLambdaTable = val;
buildLambdaTable = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ionEffectiveCharge.hh,v 1.8 2006/08/15 16:21:39 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
// -------------------------------------------------------------------
//