Import Geant4 11.1.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2022-07-01 10:44:02 +02:00
parent b3bf75a2a1
commit c07cea1fe0
2172 changed files with 183300 additions and 123938 deletions
@@ -95,7 +95,7 @@ public:
const G4Region* r = nullptr);
inline G4double GetDEDX(G4double kinEnergy, const G4String& part,
const G4String& mat,
const G4String& s = "world");
const G4String& regname = "world");
G4double GetRangeFromRestricteDEDX(G4double kinEnergy,
const G4ParticleDefinition*,
@@ -104,28 +104,28 @@ public:
inline G4double GetRangeFromRestricteDEDX(G4double kinEnergy,
const G4String& part,
const G4String& mat,
const G4String& s = "world");
const G4String& regname = "world");
G4double GetCSDARange(G4double kinEnergy, const G4ParticleDefinition*,
const G4Material*,
const G4Region* r = nullptr);
inline G4double GetCSDARange(G4double kinEnergy, const G4String& part,
const G4String& mat,
const G4String& s = "world");
const G4String& regname = "world");
G4double GetRange(G4double kinEnergy, const G4ParticleDefinition*,
const G4Material*,
const G4Region* r = nullptr);
inline G4double GetRange(G4double kinEnergy, const G4String& part,
const G4String& mat,
const G4String& s = "world");
const G4String& regname = "world");
G4double GetKinEnergy(G4double range, const G4ParticleDefinition*,
const G4Material*,
const G4Region* r = nullptr);
inline G4double GetKinEnergy(G4double range, const G4String& part,
const G4String& mat,
const G4String& s = "world");
const G4String& regname = "world");
G4double GetCrossSectionPerVolume(
G4double kinEnergy, const G4ParticleDefinition*,
@@ -133,7 +133,7 @@ public:
const G4Region* r = nullptr);
inline G4double GetCrossSectionPerVolume(
G4double kinEnergy, const G4String& part, const G4String& proc,
const G4String& mat, const G4String& s = "world");
const G4String& mat, const G4String& regname = "world");
G4double GetShellIonisationCrossSectionPerAtom(
const G4String& part, G4int Z,
@@ -145,7 +145,7 @@ public:
const G4Region* r = nullptr);
inline G4double GetMeanFreePath(G4double kinEnergy, const G4String& part,
const G4String& proc, const G4String& mat,
const G4String& s = "world");
const G4String& regname = "world");
void PrintDEDXTable(const G4ParticleDefinition*);
@@ -58,6 +58,7 @@
class G4VEnergyLossProcess;
class G4VEmProcess;
class G4VMultipleScattering;
class G4TransportationWithMsc;
class G4EmConfigurator
{
@@ -93,7 +94,8 @@ public:
G4VEmProcess* p);
void PrepareModels(const G4ParticleDefinition* aParticle,
G4VMultipleScattering* p);
G4VMultipleScattering* p,
G4TransportationWithMsc* trans = nullptr);
void Clear();
@@ -105,8 +107,6 @@ public:
private:
const G4Region* FindRegion(const G4String&);
void SetModelForRegion(G4VEmModel* model,
G4VEmFluctuationModel* fm,
const G4Region* reg,
@@ -67,10 +67,19 @@ public:
~G4EmDataHandler();
// add table
size_t SetTable(G4PhysicsTable*);
// update existing table
void UpdateTable(G4PhysicsTable*, size_t idx);
// assuming that the table is already defined
G4PhysicsTable* MakeTable(size_t idx);
// existing table may be substituted
G4PhysicsTable* MakeTable(G4PhysicsTable*, size_t idx);
// clean existing table
void CleanTable(size_t idx);
G4bool StorePhysicsTable(size_t idx,
@@ -82,7 +91,7 @@ public:
const G4ParticleDefinition* part,
const G4String& fname,
G4bool ascii, G4bool spline);
void SetMasterProcess(const G4VEmProcess*);
const G4VEmProcess* GetMasterProcess(size_t idx) const;
@@ -151,7 +151,7 @@ public:
const G4DataVector* Initialise(const G4ParticleDefinition* part,
const G4ParticleDefinition* secPart,
G4double, G4int verb);
G4int verb);
void FillDEDXVector(G4PhysicsVector*, const G4MaterialCutsCouple*,
G4EmTableType t = fRestricted);
@@ -163,10 +163,8 @@ public:
void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel* fm,
const G4Region* r);
void UpdateEmModel(const G4String& model_name, G4double emin, G4double emax);
// Get model pointer from the model list
G4VEmModel* GetModel(G4int idx, G4bool ver = false);
G4VEmModel* GetModel(G4int idx, G4bool ver = false) const;
// Get model pointer from the model list for a given material cuts couple
// no check on material cuts couple index
@@ -59,15 +59,28 @@
#include "G4DNAModelSubType.hh"
#include "G4EmSaturation.hh"
#include "G4ThreeVector.hh"
#include "G4Threading.hh"
#include <vector>
enum G4eSingleScatteringType
{
fWVI = 0,
fMott,
fDPWA
};
{
fWVI = 0,
fMott,
fDPWA
};
enum class G4TransportationWithMscType
{
fDisabled = 0,
fEnabled,
fMultipleSteps,
};
enum G4EmFluctuationType
{
fDummyFluctuation = 0,
fUniversalFluctuation,
fUrbanFluctuation
};
class G4EmParametersMessenger;
class G4EmExtraParameters;
@@ -152,6 +165,9 @@ public:
void SetUseICRU90Data(G4bool val);
G4bool UseICRU90Data() const;
void SetFluctuationType(G4EmFluctuationType val);
G4EmFluctuationType FluctuationType() const;
void SetDNAFast(G4bool val);
G4bool DNAFast() const;
@@ -279,6 +295,9 @@ public:
void SetWorkerVerbose(G4int val);
G4int WorkerVerbose() const;
void SetTransportationWithMsc(G4TransportationWithMscType val);
G4TransportationWithMscType TransportationWithMsc() const;
void SetMscStepLimitType(G4MscStepLimitType val);
G4MscStepLimitType MscStepLimitType() const;
@@ -425,14 +444,12 @@ private:
G4int workerVerbose;
G4int tripletConv; // 5d model triplet generation type
G4TransportationWithMscType fTransportationWithMsc;
G4MscStepLimitType mscStepLimit;
G4MscStepLimitType mscStepLimitMuHad;
G4NuclearFormfactorType nucFormfactor;
G4eSingleScatteringType fSStype;
#ifdef G4MULTITHREADED
static G4Mutex emParametersMutex;
#endif
G4EmFluctuationType fFluct;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -86,6 +86,7 @@ private:
G4UIdirectory* dnaDirectory;
G4UIcmdWithABool* flucCmd;
G4UIcmdWithABool* intCmd;
G4UIcmdWithABool* rangeCmd;
G4UIcmdWithABool* lpmCmd;
G4UIcmdWithABool* rsCmd;
@@ -132,10 +133,12 @@ private:
G4UIcmdWithAnInteger* ver2Cmd;
G4UIcmdWithAnInteger* tripletCmd;
G4UIcmdWithAString* transWithMscCmd;
G4UIcmdWithAString* mscCmd;
G4UIcmdWithAString* msc1Cmd;
G4UIcmdWithAString* nffCmd;
G4UIcmdWithAString* ssCmd;
G4UIcmdWithAString* fluc1Cmd;
G4UIcommand* dumpCmd;
@@ -51,7 +51,7 @@ enum G4EmSecondaryParticleType
_TripletElectron = 10014,
_Bremsstrahlung = 10020,
// Legacy name for compatibility with Geant4 11.0 and patch01.
// Legacy name for compatibility with Geant4 11.0 and patch01.
_Bremsstruhlung = 10020,
_SplitBremsstrahlung = 10021,
_ComptonGamma = 10022,
@@ -65,6 +65,7 @@ struct G4TwoPeaksXS {
G4double e1deep;
G4double e2peak;
G4double e2deep;
G4double e3peak;
};
#endif
@@ -0,0 +1,163 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// Geant4 header G4EmTableUtil
//
// Author V.Ivanchenko 14.03.2022
//
// Utilities used at initialisation of EM physics
//
#ifndef G4EmTableUtil_h
#define G4EmTableUtil_h 1
#include "globals.hh"
#include "G4PhysicsTable.hh"
#include "G4VMultipleScattering.hh"
#include "G4VEmProcess.hh"
#include "G4VEnergyLossProcess.hh"
#include "G4EmModelManager.hh"
#include "G4LossTableBuilder.hh"
#include "G4ParticleDefinition.hh"
#include "G4MscStepLimitType.hh"
#include "G4DataVector.hh"
class G4EmTableUtil
{
public:
static const G4DataVector*
PrepareEmProcess(G4VEmProcess* proc,
const G4ParticleDefinition* part,
const G4ParticleDefinition* secPart,
G4EmModelManager* modelManager,
const G4double& maxKinEnergy,
G4int& secID, G4int& tripletID,
G4int& mainSec, const G4int& verb,
const G4bool& master);
static void BuildEmProcess(G4VEmProcess* proc,
const G4VEmProcess* masterProc,
const G4ParticleDefinition* firstPart,
const G4ParticleDefinition* part,
const G4int nModels, const G4int verb,
const G4bool master, const G4bool isLocked,
const G4bool toBuild, G4bool& baseMat);
static void BuildLambdaTable(G4VEmProcess* proc,
const G4ParticleDefinition* part,
G4EmModelManager* modelManager,
G4LossTableBuilder* bld,
G4PhysicsTable* theLambdaTable,
G4PhysicsTable* theLambdaTablePrim,
const G4double minKinEnergy,
const G4double minKinEnergyPrim,
const G4double maxKinEnergy,
const G4double scale,
const G4int verbose,
const G4bool startFromNull,
const G4bool splineFlag);
static void BuildLambdaTable(G4VEnergyLossProcess* proc,
const G4ParticleDefinition* part,
G4EmModelManager* modelManager,
G4LossTableBuilder* bld,
G4PhysicsTable* theLambdaTable,
const G4DataVector* theCuts,
const G4double minKinEnergy,
const G4double maxKinEnergy,
const G4double scale,
const G4int verbose,
const G4bool splineFlag);
static const G4ParticleDefinition* CheckIon(
G4VEnergyLossProcess* proc,
const G4ParticleDefinition* part,
const G4ParticleDefinition* particle,
const G4int verboseLevel, G4bool& isIon);
static void UpdateModels(G4VEnergyLossProcess* proc,
G4EmModelManager* modelManager,
const G4double maxKinEnergy,
const G4int nModels,
G4int& secID, G4int& biasID,
G4int& mainSecondaries, const G4bool baseMat,
const G4bool isMaster, const G4bool useAGen);
static void BuildLocalElossProcess(G4VEnergyLossProcess* proc,
const G4VEnergyLossProcess* masterProc,
const G4ParticleDefinition* part,
const G4int nModels);
static void BuildDEDXTable(G4VEnergyLossProcess* proc,
const G4ParticleDefinition* part,
G4EmModelManager* modelManager,
G4LossTableBuilder* bld,
G4PhysicsTable* table,
const G4double minKinEnergy,
const G4double maxKinEnergy,
const G4int nbins,
const G4int verbose,
const G4EmTableType tType,
const G4bool splineFlag);
static void PrepareMscProcess(G4VMultipleScattering* proc,
const G4ParticleDefinition& part,
G4EmModelManager* modelManager,
G4MscStepLimitType& stepLimit,
G4double& facrange,
G4bool& latDisplacement, G4bool& master,
G4bool& isIon, G4bool& baseMat);
static void BuildMscProcess(G4VMultipleScattering* proc,
const G4VMultipleScattering* masterProc,
const G4ParticleDefinition& part,
const G4ParticleDefinition* firstPart,
G4int nModels, G4bool master);
static G4bool StoreMscTable(G4VMultipleScattering* proc,
const G4ParticleDefinition* part,
const G4String& directory,
const G4int nModels, const G4int verb,
const G4bool ascii);
static G4bool StoreTable(G4VProcess*, const G4ParticleDefinition*,
G4PhysicsTable*, const G4String& dir,
const G4String& tname, G4int verb,
G4bool ascii);
static G4bool RetrieveTable(G4VProcess* ptr,
const G4ParticleDefinition* part,
G4PhysicsTable* aTable,
const G4String& dir, const G4String& tname,
const G4int verb, const G4bool ascii,
const G4bool spline);
};
#endif
@@ -0,0 +1,85 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// Geant4 header G4EmUtility
//
// Author V.Ivanchenko 14.03.2022
//
// Utilities used at initialisation of EM physics
//
#ifndef G4EmUtility_h
#define G4EmUtility_h 1
#include <vector>
#include "globals.hh"
#include "G4Region.hh"
#include "G4PhysicsTable.hh"
#include "G4EmTableType.hh"
#include "G4ParticleDefinition.hh"
#include "G4VDiscreteProcess.hh"
#include "G4LossTableBuilder.hh"
#include "G4Material.hh"
#include "G4Element.hh"
#include "G4Isotope.hh"
#include "G4DataVector.hh"
#include "G4VEmModel.hh"
class G4EmUtility
{
public:
// find G4Region pointer by name, by default no verbosity
static const G4Region* FindRegion(const G4String& regionName,
const G4int verbose = 0);
// sample random G4Element for the case if cross section is
// proportional to the number of electrons in an atom
static const G4Element* SampleRandomElement(const G4Material*);
// sample random G4Isotope
static const G4Isotope* SampleRandomIsotope(const G4Element*);
// find energy of cross section maximum for all couples
static std::vector<G4double>* FindCrossSectionMax(G4PhysicsTable*);
static std::vector<G4double>*
FindCrossSectionMax(G4VDiscreteProcess*, const G4ParticleDefinition*);
// fill structure describing more than one peak in cross sections
static std::vector<G4TwoPeaksXS*>*
FillPeaksStructure(G4PhysicsTable*, G4LossTableBuilder*);
// model initialisation
static void InitialiseElementSelectors(G4VEmModel*,
const G4ParticleDefinition*,
const G4DataVector& cuts,
const G4double emin,
const G4double emax);
};
#endif
@@ -223,7 +223,7 @@ private:
static G4ThreadLocal G4int let_max_num_warnings;
static G4ThreadLocal G4bool first_loss;
*/
typedef std::map<K,G4EnergyLossTablesHelper,std::less<K> > helper_map;
using helper_map = std::map<K, G4EnergyLossTablesHelper, std::less<K> >;
static helper_map *dict;
static G4EnergyLossTablesHelper GetTables(const G4ParticleDefinition* p);
@@ -56,7 +56,8 @@ enum G4LowEnergyEmProcessSubType
fLowEnergyDoubleIonisation = 62,
fLowEnergyDoubleCap = 63,
fLowEnergyIoniTransfer = 64,
fLowEnergyStaticMol = 65
fLowEnergyStaticMol = 65,
fLowEnergyScavenger = 66
};
#endif
@@ -63,7 +63,7 @@ public:
explicit G4NIELCalculator(G4VEmModel*, G4int verb);
~G4NIELCalculator();
~G4NIELCalculator() = default;
// initialisation before start of run
void Initialise();
@@ -0,0 +1,108 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// G4TransportationWithMsc
//
// Class Description:
//
// It is a generic process of transportation with multiple scattering included
// in the step limitation and propagation.
//
// Original author: Jonas Hahnfeld, 2022
#ifndef G4TrasportationWithMsc_h
#define G4TrasportationWithMsc_h 1
#include "G4Transportation.hh"
#include <vector>
class G4EmModelManager;
class G4LossTableManager;
class G4ParticleDefinition;
class G4Region;
class G4VMscModel;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4TransportationWithMsc : public G4Transportation
{
public:
enum class ScatteringType
{
MultipleScattering,
};
explicit G4TransportationWithMsc(ScatteringType type, G4int verbosity = 0);
~G4TransportationWithMsc() override;
inline void SetMultipleSteps(G4bool val);
inline G4bool MultipleSteps() const;
void AddMscModel(G4VMscModel* mscModel, G4int order = 0,
const G4Region* region = nullptr);
public:
void PreparePhysicsTable(const G4ParticleDefinition& part) override;
void BuildPhysicsTable(const G4ParticleDefinition& part) override;
void StartTracking(G4Track* track) override;
G4double AlongStepGetPhysicalInteractionLength(
const G4Track& track, G4double previousStepSize,
G4double currentMinimumStep, G4double& proposedSafety,
G4GPILSelection* selection) override;
private:
const ScatteringType fType;
G4bool fMultipleSteps = false;
G4LossTableManager* fEmManager;
G4EmModelManager* fModelManager;
const G4ParticleDefinition* fFirstParticle = nullptr;
G4DynamicParticle* fSubStepDynamicParticle;
G4Track* fSubStepTrack;
G4Step* fSubStep;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4TransportationWithMsc::SetMultipleSteps(G4bool val)
{
fMultipleSteps = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4TransportationWithMsc::MultipleSteps() const
{
return fMultipleSteps;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -294,7 +294,6 @@ public:
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
// to select atom cross section per volume is recomputed for each element
const G4Element* SelectRandomAtom(const G4Material*,
const G4ParticleDefinition*,
@@ -303,10 +302,12 @@ public:
G4double maxEnergy = DBL_MAX);
// to select atom if cross section is proportional number of electrons
G4int SelectRandomAtomNumber(const G4Material*);
const G4Element* GetCurrentElement(const G4Material* mat = nullptr) const;
G4int SelectRandomAtomNumber(const G4Material*) const;
// select isotope in order to have precise mass of the nucleus
G4int SelectIsotopeNumber(const G4Element*);
const G4Isotope* GetCurrentIsotope(const G4Element* elm = nullptr) const;
G4int SelectIsotopeNumber(const G4Element*) const;
//------------------------------------------------------------------------
// Get/Set methods
@@ -388,10 +389,6 @@ public:
inline void SetCurrentCouple(const G4MaterialCutsCouple*);
inline const G4Element* GetCurrentElement() const;
inline const G4Isotope* GetCurrentIsotope() const;
inline G4bool IsLocked() const;
inline void SetLocked(G4bool);
@@ -415,7 +412,6 @@ private:
G4VEmModel* fTripletModel = nullptr;
const G4MaterialCutsCouple* fCurrentCouple = nullptr;
const G4Element* fCurrentElement = nullptr;
const G4Isotope* fCurrentIsotope = nullptr;
std::vector<G4EmElementSelector*>* elmSelectors = nullptr;
G4LossTableManager* fEmManager;
@@ -497,21 +493,6 @@ inline const G4MaterialCutsCouple* G4VEmModel::CurrentCouple() const
inline void G4VEmModel::SetCurrentElement(const G4Element* elm)
{
fCurrentElement = elm;
fCurrentIsotope = nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4Element* G4VEmModel::GetCurrentElement() const
{
return fCurrentElement;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4Isotope* G4VEmModel::GetCurrentIsotope() const
{
return fCurrentIsotope;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -569,7 +550,7 @@ G4VEmModel::ComputeCrossSectionPerAtom(const G4ParticleDefinition* part,
G4double cutEnergy,
G4double maxEnergy)
{
SetCurrentElement(elm);
fCurrentElement = elm;
return ComputeCrossSectionPerAtom(part,kinEnergy,elm->GetZ(),elm->GetN(),
cutEnergy,maxEnergy);
}
@@ -587,7 +568,6 @@ G4VEmModel::SelectRandomAtom(const G4MaterialCutsCouple* couple,
fCurrentElement = (nSelectors > 0) ?
((*elmSelectors)[couple->GetIndex()])->SelectRandomAtom(kinEnergy) :
SelectRandomAtom(pBaseMaterial,part,kinEnergy,cutEnergy,maxEnergy);
fCurrentIsotope = nullptr;
return fCurrentElement;
}
@@ -605,7 +585,6 @@ G4VEmModel::SelectTargetAtom(const G4MaterialCutsCouple* couple,
fCurrentElement = (nSelectors > 0)
? ((*elmSelectors)[couple->GetIndex()])->SelectRandomAtom(kinEnergy,logKinE)
: SelectRandomAtom(pBaseMaterial,part,kinEnergy,cutEnergy,maxEnergy);
fCurrentIsotope = nullptr;
return fCurrentElement;
}
@@ -95,13 +95,6 @@ protected:
virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
//------------------------------------------------------------------------
// Method with standard implementation; may be overwritten if needed
//------------------------------------------------------------------------
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*);
//------------------------------------------------------------------------
// Implementation of virtual methods common to all Discrete processes
//------------------------------------------------------------------------
@@ -148,25 +141,21 @@ public:
// Specific methods for Discrete EM post step simulation
//------------------------------------------------------------------------
// It returns the cross section per volume for energy/ material
G4double CrossSectionPerVolume(G4double kineticEnergy,
const G4MaterialCutsCouple* couple,
G4double logKinEnergy = DBL_MAX);
// The main method to access cross section per volume
inline G4double GetLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple,
G4double logKinEnergy);
// It returns the cross section per volume for energy/material
G4double GetCrossSection(const G4double kinEnergy,
const G4MaterialCutsCouple* couple) override;
// It returns the cross section of the process per atom
G4double ComputeCrossSectionPerAtom(G4double kineticEnergy,
G4double Z, G4double A=0.,
G4double cut=0.0);
G4double MeanFreePath(const G4Track& track);
// Obsolete method to access cross section per volume
G4double GetLambda(G4double kinEnergy, const G4MaterialCutsCouple* couple);
// The main method to access cross section per volume
inline G4double GetLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple,
G4double logKinEnergy);
inline G4double MeanFreePath(const G4Track& track);
//------------------------------------------------------------------------
// Specific methods to build and access Physics Tables
@@ -184,13 +173,18 @@ public:
// Max kinetic energy for tables
void SetMaxKinEnergy(G4double e);
// for cross section with one peak
void SetEnergyOfCrossSectionMax(std::vector<G4double>*);
// Cross section table pointers
inline G4PhysicsTable* LambdaTable() const;
inline G4PhysicsTable* LambdaTablePrim() const;
inline void SetLambdaTable(G4PhysicsTable*);
inline void SetLambdaTablePrim(G4PhysicsTable*);
// Integral method type and peak positions
inline std::vector<G4double>* EnergyOfCrossSectionMax() const;
inline void SetEnergyOfCrossSectionMax(std::vector<G4double>*);
inline G4CrossSectionType CrossSectionType() const;
inline void SetCrossSectionType(G4CrossSectionType val);
//------------------------------------------------------------------------
// Define and access particle type
//------------------------------------------------------------------------
@@ -198,12 +192,12 @@ public:
inline const G4ParticleDefinition* Particle() const;
inline const G4ParticleDefinition* SecondaryParticle() const;
protected:
//------------------------------------------------------------------------
// Specific methods to set, access, modify models and basic parameters
//------------------------------------------------------------------------
protected:
// Select model in run time
inline G4VEmModel* SelectModel(G4double kinEnergy, size_t);
@@ -230,7 +224,7 @@ public:
inline const G4VEmModel* GetCurrentModel() const;
// Access to models
G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false) const;
inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false) const;
// Access to the current G4Element
const G4Element* GetCurrentElement() const;
@@ -247,11 +241,7 @@ public:
void ActivateSecondaryBiasing(const G4String& region, G4double factor,
G4double energyLimit);
std::vector<G4double>* FindLambdaMax();
inline void SetEmMasterProcess(const G4VEmProcess*);
inline void SetCrossSectionType(G4CrossSectionType val);
inline void SetBuildTableFlag(G4bool val);
@@ -259,6 +249,11 @@ public:
inline G4bool UseBaseMaterial() const;
void BuildLambdaTable();
void StreamInfo(std::ostream& outFile, const G4ParticleDefinition&,
G4bool rst=false) const;
// hide copy constructor and assignment operator
G4VEmProcess(G4VEmProcess &) = delete;
G4VEmProcess & operator=(const G4VEmProcess &right) = delete;
@@ -286,11 +281,6 @@ protected:
// Single scattering parameters
inline G4double PolarAngleLimit() const;
inline G4CrossSectionType CrossSectionType() const;
inline G4double RecalculateLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple);
inline G4ParticleChangeForGamma* GetParticleChange();
inline void SetParticle(const G4ParticleDefinition* p);
@@ -311,9 +301,9 @@ protected:
inline void SetSplineFlag(G4bool val);
inline const G4Element* GetTargetElement() const;
const G4Element* GetTargetElement() const;
inline const G4Isotope* GetTargetIsotope() const;
const G4Isotope* GetTargetIsotope() const;
// these two methods assume that vectors are initilized
// and idx is within vector length
@@ -322,13 +312,6 @@ protected:
private:
void Clear();
void BuildLambdaTable();
void StreamInfo(std::ostream& outFile, const G4ParticleDefinition&,
G4bool rst=false) const;
void PrintWarning(G4String tit, G4double val);
void ComputeIntegralLambda(G4double kinEnergy, G4double logKinEnergy);
@@ -391,7 +374,7 @@ private:
G4double maxKinEnergy;
G4double minKinEnergyPrim = DBL_MAX;
G4double lambdaFactor = 0.8;
G4double logLambdaFactor;
G4double invLambdaFactor;
G4double biasFactor = 1.0;
G4double massRatio = 1.0;
G4double fFactor = 1.0;
@@ -456,11 +439,6 @@ private:
// ======== Run time inline methods ================
inline G4bool G4VEmProcess::ApplyCuts() const
{
return applyCuts;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline size_t G4VEmProcess::CurrentMaterialCutsCoupleIndex() const
@@ -615,15 +593,22 @@ G4VEmProcess::GetLambda(G4double kinEnergy, const G4MaterialCutsCouple* couple,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEmProcess::RecalculateLambda(G4double e, const G4MaterialCutsCouple* couple)
G4double G4VEmProcess::MeanFreePath(const G4Track& track)
{
CurrentSetup(couple, e);
return fFactor*ComputeCurrentLambda(e);
const G4double kinEnergy = track.GetKineticEnergy();
CurrentSetup(track.GetMaterialCutsCouple(), kinEnergy);
const G4double xs = GetCurrentLambda(kinEnergy,
track.GetDynamicParticle()->GetLogKineticEnergy());
return (0.0 < xs) ? 1.0/xs : DBL_MAX;
}
// ======== Get/Set inline methods used at initialisation ================
inline G4bool G4VEmProcess::ApplyCuts() const
{
return applyCuts;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4int G4VEmProcess::LambdaBinning() const
@@ -668,6 +653,20 @@ inline G4PhysicsTable* G4VEmProcess::LambdaTablePrim() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetLambdaTable(G4PhysicsTable* ptr)
{
theLambdaTable = ptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetLambdaTablePrim(G4PhysicsTable* ptr)
{
theLambdaTablePrim = ptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline std::vector<G4double>* G4VEmProcess::EnergyOfCrossSectionMax() const
{
return theEnergyOfCrossSectionMax;
@@ -675,6 +674,14 @@ inline std::vector<G4double>* G4VEmProcess::EnergyOfCrossSectionMax() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void
G4VEmProcess::SetEnergyOfCrossSectionMax(std::vector<G4double>* ptr)
{
theEnergyOfCrossSectionMax = ptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VEmProcess::Particle() const
{
return particle;
@@ -746,20 +753,6 @@ inline void G4VEmProcess::SetSplineFlag(G4bool val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4Element* G4VEmProcess::GetTargetElement() const
{
return currentModel->GetCurrentElement();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4Isotope* G4VEmProcess::GetTargetIsotope() const
{
return currentModel->GetCurrentIsotope();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4int G4VEmProcess::DensityIndex(G4int idx) const
{
return (*theDensityIdx)[idx];
@@ -809,4 +802,11 @@ inline G4VEmModel* G4VEmProcess::EmModel(size_t index) const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx, G4bool ver) const
{
return modelManager->GetModel(idx, ver);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -75,6 +75,7 @@ class G4VAtomDeexcitation;
class G4VSubCutProducer;
class G4EmBiasingManager;
class G4LossTableManager;
class G4EmDataHandler;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -99,20 +100,12 @@ protected:
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
const G4ParticleDefinition*) = 0;
//------------------------------------------------------------------------
// Methods with standard implementation; may be overwritten if needed
//------------------------------------------------------------------------
public:
// used as low energy limit LambdaTable
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*, G4double cut);
//------------------------------------------------------------------------
// Virtual methods implementation common to all EM ContinuousDiscrete
// processes. Further inheritance is not assumed
//------------------------------------------------------------------------
public:
// print documentation in html format
void ProcessDescription(std::ostream& outFile) const override;
@@ -170,19 +163,6 @@ private:
void StreamInfo(std::ostream& out, const G4ParticleDefinition& part,
G4bool rst=false) const;
// store a table
G4bool StoreTable(const G4ParticleDefinition* p,
G4PhysicsTable*, G4bool ascii,
const G4String& directory,
const G4String& tname);
// retrieve a table
G4bool RetrieveTable(const G4ParticleDefinition* p,
G4PhysicsTable*, G4bool ascii,
const G4String& directory,
const G4String& tname,
G4bool mandatory);
//------------------------------------------------------------------------
// Public interface to cross section, mfp and sampling of fluctuations
// These methods are not used in run time
@@ -328,16 +308,17 @@ public:
void SetDEDXTable(G4PhysicsTable* p, G4EmTableType tType);
void SetCSDARangeTable(G4PhysicsTable* pRange);
void SetRangeTableForLoss(G4PhysicsTable* p);
void SetSecondaryRangeTable(G4PhysicsTable* p);
void SetInverseRangeTable(G4PhysicsTable* p);
void SetLambdaTable(G4PhysicsTable* p);
void SetTwoPeaksXS(std::vector<G4TwoPeaksXS*>* p);
void SetTwoPeaksXS(std::vector<G4TwoPeaksXS*>*);
void SetEnergyOfCrossSectionMax(std::vector<G4double>*);
//------------------------------------------------------------------------
// Specific methods to define custom Physics Tables to the process
//------------------------------------------------------------------------
// Binning for dEdx, range, inverse range and labda tables
// Binning for dEdx, range, inverse range and lambda tables
void SetDEDXBinning(G4int nbins);
// Min kinetic energy for tables
@@ -375,11 +356,11 @@ public:
inline G4PhysicsTable* DEDXunRestrictedTable() const;
inline G4PhysicsTable* IonisationTable() const;
inline G4PhysicsTable* CSDARangeTable() const;
inline G4PhysicsTable* SecondaryRangeTable() const;
inline G4PhysicsTable* RangeTableForLoss() const;
inline G4PhysicsTable* InverseRangeTable() const;
inline G4PhysicsTable* LambdaTable() const;
inline std::vector<G4TwoPeaksXS*>* TwoPeaksXS() const;
inline std::vector<G4double>* EnergyOfCrossSectionMax() const;
inline G4bool UseBaseMaterial() const;
@@ -448,18 +429,13 @@ private:
const G4ParticleDefinition* particle = nullptr;
const G4ParticleDefinition* baseParticle = nullptr;
const G4ParticleDefinition* secondaryParticle = nullptr;
const G4ParticleDefinition* theElectron;
const G4ParticleDefinition* thePositron;
const G4ParticleDefinition* theGamma;
const G4ParticleDefinition* theGenericIon = nullptr;
G4EmDataHandler* theData = nullptr;
G4PhysicsTable* theDEDXTable = nullptr;
G4PhysicsTable* theDEDXunRestrictedTable = nullptr;
G4PhysicsTable* theIonisationTable = nullptr;
G4PhysicsTable* theIonisationSubTable = nullptr;
G4PhysicsTable* theRangeTableForLoss = nullptr;
G4PhysicsTable* theCSDARangeTable = nullptr;
G4PhysicsTable* theSecondaryRangeTable = nullptr;
G4PhysicsTable* theInverseRangeTable = nullptr;
G4PhysicsTable* theLambdaTable = nullptr;
@@ -469,6 +445,7 @@ private:
const std::vector<G4double>* theDensityFactor = nullptr;
const G4DataVector* theCuts = nullptr;
std::vector<G4double>* theEnergyOfCrossSectionMax = nullptr;
std::vector<G4TwoPeaksXS*>* fXSpeaks = nullptr;
G4double lowestKinEnergy;
@@ -479,8 +456,8 @@ private:
G4double linLossLimit = 0.01;
G4double dRoverRange = 0.2;
G4double finalRange;
G4double lambdaFactor = 1.0;
G4double logLambdafactor = 0.0;
G4double lambdaFactor = 0.8;
G4double invLambdaFactor;
G4double biasFactor = 1.0;
G4double massRatio = 1.0;
@@ -488,8 +465,6 @@ private:
G4double fFactor = 1.0;
G4double reduceFactor = 1.0;
G4double chargeSqRatio = 1.0;
G4double fLambda = 0.0;
G4double fLambdaEnergy = 0.0;
G4double fRange = 0.0;
G4double fRangeEnergy = 0.0;
@@ -517,7 +492,6 @@ private:
size_t basedCoupleIndex = 0;
size_t coupleIdxRange = 0;
size_t coupleIdxLambda = 0;
size_t idxDEDX = 0;
size_t idxDEDXunRestricted = 0;
size_t idxIonisation = 0;
@@ -528,7 +502,7 @@ private:
size_t idxLambda = 0;
G4GPILSelection aGPILSelection;
G4CrossSectionType fXSType = fEmIncreasing;
G4CrossSectionType fXSType = fEmOnePeak;
G4bool lossFluctuationFlag = true;
G4bool rndmStepFlag = false;
@@ -548,8 +522,7 @@ private:
G4bool actMaxKinEnergy = false;
std::vector<G4DynamicParticle*> secParticles;
std::vector<G4Track*> scTracks;
std::vector<G4Track*> scTracks;
};
// ======== Run time inline methods ================
@@ -581,7 +554,7 @@ inline void
G4VEnergyLossProcess::DefineMaterial(const G4MaterialCutsCouple* couple)
{
if(couple != currentCouple) {
currentCouple = couple;
currentCouple = couple;
currentMaterial = couple->GetMaterial();
basedCoupleIndex = currentCoupleIndex = couple->GetIndex();
fFactor = chargeSqRatio*biasFactor;
@@ -712,12 +685,7 @@ inline G4double G4VEnergyLossProcess::ScaledKinEnergyForLoss(G4double r)
inline G4double G4VEnergyLossProcess::GetLambdaForScaledEnergy(G4double e)
{
if(currentCoupleIndex != coupleIdxLambda || fLambdaEnergy != e) {
coupleIdxLambda = currentCoupleIndex;
fLambdaEnergy = e;
fLambda = fFactor*((*theLambdaTable)[basedCoupleIndex])->Value(e, idxLambda);
}
return fLambda;
return fFactor*((*theLambdaTable)[basedCoupleIndex])->Value(e, idxLambda);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -725,13 +693,7 @@ inline G4double G4VEnergyLossProcess::GetLambdaForScaledEnergy(G4double e)
inline G4double
G4VEnergyLossProcess::GetLambdaForScaledEnergy(G4double e, G4double loge)
{
if(currentCoupleIndex != coupleIdxLambda || fLambdaEnergy != e) {
coupleIdxLambda = currentCoupleIndex;
fLambdaEnergy = e;
fLambda = fFactor*
((*theLambdaTable)[basedCoupleIndex])->LogVectorValue(e, loge);
}
return fLambda;
return fFactor*((*theLambdaTable)[basedCoupleIndex])->LogVectorValue(e, loge);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -981,13 +943,6 @@ inline G4PhysicsTable* G4VEnergyLossProcess::CSDARangeTable() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::SecondaryRangeTable() const
{
return theSecondaryRangeTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::RangeTableForLoss() const
{
return theRangeTableForLoss;
@@ -1016,6 +971,14 @@ inline G4bool G4VEnergyLossProcess::UseBaseMaterial() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline std::vector<G4double>*
G4VEnergyLossProcess::EnergyOfCrossSectionMax() const
{
return theEnergyOfCrossSectionMax;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline std::vector<G4TwoPeaksXS*>* G4VEnergyLossProcess::TwoPeaksXS() const
{
return fXSpeaks;
@@ -1032,8 +995,7 @@ inline size_t G4VEnergyLossProcess::NumberOfModels() const
inline G4VEmModel* G4VEnergyLossProcess::EmModel(size_t index) const
{
return (nullptr != emModels && index < emModels->size())
? (*emModels)[index] : nullptr;
return (index < emModels->size()) ? (*emModels)[index] : nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -328,6 +328,8 @@ G4VMscModel::GetTransportMeanFreePath(const G4ParticleDefinition* part,
return (x > 0.0) ? 1.0/x : DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double
G4VMscModel::GetTransportMeanFreePath(const G4ParticleDefinition* part,
G4double ekin, G4double logekin)
@@ -98,10 +98,14 @@ public:
void ProcessDescription(std::ostream& outFile) const override;
protected:
virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
// Print out of generic class parameters
void StreamInfo(std::ostream& outFile, const G4ParticleDefinition&,
G4bool rst = false) const;
protected:
virtual void StreamProcessInfo(std::ostream&) const {};
public:
@@ -178,7 +182,7 @@ public:
// Add model for region, smaller value of order defines which
// model will be selected for a given energy interval
void AddEmModel(G4int order, G4VEmModel*, const G4Region* region = nullptr);
void AddEmModel(G4int order, G4VMscModel*, const G4Region* region = nullptr);
// Assign a model to a process local list, to enable the list in run time
// the derived process should execute AddEmModel(..) for all such models
@@ -190,14 +194,12 @@ public:
// Access to run time models
inline G4int NumberOfModels() const;
inline G4VMscModel* GetModelByIndex(G4int idx = 0, G4bool ver = false) const;
inline G4VMscModel* GetModelByIndex(G4int idx, G4bool ver = false) const;
//------------------------------------------------------------------------
// Get/Set parameters for simulation of multiple scattering
//------------------------------------------------------------------------
void SetIonisation(G4VEnergyLossProcess*);
inline G4bool LateralDisplasmentFlag() const;
inline G4double Skin() const;
@@ -237,10 +239,6 @@ protected:
private:
// Print out of generic class parameters
void StreamInfo(std::ostream& outFile, const G4ParticleDefinition&,
G4bool rst = false) const;
// ======== Parameters of the class fixed at construction =========
G4EmModelManager* modelManager;
@@ -337,7 +335,7 @@ inline G4double G4VMultipleScattering::PolarAngleLimit() const
inline G4MscStepLimitType G4VMultipleScattering::StepLimitType() const
{
return theParameters->MscStepLimitType();
return stepLimit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -387,6 +385,7 @@ inline G4int G4VMultipleScattering::NumberOfModels() const
inline G4VMscModel*
G4VMultipleScattering::GetModelByIndex(G4int idx, G4bool ver) const
{
// static cast is possible inside this class
return static_cast<G4VMscModel*>(modelManager->GetModel(idx, ver));
}
@@ -60,7 +60,7 @@ public:
explicit G4VSubCutProducer(const G4String& name) : fName(name) {};
virtual ~G4VSubCutProducer() {};
virtual ~G4VSubCutProducer() = default;
// Sample direction in global coordinate system,
// this means for zero scattering angle this direction is the same