34#define INCLXX_IN_GEANT4_MODE 1
46 const G4int ClusteringModelIntercomparison::clusterZMin[
ParticleTable::maxClusterMass+1] = {0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3};
47 const G4int ClusteringModelIntercomparison::clusterZMax[
ParticleTable::maxClusterMass+1] = {0, 0, 1, 2, 3, 3, 5, 5, 6, 6, 7, 7, 8};
61 0.0082645, 0.0069444};
72#ifdef INCL_DO_NOT_COMPILE
74 G4bool cascadingFirstPredicate(ConsideredPartner
const &aPartner) {
75 return !aPartner.isTargetSpectator;
90 Particle *theLeadingParticle = particle;
109 const G4double arg = rmaxws*rmaxws - Rprime*Rprime;
114 const G4double cosmin = std::sqrt(arg)/rmaxws;
115 if(cospr <= cosmin) {
117 translat = rmaxws * cospr;
120 translat = rmaxws * (cospr - std::sqrt(cospr*cospr - cosmin*cosmin));
124 translat = rmaxws * cospr - std::sqrt(Rprime*Rprime - rmaxws*rmaxws*(1.0 - cospr*cospr));
128 const ThreeVector leadingParticlePosition = oldLeadingParticlePosition - theLeadingParticle->
getMomentum() * (translat/pk);
130 theLeadingParticle->
setPosition(leadingParticlePosition);
150 for(
ParticleIter i=particles.begin(), e=particles.end(); i!=e; ++i) {
151 if (!(*i)->isNucleonorLambda())
continue;
152 if ((*i)->getID() == theLeadingParticle->
getID())
continue;
154 G4double space = ((*i)->getPosition() - leadingParticlePosition).mag2();
155 G4double momentum = ((*i)->getMomentum() - leadingParticleMomentum).mag2();
164 if(!(*i)->isTargetSpectator())
177#ifndef INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_None
211 theLeadingParticle->
setPosition(oldLeadingParticlePosition);
213 return chosenCluster;
223 const G4int newA = oldA + 1;
224 const G4int oldAMinusOne = oldA - 1;
233 const G4bool cachingEnabled = (newA<=maxMassConfigurationSkipping && newA>=3);
236#if defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_HashMask)
237 HashContainer *theHashContainer;
241 theHashContainer = NULL;
242#elif defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set)
247 theConfigContainer = NULL;
248#elif !defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_None)
249#error Unrecognized INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON. Allowed values are: Set, HashMask, None.
263 newZ = oldZ + candidateNucleon.
Z;
264 newS = oldS + candidateNucleon.
S;
275 if(phaseSpace > phaseSpaceCut)
continue;
279#if defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_HashMask)
280 Hashing::HashType configHash;
281 HashIterator aHashIter;
282#elif defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set)
287#if defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_HashMask)
289 aHashIter = theHashContainer->lower_bound(configHash);
291 if(aHashIter!=theHashContainer->end()
292 && !(configHash < *aHashIter))
294#elif defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set)
296 thisConfigIter = theConfigContainer->lower_bound(thisConfig);
298 if(thisConfigIter!=theConfigContainer->end()
299 && !(thisConfig < *thisConfigIter))
317 const G4double halfB = 0.72 * newZ *
332#if defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_HashMask)
333 theHashContainer->insert(aHashIter, configHash);
334#elif defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set)
335 theConfigContainer->insert(thisConfigIter, thisConfig);
344 if(newZ >= ZMinForNewA && newZ <= ZMaxForNewA) {
361 for(
G4int j=0; j<oldA; ++j)
static const G4double pos
Functions for hashing a collection of NucleonItems.
Class for storing and comparing sorted nucleon configurations.
void fill(NucleonItem *config, size_t n)
Fill configuration with array of NucleonItem.
const G4double lambdaMass
const G4double protonMass
G4double getPhaseSpace(const G4int oldA, ConsideredPartner const &p)
const G4double neutronMass
static const G4double clusterPhaseSpaceCut[ParticleTable::maxClusterMass+1]
Phase-space parameters for cluster formation.
static const G4double clusterPosFact[ParticleTable::maxClusterMass+1]
Precomputed factor 1.0/A.
G4int runningMaxClusterAlgorithmMass
SortedNucleonConfigurationContainer checkedConfigurations[ParticleTable::maxClusterMass-2]
Array of containers for configurations that have already been checked.
static const G4double limitCosEscapeAngle
G4double runningPotentials[ParticleTable::maxClusterMass+1]
ThreeVector runningMomenta[ParticleTable::maxClusterMass+1]
G4double runningEnergies[ParticleTable::maxClusterMass+1]
SortedNucleonConfigurationContainer::iterator SortedNucleonConfigurationIterator
static const G4int clusterZMin[ParticleTable::maxClusterMass+1]
Lower limit of Z for cluster of mass A.
void findClusterStartingFrom(const G4int oldA, const G4int oldZ, const G4int oldS)
G4int runningConfiguration[ParticleTable::maxClusterMass]
G4bool * isInRunningConfiguration
Array of flags for nucleons in the running configuration.
static const G4double clusterPosFact2[ParticleTable::maxClusterMass+1]
Precomputed factor (1.0/A)^2.
static const G4int clusterZMax[ParticleTable::maxClusterMass+1]
Upper limit of Z for cluster of mass A.
ThreeVector runningPositions[ParticleTable::maxClusterMass+1]
virtual G4bool clusterCanEscape(Nucleus const *const, Cluster const *const)
G4int maxMassConfigurationSkipping
Maximum mass for configuration storage.
G4double cascadingEnergyPool
ConsideredPartner * consideredPartners
Array of considered cluster partners.
std::set< SortedNucleonConfiguration > SortedNucleonConfigurationContainer
virtual Cluster * getCluster(Nucleus *, Particle *)
Particle * candidateConfiguration[ParticleTable::maxClusterMass]
Best cluster configuration.
G4int getClusterMaxMass() const
Get the maximum mass for production of clusters.
G4double getProtonNuclearRadius() const
NuclearDensity const * getDensity() const
Getter for theDensity.
G4double getUniverseRadius() const
Getter for theUniverseRadius.
G4int getS() const
Returns the strangeness number.
G4double getEnergy() const
G4double getPotentialEnergy() const
Get the particle potential energy.
G4int getZ() const
Returns the charge number.
const G4INCL::ThreeVector & getPosition() const
const G4INCL::ThreeVector & getMomentum() const
virtual void setPosition(const G4INCL::ThreeVector &position)
G4int getA() const
Returns the baryon number.
ParticleList const & getParticles() const
Config const * getConfig()
G4double dot(const ThreeVector &v) const
G4double invariantMass(const G4double E, const ThreeVector &p)
G4double energy(const ThreeVector &p, const G4double m)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4double getRealMass(const G4INCL::ParticleType t)
Get particle mass (in MeV/c^2)
const G4int maxClusterMass
ParticleList::const_iterator ParticleIter
Container for the relevant information.