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

Functions

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

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 {
222 if(!nuclearDensityCache)
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]

◆ 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
210 if(!rpCorrelationTableCache)
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 }

◆ clearCache()

void G4INCL::NuclearDensityFactory::clearCache ( )

Definition at line 233 of file G4INCLNuclearDensityFactory.cc.

233 {
234
235 if(nuclearDensityCache) {
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
243 if(rpCorrelationTableCache) {
244 for(std::map<G4int,InterpolationTable*>::const_iterator i = rpCorrelationTableCache->begin(); i!=rpCorrelationTableCache->end(); ++i)
245 delete i->second;
246 rpCorrelationTableCache->clear();
247 delete rpCorrelationTableCache;
248 rpCorrelationTableCache = NULL;
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 }

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 {
60 if(!nuclearDensityCache)
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)

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
185 const G4double momentumRMS = Math::oneOverSqrtThree * ParticleTable::getMomentumRMS(A, Z);
186 pDensityFunction = new NuclearDensityFunctions::Gaussian(5.*momentumRMS, momentumRMS);
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.

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) {
138 G4double radius = ParticleTable::getRadiusParameter(t, A, Z);
139 G4double diffuseness = ParticleTable::getSurfaceDiffuseness(t, A, Z);
140 G4double maximumRadius = ParticleTable::getMaximumNuclearRadius(t, A, Z);
141 rDensityFunction = new NuclearDensityFunctions::WoodsSaxon(radius, maximumRadius, diffuseness);
142 } else if(A <= 19 && A > 6) {
143 G4double radius = ParticleTable::getRadiusParameter(t, A, Z);
144 G4double diffuseness = ParticleTable::getSurfaceDiffuseness(t, A, Z);
145 G4double maximumRadius = ParticleTable::getMaximumNuclearRadius(t, A, Z);
146 rDensityFunction = new NuclearDensityFunctions::ModifiedHarmonicOscillator(radius, maximumRadius, diffuseness);
147 } else if(A <= 6 && A > 2) { // Gaussian distribution for light nuclei
148 G4double radius = ParticleTable::getRadiusParameter(t, A, Z);
149 G4double maximumRadius = ParticleTable::getMaximumNuclearRadius(t, A, Z);
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 }

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
82 if(!rpCorrelationTableCache)
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) {
93 const G4double radius = ParticleTable::getRadiusParameter(t, A, Z);
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) {
99 const G4double radius = ParticleTable::getRadiusParameter(t, A, Z);
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 }

Referenced by createDensity().