Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4INCL::ParticleSampler Class Reference

#include <G4INCLParticleSampler.hh>

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)
 

Detailed Description

Definition at line 52 of file G4INCLParticleSampler.hh.

Constructor & Destructor Documentation

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

Constructor.

Parameters
Athe mass number
Zthe charge number

Definition at line 50 of file G4INCLParticleSampler.cc.

References G4INCL::ParticleTable::getRPCorrelationCoefficient(), G4INCL::Neutron, G4INCL::Proton, and G4INCL::UnknownParticle.

50  :
51  sampleOneProton(&ParticleSampler::sampleOneParticleWithoutRPCorrelation),
52  sampleOneNeutron(&ParticleSampler::sampleOneParticleWithoutRPCorrelation),
53  theA(A),
54  theZ(Z),
55  theDensity(NULL),
56  thePotential(NULL)
57  {
58  std::fill(theRCDFTable, theRCDFTable + UnknownParticle, static_cast<InverseInterpolationTable *>(NULL));
59  std::fill(thePCDFTable, thePCDFTable + UnknownParticle, static_cast<InverseInterpolationTable *>(NULL));
60  std::fill(rpCorrelationCoefficient, rpCorrelationCoefficient + UnknownParticle, 1.);
61  rpCorrelationCoefficient[Proton] = ParticleTable::getRPCorrelationCoefficient(Proton);
62  rpCorrelationCoefficient[Neutron] = ParticleTable::getRPCorrelationCoefficient(Neutron);
63  }
G4double getRPCorrelationCoefficient(const ParticleType t)
Get the value of the r-p correlation coefficient.
G4INCL::ParticleSampler::~ParticleSampler ( )

Destructor.

Definition at line 65 of file G4INCLParticleSampler.cc.

65  {
66  }

Member Function Documentation

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

Getter for theDensity.

Definition at line 66 of file G4INCLParticleSampler.hh.

66 { return theDensity; }
NuclearPotential::INuclearPotential const* G4INCL::ParticleSampler::getPotential ( ) const
inline

Getter for thePotential.

Definition at line 69 of file G4INCLParticleSampler.hh.

69 { return thePotential; }
G4double G4INCL::ParticleSampler::getRPCorrelationCoefficient ( const ParticleType  t) const
inline

Getter for rpCorrelationCoefficient.

Definition at line 72 of file G4INCLParticleSampler.hh.

72  {
73 // assert(t==Proton || t==Neutron);
74  return rpCorrelationCoefficient[t];
75  }
ParticleList G4INCL::ParticleSampler::sampleParticles ( ThreeVector const &  position)

Definition at line 96 of file G4INCLParticleSampler.cc.

References G4INCL::NuclearDensityFactory::createPCDFTable(), G4INCL::NuclearDensityFactory::createRCDFTable(), G4INCL::Particle::getMomentum(), G4INCL::Particle::getPosition(), G4INCL::Neutron, G4INCL::Proton, and G4INCL::Particle::setPosition().

Referenced by G4INCL::Cluster::initializeParticles().

96  {
97 
98  if(sampleOneProton == &ParticleSampler::sampleOneParticleWithoutRPCorrelation) {
99  // sampling without correlation, we need to initialize the CDF tables
100  theRCDFTable[Proton] = NuclearDensityFactory::createRCDFTable(Proton, theA, theZ);
101  thePCDFTable[Proton] = NuclearDensityFactory::createPCDFTable(Proton, theA, theZ);
102  theRCDFTable[Neutron] = NuclearDensityFactory::createRCDFTable(Neutron, theA, theZ);
103  thePCDFTable[Neutron] = NuclearDensityFactory::createPCDFTable(Neutron, theA, theZ);
104  }
105 
106  ParticleList theList;
107  if(theA > 2) {
108  ParticleType type = Proton;
109  ParticleSamplerMethod sampleOneParticle = sampleOneProton;
110  for(G4int i = 1; i <= theA; ++i) {
111  if(i == (theZ + 1)) { // Nucleons [Z+1..A] are neutrons
112  type = Neutron;
113  sampleOneParticle = sampleOneNeutron;
114  }
115  Particle *p = (this->*sampleOneParticle)(type);
116  p->setPosition(position + p->getPosition());
117  theList.push_back(p);
118  }
119  } else {
120  // For deuterons, only sample the proton position and momentum. The
121  // neutron position and momenta are determined by the conditions of
122  // vanishing CM position and total momentum.
123 // assert(theZ==1);
124  Particle *aProton = (this->*(this->sampleOneProton))(Proton);
125  Particle *aNeutron = new Particle(Neutron, -aProton->getMomentum(), position - aProton->getPosition());
126  aProton->setPosition(position + aProton->getPosition());
127  theList.push_back(aProton);
128  theList.push_back(aNeutron);
129  }
130 
131  return theList;
132  }
InverseInterpolationTable * createPCDFTable(const ParticleType t, const G4int A, const G4int Z)
const char * p
Definition: xmltok.h:285
int G4int
Definition: G4Types.hh:78
UnorderedVector< Particle * > ParticleList
InverseInterpolationTable * createRCDFTable(const ParticleType t, const G4int A, const G4int Z)
void G4INCL::ParticleSampler::setDensity ( NuclearDensity const *const  d)

Setter for theDensity.

Definition at line 68 of file G4INCLParticleSampler.cc.

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

68  {
69  theDensity = d;
70  updateSampleOneParticleMethods();
71  }
void G4INCL::ParticleSampler::setPotential ( NuclearPotential::INuclearPotential const *const  p)

Setter for thePotential.

Definition at line 73 of file G4INCLParticleSampler.cc.

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

73  {
74  thePotential = p;
75  updateSampleOneParticleMethods();
76  }
const char * p
Definition: xmltok.h:285
void G4INCL::ParticleSampler::setRPCorrelationCoefficient ( const ParticleType  t,
const G4double  corrCoeff 
)
inline

Setter for rpCorrelationCoefficient.

Definition at line 84 of file G4INCLParticleSampler.hh.

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

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