Import Geant4 11.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2023-12-08 10:43:34 +01:00
parent dd1f179cda
commit 860a2b92bf
3962 changed files with 139318 additions and 164259 deletions
@@ -30,6 +30,9 @@
// Date: 25 October 2014 //
// Description: performs beta- decay of radioactive nuclei, and returns //
// daughter particles in rest frame of parent nucleus //
// Modifications: //
// 23.08.2023 V.Ivanchenko make it thread safe using static utility //
// G4BetaSpectrumSampler //
// //
////////////////////////////////////////////////////////////////////////////////
@@ -38,7 +41,6 @@
#include "G4NuclearDecay.hh"
#include "G4BetaDecayType.hh"
#include "G4BetaSpectrumSampler.hh"
class G4BetaMinusDecay : public G4NuclearDecay
@@ -49,18 +51,30 @@ class G4BetaMinusDecay : public G4NuclearDecay
const G4double& ex, const G4Ions::G4FloatLevelBase& flb,
const G4BetaDecayType& type);
virtual ~G4BetaMinusDecay();
~G4BetaMinusDecay() override = default;
virtual G4DecayProducts* DecayIt(G4double);
G4DecayProducts* DecayIt(G4double) override;
virtual void DumpNuclearInfo();
void DumpNuclearInfo() override;
private:
void SetUpBetaSpectrumSampler(const G4int& parentZ, const G4int& parentA,
const G4BetaDecayType& type);
const G4double endpointEnergy;
G4BetaSpectrumSampler* betaSampler;
const G4double maxEnergy; // in eMass units
const G4double estep; // in eMass units
G4double parentMass;
G4double resMass;
const G4ParticleDefinition* fPrimaryIon;
const G4ParticleDefinition* fResIon;
const G4ParticleDefinition* fLepton;
const G4ParticleDefinition* fNeutrino;
static const G4int npti{101};
G4double cdf[npti];
};
#endif
@@ -30,6 +30,9 @@
// Date: 14 November 2014 //
// Description: performs beta+ decay of radioactive nuclei, and returns //
// daughter particles in rest frame of parent nucleus //
// Modifications: //
// 23.08.2023 V.Ivanchenko make it thread safe using static utility //
// G4BetaSpectrumSampler //
// //
////////////////////////////////////////////////////////////////////////////////
@@ -38,8 +41,6 @@
#include "G4NuclearDecay.hh"
#include "G4BetaDecayType.hh"
#include "G4BetaSpectrumSampler.hh"
class G4BetaPlusDecay : public G4NuclearDecay
{
@@ -49,18 +50,30 @@ class G4BetaPlusDecay : public G4NuclearDecay
const G4double& ex, const G4Ions::G4FloatLevelBase& flb,
const G4BetaDecayType& type);
virtual ~G4BetaPlusDecay();
~G4BetaPlusDecay() override = default;
virtual G4DecayProducts* DecayIt(G4double);
G4DecayProducts* DecayIt(G4double) override;
virtual void DumpNuclearInfo();
void DumpNuclearInfo() override;
private:
void SetUpBetaSpectrumSampler(const G4int& parentZ, const G4int& parentA,
const G4BetaDecayType& type);
const G4double endpointEnergy;
G4BetaSpectrumSampler* betaSampler;
const G4double maxEnergy; // in eMass units
const G4double estep; // in eMass units
G4double parentMass;
G4double resMass;
const G4ParticleDefinition* fPrimaryIon;
const G4ParticleDefinition* fResIon;
const G4ParticleDefinition* fLepton;
const G4ParticleDefinition* fNeutrino;
static const G4int npti{101};
G4double cdf[npti];
};
#endif
@@ -38,30 +38,17 @@
#define G4BetaSpectrumSampler_h 1
#include "globals.hh"
#include "Randomize.hh"
#include <vector>
class G4BetaSpectrumSampler
{
public:
G4BetaSpectrumSampler(const G4double* aPDF, G4int pdfSize, G4double e);
public:
~G4BetaSpectrumSampler() = default;
// sampling of any spectra using cumulative PDF function
// energy stepts are uniform starting from zero
// no check on array size is performed
static G4double shoot(const G4int npoints, const G4double* aCDF,
const G4double estep);
G4double shoot();
private:
G4double sampleSlopedLine(); // Method to sample under sloped line
std::vector<double> pdf; // Spectrum shape
std::vector<double> cdf; // Cumulative distribution function
G4double eEnd; // Endpoint energy of spectrum
G4int nBins; // Number of lower bin edges in spectrum
G4int lowerBinEdge; // Index of lower bin edge
G4int upperBinEdge; // Index of upper bin edge
G4double ylower{0.0}; // Value at lower bin edge
G4double yupper{0.0}; // Value at upper bin edge
};
#endif
@@ -44,26 +44,34 @@ class G4PhotonEvaporation;
class G4ITDecay : public G4NuclearDecay
{
public:
G4ITDecay(const G4ParticleDefinition* theParentNucleus,
const G4double& theBR, const G4double& Qvalue,
const G4double& excitation, G4PhotonEvaporation* aPhotonEvap);
public:
virtual ~G4ITDecay();
// constructor for sampling of radiaoctive decay in a thread
G4ITDecay(G4PhotonEvaporation* aPhotonEvap);
virtual G4DecayProducts* DecayIt(G4double);
// constructor to define decay channels in the shared decay table
G4ITDecay(const G4ParticleDefinition* theParentNucleus,
const G4double& theBR, const G4double& Qvalue,
const G4double& excitation);
virtual void DumpNuclearInfo();
~G4ITDecay() override = default;
void SetARM(G4bool onoff) {applyARM = onoff;}
void SetupDecay(const G4ParticleDefinition*);
G4DecayProducts* DecayIt(G4double) override;
void DumpNuclearInfo() override;
void SetARM(G4bool onoff) {applyARM = onoff;}
private:
const G4double transitionQ;
G4int parentZ;
G4int parentA;
G4bool applyARM;
private:
G4PhotonEvaporation* photonEvaporation;
G4int parentZ{0};
G4int parentA{0};
G4bool applyARM{true};
G4PhotonEvaporation* photonEvaporation{nullptr};
const G4ParticleDefinition* theParent{nullptr};
};
#endif
@@ -48,29 +48,29 @@ class G4NuclearDecay : public G4VDecayChannel
const G4double& excitation,
const G4Ions::G4FloatLevelBase& floatingLevel);
virtual ~G4NuclearDecay();
~G4NuclearDecay() override = default;
G4RadioactiveDecayMode GetDecayMode() {return theMode;}
G4bool IsOKWithParentMass(G4double parentMass) override;
G4double GetDaughterExcitation() {return daughterEx;}
G4RadioactiveDecayMode GetDecayMode() const {return theMode;}
G4Ions::G4FloatLevelBase GetFloatingLevel() {return floatingLevel;}
G4double GetDaughterExcitation() const {return daughterEx;}
G4Ions::G4FloatLevelBase GetFloatingLevel() const {return floatingLevel;}
G4ParticleDefinition* GetDaughterNucleus() {return GetDaughter(0);}
void SetHLThreshold(G4double HLT) {halflifeThreshold = HLT;}
G4double GetHLThreshold() {return halflifeThreshold;}
virtual void DumpNuclearInfo() = 0;
protected:
const G4RadioactiveDecayMode theMode;
private:
// Needed for variance reduction mode
const G4double daughterEx;
const G4Ions::G4FloatLevelBase floatingLevel;
G4double halflifeThreshold;
};
#endif
@@ -51,26 +51,26 @@ typedef std::vector<G4RadioactiveDecayChainsFromParent> G4RadioactiveDecayParent
typedef std::vector<G4RadioactiveDecayRatesToDaughter> G4RadioactiveDecayRates;
typedef std::map<G4String, G4DecayTable*> DecayTableMap;
class G4Radioactivation : public G4RadioactiveDecay
{
public: // with description
G4Radioactivation(const G4String& processName="Radioactivation");
~G4Radioactivation();
G4Radioactivation(const G4String& processName="Radioactivation",
const G4double timeThresholdForRadioactiveDecays=-1.0);
~G4Radioactivation() override;
virtual void ProcessDescription(std::ostream& outFile) const;
G4VParticleChange* DecayIt(const G4Track& theTrack,
const G4Step& theStep) override;
// Return decay table if it exists, if not, load it from file
G4DecayTable* GetDecayTable1(const G4ParticleDefinition*);
void ProcessDescription(std::ostream& outFile) const override;
// Set the decay biasing scheme using the data in "filename"
void SetDecayBias(G4String filename);
void SetDecayBias(const G4String& filename);
// Set the half-life threshold for isomer production
void SetHLThreshold(G4double hl) {halflifethreshold = hl;}
void SetSourceTimeProfile(G4String filename);
void SetSourceTimeProfile(const G4String& filename);
// Set source exposure function using histograms in "filename"
G4bool IsRateTableReady(const G4ParticleDefinition &);
@@ -90,12 +90,12 @@ class G4Radioactivation : public G4RadioactiveDecay
// and place it in "chainsFromParent".
// used in VR decay mode only
void SetDecayRate(G4int,G4int,G4double, G4int, std::vector<G4double>,
std::vector<G4double>);
void SetDecayRate(G4int,G4int,G4double, G4int, std::vector<G4double>&,
std::vector<G4double>&);
// Sets "theDecayRate" with data supplied in the arguements.
// used in VR decay mode only
std::vector<G4RadioactivityTable*> GetTheRadioactivityTables()
std::vector<G4RadioactivityTable*>& GetTheRadioactivityTables()
{return theRadioactivityTables;}
// Return vector of G4Radioactivity map - should be used in VR mode only
@@ -103,9 +103,8 @@ class G4Radioactivation : public G4RadioactiveDecay
// Controls whether G4Radioactivation runs in analogue mode or
// variance reduction mode. SetBRBias, SetSplitNuclei and
// SetSourceTimeProfile all turn off analogue mode and use VR mode
inline void SetAnalogueMonteCarlo (G4bool r ) {
inline void SetAnalogueMonteCarlo (G4bool r) {
AnalogueMC = r;
if (!AnalogueMC) halflifethreshold = 1e-6*CLHEP::s;
}
// Returns true if the simulation is an analogue Monte Carlo, and false if
@@ -127,8 +126,8 @@ class G4Radioactivation : public G4RadioactiveDecay
// Returns the nuclear splitting number
inline G4int GetSplitNuclei () {return NSplit;}
G4VParticleChange* DecayIt(const G4Track& theTrack,
const G4Step& theStep);
G4Radioactivation(const G4Radioactivation& right) = delete;
G4Radioactivation& operator=(const G4Radioactivation& right) = delete;
protected:
@@ -137,7 +136,7 @@ class G4Radioactivation : public G4RadioactiveDecay
G4int GetDecayTimeBin(const G4double aDecayTime);
G4double GetMeanLifeTime(const G4Track& theTrack,
G4ForceCondition* condition);
G4ForceCondition* condition) override;
//Add gamma,Xray,conversion,and auger electrons for bias mode
void AddDeexcitationSpectrumForBiasMode(G4ParticleDefinition* apartDef,
@@ -147,10 +146,9 @@ class G4Radioactivation : public G4RadioactiveDecay
std::vector<double>& times_v,
std::vector<G4DynamicParticle*>& secondaries_v);
G4RadioactivationMessenger* theRadioactivationMessenger;
private:
G4RadioactivationMessenger* theRadioactivationMessenger;
G4bool AnalogueMC;
G4bool BRBias;
G4int NSplit;
@@ -172,14 +170,6 @@ class G4Radioactivation : public G4RadioactiveDecay
// for the radioactivity tables
std::vector<G4RadioactivityTable*> theRadioactivityTables;
G4int decayWindows[100];
inline
G4VParticleChange* AtRestDoIt(const G4Track& theTrack, const G4Step& theStep)
{return DecayIt(theTrack, theStep);}
inline
G4VParticleChange* PostStepDoIt(const G4Track& theTrack, const G4Step& theStep)
{return DecayIt(theTrack, theStep);}
};
#endif
@@ -50,12 +50,14 @@
#include "G4NucleusLimits.hh"
#include "G4ThreeVector.hh"
#include "G4Threading.hh"
#include "G4RadioactiveDecayMode.hh"
class G4Fragment;
class G4RadioactiveDecayMessenger;
class G4PhotonEvaporation;
class G4Ions;
class G4DecayTable;
class G4ITDecay;
typedef std::map<G4String, G4DecayTable*> DecayTableMap;
@@ -74,16 +76,28 @@ class G4RadioactiveDecay : public G4VRestDiscreteProcess
public: // with description
G4RadioactiveDecay(const G4String& processName="RadioactiveDecay");
~G4RadioactiveDecay();
G4RadioactiveDecay(const G4String& processName="RadioactiveDecay",
const G4double timeThreshold=-1.0);
~G4RadioactiveDecay() override;
virtual void ProcessDescription(std::ostream& outFile) const;
G4bool IsApplicable(const G4ParticleDefinition&);
G4bool IsApplicable(const G4ParticleDefinition&) override;
// Return true if the specified isotope is
// 1) defined as "nucleus" and
// 2) it is within theNucleusLimit
G4VParticleChange* AtRestDoIt(const G4Track& theTrack,
const G4Step& theStep) override;
G4VParticleChange* PostStepDoIt(const G4Track& theTrack,
const G4Step& theStep) override;
void BuildPhysicsTable(const G4ParticleDefinition &) override;
void ProcessDescription(std::ostream& outFile) const override;
virtual G4VParticleChange* DecayIt(const G4Track& theTrack,
const G4Step& theStep);
// Return decay table if it exists, if not, load it from file
G4DecayTable* GetDecayTable(const G4ParticleDefinition*);
@@ -102,19 +116,13 @@ class G4RadioactiveDecay : public G4VRestDiscreteProcess
// Enable/disable ARM
void SetARM(G4bool arm) {applyARM = arm;}
G4DecayTable* LoadDecayTable(const G4ParticleDefinition& theParentNucleus);
G4DecayTable* LoadDecayTable(const G4Ions*);
// Load the decay data of isotope theParentNucleus
void AddUserDecayDataFile(G4int Z, G4int A,G4String filename);
void AddUserDecayDataFile(G4int Z, G4int A, const G4String& filename);
// Allow the user to replace the radio-active decay data provided in Geant4
// by its own data file for a given isotope
inline void SetVerboseLevel(G4int value) {verboseLevel = value;}
// Sets the VerboseLevel which controls duggering display
inline G4int GetVerboseLevel() const {return verboseLevel;}
// Returns the VerboseLevel which controls level of debugging output
inline void SetNucleusLimits(G4NucleusLimits theNucleusLimits1)
{theNucleusLimits = theNucleusLimits1 ;}
// Sets theNucleusLimits which specifies the range of isotopes
@@ -152,105 +160,68 @@ class G4RadioactiveDecay : public G4VRestDiscreteProcess
}
inline G4double GetThresholdForVeryLongDecayTime() const {return fThresholdForVeryLongDecayTime;}
void BuildPhysicsTable(const G4ParticleDefinition &);
void StreamInfo(std::ostream& os, const G4String& endline);
G4VParticleChange* DecayIt(const G4Track& theTrack,
const G4Step& theStep);
G4RadioactiveDecay(const G4RadioactiveDecay& right) = delete;
G4RadioactiveDecay& operator=(const G4RadioactiveDecay& right) = delete;
protected:
void DecayAnalog(const G4Track& theTrack);
G4double GetMeanFreePath(const G4Track& theTrack, G4double previousStepSize,
G4ForceCondition* condition) override;
G4DecayProducts* DoDecay(const G4ParticleDefinition& theParticleDef);
G4double GetMeanLifeTime(const G4Track& theTrack,
G4ForceCondition* condition) override;
// sampling of products
void DecayAnalog(const G4Track& theTrack, G4DecayTable*);
// sampling products at rest
G4DecayProducts* DoDecay(const G4ParticleDefinition&, G4DecayTable*);
// Apply directional bias for "visible" daughters (e+-, gamma, n, p, alpha)
void CollimateDecay(G4DecayProducts* products);
void CollimateDecayProduct(G4DynamicParticle* product);
G4ThreeVector ChooseCollimationDirection() const;
G4double GetMeanFreePath(const G4Track& theTrack, G4double previousStepSize,
G4ForceCondition* condition);
G4double GetMeanLifeTime(const G4Track& theTrack,
G4ForceCondition* condition);
// ParticleChange for decay process
G4ParticleChangeForRadDecay fParticleChangeForRadDecay;
G4RadioactiveDecayMessenger* theRadioactiveDecayMessenger;
G4PhotonEvaporation* photonEvaporation;
G4ITDecay* decayIT;
std::vector<G4String> ValidVolumes;
bool isAllVolumesMode;
bool isAllVolumesMode{true};
static const G4double levelTolerance;
// Library of decay tables
DecayTableMap* dkmap;
#ifdef G4MULTITHREADED
static DecayTableMap* master_dkmap;
#endif
private:
void StreamInfo(std::ostream& os, const G4String& endline);
G4RadioactiveDecay(const G4RadioactiveDecay& right);
G4RadioactiveDecay& operator=(const G4RadioactiveDecay& right);
G4NucleusLimits theNucleusLimits;
G4bool isInitialised;
G4bool applyARM;
G4bool isInitialised{false};
G4bool applyARM{true};
// Parameters for pre-collimated (biased) decay products
G4ThreeVector forceDecayDirection;
G4double forceDecayHalfAngle;
G4ThreeVector forceDecayDirection{G4ThreeVector(0., 0., 0.)};
G4double forceDecayHalfAngle{0.0};
static const G4ThreeVector origin; // (0,0,0) for convenience
// Radioactive decay database directory path
G4String dirPath;
static G4String dirPath;
//User define radioactive decay data files replacing some files in the G4RADECAY database
std::map<G4int, G4String> theUserRadioactiveDataFiles;
//The last RadDecayMode
G4RadioactiveDecayMode theRadDecayMode{G4RadioactiveDecayMode::IT};
// Remainder of life time at rest
G4double fRemainderLifeTime{0.0};
G4int verboseLevel;
// User define radioactive decay data files replacing some files in the G4RADECAY database
static std::map<G4int, G4String>* theUserRDataFiles;
// The last RadDecayMode
G4RadioactiveDecayMode theRadDecayMode{G4RadioactiveDecayMode::IT};
// Ignore radioactive decays at rest of nuclides happening after this (very long) time threshold
G4double fThresholdForVeryLongDecayTime;
// inline implementations
inline
G4double AtRestGetPhysicalInteractionLength(const G4Track& track,
G4ForceCondition* condition)
{
fRemainderLifeTime =
G4VRestDiscreteProcess::AtRestGetPhysicalInteractionLength(track, condition);
return fRemainderLifeTime;
}
inline
G4VParticleChange* AtRestDoIt(const G4Track& theTrack,
const G4Step& theStep)
{return DecayIt(theTrack, theStep);}
inline
G4VParticleChange* PostStepDoIt(const G4Track& theTrack,
const G4Step& theStep)
{return DecayIt(theTrack, theStep);}
#ifdef G4MULTITHREADED
public:
static G4Mutex radioactiveDecayMutex;
protected:
G4int& NumberOfInstances();
#endif
};
#endif