Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4INCLNuclearDensityFactory.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// INCL++ intra-nuclear cascade model
27// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
28// Davide Mancusi, CEA
29// Alain Boudard, CEA
30// Sylvie Leray, CEA
31// Joseph Cugnon, University of Liege
32//
33// INCL++ revision: v5.1.8
34//
35#define INCLXX_IN_GEANT4_MODE 1
36
37#include "globals.hh"
38
42#include "G4INCLNDFGaussian.hh"
43#include "G4INCLNDFParis.hh"
45
46namespace G4INCL {
47
48 std::map<G4int,NuclearDensity*> NuclearDensityFactory::nuclearDensityCache;
49
50 std::map<G4int,InverseInterpolationTable*> NuclearDensityFactory::rpCorrelationTableCache;
51
52 std::map<G4int,InverseInterpolationTable*> NuclearDensityFactory::rCDFTableCache;
53
54 std::map<G4int,InverseInterpolationTable*> NuclearDensityFactory::pCDFTableCache;
55
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()) {
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 }
70
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) :
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 }
125
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 }
165
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) {
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 }
195
199 return new ParticleSampler(A, Z, rCDFTable, pCDFTable);
200 }
201
202}
#define DEBUG(x)
#define ERROR(x)
Class for Gaussian density.
NDF* class for the deuteron density according to the HardSphere potential.
Class for modified harmonic oscillator density.
NDF* class for the deuteron density according to the Paris potential.
Class for Woods-Saxon density.
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
virtual G4double getXMaximum() const
Return the maximum allowed value of the independent variable.
virtual G4double getXMinimum() const
Return the minimum allowed value of the independent variable.
InverseInterpolationTable * inverseCDFTable(const G4int nNodes=60) const
Return a pointer to the inverse of the CDF of this function.
Class for interpolating the inverse of a 1-dimensional function.
static std::map< G4int, InverseInterpolationTable * > rCDFTableCache
static std::map< G4int, NuclearDensity * > nuclearDensityCache
static NuclearDensity * createDensity(const G4int A, const G4int Z)
static InverseInterpolationTable * createPCDFTable(const G4int A, const G4int Z)
static ParticleSampler * createParticleSampler(const G4int A, const G4int Z)
static std::map< G4int, InverseInterpolationTable * > rpCorrelationTableCache
static std::map< G4int, InverseInterpolationTable * > pCDFTableCache
static InverseInterpolationTable * createRCDFTable(const G4int A, const G4int Z)
static InverseInterpolationTable * createRPCorrelationTable(const G4int A, const G4int Z)
static G4double getMomentumRMS(const G4int A, const G4int Z)
Return the RMS of the momentum distribution (light clusters)
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)
const G4double oneOverSqrtThree
const G4double Pf
Fermi momentum [MeV/c].