34 #define INCLXX_IN_GEANT4_MODE 1
52 sampleOneProton(&
ParticleSampler::sampleOneParticleWithoutRPCorrelation),
53 sampleOneNeutron(&
ParticleSampler::sampleOneParticleWithoutRPCorrelation),
59 std::fill(theRCDFTable, theRCDFTable +
UnknownParticle, static_cast<InterpolationTable *>(NULL));
60 std::fill(thePCDFTable, thePCDFTable +
UnknownParticle, static_cast<InterpolationTable *>(NULL));
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);
ParticleList sampleParticles(ThreeVector const &position)
ThreeVector sphereVector(G4double rmax=1.)
InterpolationTable * createPCDFTable(const ParticleType t, const G4int A, const G4int Z)
G4double getFermiMomentum(const Particle *const p) const
Return the Fermi momentum for a particle.
const G4INCL::ThreeVector & getMomentum() const
~ParticleSampler()
Destructor.
InterpolationTable * createRCDFTable(const ParticleType t, const G4int A, const G4int Z)
void setUncorrelatedMomentum(const G4double p)
Set the uncorrelated momentum.
ThreeVector normVector(G4double norm=1.)
void sampleParticlesIntoList(ThreeVector const &position, ParticleList &theList)
Class for sampling particles in a nucleus.
double A(double temperature)
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.
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.