Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4INCL::ParticleSampler Class Reference

#include <G4INCLParticleSampler.hh>

Public Member Functions

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

Detailed Description

Definition at line 54 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 :
52 sampleOneProton(&ParticleSampler::sampleOneParticleWithoutRPCorrelation),
53 sampleOneNeutron(&ParticleSampler::sampleOneParticleWithoutRPCorrelation),
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));
61 std::fill(rpCorrelationCoefficient, rpCorrelationCoefficient + UnknownParticle, 1.);
62 rpCorrelationCoefficient[Proton] = ParticleTable::getRPCorrelationCoefficient(Proton);
64 }
G4double getRPCorrelationCoefficient(const ParticleType t)
Get the value of the r-p correlation coefficient.

◆ ~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; }

◆ getPotential()

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

Getter for thePotential.

Definition at line 71 of file G4INCLParticleSampler.hh.

71{ return 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);
76 return rpCorrelationCoefficient[t];
77 }

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

◆ sampleParticlesIntoList()

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

Definition at line 103 of file G4INCLParticleSampler.cc.

103 {
104
105 if(sampleOneProton == &ParticleSampler::sampleOneParticleWithoutRPCorrelation) {
106 // sampling without correlation, we need to initialize the CDF tables
107 theRCDFTable[Proton] = NuclearDensityFactory::createRCDFTable(Proton, theA, theZ);
108 thePCDFTable[Proton] = NuclearDensityFactory::createPCDFTable(Proton, theA, theZ);
109 theRCDFTable[Neutron] = NuclearDensityFactory::createRCDFTable(Neutron, theA, theZ);
110 thePCDFTable[Neutron] = NuclearDensityFactory::createPCDFTable(Neutron, theA, theZ);
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 }
int G4int
Definition: G4Types.hh:85
InterpolationTable * createPCDFTable(const ParticleType t, const G4int A, const G4int Z)
InterpolationTable * createRCDFTable(const ParticleType t, const G4int A, const G4int Z)

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

◆ setDensity()

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

Setter for theDensity.

Definition at line 69 of file G4INCLParticleSampler.cc.

69 {
70 theDensity = d;
71 updateSampleOneParticleMethods();
72 }

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 74 of file G4INCLParticleSampler.cc.

74 {
75 thePotential = p;
76 updateSampleOneParticleMethods();
77 }

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 }

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