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
@@ -52,7 +52,7 @@ const G4int NDENSELEM = 98;
class G4DensityEffectData
{
public:
explicit G4DensityEffectData();
G4DensityEffectData();
~G4DensityEffectData() = default;
+137 -47
View File
@@ -28,18 +28,24 @@
// GEANT4 Class file
//
// Description: Data structure for cross sections, shell cross sections,
// isotope cross sections. Control of vector size should be
// performed in user code, no protection in this class
// isotope cross sections. Data access via integer variable
// Z (atomic number in majority of applications), which may
// be in the interval 0 <= Z < length. For isotope like
// data a second parameter idx or data ID code are used.
// In most cases ID = A - atomic weight number.
// There are run time const methods, in which input is not checked
// assuming responsibility of consumer code. Another run time
// check input and may throwgh a fatal exception
//
// Author: V.Ivanchenko 10.03.2011
//
// Modifications:
// Modifications: 30.09.2023 Extended functionality, data size defined in constructor
//
//----------------------------------------------------------------------------
//
#ifndef ElementData_h
#define ElementData_h 1
#ifndef G4ElementData_h
#define G4ElementData_h 1
#include "G4Physics2DVector.hh"
#include "G4PhysicsVector.hh"
@@ -50,7 +56,7 @@
class G4ElementData
{
public:
explicit G4ElementData();
explicit G4ElementData(G4int length = 99);
~G4ElementData();
@@ -67,92 +73,176 @@ class G4ElementData
// reserve vector of components
void InitialiseForComponent(G4int Z, G4int nComponents = 0);
// reserve vector of 2D components
void InitialiseFor2DComponent(G4int Z, G4int nComponents = 0);
// prepare vector of components
void AddComponent(G4int Z, G4int id, G4PhysicsVector* v);
// set name of the dataset
void SetName(const G4String& nam);
// prepare vector of 2D components
void Add2DComponent(G4int Z, G4int id, G4Physics2DVector* v);
// set name of the dataset (optional)
inline void SetName(const G4String& nam);
//--------------------------------------------------------------
//
// run time methods - no check on validity of input index
// run time const methods - no check on validity of input
// it is a responsibility of the consume code to check the input
//
//--------------------------------------------------------------
// get name of the dataset
inline const G4String& GetName() const;
// get vector for the element
inline G4PhysicsVector* GetElementData(G4int Z);
inline G4PhysicsVector* GetElementData(G4int Z) const;
// get 2-D vector for the element
inline G4Physics2DVector* GetElement2DData(G4int Z);
inline G4Physics2DVector* GetElement2DData(G4int Z) const;
// get vector per shell or per isotope
inline G4PhysicsVector* GetComponentDataByID(G4int Z, G4int id) const;
// get vector per shell or per isotope
inline G4Physics2DVector* Get2DComponentDataByID(G4int Z, G4int id) const;
// return cross section per element
inline G4double GetValueForElement(G4int Z, G4double kinEnergy) const;
//--------------------------------------------------------------
// run time const methods with input parameters control
//--------------------------------------------------------------
// get number of components for the element
inline size_t GetNumberOfComponents(G4int Z);
inline std::size_t GetNumberOfComponents(G4int Z) const;
// get number of 2D components for the element
inline std::size_t GetNumberOf2DComponents(G4int Z) const;
// get component ID which may be number of nucleons,
// or shell number, or any other integer
inline G4int GetComponentID(G4int Z, G4int idx);
inline G4int GetComponentID(G4int Z, std::size_t idx) const;
// get vector per shell or per isotope
inline G4PhysicsVector* GetComponentDataByIndex(G4int Z, G4int idx);
inline G4PhysicsVector*
GetComponentDataByIndex(G4int Z, std::size_t idx) const;
// get vector per shell or per isotope
inline G4PhysicsVector* GetComponentDataByID(G4int Z, G4int id);
inline G4Physics2DVector*
Get2DComponentDataByIndex(G4int Z, std::size_t idx) const;
// return cross section per element
// if not available return zero
inline G4double GetValueForElement(G4int Z, G4double kinEnergy);
// return cross section per element
// if not available return zero
inline G4double GetValueForComponent(G4int Z, G4int idx, G4double kinEnergy);
inline G4double
GetValueForComponent(G4int Z, std::size_t idx, G4double kinEnergy) const;
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 = "";
void DataError(G4int Z, const G4String&);
const G4int maxNumElm;
std::vector<G4PhysicsVector*> elmData;
std::vector<G4Physics2DVector*> elm2Data;
std::vector<std::vector<std::pair<G4int, G4PhysicsVector*> >* > compData;
std::vector<std::vector<std::pair<G4int, G4Physics2DVector*> >* > comp2D;
G4String name{""};
};
inline void G4ElementData::SetName(const G4String& nam) { name = nam; }
//--------------------------------------------------------------
// run time const methods without check on validity of input
//--------------------------------------------------------------
inline G4PhysicsVector* G4ElementData::GetElementData(G4int Z) { return elmData[Z]; }
inline G4Physics2DVector* G4ElementData::GetElement2DData(G4int Z) { return elm2Data[Z]; }
inline size_t G4ElementData::GetNumberOfComponents(G4int Z) { return compID[Z]->size(); }
inline G4int G4ElementData::GetComponentID(G4int Z, G4int idx) { return (*(compID[Z]))[idx]; }
inline G4PhysicsVector* G4ElementData::GetComponentDataByIndex(G4int Z, G4int idx)
inline void G4ElementData::SetName(const G4String& nam)
{
return (*(compData[Z]))[idx];
name = nam;
}
inline G4PhysicsVector* G4ElementData::GetComponentDataByID(G4int Z, G4int id)
inline const G4String& G4ElementData::GetName() const
{
return name;
}
inline G4PhysicsVector* G4ElementData::GetElementData(G4int Z) const
{
return elmData[Z];
}
inline G4Physics2DVector* G4ElementData::GetElement2DData(G4int Z) const
{
return elm2Data[Z];
}
inline G4PhysicsVector*
G4ElementData::GetComponentDataByID(G4int Z, G4int id) const
{
G4PhysicsVector* v = nullptr;
for (G4int i = 0; i < compLength[Z]; ++i) {
if (id == (*(compID[Z]))[i]) {
v = (*(compData[Z]))[i];
for (auto const & p : *(compData[Z])) {
if (id == p.first) {
v = p.second;
break;
}
}
return v;
}
inline G4double G4ElementData::GetValueForElement(G4int Z, G4double kinEnergy)
inline G4Physics2DVector*
G4ElementData::Get2DComponentDataByID(G4int Z, G4int id) const
{
G4Physics2DVector* v = nullptr;
for (auto const & p : *(comp2D[Z])) {
if (id == p.first) {
v = p.second;
break;
}
}
return v;
}
inline G4double
G4ElementData::GetValueForElement(G4int Z, G4double kinEnergy) const
{
return elmData[Z]->Value(kinEnergy);
}
inline G4double G4ElementData::GetValueForComponent(G4int Z, G4int idx, G4double kinEnergy)
//--------------------------------------------------------------
// run time const methods with check on validity of input
//--------------------------------------------------------------
inline std::size_t G4ElementData::GetNumberOfComponents(G4int Z) const
{
return (*(compData[Z]))[idx]->Value(kinEnergy);
return (nullptr != compData[Z]) ? compData[Z]->size() : 0;
}
inline std::size_t G4ElementData::GetNumberOf2DComponents(G4int Z) const
{
return (nullptr != comp2D[Z]) ? comp2D[Z]->size() : 0;
}
inline G4int G4ElementData::GetComponentID(G4int Z, std::size_t idx) const
{
return (idx < GetNumberOfComponents(Z)) ? (*(compData[Z]))[idx].first : 0;
}
inline G4PhysicsVector*
G4ElementData::GetComponentDataByIndex(G4int Z, std::size_t idx) const
{
return
(idx < GetNumberOfComponents(Z)) ? (*(compData[Z]))[idx].second : nullptr;
}
inline G4Physics2DVector*
G4ElementData::Get2DComponentDataByIndex(G4int Z, std::size_t idx) const
{
return
(idx < GetNumberOf2DComponents(Z)) ? (*(comp2D[Z]))[idx].second : nullptr;
}
inline G4double
G4ElementData::GetValueForComponent(G4int Z, std::size_t idx, G4double e) const
{
return (idx < GetNumberOfComponents(Z)) ?
(*(compData[Z]))[idx].second->Value(e) : 0.0;
}
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// 26 August 2023 V.Ivanchenko
//
// This is a singleton class to store shared G4ElementData
//
#ifndef G4ElementDataRegistry_h
#define G4ElementDataRegistry_h 1
#include <vector>
#include "G4ElementData.hh"
class G4ElementDataRegistry
{
public:
static G4ElementDataRegistry* Instance();
~G4ElementDataRegistry();
void RegisterMe(G4ElementData* p);
void RemoveMe(G4ElementData* p);
const std::vector<G4ElementData*>& GetElementData() const {
return elmdata;
}
G4ElementData* GetElementDataByName(const G4String&);
private:
G4ElementDataRegistry();
static G4ElementDataRegistry* instance;
std::vector<G4ElementData*> elmdata;
};
#endif
@@ -54,7 +54,8 @@
class G4ICRU90StoppingData
{
public:
explicit G4ICRU90StoppingData();
G4ICRU90StoppingData();
~G4ICRU90StoppingData();
@@ -79,11 +80,12 @@ class G4ICRU90StoppingData
inline G4bool IsApplicable(const G4Material*) const;
private:
inline G4double GetDEDX(G4PhysicsFreeVector*, G4double e) const;
inline G4double GetDEDX(const G4PhysicsFreeVector*, G4double e) const;
void FillData();
G4PhysicsFreeVector* AddData(G4int n, const G4double* e, const G4float* dedx);
G4PhysicsFreeVector* AddData(G4int n, const G4float* e, const G4float* dedx);
static constexpr G4int nvectors = 3;
const G4Material* materials[nvectors];
@@ -96,7 +98,7 @@ class G4ICRU90StoppingData
inline G4bool G4ICRU90StoppingData::IsApplicable(const G4Material* mat) const
{
return (mat == materials[0] || mat == materials[1] || mat == materials[2]);
return (mat == materials[1] || mat == materials[0] || mat == materials[2]);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -104,12 +106,12 @@ inline G4bool G4ICRU90StoppingData::IsApplicable(const G4Material* mat) const
inline G4int G4ICRU90StoppingData::GetIndex(const G4Material* mat) const
{
G4int idx = -1;
if (mat == materials[0]) {
idx = 0;
}
else if (mat == materials[1]) {
if (mat == materials[1]) {
idx = 1;
}
else if (mat == materials[0]) {
idx = 0;
}
else if (mat == materials[2]) {
idx = 2;
}
@@ -121,12 +123,12 @@ inline G4int G4ICRU90StoppingData::GetIndex(const G4Material* mat) const
inline G4int G4ICRU90StoppingData::GetIndex(const G4String& nam) const
{
G4int idx = -1;
if (nam == materials[0]->GetName()) {
idx = 0;
}
else if (nam == materials[1]->GetName()) {
if (nam == materials[1]->GetName()) {
idx = 1;
}
else if (nam == materials[0]->GetName()) {
idx = 0;
}
else if (nam == materials[2]->GetName()) {
idx = 2;
}
@@ -135,10 +137,11 @@ inline G4int G4ICRU90StoppingData::GetIndex(const G4String& nam) const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4ICRU90StoppingData::GetDEDX(G4PhysicsFreeVector* data, G4double e) const
inline G4double G4ICRU90StoppingData::GetDEDX(const G4PhysicsFreeVector* data,
G4double e) const
{
G4double emin = data->Energy(0);
return (e <= emin) ? (*data)[0] * std::sqrt(e / emin) : data->Value(e);
const G4double emin = data->Energy(0);
return (e >= emin) ? data->Value(e) : (*data)[0] * std::sqrt(e / emin);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -146,7 +149,7 @@ inline G4double G4ICRU90StoppingData::GetDEDX(G4PhysicsFreeVector* data, G4doubl
inline G4double G4ICRU90StoppingData::GetElectronicDEDXforProton(
G4int idx, G4double kinEnergy) const
{
return (idx < 0 || idx >= nvectors) ? 0.0 : GetDEDX(sdata_proton[idx], kinEnergy);
return (idx >= 0 && idx < nvectors) ? GetDEDX(sdata_proton[idx], kinEnergy) : 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -154,7 +157,7 @@ inline G4double G4ICRU90StoppingData::GetElectronicDEDXforProton(
inline G4double G4ICRU90StoppingData::GetElectronicDEDXforAlpha(
G4int idx, G4double scaledKinEnergy) const
{
return (idx < 0 || idx >= nvectors) ? 0.0 : GetDEDX(sdata_alpha[idx], scaledKinEnergy);
return (idx >= 0 && idx < nvectors) ? GetDEDX(sdata_alpha[idx], scaledKinEnergy) : 0.0;
}
#endif
+13 -11
View File
@@ -144,6 +144,14 @@ class G4Material
virtual ~G4Material();
// These methods allow customisation of corrections to ionisation
// computations. Free electron density above zero means that the material
// is a conductor. Computation of density effect correction of fly
// may be more accurate but require extra computations.
void SetChemicalFormula(const G4String& chF);
void SetFreeElectronDensity(G4double val);
void ComputeDensityEffectOnFly(G4bool val);
G4Material(const G4Material&) = delete;
const G4Material& operator=(const G4Material&) = delete;
@@ -169,7 +177,7 @@ class G4Material
inline G4double GetPressure() const { return fPressure; }
// number of elements constituing this material:
inline size_t GetNumberOfElements() const { return fNumberOfElements; }
inline std::size_t GetNumberOfElements() const { return fNumberOfElements; }
// vector of pointers to elements constituing this material:
inline const G4ElementVector* GetElementVector() const { return theElementVector; }
@@ -215,12 +223,6 @@ class G4Material
// for chemical compound
inline G4double GetMassOfMolecule() const { return fMassOfMolecule; }
void SetChemicalFormula(const G4String& chF);
void SetFreeElectronDensity(G4double val);
void ComputeDensityEffectOnFly(G4bool);
// meaningful only for single material:
G4double GetZ() const;
G4double GetA() const;
@@ -234,12 +236,12 @@ class G4Material
}
// the index of this material in the Table:
inline size_t GetIndex() const { return fIndexInTable; }
inline std::size_t GetIndex() const { return fIndexInTable; }
// the static Table of Materials:
static G4MaterialTable* GetMaterialTable();
static size_t GetNumberOfMaterials();
static std::size_t GetNumberOfMaterials();
// return pointer to a material, given its name:
static G4Material* GetMaterial(const G4String& name, G4bool warning = true);
@@ -248,7 +250,7 @@ class G4Material
static G4Material* GetMaterial(G4double z, G4double a, G4double dens);
// return pointer to a composit material, given its propeties:
static G4Material* GetMaterial(size_t nComp, G4double dens);
static G4Material* GetMaterial(std::size_t nComp, G4double dens);
// printing methods
friend std::ostream& operator<<(std::ostream&, const G4Material*);
@@ -312,7 +314,7 @@ class G4Material
G4double fMassOfMolecule; // Correct for materials built by atoms count
G4State fState; // Material state
size_t fIndexInTable; // Index in the material table
std::size_t fIndexInTable; // Index in the material table
G4int fNumberOfElements; // Number of G4Elements in the material
// Class members used only at initialisation
@@ -131,6 +131,24 @@ enum G4MaterialConstPropertyIndex
kCOATEDTHICKNESS, // thickness of the thin layer in case of coated
kCOATEDFRUSTRATEDTRANSMISSION,// for incident angle superior to limit angle, use frustrated transmission (if true)
// or total reflection (if false)
kPROTONSCINTILLATIONTIMECONSTANT1, // these are per-particle time constants for
kPROTONSCINTILLATIONTIMECONSTANT2, // particle-dependent scintillation
kPROTONSCINTILLATIONTIMECONSTANT3, // "
kDEUTERONSCINTILLATIONTIMECONSTANT1, // "
kDEUTERONSCINTILLATIONTIMECONSTANT2, // "
kDEUTERONSCINTILLATIONTIMECONSTANT3, // "
kTRITONSCINTILLATIONTIMECONSTANT1, // "
kTRITONSCINTILLATIONTIMECONSTANT2, // "
kTRITONSCINTILLATIONTIMECONSTANT3, // "
kALPHASCINTILLATIONTIMECONSTANT1, // "
kALPHASCINTILLATIONTIMECONSTANT2, // "
kALPHASCINTILLATIONTIMECONSTANT3, // "
kIONSCINTILLATIONTIMECONSTANT1, // "
kIONSCINTILLATIONTIMECONSTANT2, // "
kIONSCINTILLATIONTIMECONSTANT3, // "
kELECTRONSCINTILLATIONTIMECONSTANT1, // "
kELECTRONSCINTILLATIONTIMECONSTANT2, // "
kELECTRONSCINTILLATIONTIMECONSTANT3, // "
kNumberOfConstPropertyIndex // the number of G4MaterialConstPropertyIndex
};
@@ -22,9 +22,10 @@
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// G4MicroElecMaterialStructure.hh, 2011/08/29 A.Valentin, M. Raine are with CEA [a]
// 2020/05/20 P. Caron, C. Inguimbert are with ONERA [b]
// 2020/05/20 P. Caron, C. Inguimbert are with ONERA [b]
// Q. Gibaru is with CEA [a], ONERA [b] and CNES [c]
// M. Raine and D. Lambert are with CEA [a]
//
@@ -34,7 +35,7 @@
// [c] CNES, 18 av.E.Belin, 31401 Toulouse CEDEX, France
//
// Based on the following publications
// - A.Valentin, M. Raine,
// - A.Valentin, M. Raine,
// Inelastic cross-sections of low energy electrons in silicon
// for the simulation of heavy ion tracks with the Geant4-DNA toolkit,
// NSS Conf. Record 2010, pp. 80-85
@@ -49,40 +50,42 @@
// https://doi.org/10.1016/j.nimb.2012.07.028
//
// - M. Raine, M. Gaillardin, P. Paillet
// Geant4 physics processes for silicon microdosimetry simulation:
// Geant4 physics processes for silicon microdosimetry simulation:
// Improvements and extension of the energy-range validity up to 10 GeV/nucleon
// NIM B, vol. 325, pp. 97-100, 2014
// https://doi.org/10.1016/j.nimb.2014.01.014
//
// - J. Pierron, C. Inguimbert, M. Belhaj, T. Gineste, J. Puech, M. Raine
// Electron emission yield for low energy electrons:
// Electron emission yield for low energy electrons:
// Monte Carlo simulation and experimental comparison for Al, Ag, and Si
// Journal of Applied Physics 121 (2017) 215107.
// Journal of Applied Physics 121 (2017) 215107.
// https://doi.org/10.1063/1.4984761
//
// - P. Caron,
// Study of Electron-Induced Single-Event Upset in Integrated Memory Devices
// PHD, 16th October 2019
//
// - Q.Gibaru, C.Inguimbert, P.Caron, M.Raine, D.Lambert, J.Puech,
// Geant4 physics processes for microdosimetry and secondary electron emission simulation :
// - Q.Gibaru, C.Inguimbert, P.Caron, M.Raine, D.Lambert, J.Puech,
// Geant4 physics processes for microdosimetry and secondary electron emission simulation :
// Extension of MicroElec to very low energies and new materials
// NIM B, 2020, in review.
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef G4MICROELECMATERIALSTRUCTURE_HH
#define G4MICROELECMATERIALSTRUCTURE_HH 1
#ifndef G4MICROELECMATERIALSTRUCTURE_HH
#define G4MICROELECMATERIALSTRUCTURE_HH 1
#include "globals.hh"
#include "G4Material.hh"
#include "globals.hh"
#include <vector>
class G4MicroElecMaterialStructure
{
public:
public:
G4MicroElecMaterialStructure(const G4String& matName = "");
virtual ~G4MicroElecMaterialStructure() = default;
void ReadMaterialFile();
G4double Energy(G4int level);
G4int NumberOfLevels() { return nLevels; }
@@ -94,14 +97,15 @@ class G4MicroElecMaterialStructure
G4double GetWorkFunction() { return workFunction; };
G4String GetMaterialName() { return materialName; };
G4double GetLimitEnergy(G4int level);
G4double GetElasticModelLowLimit() { return limitElastic[0]; }
G4double GetElasticModelHighLimit() { return limitElastic[1]; }
G4double GetElasticModelLowLimit() {return flimitElastic[0];}
G4double GetElasticModelHighLimit() { return flimitElastic[1]; }
G4double GetInelasticModelLowLimit(G4int pdg);
G4double GetInelasticModelHighLimit(G4int pdg);
G4bool IsShellWeaklyBound(G4int level);
private:
G4int nLevels = 3; // Number of levels of material
private:
// private elements
G4int nLevels = 3; // Number of levels of material
G4bool isCompound = false;
G4String materialName = "";
std::vector<G4bool> isShellWeaklyBoundVector;
@@ -113,8 +117,8 @@ class G4MicroElecMaterialStructure
std::vector<G4double> compoundShellZ;
G4double Z = 0.0;
G4double energyGap = 0.0;
G4double limitElastic[2] = {0, 0};
G4double limitInelastic[4] = {0, 0, 0, 0};
G4double flimitElastic[2] = { 0,0 };
G4double flimitInelastic[4] = { 0,0,0,0 };
};
#endif
#endif
+1 -1
View File
@@ -255,7 +255,7 @@ class G4NistManager
G4ICRU90StoppingData* GetICRU90StoppingData();
private:
explicit G4NistManager();
G4NistManager();
static G4NistManager* instance;