34 #define INCLXX_IN_GEANT4_MODE 1 87 theParticipantType(rhs.theParticipantType),
89 theEnergy(rhs.theEnergy),
90 theFrozenEnergy(rhs.theFrozenEnergy),
91 theMomentum(rhs.theMomentum),
92 theFrozenMomentum(rhs.theFrozenMomentum),
93 thePosition(rhs.thePosition),
94 nCollisions(rhs.nCollisions),
96 thePotentialEnergy(rhs.thePotentialEnergy),
97 rpCorrelated(rhs.rpCorrelated),
98 uncorrelatedMomentum(rhs.uncorrelatedMomentum),
99 theHelicity(rhs.theHelicity),
100 emissionTime(rhs.emissionTime),
101 outOfWell(rhs.outOfWell),
105 thePropagationEnergy = &theFrozenEnergy;
107 thePropagationEnergy = &theEnergy;
109 thePropagationMomentum = &theFrozenMomentum;
111 thePropagationMomentum = &theMomentum;
119 std::swap(theZ, rhs.
theZ);
120 std::swap(theA, rhs.
theA);
122 std::swap(theType, rhs.
theType);
124 thePropagationEnergy = &theFrozenEnergy;
126 thePropagationEnergy = &theEnergy;
130 thePropagationMomentum = &theFrozenMomentum;
132 thePropagationMomentum = &theMomentum;
137 std::swap(nDecays, rhs.
nDecays);
145 std::swap(theMass, rhs.
theMass);
158 swap(temporaryParticle);
217 INCL_ERROR(
"Trying to set particle type to Unknown!" <<
'\n');
236 return theParticipantType;
240 theParticipantType = p;
297 return theMomentum / theEnergy;
308 const G4double gamma = 1.0 / std::sqrt(1.0 - beta2);
309 const G4double bp = theMomentum.dot(aBoostVector);
312 theMomentum = theMomentum + aBoostVector * (alpha * bp - gamma * theEnergy);
313 theEnergy = gamma * (theEnergy -
bp);
326 const G4double gamma = 1.0 / std::sqrt(1.0 - beta2);
327 const ThreeVector theRelativePosition = thePosition - refPos;
328 const ThreeVector transversePosition = theRelativePosition - aBoostVector * (theRelativePosition.
dot(aBoostVector) / aBoostVector.
mag2());
329 const ThreeVector longitudinalPosition = theRelativePosition - transversePosition;
331 thePosition = refPos + transversePosition + longitudinalPosition / gamma;
360 INCL_ERROR(
"Particle::getINCLMass: Unknown particle type." <<
'\n');
389 INCL_ERROR(
"Particle::getTableMass: Unknown particle type." <<
'\n');
418 INCL_ERROR(
"Particle::getRealMass: Unknown particle type." <<
'\n');
445 const G4int ADaughter = AParent - theA;
446 const G4int ZDaughter = ZParent - theZ;
456 theQValue = massTableParent - massTableDaughter - massTableParticle;
464 return theQValue - (massINCLParent-massINCLDaughter-massINCLParticle);
483 const G4int AFromDaughter = AFrom - theA;
484 const G4int ZFromDaughter = ZFrom - theZ;
485 const G4int AToDaughter = ATo + theA;
486 const G4int ZToDaughter = ZTo + theZ;
499 return theQValue - (massINCLToDaughter-massINCLTo-massINCLParticle);
508 const G4double mass = std::pow(theEnergy, 2) - theMomentum.dot(theMomentum);
513 return std::sqrt(mass);
539 this->theMass = mass;
561 return thePosition.
vector(theMomentum);
569 this->theMomentum = momentum;
589 thePosition += ((*thePropagationMomentum)*(step/(*thePropagationEnergy)));
628 return thePosition - getLongitudinalPosition();
633 return *thePropagationMomentum * (thePosition.dot(*thePropagationMomentum)/thePropagationMomentum->mag2());
640 G4double adjustEnergyFromMomentum();
668 thePropagationMomentum = &theFrozenMomentum;
669 thePropagationEnergy = &theFrozenEnergy;
679 thePropagationMomentum = &theMomentum;
680 thePropagationEnergy = &theEnergy;
699 thePosition.rotate(angle, axis);
708 theMomentum.rotate(angle, axis);
709 theFrozenMomentum.rotate(angle, axis);
713 std::stringstream ss;
714 ss <<
"Particle (ID = " << ID <<
") type = ";
717 <<
" energy = " << theEnergy <<
'\n' 719 << theMomentum.print()
722 << thePosition.print()
728 std::stringstream ss;
729 ss <<
"(particle " << ID <<
" ";
732 << thePosition.dump()
734 << theMomentum.dump()
736 << theEnergy <<
")" <<
'\n';
746 INCL_WARN(
"Particle::getParticles() method was called on a Particle object" <<
'\n');
758 return theMomentum.mag();
760 return uncorrelatedMomentum;
774 const G4double norm = thePosition.mag2()*thePropagationMomentum->mag2();
776 return thePosition.dot(*thePropagationMomentum) / std::sqrt(norm);
ParticipantType theParticipantType
#define INCL_DECLARE_ALLOCATION_POOL(T)
void setParticipantType(ParticipantType const p)
void setMass(G4double mass)
ThreeVector boostVector() const
G4bool isOutOfWell() const
Check if the particle is out of its potential well.
virtual void makeTargetSpectator()
G4double * thePropagationEnergy
G4ThreadLocal ParticleMassFn getTableParticleMass
Static pointer to the mass function for particles.
G4double getEnergy() const
G4bool isPion() const
Is this a pion?
ThreeVector getFrozenMomentum() const
Get the frozen particle momentum.
G4double getINCLMass() const
Get the INCL particle mass.
const G4INCL::ThreeVector & getPosition() const
G4double getEmissionTime()
G4double getMass() const
Get the cached particle mass.
void setEmissionTime(G4double t)
G4INCL::ThreeVector theFrozenMomentum
G4double getTableQValue(const G4int A1, const G4int Z1, const G4int A2, const G4int Z2)
Get Q-value (in MeV/c^2)
G4double getReflectionMomentum() const
Return the reflection momentum.
virtual void rotatePosition(const G4double angle, const ThreeVector &axis)
Rotate the particle position.
void boost(const ThreeVector &aBoostVector)
static G4double angle[DIM]
void setINCLMass()
Set the mass of the Particle to its table mass.
void thawPropagation()
Unfreeze particle propagation.
virtual void makeProjectileSpectator()
void propagate(G4double step)
Singleton for recycling allocation of instances of a given class.
void setOutOfWell()
Mark the particle as out of its potential well.
void rotateMomentum(const G4double angle, const ThreeVector &axis) const
void incrementNumberOfCollisions()
Increment the number of collisions undergone by the particle.
virtual void rotateMomentum(const G4double angle, const ThreeVector &axis)
Rotate the particle momentum.
void setUncorrelatedMomentum(const G4double p)
Set the uncorrelated momentum.
G4int getA() const
Returns the baryon number.
G4double uncorrelatedMomentum
G4int getZ() const
Returns the charge number.
G4double getKineticEnergy() const
Get the particle kinetic energy.
std::string print() const
void incrementNumberOfDecays()
Increment the number of decays undergone by the particle.
void rpCorrelate()
Make the particle follow a strict r-p correlation.
void setEnergy(G4double energy)
G4double getFrozenEnergy() const
Get the frozen particle momentum.
ThreeVector vector(const ThreeVector &v) const
G4double getRealMass(const G4INCL::ParticleType t)
Get particle mass (in MeV/c^2)
G4int getNumberOfCollisions() const
Return the number of collisions undergone by the particle.
void boost(const ThreeVector &b) const
G4bool isTargetSpectator() const
void rpDecorrelate()
Make the particle not follow a strict r-p correlation.
void setNumberOfDecays(G4int n)
Set the number of decays undergone by the particle.
G4INCL::ParticleType getType() const
ParticleList const * getParticles() const
void lorentzContract(const ThreeVector &aBoostVector, const ThreeVector &refPos)
Lorentz-contract the particle position around some center.
virtual void setPosition(const G4INCL::ThreeVector &position)
G4bool isDelta() const
Is it a Delta?
void setPotentialEnergy(G4double v)
Set the particle potential energy.
static G4ThreadLocal long nextID
virtual G4double getTableMass() const
Get the tabulated particle mass.
G4double dot(const ThreeVector &v) const
G4int getNumberOfDecays() const
Return the number of decays undergone by the particle.
G4INCL::ThreeVector thePosition
G4double getTransferQValueCorrection(const G4int AFrom, const G4int ZFrom, const G4int ATo, const G4int ZTo) const
Computes correction on the transfer Q-value.
Particle(const Particle &rhs)
Copy constructor.
void rotatePosition(const G4double angle, const ThreeVector &axis) const
G4INCL::ParticleType theType
void setFrozenMomentum(const ThreeVector &momentum)
Set the frozen particle momentum.
G4double getPotentialEnergy() const
Get the particle potential energy.
G4double getINCLMass(const G4int A, const G4int Z)
Get INCL nuclear mass (in MeV/c^2)
G4ThreadLocal NuclearMassFn getTableMass
Static pointer to the mass function for nuclei.
void setTableMass()
Set the mass of the Particle to its table mass.
void setRealMass()
Set the mass of the Particle to its real mass.
void swap(Particle &rhs)
Helper method for the assignment operator.
ThreeVector getTransversePosition() const
Transverse component of the position w.r.t. the momentum.
ThreeVector getLongitudinalPosition() const
Longitudinal component of the position w.r.t. the momentum.
void rotatePositionAndMomentum(const G4double angle, const ThreeVector &axis) const
void setType(ParticleType t)
G4bool isProjectileSpectator() const
void setNumberOfCollisions(G4int n)
Set the number of collisions undergone by the particle.
G4double getRealMass() const
Get the real particle mass.
G4double getCosRPAngle() const
Get the cosine of the angle between position and momentum.
Particle & operator=(const Particle &rhs)
Assignment operator.
G4INCL::ThreeVector theMomentum
virtual G4INCL::ParticleSpecies getSpecies() const
Get the particle species.
virtual void makeParticipant()
const G4INCL::ThreeVector & getMomentum() const
G4INCL::ThreeVector * thePropagationMomentum
static const G4double alpha
G4double getInvariantMass() const
Get the the particle invariant mass.
ParticleList::iterator ParticleMutableIter
virtual void rotatePositionAndMomentum(const G4double angle, const ThreeVector &axis)
Rotate the particle position and momentum.
virtual G4INCL::ThreeVector getAngularMomentum() const
G4bool isResonance() const
Is it a resonance?
ThreeVector getPropagationVelocity() const
Get the propagation velocity of the particle.
G4double thePotentialEnergy
ParticipantType getParticipantType() const
ParticleList::const_iterator ParticleIter
G4bool isParticipant() const
G4double getEmissionQValueCorrection(const G4int AParent, const G4int ZParent) const
Computes correction on the emission Q-value.
std::string getName(const ParticleType t)
Get the native INCL name of the particle.
void setHelicity(G4double h)
virtual void setMomentum(const G4INCL::ThreeVector &momentum)
void setFrozenEnergy(const G4double energy)
Set the frozen particle momentum.
void freezePropagation()
Freeze particle propagation.