71 {
72 const G4int nuclideID = 1000*Z + A;
73 const std::map<G4int,InverseInterpolationTable*>::const_iterator mapEntry =
rpCorrelationTableCache.find(nuclideID);
75
76 IFunction1D *rpCorrelationFunction;
77 if(A > 19) {
81 rpCorrelationFunction = new NuclearDensityFunctions::WoodsSaxonRP(radius, maximumRadius, diffuseness);
82 } else if(A <= 19 && A > 6) {
86 rpCorrelationFunction = new NuclearDensityFunctions::ModifiedHarmonicOscillatorRP(radius, maximumRadius, diffuseness);
87 } else if(A <= 6 && A > 1) {
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
106 return Math::pow13(normalisation * theFunction->integrate(xMin,x));
107 }
108 private:
109 IFunction1D const * const theFunction;
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
120 return theTable;
121 } else {
122 return mapEntry->second;
123 }
124 }