Geant4-11
Namespaces | Functions
G4INCL::NuclearDensityFactory Namespace Reference

Namespaces

namespace  anonymous_namespace{G4INCLNuclearDensityFactory.cc}
 

Functions

void addDensityToCache (const G4int A, const G4int Z, NuclearDensity *const density)
 
void addRPCorrelationToCache (const G4int A, const G4int Z, const ParticleType t, InterpolationTable *const table)
 
void clearCache ()
 
NuclearDensity const * createDensity (const G4int A, const G4int Z, const G4int S)
 
InterpolationTablecreatePCDFTable (const ParticleType t, const G4int A, const G4int Z)
 
InterpolationTablecreateRCDFTable (const ParticleType t, const G4int A, const G4int Z)
 
InterpolationTablecreateRPCorrelationTable (const ParticleType t, const G4int A, const G4int Z)
 

Function Documentation

◆ addDensityToCache()

void G4INCL::NuclearDensityFactory::addDensityToCache ( const G4int  A,
const G4int  Z,
NuclearDensity *const  density 
)

Definition at line 221 of file G4INCLNuclearDensityFactory.cc.

221 {
223 nuclearDensityCache = new std::map<G4int,NuclearDensity const *>;
224
225 const G4int nuclideID = 1000*Z + A; // MCNP-style nuclide IDs
226 const std::map<G4int,NuclearDensity const *>::const_iterator mapEntry = nuclearDensityCache->find(nuclideID);
227 if(mapEntry != nuclearDensityCache->end())
228 delete mapEntry->second;
229
230 (*nuclearDensityCache)[nuclideID] = density;
231 }
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
const G4double A[17]

References A, G4INCL::NuclearDensityFactory::anonymous_namespace{G4INCLNuclearDensityFactory.cc}::nuclearDensityCache, and Z.

◆ addRPCorrelationToCache()

void G4INCL::NuclearDensityFactory::addRPCorrelationToCache ( const G4int  A,
const G4int  Z,
const ParticleType  t,
InterpolationTable *const  table 
)

Definition at line 207 of file G4INCLNuclearDensityFactory.cc.

207 {
208// assert(t==Proton || t==Neutron || t==Lambda);
209
211 rpCorrelationTableCache = new std::map<G4int,InterpolationTable*>;
212
213 const G4int nuclideID = ((t==Proton) ? 1000 : -1000)*Z + A; // MCNP-style nuclide IDs
214 const std::map<G4int,InterpolationTable*>::const_iterator mapEntry = rpCorrelationTableCache->find(nuclideID);
215 if(mapEntry != rpCorrelationTableCache->end())
216 delete mapEntry->second;
217
218 (*rpCorrelationTableCache)[nuclideID] = table;
219 }

References A, G4INCL::Proton, G4INCL::NuclearDensityFactory::anonymous_namespace{G4INCLNuclearDensityFactory.cc}::rpCorrelationTableCache, and Z.

◆ clearCache()

void G4INCL::NuclearDensityFactory::clearCache ( )

Definition at line 233 of file G4INCLNuclearDensityFactory.cc.

233 {
234
236 for(std::map<G4int,NuclearDensity const *>::const_iterator i = nuclearDensityCache->begin(); i!=nuclearDensityCache->end(); ++i)
237 delete i->second;
238 nuclearDensityCache->clear();
239 delete nuclearDensityCache;
240 nuclearDensityCache = NULL;
241 }
242
244 for(std::map<G4int,InterpolationTable*>::const_iterator i = rpCorrelationTableCache->begin(); i!=rpCorrelationTableCache->end(); ++i)
245 delete i->second;
249 }
250
251 if(rCDFTableCache) {
252 for(std::map<G4int,InterpolationTable*>::const_iterator i = rCDFTableCache->begin(); i!=rCDFTableCache->end(); ++i)
253 delete i->second;
254 rCDFTableCache->clear();
255 delete rCDFTableCache;
256 rCDFTableCache = NULL;
257 }
258
259 if(pCDFTableCache) {
260 for(std::map<G4int,InterpolationTable*>::const_iterator i = pCDFTableCache->begin(); i!=pCDFTableCache->end(); ++i)
261 delete i->second;
262 pCDFTableCache->clear();
263 delete pCDFTableCache;
264 pCDFTableCache = NULL;
265 }
266 }

References G4INCL::NuclearDensityFactory::anonymous_namespace{G4INCLNuclearDensityFactory.cc}::nuclearDensityCache, G4INCL::NuclearDensityFactory::anonymous_namespace{G4INCLNuclearDensityFactory.cc}::pCDFTableCache, G4INCL::NuclearDensityFactory::anonymous_namespace{G4INCLNuclearDensityFactory.cc}::rCDFTableCache, and G4INCL::NuclearDensityFactory::anonymous_namespace{G4INCLNuclearDensityFactory.cc}::rpCorrelationTableCache.

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

◆ createDensity()

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

Definition at line 59 of file G4INCLNuclearDensityFactory.cc.

59 {
61 nuclearDensityCache = new std::map<G4int,NuclearDensity const *>;
62
63 const G4int nuclideID = 1000*Z + A; // MCNP-style nuclide IDs
64 const std::map<G4int,NuclearDensity const *>::const_iterator mapEntry = nuclearDensityCache->find(nuclideID);
65 if(mapEntry == nuclearDensityCache->end()) {
66 InterpolationTable *rpCorrelationTableProton = createRPCorrelationTable(Proton, A, Z);
67 InterpolationTable *rpCorrelationTableNeutron = createRPCorrelationTable(Neutron, A, Z);
68 InterpolationTable *rpCorrelationTableLambda = createRPCorrelationTable(Lambda, A, Z);
69 if(!rpCorrelationTableProton || !rpCorrelationTableNeutron || !rpCorrelationTableLambda)
70 return NULL;
71 NuclearDensity const *density = new NuclearDensity(A, Z, S, rpCorrelationTableProton, rpCorrelationTableNeutron, rpCorrelationTableLambda);
72 (*nuclearDensityCache)[nuclideID] = density;
73 return density;
74 } else {
75 return mapEntry->second;
76 }
77 }
G4double S(G4double temp)
Class for interpolating the of a 1-dimensional function.
InterpolationTable * createRPCorrelationTable(const ParticleType t, const G4int A, const G4int Z)

References A, createRPCorrelationTable(), G4INCL::Lambda, G4INCL::Neutron, G4INCL::NuclearDensityFactory::anonymous_namespace{G4INCLNuclearDensityFactory.cc}::nuclearDensityCache, G4INCL::Proton, S(), and Z.

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

◆ createPCDFTable()

InterpolationTable * G4INCL::NuclearDensityFactory::createPCDFTable ( const ParticleType  t,
const G4int  A,
const G4int  Z 
)

Definition at line 171 of file G4INCLNuclearDensityFactory.cc.

171 {
172// assert(t==Proton || t==Neutron || t==Lambda);
173
174 if(!pCDFTableCache)
175 pCDFTableCache = new std::map<G4int,InterpolationTable*>;
176
177 const G4int nuclideID = ((t==Proton) ? 1000 : -1000)*Z + A; // MCNP-style nuclide IDs
178 const std::map<G4int,InterpolationTable*>::const_iterator mapEntry = pCDFTableCache->find(nuclideID);
179 if(mapEntry == pCDFTableCache->end()) {
180 IFunction1D *pDensityFunction;
181 if(A > 19) {
182 const G4double theFermiMomentum = ParticleTable::getFermiMomentum(A, Z);
183 pDensityFunction = new NuclearDensityFunctions::HardSphere(theFermiMomentum);
184 } else if(A <= 19 && A > 2) { // Gaussian distribution for light nuclei
187 } else if(A == 2 && Z == 1) { // density from the Paris potential for deuterons
188 pDensityFunction = new NuclearDensityFunctions::ParisP();
189 } else {
190 INCL_ERROR("No nuclear density function for target A = "
191 << A << " Z = " << Z << '\n');
192 return NULL;
193 }
194
195 InterpolationTable *theTable = pDensityFunction->inverseCDFTable();
196 delete pDensityFunction;
197 INCL_DEBUG("Creating inverse momentum CDF for A=" << A << ", Z=" << Z << ":" <<
198 '\n' << theTable->print() << '\n');
199
200 (*pCDFTableCache)[nuclideID] = theTable;
201 return theTable;
202 } else {
203 return mapEntry->second;
204 }
205 }
#define INCL_ERROR(x)
#define INCL_DEBUG(x)
double G4double
Definition: G4Types.hh:83
InterpolationTable * inverseCDFTable(ManipulatorFunc fWrap=0, const G4int nNodes=60) const
Return a pointer to the inverse of the CDF of this function.
const G4double oneOverSqrtThree
const G4double momentumRMS[clusterTableZSize][clusterTableASize]
G4ThreadLocal FermiMomentumFn getFermiMomentum
G4double getMomentumRMS(const G4int A, const G4int Z)
Return the RMS of the momentum distribution (light clusters)

References A, G4INCL::ParticleTable::getFermiMomentum, G4INCL::ParticleTable::getMomentumRMS(), INCL_DEBUG, INCL_ERROR, G4INCL::IFunction1D::inverseCDFTable(), G4INCL::ParticleTable::anonymous_namespace{G4INCLParticleTable.cc}::momentumRMS, G4INCL::Math::oneOverSqrtThree, G4INCL::NuclearDensityFactory::anonymous_namespace{G4INCLNuclearDensityFactory.cc}::pCDFTableCache, G4INCL::InterpolationTable::print(), G4INCL::Proton, and Z.

Referenced by G4INCL::ParticleSampler::sampleParticlesIntoList().

◆ createRCDFTable()

InterpolationTable * G4INCL::NuclearDensityFactory::createRCDFTable ( const ParticleType  t,
const G4int  A,
const G4int  Z 
)

Definition at line 126 of file G4INCLNuclearDensityFactory.cc.

126 {
127// assert(t==Proton || t==Neutron || t==Lambda);
128
129 if(!rCDFTableCache)
130 rCDFTableCache = new std::map<G4int,InterpolationTable*>;
131
132 const G4int nuclideID = ((t==Proton) ? 1000 : -1000)*Z + A; // MCNP-style nuclide IDs
133 const std::map<G4int,InterpolationTable*>::const_iterator mapEntry = rCDFTableCache->find(nuclideID);
134 if(mapEntry == rCDFTableCache->end()) {
135
136 IFunction1D *rDensityFunction;
137 if(A > 19) {
141 rDensityFunction = new NuclearDensityFunctions::WoodsSaxon(radius, maximumRadius, diffuseness);
142 } else if(A <= 19 && A > 6) {
146 rDensityFunction = new NuclearDensityFunctions::ModifiedHarmonicOscillator(radius, maximumRadius, diffuseness);
147 } else if(A <= 6 && A > 2) { // Gaussian distribution for light nuclei
150 rDensityFunction = new NuclearDensityFunctions::Gaussian(maximumRadius, Math::oneOverSqrtThree * radius);
151 } else if(A == 2 && Z == 1) { // density from the Paris potential for deuterons
152 rDensityFunction = new NuclearDensityFunctions::ParisR();
153 } else {
154 INCL_ERROR("No nuclear density function for target A = "
155 << A << " Z = " << Z << '\n');
156 return NULL;
157 }
158
159 InterpolationTable *theTable = rDensityFunction->inverseCDFTable();
160 delete rDensityFunction;
161 INCL_DEBUG("Creating inverse position CDF for A=" << A << ", Z=" << Z << ":" <<
162 '\n' << theTable->print() << '\n');
163
164 (*rCDFTableCache)[nuclideID] = theTable;
165 return theTable;
166 } else {
167 return mapEntry->second;
168 }
169 }
G4double getRadiusParameter(const ParticleType t, const G4int A, const G4int Z)
G4double getMaximumNuclearRadius(const ParticleType t, const G4int A, const G4int Z)
G4double getSurfaceDiffuseness(const ParticleType t, const G4int A, const G4int Z)

References A, G4INCL::ParticleTable::getMaximumNuclearRadius(), G4INCL::ParticleTable::getRadiusParameter(), G4INCL::ParticleTable::getSurfaceDiffuseness(), INCL_DEBUG, INCL_ERROR, G4INCL::IFunction1D::inverseCDFTable(), G4INCL::Math::oneOverSqrtThree, G4INCL::InterpolationTable::print(), G4INCL::Proton, G4INCL::NuclearDensityFactory::anonymous_namespace{G4INCLNuclearDensityFactory.cc}::rCDFTableCache, and Z.

Referenced by G4INCL::ParticleSampler::sampleParticlesIntoList().

◆ createRPCorrelationTable()

InterpolationTable * G4INCL::NuclearDensityFactory::createRPCorrelationTable ( const ParticleType  t,
const G4int  A,
const G4int  Z 
)

Definition at line 79 of file G4INCLNuclearDensityFactory.cc.

79 {
80// assert(t==Proton || t==Neutron || t==Lambda);
81
83 rpCorrelationTableCache = new std::map<G4int,InterpolationTable*>;
84
85 const G4int nuclideID = ((t==Proton) ? 1000 : -1000)*Z + A; // MCNP-style nuclide IDs
86 const std::map<G4int,InterpolationTable*>::const_iterator mapEntry = rpCorrelationTableCache->find(nuclideID);
87 if(mapEntry == rpCorrelationTableCache->end()) {
88
89 INCL_DEBUG("Creating r-p correlation function for " << ((t==Proton) ? "protons" : ((t==Neutron) ? "neutrons" : "lambdas")) << " in A=" << A << ", Z=" << Z << std::endl);
90
91 IFunction1D *rpCorrelationFunction;
92 if(A > 19) {
94 const G4double diffuseness = ParticleTable::getSurfaceDiffuseness(t, A, Z);
95 const G4double maximumRadius = ParticleTable::getMaximumNuclearRadius(t, A, Z);
96 rpCorrelationFunction = new NuclearDensityFunctions::WoodsSaxonRP(radius, maximumRadius, diffuseness);
97 INCL_DEBUG(" ... Woods-Saxon; R0=" << radius << ", a=" << diffuseness << ", Rmax=" << maximumRadius << std::endl);
98 } else if(A <= 19 && A > 6) {
100 const G4double diffuseness = ParticleTable::getSurfaceDiffuseness(t, A, Z);
101 const G4double maximumRadius = ParticleTable::getMaximumNuclearRadius(t, A, Z);
102 rpCorrelationFunction = new NuclearDensityFunctions::ModifiedHarmonicOscillatorRP(radius, maximumRadius, diffuseness);
103 INCL_DEBUG(" ... MHO; param1=" << radius << ", param2=" << diffuseness << ", Rmax=" << maximumRadius << std::endl);
104 } else if(A <= 6 && A > 1) { // Gaussian distribution for light nuclei
105 const G4double radius = ParticleTable::getRadiusParameter(t, A, Z);
106 const G4double maximumRadius = ParticleTable::getMaximumNuclearRadius(t, A, Z);
107 rpCorrelationFunction = new NuclearDensityFunctions::GaussianRP(maximumRadius, Math::oneOverSqrtThree * radius);
108 INCL_DEBUG(" ... Gaussian; sigma=" << radius << ", Rmax=" << maximumRadius << std::endl);
109 } else {
110 INCL_ERROR("No r-p correlation function for " << ((t==Proton) ? "protons" : "neutrons") << " in A = "
111 << A << " Z = " << Z << '\n');
112 return NULL;
113 }
114
115 InterpolationTable *theTable = rpCorrelationFunction->inverseCDFTable(Math::pow13);
116 delete rpCorrelationFunction;
117 INCL_DEBUG(" ... here comes the table:\n" << theTable->print() << '\n');
118
119 (*rpCorrelationTableCache)[nuclideID] = theTable;
120 return theTable;
121 } else {
122 return mapEntry->second;
123 }
124 }
G4double pow13(G4double x)

References A, G4INCL::ParticleTable::getMaximumNuclearRadius(), G4INCL::ParticleTable::getRadiusParameter(), G4INCL::ParticleTable::getSurfaceDiffuseness(), INCL_DEBUG, INCL_ERROR, G4INCL::IFunction1D::inverseCDFTable(), G4INCL::Neutron, G4INCL::Math::oneOverSqrtThree, G4INCL::Math::pow13(), G4INCL::InterpolationTable::print(), G4INCL::Proton, G4INCL::NuclearDensityFactory::anonymous_namespace{G4INCLNuclearDensityFactory.cc}::rpCorrelationTableCache, and Z.

Referenced by createDensity().