Import Geant4 11.1.0.beta source tree
This commit is contained in:
@@ -54,6 +54,10 @@
|
||||
#include "G4ReactionProduct.hh"
|
||||
#include "G4HadronicProcessType.hh"
|
||||
#include "G4CrossSectionDataStore.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4DynamicParticle.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4HadXSTypes.hh"
|
||||
#include <vector>
|
||||
|
||||
class G4Track;
|
||||
@@ -64,6 +68,7 @@ class G4HadronicInteraction;
|
||||
class G4HadronicProcessStore;
|
||||
class G4VCrossSectionDataSet;
|
||||
class G4VLeadingParticleBiasing;
|
||||
class G4ParticleDefinition;
|
||||
|
||||
class G4HadronicProcess : public G4VDiscreteProcess
|
||||
{
|
||||
@@ -89,8 +94,14 @@ public:
|
||||
inline
|
||||
G4double GetMicroscopicCrossSection(const G4DynamicParticle * part,
|
||||
const G4Element * elm,
|
||||
const G4Material* mat = nullptr)
|
||||
{ return GetElementCrossSection(part, elm, mat); }
|
||||
const G4Material* mat = nullptr);
|
||||
|
||||
// initialisation for a new track
|
||||
void StartTracking(G4Track* track) override;
|
||||
|
||||
// compute step limit
|
||||
G4double PostStepGetPhysicalInteractionLength(const G4Track& track,
|
||||
G4double, G4ForceCondition*) override;
|
||||
|
||||
// generic PostStepDoIt recommended for all derived classes
|
||||
G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
|
||||
@@ -115,79 +126,71 @@ public:
|
||||
G4HadronicInteraction* GetHadronicModel(const G4String&);
|
||||
|
||||
// access to the chosen generator
|
||||
inline G4HadronicInteraction* GetHadronicInteraction() const
|
||||
{ return theInteraction; }
|
||||
inline G4HadronicInteraction* GetHadronicInteraction() const;
|
||||
|
||||
// get inverse cross section per volume
|
||||
G4double GetMeanFreePath(const G4Track &aTrack, G4double,
|
||||
G4ForceCondition *) override;
|
||||
|
||||
// access to the target nucleus
|
||||
inline const G4Nucleus* GetTargetNucleus() const
|
||||
{ return &targetNucleus; }
|
||||
|
||||
// G4ParticleDefinition* GetTargetDefinition();
|
||||
inline const G4Isotope* GetTargetIsotope()
|
||||
{ return targetNucleus.GetIsotope(); }
|
||||
inline const G4Nucleus* GetTargetNucleus() const;
|
||||
|
||||
inline const G4Isotope* GetTargetIsotope();
|
||||
|
||||
// methods needed for implementation of integral XS
|
||||
G4double ComputeCrossSection(const G4ParticleDefinition*,
|
||||
const G4Material*,
|
||||
const G4double kinEnergy);
|
||||
|
||||
inline G4HadXSType CrossSectionType() const;
|
||||
inline void SetCrossSectionType(G4HadXSType val);
|
||||
|
||||
void ProcessDescription(std::ostream& outFile) const override;
|
||||
|
||||
protected:
|
||||
// scale cross section
|
||||
void BiasCrossSectionByFactor(G4double aScale);
|
||||
void MultiplyCrossSectionBy(G4double factor);
|
||||
inline G4double CrossSectionFactor() const;
|
||||
|
||||
// Integral option
|
||||
inline void SetIntegral(G4bool val);
|
||||
|
||||
// Energy-momentum non-conservation limits and reporting
|
||||
inline void SetEpReportLevel(G4int level);
|
||||
inline void SetEnergyMomentumCheckLevels(G4double relativeLevel,
|
||||
G4double absoluteLevel);
|
||||
inline std::pair<G4double, G4double> GetEnergyMomentumCheckLevels() const;
|
||||
|
||||
// access to the cross section data store
|
||||
inline G4CrossSectionDataStore* GetCrossSectionDataStore();
|
||||
|
||||
// access to the data for integral XS method
|
||||
inline std::vector<G4TwoPeaksHadXS*>* TwoPeaksXS() const;
|
||||
inline std::vector<G4double>* EnergyOfCrossSectionMax() const;
|
||||
|
||||
// hide assignment operator as private
|
||||
G4HadronicProcess& operator=(const G4HadronicProcess& right) = delete;
|
||||
G4HadronicProcess(const G4HadronicProcess&) = delete;
|
||||
|
||||
protected:
|
||||
|
||||
// generic method to choose secondary generator
|
||||
// recommended for all derived classes
|
||||
inline G4HadronicInteraction* ChooseHadronicInteraction(
|
||||
const G4HadProjectile & aHadProjectile, G4Nucleus& aTargetNucleus,
|
||||
const G4Material* aMaterial, const G4Element* anElement)
|
||||
{ return theEnergyRangeManager.GetHadronicInteraction(aHadProjectile,
|
||||
aTargetNucleus,
|
||||
aMaterial,anElement);
|
||||
}
|
||||
const G4Material* aMaterial, const G4Element* anElement);
|
||||
|
||||
// access to the target nucleus
|
||||
inline G4Nucleus* GetTargetNucleusPointer()
|
||||
{ return &targetNucleus; }
|
||||
|
||||
public:
|
||||
|
||||
// scale cross section
|
||||
void BiasCrossSectionByFactor(G4double aScale);
|
||||
void MultiplyCrossSectionBy(G4double factor);
|
||||
inline G4double CrossSectionFactor() const
|
||||
{ return aScaleFactor; }
|
||||
|
||||
// Integral option
|
||||
inline void SetIntegral(G4bool val)
|
||||
{ useIntegralXS = val; }
|
||||
|
||||
// Energy-momentum non-conservation limits and reporting
|
||||
inline void SetEpReportLevel(G4int level)
|
||||
{ epReportLevel = level; }
|
||||
|
||||
inline void SetEnergyMomentumCheckLevels(G4double relativeLevel, G4double absoluteLevel)
|
||||
{ epCheckLevels.first = relativeLevel;
|
||||
epCheckLevels.second = absoluteLevel;
|
||||
levelsSetByProcess = true;
|
||||
}
|
||||
|
||||
inline std::pair<G4double, G4double> GetEnergyMomentumCheckLevels() const
|
||||
{ return epCheckLevels; }
|
||||
|
||||
// access to the cross section data store
|
||||
inline G4CrossSectionDataStore* GetCrossSectionDataStore()
|
||||
{return theCrossSectionDataStore;}
|
||||
|
||||
protected:
|
||||
|
||||
void DumpState(const G4Track&, const G4String&, G4ExceptionDescription&);
|
||||
|
||||
inline G4Nucleus* GetTargetNucleusPointer();
|
||||
|
||||
// access to the cross section data set
|
||||
inline G4double GetLastCrossSection()
|
||||
{ return theLastCrossSection; }
|
||||
inline G4double GetLastCrossSection();
|
||||
|
||||
// fill result
|
||||
void FillResult(G4HadFinalState* aR, const G4Track& aT);
|
||||
|
||||
void DumpState(const G4Track&, const G4String&, G4ExceptionDescription&);
|
||||
|
||||
// Check the result for catastrophic energy non-conservation
|
||||
G4HadFinalState* CheckResult(const G4HadProjectile& thePro,
|
||||
const G4Nucleus& targetNucleus,
|
||||
@@ -199,14 +202,15 @@ protected:
|
||||
private:
|
||||
|
||||
void InitialiseLocal();
|
||||
void UpdateCrossSectionAndMFP(const G4double kinEnergy);
|
||||
void RecomputeXSandMFP(const G4double kinEnergy);
|
||||
|
||||
inline void DefineXSandMFP();
|
||||
inline void ComputeXSandMFP();
|
||||
|
||||
G4double XBiasSurvivalProbability();
|
||||
G4double XBiasSecondaryWeight();
|
||||
|
||||
// hide assignment operator as private
|
||||
G4HadronicProcess& operator=(const G4HadronicProcess& right);
|
||||
G4HadronicProcess(const G4HadronicProcess&);
|
||||
|
||||
// Set E/p conservation check levels from environment variables
|
||||
void GetEnergyMomentumCheckEnvvars();
|
||||
|
||||
@@ -214,44 +218,173 @@ protected:
|
||||
|
||||
G4HadProjectile thePro;
|
||||
|
||||
G4ParticleChange* theTotalResult;
|
||||
|
||||
G4double fWeight;
|
||||
|
||||
G4int epReportLevel;
|
||||
G4ParticleChange* theTotalResult;
|
||||
G4double fWeight = 1.0;
|
||||
G4int epReportLevel = 0;
|
||||
|
||||
private:
|
||||
|
||||
G4EnergyRangeManager theEnergyRangeManager;
|
||||
|
||||
G4HadronicInteraction* theInteraction;
|
||||
|
||||
G4CrossSectionDataStore* theCrossSectionDataStore;
|
||||
|
||||
G4HadronicProcessStore* theProcessStore;
|
||||
|
||||
G4Nucleus targetNucleus;
|
||||
|
||||
G4HadronicInteraction* theInteraction = nullptr;
|
||||
G4CrossSectionDataStore* theCrossSectionDataStore;
|
||||
G4HadronicProcessStore* theProcessStore;
|
||||
const G4HadronicProcess* masterProcess = nullptr;
|
||||
const G4ParticleDefinition* firstParticle = nullptr;
|
||||
const G4ParticleDefinition* currentParticle = nullptr;
|
||||
const G4Material* currentMat = nullptr;
|
||||
const G4DynamicParticle* fDynParticle = nullptr;
|
||||
|
||||
bool G4HadronicProcess_debug_flag;
|
||||
std::vector<G4double>* theEnergyOfCrossSectionMax = nullptr;
|
||||
std::vector<G4TwoPeaksHadXS*>* fXSpeaks = nullptr;
|
||||
|
||||
G4double aScaleFactor = 1.0;
|
||||
G4double theLastCrossSection = 0.0;
|
||||
G4double mfpKinEnergy = DBL_MAX;
|
||||
G4double theMFP = DBL_MAX;
|
||||
G4double minKinEnergy;
|
||||
|
||||
bool useIntegralXS;
|
||||
G4HadXSType fXSType = fHadNoIntegral;
|
||||
|
||||
G4int nMatWarn;
|
||||
G4int nKaonWarn;
|
||||
// counters
|
||||
G4int nMatWarn = 0;
|
||||
G4int nKaonWarn = 0;
|
||||
G4int nICelectrons = 0;
|
||||
G4int matIdx = 0;
|
||||
|
||||
G4int nICelectrons;
|
||||
// flags
|
||||
G4bool levelsSetByProcess = false;
|
||||
G4bool G4HadronicProcess_debug_flag = false;
|
||||
G4bool useIntegralXS = true;
|
||||
G4bool isMaster = true;
|
||||
|
||||
G4ThreeVector unitVector;
|
||||
|
||||
// Energy-momentum checking
|
||||
std::pair<G4double, G4double> epCheckLevels;
|
||||
G4bool levelsSetByProcess;
|
||||
|
||||
std::vector<G4VLeadingParticleBiasing*> theBias;
|
||||
|
||||
G4double theInitialNumberOfInteractionLength;
|
||||
|
||||
G4double aScaleFactor;
|
||||
G4double theLastCrossSection;
|
||||
};
|
||||
|
||||
inline G4double G4HadronicProcess::
|
||||
GetMicroscopicCrossSection(const G4DynamicParticle * part,
|
||||
const G4Element * elm,
|
||||
const G4Material* mat)
|
||||
{
|
||||
return GetElementCrossSection(part, elm, mat);
|
||||
}
|
||||
|
||||
inline G4HadronicInteraction*
|
||||
G4HadronicProcess::GetHadronicInteraction() const
|
||||
{
|
||||
return theInteraction;
|
||||
}
|
||||
|
||||
inline const G4Nucleus*
|
||||
G4HadronicProcess::GetTargetNucleus() const
|
||||
{
|
||||
return &targetNucleus;
|
||||
}
|
||||
|
||||
inline const G4Isotope* G4HadronicProcess::GetTargetIsotope()
|
||||
{
|
||||
return targetNucleus.GetIsotope();
|
||||
}
|
||||
|
||||
inline G4HadXSType
|
||||
G4HadronicProcess::CrossSectionType() const
|
||||
{
|
||||
return fXSType;
|
||||
}
|
||||
|
||||
inline void
|
||||
G4HadronicProcess::SetCrossSectionType(G4HadXSType val)
|
||||
{
|
||||
fXSType = val;
|
||||
}
|
||||
|
||||
inline G4double G4HadronicProcess::CrossSectionFactor() const
|
||||
{
|
||||
return aScaleFactor;
|
||||
}
|
||||
|
||||
inline void G4HadronicProcess::SetIntegral(G4bool val)
|
||||
{
|
||||
useIntegralXS = val;
|
||||
}
|
||||
|
||||
inline void G4HadronicProcess::SetEpReportLevel(G4int level)
|
||||
{
|
||||
epReportLevel = level;
|
||||
}
|
||||
|
||||
inline void
|
||||
G4HadronicProcess::SetEnergyMomentumCheckLevels(G4double relativeLevel,
|
||||
G4double absoluteLevel)
|
||||
{
|
||||
epCheckLevels.first = relativeLevel;
|
||||
epCheckLevels.second = absoluteLevel;
|
||||
levelsSetByProcess = true;
|
||||
}
|
||||
|
||||
inline std::pair<G4double, G4double>
|
||||
G4HadronicProcess::GetEnergyMomentumCheckLevels() const
|
||||
{
|
||||
return epCheckLevels;
|
||||
}
|
||||
|
||||
inline G4CrossSectionDataStore*
|
||||
G4HadronicProcess::GetCrossSectionDataStore()
|
||||
{
|
||||
return theCrossSectionDataStore;
|
||||
}
|
||||
|
||||
inline std::vector<G4TwoPeaksHadXS*>*
|
||||
G4HadronicProcess::TwoPeaksXS() const
|
||||
{
|
||||
return fXSpeaks;
|
||||
}
|
||||
|
||||
inline std::vector<G4double>*
|
||||
G4HadronicProcess::EnergyOfCrossSectionMax() const
|
||||
{
|
||||
return theEnergyOfCrossSectionMax;
|
||||
}
|
||||
|
||||
inline G4HadronicInteraction* G4HadronicProcess::
|
||||
ChooseHadronicInteraction(const G4HadProjectile& aHadProjectile,
|
||||
G4Nucleus& aTargetNucleus,
|
||||
const G4Material* aMaterial,
|
||||
const G4Element* anElement)
|
||||
{
|
||||
return theEnergyRangeManager.GetHadronicInteraction(aHadProjectile,
|
||||
aTargetNucleus,
|
||||
aMaterial,anElement);
|
||||
}
|
||||
|
||||
inline G4Nucleus* G4HadronicProcess::GetTargetNucleusPointer()
|
||||
{
|
||||
return &targetNucleus;
|
||||
}
|
||||
|
||||
inline G4double G4HadronicProcess::GetLastCrossSection()
|
||||
{
|
||||
return theLastCrossSection;
|
||||
}
|
||||
|
||||
inline void G4HadronicProcess::DefineXSandMFP()
|
||||
{
|
||||
theLastCrossSection = aScaleFactor*
|
||||
theCrossSectionDataStore->GetCrossSection(fDynParticle, currentMat);
|
||||
theMFP = (theLastCrossSection > 0.0) ? 1.0/theLastCrossSection : DBL_MAX;
|
||||
}
|
||||
|
||||
inline void G4HadronicProcess::ComputeXSandMFP()
|
||||
{
|
||||
theLastCrossSection = aScaleFactor*
|
||||
theCrossSectionDataStore->ComputeCrossSection(fDynParticle, currentMat);
|
||||
theMFP = (theLastCrossSection > 0.0) ? 1.0/theLastCrossSection : DBL_MAX;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user