34#define INCLXX_IN_GEANT4_MODE 1
52 sampleOneProton(&
ParticleSampler::sampleOneParticleWithoutRPCorrelation),
53 sampleOneNeutron(&
ParticleSampler::sampleOneParticleWithoutRPCorrelation),
62 std::fill(rpCorrelationCoefficient, rpCorrelationCoefficient +
UnknownParticle, 1.);
73 updateSampleOneParticleMethods();
78 updateSampleOneParticleMethods();
81 void ParticleSampler::updateSampleOneParticleMethods() {
82 if(theDensity && thePotential) {
83 if(rpCorrelationCoefficient[
Proton]>0.99999) {
84 sampleOneProton = &ParticleSampler::sampleOneParticleWithRPCorrelation;
86 sampleOneProton = &ParticleSampler::sampleOneParticleWithFuzzyRPCorrelation;
88 if(rpCorrelationCoefficient[
Neutron]>0.99999) {
89 sampleOneNeutron = &ParticleSampler::sampleOneParticleWithRPCorrelation;
91 sampleOneNeutron = &ParticleSampler::sampleOneParticleWithFuzzyRPCorrelation;
94 sampleOneProton = &ParticleSampler::sampleOneParticleWithoutRPCorrelation;
95 sampleOneNeutron = &ParticleSampler::sampleOneParticleWithoutRPCorrelation;
107 if(sampleOneProton == &ParticleSampler::sampleOneParticleWithoutRPCorrelation) {
117 theList.resize(theA);
120 ParticleSamplerMethod sampleOneParticle = sampleOneProton;
121 for(
G4int i = 0; i < theA; ++i) {
124 sampleOneParticle = sampleOneNeutron;
126 if(i == theZ - theS) type =
Neutron;
127 Particle *p = (this->*sampleOneParticle)(type);
139 theList[0] = aProton;
140 theList[1] = aNeutron;
149 const G4double momentumRatio = momentumAbs/theFermiMomentum;
157 Particle *ParticleSampler::sampleOneParticleWithoutRPCorrelation(
const ParticleType t)
const {
162 return new Particle(t, momentumVector, positionVector);
165 Particle *ParticleSampler::sampleOneParticleWithFuzzyRPCorrelation(
const ParticleType t)
const {
174 Particle *aParticle =
new Particle(t, momentumVector, positionVector);
175 aParticle->setUncorrelatedMomentum(x*theFermiMomentum);
G4double S(G4double temp)
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)
ParticleSampler(const G4int A, const G4int Z, const G4int S)
Constructor.
void setDensity(NuclearDensity const *const d)
Setter for theDensity.
ParticleList sampleParticles(ThreeVector const &position)
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.