Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4INCL::NuclearDensityFactory Class Reference

#include <G4INCLNuclearDensityFactory.hh>

Static Public Member Functions

static NuclearDensitycreateDensity (const G4int A, const G4int Z)
 
static InverseInterpolationTablecreateRPCorrelationTable (const G4int A, const G4int Z)
 
static InverseInterpolationTablecreateRCDFTable (const G4int A, const G4int Z)
 
static InverseInterpolationTablecreatePCDFTable (const G4int A, const G4int Z)
 
static ParticleSamplercreateParticleSampler (const G4int A, const G4int Z)
 
static void clearCache ()
 

Protected Member Functions

 NuclearDensityFactory ()
 
 ~NuclearDensityFactory ()
 

Static Protected Attributes

static std::map< G4int, NuclearDensity * > nuclearDensityCache
 
static std::map< G4int, InverseInterpolationTable * > rpCorrelationTableCache
 
static std::map< G4int, InverseInterpolationTable * > rCDFTableCache
 
static std::map< G4int, InverseInterpolationTable * > pCDFTableCache
 

Detailed Description

Definition at line 49 of file G4INCLNuclearDensityFactory.hh.

Constructor & Destructor Documentation

◆ NuclearDensityFactory()

G4INCL::NuclearDensityFactory::NuclearDensityFactory ( )
inlineprotected

Definition at line 81 of file G4INCLNuclearDensityFactory.hh.

81{}

◆ ~NuclearDensityFactory()

G4INCL::NuclearDensityFactory::~NuclearDensityFactory ( )
inlineprotected

Definition at line 82 of file G4INCLNuclearDensityFactory.hh.

82{}

Member Function Documentation

◆ clearCache()

static void G4INCL::NuclearDensityFactory::clearCache ( )
inlinestatic

Definition at line 61 of file G4INCLNuclearDensityFactory.hh.

61 {
62 for(std::map<G4int,NuclearDensity*>::const_iterator i = nuclearDensityCache.begin(); i!=nuclearDensityCache.end(); ++i)
63 delete i->second;
64 nuclearDensityCache.clear();
65
66 for(std::map<G4int,InverseInterpolationTable*>::const_iterator i = rpCorrelationTableCache.begin(); i!=rpCorrelationTableCache.end(); ++i)
67 delete i->second;
69
70 for(std::map<G4int,InverseInterpolationTable*>::const_iterator i = rCDFTableCache.begin(); i!=rCDFTableCache.end(); ++i)
71 delete i->second;
72 rCDFTableCache.clear();
73
74 for(std::map<G4int,InverseInterpolationTable*>::const_iterator i = pCDFTableCache.begin(); i!=pCDFTableCache.end(); ++i)
75 delete i->second;
76 pCDFTableCache.clear();
77 }
static std::map< G4int, InverseInterpolationTable * > rCDFTableCache
static std::map< G4int, NuclearDensity * > nuclearDensityCache
static std::map< G4int, InverseInterpolationTable * > rpCorrelationTableCache
static std::map< G4int, InverseInterpolationTable * > pCDFTableCache

Referenced by G4INCL::INCL::~INCL().

◆ createDensity()

NuclearDensity * G4INCL::NuclearDensityFactory::createDensity ( const G4int  A,
const G4int  Z 
)
static

Definition at line 56 of file G4INCLNuclearDensityFactory.cc.

56 {
57 const G4int nuclideID = 1000*Z + A; // MCNP-style nuclide IDs
58 const std::map<G4int,NuclearDensity*>::const_iterator mapEntry = nuclearDensityCache.find(nuclideID);
59 if(mapEntry == nuclearDensityCache.end()) {
60 InverseInterpolationTable *rpCorrelationTable = NuclearDensityFactory::createRPCorrelationTable(A, Z);
61 if(!rpCorrelationTable)
62 return NULL;
63 NuclearDensity *density = new NuclearDensity(A, Z, rpCorrelationTable);
64 nuclearDensityCache[nuclideID] = density;
65 return density;
66 } else {
67 return mapEntry->second;
68 }
69 }
int G4int
Definition: G4Types.hh:66
static InverseInterpolationTable * createRPCorrelationTable(const G4int A, const G4int Z)

Referenced by G4INCL::Nucleus::Nucleus().

◆ createParticleSampler()

ParticleSampler * G4INCL::NuclearDensityFactory::createParticleSampler ( const G4int  A,
const G4int  Z 
)
static

Definition at line 196 of file G4INCLNuclearDensityFactory.cc.

196 {
197 InverseInterpolationTable *rCDFTable = NuclearDensityFactory::createRCDFTable(A, Z);
198 InverseInterpolationTable *pCDFTable = NuclearDensityFactory::createPCDFTable(A, Z);
199 return new ParticleSampler(A, Z, rCDFTable, pCDFTable);
200 }
static InverseInterpolationTable * createPCDFTable(const G4int A, const G4int Z)
static InverseInterpolationTable * createRCDFTable(const G4int A, const G4int Z)

Referenced by G4INCL::Cluster::Cluster().

◆ createPCDFTable()

InverseInterpolationTable * G4INCL::NuclearDensityFactory::createPCDFTable ( const G4int  A,
const G4int  Z 
)
static

Definition at line 166 of file G4INCLNuclearDensityFactory.cc.

166 {
167 const G4int nuclideID = 1000*Z + A; // MCNP-style nuclide IDs
168 const std::map<G4int,InverseInterpolationTable*>::const_iterator mapEntry = pCDFTableCache.find(nuclideID);
169 if(mapEntry == pCDFTableCache.end()) {
170 IFunction1D *pDensityFunction;
171 if(A > 19) {
172 pDensityFunction = new NuclearDensityFunctions::HardSphere(PhysicalConstants::Pf);
173 } else if(A <= 19 && A > 2) { // Gaussian distribution for light nuclei
175 pDensityFunction = new NuclearDensityFunctions::Gaussian(5.*momentumRMS, momentumRMS);
176 } else if(A == 2 && Z == 1) { // density from the Paris potential for deuterons
177 pDensityFunction = new NuclearDensityFunctions::ParisP();
178 } else {
179 ERROR("No nuclear density function for target A = "
180 << A << " Z = " << Z << std::endl);
181 return NULL;
182 }
183
184 InverseInterpolationTable *theTable = pDensityFunction->inverseCDFTable();
185 delete pDensityFunction;
186 DEBUG("Creating inverse momentum CDF for A=" << A << ", Z=" << Z << ":" <<
187 std::endl << theTable->print() << std::endl);
188
189 pCDFTableCache[nuclideID] = theTable;
190 return theTable;
191 } else {
192 return mapEntry->second;
193 }
194 }
#define DEBUG(x)
#define ERROR(x)
double G4double
Definition: G4Types.hh:64
static G4double getMomentumRMS(const G4int A, const G4int Z)
Return the RMS of the momentum distribution (light clusters)
const G4double oneOverSqrtThree
const G4double Pf
Fermi momentum [MeV/c].

Referenced by createParticleSampler().

◆ createRCDFTable()

InverseInterpolationTable * G4INCL::NuclearDensityFactory::createRCDFTable ( const G4int  A,
const G4int  Z 
)
static

Definition at line 126 of file G4INCLNuclearDensityFactory.cc.

126 {
127 const G4int nuclideID = 1000*Z + A; // MCNP-style nuclide IDs
128 const std::map<G4int,InverseInterpolationTable*>::const_iterator mapEntry = rCDFTableCache.find(nuclideID);
129 if(mapEntry == rCDFTableCache.end()) {
130
131 IFunction1D *rDensityFunction;
132 if(A > 19) {
136 rDensityFunction = new NuclearDensityFunctions::WoodsSaxon(radius, maximumRadius, diffuseness);
137 } else if(A <= 19 && A > 6) {
141 rDensityFunction = new NuclearDensityFunctions::ModifiedHarmonicOscillator(radius, maximumRadius, diffuseness);
142 } else if(A <= 6 && A > 2) { // Gaussian distribution for light nuclei
145 rDensityFunction = new NuclearDensityFunctions::Gaussian(maximumRadius, Math::oneOverSqrtThree * radius);
146 } else if(A == 2 && Z == 1) { // density from the Paris potential for deuterons
147 rDensityFunction = new NuclearDensityFunctions::ParisR();
148 } else {
149 ERROR("No nuclear density function for target A = "
150 << A << " Z = " << Z << std::endl);
151 return NULL;
152 }
153
154 InverseInterpolationTable *theTable = rDensityFunction->inverseCDFTable();
155 delete rDensityFunction;
156 DEBUG("Creating inverse position CDF for A=" << A << ", Z=" << Z << ":" <<
157 std::endl << theTable->print() << std::endl);
158
159 rCDFTableCache[nuclideID] = theTable;
160 return theTable;
161 } else {
162 return mapEntry->second;
163 }
164 }
static G4double getRadiusParameter(const G4int A, const G4int Z)
static G4double getMaximumNuclearRadius(const G4int A, const G4int Z)
static G4double getSurfaceDiffuseness(const G4int A, const G4int Z)

Referenced by createParticleSampler().

◆ createRPCorrelationTable()

InverseInterpolationTable * G4INCL::NuclearDensityFactory::createRPCorrelationTable ( const G4int  A,
const G4int  Z 
)
static

Definition at line 71 of file G4INCLNuclearDensityFactory.cc.

71 {
72 const G4int nuclideID = 1000*Z + A; // MCNP-style nuclide IDs
73 const std::map<G4int,InverseInterpolationTable*>::const_iterator mapEntry = rpCorrelationTableCache.find(nuclideID);
74 if(mapEntry == rpCorrelationTableCache.end()) {
75
76 IFunction1D *rpCorrelationFunction;
77 if(A > 19) {
79 const G4double diffuseness = ParticleTable::getSurfaceDiffuseness(A, Z);
80 const G4double maximumRadius = ParticleTable::getMaximumNuclearRadius(A, Z);
81 rpCorrelationFunction = new NuclearDensityFunctions::WoodsSaxonRP(radius, maximumRadius, diffuseness);
82 } else if(A <= 19 && A > 6) {
84 const G4double diffuseness = ParticleTable::getSurfaceDiffuseness(A, Z);
85 const G4double maximumRadius = ParticleTable::getMaximumNuclearRadius(A, Z);
86 rpCorrelationFunction = new NuclearDensityFunctions::ModifiedHarmonicOscillatorRP(radius, maximumRadius, diffuseness);
87 } else if(A <= 6 && A > 1) { // Gaussian distribution for light nuclei
89 const G4double maximumRadius = ParticleTable::getMaximumNuclearRadius(A, Z);
90 rpCorrelationFunction = new NuclearDensityFunctions::GaussianRP(maximumRadius, Math::oneOverSqrtThree * radius);
91 } else {
92 ERROR("No r-p correlation function for target A = "
93 << A << " Z = " << Z << std::endl);
94 return NULL;
95 }
96
97 class InverseCDFOneThird : public IFunction1D {
98 public:
99 InverseCDFOneThird(IFunction1D const * const f) :
100 IFunction1D(f->getXMinimum(), f->getXMaximum()),
101 theFunction(f),
102 normalisation(1./theFunction->integrate(xMin,xMax))
103 {}
104
105 G4double operator()(const G4double x) const {
106 return Math::pow13(normalisation * theFunction->integrate(xMin,x));
107 }
108 private:
109 IFunction1D const * const theFunction;
110 const G4double normalisation;
111 } *theInverseCDFOneThird = new InverseCDFOneThird(rpCorrelationFunction);
112
113 InverseInterpolationTable *theTable = new InverseInterpolationTable(*theInverseCDFOneThird);
114 delete theInverseCDFOneThird;
115 delete rpCorrelationFunction;
116 DEBUG("Creating r-p correlation function for A=" << A << ", Z=" << Z << ":"
117 << std::endl << theTable->print() << std::endl);
118
119 rpCorrelationTableCache[nuclideID] = theTable;
120 return theTable;
121 } else {
122 return mapEntry->second;
123 }
124 }

Referenced by createDensity().

Member Data Documentation

◆ nuclearDensityCache

std::map< G4int, NuclearDensity * > G4INCL::NuclearDensityFactory::nuclearDensityCache
staticprotected

Definition at line 84 of file G4INCLNuclearDensityFactory.hh.

Referenced by clearCache(), and createDensity().

◆ pCDFTableCache

std::map< G4int, InverseInterpolationTable * > G4INCL::NuclearDensityFactory::pCDFTableCache
staticprotected

Definition at line 88 of file G4INCLNuclearDensityFactory.hh.

Referenced by clearCache(), and createPCDFTable().

◆ rCDFTableCache

std::map< G4int, InverseInterpolationTable * > G4INCL::NuclearDensityFactory::rCDFTableCache
staticprotected

Definition at line 87 of file G4INCLNuclearDensityFactory.hh.

Referenced by clearCache(), and createRCDFTable().

◆ rpCorrelationTableCache

std::map< G4int, InverseInterpolationTable * > G4INCL::NuclearDensityFactory::rpCorrelationTableCache
staticprotected

Definition at line 86 of file G4INCLNuclearDensityFactory.hh.

Referenced by clearCache(), and createRPCorrelationTable().


The documentation for this class was generated from the following files: