Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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)
 
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

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

Definition at line 220 of file G4INCLNuclearDensityFactory.cc.

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

Here is the call graph for this function:

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

Definition at line 206 of file G4INCLNuclearDensityFactory.cc.

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

Here is the call graph for this function:

void G4INCL::NuclearDensityFactory::clearCache ( )

Definition at line 232 of file G4INCLNuclearDensityFactory.cc.

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

Here is the caller graph for this function:

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

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  if(!rpCorrelationTableProton || !rpCorrelationTableNeutron)
69  return NULL;
70  NuclearDensity const *density = new NuclearDensity(A, Z, rpCorrelationTableProton, rpCorrelationTableNeutron);
71  (*nuclearDensityCache)[nuclideID] = density;
72  return density;
73  } else {
74  return mapEntry->second;
75  }
76  }
int G4int
Definition: G4Types.hh:78
double A(double temperature)
InterpolationTable * createRPCorrelationTable(const ParticleType t, const G4int A, const G4int Z)

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 170 of file G4INCLNuclearDensityFactory.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 125 of file G4INCLNuclearDensityFactory.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 78 of file G4INCLNuclearDensityFactory.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function: