34#define INCLXX_IN_GEANT4_MODE 1
80 :propagationModel(0), theA(208), theZ(82), theS(0),
81 targetInitSuccess(false),
83 maxUniverseRadius(0.),
84 maxInteractionDistance(0.),
85 fixedImpactParameter(0.),
88 forceTransparent(false),
92#ifdef INCLXX_IN_GEANT4_MODE
147#ifndef INCLXX_IN_GEANT4_MODE
165#ifndef INCLXX_IN_GEANT4_MODE
166 NuclearMassTable::deleteTable();
174#ifndef INCLXX_IN_GEANT4_MODE
175 Logger::deleteLoggerSlave();
186 if(A < 0 || A > 300 || Z < 1 || Z > 200) {
187 INCL_ERROR(
"Unsupported target: A = " <<
A <<
" Z = " <<
Z <<
" S = " <<
S <<
'\n'
188 <<
"Target configuration rejected." <<
'\n');
192 (projectileSpecies.
theZ==projectileSpecies.
theA || projectileSpecies.
theZ==0)) {
193 INCL_ERROR(
"Unsupported projectile: A = " << projectileSpecies.
theA <<
" Z = " << projectileSpecies.
theZ <<
" S = " << projectileSpecies.
theS <<
'\n'
194 <<
"Projectile configuration rejected." <<
'\n');
225 if(projectileSpecies.
theA > 0)
260 INCL_WARN(
"Target initialisation failed for A=" << targetA <<
", Z=" << targetZ <<
", S=" << targetS <<
'\n');
311 INCL_DEBUG(
"Selected impact parameter: " << impactParameter <<
'\n');
317 if(effectiveImpactParameter < 0.) {
334 unsigned long loopCounter = 0;
335 const unsigned long maxLoopCounter = 10000000;
349 if(avatar == 0)
break;
386 INCL_DEBUG(
"Trying compound nucleus" <<
'\n');
390#ifndef INCLXX_IN_GEANT4_MODE
400 if(projectileRemnant) {
422#ifdef INCLXX_IN_GEANT4_MODE
452 INCL_DEBUG(
"Cascade resulted in complete fusion, using realistic fusion kinematics" <<
'\n');
458 INCL_WARN(
"Complete-fusion kinematics yields negative excitation energy, returning a transparent!" <<
'\n');
474 INCL_ERROR(
"Computing one-nucleon recoil kinematics. We should never be here nowadays, cascade should stop earlier than this." <<
'\n');
478#ifndef INCLXX_IN_GEANT4_MODE
480 globalConservationChecks(
false);
492#ifndef INCLXX_IN_GEANT4_MODE
494 globalConservationChecks(
true);
533 std::vector<Particle *> shuffledComponents(initialProjectileComponents.begin(), initialProjectileComponents.end());
535 std::shuffle(shuffledComponents.begin(), shuffledComponents.end(),
Random::getAdapter());
538 G4bool atLeastOneNucleonEntering =
false;
539 for(std::vector<Particle*>::const_iterator p=shuffledComponents.begin(), e=shuffledComponents.end(); p!=e; ++p) {
543 (*p)->getPropagationVelocity(),
545 if(!intersectionInteractionDistance.
exists)
549 atLeastOneNucleonEntering =
true;
562 theCNZ += (*p)->getZ();
563 theCNS += (*p)->getS();
573 if(!success || !atLeastOneNucleonEntering) {
574 INCL_DEBUG(
"No nucleon entering in forced CN, forcing a transparent" <<
'\n');
585 theCNEnergy -= theProjectileRemnant->
getEnergy();
586 theCNMomentum -= theProjectileRemnant->
getMomentum();
597 const G4double theCNInvariantMassSquared = theCNEnergy*theCNEnergy-theCNMomentum.
mag2();
598 if(theCNInvariantMassSquared<0.) {
603 const G4double theCNExcitationEnergy = std::sqrt(theCNInvariantMassSquared) - theCNMass;
604 if(theCNExcitationEnergy<0.) {
606 INCL_DEBUG(
"CN excitation energy is negative, forcing a transparent" <<
'\n'
607 <<
" theCNA = " << theCNA <<
'\n'
608 <<
" theCNZ = " << theCNZ <<
'\n'
609 <<
" theCNS = " << theCNS <<
'\n'
610 <<
" theCNEnergy = " << theCNEnergy <<
'\n'
611 <<
" theCNMomentum = (" << theCNMomentum.
getX() <<
", "<< theCNMomentum.
getY() <<
", " << theCNMomentum.
getZ() <<
")" <<
'\n'
612 <<
" theCNExcitationEnergy = " << theCNExcitationEnergy <<
'\n'
613 <<
" theCNSpin = (" << theCNSpin.
getX() <<
", "<< theCNSpin.
getY() <<
", " << theCNSpin.
getZ() <<
")" <<
'\n'
619 INCL_DEBUG(
"CN excitation energy is positive, forcing a CN" <<
'\n'
620 <<
" theCNA = " << theCNA <<
'\n'
621 <<
" theCNZ = " << theCNZ <<
'\n'
622 <<
" theCNS = " << theCNS <<
'\n'
623 <<
" theCNEnergy = " << theCNEnergy <<
'\n'
624 <<
" theCNMomentum = (" << theCNMomentum.
getX() <<
", "<< theCNMomentum.
getY() <<
", " << theCNMomentum.
getZ() <<
")" <<
'\n'
625 <<
" theCNExcitationEnergy = " << theCNExcitationEnergy <<
'\n'
626 <<
" theCNSpin = (" << theCNSpin.
getX() <<
", "<< theCNSpin.
getY() <<
", " << theCNSpin.
getZ() <<
")" <<
'\n'
661 theRecoilFunctor(theSolution.
x);
663 INCL_WARN(
"Couldn't accommodate remnant recoil while satisfying energy conservation, root-finding algorithm failed." <<
'\n');
668#ifndef INCLXX_IN_GEANT4_MODE
669 void INCL::globalConservationChecks(
G4bool afterRecoil) {
675 if(theBalance.
Z != 0) {
678 if(theBalance.
A != 0) {
681 if(theBalance.
S != 0) {
684 G4double EThreshold, pLongThreshold, pTransThreshold;
689 pTransThreshold = 1.;
693 pLongThreshold = 0.1;
694 pTransThreshold = 0.1;
696 if(std::abs(theBalance.
energy)>EThreshold) {
699 if(std::abs(pLongBalance)>pLongThreshold) {
700 INCL_WARN(
"Violation of longitudinal momentum conservation > " << pLongThreshold <<
" MeV/c. pLongBalance = " << pLongBalance <<
" afterRecoil = " << afterRecoil <<
" eventNumber=" <<
theEventInfo.
eventNumber <<
'\n');
702 if(std::abs(pTransBalance)>pTransThreshold) {
703 INCL_WARN(
"Violation of transverse momentum conservation > " << pTransThreshold <<
" MeV/c. pTransBalance = " << pTransBalance <<
" afterRecoil = " << afterRecoil <<
" eventNumber=" <<
theEventInfo.
eventNumber <<
'\n');
718 <<
"), stopping cascade" <<
'\n');
724 INCL_DEBUG(
"No participants in the nucleus and no incoming particles left, stopping cascade" <<
'\n');
731 <<
"), stopping cascade" <<
'\n');
737 INCL_DEBUG(
"Trying to make a compound nucleus, stopping cascade" <<
'\n');
781 G4int nUnmergedSpectators = 0;
784 if(dynSpectators.empty() && geomSpectators.empty()) {
786 }
else if(dynSpectators.size()==1 && geomSpectators.empty()) {
797 nUnmergedSpectators = rejected.size();
805 return nUnmergedSpectators;
819 INCL_DEBUG(
"Initialised interaction distance: r0 = " << r0 <<
'\n'
820 <<
" theNNDistance = " << theNNDistance <<
'\n'
830 for(
IsotopeIter i=theIsotopes.begin(), e=theIsotopes.end(); i!=e; ++i) {
834 rMax =
std::max(maximumRadius, rMax);
840 rMax =
std::max(maximumRadius, rMax);
G4double S(G4double temp)
Alternative CascadeAction for dumping avatars.
Class containing default actions to be performed at intermediate cascade steps.
Static class for cluster formation.
Static class for selecting Coulomb distortion.
Simple container for output of calculation-wide results.
Abstract interface to the nuclear potential.
Simple class for computing intersections between a straight line and a sphere.
Functions that encapsulate a mass table.
static void setBias(const G4double b)
Set the global bias factor.
static void setCutNN(const G4double c)
G4int getCascading() const
void beforeCascadeAction(IPropagationModel *)
void afterAvatarAction(IAvatar *a, Nucleus *n, FinalState *fs)
void afterPropagationAction(IPropagationModel *pm, IAvatar *avatar)
void afterCascadeAction(Nucleus *)
void beforeRunAction(Config const *config)
void beforeAvatarAction(IAvatar *a, Nucleus *n)
void beforePropagationAction(IPropagationModel *pm)
ParticleList const & getParticles() const
void setExcitationEnergy(const G4double e)
Set the excitation energy of the cluster.
void setS(const G4int S)
Set the strangess number of the cluster.
void setSpin(const ThreeVector &j)
Set the spin of the nucleus.
G4INCL::ThreeVector getAngularMomentum() const
Get the total angular momentum (orbital + spin)
void setA(const G4int A)
Set the mass number of the cluster.
void setZ(const G4int Z)
Set the charge number of the cluster.
static std::string const getVersionString()
Get the INCL version string.
G4double getImpactParameter() const
CascadeActionType getCascadeActionType() const
Get the cascade-action type.
G4int getTargetA() const
Get the target mass number.
G4double getDecayTimeThreshold() const
Get the decay time threshold time.
G4double getProjectileKineticEnergy() const
Get the projectile kinetic energy.
G4double getHadronizationTime() const
Get the hadronization time.
ParticleSpecies getProjectileSpecies() const
Get the projectile species.
LocalEnergyType getLocalEnergyPiType() const
Get the type of local energy for pi-N and decay avatars.
G4bool isNaturalTarget() const
Natural targets.
G4int getTargetS() const
Get the target strangess number.
G4double getCutNN() const
LocalEnergyType getLocalEnergyBBType() const
Get the type of local energy for N-N avatars.
G4double getBias() const
Get the bias.
G4int getTargetZ() const
Get the target charge number.
std::string getDeExcitationString() const
Get the de-excitation string.
FinalStateValidity getValidity() const
void fillFinalState(FinalState *fs)
FinalState * getFinalState()
Class to adjust remnant recoil in the reaction CM system.
void initUniverseRadius(ParticleSpecies const &p, const G4double kineticEnergy, const G4int A, const G4int Z)
Initialize the universe radius.
void finalizeGlobalInfo(Random::SeedVector const &initialSeeds)
void initMaxInteractionDistance(ParticleSpecies const &p, const G4double kineticEnergy)
Initialise the maximum interaction distance.
G4bool prepareReaction(const ParticleSpecies &projectileSpecies, const G4double kineticEnergy, const G4int A, const G4int Z, const G4int S)
G4double maxImpactParameter
G4bool initializeTarget(const G4int A, const G4int Z, const G4int S)
INCL(Config const *const config)
const EventInfo & processEvent()
G4bool continueCascade()
Stopping criterion for the cascade.
Config const *const theConfig
CascadeAction * cascadeAction
G4int minRemnantSize
Remnant size below which cascade stops.
G4double maxUniverseRadius
void makeCompoundNucleus()
Make a compound nucleus.
G4double maxInteractionDistance
void cascade()
The actual cascade loop.
G4double fixedImpactParameter
IPropagationModel * propagationModel
G4int makeProjectileRemnant()
Make a projectile pre-fragment out of geometrical spectators.
void updateGlobalInfo()
Update global counters and other members of theGlobalInfo object.
void postCascade()
Finalise the cascade and clean up.
void rescaleOutgoingForRecoil()
Rescale the energies of the outgoing particles.
G4bool preCascade(ParticleSpecies const &projectileSpecies, const G4double kineticEnergy)
Initialise the cascade.
virtual G4double shoot(ParticleSpecies const &projectileSpecies, const G4double kineticEnergy, const G4double impactParameter, const G4double phi)=0
virtual G4INCL::IAvatar * propagate(FinalState const *const fs)=0
virtual G4double getCurrentTime()=0
virtual G4double getStoppingTime()=0
virtual void setNucleus(G4INCL::Nucleus *nucleus)=0
static void deleteBackupParticles()
Release the memory allocated for the backup particles.
Class that stores isotopic abundances for a given element.
IsotopeVector const & getIsotopes() const
Get the isotope vector.
G4bool decayOutgoingNeutralKaon()
Force the transformation of outgoing Neutral Kaon into propation eigenstate.
G4bool containsSigma()
Returns true if the nucleus contains any Sigma.
const ThreeVector & getIncomingAngularMomentum() const
Get the incoming angular-momentum vector.
ProjectileRemnant * getProjectileRemnant() const
Get the projectile remnant.
void fillEventInfo(EventInfo *eventInfo)
G4bool decayMe()
Force the phase-space decay of the Nucleus.
G4bool decayInsideDeltas()
Force the decay of deltas inside the nucleus.
void computeRecoilKinematics()
Compute the recoil momentum and spin of the nucleus.
void finalizeProjectileRemnant(const G4double emissionTime)
Finalise the projectile remnant.
G4bool containsDeltas()
Returns true if the nucleus contains any deltas.
G4bool getTryCompoundNucleus()
G4bool emitInsideKaon()
Force emission of all Kaon inside the nucleus.
G4bool isEventTransparent() const
Is the event transparent?
void applyFinalState(FinalState *)
G4bool isNucleusNucleusCollision() const
Is it a nucleus-nucleus collision?
G4bool containsKaon()
Returns true if the nucleus contains any Kaons.
void emitInsideStrangeParticles()
Force emission of all strange particles inside the nucleus.
G4bool decayOutgoingPionResonances(G4double timeThreshold)
Force the decay of outgoing PionResonances (eta/omega).
void useFusionKinematics()
Adjust the kinematics for complete-fusion events.
G4bool containsLambda()
Returns true if the nucleus contains any Lambda.
const ThreeVector & getIncomingMomentum() const
Get the incoming momentum vector.
G4bool decayOutgoingClusters()
Force the decay of unstable outgoing clusters.
G4double getExcitationEnergy() const
Get the excitation energy of the nucleus.
G4int emitInsideLambda()
Force emission of all Lambda (desexitation code with strangeness not implanted yet)
G4bool decayInsideStrangeParticles()
Force the transformation of strange particles into a Lambda;.
ConservationBalance getConservationBalance(EventInfo const &theEventInfo, const G4bool afterRecoil) const
Compute charge, mass, energy and momentum balance.
void initializeParticles()
G4bool hasRemnant() const
Does the nucleus give a cascade remnant?
G4double computeExcitationEnergy() const
Compute the current excitation energy.
G4bool containsAntiKaon()
Returns true if the nucleus contains any anti Kaons.
G4bool decayOutgoingDeltas()
Force the decay of outgoing deltas.
G4bool decayOutgoingSigmaZero(G4double timeThreshold)
Force the decay of outgoing Neutral Sigma.
G4int getS() const
Returns the strangeness number.
G4double getEnergy() const
static std::vector< G4double > INCLBiasVector
Time ordered vector of all bias applied.
void setMass(G4double mass)
G4int getZ() const
Returns the charge number.
static G4double getTotalBias()
General bias vector function.
const G4INCL::ThreeVector & getMomentum() const
virtual void setMomentum(const G4INCL::ThreeVector &momentum)
void setEnergy(G4double energy)
static G4ThreadLocal G4int nextBiasedCollisionID
G4int getA() const
Returns the baryon number.
ParticleList addAllDynamicalSpectators(ParticleList const &pL)
Add back all dynamical spectators to the projectile remnant.
void reset()
Reset the projectile remnant to the state at the beginning of the cascade.
ParticleList const & getIncomingParticles() const
void deleteIncoming()
Clear the incoming list and delete the particles.
ParticleList const & getOutgoingParticles() const
void addToOutgoing(Particle *p)
add the particle to the outgoing particle list.
void clearIncoming()
Clear the incoming list.
void addParticleEntryAvatar(IAvatar *a)
Add one ParticleEntry avatar.
ParticleList extractDynamicalSpectators()
Returns a list of dynamical spectators.
void initialize(Config const *const theConfig)
Initialize the clustering model based on the Config object.
void deleteClusteringModel()
Delete the clustering model.
void initialize(Config const *const theConfig)
Initialize the Coulomb-distortion algorithm.
void deleteCoulomb()
Delete the Coulomb-distortion object.
void distortOut(ParticleList const &pL, Nucleus const *const n)
Modify the momentum of an outgoing particle.
G4double maxImpactParameter(ParticleSpecies const &p, const G4double kinE, Nucleus const *const n)
Return the maximum impact parameter for Coulomb-distorted trajectories.
G4double interactionDistanceKbarN(const G4double projectileKineticEnergy)
Compute the "interaction distance".
G4double interactionDistancePiN(const G4double projectileKineticEnergy)
Compute the "interaction distance".
G4double interactionDistanceKN(const G4double projectileKineticEnergy)
Compute the "interaction distance".
G4double interactionDistanceYN(const G4double projectileKineticEnergy)
Compute the "interaction distance".
void deleteCrossSections()
void initialize(Config const *const theConfig)
G4double interactionDistanceNN(const ParticleSpecies &aSpecies, const G4double kineticEnergy)
Compute the "interaction distance".
Intersection getEarlierTrajectoryIntersection(const ThreeVector &x0, const ThreeVector &p, const G4double r)
Compute the first intersection of a straight particle trajectory with a sphere.
void initVerbosityLevelFromEnvvar()
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
void clearCache()
Clear the INuclearPotential cache.
G4ThreadLocal NuclearMassFn getTableMass
Static pointer to the mass function for nuclei.
void initialize(Config const *const theConfig=0)
Initialize the particle table.
G4int drawRandomNaturalIsotope(const G4int Z)
G4double getMaximumNuclearRadius(const ParticleType t, const G4int A, const G4int Z)
IsotopicDistribution const & getNaturalIsotopicDistribution(const G4int Z)
G4double getNuclearRadius(const ParticleType t, const G4int A, const G4int Z)
void initialize(Config const *const aConfig)
Initialise blockers according to a Config object.
void deleteBlockers()
Delete blockers.
void initialize(Config const *const theConfig)
void deletePhaseSpaceGenerator()
Adapter const & getAdapter()
void initialize(Config const *const)
Initialize generator according to a Config object.
Solution solve(RootFunctor const *const f, const G4double x0)
Numerically solve a one-dimensional equation.
IsotopeVector::iterator IsotopeIter
std::vector< Isotope > IsotopeVector
Bool_t pionAbsorption
True if the event is a pion absorption.
void reset()
Reset the EventInfo members.
Bool_t lambdasInside
Event involved lambdas in the nucleus at the end of the cascade.
Bool_t forcedDeltasOutside
Event involved forced delta decays outside the nucleus.
Short_t At
Mass number of the target nucleus.
Short_t Zp
Charge number of the projectile nucleus.
Int_t projectileType
Projectile particle type.
Float_t pTransBalance
Transverse momentum-conservation balance [MeV/c].
Float_t Ep
Projectile kinetic energy given as input.
Short_t nCascadeParticles
Number of cascade particles.
Float_t eventBias
Event bias.
Bool_t transparent
True if the event is transparent.
Bool_t sigmasInside
Event involved sigmas in the nucleus at the end of the cascade.
Bool_t deltasInside
Event involved deltas in the nucleus at the end of the cascade.
Float_t EBalance
Energy-conservation balance [MeV].
Bool_t forcedPionResonancesOutside
Event involved forced eta/omega decays outside the nucleus.
Bool_t nucleonAbsorption
True if the event is a nucleon absorption.
Int_t emitLambda
Number of forced Lambda emit out of the nucleus.
Short_t St
Strangeness number of the target nucleus.
Float_t effectiveImpactParameter
Effective (Coulomb-distorted) impact parameter [fm].
Bool_t kaonsInside
Event involved kaons in the nucleus at the end of the cascade.
Float_t stoppingTime
Cascade stopping time [fm/c].
Int_t nEnergyViolationInteraction
Number of attempted collisions/decays for which the energy-conservation algorithm failed to find a so...
Short_t Ap
Mass number of the projectile nucleus.
Short_t Sp
Strangeness number of the projectile nucleus.
Bool_t emitKaon
Event involved forced Kaon emission.
Bool_t antikaonsInside
Event involved antikaons in the nucleus at the end of the cascade.
Bool_t clusterDecay
Event involved cluster decay.
Bool_t forcedDeltasInside
Event involved forced delta decays inside the nucleus.
Short_t Zt
Charge number of the target nucleus.
static G4ThreadLocal Int_t eventNumber
Number of the event.
Float_t impactParameter
Impact parameter [fm].
Bool_t absorbedStrangeParticle
Event involved forced strange absorption inside the nucleus.
Int_t nUnmergedSpectators
Number of dynamical spectators that were merged back into the projectile remnant.
Float_t pLongBalance
Longitudinal momentum-conservation balance [MeV/c].
Int_t nNucleonAbsorptions
Number of nucleon absorptions (no outcoming particles)
std::string deexcitationModel
Name of the de-excitation model.
Float_t forcedCNCrossSection
Calculated forced-compound-nucleus cross section.
Float_t pionAbsorptionCrossSection
Pion absorption cross section.
Float_t errorCompleteFusionCrossSection
Error on the calculated complete-fusion cross section (nParticles==0)
Short_t St
Target strangeness number given as input.
Float_t Ep
Projectile kinetic energy given as input.
Int_t nEnergyViolationInteraction
Number of attempted collisions/decays for which the energy-conservation algorithm failed to find a so...
Float_t biasFactor
Bias factor.
std::vector< Int_t > initialRandomSeeds
Initial seeds for the pseudo-random-number generator.
Short_t At
Target mass number given as input.
Int_t nShots
Number of shots.
Float_t completeFusionCrossSection
Calculated complete-fusion cross section (nParticles==0)
Float_t nucleonAbsorptionCrossSection
Nucleon absorption cross section.
Float_t errorReactionCrossSection
Error on the calculated reaction cross section.
Short_t Zt
Target charge number given as input.
std::vector< Int_t > finalRandomSeeds
Final seeds for the pseudo-random-number generator.
Int_t nPionAbsorptions
Number of nucleon absorptions (no outcoming pions)
Short_t Ap
Projectile mass number given as input.
Float_t energyViolationInteractionCrossSection
Cross section for attempted collisions/decays for which the energy-conservation algorithm failed to f...
Int_t nCompleteFusion
Number of complete-fusion events (nParticles==0)
Int_t nTransparents
Number of transparent shots.
Short_t Sp
Projectile strangeness number given as input.
Int_t nForcedCompoundNucleus
Number of forced compound-nucleus events.
Short_t Zp
Projectile charge number given as input.
Int_t nForcedTransparents
Number of forced transparents.
std::string cascadeModel
Name of the cascade model.
Float_t reactionCrossSection
Calculated reaction cross section.
Float_t errorForcedCNCrossSection
Error on the calculated forced-compound-nucleus cross section.
Float_t geometricCrossSection
Geometric cross section.
Intersection-point structure.
Struct for conservation laws.