Geant4 11.1.1
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, const G4int S)
 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,
const G4int  S 
)

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 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));
62 std::fill(rpCorrelationCoefficient, rpCorrelationCoefficient + UnknownParticle, 1.);
63 rpCorrelationCoefficient[Proton] = ParticleTable::getRPCorrelationCoefficient(Proton);
65 rpCorrelationCoefficient[Lambda] = ParticleTable::getRPCorrelationCoefficient(Lambda);
66 }
G4double S(G4double temp)
const G4int Z[17]
const G4double A[17]
G4double getRPCorrelationCoefficient(const ParticleType t)
Get the value of the r-p correlation coefficient.

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

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

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

◆ sampleParticlesIntoList()

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

Definition at line 105 of file G4INCLParticleSampler.cc.

105 {
106
107 if(sampleOneProton == &ParticleSampler::sampleOneParticleWithoutRPCorrelation) {
108 // sampling without correlation, we need to initialize the CDF tables
109 theRCDFTable[Proton] = NuclearDensityFactory::createRCDFTable(Proton, theA, theZ);
110 thePCDFTable[Proton] = NuclearDensityFactory::createPCDFTable(Proton, theA, theZ);
111 theRCDFTable[Neutron] = NuclearDensityFactory::createRCDFTable(Neutron, theA, theZ);
112 thePCDFTable[Neutron] = NuclearDensityFactory::createPCDFTable(Neutron, theA, theZ);
113 theRCDFTable[Lambda] = NuclearDensityFactory::createRCDFTable(Lambda, theA, theZ);
114 thePCDFTable[Lambda] = NuclearDensityFactory::createPCDFTable(Lambda, theA, theZ);
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
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 71 of file G4INCLParticleSampler.cc.

71 {
72 theDensity = d;
73 updateSampleOneParticleMethods();
74 }

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.

76 {
77 thePotential = p;
78 updateSampleOneParticleMethods();
79 }

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: