Geant4-11
Public Member Functions | Private Types | Private Member Functions | Private Attributes
G4INCL::ParticleSampler Class Reference

#include <G4INCLParticleSampler.hh>

Public Member Functions

NuclearDensity const * getDensity () const
 Getter for theDensity. More...
 
NuclearPotential::INuclearPotential const * getPotential () const
 Getter for thePotential. More...
 
G4double getRPCorrelationCoefficient (const ParticleType t) const
 Getter for rpCorrelationCoefficient. More...
 
 ParticleSampler (const G4int A, const G4int Z, const G4int S)
 Constructor. More...
 
ParticleList sampleParticles (ThreeVector const &position)
 
void sampleParticlesIntoList (ThreeVector const &position, ParticleList &theList)
 
void setDensity (NuclearDensity const *const d)
 Setter for theDensity. More...
 
void setPotential (NuclearPotential::INuclearPotential const *const p)
 Setter for thePotential. More...
 
void setRPCorrelationCoefficient (const ParticleType t, const G4double corrCoeff)
 Setter for rpCorrelationCoefficient. More...
 
 ~ParticleSampler ()
 Destructor. More...
 

Private Types

typedef Particle *(ParticleSampler::* ParticleSamplerMethod) (const ParticleType t) const
 

Private Member Functions

ParticlesampleOneParticleWithFuzzyRPCorrelation (const ParticleType t) const
 Sample one particle with a fuzzy rp-correlation. More...
 
ParticlesampleOneParticleWithoutRPCorrelation (const ParticleType t) const
 Sample one particle not taking into account the rp-correlation. More...
 
ParticlesampleOneParticleWithRPCorrelation (const ParticleType t) const
 Sample one particle taking into account the rp-correlation. More...
 
void updateSampleOneParticleMethods ()
 

Private Attributes

G4double rpCorrelationCoefficient [UnknownParticle]
 Correlation coefficients for the r-p correlation. More...
 
ParticleSamplerMethod sampleOneNeutron
 Sample a list of particles. More...
 
ParticleSamplerMethod sampleOneProton
 Sample a list of particles. More...
 
const G4int theA
 Mass number. More...
 
NuclearDensity const * theDensity
 Pointer to the Cluster's NuclearDensity. More...
 
InterpolationTable const * thePCDFTable [UnknownParticle]
 Array of pointers to the p-space CDF table. More...
 
NuclearPotential::INuclearPotential const * thePotential
 Pointer to the Cluster's NuclearPotential. More...
 
InterpolationTable const * theRCDFTable [UnknownParticle]
 Array of pointers to the r-space CDF table. More...
 
const G4int theS
 Strangeness number. More...
 
const G4int theZ
 Charge number. More...
 

Detailed Description

Definition at line 54 of file G4INCLParticleSampler.hh.

Member Typedef Documentation

◆ ParticleSamplerMethod

typedef Particle *(ParticleSampler::* G4INCL::ParticleSampler::ParticleSamplerMethod) (const ParticleType t) const
private

Definition at line 98 of file G4INCLParticleSampler.hh.

Constructor & Destructor Documentation

◆ ParticleSampler()

G4INCL::ParticleSampler::ParticleSampler ( const G4int  A,
const G4int  Z,
const G4int  S 
)

Constructor.

Parameters
Athe mass number
Zthe charge number

Definition at line 51 of file G4INCLParticleSampler.cc.

51 :
54 theA(A),
55 theZ(Z),
56 theS(S),
57 theDensity(NULL),
58 thePotential(NULL)
59 {
60 std::fill(theRCDFTable, theRCDFTable + UnknownParticle, static_cast<InterpolationTable *>(NULL));
61 std::fill(thePCDFTable, thePCDFTable + UnknownParticle, static_cast<InterpolationTable *>(NULL));
66 }
G4double S(G4double temp)
const G4int Z[17]
const G4double A[17]
const G4int theA
Mass number.
ParticleSamplerMethod sampleOneNeutron
Sample a list of particles.
ParticleSamplerMethod sampleOneProton
Sample a list of particles.
G4double rpCorrelationCoefficient[UnknownParticle]
Correlation coefficients for the r-p correlation.
Particle * sampleOneParticleWithoutRPCorrelation(const ParticleType t) const
Sample one particle not taking into account the rp-correlation.
NuclearDensity const * theDensity
Pointer to the Cluster's NuclearDensity.
InterpolationTable const * theRCDFTable[UnknownParticle]
Array of pointers to the r-space CDF table.
const G4int theS
Strangeness number.
InterpolationTable const * thePCDFTable[UnknownParticle]
Array of pointers to the p-space CDF table.
NuclearPotential::INuclearPotential const * thePotential
Pointer to the Cluster's NuclearPotential.
const G4int theZ
Charge number.
G4double getRPCorrelationCoefficient(const ParticleType t)
Get the value of the r-p correlation coefficient.

References G4INCL::ParticleTable::getRPCorrelationCoefficient(), G4INCL::Lambda, G4INCL::Neutron, G4INCL::Proton, rpCorrelationCoefficient, thePCDFTable, theRCDFTable, and G4INCL::UnknownParticle.

◆ ~ParticleSampler()

G4INCL::ParticleSampler::~ParticleSampler ( )

Destructor.

Definition at line 68 of file G4INCLParticleSampler.cc.

68 {
69 }

Member Function Documentation

◆ getDensity()

NuclearDensity const * G4INCL::ParticleSampler::getDensity ( ) const
inline

Getter for theDensity.

Definition at line 68 of file G4INCLParticleSampler.hh.

68{ return theDensity; }

References theDensity.

◆ getPotential()

NuclearPotential::INuclearPotential const * G4INCL::ParticleSampler::getPotential ( ) const
inline

Getter for thePotential.

Definition at line 71 of file G4INCLParticleSampler.hh.

71{ return thePotential; }

References thePotential.

◆ getRPCorrelationCoefficient()

G4double G4INCL::ParticleSampler::getRPCorrelationCoefficient ( const ParticleType  t) const
inline

Getter for rpCorrelationCoefficient.

Definition at line 74 of file G4INCLParticleSampler.hh.

74 {
75// assert(t==Proton || t==Neutron);
77 }

References rpCorrelationCoefficient.

◆ sampleOneParticleWithFuzzyRPCorrelation()

Particle * G4INCL::ParticleSampler::sampleOneParticleWithFuzzyRPCorrelation ( const ParticleType  t) const
private

Sample one particle with a fuzzy rp-correlation.

Definition at line 165 of file G4INCLParticleSampler.cc.

165 {
166// assert(theDensity && thePotential);
167 std::pair<G4double,G4double> ranNumbers = Random::correlatedUniform(rpCorrelationCoefficient[t]);
168 const G4double x = Math::pow13(ranNumbers.first);
169 const G4double y = Math::pow13(ranNumbers.second);
170 const G4double theFermiMomentum = thePotential->getFermiMomentum(t);
171 const ThreeVector momentumVector = Random::normVector(y*theFermiMomentum);
172 const G4double reflectionRadius = theDensity->getMaxRFromP(t, x);
173 const ThreeVector positionVector = Random::sphereVector(reflectionRadius);
174 Particle *aParticle = new Particle(t, momentumVector, positionVector);
175 aParticle->setUncorrelatedMomentum(x*theFermiMomentum);
176 return aParticle;
177 }
double G4double
Definition: G4Types.hh:83
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.
G4double pow13(G4double x)
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.

References G4INCL::Random::correlatedUniform(), G4INCL::NuclearPotential::INuclearPotential::getFermiMomentum(), G4INCL::NuclearDensity::getMaxRFromP(), G4INCL::Random::normVector(), G4INCL::Math::pow13(), rpCorrelationCoefficient, G4INCL::Particle::setUncorrelatedMomentum(), G4INCL::Random::sphereVector(), theDensity, and thePotential.

Referenced by updateSampleOneParticleMethods().

◆ sampleOneParticleWithoutRPCorrelation()

Particle * G4INCL::ParticleSampler::sampleOneParticleWithoutRPCorrelation ( const ParticleType  t) const
private

Sample one particle not taking into account the rp-correlation.

Definition at line 157 of file G4INCLParticleSampler.cc.

157 {
158 const G4double position = (*(theRCDFTable[t]))(Random::shoot());
159 const G4double momentum = (*(thePCDFTable[t]))(Random::shoot());
160 ThreeVector positionVector = Random::normVector(position);
161 ThreeVector momentumVector = Random::normVector(momentum);
162 return new Particle(t, momentumVector, positionVector);
163 }
G4double shoot()
Definition: G4INCLRandom.cc:93

References G4INCL::Random::normVector(), G4INCL::Random::shoot(), thePCDFTable, and theRCDFTable.

Referenced by sampleParticlesIntoList(), and updateSampleOneParticleMethods().

◆ sampleOneParticleWithRPCorrelation()

Particle * G4INCL::ParticleSampler::sampleOneParticleWithRPCorrelation ( const ParticleType  t) const
private

Sample one particle taking into account the rp-correlation.

Definition at line 144 of file G4INCLParticleSampler.cc.

144 {
145// assert(theDensity && thePotential);
146 const G4double theFermiMomentum = thePotential->getFermiMomentum(t);
147 const ThreeVector momentumVector = Random::sphereVector(theFermiMomentum);
148 const G4double momentumAbs = momentumVector.mag();
149 const G4double momentumRatio = momentumAbs/theFermiMomentum;
150 const G4double reflectionRadius = theDensity->getMaxRFromP(t, momentumRatio);
151 const ThreeVector positionVector = Random::sphereVector(reflectionRadius);
152 Particle *aParticle = new Particle(t, momentumVector, positionVector);
153 aParticle->setUncorrelatedMomentum(momentumAbs);
154 return aParticle;
155 }

References G4INCL::NuclearPotential::INuclearPotential::getFermiMomentum(), G4INCL::NuclearDensity::getMaxRFromP(), G4INCL::ThreeVector::mag(), G4INCL::Particle::setUncorrelatedMomentum(), G4INCL::Random::sphereVector(), theDensity, and thePotential.

Referenced by updateSampleOneParticleMethods().

◆ sampleParticles()

ParticleList G4INCL::ParticleSampler::sampleParticles ( ThreeVector const &  position)

Definition at line 99 of file G4INCLParticleSampler.cc.

99 {
100 ParticleList aList;
102 return aList;
103 }
void sampleParticlesIntoList(ThreeVector const &position, ParticleList &theList)

References sampleParticlesIntoList().

◆ sampleParticlesIntoList()

void G4INCL::ParticleSampler::sampleParticlesIntoList ( ThreeVector const &  position,
ParticleList theList 
)

Definition at line 105 of file G4INCLParticleSampler.cc.

105 {
106
108 // sampling without correlation, we need to initialize the CDF tables
115 }
116
117 theList.resize(theA);
118 if(theA > 2) {
119 ParticleType type = Proton;
120 ParticleSamplerMethod sampleOneParticle = sampleOneProton;
121 for(G4int i = 0; i < theA; ++i) {
122 if(i == theZ) { // Nucleons [Z..A-1] are neutrons
123 type = Lambda;
124 sampleOneParticle = sampleOneNeutron; // hypothesis: Lambdas follow the same rules than neutrons
125 }
126 if(i == theZ - theS) type = Neutron;
127 Particle *p = (this->*sampleOneParticle)(type);
128 p->setPosition(position + p->getPosition());
129 theList[i] = p;
130 }
131 } else {
132 // For deuterons, only sample the proton position and momentum. The
133 // neutron position and momenta are determined by the conditions of
134 // vanishing CM position and total momentum.
135// assert(theZ==1);
136 Particle *aProton = (this->*(this->sampleOneProton))(Proton);
137 Particle *aNeutron = new Particle(Neutron, -aProton->getMomentum(), position - aProton->getPosition());
138 aProton->setPosition(position + aProton->getPosition());
139 theList[0] = aProton;
140 theList[1] = aNeutron;
141 }
142 }
int G4int
Definition: G4Types.hh:85
Particle *(ParticleSampler::* ParticleSamplerMethod)(const ParticleType t) const
InterpolationTable * createPCDFTable(const ParticleType t, const G4int A, const G4int Z)
InterpolationTable * createRCDFTable(const ParticleType t, const G4int A, const G4int Z)

References G4INCL::NuclearDensityFactory::createPCDFTable(), G4INCL::NuclearDensityFactory::createRCDFTable(), G4INCL::Particle::getMomentum(), G4INCL::Particle::getPosition(), G4INCL::Lambda, G4INCL::Neutron, G4INCL::Proton, sampleOneNeutron, sampleOneParticleWithoutRPCorrelation(), sampleOneProton, G4INCL::Particle::setPosition(), theA, thePCDFTable, theRCDFTable, theS, and theZ.

Referenced by G4INCL::Cluster::initializeParticles(), and sampleParticles().

◆ setDensity()

void G4INCL::ParticleSampler::setDensity ( NuclearDensity const *const  d)

Setter for theDensity.

Definition at line 71 of file G4INCLParticleSampler.cc.

References theDensity, and updateSampleOneParticleMethods().

Referenced by G4INCL::Nucleus::Nucleus(), and G4INCL::Nucleus::setDensity().

◆ setPotential()

void G4INCL::ParticleSampler::setPotential ( NuclearPotential::INuclearPotential const *const  p)

Setter for thePotential.

Definition at line 76 of file G4INCLParticleSampler.cc.

References thePotential, and updateSampleOneParticleMethods().

Referenced by G4INCL::Nucleus::Nucleus().

◆ setRPCorrelationCoefficient()

void G4INCL::ParticleSampler::setRPCorrelationCoefficient ( const ParticleType  t,
const G4double  corrCoeff 
)
inline

Setter for rpCorrelationCoefficient.

Definition at line 86 of file G4INCLParticleSampler.hh.

86 {
87// assert(t==Proton || t==Neutron);
88 rpCorrelationCoefficient[t] = corrCoeff;
89 }

References rpCorrelationCoefficient.

◆ updateSampleOneParticleMethods()

void G4INCL::ParticleSampler::updateSampleOneParticleMethods ( )
private

Field Documentation

◆ rpCorrelationCoefficient

G4double G4INCL::ParticleSampler::rpCorrelationCoefficient[UnknownParticle]
private

◆ sampleOneNeutron

ParticleSamplerMethod G4INCL::ParticleSampler::sampleOneNeutron
private

Sample a list of particles.

This method is a pointer to the method that does the real work for neutrons.

Definition at line 110 of file G4INCLParticleSampler.hh.

Referenced by sampleParticlesIntoList(), and updateSampleOneParticleMethods().

◆ sampleOneProton

ParticleSamplerMethod G4INCL::ParticleSampler::sampleOneProton
private

Sample a list of particles.

This method is a pointer to the method that does the real work for protons.

Definition at line 104 of file G4INCLParticleSampler.hh.

Referenced by sampleParticlesIntoList(), and updateSampleOneParticleMethods().

◆ theA

const G4int G4INCL::ParticleSampler::theA
private

Mass number.

Definition at line 122 of file G4INCLParticleSampler.hh.

Referenced by sampleParticlesIntoList().

◆ theDensity

NuclearDensity const* G4INCL::ParticleSampler::theDensity
private

◆ thePCDFTable

InterpolationTable const* G4INCL::ParticleSampler::thePCDFTable[UnknownParticle]
private

Array of pointers to the p-space CDF table.

Definition at line 134 of file G4INCLParticleSampler.hh.

Referenced by ParticleSampler(), sampleOneParticleWithoutRPCorrelation(), and sampleParticlesIntoList().

◆ thePotential

NuclearPotential::INuclearPotential const* G4INCL::ParticleSampler::thePotential
private

◆ theRCDFTable

InterpolationTable const* G4INCL::ParticleSampler::theRCDFTable[UnknownParticle]
private

Array of pointers to the r-space CDF table.

Definition at line 131 of file G4INCLParticleSampler.hh.

Referenced by ParticleSampler(), sampleOneParticleWithoutRPCorrelation(), and sampleParticlesIntoList().

◆ theS

const G4int G4INCL::ParticleSampler::theS
private

Strangeness number.

Definition at line 128 of file G4INCLParticleSampler.hh.

Referenced by sampleParticlesIntoList().

◆ theZ

const G4int G4INCL::ParticleSampler::theZ
private

Charge number.

Definition at line 125 of file G4INCLParticleSampler.hh.

Referenced by sampleParticlesIntoList().


The documentation for this class was generated from the following files: