Import Geant4 11.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2021-12-10 14:46:44 +01:00
committed by Ben Morgan
parent 6399a014b6
commit 80e2389dd8
3932 changed files with 202519 additions and 246221 deletions
@@ -81,32 +81,26 @@ class G4MCCIndexConversionTable
inline
G4bool G4MCCIndexConversionTable::IsUsed(std::size_t index) const
{
if (index >= vecNewIndex.size()) return false;
// returns 'true' if the indicated MCC in the file
// is used in the current production cut table
return (vecNewIndex[index] >= 0);
return ((index < vecNewIndex.size()) && (vecNewIndex[index] >= 0));
}
inline
void G4MCCIndexConversionTable::SetNewIndex(std::size_t index,
std::size_t new_value)
{
if (index >= vecNewIndex.size()) return;
// set the index in the current production cut table
// for the indicated MCC in the file
vecNewIndex[index]=G4int(new_value);
if (index < vecNewIndex.size()) vecNewIndex[index] = new_value;
}
inline
G4int G4MCCIndexConversionTable::GetIndex(std::size_t index) const
{
if (index >= vecNewIndex.size()) return -1;
// get the index in the current production cut table
// for the indicated MCC in the file
return (vecNewIndex[index]);
return (index < vecNewIndex.size()) ? vecNewIndex[index] : -1;
}
inline
@@ -35,13 +35,9 @@
#ifndef G4PhysicsTableHelper_hh
#define G4PhysicsTableHelper_hh 1
#include <vector>
#include "globals.hh"
#include "G4ios.hh"
#include "G4PhysicsVector.hh"
#include "G4PhysicsTable.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4Region.hh"
class G4PhysicsTableHelper
{
@@ -78,7 +74,7 @@ class G4PhysicsTableHelper
G4PhysicsTableHelper();
~G4PhysicsTableHelper();
static G4ThreadLocal G4int verboseLevel;
static G4int verboseLevel;
// Control flag for output message
};
@@ -42,25 +42,16 @@
class G4RToEConvForElectron : public G4VRangeToEnergyConverter
{
public:
public:
G4RToEConvForElectron();
// Constructor
explicit G4RToEConvForElectron();
virtual ~G4RToEConvForElectron();
// Destructor
virtual ~G4RToEConvForElectron();
protected:
protected:
virtual G4double ComputeLoss(G4double AtomicNumber,
G4double KineticEnergy);
G4double ComputeValue(const G4int Z, const G4double kinEnergy) final;
G4double Mass = 0.0;
G4double Z = -1.0;
G4double taul = 0.0;
G4double ionpot = 0.0;
G4double ionpotlog = -1.0e-10;
G4double bremfactor = 0.1;
};
#endif
@@ -34,62 +34,21 @@
#ifndef G4RToEConvForGamma_hh
#define G4RToEConvForGamma_hh 1
#include <vector>
#include "globals.hh"
#include "G4ios.hh"
#include "G4VRangeToEnergyConverter.hh"
class G4RToEConvForGamma : public G4VRangeToEnergyConverter
{
public:
public:
G4RToEConvForGamma();
// Constructor
explicit G4RToEConvForGamma();
virtual ~G4RToEConvForGamma();
// Destructor
virtual ~G4RToEConvForGamma();
protected:
protected:
using G4CrossSectionTable = G4LossTable;
G4double ComputeValue(const G4int Z, const G4double kinEnergy) final;
virtual G4double ComputeLoss( G4double AtomicNumber,
G4double KineticEnergy );
virtual void BuildRangeVector( const G4Material* aMaterial,
G4RangeVector* rangeVector );
// The Range Table
void BuildAbsorptionLengthVector( const G4Material* aMaterial,
G4RangeVector* rangeVector );
G4double ComputeCrossSection( G4double AtomicNumber,
G4double KineticEnergy );
G4double Z = -1.0;
G4double s200keV = 0.0, s1keV = 0.0;
G4double tmin = 0.0, tlow = 0.0;
G4double smin = 0.0, slow = 0.0;
G4double cmin = 0.0, clow = 0.0, chigh = 0.0;
};
// ------------------
// Inline methods
// ------------------
inline
G4double G4RToEConvForGamma::ComputeLoss(G4double AtomicNumber,
G4double KineticEnergy)
{
return ComputeCrossSection(AtomicNumber,KineticEnergy);
}
inline
void G4RToEConvForGamma::BuildRangeVector(const G4Material* aMaterial,
G4RangeVector* rangeVector)
{
BuildAbsorptionLengthVector(aMaterial, rangeVector);
}
#endif
@@ -34,33 +34,21 @@
#ifndef G4RToEConvForPositron_hh
#define G4RToEConvForPositron_hh 1
#include <vector>
#include "globals.hh"
#include "G4ios.hh"
#include "G4VRangeToEnergyConverter.hh"
class G4RToEConvForPositron : public G4VRangeToEnergyConverter
{
public:
public:
G4RToEConvForPositron();
// Constructor
explicit G4RToEConvForPositron();
virtual ~G4RToEConvForPositron();
// Destructor
protected:
protected:
virtual G4double ComputeLoss(G4double AtomicNumber,
G4double KineticEnergy);
G4double ComputeValue(const G4int Z, const G4double kinEnergy) final;
G4double Mass = 0.0;
G4double Z = -1.0;
G4double taul = 0.0;
G4double ionpot = 0.0;
G4double ionpotlog = -1.0e-10;
G4double bremfactor = 0.1;
};
@@ -34,41 +34,24 @@
#ifndef G4RToEConvForProton_hh
#define G4RToEConvForProton_hh 1
#include <vector>
#include "globals.hh"
#include "G4ios.hh"
#include "G4VRangeToEnergyConverter.hh"
class G4RToEConvForProton : public G4VRangeToEnergyConverter
{
public:
public:
G4RToEConvForProton();
// Constructor
explicit G4RToEConvForProton();
virtual ~G4RToEConvForProton();
// Destructor
virtual ~G4RToEConvForProton();
virtual G4double Convert(G4double rangeCut, const G4Material* material);
// Calculate energy cut from given range cut for the material
G4double Convert(const G4double rangeCut, const G4Material* material) final;
virtual void Reset();
// Reset Loss Table and Range Vectors
protected:
protected:
G4double ComputeValue(const G4int Z, const G4double kinEnergy) final;
virtual G4double ComputeLoss(G4double AtomicNumber,
G4double KineticEnergy);
G4double Mass = 0.0;
G4double Z = -1.0;
G4double tau0 = 0.0;
G4double taul = 0.0;
G4double taum = 0.0;
G4double ionpot = 0.0;
G4double ca = 0.0;
G4double cba = 0.0;
G4double cc = 0.0;
};
#endif
@@ -36,109 +36,87 @@
#ifndef G4VRangeToEnergyConverter_hh
#define G4VRangeToEnergyConverter_hh 1
#include <cmath>
#include <vector>
#include "globals.hh"
#include "G4ios.hh"
#include "G4ParticleDefinition.hh"
#include "G4PhysicsTable.hh"
#include "G4Element.hh"
#include "G4Material.hh"
class G4PhysicsLogVector;
#include "G4Threading.hh"
class G4VRangeToEnergyConverter
{
public:
public:
G4VRangeToEnergyConverter();
// Constructor
explicit G4VRangeToEnergyConverter();
G4VRangeToEnergyConverter(const G4VRangeToEnergyConverter& r);
// Copy constructor
virtual ~G4VRangeToEnergyConverter();
G4VRangeToEnergyConverter& operator=(const G4VRangeToEnergyConverter &r);
// Assignment operator
// operators are not used
G4VRangeToEnergyConverter(const G4VRangeToEnergyConverter& r) = delete;
G4VRangeToEnergyConverter& operator=
(const G4VRangeToEnergyConverter &r) = delete;
G4bool operator==(const G4VRangeToEnergyConverter& r) const = delete;
G4bool operator!=(const G4VRangeToEnergyConverter& r) const = delete;
virtual ~G4VRangeToEnergyConverter();
// Destructor
// Calculate energy cut from given range cut for the material
virtual G4double Convert(const G4double rangeCut, const G4Material* material);
G4bool operator==(const G4VRangeToEnergyConverter& r) const;
G4bool operator!=(const G4VRangeToEnergyConverter& r) const;
// Equality operators
// Set energy range for all particle type
// if highedge > 10 GeV, highedge value is not changed
static void SetEnergyRange(const G4double lowedge, const G4double highedge);
virtual G4double Convert(G4double rangeCut, const G4Material* material);
// Calculate energy cut from given range cut for the material
// Get energy range for all particle type
static G4double GetLowEdgeEnergy();
static G4double GetHighEdgeEnergy();
static void SetEnergyRange(G4double lowedge, G4double highedge);
// Set energy range for all particle type
static G4double GetLowEdgeEnergy();
static G4double GetHighEdgeEnergy();
// Get energy range for all particle type
static G4double GetMaxEnergyCut();
static void SetMaxEnergyCut(G4double value);
// Get/set max cut energy for all particle type
// Get/set max cut energy for all particle type
// No check on the value
static G4double GetMaxEnergyCut();
static void SetMaxEnergyCut(const G4double value);
inline const G4ParticleDefinition* GetParticleType() const;
// Return pointer to the particle type which this converter takes care of
// Return pointer to the particle type which this converter takes care of
inline const G4ParticleDefinition* GetParticleType() const;
const G4PhysicsTable* GetLossTable() const;
// theLossTable is a collection of loss vectors for all elements.
// Each loss vector has energy loss values (cross-section values
// for neutral particles) which are calculated by
// ComputeLoss(G4double AtomicNumber, G4double KineticEnergy).
// ComputeLoss method is pure virtual and should be provided
// for each particle type
virtual void Reset();
// Reset Loss Table and Range Vectors
inline void SetVerboseLevel(G4int value);
inline G4int GetVerboseLevel() const;
inline void SetVerboseLevel(G4int value);
inline G4int GetVerboseLevel() const;
// control flag for output message
// 0: Silent
// 1: Warning message
// 2: More
protected:
protected:
virtual void BuildLossTable();
virtual G4double ComputeValue(const G4int Z, const G4double kinEnergy) = 0;
virtual G4double ComputeLoss(G4double AtomicNumber,
G4double KineticEnergy) = 0;
private:
// ------------- Range Table --------------------------------------
static void FillEnergyVector(const G4double emin, const G4double emax);
using G4LossVector = G4PhysicsLogVector;
using G4RangeVector = G4PhysicsLogVector;
using G4LossTable = G4PhysicsTable;
G4double ConvertForGamma(const G4double rangeCut, const G4Material* material);
virtual void BuildRangeVector(const G4Material* aMaterial,
G4RangeVector* rangeVector);
G4double ConvertForElectron(const G4double rangeCut,
const G4Material* material);
G4double ConvertCutToKineticEnergy(G4RangeVector* theRangeVector,
G4double theCutInLength,
std::size_t materialIndex ) const;
protected:
inline G4double LiniearInterpolation(const G4double e1, const G4double e2,
const G4double r1, const G4double r2,
const G4double r);
static G4double LowestEnergy, HighestEnergy;
static G4double MaxEnergyCut;
G4double fMaxEnergyCut = 0.0;
const G4ParticleDefinition* theParticle = nullptr;
G4LossTable* theLossTable = nullptr;
G4int NumberOfElements = 0;
const G4int TotBin = 300;
protected:
std::vector< G4RangeVector* > fRangeVectorStore;
#ifdef G4MULTITHREADED
static G4Mutex theMutex;
#endif
private:
static G4double Emin;
static G4double Emax;
static std::vector<G4double>* Energy;
static G4int NbinPerDecade;
static G4int Nbin;
G4int verboseLevel = 1;
const G4ParticleDefinition* theParticle = nullptr;
G4int fPDG = 0;
G4int verboseLevel = 1;
};
// ------------------
@@ -163,4 +141,11 @@ const G4ParticleDefinition* G4VRangeToEnergyConverter::GetParticleType() const
return theParticle;
}
inline G4double G4VRangeToEnergyConverter::LiniearInterpolation(
const G4double e1, const G4double e2,
const G4double r1, const G4double r2, const G4double r)
{
return (r1 == r2) ? e1 : e1 + (e2 - e1)*(r - r1)/(r2 - r1);
}
#endif