Geant4  10.02.p03
G4INCL::ParticleSampler Class Reference

#include <G4INCLParticleSampler.hh>

Collaboration diagram for G4INCL::ParticleSampler:

Public Member Functions

 ParticleSampler (const G4int A, const G4int Z)
 Constructor. More...
 
 ~ParticleSampler ()
 Destructor. More...
 
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...
 
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...
 
ParticleList sampleParticles (ThreeVector const &position)
 
void sampleParticlesIntoList (ThreeVector const &position, ParticleList &theList)
 

Private Types

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

Private Member Functions

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

Private Attributes

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

Constructor.

Parameters
Athe mass number
Zthe charge number

Definition at line 51 of file G4INCLParticleSampler.cc.

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

◆ ~ParticleSampler()

G4INCL::ParticleSampler::~ParticleSampler ( )

Destructor.

Definition at line 66 of file G4INCLParticleSampler.cc.

66  {
67  }

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; }
NuclearDensity const * theDensity
Pointer to the Cluster&#39;s NuclearDensity.

◆ getPotential()

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

Getter for thePotential.

Definition at line 71 of file G4INCLParticleSampler.hh.

71 { return thePotential; }
NuclearPotential::INuclearPotential const * thePotential
Pointer to the Cluster&#39;s NuclearPotential.

◆ 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);
76  return rpCorrelationCoefficient[t];
77  }
G4double rpCorrelationCoefficient[UnknownParticle]
Correlation coefficients for the r-p correlation.
Here is the call graph for this function:

◆ sampleOneParticleWithFuzzyRPCorrelation()

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

Sample one particle with a fuzzy rp-correlation.

Definition at line 160 of file G4INCLParticleSampler.cc.

160  {
161 // assert(theDensity && thePotential);
162  std::pair<G4double,G4double> ranNumbers = Random::correlatedUniform(rpCorrelationCoefficient[t]);
163  const G4double x = Math::pow13(ranNumbers.first);
164  const G4double y = Math::pow13(ranNumbers.second);
165  const G4double theFermiMomentum = thePotential->getFermiMomentum(t);
166  const ThreeVector momentumVector = Random::normVector(y*theFermiMomentum);
167  const G4double reflectionRadius = theDensity->getMaxRFromP(t, x);
168  const ThreeVector positionVector = Random::sphereVector(reflectionRadius);
169  Particle *aParticle = new Particle(t, momentumVector, positionVector);
170  aParticle->setUncorrelatedMomentum(x*theFermiMomentum);
171  return aParticle;
172  }
ThreeVector sphereVector(G4double rmax=1.)
G4double rpCorrelationCoefficient[UnknownParticle]
Correlation coefficients for the r-p correlation.
G4double getFermiMomentum(const Particle *const p) const
Return the Fermi momentum for a particle.
G4double getMaxRFromP(const ParticleType t, const G4double p) const
Get the maximum allowed radius for a given momentum.
ThreeVector normVector(G4double norm=1.)
Double_t y
std::pair< G4double, G4double > correlatedUniform(const G4double corrCoeff)
Generate pairs of correlated uniform random numbers.
NuclearPotential::INuclearPotential const * thePotential
Pointer to the Cluster&#39;s NuclearPotential.
double G4double
Definition: G4Types.hh:76
G4double pow13(G4double x)
NuclearDensity const * theDensity
Pointer to the Cluster&#39;s NuclearDensity.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sampleOneParticleWithoutRPCorrelation()

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

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

Definition at line 152 of file G4INCLParticleSampler.cc.

152  {
153  const G4double position = (*(theRCDFTable[t]))(Random::shoot());
154  const G4double momentum = (*(thePCDFTable[t]))(Random::shoot());
155  ThreeVector positionVector = Random::normVector(position);
156  ThreeVector momentumVector = Random::normVector(momentum);
157  return new Particle(t, momentumVector, positionVector);
158  }
ThreeVector normVector(G4double norm=1.)
InterpolationTable const * theRCDFTable[UnknownParticle]
Array of pointers to the r-space CDF table.
InterpolationTable const * thePCDFTable[UnknownParticle]
Array of pointers to the p-space CDF table.
G4double shoot()
Definition: G4INCLRandom.cc:93
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sampleOneParticleWithRPCorrelation()

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

Sample one particle taking into account the rp-correlation.

Definition at line 139 of file G4INCLParticleSampler.cc.

139  {
140 // assert(theDensity && thePotential);
141  const G4double theFermiMomentum = thePotential->getFermiMomentum(t);
142  const ThreeVector momentumVector = Random::sphereVector(theFermiMomentum);
143  const G4double momentumAbs = momentumVector.mag();
144  const G4double momentumRatio = momentumAbs/theFermiMomentum;
145  const G4double reflectionRadius = theDensity->getMaxRFromP(t, momentumRatio);
146  const ThreeVector positionVector = Random::sphereVector(reflectionRadius);
147  Particle *aParticle = new Particle(t, momentumVector, positionVector);
148  aParticle->setUncorrelatedMomentum(momentumAbs);
149  return aParticle;
150  }
ThreeVector sphereVector(G4double rmax=1.)
G4double getFermiMomentum(const Particle *const p) const
Return the Fermi momentum for a particle.
G4double getMaxRFromP(const ParticleType t, const G4double p) const
Get the maximum allowed radius for a given momentum.
NuclearPotential::INuclearPotential const * thePotential
Pointer to the Cluster&#39;s NuclearPotential.
double G4double
Definition: G4Types.hh:76
NuclearDensity const * theDensity
Pointer to the Cluster&#39;s NuclearDensity.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sampleParticles()

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

Definition at line 97 of file G4INCLParticleSampler.cc.

97  {
98  ParticleList aList;
100  return aList;
101  }
void sampleParticlesIntoList(ThreeVector const &position, ParticleList &theList)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sampleParticlesIntoList()

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

Definition at line 103 of file G4INCLParticleSampler.cc.

103  {
104 
106  // sampling without correlation, we need to initialize the CDF tables
111  }
112 
113  theList.resize(theA);
114  if(theA > 2) {
115  ParticleType type = Proton;
116  ParticleSamplerMethod sampleOneParticle = sampleOneProton;
117  for(G4int i = 0; i < theA; ++i) {
118  if(i == theZ) { // Nucleons [Z..A-1] are neutrons
119  type = Neutron;
120  sampleOneParticle = sampleOneNeutron;
121  }
122  Particle *p = (this->*sampleOneParticle)(type);
123  p->setPosition(position + p->getPosition());
124  theList[i] = p;
125  }
126  } else {
127  // For deuterons, only sample the proton position and momentum. The
128  // neutron position and momenta are determined by the conditions of
129  // vanishing CM position and total momentum.
130 // assert(theZ==1);
131  Particle *aProton = (this->*(this->sampleOneProton))(Proton);
132  Particle *aNeutron = new Particle(Neutron, -aProton->getMomentum(), position - aProton->getPosition());
133  aProton->setPosition(position + aProton->getPosition());
134  theList[0] = aProton;
135  theList[1] = aNeutron;
136  }
137  }
InterpolationTable * createPCDFTable(const ParticleType t, const G4int A, const G4int Z)
InterpolationTable * createRCDFTable(const ParticleType t, const G4int A, const G4int Z)
int G4int
Definition: G4Types.hh:78
Particle *(ParticleSampler::* ParticleSamplerMethod)(const ParticleType t) const
const G4int theZ
Charge number.
ParticleSamplerMethod sampleOneProton
Sample a list of particles.
InterpolationTable const * theRCDFTable[UnknownParticle]
Array of pointers to the r-space CDF table.
const G4int theA
Mass number.
ParticleSamplerMethod sampleOneNeutron
Sample a list of particles.
InterpolationTable const * thePCDFTable[UnknownParticle]
Array of pointers to the p-space CDF table.
Particle * sampleOneParticleWithoutRPCorrelation(const ParticleType t) const
Sample one particle not taking into account the rp-correlation.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDensity()

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

Setter for theDensity.

Definition at line 69 of file G4INCLParticleSampler.cc.

69  {
70  theDensity = d;
72  }
Float_t d
NuclearDensity const * theDensity
Pointer to the Cluster&#39;s NuclearDensity.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPotential()

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

Setter for thePotential.

Definition at line 74 of file G4INCLParticleSampler.cc.

74  {
75  thePotential = p;
77  }
NuclearPotential::INuclearPotential const * thePotential
Pointer to the Cluster&#39;s NuclearPotential.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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  }
G4double rpCorrelationCoefficient[UnknownParticle]
Correlation coefficients for the r-p correlation.
Here is the call graph for this function:

◆ updateSampleOneParticleMethods()

void G4INCL::ParticleSampler::updateSampleOneParticleMethods ( )
private

Definition at line 79 of file G4INCLParticleSampler.cc.

79  {
80  if(theDensity && thePotential) {
81  if(rpCorrelationCoefficient[Proton]>0.99999) {
83  } else {
85  }
86  if(rpCorrelationCoefficient[Neutron]>0.99999) {
88  } else {
90  }
91  } else {
94  }
95  }
G4double rpCorrelationCoefficient[UnknownParticle]
Correlation coefficients for the r-p correlation.
ParticleSamplerMethod sampleOneProton
Sample a list of particles.
NuclearPotential::INuclearPotential const * thePotential
Pointer to the Cluster&#39;s NuclearPotential.
Particle * sampleOneParticleWithFuzzyRPCorrelation(const ParticleType t) const
Sample one particle with a fuzzy rp-correlation.
ParticleSamplerMethod sampleOneNeutron
Sample a list of particles.
Particle * sampleOneParticleWithoutRPCorrelation(const ParticleType t) const
Sample one particle not taking into account the rp-correlation.
NuclearDensity const * theDensity
Pointer to the Cluster&#39;s NuclearDensity.
Particle * sampleOneParticleWithRPCorrelation(const ParticleType t) const
Sample one particle taking into account the rp-correlation.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ rpCorrelationCoefficient

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

Correlation coefficients for the r-p correlation.

Definition at line 140 of file G4INCLParticleSampler.hh.

◆ 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.

◆ 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.

◆ theA

const G4int G4INCL::ParticleSampler::theA
private

Mass number.

Definition at line 122 of file G4INCLParticleSampler.hh.

◆ theDensity

NuclearDensity const* G4INCL::ParticleSampler::theDensity
private

Pointer to the Cluster's NuclearDensity.

Definition at line 134 of file G4INCLParticleSampler.hh.

◆ thePCDFTable

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

Array of pointers to the p-space CDF table.

Definition at line 131 of file G4INCLParticleSampler.hh.

◆ thePotential

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

Pointer to the Cluster's NuclearPotential.

Definition at line 137 of file G4INCLParticleSampler.hh.

◆ theRCDFTable

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

Array of pointers to the r-space CDF table.

Definition at line 128 of file G4INCLParticleSampler.hh.

◆ theZ

const G4int G4INCL::ParticleSampler::theZ
private

Charge number.

Definition at line 125 of file G4INCLParticleSampler.hh.


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