Import Geant4 11.0.0 source tree
This commit is contained in:
committed by
Ben Morgan
parent
6399a014b6
commit
80e2389dd8
@@ -90,6 +90,7 @@
|
||||
#include "G4IonisParamElm.hh"
|
||||
#include "G4IsotopeVector.hh"
|
||||
#include "G4ElementTable.hh"
|
||||
#include "G4ElementVector.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -201,7 +202,8 @@ public: // with description
|
||||
//
|
||||
friend std::ostream& operator<<(std::ostream&, const G4Element*);
|
||||
friend std::ostream& operator<<(std::ostream&, const G4Element&);
|
||||
friend std::ostream& operator<<(std::ostream&, G4ElementTable);
|
||||
friend std::ostream& operator<<(std::ostream&, const G4ElementTable&);
|
||||
friend std::ostream& operator<<(std::ostream&, const G4ElementVector&);
|
||||
|
||||
public: // without description
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4NistElementBuilder.hh"
|
||||
#include "G4PhysicsVector.hh"
|
||||
#include "G4Physics2DVector.hh"
|
||||
#include <vector>
|
||||
@@ -75,6 +74,13 @@ public:
|
||||
// set name of the dataset
|
||||
void SetName(const G4String& nam);
|
||||
|
||||
//--------------------------------------------------------------
|
||||
//
|
||||
// run time methods - no check on validity of input index
|
||||
// it is a responsibility of the consume code to check the input
|
||||
//
|
||||
//--------------------------------------------------------------
|
||||
|
||||
// get vector for the element
|
||||
inline G4PhysicsVector* GetElementData(G4int Z);
|
||||
|
||||
@@ -86,10 +92,10 @@ public:
|
||||
|
||||
// get component ID which may be number of nucleons,
|
||||
// or shell number, or any other integer
|
||||
inline G4int GetComponentID(G4int Z, size_t idx);
|
||||
inline G4int GetComponentID(G4int Z, G4int idx);
|
||||
|
||||
// get vector per shell or per isotope
|
||||
inline G4PhysicsVector* GetComponentDataByIndex(G4int Z, size_t idx);
|
||||
inline G4PhysicsVector* GetComponentDataByIndex(G4int Z, G4int idx);
|
||||
|
||||
// get vector per shell or per isotope
|
||||
inline G4PhysicsVector* GetComponentDataByID(G4int Z, G4int id);
|
||||
@@ -100,20 +106,23 @@ public:
|
||||
|
||||
// return cross section per element
|
||||
// if not available return zero
|
||||
inline G4double GetValueForComponent(G4int Z, size_t idx, G4double kinEnergy);
|
||||
|
||||
private:
|
||||
inline G4double GetValueForComponent(G4int Z, G4int idx,
|
||||
G4double kinEnergy);
|
||||
|
||||
// Assignment operator and copy constructor
|
||||
G4ElementData & operator=(const G4ElementData &right) = delete;
|
||||
G4ElementData(const G4ElementData&) = delete;
|
||||
|
||||
G4PhysicsVector* elmData[maxNumElements];
|
||||
G4Physics2DVector* elm2Data[maxNumElements];
|
||||
std::vector<G4PhysicsVector*> compData[maxNumElements];
|
||||
std::vector<G4int> compID[maxNumElements];
|
||||
size_t compLength[maxNumElements];
|
||||
G4String name;
|
||||
private:
|
||||
|
||||
static const G4int maxNumElm = 99;
|
||||
G4PhysicsVector* elmData[maxNumElm];
|
||||
G4Physics2DVector* elm2Data[maxNumElm];
|
||||
std::vector<G4PhysicsVector*>* compData[maxNumElm];
|
||||
std::vector<G4int>* compID[maxNumElm];
|
||||
G4int compLength[maxNumElm];
|
||||
|
||||
G4String name = "";
|
||||
};
|
||||
|
||||
inline void G4ElementData::SetName(const G4String& nam)
|
||||
@@ -136,27 +145,27 @@ G4Physics2DVector* G4ElementData::GetElement2DData(G4int Z)
|
||||
inline
|
||||
size_t G4ElementData::GetNumberOfComponents(G4int Z)
|
||||
{
|
||||
return compLength[Z];
|
||||
return compID[Z]->size();
|
||||
}
|
||||
|
||||
inline G4int G4ElementData::GetComponentID(G4int Z, size_t idx)
|
||||
inline G4int G4ElementData::GetComponentID(G4int Z, G4int idx)
|
||||
{
|
||||
return (compID[Z])[idx];
|
||||
return (*(compID[Z]))[idx];
|
||||
}
|
||||
|
||||
inline
|
||||
G4PhysicsVector* G4ElementData::GetComponentDataByIndex(G4int Z, size_t idx)
|
||||
inline G4PhysicsVector*
|
||||
G4ElementData::GetComponentDataByIndex(G4int Z, G4int idx)
|
||||
{
|
||||
return (compData[Z])[idx];
|
||||
return (*(compData[Z]))[idx];
|
||||
}
|
||||
|
||||
inline
|
||||
G4PhysicsVector* G4ElementData::GetComponentDataByID(G4int Z, G4int id)
|
||||
{
|
||||
G4PhysicsVector* v = 0;
|
||||
for(size_t i=0; i<compLength[Z]; ++i) {
|
||||
if(id == (compID[Z])[i]) {
|
||||
v = (compData[Z])[i];
|
||||
G4PhysicsVector* v = nullptr;
|
||||
for(G4int i=0; i<compLength[Z]; ++i) {
|
||||
if(id == (*(compID[Z]))[i]) {
|
||||
v = (*(compData[Z]))[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -170,9 +179,9 @@ G4double G4ElementData::GetValueForElement(G4int Z, G4double kinEnergy)
|
||||
}
|
||||
|
||||
inline G4double
|
||||
G4ElementData::GetValueForComponent(G4int Z, size_t idx, G4double kinEnergy)
|
||||
G4ElementData::GetValueForComponent(G4int Z, G4int idx, G4double kinEnergy)
|
||||
{
|
||||
return ((compData[Z])[idx])->Value(kinEnergy);
|
||||
return (*(compData[Z]))[idx]->Value(kinEnergy);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -38,8 +38,9 @@
|
||||
#define G4ELEMENTVECTOR_HH
|
||||
|
||||
#include <vector>
|
||||
#include "G4Element.hh"
|
||||
|
||||
typedef std::vector<G4Element*> G4ElementVector;
|
||||
class G4Element;
|
||||
|
||||
typedef std::vector<const G4Element*> G4ElementVector;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -35,8 +35,7 @@
|
||||
// Class description:
|
||||
//
|
||||
// Is used to define the additional material information. This class
|
||||
// contains a map of G4VMaterialExtension associated with an integer
|
||||
// key of G4PhysicsModelCatalog index.
|
||||
// contains a map of G4VMaterialExtension associated with an integer key.
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -152,21 +152,19 @@ public: // with description
|
||||
//
|
||||
// Add an element, giving number of atoms
|
||||
//
|
||||
void AddElement(G4Element* element, //the element
|
||||
G4int nAtoms); //nb of atoms in a molecule
|
||||
void AddElementByNumberOfAtoms(const G4Element* elm, G4int nAtoms);
|
||||
inline
|
||||
void AddElementByNumberOfAtoms(G4Element* elm, G4int nAtoms) {AddElement(elm, nAtoms);}
|
||||
void AddElement(G4Element* elm, G4int nAtoms)
|
||||
{ AddElementByNumberOfAtoms(elm, nAtoms); }
|
||||
|
||||
//
|
||||
// Add an element or material, giving fraction of mass
|
||||
//
|
||||
void AddElement (G4Element* element , //the element
|
||||
G4double fraction); //fractionOfMass
|
||||
inline
|
||||
void AddElementByMassFraction(G4Element* elm, G4double frac) {AddElement(elm, frac);}
|
||||
void AddElementByMassFraction(const G4Element* elm, G4double fraction);
|
||||
inline void AddElement (G4Element* elm, G4double frac)
|
||||
{ AddElementByMassFraction(elm, frac); }
|
||||
|
||||
void AddMaterial(G4Material* material, //the material
|
||||
G4double fraction); //fractionOfMass
|
||||
void AddMaterial(G4Material* material, G4double fraction);
|
||||
|
||||
virtual ~G4Material();
|
||||
//
|
||||
@@ -277,7 +275,7 @@ public: // with description
|
||||
//
|
||||
friend std::ostream& operator<<(std::ostream&, const G4Material*);
|
||||
friend std::ostream& operator<<(std::ostream&, const G4Material&);
|
||||
friend std::ostream& operator<<(std::ostream&, G4MaterialTable);
|
||||
friend std::ostream& operator<<(std::ostream&, const G4MaterialTable&);
|
||||
|
||||
G4Material(__void__&);
|
||||
// Fake default constructor for usage restricted to direct object
|
||||
@@ -312,52 +310,52 @@ private:
|
||||
|
||||
private:
|
||||
|
||||
const G4Material* fBaseMaterial; // Pointer to the base material
|
||||
G4MaterialPropertiesTable* fMaterialPropertiesTable;
|
||||
|
||||
G4ElementVector* theElementVector; // vector of constituent Elements
|
||||
G4double* fMassFractionVector; // composition by fractional mass
|
||||
G4int* fAtomsVector; // composition by atom count
|
||||
void FillVectors();
|
||||
|
||||
static
|
||||
G4MaterialTable theMaterialTable; // the material table
|
||||
G4MaterialTable theMaterialTable; // the material table
|
||||
|
||||
const G4Material* fBaseMaterial; // Pointer to the base material
|
||||
G4MaterialPropertiesTable* fMaterialPropertiesTable;
|
||||
|
||||
//
|
||||
// Derived data members (computed from the basic data members)
|
||||
// General atomic properties defined in constructor or
|
||||
// computed from the basic data members
|
||||
//
|
||||
// some general atomic properties
|
||||
|
||||
G4double* fVecNbOfAtomsPerVolume; // vector of nb of atoms per volume
|
||||
|
||||
G4IonisParamMat* fIonisation; // ionisation parameters
|
||||
G4SandiaTable* fSandiaTable; // Sandia table
|
||||
G4ElementVector* theElementVector; // vector of constituent G4Elements
|
||||
G4int* fAtomsVector; // composition by atom count
|
||||
G4double* fMassFractionVector; // composition by fractional mass
|
||||
G4double* fVecNbOfAtomsPerVolume; // number of atoms per volume
|
||||
|
||||
G4IonisParamMat* fIonisation; // ionisation parameters
|
||||
G4SandiaTable* fSandiaTable; // Sandia table
|
||||
|
||||
G4double fDensity; // Material density
|
||||
G4double fFreeElecDensity; // Free electron density
|
||||
G4double fTemp; // Temperature (defaults: STP)
|
||||
G4double fPressure; // Pressure (defaults: STP)
|
||||
G4double fDensity; // Material density
|
||||
G4double fFreeElecDensity; // Free electron density
|
||||
G4double fTemp; // Temperature (defaults: STP)
|
||||
G4double fPressure; // Pressure (defaults: STP)
|
||||
|
||||
G4double fTotNbOfAtomsPerVolume; // total nb of atoms per volume
|
||||
G4double fTotNbOfElectPerVolume; // total nb of electrons per volume
|
||||
G4double fRadlen; // Radiation length
|
||||
G4double fNuclInterLen; // Nuclear interaction length
|
||||
G4double fMassOfMolecule; // for materials built by atoms count
|
||||
G4double fTotNbOfAtomsPerVolume; // Total nb of atoms per volume
|
||||
G4double fTotNbOfElectPerVolume; // Total nb of electrons per volume
|
||||
G4double fRadlen; // Radiation length
|
||||
G4double fNuclInterLen; // Nuclear interaction length
|
||||
G4double fMassOfMolecule; // Correct for materials built by atoms count
|
||||
|
||||
G4State fState; // Material state (determined
|
||||
// internally based on density)
|
||||
size_t fIndexInTable; // the position in the material table
|
||||
G4State fState; // Material state
|
||||
size_t fIndexInTable; // Index in the material table
|
||||
G4int fNumberOfElements; // Number of G4Elements in the material
|
||||
|
||||
G4int maxNbComponents; // totalNbOfComponentsInTheMaterial
|
||||
G4int fArrayLength; // the length of fAtomsVector
|
||||
G4int fNumberOfComponents; // Nb of components declared so far
|
||||
// Class members used only at initialisation
|
||||
G4int fNbComponents; // Number of material components
|
||||
G4int fIdxComponent; // Index of a new component
|
||||
G4bool fMassFraction; // Flag of the method to add components
|
||||
|
||||
G4int fNumberOfElements; // Nb of Elements in the material
|
||||
// For composites built via AddMaterial()
|
||||
std::map<G4Material*, G4double> fMatComponents;
|
||||
|
||||
std::map<G4Material*,G4double> fMatComponents; // for composites built via
|
||||
// AddMaterial()
|
||||
|
||||
G4String fName; // Material name
|
||||
G4String fChemicalFormula; // Material chemical formula
|
||||
G4String fName; // Material name
|
||||
G4String fChemicalFormula; // Material chemical formula
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
static G4Mutex materialMutex;
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#include "G4MaterialPropertiesIndex.hh"
|
||||
#include "G4MaterialPropertyVector.hh"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
class G4MaterialPropertiesTable
|
||||
{
|
||||
@@ -64,23 +64,22 @@ class G4MaterialPropertiesTable
|
||||
G4MaterialPropertiesTable();
|
||||
virtual ~G4MaterialPropertiesTable();
|
||||
|
||||
void AddConstProperty(const G4String& key, G4double PropertyValue,
|
||||
void AddConstProperty(const G4String& key, G4double propertyValue,
|
||||
G4bool createNewKey = false);
|
||||
void AddConstProperty(const char* key, G4double PropertyValue,
|
||||
void AddConstProperty(const char* key, G4double propertyValue,
|
||||
G4bool createNewKey = false);
|
||||
// Add a new property to the table by giving a key-name and value
|
||||
|
||||
G4MaterialPropertyVector* AddProperty(
|
||||
const G4String& key, const std::vector<G4double>& photonEnergies,
|
||||
const std::vector<G4double>& propertyValues, G4bool createNewKey = false);
|
||||
const std::vector<G4double>& propertyValues, G4bool createNewKey = false,
|
||||
G4bool spline = false);
|
||||
// Add a new property to the table by giving a key-name and
|
||||
// vectors of values
|
||||
|
||||
G4MaterialPropertyVector* AddProperty(const char* key,
|
||||
G4double* PhotonEnergies,
|
||||
G4double* PropertyValues,
|
||||
G4int NumEntries,
|
||||
G4bool createNewKey = false);
|
||||
G4MaterialPropertyVector* AddProperty(
|
||||
const char* key, G4double* photonEnergies, G4double* propertyValues,
|
||||
G4int numEntries, G4bool createNewKey = false, G4bool spline = false);
|
||||
// Add a new property to the table by giving a key-name and the
|
||||
// arrays x and y of size NumEntries.
|
||||
|
||||
@@ -106,27 +105,24 @@ class G4MaterialPropertiesTable
|
||||
|
||||
G4double GetConstProperty(const G4String& key) const;
|
||||
G4double GetConstProperty(const char* key) const;
|
||||
// Get the constant property from the table corresponding to the key-name
|
||||
|
||||
G4double GetConstProperty(const G4int index) const;
|
||||
// Get the constant property from the table corresponding to the key-index
|
||||
// Get a constant property from the table
|
||||
// It is an error to ask for a const property that the user has not defined.
|
||||
// Check if it has been defined with ConstPropertyExists() first.
|
||||
|
||||
G4bool ConstPropertyExists(const G4String& key) const;
|
||||
G4bool ConstPropertyExists(const char* key) const;
|
||||
// Return true if a const property 'key' exists.
|
||||
|
||||
G4bool ConstPropertyExists(const G4int index) const;
|
||||
// Return true if a const property with key-index 'index' exists.
|
||||
// Return true if a const property has been defined by the user.
|
||||
// Despite the name, this returns false for a const property in
|
||||
// GetMaterialConstPropertyNames() but not defined by user.
|
||||
// Use this method before calling GetConstProperty().
|
||||
|
||||
G4MaterialPropertyVector* GetProperty(const char* key,
|
||||
G4bool warning = false);
|
||||
G4MaterialPropertyVector* GetProperty(const G4String& key,
|
||||
G4bool warning = false);
|
||||
// Get the property from the table corresponding to the key-name.
|
||||
|
||||
G4MaterialPropertyVector* GetProperty(const G4int index,
|
||||
G4bool warning = false);
|
||||
// Get the property from the table corresponding to the key-index.
|
||||
G4MaterialPropertyVector* GetProperty(const char* key) const;
|
||||
G4MaterialPropertyVector* GetProperty(const G4String& key) const;
|
||||
G4MaterialPropertyVector* GetProperty(const G4int index) const;
|
||||
// Get the property from the table corresponding to the key-index or index.
|
||||
// nullptr is returned if the property has not been defined by the user.
|
||||
|
||||
void AddEntry(const G4String& key, G4double aPhotonEnergy,
|
||||
G4double aPropertyValue);
|
||||
@@ -134,44 +130,56 @@ class G4MaterialPropertiesTable
|
||||
G4double aPropertyValue);
|
||||
// Add a new entry (pair of numbers) to the table for a given key.
|
||||
|
||||
G4int GetConstPropertyIndex(const G4String& key,
|
||||
G4bool warning = false) const;
|
||||
G4int GetConstPropertyIndex(const G4String& key) const;
|
||||
// Get the constant property index from the key-name
|
||||
// It is an error to request the index of a non-existent key (key not
|
||||
// present in fMaterialConstPropertyNames()).
|
||||
|
||||
G4int GetPropertyIndex(const G4String& key, G4bool warning = false) const;
|
||||
G4int GetPropertyIndex(const G4String& key) const;
|
||||
// Get the property index by the key-name.
|
||||
// It is an error to request the index of a non-existent key (key not
|
||||
// present in GetMaterialPropertyNames()).
|
||||
|
||||
std::vector<G4String> GetMaterialPropertyNames() const;
|
||||
std::vector<G4String> GetMaterialConstPropertyNames() const;
|
||||
void DumpTable() const;
|
||||
// print the material properties and material constant properties
|
||||
|
||||
void DumpTable();
|
||||
|
||||
const std::map<G4int, G4MaterialPropertyVector*, std::less<G4int>>*
|
||||
GetPropertyMap() const
|
||||
// the next four methods are used in persistency/GDML:
|
||||
const std::vector<G4String>& GetMaterialPropertyNames() const
|
||||
{
|
||||
return &MP;
|
||||
return fMatPropNames;
|
||||
}
|
||||
const std::map<G4int, G4double, std::less<G4int>>* GetConstPropertyMap() const
|
||||
const std::vector<G4String>& GetMaterialConstPropertyNames() const
|
||||
{
|
||||
return &MCP;
|
||||
return fMatConstPropNames;
|
||||
}
|
||||
// Accessors required for persistency purposes
|
||||
const std::vector<G4MaterialPropertyVector*>& GetProperties() const
|
||||
{
|
||||
return fMP;
|
||||
}
|
||||
const std::vector<std::pair<G4double, G4bool>>& GetConstProperties()
|
||||
const
|
||||
{
|
||||
return fMCP;
|
||||
}
|
||||
// return references to the vectors of material (constant) properties.
|
||||
|
||||
private:
|
||||
G4MaterialPropertyVector* CalculateGROUPVEL();
|
||||
// Calculate the group velocity based on RINDEX
|
||||
|
||||
std::map<G4int, G4MaterialPropertyVector*, std::less<G4int>> MP;
|
||||
typedef std::map<G4int, G4MaterialPropertyVector*,
|
||||
std::less<G4int>>::const_iterator MPiterator;
|
||||
std::vector<G4MaterialPropertyVector*> fMP;
|
||||
// Vector of pointer to material property vectors. All entries are
|
||||
// initialized to nullptr. Pointer is not null when mat.prop. vector defined.
|
||||
// Order of entries in MP defined by enum in G4MaterialPropertiesIndex.
|
||||
|
||||
std::map<G4int, G4double, std::less<G4int>> MCP;
|
||||
typedef std::map<G4int, G4double, std::less<G4int>>::const_iterator
|
||||
MCPiterator;
|
||||
// material property map and constant property map by index types
|
||||
std::vector<std::pair<G4double, G4bool>> fMCP;
|
||||
// Vector of energy-independent (i.e., "constant") material properties. We
|
||||
// need to keep track if a property is defined or not: the bool in the pair
|
||||
// is 'true' if the property is defined.
|
||||
// Order of entries in MCP defined by enum in G4MaterialPropertiesIndex.
|
||||
|
||||
std::vector<G4String> G4MaterialPropertyName;
|
||||
std::vector<G4String> G4MaterialConstPropertyName;
|
||||
std::vector<G4String> fMatPropNames;
|
||||
std::vector<G4String> fMatConstPropNames;
|
||||
// vectors of strings of property names
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user