Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
@@ -58,16 +58,14 @@ public:
G4AngleDirect();
virtual ~G4AngleDirect();
~G4AngleDirect() override;
// Sample direction in global coordinate system,
// this means for zero scattering angle this direction is the same
// as the direction of primary
virtual G4ThreeVector& SampleDirection(const G4DynamicParticle* dp,
G4double, G4int,
const G4Material*) override;
private:
G4ThreeVector& SampleDirection(const G4DynamicParticle* dp,
G4double, G4int,
const G4Material*) override;
// hide assignment operator
G4AngleDirect & operator=(const G4AngleDirect &right) = delete;
@@ -65,12 +65,12 @@ public:
// Returns the id of the shell
inline G4int ShellId() const;
private:
G4AtomicShell & operator=(const G4AtomicShell &right) = delete;
G4AtomicShell(const G4AtomicShell&) = delete;
private:
G4int identifier;
G4double bindingEnergy;
@@ -50,7 +50,7 @@
#include "globals.hh"
#include "G4VMscModel.hh"
class G4DummyModel : public G4VMscModel
class G4DummyModel : public G4VMscModel
{
public:
@@ -75,8 +75,6 @@ public:
G4ThreeVector& SampleScattering(const G4ThreeVector&, G4double) final;
private:
// hide assignment operator
G4DummyModel & operator=(const G4DummyModel &right) = delete;
G4DummyModel(const G4DummyModel&) = delete;
@@ -23,8 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
#ifndef G4ElectronIonPair_h
#define G4ElectronIonPair_h 1
@@ -110,16 +108,16 @@ public:
inline void SetVerbose(G4int);
// hide assignment operator
G4ElectronIonPair & operator=(const G4ElectronIonPair &right) = delete;
G4ElectronIonPair(const G4ElectronIonPair&) = delete;
private:
void Initialise();
G4double FindMeanEnergyPerIonPair(const G4Material*) const;
// hide assignment operator
G4ElectronIonPair & operator=(const G4ElectronIonPair &right) = delete;
G4ElectronIonPair(const G4ElectronIonPair&) = delete;
// cache
const G4Material* curMaterial;
G4double curMeanEnergy;
@@ -131,6 +131,10 @@ public:
{ fDirectionalSplittingRadius = r; }
G4double GetWeight(G4int i);
// hide copy constructor and assignment operator
G4EmBiasingManager(G4EmBiasingManager &) = delete;
G4EmBiasingManager & operator=(const G4EmBiasingManager &right) = delete;
private:
void ApplyRangeCut(std::vector<G4DynamicParticle*>& vd,
@@ -160,37 +164,36 @@ private:
inline G4double ApplyRussianRoulette(std::vector<G4DynamicParticle*>& vd,
G4int index);
// hide copy constructor and assignment operator
G4EmBiasingManager(G4EmBiasingManager &) = delete;
G4EmBiasingManager & operator=(const G4EmBiasingManager &right) = delete;
G4VEnergyLossProcess* eIonisation = nullptr;
const G4ParticleDefinition* theElectron;
const G4ParticleDefinition* theGamma;
G4double fSafetyMin;
G4double currentStepLimit = 0.0;
G4double fDirectionalSplittingRadius = 0.0;
G4int nForcedRegions = 0;
G4int nSecBiasedRegions = 0;
G4bool startTracking = true;
G4bool fDirectionalSplitting = false;
G4ThreeVector fDirectionalSplittingTarget;
std::vector<G4double> fDirectionalSplittingWeights;
G4int nForcedRegions;
G4int nSecBiasedRegions;
std::vector<const G4Region*> forcedRegions;
std::vector<G4double> lengthForRegion;
std::vector<const G4Region*> secBiasedRegions;
std::vector<G4double> secBiasedWeight;
std::vector<G4double> secBiasedEnegryLimit;
std::vector<G4int> nBremSplitting;
std::vector<const G4Region*> forcedRegions;
std::vector<const G4Region*> secBiasedRegions;
std::vector<G4int> nBremSplitting;
std::vector<G4int> idxForcedCouple;
std::vector<G4int> idxSecBiasedCouple;
std::vector<G4DynamicParticle*> tmpSecondaries;
G4VEnergyLossProcess* eIonisation;
const G4ParticleDefinition* theElectron;
const G4ParticleDefinition* theGamma;
G4double fSafetyMin;
G4double currentStepLimit;
G4bool startTracking;
G4bool fDirectionalSplitting;
G4ThreeVector fDirectionalSplittingTarget;
G4double fDirectionalSplittingRadius;
std::vector<G4double> fDirectionalSplittingWeights;
};
inline G4bool
@@ -24,7 +24,6 @@
// ********************************************************************
//
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
@@ -57,8 +56,6 @@
#include <vector>
#include "globals.hh"
#include "G4DataVector.hh"
#include "G4DynamicParticle.hh"
#include "G4VAtomDeexcitation.hh"
class G4LossTableManager;
@@ -267,9 +264,9 @@ public:
void SetVerbose(G4int val);
//===========================================================================
// Private methods
//===========================================================================
// hide copy and assign
G4EmCalculator & operator=(const G4EmCalculator &right) = delete;
G4EmCalculator(const G4EmCalculator&) = delete;
private:
@@ -301,55 +298,52 @@ private:
void CheckMaterial(G4int Z);
// hide copy and assign
G4EmCalculator & operator=(const G4EmCalculator &right) = delete;
G4EmCalculator(const G4EmCalculator&) = delete;
std::vector<const G4Material*> localMaterials;
std::vector<const G4MaterialCutsCouple*> localCouples;
G4EmParameters* theParameters;
G4LossTableManager* manager;
G4NistManager* nist;
G4IonTable* ionTable;
G4EmCorrections* corr;
G4DataVector localCuts;
G4int nLocalMaterials;
G4int verbose;
// cache
G4int currentCoupleIndex;
const G4MaterialCutsCouple* currentCouple;
const G4Material* currentMaterial;
const G4Material* cutMaterial;
const G4ParticleDefinition* currentParticle;
const G4ParticleDefinition* lambdaParticle;
const G4ParticleDefinition* baseParticle;
const G4PhysicsTable* currentLambda;
const G4MaterialCutsCouple* currentCouple = nullptr;
const G4Material* currentMaterial = nullptr;
const G4Material* cutMaterial = nullptr;
const G4ParticleDefinition* currentParticle = nullptr;
const G4ParticleDefinition* lambdaParticle = nullptr;
const G4ParticleDefinition* baseParticle = nullptr;
const G4PhysicsTable* currentLambda = nullptr;
G4VEmModel* currentModel;
G4VEmModel* loweModel;
G4VEnergyLossProcess* currentProcess;
G4VProcess* curProcess;
G4VEmModel* currentModel = nullptr;
G4VEmModel* loweModel = nullptr;
G4VEnergyLossProcess* currentProcess = nullptr;
G4VProcess* curProcess = nullptr;
G4DynamicParticle* dynParticle = nullptr;
const G4ParticleDefinition* theGenericIon;
G4ionEffectiveCharge* ionEffCharge;
G4DynamicParticle dynParticle;
G4String currentName;
G4String lambdaName;
G4double currentCut;
G4double chargeSquare;
G4double massRatio;
G4double mass;
G4double currentCut = DBL_MAX;
G4double chargeSquare = 1.0;
G4double massRatio = 1.0;
G4double mass = 0;
G4double cutenergy[3];
G4bool isIon;
G4bool isApplicable;
G4String currentParticleName;
G4String currentMaterialName;
G4String currentProcessName;
G4int currentCoupleIndex = 0;
G4int nLocalMaterials = 0;
G4int verbose = 0;
G4bool isIon = false;
G4bool isApplicable = false;
std::vector<const G4Material*> localMaterials;
std::vector<const G4MaterialCutsCouple*> localCouples;
std::vector<G4double> localCuts;
G4String currentName = "";
G4String lambdaName = "";
G4String currentParticleName = "";
G4String currentMaterialName = "";
G4String currentProcessName = "";
};
//....oooOO0OOooo.......oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -99,13 +99,17 @@ public:
inline void SetVerbose(G4int value);
// hide assignment operator
G4EmConfigurator & operator=(const G4EmConfigurator &right) = delete;
G4EmConfigurator(const G4EmConfigurator&) = delete;
private:
G4Region* FindRegion(const G4String&);
const G4Region* FindRegion(const G4String&);
void SetModelForRegion(G4VEmModel* model,
G4VEmFluctuationModel* fm,
G4Region* reg,
const G4Region* reg,
const G4String& particleName,
const G4String& processName,
G4double emin,
@@ -114,10 +118,6 @@ private:
G4bool UpdateModelEnergyRange(G4VEmModel* mod,
G4double emin, G4double emax);
// hide assignment operator
G4EmConfigurator & operator=(const G4EmConfigurator &right) = delete;
G4EmConfigurator(const G4EmConfigurator&) = delete;
std::vector<G4VEmModel*> models;
std::vector<G4VEmFluctuationModel*> flucModels;
std::vector<G4String> particles;
@@ -59,12 +59,13 @@
#include "G4ionEffectiveCharge.hh"
#include "G4Material.hh"
#include "G4ParticleDefinition.hh"
#include "G4Threading.hh"
class G4VEmModel;
class G4PhysicsVector;
class G4IonTable;
class G4MaterialCutsCouple;
class G4LPhysicsFreeVector;
class G4PhysicsFreeVector;
class G4Pow;
class G4EmCorrections
@@ -74,7 +75,7 @@ public:
explicit G4EmCorrections(G4int verb);
virtual ~G4EmCorrections();
~G4EmCorrections();
G4double HighOrderCorrections(const G4ParticleDefinition*,
const G4Material*,
@@ -161,6 +162,10 @@ public:
inline void SetVerbose(G4int verb);
// hide assignment operator
G4EmCorrections & operator=(const G4EmCorrections &right) = delete;
G4EmCorrections(const G4EmCorrections&) = delete;
private:
void Initialise();
@@ -184,11 +189,68 @@ private:
G4double y1, G4double y2, G4double z11, G4double z21,
G4double z12, G4double z22) const;
// hide assignment operator
G4EmCorrections & operator=(const G4EmCorrections &right) = delete;
G4EmCorrections(const G4EmCorrections&) = delete;
G4Pow* g4calc;
G4IonTable* ionTable;
const G4ParticleDefinition* particle = nullptr;
const G4ParticleDefinition* curParticle = nullptr;
const G4Material* material = nullptr;
const G4Material* curMaterial = nullptr;
const G4ElementVector* theElementVector = nullptr;
const G4double* atomDensity = nullptr;
G4PhysicsVector* curVector = nullptr;
G4VEmModel* ionLEModel = nullptr;
G4VEmModel* ionHEModel = nullptr;
G4double kinEnergy = 0.0;
G4double mass = 0.0;
G4double massFactor = 1.0;
G4double eth;
G4double tau = 0.0;
G4double gamma = 1.0;
G4double bg2 = 0.0;
G4double beta2 = 0.0;
G4double beta = 0.0;
G4double ba2 = 0.0;
G4double tmax = 0.0;
G4double charge = 0.0;
G4double q2 = 0.0;
G4double eCorrMin;
G4double eCorrMax;
G4bool isMaster = false;
size_t ncouples = 0;
G4int verbose;
G4int nK;
G4int nL;
G4int nEtaK;
G4int nEtaL;
G4int nbinCorr = 20;
G4int numberOfElements = 0;
// Ion stopping data
G4int nIons = 0;
G4int idx = 0;
G4int currentZ = 0;
std::vector<G4int> Zion;
std::vector<G4int> Aion;
std::vector<G4String> materialName;
std::vector<const G4ParticleDefinition*> ionList;
std::map< G4int, std::vector<G4double> > thcorr;
std::vector<const G4Material*> currmat;
std::vector<const G4Material*> materialList;
std::vector<G4PhysicsVector*> stopData;
G4ionEffectiveCharge effCharge;
static const G4double ZD[11];
static const G4double UK[20];
@@ -200,70 +262,13 @@ private:
static const G4double UL[26];
static G4double VL[26];
static G4LPhysicsFreeVector* BarkasCorr;
static G4LPhysicsFreeVector* ThetaK;
static G4LPhysicsFreeVector* ThetaL;
static G4PhysicsFreeVector* sBarkasCorr;
static G4PhysicsFreeVector* sThetaK;
static G4PhysicsFreeVector* sThetaL;
G4double alpha2;
std::vector<const G4Material*> currmat;
std::map< G4int, std::vector<G4double> > thcorr;
size_t ncouples;
const G4ParticleDefinition* particle;
const G4ParticleDefinition* curParticle;
const G4Material* material;
const G4Material* curMaterial;
const G4ElementVector* theElementVector;
const G4double* atomDensity;
G4PhysicsVector* curVector;
G4IonTable* ionTable;
G4VEmModel* ionLEModel;
G4VEmModel* ionHEModel;
G4double kinEnergy;
G4double mass;
G4double massFactor;
G4double eth;
G4double tau;
G4double gamma;
G4double bg2;
G4double beta2;
G4double beta;
G4double ba2;
G4double tmax;
G4double charge;
G4double q2;
G4double eCorrMin;
G4double eCorrMax;
G4int verbose;
G4int nK;
G4int nL;
G4int nEtaK;
G4int nEtaL;
G4int nbinCorr;
G4int numberOfElements;
// Ion stopping data
G4int nIons;
G4int idx;
G4int currentZ;
std::vector<G4int> Zion;
std::vector<G4int> Aion;
std::vector<G4String> materialName;
std::vector<const G4ParticleDefinition*> ionList;
std::vector<const G4Material*> materialList;
std::vector<G4PhysicsVector*> stopData;
G4bool isMaster;
G4ionEffectiveCharge effCharge;
#ifdef G4MULTITHREADED
static G4Mutex theCorrMutex;
#endif
};
inline G4int
@@ -295,8 +300,8 @@ inline G4double G4EmCorrections::Value2(G4double xv, G4double yv,
inline void
G4EmCorrections::SetIonisationModels(G4VEmModel* mod1, G4VEmModel* mod2)
{
if(mod1) { ionLEModel = mod1; }
if(mod2) { ionHEModel = mod2; }
if(nullptr != mod1) { ionLEModel = mod1; }
if(nullptr != mod2) { ionHEModel = mod2; }
}
inline G4int G4EmCorrections::GetNumberOfStoppingVectors() const
@@ -81,7 +81,7 @@ public:
G4bool RetrievePhysicsTable(size_t idx,
const G4ParticleDefinition* part,
const G4String& fname,
G4bool ascii);
G4bool ascii, G4bool spline);
void SetMasterProcess(const G4VEmProcess*);
@@ -74,18 +74,19 @@ public:
void Dump(const G4ParticleDefinition* p = nullptr);
const G4Element* SelectRandomAtom(const G4double kineticEnergy,
const G4double logEKin) const;
inline const G4Element* SelectRandomAtom(G4double kineticEnergy) const;
inline const G4Element* SelectRandomAtom(const G4double kineticEnergy,
const G4double logEKin) const;
inline const G4Material* GetMaterial() const;
private:
// hide assignment operator
G4EmElementSelector & operator=(const G4EmElementSelector &right) = delete;
G4EmElementSelector(const G4EmElementSelector&) = delete;
private:
G4VEmModel* model;
const G4Material* material;
const G4ElementVector* theElementVector;
@@ -120,41 +121,6 @@ inline const G4Element* G4EmElementSelector::SelectRandomAtom(G4double e) const
return element;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
inline const G4Element*
G4EmElementSelector::SelectRandomAtom(const G4double e,const G4double loge)const
{
const G4Element* element = (*theElementVector)[nElmMinusOne];
if (nElmMinusOne > 0) {
// 1. Determine energy index (only once)
const size_t nBins = (xSections[0])->GetVectorLength();
// handle cases below/above the enrgy grid (by ekin, idx that gives a=0/1)
// ekin = x[0] if e<=x[0] and idx will be 0 ^ a=0 => so y=y0
// ekin = x[N-1] if e>=x[N-1] and idx will be N-2 ^ a=1 => so y=y_{N-1}
const G4double ekin = std::max((xSections[0])->Energy(0),
std::min((xSections[0])->Energy(nBins-1),e));
// compute the lower index of the bin (idx \in [0,N-2] will be guaranted)
const size_t idx = (xSections[0])->ComputeLogVectorBin(loge);
// 2. Do the linear interp.(robust for corner cases through ekin, idx and a)
const G4double x1 = (xSections[0])->Energy(idx);
const G4double x2 = (xSections[0])->Energy(idx+1);
// note: all corner cases of the previous methods are covered and eventually
// gives a=0/1 that results in y=y0\y_{N-1} if e<=x[0]/e>=x[N-1] or
// y=y_i/y_{i+1} if e<x[i]/e>=x[i+1] due to small numerical errors
const G4double a = std::max(0., std::min(1., (ekin - x1)/(x2 - x1)));
const G4double urnd = G4UniformRand();
for (G4int i = 0; i < nElmMinusOne; ++i) {
const G4double y1 = (*xSections[i])[idx];
const G4double y2 = (*xSections[i])[idx+1];
if (urnd <= y1 + a*(y2-y1)) {
element = (*theElementVector)[i];
break;
}
}
}
return element;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
inline const G4Material* G4EmElementSelector::GetMaterial() const
@@ -111,7 +111,7 @@ public:
const std::vector<G4String>& RegionsPhysics() const;
const std::vector<G4String>& TypesPhysics() const;
void SetSubCutoff(G4bool val, const G4String& region = "");
void SetSubCutRegion(const G4String& region);
void SetProcessBiasingFactor(const G4String& procname,
G4double val, G4bool wflag);
@@ -165,7 +165,6 @@ private:
std::vector<G4String> m_typesPhys;
std::vector<G4String> m_regnamesSubCut;
std::vector<G4bool> m_subCuts;
std::vector<G4String> m_procBiasedXS;
std::vector<G4double> m_factBiasedXS;
@@ -66,9 +66,13 @@ class G4EmExtraParametersMessenger: public G4UImessenger
public: // with description
explicit G4EmExtraParametersMessenger(G4EmExtraParameters*);
virtual ~G4EmExtraParametersMessenger();
~G4EmExtraParametersMessenger() override;
virtual void SetNewValue(G4UIcommand*, G4String) override;
void SetNewValue(G4UIcommand*, G4String) override;
G4EmExtraParametersMessenger & operator=
(const G4EmExtraParametersMessenger &right) = delete;
G4EmExtraParametersMessenger(const G4EmExtraParametersMessenger&) = delete;
private:
@@ -82,7 +86,7 @@ private:
G4UIcommand* paiCmd;
G4UIcommand* mscoCmd;
G4UIcommand* SubSecCmd;
G4UIcmdWithAString* SubSecCmd;
G4UIcommand* bfCmd;
G4UIcommand* fiCmd;
G4UIcommand* bsCmd;
@@ -66,9 +66,13 @@ class G4EmLowEParametersMessenger: public G4UImessenger
public: // with description
explicit G4EmLowEParametersMessenger(G4EmLowEParameters*);
virtual ~G4EmLowEParametersMessenger();
~G4EmLowEParametersMessenger() override;
virtual void SetNewValue(G4UIcommand*, G4String) override;
void SetNewValue(G4UIcommand*, G4String) override;
G4EmLowEParametersMessenger & operator=
(const G4EmLowEParametersMessenger &right) = delete;
G4EmLowEParametersMessenger(const G4EmLowEParametersMessenger&) = delete;
private:
@@ -66,7 +66,6 @@
// -------------------------------------------------------------------
//
#ifndef G4EmModelManager_h
#define G4EmModelManager_h 1
@@ -78,6 +77,11 @@
#include "G4EmProcessSubType.hh"
#include "G4Region.hh"
#include "G4VEmModel.hh"
#include "G4VEmFluctuationModel.hh"
#include "G4DynamicParticle.hh"
#include <iostream>
class G4RegionModels
{
@@ -126,10 +130,7 @@ private:
};
#include "G4VEmModel.hh"
#include "G4VEmFluctuationModel.hh"
#include "G4DynamicParticle.hh"
#include <iostream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4Region;
class G4ParticleDefinition;
@@ -150,8 +151,7 @@ public:
const G4DataVector* Initialise(const G4ParticleDefinition* part,
const G4ParticleDefinition* secPart,
G4double minSubRange,
G4int verb);
G4double, G4int verb);
void FillDEDXVector(G4PhysicsVector*, const G4MaterialCutsCouple*,
G4EmTableType t = fRestricted);
@@ -160,7 +160,8 @@ public:
G4bool startFromNull = true,
G4EmTableType t = fRestricted);
void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel*, const G4Region*);
void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel* fm,
const G4Region* r);
void UpdateEmModel(const G4String& model_name, G4double emin, G4double emax);
@@ -179,11 +180,10 @@ public:
void DumpModelList(std::ostream& out, G4int verb);
// Select model for given material cuts couple index
inline G4VEmModel* SelectModel(G4double& energy, size_t& index);
inline G4VEmModel* SelectModel(G4double energy, size_t index);
// Access to cuts
inline const G4DataVector* Cuts() const;
inline const G4DataVector* SubCutoff() const;
// Set flag of fluorescence
inline void SetFluoFlag(G4bool val);
@@ -197,48 +197,36 @@ public:
private:
inline G4double ComputeDEDX(G4VEmModel* model,
const G4MaterialCutsCouple*,
G4double kinEnergy,
G4double cutEnergy,
G4double minEnergy);
const G4ParticleDefinition* particle = nullptr;
const G4DataVector* theCuts = nullptr;
G4DataVector* theCutsNew = nullptr;
// =====================================================================
// may be changed in run time
G4RegionModels* currRegionModel = nullptr;
G4VEmModel* currModel = nullptr;
const G4DataVector* theCuts;
G4DataVector* theCutsNew;
G4DataVector* theSubCuts;
G4int nEmModels = 0;
G4int nRegions = 0;
std::vector<G4VEmModel*> models;
std::vector<G4VEmFluctuationModel*> flucModels;
std::vector<const G4Region*> regions;
std::vector<G4int> orderOfModels;
std::vector<G4int> isUsed;
G4int verboseLevel = 0;
G4bool severalModels = true;
G4bool fluoFlag = false;
G4int nEmModels;
G4int nRegions;
std::vector<G4VEmModel*> models;
std::vector<G4VEmFluctuationModel*> flucModels;
std::vector<const G4Region*> regions;
std::vector<G4int> orderOfModels;
std::vector<G4int> isUsed;
std::vector<G4int> idxOfRegionModels;
std::vector<G4RegionModels*> setOfRegionModels;
G4double maxSubCutInRange;
const G4ParticleDefinition* particle;
G4int verboseLevel;
G4bool severalModels;
G4bool fluoFlag;
// may be changed in run time
G4RegionModels* currRegionModel;
G4VEmModel* currModel;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4EmModelManager::SelectModel(G4double& kinEnergy,
size_t& index)
inline
G4VEmModel* G4EmModelManager::SelectModel(G4double kinEnergy, size_t index)
{
if(severalModels) {
if(nRegions > 1) {
@@ -258,13 +246,6 @@ inline const G4DataVector* G4EmModelManager::Cuts() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4DataVector* G4EmModelManager::SubCutoff() const
{
return theSubCuts;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4EmModelManager::SetFluoFlag(G4bool val)
{
fluoFlag = val;
@@ -279,22 +260,5 @@ inline G4int G4EmModelManager::NumberOfModels() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4EmModelManager::ComputeDEDX(G4VEmModel* model,
const G4MaterialCutsCouple* couple,
G4double e,
G4double cut,
G4double emin)
{
G4double dedx = 0.0;
if(model && cut > emin) {
dedx = model->ComputeDEDX(couple,particle,e,cut);
if(emin > 0.0) {dedx -= model->ComputeDEDX(couple,particle,e,emin);}
}
return dedx;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -51,31 +51,31 @@
#include "globals.hh"
#include "G4VEmModel.hh"
#include "G4ParticleDefinition.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4Material.hh"
#include <vector>
class G4DynamicParticle;
class G4EmMultiModel : public G4VEmModel
{
public:
explicit G4EmMultiModel(const G4String& nam = "MultiModel");
virtual ~G4EmMultiModel();
~G4EmMultiModel() override;
void AddModel(G4VEmModel*);
virtual void Initialise(const G4ParticleDefinition*,
const G4DataVector&) final;
void Initialise(const G4ParticleDefinition*, const G4DataVector&) final;
virtual G4double ComputeDEDX(const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy) final;
G4double ComputeDEDXPerVolume(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy) final;
// main method to compute cross section per atom
virtual
G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
G4double kinEnergy,
G4double Z,
@@ -83,19 +83,19 @@ public:
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX) final;
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double tmax) final;
private:
void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double tmax) final;
// hide assignment operator
G4EmMultiModel & operator=(const G4EmMultiModel &right) = delete;
G4EmMultiModel(const G4EmMultiModel&) = delete;
G4int nModels;
private:
G4int nModels = 0;
std::vector<G4VEmModel*> model;
std::vector<G4double> cross_section;
@@ -145,9 +145,8 @@ public:
void SetUseMottCorrection(G4bool val);
G4bool UseMottCorrection() const;
void SetIntegral(G4bool val);
G4bool Integral() const;
void SetIntegral(G4bool) {};
void SetBirksActive(G4bool val);
G4bool BirksActive() const;
@@ -163,6 +162,8 @@ public:
void SetDNAElectronMsc(G4bool val);
G4bool DNAElectronMsc() const;
// if general interaction is enabled then
// force interaction options should be disabled
void SetGeneralProcessActive(G4bool val);
G4bool GeneralProcessActive() const;
@@ -188,8 +189,6 @@ public:
void ActivateDNA();
// double parameters with values
void SetMinSubRange(G4double val);
G4double MinSubRange() const;
void SetMinEnergy(G4double val);
G4double MinKinEnergy() const;
@@ -269,11 +268,10 @@ public:
G4ThreeVector GetDirectionalSplittingTarget() const;
// integer parameters
void SetNumberOfBins(G4int val);
G4int NumberOfBins() const;
void SetNumberOfBinsPerDecade(G4int val);
G4int NumberOfBinsPerDecade() const;
G4int NumberOfBins() const;
void SetVerbose(G4int val);
G4int Verbose() const;
@@ -329,7 +327,7 @@ public:
const std::vector<G4String>& RegionsPhysics() const;
const std::vector<G4String>& TypesPhysics() const;
void SetSubCutoff(G4bool val, const G4String& region = "");
void SetSubCutRegion(const G4String& region = "");
void SetDeexActiveRegion(const G4String& region, G4bool fdeex,
G4bool fauger, G4bool fpixe);
@@ -347,7 +345,9 @@ public:
G4double factor,
G4double energyLimit);
// define external saturation class
void SetEmSaturation(G4EmSaturation*);
// create and access saturation class
G4EmSaturation* GetEmSaturation();
// initialisation methods
@@ -379,7 +379,6 @@ private:
G4bool lossFluctuation;
G4bool buildCSDARange;
G4bool flagLPM;
G4bool spline;
G4bool cutAsFinalRange;
G4bool applyCuts;
G4bool lateralDisplacement;
@@ -387,7 +386,6 @@ private:
G4bool muhadLateralDisplacement;
G4bool useAngGeneratorForIonisation;
G4bool useMottCorrection;
G4bool integral;
G4bool birks;
G4bool fICRU90;
G4bool gener;
@@ -397,7 +395,6 @@ private:
G4bool onIsolated; // 5d model conversion on free ions
G4bool fDNA;
G4double minSubRange;
G4double minKinEnergy;
G4double maxKinEnergy;
G4double maxKinEnergyCSDA;
@@ -421,7 +418,6 @@ private:
G4double skin;
G4double factorScreen;
G4int nbins;
G4int nbinsPerDecade;
G4int verbose;
G4int workerVerbose;
@@ -67,9 +67,13 @@ class G4EmParametersMessenger: public G4UImessenger
public: // with description
explicit G4EmParametersMessenger(G4EmParameters*);
virtual ~G4EmParametersMessenger();
~G4EmParametersMessenger() override;
virtual void SetNewValue(G4UIcommand*, G4String) override;
void SetNewValue(G4UIcommand*, G4String) override;
G4EmParametersMessenger & operator=
(const G4EmParametersMessenger &right) = delete;
G4EmParametersMessenger(const G4EmParametersMessenger&) = delete;
private:
@@ -84,14 +88,12 @@ private:
G4UIcmdWithABool* flucCmd;
G4UIcmdWithABool* rangeCmd;
G4UIcmdWithABool* lpmCmd;
G4UIcmdWithABool* splCmd;
G4UIcmdWithABool* rsCmd;
G4UIcmdWithABool* aplCmd;
G4UIcmdWithABool* latCmd;
G4UIcmdWithABool* lat96Cmd;
G4UIcmdWithABool* mulatCmd;
G4UIcmdWithABool* delCmd;
G4UIcmdWithABool* IntegCmd;
G4UIcmdWithABool* mottCmd;
G4UIcmdWithABool* birksCmd;
G4UIcmdWithABool* sharkCmd;
@@ -100,7 +102,6 @@ private:
G4UIcmdWithABool* icru90Cmd;
G4UIcmdWithABool* mudatCmd;
G4UIcmdWithADouble* minSubSecCmd;
G4UIcmdWithADoubleAndUnit* minEnCmd;
G4UIcmdWithADoubleAndUnit* maxEnCmd;
G4UIcmdWithADoubleAndUnit* max5DCmd;
@@ -124,8 +125,6 @@ private:
G4UIcmdWithADouble* skinCmd;
G4UIcmdWithADouble* screCmd;
G4UIcmdWithAnInteger* dedxCmd;
G4UIcmdWithAnInteger* lamCmd;
G4UIcmdWithAnInteger* amCmd;
G4UIcmdWithAnInteger* verCmd;
G4UIcmdWithAnInteger* ver1Cmd;
@@ -1,174 +0,0 @@
//
// ********************************************************************
// * 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 Class header file
//
//
// File name: G4EmProcessOptions
//
// Author: Vladimir Ivanchenko
//
// Creation date: 27.02.2004
//
// Modifications:
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 22-05-06 Add SetBremsstrahlungTh (V.Ivanchenko)
// 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko)
//
//
// Class Description:
//
// Provide options for EM processes
// -------------------------------------------------------------------
//
#ifndef G4EmProcessOptions_h
#define G4EmProcessOptions_h 1
#include <vector>
#include "globals.hh"
#include "G4MscStepLimitType.hh"
class G4EmParameters;
class G4LossTableManager;
class G4EmProcessOptions
{
public:
G4EmProcessOptions();
~G4EmProcessOptions();
void SetLossFluctuations(G4bool val);
void SetBuildCSDARange(G4bool val);
void SetLPMFlag(G4bool val);
void SetSplineFlag(G4bool val);
void SetUseCutAsFinalRange(G4bool val);
void SetApplyCuts(G4bool val);
void SetFluo(G4bool val);
void SetAuger(G4bool val);
void SetPIXE(G4bool val);
void SetDeexcitationIgnoreCuts(G4bool val);
void SetMscLateralDisplacement(G4bool val);
void SetMscMuHadLateralDisplacement(G4bool val);
void SetDisplacementBeyondSafety(G4bool val);
void SetMinSubRange(G4double val);
void SetMinEnergy(G4double val);
void SetMaxEnergy(G4double val);
void SetMaxEnergyForMuons(G4double val);
void SetMaxEnergyForCSDARange(G4double val);
void SetLinearLossLimit(G4double val);
void SetBremsstrahlungTh(G4double val);
void SetLambdaFactor(G4double val);
void SetFactorForAngleLimit(G4double val);
void SetPolarAngleLimit(G4double val);
void SetMscRangeFactor(G4double val);
void SetMscGeomFactor(G4double val);
void SetSkin(G4double val);
void SetDEDXBinning(G4int val);
void SetDEDXBinningForCSDARange(G4int val);
void SetLambdaBinning(G4int val);
void SetVerbose(G4int val);
void SetWorkerVerbose(G4int val);
void SetMscStepLimitation(G4MscStepLimitType val);
void SetSubCutoff(G4bool val, const G4String& r = "");
void SetIntegral(G4bool val);
void SetStepFunction(G4double v1, G4double v2);
void SetDeexcitationActiveRegion(const G4String& rname = "",
G4bool valDeexcitation = true,
G4bool valAuger = true,
G4bool valPIXE = true);
void SetPIXECrossSectionModel(const G4String& val);
void SetPIXEElectronCrossSectionModel(const G4String& val);
void SetProcessBiasingFactor(const G4String& name, G4double val,
G4bool flag = true);
void ActivateForcedInteraction(const G4String& name, G4double length=0.0,
const G4String& region="",
G4bool flag = true);
void ActivateSecondaryBiasing(const G4String& name, const G4String& region,
G4double factor, G4double energyLimit);
void ActivateSecondaryBiasingForGamma(const G4String& name,
const G4String& region,
G4double factor, G4double energyLimit);
private:
G4EmProcessOptions & operator=(const G4EmProcessOptions &right) = delete;
G4EmProcessOptions(const G4EmProcessOptions&) = delete;
G4EmParameters* theParameters;
};
//....oooOO0OOooo.......oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,7 +24,6 @@
// ********************************************************************
//
//
//
#ifndef G4EmSaturation_h
#define G4EmSaturation_h 1
@@ -99,12 +98,12 @@ public:
inline void SetVerbose(G4int);
private:
// hide assignment operator
G4EmSaturation & operator=(const G4EmSaturation &right) = delete;
G4EmSaturation(const G4EmSaturation&) = delete;
private:
void InitialiseBirksCoefficient(const G4Material*);
void InitialiseG4materials();
@@ -117,7 +116,7 @@ private:
G4int nG4Birks;
G4int nWarnings;
static G4int nMaterials;
static size_t nMaterials;
// list of materials used in run time
static std::vector<G4double> massFactors;
@@ -24,7 +24,6 @@
// ********************************************************************
//
//
//
//---------------------------------------------------------------
//
// G4EmTableType.hh
@@ -36,7 +35,8 @@
//
// Creation date: 19.01.2006
// Modifications:
// 15.01.07 Add two types (V.Ivanchenko)
// 15.01.07 Added two types (V.Ivanchenko)
// 06.04.21 Removed two types (V.Ivanchenko)
//
//---------------------------------------------------------------
@@ -47,11 +47,26 @@ enum G4EmTableType
{
fTotal = 0,
fRestricted,
fSubRestricted,
fIsIonisation,
fIsSubIonisation,
fIsCrossSectionPrim
};
enum G4CrossSectionType
{
fEmNoIntegral = 0,
fEmIncreasing,
fEmDecreasing,
fEmOnePeak,
fEmTwoPeaks
};
struct G4TwoPeaksXS {
G4double e1peak;
G4double e1deep;
G4double e2peak;
G4double e2deep;
};
#endif
@@ -64,7 +64,7 @@ public:
G4LossTableBuilder(G4bool master=true);
virtual ~G4LossTableBuilder();
~G4LossTableBuilder();
// build sum of all energy loss processes
void BuildDEDXTable(G4PhysicsTable* dedxTable,
@@ -100,16 +100,16 @@ public:
inline void SetSplineFlag(G4bool flag);
inline void SetInitialisationFlag(G4bool flag);
G4LossTableBuilder & operator=(const G4LossTableBuilder &right) = delete;
G4LossTableBuilder(const G4LossTableBuilder&) = delete;
private:
G4LossTableBuilder & operator=(const G4LossTableBuilder &right);
G4LossTableBuilder(const G4LossTableBuilder&);
G4EmParameters* theParameters;
G4bool splineFlag;
G4bool isInitialized;
G4bool splineFlag = true;
G4bool isInitialized = false;
G4bool isMaster;
static std::vector<G4double>* theDensityFactor;
@@ -57,6 +57,7 @@
#include "globals.hh"
#include "G4ThreadLocalSingleton.hh"
#include "G4VEnergyLossProcess.hh"
#include "G4EmParameters.hh"
class G4PhysicsTable;
class G4MaterialCutsCouple;
@@ -117,11 +118,6 @@ public:
G4double kineticEnergy,
const G4MaterialCutsCouple *couple);
inline G4double GetSubDEDX(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple);
inline G4double GetRange(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
@@ -231,6 +227,9 @@ public:
inline G4VEmProcess* GetPositronGeneralProcess();
G4LossTableManager(G4LossTableManager &) = delete;
G4LossTableManager & operator=(const G4LossTableManager &right) = delete;
private:
//-------------------------------------------------
@@ -252,9 +251,6 @@ private:
void PrintEWarning(G4String, G4double);
G4LossTableManager(G4LossTableManager &) = delete;
G4LossTableManager & operator=(const G4LossTableManager &right) = delete;
static G4ThreadLocal G4LossTableManager* instance;
typedef const G4ParticleDefinition* PD;
@@ -282,26 +278,26 @@ private:
PD theGenericIon;
PD firstParticle;
G4LossTableBuilder* tableBuilder;
G4EmCorrections* emCorrections;
G4EmConfigurator* emConfigurator;
G4ElectronIonPair* emElectronIonPair;
G4NIELCalculator* nielCalculator;
G4VAtomDeexcitation* atomDeexcitation;
G4VSubCutProducer* subcutProducer;
G4EmParameters* theParameters;
G4VEmProcess* gGeneral;
G4VEmProcess* eGeneral;
G4VEmProcess* pGeneral;
G4int verbose;
G4int n_loss;
G4int run;
G4bool all_tables_are_built;
G4bool startInitialisation;
G4bool isMaster;
G4LossTableBuilder* tableBuilder;
G4EmCorrections* emCorrections;
G4EmConfigurator* emConfigurator;
G4ElectronIonPair* emElectronIonPair;
G4NIELCalculator* nielCalculator;
G4VAtomDeexcitation* atomDeexcitation;
G4VSubCutProducer* subcutProducer;
G4EmParameters* theParameters;
G4VEmProcess* gGeneral;
G4VEmProcess* eGeneral;
G4VEmProcess* pGeneral;
G4int verbose;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -318,17 +314,6 @@ G4double G4LossTableManager::GetDEDX(const G4ParticleDefinition *aParticle,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
inline
G4double G4LossTableManager::GetSubDEDX(const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple)
{
if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
return currentLoss ? currentLoss->GetDEDXForSubsec(kineticEnergy, couple) : 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
inline
G4double G4LossTableManager::GetCSDARange(const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
@@ -347,7 +332,7 @@ G4double G4LossTableManager::GetRangeFromRestricteDEDX(
const G4MaterialCutsCouple *couple)
{
if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
return currentLoss ? currentLoss->GetRangeForLoss(kineticEnergy, couple) : DBL_MAX;
return currentLoss ? currentLoss->GetRange(kineticEnergy, couple) : DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -464,4 +449,3 @@ inline G4VEmProcess* G4LossTableManager::GetPositronGeneralProcess()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -77,12 +77,12 @@ public:
// replace model of NIEL
void AddEmModel(G4VEmModel*);
private:
// hide assignment operator
G4NIELCalculator & operator=(const G4NIELCalculator &right) = delete;
G4NIELCalculator(const G4NIELCalculator&) = delete;
private:
G4VEmModel* fModel;
G4int fVerbose;
};
@@ -91,8 +91,6 @@ G4String G4OpticalProcessName(G4int processNumber)
}
}
class G4OpticalParameters
{
public:
@@ -114,15 +112,6 @@ public:
void SetProcessActivation(const G4String&, G4bool);
G4bool GetProcessActivation(const G4String&) const;
// DEPRECATED, use Set/GetProcessActivation instead
void Configure(G4OpticalProcessIndex, G4bool);
G4bool GetConfiguration(G4OpticalProcessIndex);
// DEPRECATED, use Set/GetCerenkovTrackSecondariesFirst and
// Set/GetScintTrackSecondariesFirst instead
void SetTrackSecondariesFirst(G4OpticalProcessIndex, G4bool);
G4bool GetTrackSecondariesFirst(G4OpticalProcessIndex);
// Cerenkov
void SetCerenkovMaxPhotonsPerStep(G4int);
G4int GetCerenkovMaxPhotonsPerStep() const;
@@ -209,15 +198,10 @@ private:
G4double cerenkovMaxBetaChange;
// scintillation /////////////////
G4double scintYieldFactor;
/// Note: this is to be removed in the next major release.
/// Use material properties SCINTILLATIONYIELD1, 2, 3 instead
G4double scintExcitationRatio;
/// option to set a finite rise-time; Note: the G4Scintillation
/// process expects the user to have set the constant material
/// property FAST/SLOWSCINTILLATIONRISETIME
/// property SCINTILLATIONRISETIME{1,2,3}
G4bool scintFiniteRiseTime;
/// option to allow for the light yield to be a function of
@@ -232,10 +216,6 @@ private:
/// option to allow stacking of secondary Scintillation photons
G4bool scintStackPhotons;
/// new in version 10.7; allow > 2 time constants, and > 1 time
/// constant for scintillation by particle type
G4bool scintEnhancedTimeConstants;
G4int scintVerboseLevel;
G4bool scintTrackSecondariesFirst;
@@ -43,7 +43,6 @@
#define G4OpticalParametersMessenger_h 1
#include "G4UImessenger.hh"
//#include "G4OpticalProcessIndex.hh"
#include "globals.hh"
@@ -75,19 +74,21 @@ private:
G4OpticalParametersMessenger(const G4OpticalParametersMessenger& right) = delete;
G4OpticalParametersMessenger& operator=(const G4OpticalParametersMessenger& right) = delete;
void Deprecated(void);
// data members
/// associated class
G4OpticalParameters* params;
/// command directory
G4UIdirectory* fDir;
G4UIdirectory* fDir2;
/// selected optical process
//G4OpticalProcessIndex fSelectedProcessIndex;
G4UIdirectory* fDir;
G4UIdirectory* fCerenkovDir;
G4UIdirectory* fScintDir;
G4UIdirectory* fWlsDir;
G4UIdirectory* fWls2Dir;
G4UIdirectory* fBoundaryDir;
G4UIdirectory* fMieDir;
G4UIdirectory* fAbsDir;
G4UIdirectory* fRaylDir;
/// selectOpProcess command
G4UIcommand* fActivateProcessCmd;
@@ -95,54 +96,35 @@ private:
/// setProcessVerbose command
G4UIcmdWithAnInteger* fVerboseCmd;
/// setTrackSecondariesFirst command
G4UIcommand* fTrackSecondariesFirstCmd;
// Cerenkov
// setCerenkovMaxPhotons command
G4UIcmdWithAnInteger* fCerenkovMaxPhotonsCmd;
G4UIcmdWithAnInteger* fCerenkovMaxPhotons1Cmd;
/// setCerenkovMaxBetaChange command
G4UIcmdWithADouble* fCerenkovMaxBetaChangeCmd;
G4UIcmdWithADouble* fCerenkovMaxBetaChange1Cmd;
/// setStackPhotons command
G4UIcmdWithABool* fCerenkovStackPhotonsCmd;
G4UIcmdWithABool* fCerenkovStackPhotons1Cmd;
G4UIcmdWithABool* fCerenkovTrackSecondariesFirstCmd;
G4UIcmdWithAnInteger* fCerenkovVerboseLevelCmd;
// Scintillation
// setScintillationYieldFactor command
G4UIcmdWithADouble* fScintYieldFactorCmd;
G4UIcmdWithADouble* fScintYieldFactor1Cmd;
/// setScintillationByParticleType command
G4UIcmdWithABool* fScintByParticleTypeCmd;
G4UIcmdWithABool* fScintByParticleType1Cmd;
/// setScintillationTrackInfo command
G4UIcmdWithABool* fScintTrackInfoCmd;
G4UIcmdWithABool* fScintTrackInfo1Cmd;
/// setStackPhotons command
G4UIcmdWithABool* fScintStackPhotonsCmd;
G4UIcmdWithABool* fScintStackPhotons1Cmd;
G4UIcmdWithADouble* fScintExcitationRatioCmd;
G4UIcmdWithABool* fScintTrackSecondariesFirstCmd;
/// setFiniteRiseTime command
G4UIcmdWithABool* fScintFiniteRiseTimeCmd;
G4UIcmdWithABool* fScintFiniteRiseTime1Cmd;
// setEnhancedTimeConstants commnad
G4UIcmdWithABool* fScintEnhancedTimeConstantsCmd;
G4UIcmdWithAnInteger* fScintVerboseLevelCmd;
@@ -150,7 +132,6 @@ private:
/// setWLSTimeProfile command
G4UIcmdWithAString* fWLSTimeProfileCmd;
G4UIcmdWithAString* fWLSTimeProfile1Cmd;
G4UIcmdWithAnInteger* fWLSVerboseLevelCmd;
// WLS2
@@ -161,7 +142,6 @@ private:
/// setInvokeSD command
G4UIcmdWithABool* fBoundaryInvokeSDCmd;
G4UIcmdWithABool* fBoundaryInvokeSD1Cmd;
G4UIcmdWithAnInteger* fBoundaryVerboseLevelCmd;
G4UIcmdWithAnInteger* fAbsorptionVerboseLevelCmd;
@@ -163,33 +163,32 @@ public:
private:
G4EmParameters* theParameters;
const G4ParticleDefinition* gamma;
const G4ProductionCutsTable* theCoupleTable = nullptr;
G4ProductionCutsTable* theCoupleTable;
G4int verbose;
G4String name;
G4int nCouples = 0;
G4int verbose = 1;
G4bool isActive;
G4bool flagAuger;
G4bool flagAugerCascade;
G4bool flagPIXE;
G4bool ignoreCuts;
G4bool isActive = false;
G4bool flagAuger = false;
G4bool flagPIXE = false;
G4bool ignoreCuts = false;
G4bool isActiveLocked;
G4bool isAugerLocked;
G4bool isAugerCascadeLocked;
G4bool isPIXELocked;
G4bool isActiveLocked = false;
G4bool isAugerLocked = false;
G4bool isPIXELocked = false;
std::vector<G4bool> activeZ;
std::vector<G4bool> activeDeexcitationMedia;
std::vector<G4bool> activeAugerMedia;
std::vector<G4bool> activePIXEMedia;
std::vector<G4String> activeRegions;
std::vector<G4bool> deRegions;
std::vector<G4bool> AugerRegions;
std::vector<G4bool> PIXERegions;
std::vector<G4DynamicParticle*> vdyn;
std::vector<G4String> activeRegions;
G4String name;
static G4int pixeIDg;
static G4int pixeIDe;
@@ -221,12 +220,12 @@ inline G4bool G4VAtomDeexcitation::IsAugerActive() const
inline void G4VAtomDeexcitation::SetAugerCascade(G4bool val)
{
if(!isAugerCascadeLocked) { flagAugerCascade = val; isAugerCascadeLocked = true; }
SetAuger(val);
}
inline G4bool G4VAtomDeexcitation::IsAugerCascadeActive() const
{
return flagAugerCascade;
return flagAuger;
}
inline void G4VAtomDeexcitation::SetPIXE(G4bool val)
@@ -261,15 +260,15 @@ inline G4int G4VAtomDeexcitation::GetVerboseLevel() const
}
inline G4bool
G4VAtomDeexcitation::CheckDeexcitationActiveRegion(G4int coupleIndex)
G4VAtomDeexcitation::CheckDeexcitationActiveRegion(G4int idx)
{
return (activeDeexcitationMedia[coupleIndex]);
return (idx < nCouples) ? activeDeexcitationMedia[idx] : false;
}
inline G4bool
G4VAtomDeexcitation::CheckAugerActiveRegion(G4int coupleIndex)
G4VAtomDeexcitation::CheckAugerActiveRegion(G4int idx)
{
return (activeAugerMedia[coupleIndex]);
return (idx < nCouples) ? activeAugerMedia[idx] : false;
}
#endif
@@ -89,6 +89,8 @@ public:
G4int Z = 0,
const G4Material* mat = nullptr);
virtual void PrintGeneratorInformation() const;
inline const G4String& GetName() const;
// hide assignment operator
@@ -193,9 +193,8 @@ public:
// add correction to energy loss and compute non-ionizing energy loss
virtual void CorrectionsAlongStep(const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double& eloss,
G4double& niel,
G4double length);
const G4double& length,
G4double& eloss);
// value which may be tabulated (by default cross section)
virtual G4double Value(const G4MaterialCutsCouple*,
@@ -251,7 +250,7 @@ public:
inline void SetElementSelectors(std::vector<G4EmElementSelector*>*);
// dEdx per unit length, base material approach may be used
virtual inline G4double ComputeDEDX(const G4MaterialCutsCouple*,
inline G4double ComputeDEDX( const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = DBL_MAX);
@@ -407,55 +406,58 @@ private:
// ======== Parameters of the class fixed at construction =========
G4VEmFluctuationModel* flucModel;
G4VEmAngularDistribution* anglModel;
const G4String name;
// ======== Parameters of the class fixed at initialisation =======
G4double lowLimit;
G4double highLimit;
G4double eMinActive;
G4double eMaxActive;
G4double polarAngleLimit;
G4double secondaryThreshold;
G4bool theLPMflag;
G4bool flagDeexcitation;
G4bool flagForceBuildTable;
G4bool isMaster;
G4bool localTable;
G4bool localElmSelectors;
G4bool useAngularGenerator;
G4bool useBaseMaterials;
G4bool isLocked;
G4int nSelectors;
std::vector<G4EmElementSelector*>* elmSelectors;
G4LossTableManager* fEmManager;
G4VEmFluctuationModel* flucModel = nullptr;
G4VEmAngularDistribution* anglModel = nullptr;
G4VEmModel* fTripletModel = nullptr;
const G4MaterialCutsCouple* fCurrentCouple = nullptr;
const G4Element* fCurrentElement = nullptr;
const G4Isotope* fCurrentIsotope = nullptr;
std::vector<G4EmElementSelector*>* elmSelectors = nullptr;
G4LossTableManager* fEmManager;
protected:
G4ElementData* fElementData;
G4VParticleChange* pParticleChange;
G4PhysicsTable* xSectionTable;
const G4Material* pBaseMaterial;
const std::vector<G4double>* theDensityFactor;
const std::vector<G4int>* theDensityIdx;
size_t idxTable;
G4bool lossFlucFlag;
G4double inveplus;
G4double pFactor;
G4ElementData* fElementData = nullptr;
G4VParticleChange* pParticleChange = nullptr;
G4PhysicsTable* xSectionTable = nullptr;
const G4Material* pBaseMaterial = nullptr;
const std::vector<G4double>* theDensityFactor = nullptr;
const std::vector<G4int>* theDensityIdx = nullptr;
// ======== Cached values - may be state dependent ================
G4double inveplus;
G4double pFactor = 1.0;
private:
const G4MaterialCutsCouple* fCurrentCouple;
const G4Element* fCurrentElement;
const G4Isotope* fCurrentIsotope;
G4VEmModel* fTripletModel;
G4double lowLimit;
G4double highLimit;
G4double eMinActive = 0.0;
G4double eMaxActive = DBL_MAX;
G4double secondaryThreshold = DBL_MAX;
G4double polarAngleLimit;
G4int nsec;
G4int nSelectors = 0;
G4int nsec = 5;
protected:
size_t idxTable = 0;
G4bool lossFlucFlag = true;
private:
G4bool theLPMflag = false;
G4bool flagDeexcitation = false;
G4bool flagForceBuildTable = false;
G4bool isMaster = true;
G4bool localTable = true;
G4bool localElmSelectors = true;
G4bool useAngularGenerator = false;
G4bool useBaseMaterials = true;
G4bool isLocked = false;
const G4String name;
std::vector<G4double> xsec;
};
@@ -468,7 +470,7 @@ inline void G4VEmModel::SetCurrentCouple(const G4MaterialCutsCouple* ptr)
fCurrentCouple = ptr;
pBaseMaterial = ptr->GetMaterial();
pFactor = 1.0;
if(useBaseMaterials && pBaseMaterial->GetBaseMaterial()) {
if(useBaseMaterials && nullptr != pBaseMaterial->GetBaseMaterial()) {
pBaseMaterial = pBaseMaterial->GetBaseMaterial();
pFactor = (*theDensityFactor)[(*theDensityIdx)[ptr->GetIndex()]];
}
@@ -843,7 +845,7 @@ G4VEmModel::SetElementSelectors(std::vector<G4EmElementSelector*>* p)
{
if(p != elmSelectors) {
elmSelectors = p;
nSelectors = (elmSelectors) ? G4int(elmSelectors->size()) : 0;
nSelectors = (nullptr != elmSelectors) ? G4int(elmSelectors->size()) : 0;
localElmSelectors = false;
}
}
@@ -59,6 +59,7 @@
#include "G4ParticleChangeForGamma.hh"
#include "G4EmDataHandler.hh"
#include "G4EmParameters.hh"
#include "G4EmTableType.hh"
class G4Step;
class G4VEmModel;
@@ -77,7 +78,7 @@ public:
G4VEmProcess(const G4String& name, G4ProcessType type = fElectromagnetic);
virtual ~G4VEmProcess();
~G4VEmProcess() override;
//------------------------------------------------------------------------
// Virtual methods to be implemented in concrete processes
@@ -85,10 +86,7 @@ public:
virtual G4bool IsApplicable(const G4ParticleDefinition& p) override = 0;
// obsolete
virtual void PrintInfo() {};
virtual void ProcessDescription(std::ostream& outFile) const override;
void ProcessDescription(std::ostream& outFile) const override;
protected:
@@ -110,38 +108,37 @@ protected:
public:
// Initialise for build of tables
virtual void PreparePhysicsTable(const G4ParticleDefinition&) override;
void PreparePhysicsTable(const G4ParticleDefinition&) override;
// Build physics table during initialisation
virtual void BuildPhysicsTable(const G4ParticleDefinition&) override;
void BuildPhysicsTable(const G4ParticleDefinition&) override;
// Called before tracking of each new G4Track
virtual void StartTracking(G4Track*) override;
void StartTracking(G4Track*) override;
// implementation of virtual method, specific for G4VEmProcess
virtual G4double PostStepGetPhysicalInteractionLength(
G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition) override;
// implementation of virtual method, specific for G4VEmProcess
virtual G4VParticleChange* PostStepDoIt(const G4Track&,
const G4Step&) override;
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&) override;
// Store PhysicsTable in a file.
// Return false in case of failure at I/O
virtual G4bool StorePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii = false) override;
G4bool StorePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii = false) override;
// Retrieve Physics from a file.
// (return true if the Physics Table can be build by using file)
// (return false if the process has no functionality or in case of failure)
// File name should is constructed as processName+particleName and the
// should be placed under the directory specified by the argument.
virtual G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii) override;
G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii) override;
// allowing check process name
virtual G4VEmProcess* GetEmProcess(const G4String& name);
@@ -189,7 +186,7 @@ public:
// Cross section table pointers
inline G4PhysicsTable* LambdaTable() const;
inline G4PhysicsTable* LambdaTablePrim() const;
inline std::vector<G4double>* EnergyOfCrossSectionMax() const;
//------------------------------------------------------------------------
// Define and access particle type
//------------------------------------------------------------------------
@@ -202,13 +199,15 @@ public:
//------------------------------------------------------------------------
protected:
// Select model in run time
inline G4VEmModel* SelectModel(G4double kinEnergy, size_t index);
inline G4VEmModel* SelectModel(G4double kinEnergy, size_t);
public:
// Select model by energy and region index
// Select model by energy and couple index
inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
size_t idxRegion) const;
size_t idxCouple) const;
// Add model for region, smaller value of order defines which
// model will be selected for a given energy interval
@@ -217,18 +216,14 @@ public:
// 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
void SetEmModel(G4VEmModel*, G4int index = 0);
inline G4int NumberOfModels() const;
// return a model from the local list
G4VEmModel* EmModel(size_t index = 0) const;
// Define new energy range for the model identified by the name
void UpdateEmModel(const G4String&, G4double, G4double);
inline G4VEmModel* EmModel(size_t index = 0) const;
// Access to models
G4int GetNumberOfModels() const;
G4int GetNumberOfRegionModels(size_t couple_index) const;
G4VEmModel* GetRegionModel(G4int idx, size_t couple_index) const;
G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false) const;
inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false) const;
// Access to active model
inline const G4VEmModel* GetCurrentModel() const;
@@ -246,25 +241,29 @@ public:
G4bool flag = true);
void ActivateSecondaryBiasing(const G4String& region, G4double factor,
G4double energyLimit);
G4double energyLimit);
inline void SetEmMasterProcess(const G4VEmProcess*);
inline void SetIntegral(G4bool val);
inline void SetCrossSectionType(G4CrossSectionType val);
inline void SetBuildTableFlag(G4bool val);
inline void CurrentSetup(const G4MaterialCutsCouple*, G4double energy);
// hide copy constructor and assignment operator
G4VEmProcess(G4VEmProcess &) = delete;
G4VEmProcess & operator=(const G4VEmProcess &right) = delete;
//------------------------------------------------------------------------
// Other generic methods
//------------------------------------------------------------------------
protected:
virtual G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition) override;
G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition) override;
G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*);
@@ -279,7 +278,7 @@ protected:
// Single scattering parameters
inline G4double PolarAngleLimit() const;
inline G4bool IsIntegral() const;
inline G4CrossSectionType CrossSectionType() const;
inline G4double RecalculateLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple);
@@ -323,114 +322,123 @@ private:
void ComputeIntegralLambda(G4double kinEnergy, G4double logKinEnergy);
// inline G4double GetLambdaFromTable(G4double kinEnergy);
inline G4double GetLambdaFromTable(G4double kinEnergy);
inline G4double GetLambdaFromTable(G4double kinEnergy, G4double logKinEnergy);
// inline G4double GetLambdaFromTablePrim(G4double kinEnergy);
inline G4double GetLambdaFromTablePrim(G4double kinEnergy,
G4double logKinEnergy);
inline G4double GetLambdaFromTablePrim(G4double kinEnergy);
inline G4double GetLambdaFromTablePrim(G4double kinEnergy, G4double logKinEnergy);
inline G4double GetCurrentLambda(G4double kinEnergy);
// inline G4double GetCurrentLambda(G4double kinEnergy);
inline G4double GetCurrentLambda(G4double kinEnergy, G4double logKinEnergy);
inline G4double ComputeCurrentLambda(G4double kinEnergy);
// hide copy constructor and assignment operator
G4VEmProcess(G4VEmProcess &) = delete;
G4VEmProcess & operator=(const G4VEmProcess &right) = delete;
// ======== pointers =========
// ======== Parameters of the class fixed at construction =========
G4EmModelManager* modelManager = nullptr;
const G4ParticleDefinition* particle = nullptr;
const G4ParticleDefinition* currentParticle = nullptr;
const G4ParticleDefinition* theGamma = nullptr;
const G4ParticleDefinition* theElectron = nullptr;
const G4ParticleDefinition* thePositron = nullptr;
const G4ParticleDefinition* secondaryParticle = nullptr;
const G4VEmProcess* masterProc = nullptr;
G4EmDataHandler* theData = nullptr;
G4VEmModel* currentModel = nullptr;
G4LossTableManager* lManager = nullptr;
G4EmParameters* theParameters = nullptr;
const G4Material* baseMaterial = nullptr;
G4EmModelManager* modelManager;
const G4ParticleDefinition* thePositron;
const G4ParticleDefinition* secondaryParticle;
// ======== tables and vectors ========
G4PhysicsTable* theLambdaTable = nullptr;
G4PhysicsTable* theLambdaTablePrim = nullptr;
G4bool buildLambdaTable;
// ======== Parameters of the class fixed at initialisation =======
std::vector<G4VEmModel*> emModels;
G4int numberOfModels;
// tables and vectors
G4PhysicsTable* theLambdaTable;
G4PhysicsTable* theLambdaTablePrim;
std::vector<G4double> theEnergyOfCrossSectionMax;
std::vector<G4double> theCrossSectionMax;
const std::vector<G4double>* theCuts;
const std::vector<G4double>* theCutsGamma;
const std::vector<G4double>* theCutsElectron;
const std::vector<G4double>* theCutsPositron;
G4int nLambdaBins;
G4double minKinEnergy;
G4double minKinEnergyPrim;
G4double maxKinEnergy;
G4double lambdaFactor;
G4double logLambdaFactor;
G4double biasFactor;
G4double massRatio;
G4bool integral;
G4bool applyCuts;
G4bool startFromNull;
G4bool splineFlag;
G4bool actMinKinEnergy;
G4bool actMaxKinEnergy;
G4bool actBinning;
G4bool actSpline;
G4bool isIon;
// ======== Cashed values - may be state dependent ================
const std::vector<G4double>* theCuts = nullptr;
const std::vector<G4double>* theCutsGamma = nullptr;
const std::vector<G4double>* theCutsElectron = nullptr;
const std::vector<G4double>* theCutsPositron = nullptr;
protected:
G4LossTableManager* lManager;
G4EmParameters* theParameters;
// ======== pointers =========
G4EmBiasingManager* biasManager;
const G4ParticleDefinition* theGamma;
const G4ParticleDefinition* theElectron;
G4ParticleChangeForGamma fParticleChange;
std::vector<G4DynamicParticle*> secParticles;
const G4MaterialCutsCouple* currentCouple;
const G4Material* currentMaterial;
const std::vector<G4double>* theDensityFactor;
const std::vector<G4int>* theDensityIdx;
size_t currentCoupleIndex;
size_t basedCoupleIndex;
G4int mainSecondaries;
G4int secID;
G4int fluoID;
G4int augerID;
G4int biasID;
G4bool isTheMaster;
G4double mfpKinEnergy;
G4double preStepKinEnergy;
G4double preStepLogKinEnergy;
G4double preStepLambda;
const G4MaterialCutsCouple* currentCouple = nullptr;
const G4Material* currentMaterial = nullptr;
G4EmBiasingManager* biasManager = nullptr;
std::vector<G4double>* theEnergyOfCrossSectionMax = nullptr;
const std::vector<G4double>* theDensityFactor = nullptr;
const std::vector<G4int>* theDensityIdx = nullptr;
private:
const G4VEmProcess* masterProc;
G4EmDataHandler* theData;
G4VEmModel* currentModel;
// ======== parameters =========
G4double minKinEnergy;
G4double maxKinEnergy;
G4double minKinEnergyPrim = DBL_MAX;
G4double lambdaFactor = 0.8;
G4double logLambdaFactor;
G4double biasFactor = 1.0;
G4double massRatio = 1.0;
G4double fFactor = 1.0;
G4double fLambda = 0.0;
G4double fLambdaEnergy = 0.0;
const G4ParticleDefinition* particle;
protected:
// cache
const G4ParticleDefinition* currentParticle;
const G4Material* baseMaterial;
G4double mfpKinEnergy = DBL_MAX;
G4double preStepKinEnergy = 0.0;
G4double preStepLogKinEnergy = LOG_EKIN_MIN;
G4double preStepLambda = 0.0;
private:
G4CrossSectionType fXSType = fEmNoIntegral;
G4int numberOfModels = 0;
G4int nLambdaBins = 84;
protected:
G4int mainSecondaries = 100;
G4int secID = -1;
G4int fluoID = -1;
G4int augerID = -1;
G4int biasID = -1;
size_t currentCoupleIndex = 0;
size_t basedCoupleIndex = 0;
size_t coupleIdxLambda = 0;
size_t idxLambda = 0;
G4bool isTheMaster = true;
private:
G4bool buildLambdaTable = true;
G4bool applyCuts = false;
G4bool startFromNull = false;
G4bool splineFlag = true;
G4bool actMinKinEnergy = false;
G4bool actMaxKinEnergy = false;
G4bool actBinning = false;
G4bool isIon = false;
G4bool biasFlag = false;
G4bool weightFlag = false;
protected:
// ======== particle change =========
std::vector<G4DynamicParticle*> secParticles;
G4ParticleChangeForGamma fParticleChange;
private:
// ======== local vectors =========
std::vector<G4VEmModel*> emModels;
G4double fFactor;
G4bool biasFlag;
G4bool weightFlag;
};
// ======== Run time inline methods ================
@@ -487,10 +495,10 @@ inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
G4VEmModel* G4VEmProcess::SelectModel(G4double kinEnergy, size_t index)
G4VEmModel* G4VEmProcess::SelectModel(G4double kinEnergy, size_t)
{
if(1 < numberOfModels) {
currentModel = modelManager->SelectModel(kinEnergy, index);
currentModel = modelManager->SelectModel(kinEnergy, currentCoupleIndex);
}
currentModel->SetCurrentCouple(currentCouple);
return currentModel;
@@ -500,9 +508,16 @@ G4VEmModel* G4VEmProcess::SelectModel(G4double kinEnergy, size_t index)
inline
G4VEmModel* G4VEmProcess::SelectModelForMaterial(G4double kinEnergy,
size_t idxRegion) const
size_t idxCouple) const
{
return modelManager->SelectModel(kinEnergy, idxRegion);
return modelManager->SelectModel(kinEnergy, idxCouple);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambdaFromTable(G4double e)
{
return ((*theLambdaTable)[basedCoupleIndex])->Value(e, idxLambda);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -514,6 +529,13 @@ inline G4double G4VEmProcess::GetLambdaFromTable(G4double e, G4double loge)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambdaFromTablePrim(G4double e)
{
return ((*theLambdaTablePrim)[basedCoupleIndex])->Value(e, idxLambda)/e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambdaFromTablePrim(G4double e, G4double loge)
{
return ((*theLambdaTablePrim)[basedCoupleIndex])->LogVectorValue(e, loge)/e;
@@ -528,13 +550,32 @@ inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetCurrentLambda(G4double e)
{
if(currentCoupleIndex != coupleIdxLambda || fLambdaEnergy != e) {
coupleIdxLambda = currentCoupleIndex;
fLambdaEnergy = e;
if(e >= minKinEnergyPrim) { fLambda = GetLambdaFromTablePrim(e); }
else if(nullptr != theLambdaTable) { fLambda = GetLambdaFromTable(e); }
else if(nullptr != currentModel) { fLambda = ComputeCurrentLambda(e); }
fLambda *= fFactor;
}
return fLambda;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetCurrentLambda(G4double e, G4double loge)
{
G4double x(0.0);
if(e >= minKinEnergyPrim) { x = GetLambdaFromTablePrim(e, loge); }
else if(theLambdaTable) { x = GetLambdaFromTable(e, loge); }
else if(currentModel) { x = ComputeCurrentLambda(e); }
return fFactor*x;
if(currentCoupleIndex != coupleIdxLambda || fLambdaEnergy != e) {
coupleIdxLambda = currentCoupleIndex;
fLambdaEnergy = e;
if(e >= minKinEnergyPrim) { fLambda = GetLambdaFromTablePrim(e, loge); }
else if(nullptr != theLambdaTable) { fLambda = GetLambdaFromTable(e, loge); }
else if(nullptr != currentModel) { fLambda = ComputeCurrentLambda(e); }
fLambda *= fFactor;
}
return fLambda;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -546,6 +587,8 @@ G4VEmProcess::CurrentSetup(const G4MaterialCutsCouple* couple, G4double energy)
SelectModel(energy*massRatio, currentCoupleIndex);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEmProcess::GetLambda(G4double kinEnergy, const G4MaterialCutsCouple* couple,
G4double logKinEnergy)
@@ -616,6 +659,13 @@ inline G4PhysicsTable* G4VEmProcess::LambdaTablePrim() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline std::vector<G4double>* G4VEmProcess::EnergyOfCrossSectionMax() const
{
return theEnergyOfCrossSectionMax;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VEmProcess::Particle() const
{
return particle;
@@ -630,16 +680,16 @@ inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetIntegral(G4bool val)
inline void G4VEmProcess::SetCrossSectionType(G4CrossSectionType val)
{
integral = val;
fXSType = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4VEmProcess::IsIntegral() const
inline G4CrossSectionType G4VEmProcess::CrossSectionType() const
{
return integral;
return fXSType;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -683,7 +733,6 @@ inline void G4VEmProcess::SetStartFromNullFlag(G4bool val)
inline void G4VEmProcess::SetSplineFlag(G4bool val)
{
splineFlag = val;
actSpline = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -716,4 +765,25 @@ inline void G4VEmProcess::SetEmMasterProcess(const G4VEmProcess* ptr)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4int G4VEmProcess::NumberOfModels() const
{
return numberOfModels;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEmProcess::EmModel(size_t index) const
{
return (index < emModels.size()) ? emModels[index] : nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx, G4bool ver) const
{
return modelManager->GetModel(idx, ver);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -57,15 +57,14 @@
#include "G4MaterialCutsCouple.hh"
#include "G4Track.hh"
#include "G4EmModelManager.hh"
#include "G4UnitsTable.hh"
#include "G4ParticleChangeForLoss.hh"
#include "G4EmTableType.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsVector.hh"
#include "G4EmParameters.hh"
class G4Step;
class G4ParticleDefinition;
class G4EmParameters;
class G4VEmModel;
class G4VEmFluctuationModel;
class G4DataVector;
@@ -85,26 +84,15 @@ public:
G4VEnergyLossProcess(const G4String& name = "EnergyLoss",
G4ProcessType type = fElectromagnetic);
virtual ~G4VEnergyLossProcess();
private:
// clean vectors and arrays
void Clean();
~G4VEnergyLossProcess() override;
//------------------------------------------------------------------------
// Virtual methods to be implemented in concrete processes
//------------------------------------------------------------------------
public:
virtual G4bool IsApplicable(const G4ParticleDefinition& p) override = 0;
// obsolete to be removed
virtual void PrintInfo() {};
virtual void ProcessDescription(std::ostream& outFile) const override;
protected:
// description of specific process parameters
virtual void StreamProcessInfo(std::ostream&) const {};
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
@@ -124,11 +112,14 @@ protected:
public:
// print documentation in html format
void ProcessDescription(std::ostream& outFile) const override;
// prepare all tables
virtual void PreparePhysicsTable(const G4ParticleDefinition&) override;
void PreparePhysicsTable(const G4ParticleDefinition&) override;
// build all tables
virtual void BuildPhysicsTable(const G4ParticleDefinition&) override;
void BuildPhysicsTable(const G4ParticleDefinition&) override;
// build a table
G4PhysicsTable* BuildDEDXTable(G4EmTableType tType = fRestricted);
@@ -137,10 +128,10 @@ public:
G4PhysicsTable* BuildLambdaTable(G4EmTableType tType = fRestricted);
// Called before tracking of each new G4Track
virtual void StartTracking(G4Track*) override;
void StartTracking(G4Track*) override;
// Step limit from AlongStep
virtual G4double AlongStepGetPhysicalInteractionLength(
G4double AlongStepGetPhysicalInteractionLength(
const G4Track&,
G4double previousStepSize,
G4double currentMinimumStep,
@@ -148,36 +139,29 @@ public:
G4GPILSelection* selection) override;
// Step limit from cross section
virtual G4double PostStepGetPhysicalInteractionLength(
G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4double previousStepSize,
G4ForceCondition* condition) override;
// AlongStep computations
virtual G4VParticleChange* AlongStepDoIt(const G4Track&,
const G4Step&) override;
// Sampling of secondaries in vicinity of geometrical boundary
// Return sum of secodaries energy
G4double SampleSubCutSecondaries(std::vector<G4Track*>&, const G4Step&,
G4VEmModel* model, G4int matIdx);
G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&) override;
// PostStep sampling of secondaries
virtual G4VParticleChange* PostStepDoIt(const G4Track&,
const G4Step&) override;
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&) override;
// Store all PhysicsTable in files.
// Return false in case of any fatal failure at I/O
virtual G4bool StorePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii = false) override;
G4bool StorePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii = false) override;
// Retrieve all Physics from a files.
// Return true if all the Physics Table are built.
// Return false if any fatal failure.
virtual G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii) override;
G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii) override;
private:
@@ -212,7 +196,7 @@ public:
// Access to cross section table
G4double CrossSectionPerVolume(G4double kineticEnergy,
const G4MaterialCutsCouple* couple);
const G4MaterialCutsCouple* couple);
G4double CrossSectionPerVolume(G4double kineticEnergy,
const G4MaterialCutsCouple* couple,
G4double logKineticEnergy);
@@ -229,23 +213,18 @@ public:
protected:
// implementation of the pure virtual method
virtual G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition) override;
G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition) override;
// implementation of the pure virtual method
virtual G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety) override;
G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety) override;
//------------------------------------------------------------------------
// Run time method which may be also used by derived processes
//------------------------------------------------------------------------
// creeation of an empty vector for cross section
G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*,
G4double cut);
// creation of an empty vector for cross sections for derived processes
G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*, G4double cut);
inline size_t CurrentMaterialCutsCoupleIndex() const;
@@ -257,37 +236,36 @@ protected:
inline void SelectModel(G4double kinEnergy);
public:
// Select model by energy and region index
// Select model by energy and couple index
// Not for run time processing
inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
size_t& idx) const;
size_t& idxCouple) const;
// Add EM model coupled with fluctuation model for region, smaller value
// of order defines which pair of models will be selected for a given
// energy interval
void AddEmModel(G4int, G4VEmModel*,
G4VEmFluctuationModel* fluc = 0,
G4VEmFluctuationModel* fluc = nullptr,
const G4Region* region = nullptr);
// Define new energy range for the model identified by the name
void UpdateEmModel(const G4String&, G4double, G4double);
// 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
void SetEmModel(G4VEmModel*, G4int index=0);
// return a model from the local list
G4VEmModel* EmModel(size_t index=0) const;
// Access to models
G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false) const;
G4int NumberOfModels() const;
// Access to models
inline size_t NumberOfModels() const;
// Return a model from the local list
inline G4VEmModel* EmModel(size_t index=0) const;
// Access to models from G4EmModelManager list
inline G4VEmModel* GetModelByIndex(size_t idx = 0, G4bool ver = false) const;
// Assign a fluctuation model to a process
inline void SetFluctModel(G4VEmFluctuationModel*);
// return the assigned fluctuation model
inline G4VEmFluctuationModel* FluctModel();
// Return the assigned fluctuation model
inline G4VEmFluctuationModel* FluctModel() const;
//------------------------------------------------------------------------
// Define and access particle type
@@ -303,12 +281,16 @@ public:
inline const G4ParticleDefinition* BaseParticle() const;
inline const G4ParticleDefinition* SecondaryParticle() const;
// hide assignment operator
G4VEnergyLossProcess(G4VEnergyLossProcess &) = delete;
G4VEnergyLossProcess & operator=(const G4VEnergyLossProcess &right) = delete;
//------------------------------------------------------------------------
// Get/set parameters to configure the process at initialisation time
//------------------------------------------------------------------------
// Add subcutoff option for the region
void ActivateSubCutoff(G4bool val, const G4Region* region = nullptr);
// Add subcut processor for the region
void ActivateSubCutoff(const G4Region* region);
// Activate biasing
void SetCrossSectionBiasingFactor(G4double f, G4bool flag = true);
@@ -320,14 +302,11 @@ public:
void ActivateSecondaryBiasing(const G4String& region, G4double factor,
G4double energyLimit);
// Add subcutoff process (bremsstrahlung) to sample secondary
// particle production in vicinity of the geometry boundary
void AddCollaborativeProcess(G4VEnergyLossProcess*);
inline void SetLossFluctuations(G4bool val);
inline void SetIntegral(G4bool val);
inline G4bool IsIntegral() const;
inline void SetSpline(G4bool val);
inline void SetCrossSectionType(G4CrossSectionType val);
inline G4CrossSectionType CrossSectionType() const;
// Set/Get flag "isIonisation"
void SetIonisation(G4bool val);
@@ -349,9 +328,12 @@ public:
void SetRangeTableForLoss(G4PhysicsTable* p);
void SetSecondaryRangeTable(G4PhysicsTable* p);
void SetInverseRangeTable(G4PhysicsTable* p);
void SetLambdaTable(G4PhysicsTable* p);
void SetSubLambdaTable(G4PhysicsTable* p);
void SetTwoPeaksXS(std::vector<G4TwoPeaksXS*>* p);
//------------------------------------------------------------------------
// Specific methods to define custom Physics Tables to the process
//------------------------------------------------------------------------
// Binning for dEdx, range, inverse range and labda tables
void SetDEDXBinning(G4int nbins);
@@ -369,20 +351,15 @@ public:
// Return values for given G4MaterialCutsCouple
inline G4double GetDEDX(G4double kineticEnergy, const G4MaterialCutsCouple*);
inline G4double GetCSDADEDX(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetDEDX(G4double kineticEnergy, const G4MaterialCutsCouple*,
G4double logKineticEnergy);
inline G4double GetDEDXForSubsec(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetRange(G4double kineticEnergy, const G4MaterialCutsCouple*);
inline G4double GetRange(G4double kineticEnergy, const G4MaterialCutsCouple*,
G4double logKineticEnergy);
inline G4double GetCSDARange(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetRangeForLoss(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetRangeForLoss(G4double kineticEnergy,
const G4MaterialCutsCouple*,
G4double logKineticEnergy);
inline G4double GetKineticEnergy(G4double range,
const G4MaterialCutsCouple*);
inline G4double GetLambda(G4double kineticEnergy,const G4MaterialCutsCouple*);
@@ -393,16 +370,14 @@ public:
// 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* SecondaryRangeTable() const;
inline G4PhysicsTable* RangeTableForLoss() const;
inline G4PhysicsTable* InverseRangeTable() const;
inline G4PhysicsTable* LambdaTable() const;
inline G4PhysicsTable* SubLambdaTable() const;
inline std::vector<G4TwoPeaksXS*>* TwoPeaksXS() const;
//------------------------------------------------------------------------
// Run time method for simulation of ionisation
@@ -412,13 +387,13 @@ public:
const G4Element* GetCurrentElement() const;
// Set scaling parameters for ions is needed to G4EmCalculator
inline void SetDynamicMassCharge(G4double massratio, G4double charge2ratio);
void SetDynamicMassCharge(G4double massratio, G4double charge2ratio);
private:
void FillSecondariesAlongStep(G4double& eloss, G4double& weight);
void FillSecondariesAlongStep(G4double weight);
void PrintWarning(G4String, G4double val);
void PrintWarning(const G4String&, G4double val) const;
// define material and indexes
inline void DefineMaterial(const G4MaterialCutsCouple* couple);
@@ -426,168 +401,145 @@ private:
//------------------------------------------------------------------------
// Compute values using scaling relation, mass and charge of based particle
//------------------------------------------------------------------------
inline G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy,
G4double logScaledKinEnergy);
inline G4double GetSubDEDXForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetIonisationForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetSubIonisationForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy,
G4double logScaledKinEnergy);
inline G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy,
G4double logScaledKinEnergy);
inline G4double GetDEDXForScaledEnergy(G4double scaledKinE);
inline G4double GetDEDXForScaledEnergy(G4double scaledKinE,
G4double logScaledKinE);
inline G4double GetIonisationForScaledEnergy(G4double scaledKinE);
inline G4double GetScaledRangeForScaledEnergy(G4double scaledKinE);
inline G4double GetScaledRangeForScaledEnergy(G4double scaledKinE,
G4double logScaledKinE);
inline G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinE);
inline G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinE,
G4double logScaledKinE);
inline G4double ScaledKinEnergyForLoss(G4double range);
inline G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy,
G4double logScaledKinEnergy);
void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy,
G4double logScaledKinEnergy);
inline G4double GetLambdaForScaledEnergy(G4double scaledKinE);
inline G4double GetLambdaForScaledEnergy(G4double scaledKinE,
G4double logScaledKinE);
// hide assignment operator
G4VEnergyLossProcess(G4VEnergyLossProcess &) = delete;
G4VEnergyLossProcess & operator=(const G4VEnergyLossProcess &right) = delete;
void ComputeLambdaForScaledEnergy(G4double scaledKinE, G4double logScaledKinE);
// ======== Parameters of the class fixed at construction =========
G4bool IsRegionForCubcutProcessor(const G4Track& aTrack);
protected:
G4ParticleChangeForLoss fParticleChange;
const G4Material* currentMaterial = nullptr;
const G4MaterialCutsCouple* currentCouple = nullptr;
private:
G4LossTableManager* lManager;
G4EmModelManager* modelManager;
G4EmBiasingManager* biasManager;
G4VEmModel* currentModel = nullptr;
G4EmBiasingManager* biasManager = nullptr;
G4SafetyHelper* safetyHelper;
G4EmParameters* theParameters;
G4VEmFluctuationModel* fluctModel = nullptr;
G4VAtomDeexcitation* atomDeexcitation = nullptr;
G4VSubCutProducer* subcutProducer = nullptr;
const G4ParticleDefinition* secondaryParticle;
const G4ParticleDefinition* particle = nullptr;
const G4ParticleDefinition* baseParticle = nullptr;
const G4ParticleDefinition* secondaryParticle = nullptr;
const G4ParticleDefinition* theElectron;
const G4ParticleDefinition* thePositron;
const G4ParticleDefinition* theGamma;
const G4ParticleDefinition* theGenericIon;
const G4ParticleDefinition* theGenericIon = nullptr;
// ======== Parameters of the class fixed at initialisation =======
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;
std::vector<G4VEmModel*> emModels;
G4VEmFluctuationModel* fluctModel;
G4VAtomDeexcitation* atomDeexcitation;
G4VSubCutProducer* subcutProducer;
std::vector<const G4Region*> scoffRegions;
G4int nSCoffRegions;
G4bool* idxSCoffRegions;
std::vector<const G4Region*>* scoffRegions = nullptr;
std::vector<G4VEmModel*>* emModels = nullptr;
const std::vector<G4int>* theDensityIdx = nullptr;
const std::vector<G4double>* theDensityFactor = nullptr;
const G4DataVector* theCuts = nullptr;
std::vector<G4VEnergyLossProcess*> scProcesses;
G4int nProcesses;
// tables and vectors
G4PhysicsTable* theDEDXTable;
G4PhysicsTable* theDEDXSubTable;
G4PhysicsTable* theDEDXunRestrictedTable;
G4PhysicsTable* theIonisationTable;
G4PhysicsTable* theIonisationSubTable;
G4PhysicsTable* theRangeTableForLoss;
G4PhysicsTable* theCSDARangeTable;
G4PhysicsTable* theSecondaryRangeTable;
G4PhysicsTable* theInverseRangeTable;
G4PhysicsTable* theLambdaTable;
G4PhysicsTable* theSubLambdaTable;
size_t idxDEDX = 0;
size_t idxDEDXSub = 0;
size_t idxDEDXunRestricted = 0;
size_t idxIonisation = 0;
size_t idxIonisationSub = 0;
size_t idxRange = 0;
size_t idxCSDA = 0;
size_t idxSecRange = 0;
size_t idxInverseRange = 0;
size_t idxLambda = 0;
size_t idxSubLambda = 0;
std::vector<G4double> theDEDXAtMaxEnergy;
std::vector<G4double> theRangeAtMaxEnergy;
std::vector<G4double> theEnergyOfCrossSectionMax;
std::vector<G4double> theCrossSectionMax;
const std::vector<G4double>* theDensityFactor;
const std::vector<G4int>* theDensityIdx;
const G4DataVector* theCuts;
const G4DataVector* theSubCuts;
const G4ParticleDefinition* baseParticle;
G4int nBins;
G4int nBinsCSDA;
std::vector<G4TwoPeaksXS*>* fXSpeaks = nullptr;
G4double lowestKinEnergy;
G4double minKinEnergy;
G4double maxKinEnergy;
G4double maxKinEnergyCSDA;
G4double linLossLimit;
G4double dRoverRange;
G4double linLossLimit = 0.01;
G4double dRoverRange = 0.2;
G4double finalRange;
G4double lambdaFactor;
G4double logLambdafactor;
G4double biasFactor;
G4double lambdaFactor = 1.0;
G4double logLambdafactor = 0.0;
G4double biasFactor = 1.0;
G4bool lossFluctuationFlag;
G4bool rndmStepFlag;
G4bool tablesAreBuilt;
G4bool integral;
G4bool isIon;
G4bool isIonisation;
G4bool useSubCutoff;
G4bool useDeexcitation;
G4bool biasFlag;
G4bool weightFlag;
G4bool isMaster;
G4bool actIntegral;
G4bool actLinLossLimit;
G4bool actLossFluc;
G4bool actBinning;
G4bool actMinKinEnergy;
G4bool actMaxKinEnergy;
G4double massRatio = 1.0;
G4double logMassRatio = 0.0;
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;
protected:
G4ParticleChangeForLoss fParticleChange;
const G4Material* currentMaterial;
const G4MaterialCutsCouple* currentCouple;
size_t currentCoupleIndex;
G4double preStepLambda = 0.0;
G4double preStepKinEnergy = 0.0;
G4double preStepLogKinEnergy = LOG_EKIN_MIN;
G4double preStepScaledEnergy = 0.0;
G4double preStepLogScaledEnergy = LOG_EKIN_MIN;
G4double mfpKinEnergy = 0.0;
G4double preStepLambda;
G4double fRange;
G4double computedRange;
G4double preStepKinEnergy;
G4double preStepLogKinEnergy;
G4double preStepScaledEnergy;
G4double preStepLogScaledEnergy;
G4double preStepRangeEnergy;
G4double mfpKinEnergy;
// ======== Cached values - may be state dependent ================
size_t currentCoupleIndex = 0;
private:
std::vector<G4DynamicParticle*> secParticles;
std::vector<G4Track*> scTracks;
G4int nBins;
G4int nBinsCSDA;
G4int numberOfModels = 0;
G4int nSCoffRegions = 0;
const G4ParticleDefinition* particle;
size_t basedCoupleIndex = 0;
size_t coupleIdxRange = 0;
size_t coupleIdxLambda = 0;
size_t idxDEDX = 0;
size_t idxDEDXunRestricted = 0;
size_t idxIonisation = 0;
size_t idxRange = 0;
size_t idxCSDA = 0;
size_t idxSecRange = 0;
size_t idxInverseRange = 0;
size_t idxLambda = 0;
G4int secID = -1;
G4int biasID = -1;
G4VEmModel* currentModel;
size_t basedCoupleIndex;
size_t lastIdx;
G4GPILSelection aGPILSelection;
G4CrossSectionType fXSType = fEmIncreasing;
G4double massRatio;
G4double logMassRatio;
G4double fFactor;
G4double reduceFactor;
G4double chargeSqRatio;
G4bool lossFluctuationFlag = true;
G4bool rndmStepFlag = false;
G4bool tablesAreBuilt = false;
G4bool spline = true;
G4bool isIon = false;
G4bool isIonisation = true;
G4bool useDeexcitation = false;
G4bool biasFlag = false;
G4bool weightFlag = false;
G4bool isMaster = true;
G4bool actLinLossLimit = false;
G4bool actLossFluc = false;
G4bool actBinning = false;
G4bool actMinKinEnergy = false;
G4bool actMaxKinEnergy = false;
G4GPILSelection aGPILSelection;
std::vector<G4DynamicParticle*> secParticles;
std::vector<G4Track*> scTracks;
G4int secID;
G4int subsecID;
G4int biasID;
};
// ======== Run time inline methods ================
@@ -626,24 +578,12 @@ G4VEnergyLossProcess::DefineMaterial(const G4MaterialCutsCouple* couple)
fFactor = chargeSqRatio*biasFactor*(*theDensityFactor)[currentCoupleIndex];
reduceFactor = 1.0/(fFactor*massRatio);
mfpKinEnergy = DBL_MAX;
idxLambda = idxSubLambda = 0;
idxLambda = 0;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio,
G4double charge2ratio)
{
massRatio = massratio;
logMassRatio = G4Log(massRatio);
fFactor = charge2ratio*biasFactor*(*theDensityFactor)[currentCoupleIndex];
chargeSqRatio = charge2ratio;
reduceFactor = 1.0/(fFactor*massRatio);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e)
{
/*
@@ -671,16 +611,6 @@ G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e, G4double loge)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetSubDEDXForScaledEnergy(G4double e)
{
G4double x =
fFactor*(*theDEDXSubTable)[basedCoupleIndex]->Value(e, idxDEDXSub);
if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(G4double e)
{
G4double x =
@@ -691,34 +621,21 @@ inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(G4double e)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
G4double G4VEnergyLossProcess::GetSubIonisationForScaledEnergy(G4double e)
{
G4double x = fFactor*
(*theIonisationSubTable)[basedCoupleIndex]->Value(e, idxIonisationSub);
if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e)
{
//G4cout << "G4VEnergyLossProcess::GetScaledRange: Idx= "
// << basedCoupleIndex << " E(MeV)= " << e
// << " lastIdx= " << lastIdx << " " << theRangeTableForLoss << G4endl;
if(basedCoupleIndex != lastIdx || preStepRangeEnergy != e) {
lastIdx = basedCoupleIndex;
preStepRangeEnergy = e;
computedRange =
((*theRangeTableForLoss)[basedCoupleIndex])->Value(e, idxRange);
if(e < minKinEnergy) { computedRange *= std::sqrt(e/minKinEnergy); }
if(currentCoupleIndex != coupleIdxRange || fRangeEnergy != e) {
coupleIdxRange = currentCoupleIndex;
fRangeEnergy = e;
fRange = reduceFactor*((*theRangeTableForLoss)[basedCoupleIndex])->Value(e, idxRange);
if(e < minKinEnergy) { fRange *= std::sqrt(e/minKinEnergy); }
}
//G4cout << "G4VEnergyLossProcess::GetScaledRange: Idx= "
// << basedCoupleIndex << " E(MeV)= " << e
// << " R= " << fRange << " " << theRangeTableForLoss << G4endl;
return computedRange;
// << " R= " << computedRange << " " << theRangeTableForLoss << G4endl;
return fRange;
}
inline G4double
@@ -727,18 +644,16 @@ G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e, G4double loge)
//G4cout << "G4VEnergyLossProcess::GetScaledRange: Idx= "
// << basedCoupleIndex << " E(MeV)= " << e
// << " lastIdx= " << lastIdx << " " << theRangeTableForLoss << G4endl;
if(basedCoupleIndex != lastIdx || preStepRangeEnergy != e) {
lastIdx = basedCoupleIndex;
preStepRangeEnergy = e;
computedRange =
((*theRangeTableForLoss)[basedCoupleIndex])->LogVectorValue(e, loge);
if(e < minKinEnergy) { computedRange *= std::sqrt(e/minKinEnergy); }
if(currentCoupleIndex != coupleIdxRange || fRangeEnergy != e) {
coupleIdxRange = currentCoupleIndex;
fRangeEnergy = e;
fRange = reduceFactor*((*theRangeTableForLoss)[basedCoupleIndex])->LogVectorValue(e, loge);
if(e < minKinEnergy) { fRange *= std::sqrt(e/minKinEnergy); }
}
//G4cout << "G4VEnergyLossProcess::GetScaledRange: Idx= "
// << basedCoupleIndex << " E(MeV)= " << e
// << " R= " << fRange << " " << theRangeTableForLoss << G4endl;
return computedRange;
// << " R= " << fRange << " " << theRangeTableForLoss << G4endl;
return fRange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -746,29 +661,19 @@ G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e, G4double loge)
inline G4double
G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(G4double e)
{
G4double x;
if (e < maxKinEnergyCSDA) {
x = ((*theCSDARangeTable)[basedCoupleIndex])->Value(e, idxCSDA);
if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
} else {
x = theRangeAtMaxEnergy[basedCoupleIndex] +
(e - maxKinEnergyCSDA)/theDEDXAtMaxEnergy[basedCoupleIndex];
}
G4double x = ((*theCSDARangeTable)[basedCoupleIndex])->Value(e, idxCSDA);
if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(G4double e,
G4double loge)
{
G4double x;
if (e < maxKinEnergyCSDA) {
x = ((*theCSDARangeTable)[basedCoupleIndex])->LogVectorValue(e, loge);
if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
} else {
x = theRangeAtMaxEnergy[basedCoupleIndex] +
(e - maxKinEnergyCSDA)/theDEDXAtMaxEnergy[basedCoupleIndex];
}
G4double x = ((*theCSDARangeTable)[basedCoupleIndex])->LogVectorValue(e, loge);
if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
return x;
}
@@ -794,13 +699,26 @@ inline G4double G4VEnergyLossProcess::ScaledKinEnergyForLoss(G4double r)
inline G4double G4VEnergyLossProcess::GetLambdaForScaledEnergy(G4double e)
{
return fFactor*((*theLambdaTable)[basedCoupleIndex])->Value(e, idxLambda);
if(currentCoupleIndex != coupleIdxLambda || fLambdaEnergy != e) {
coupleIdxLambda = currentCoupleIndex;
fLambdaEnergy = e;
fLambda = fFactor*((*theLambdaTable)[basedCoupleIndex])->Value(e, idxLambda);
}
return fLambda;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetLambdaForScaledEnergy(G4double e, G4double loge)
{
return fFactor*((*theLambdaTable)[basedCoupleIndex])->LogVectorValue(e,loge);
if(currentCoupleIndex != coupleIdxLambda || fLambdaEnergy != e) {
coupleIdxLambda = currentCoupleIndex;
fLambdaEnergy = e;
fLambda = fFactor*
((*theLambdaTable)[basedCoupleIndex])->LogVectorValue(e, loge);
}
return fLambda;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -813,6 +731,8 @@ G4VEnergyLossProcess::GetDEDX(G4double kinEnergy,
return GetDEDXForScaledEnergy(kinEnergy*massRatio);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetDEDX(G4double kinEnergy,
const G4MaterialCutsCouple* couple,
@@ -825,44 +745,22 @@ G4VEnergyLossProcess::GetDEDX(G4double kinEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetDEDXForSubsec(G4double kineticEnergy,
const G4MaterialCutsCouple* couple)
G4VEnergyLossProcess::GetRange(G4double kinEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
return GetSubDEDXForScaledEnergy(kineticEnergy*massRatio);
return GetScaledRangeForScaledEnergy(kinEnergy*massRatio);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetRange(G4double kinEnergy,
const G4MaterialCutsCouple* couple)
{
G4double x = fRange;
DefineMaterial(couple);
if(theCSDARangeTable) {
x = reduceFactor * GetLimitScaledRangeForScaledEnergy(kinEnergy*massRatio);
} else if(theRangeTableForLoss) {
x = reduceFactor * GetScaledRangeForScaledEnergy(kinEnergy*massRatio);
}
return x;
}
inline G4double
G4VEnergyLossProcess::GetRange(G4double kinEnergy,
const G4MaterialCutsCouple* couple,
G4double logKinEnergy)
{
G4double x = fRange;
DefineMaterial(couple);
if(theCSDARangeTable) {
x = reduceFactor * GetLimitScaledRangeForScaledEnergy(kinEnergy*massRatio,
logKinEnergy+logMassRatio);
} else if(theRangeTableForLoss) {
x = reduceFactor * GetScaledRangeForScaledEnergy(kinEnergy*massRatio,
logKinEnergy+logMassRatio);
}
return x;
return GetScaledRangeForScaledEnergy(kinEnergy*massRatio, logKinEnergy+logMassRatio);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -872,32 +770,8 @@ G4VEnergyLossProcess::GetCSDARange(G4double kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
return (theCSDARangeTable) ?
GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor
: DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetRangeForLoss(G4double kinEnergy,
const G4MaterialCutsCouple* couple)
{
// G4cout << "GetRangeForLoss: Range from " << GetProcessName() << G4endl;
DefineMaterial(couple);
return reduceFactor * GetScaledRangeForScaledEnergy(kinEnergy*massRatio);
}
inline G4double
G4VEnergyLossProcess::GetRangeForLoss(G4double kinEnergy,
const G4MaterialCutsCouple* couple,
G4double logKinEnergy)
{
// G4cout << "GetRangeForLoss: Range from " << GetProcessName() << G4endl;
DefineMaterial(couple);
return reduceFactor * GetScaledRangeForScaledEnergy(kinEnergy*massRatio,
logKinEnergy+logMassRatio);
return (nullptr == theCSDARangeTable) ? DBL_MAX :
GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -917,17 +791,20 @@ G4VEnergyLossProcess::GetLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
return theLambdaTable ? GetLambdaForScaledEnergy(kinEnergy*massRatio) : 0.0;
return (nullptr != theLambdaTable) ?
GetLambdaForScaledEnergy(kinEnergy*massRatio) : 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple,
G4double logKinEnergy)
{
DefineMaterial(couple);
return theLambdaTable
? GetLambdaForScaledEnergy(kinEnergy*massRatio, logKinEnergy+logMassRatio)
return (nullptr != theLambdaTable) ?
GetLambdaForScaledEnergy(kinEnergy*massRatio, logKinEnergy+logMassRatio)
: 0.0;
}
@@ -940,7 +817,7 @@ inline void G4VEnergyLossProcess::SetFluctModel(G4VEmFluctuationModel* p)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmFluctuationModel* G4VEnergyLossProcess::FluctModel()
inline G4VEmFluctuationModel* G4VEnergyLossProcess::FluctModel() const
{
return fluctModel;
}
@@ -1000,17 +877,23 @@ inline void G4VEnergyLossProcess::SetLossFluctuations(G4bool val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetIntegral(G4bool val)
inline void G4VEnergyLossProcess::SetSpline(G4bool val)
{
integral = val;
actIntegral = true;
spline = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetCrossSectionType(G4CrossSectionType val)
{
fXSType = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4VEnergyLossProcess::IsIntegral() const
inline G4CrossSectionType G4VEnergyLossProcess::CrossSectionType() const
{
return integral;
return fXSType;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1064,13 +947,6 @@ inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTable() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTableForSubsec() const
{
return theDEDXSubTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::DEDXunRestrictedTable() const
{
return theDEDXunRestrictedTable;
@@ -1085,13 +961,6 @@ inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTable() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTableForSubsec() const
{
return theIonisationSubTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::CSDARangeTable() const
{
return theCSDARangeTable;
@@ -1127,9 +996,32 @@ inline G4PhysicsTable* G4VEnergyLossProcess::LambdaTable() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::SubLambdaTable() const
inline std::vector<G4TwoPeaksXS*>* G4VEnergyLossProcess::TwoPeaksXS() const
{
return theSubLambdaTable;
return fXSpeaks;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline size_t G4VEnergyLossProcess::NumberOfModels() const
{
return numberOfModels;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEnergyLossProcess::EmModel(size_t index) const
{
return (nullptr != emModels && index < emModels->size())
? (*emModels)[index] : nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel*
G4VEnergyLossProcess::GetModelByIndex(size_t idx, G4bool ver) const
{
return modelManager->GetModel(idx, ver);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -180,31 +180,31 @@ public:
private:
G4SafetyHelper* safetyHelper;
G4VEnergyLossProcess* ionisation;
const G4ParticleDefinition* currentPart;
G4SafetyHelper* safetyHelper = nullptr;
G4VEnergyLossProcess* ionisation = nullptr;
const G4ParticleDefinition* currentPart = nullptr;
G4double dedx;
G4double localtkin;
G4double localrange;
G4double dedx = 0.0;
G4double localtkin = 0.0;
G4double localrange = DBL_MAX;
protected:
G4double facrange;
G4double facgeom;
G4double facsafety;
G4double skin;
G4double dtrl;
G4double facrange = 0.04;
G4double facgeom = 2.5;
G4double facsafety = 0.6;
G4double skin = 1.0;
G4double dtrl = 0.05;
G4double lambdalimit;
G4double geomMin;
G4double geomMax;
G4bool samplez = false;
G4bool latDisplasment = true;
G4ThreeVector fDisplacement;
G4MscStepLimitType steppingAlgorithm;
G4bool samplez;
G4bool latDisplasment;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -310,6 +310,8 @@ G4VMscModel::GetDEDX(const G4ParticleDefinition* part, G4double kinEnergy,
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double
G4VMscModel::GetDEDX(const G4ParticleDefinition* part, G4double kinEnergy,
const G4MaterialCutsCouple* couple, G4double logKinEnergy)
@@ -335,7 +337,7 @@ G4VMscModel::GetRange(const G4ParticleDefinition* part,G4double kinEnergy,
// << G4endl;
localtkin = kinEnergy;
if (ionisation) {
localrange = ionisation->GetRangeForLoss(kinEnergy, couple);
localrange = ionisation->GetRange(kinEnergy, couple);
} else {
const G4double q = part->GetPDGCharge()*inveplus;
localrange = kinEnergy/(dedx*q*q*couple->GetMaterial()->GetDensity());
@@ -344,6 +346,8 @@ G4VMscModel::GetRange(const G4ParticleDefinition* part,G4double kinEnergy,
return localrange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double
G4VMscModel::GetRange(const G4ParticleDefinition* part,G4double kinEnergy,
const G4MaterialCutsCouple* couple, G4double logKinEnergy)
@@ -353,7 +357,7 @@ G4VMscModel::GetRange(const G4ParticleDefinition* part,G4double kinEnergy,
// << G4endl;
localtkin = kinEnergy;
if (ionisation) {
localrange = ionisation->GetRangeForLoss(kinEnergy, couple, logKinEnergy);
localrange = ionisation->GetRange(kinEnergy, couple, logKinEnergy);
} else {
const G4double q = part->GetPDGCharge()*inveplus;
localrange = kinEnergy/(dedx*q*q*couple->GetMaterial()->GetDensity());
@@ -38,19 +38,10 @@
// Modifications:
//
// 16-07-03 Update GetRange interface (V.Ivanchenko)
//
//
// Class Description:
//
// It is the generic process of multiple scattering it includes common
// part of calculations for all charged particles
//
// 26-11-03 bugfix in AlongStepDoIt (L.Urban)
// 25-05-04 add protection against case when range is less than steplimit (VI)
// 30-06-04 make destructor virtual (V.Ivanchenko)
// 27-08-04 Add InitialiseForRun method (V.Ivanchneko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
// 15-04-05 optimize internal interfaces (V.Ivanchenko)
// 15-04-05 remove boundary flag (V.Ivanchenko)
// 07-10-05 error in a protection in GetContinuousStepLimit corrected (L.Urban)
// 27-10-05 introduce virtual function MscStepLimitation() (V.Ivanchenko)
@@ -63,6 +54,10 @@
// 15-07-08 Reorder class members for further multi-thread development (VI)
// 07-04-09 Moved msc methods from G4VEmModel to G4VMscModel (VI)
//
// Class Description:
//
// It is the generic process of multiple scattering it includes common
// part of calculations for all charged particles
// -------------------------------------------------------------------
//
@@ -92,21 +87,16 @@ class G4VMultipleScattering : public G4VContinuousDiscreteProcess
{
public:
G4VMultipleScattering(const G4String& name = "msc",
G4ProcessType type = fElectromagnetic);
explicit G4VMultipleScattering(const G4String& name = "msc",
G4ProcessType type = fElectromagnetic);
virtual ~G4VMultipleScattering();
~G4VMultipleScattering() override;
//------------------------------------------------------------------------
// Virtual methods to be implemented for the concrete model
//------------------------------------------------------------------------
virtual G4bool IsApplicable(const G4ParticleDefinition& p) override = 0;
// obsolete
virtual void PrintInfo() {};
virtual void ProcessDescription(std::ostream& outFile) const override;
void ProcessDescription(std::ostream& outFile) const override;
protected:
@@ -173,6 +163,10 @@ public:
G4double currentMinimalStep,
G4double& currentSafety);
// hide assignment operator
G4VMultipleScattering(G4VMultipleScattering &) = delete;
G4VMultipleScattering & operator=(const G4VMultipleScattering &right) = delete;
//------------------------------------------------------------------------
// Specific methods to set, access, modify models
//------------------------------------------------------------------------
@@ -188,13 +182,15 @@ public:
// 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
void SetEmModel(G4VMscModel*, size_t index = 0);
void SetEmModel(G4VMscModel*, G4int idx = 0);
// return a model from the local list
G4VMscModel* EmModel(size_t index = 0) const;
inline G4VMscModel* EmModel(size_t index = 0) const;
// Access to run time models by index
inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false) const;
// Access to run time models
inline G4int NumberOfModels() const;
inline G4VMscModel* GetModelByIndex(G4int idx = 0, G4bool ver = false) const;
//------------------------------------------------------------------------
// Get/Set parameters for simulation of multiple scattering
@@ -203,13 +199,10 @@ public:
void SetIonisation(G4VEnergyLossProcess*);
inline G4bool LateralDisplasmentFlag() const;
inline void SetLateralDisplasmentFlag(G4bool val);
inline G4double Skin() const;
inline void SetSkin(G4double val);
inline G4double RangeFactor() const;
inline void SetRangeFactor(G4double val);
inline G4double GeomFactor() const;
@@ -238,21 +231,13 @@ protected:
G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety) override ;
// return number of already added models
inline G4int NumberOfModels() const;
G4double& currentSafety) override;
private:
// hide assignment operator
G4VMultipleScattering(G4VMultipleScattering &) = delete;
G4VMultipleScattering &
operator=(const G4VMultipleScattering &right) = delete;
// Print out of generic class parameters
void StreamInfo(std::ostream& outFile, const G4ParticleDefinition&,
G4bool rst=false) const;
G4bool rst = false) const;
// ======== Parameters of the class fixed at construction =========
@@ -262,22 +247,16 @@ private:
// ======== Parameters of the class fixed at initialisation =======
G4SafetyHelper* safetyHelper;
G4SafetyHelper* safetyHelper = nullptr;
const G4ParticleDefinition* firstParticle = nullptr;
const G4ParticleDefinition* currParticle = nullptr;
// const G4ParticleDefinition* theGenericIon = nullptr;
std::vector<G4VMscModel*> mscModels;
G4int numberOfModels;
const G4ParticleDefinition* firstParticle;
const G4ParticleDefinition* currParticle;
G4MscStepLimitType stepLimit;
G4double facrange;
G4double facrange = 0.04;
G4double lowestKinEnergy;
G4bool latDisplacement;
G4bool isIon;
// ======== Cached values - may be state dependent ================
protected:
@@ -286,20 +265,25 @@ protected:
private:
// cache
G4VMscModel* currentModel;
G4VEnergyLossProcess* fIonisation;
G4ThreeVector fNewPosition;
G4ThreeVector fNewDirection;
G4VMscModel* currentModel = nullptr;
G4VEnergyLossProcess* fIonisation = nullptr;
G4double geomMin;
G4double minDisplacement2;
G4double physStepLimit;
G4double tPathLength;
G4double gPathLength;
G4double physStepLimit = 0.0;
G4double tPathLength = 0.0;
G4double gPathLength = 0.0;
G4ThreeVector fNewPosition;
G4ThreeVector fNewDirection;
G4bool fPositionChanged;
G4bool isActive;
G4MscStepLimitType stepLimit = fUseSafety;
G4int numberOfModels = 0;
G4bool latDisplacement = true;
G4bool isIon = false;
G4bool fPositionChanged = false;
G4bool isActive = false;
};
// ======== Run time inline methods ================
@@ -321,13 +305,6 @@ inline G4bool G4VMultipleScattering::LateralDisplasmentFlag() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::SetLateralDisplasmentFlag(G4bool val)
{
latDisplacement = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::Skin() const
{
return theParameters->MscSkin();
@@ -335,13 +312,6 @@ inline G4double G4VMultipleScattering::Skin() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::SetSkin(G4double val)
{
theParameters->SetMscSkin(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::RangeFactor() const
{
return facrange;
@@ -349,16 +319,6 @@ inline G4double G4VMultipleScattering::RangeFactor() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::SetRangeFactor(G4double val)
{
if(val > 0.0 && val < 1.0) {
facrange = val;
theParameters->SetMscRangeFactor(val);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::GeomFactor() const
{
return theParameters->MscGeomFactor();
@@ -375,15 +335,13 @@ inline G4double G4VMultipleScattering::PolarAngleLimit() const
inline G4MscStepLimitType G4VMultipleScattering::StepLimitType() const
{
return stepLimit;
return theParameters->MscStepLimitType();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::SetStepLimitType(G4MscStepLimitType val)
{
stepLimit = val;
if(val == fMinimal) { SetRangeFactor(0.2); }
theParameters->SetMscStepLimitType(val);
}
@@ -410,17 +368,24 @@ inline const G4ParticleDefinition* G4VMultipleScattering::FirstParticle() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4int G4VMultipleScattering::NumberOfModels() const
inline G4VMscModel* G4VMultipleScattering::EmModel(size_t index) const
{
return modelManager->NumberOfModels();
return (index < mscModels.size()) ? mscModels[index] : nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel*
inline G4int G4VMultipleScattering::NumberOfModels() const
{
return numberOfModels;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VMscModel*
G4VMultipleScattering::GetModelByIndex(G4int idx, G4bool ver) const
{
return modelManager->GetModel(idx, ver);
return static_cast<G4VMscModel*>(modelManager->GetModel(idx, ver));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -72,12 +72,12 @@ public:
inline const G4String& GetName() const;
private:
// hide assignment operator
G4VSubCutProducer & operator=(const G4VSubCutProducer &right) = delete;
G4VSubCutProducer(const G4VSubCutProducer&) = delete;
private:
G4String fName;
};
@@ -65,7 +65,7 @@ public:
explicit G4ionEffectiveCharge();
virtual ~G4ionEffectiveCharge();
~G4ionEffectiveCharge() = default;
G4double EffectiveChargeSquareRatio(
const G4ParticleDefinition* p,
@@ -76,17 +76,18 @@ public:
const G4Material* material,
G4double kineticEnergy);
private:
// hide assignment operator
G4ionEffectiveCharge & operator=(const G4ionEffectiveCharge &right) = delete;
G4ionEffectiveCharge(const G4ionEffectiveCharge&) = delete;
G4double inveplus;
private:
G4Pow* g4calc;
const G4ParticleDefinition* lastPart;
const G4Material* lastMat;
const G4ParticleDefinition* lastPart = nullptr;
const G4Material* lastMat = nullptr;
G4double inveplus;
G4double lastKinEnergy;
G4double chargeCorrection;
@@ -107,13 +108,9 @@ inline G4double G4ionEffectiveCharge::EffectiveChargeSquareRatio(
const G4Material* material,
G4double kineticEnergy)
{
G4double charge = effCharge;
if( kineticEnergy != lastKinEnergy || material != lastMat || p != lastPart) {
charge = EffectiveCharge(p,material,kineticEnergy);
}
charge *= chargeCorrection*inveplus;
return charge*charge;
const G4double aCharge =
EffectiveCharge(p,material,kineticEnergy)*chargeCorrection*inveplus;
return aCharge*aCharge;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....