34#define INCLXX_IN_GEANT4_MODE 1
52 sampleOneProton(&
ParticleSampler::sampleOneParticleWithoutRPCorrelation),
53 sampleOneNeutron(&
ParticleSampler::sampleOneParticleWithoutRPCorrelation),
61 std::fill(rpCorrelationCoefficient, rpCorrelationCoefficient +
UnknownParticle, 1.);
71 updateSampleOneParticleMethods();
76 updateSampleOneParticleMethods();
79 void ParticleSampler::updateSampleOneParticleMethods() {
80 if(theDensity && thePotential) {
81 if(rpCorrelationCoefficient[
Proton]>0.99999) {
82 sampleOneProton = &ParticleSampler::sampleOneParticleWithRPCorrelation;
84 sampleOneProton = &ParticleSampler::sampleOneParticleWithFuzzyRPCorrelation;
86 if(rpCorrelationCoefficient[
Neutron]>0.99999) {
87 sampleOneNeutron = &ParticleSampler::sampleOneParticleWithRPCorrelation;
89 sampleOneNeutron = &ParticleSampler::sampleOneParticleWithFuzzyRPCorrelation;
92 sampleOneProton = &ParticleSampler::sampleOneParticleWithoutRPCorrelation;
93 sampleOneNeutron = &ParticleSampler::sampleOneParticleWithoutRPCorrelation;
105 if(sampleOneProton == &ParticleSampler::sampleOneParticleWithoutRPCorrelation) {
113 theList.resize(theA);
116 ParticleSamplerMethod sampleOneParticle = sampleOneProton;
117 for(
G4int i = 0; i < theA; ++i) {
120 sampleOneParticle = sampleOneNeutron;
122 Particle *p = (this->*sampleOneParticle)(type);
134 theList[0] = aProton;
135 theList[1] = aNeutron;
144 const G4double momentumRatio = momentumAbs/theFermiMomentum;
152 Particle *ParticleSampler::sampleOneParticleWithoutRPCorrelation(
const ParticleType t)
const {
157 return new Particle(t, momentumVector, positionVector);
160 Particle *ParticleSampler::sampleOneParticleWithFuzzyRPCorrelation(
const ParticleType t)
const {
169 Particle *aParticle =
new Particle(t, momentumVector, positionVector);
170 aParticle->setUncorrelatedMomentum(x*theFermiMomentum);
double A(double temperature)
Class for sampling particles in a nucleus.
Class for interpolating the of a 1-dimensional function.
G4double getMaxRFromP(const ParticleType t, const G4double p) const
Get the maximum allowed radius for a given momentum.
G4double getFermiMomentum(const Particle *const p) const
Return the Fermi momentum for a particle.
void setPotential(NuclearPotential::INuclearPotential const *const p)
Setter for thePotential.
~ParticleSampler()
Destructor.
void sampleParticlesIntoList(ThreeVector const &position, ParticleList &theList)
void setDensity(NuclearDensity const *const d)
Setter for theDensity.
ParticleList sampleParticles(ThreeVector const &position)
ParticleSampler(const G4int A, const G4int Z)
Constructor.
void setUncorrelatedMomentum(const G4double p)
Set the uncorrelated momentum.
const G4INCL::ThreeVector & getPosition() const
const G4INCL::ThreeVector & getMomentum() const
virtual void setPosition(const G4INCL::ThreeVector &position)
G4double pow13(G4double x)
InterpolationTable * createPCDFTable(const ParticleType t, const G4int A, const G4int Z)
InterpolationTable * createRCDFTable(const ParticleType t, const G4int A, const G4int Z)
G4double getRPCorrelationCoefficient(const ParticleType t)
Get the value of the r-p correlation coefficient.
ThreeVector normVector(G4double norm=1.)
ThreeVector sphereVector(G4double rmax=1.)
std::pair< G4double, G4double > correlatedUniform(const G4double corrCoeff)
Generate pairs of correlated uniform random numbers.