33 #define INCLXX_IN_GEANT4_MODE 1
51 sampleOneProton(&
ParticleSampler::sampleOneParticleWithoutRPCorrelation),
52 sampleOneNeutron(&
ParticleSampler::sampleOneParticleWithoutRPCorrelation),
58 std::fill(theRCDFTable, theRCDFTable +
UnknownParticle, static_cast<InverseInterpolationTable *>(NULL));
59 std::fill(thePCDFTable, thePCDFTable +
UnknownParticle, static_cast<InverseInterpolationTable *>(NULL));
60 std::fill(rpCorrelationCoefficient, rpCorrelationCoefficient +
UnknownParticle, 1.);
70 updateSampleOneParticleMethods();
75 updateSampleOneParticleMethods();
78 void ParticleSampler::updateSampleOneParticleMethods() {
79 if(theDensity && thePotential) {
80 if(rpCorrelationCoefficient[
Proton]>0.99999) {
81 sampleOneProton = &ParticleSampler::sampleOneParticleWithRPCorrelation;
83 sampleOneProton = &ParticleSampler::sampleOneParticleWithFuzzyRPCorrelation;
85 if(rpCorrelationCoefficient[
Neutron]>0.99999) {
86 sampleOneNeutron = &ParticleSampler::sampleOneParticleWithRPCorrelation;
88 sampleOneNeutron = &ParticleSampler::sampleOneParticleWithFuzzyRPCorrelation;
91 sampleOneProton = &ParticleSampler::sampleOneParticleWithoutRPCorrelation;
92 sampleOneNeutron = &ParticleSampler::sampleOneParticleWithoutRPCorrelation;
98 if(sampleOneProton == &ParticleSampler::sampleOneParticleWithoutRPCorrelation) {
109 ParticleSamplerMethod sampleOneParticle = sampleOneProton;
110 for(
G4int i = 1; i <= theA; ++i) {
111 if(i == (theZ + 1)) {
113 sampleOneParticle = sampleOneNeutron;
115 Particle *
p = (this->*sampleOneParticle)(type);
117 theList.push_back(p);
127 theList.push_back(aProton);
128 theList.push_back(aNeutron);
139 const G4double momentumRatio = momentumAbs/theFermiMomentum;
147 Particle *ParticleSampler::sampleOneParticleWithoutRPCorrelation(
const ParticleType t)
const {
152 return new Particle(t, momentumVector, positionVector);
155 Particle *ParticleSampler::sampleOneParticleWithFuzzyRPCorrelation(
const ParticleType t)
const {
164 Particle *aParticle =
new Particle(t, momentumVector, positionVector);
165 aParticle->setUncorrelatedMomentum(x*theFermiMomentum);
ParticleList sampleParticles(ThreeVector const &position)
ThreeVector sphereVector(G4double rmax=1.)
G4double getFermiMomentum(const Particle *const p) const
Return the Fermi momentum for a particle.
InverseInterpolationTable * createPCDFTable(const ParticleType t, const G4int A, const G4int Z)
const G4INCL::ThreeVector & getMomentum() const
~ParticleSampler()
Destructor.
void setUncorrelatedMomentum(const G4double p)
Set the uncorrelated momentum.
ThreeVector normVector(G4double norm=1.)
Class for sampling particles in a nucleus.
void setDensity(NuclearDensity const *const d)
Setter for theDensity.
std::pair< G4double, G4double > correlatedUniform(const G4double corrCoeff)
Generate pairs of correlated uniform random numbers.
virtual void setPosition(const G4INCL::ThreeVector &position)
ParticleSampler(const G4int A, const G4int Z)
Constructor.
const G4INCL::ThreeVector & getPosition() const
void setPotential(NuclearPotential::INuclearPotential const *const p)
Setter for thePotential.
InverseInterpolationTable * createRCDFTable(const ParticleType t, const G4int A, const G4int Z)
G4double getRPCorrelationCoefficient(const ParticleType t)
Get the value of the r-p correlation coefficient.
G4double pow13(G4double x)
G4double getMaxRFromP(const ParticleType t, const G4double p) const
Get the maximum allowed radius for a given momentum.