Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4INCL::ClusteringModelIntercomparison Class Reference

Cluster coalescence algorithm used in the IAEA intercomparison. More...

#include <G4INCLClusteringModelIntercomparison.hh>

+ Inheritance diagram for G4INCL::ClusteringModelIntercomparison:

Public Member Functions

 ClusteringModelIntercomparison (Config const *const theConfig)
 
virtual ~ClusteringModelIntercomparison ()
 
virtual ClustergetCluster (Nucleus *, Particle *)
 
virtual G4bool clusterCanEscape (Nucleus const *const, Cluster const *const)
 
- Public Member Functions inherited from G4INCL::IClusteringModel
 IClusteringModel ()
 
virtual ~IClusteringModel ()
 
virtual ClustergetCluster (Nucleus *, Particle *)=0
 
virtual G4bool clusterCanEscape (Nucleus const *const, Cluster const *const)=0
 

Detailed Description

Cluster coalescence algorithm used in the IAEA intercomparison.

Definition at line 60 of file G4INCLClusteringModelIntercomparison.hh.

Constructor & Destructor Documentation

◆ ClusteringModelIntercomparison()

G4INCL::ClusteringModelIntercomparison::ClusteringModelIntercomparison ( Config const *const  theConfig)
inline

Definition at line 62 of file G4INCLClusteringModelIntercomparison.hh.

62 :
63 theNucleus(NULL),
64 selectedA(0),
65 selectedZ(0),
66 sqtot(0.),
67 cascadingEnergyPool(0.),
70 runningMaxClusterAlgorithmMass(theConfig->getClusterMaxMass()),
71 nConsideredMax(0),
72 nConsidered(0),
73 consideredPartners(NULL),
74 isInRunningConfiguration(NULL),
75 maxMassConfigurationSkipping(ParticleTable::maxClusterMass)
76 {
77 // Set up the maximum charge and neutron number for clusters
78 clusterZMaxAll = 0;
79 clusterNMaxAll = 0;
80 for(G4int A=0; A<=runningMaxClusterAlgorithmMass; ++A) {
81 if(ParticleTable::clusterZMax[A]>clusterZMaxAll)
82 clusterZMaxAll = ParticleTable::clusterZMax[A];
83 if(A-ParticleTable::clusterZMin[A]>clusterNMaxAll)
84 clusterNMaxAll = A-ParticleTable::clusterZMin[A];
85 }
86 std::fill(candidateConfiguration,
87 candidateConfiguration + ParticleTable::maxClusterMass,
88 static_cast<Particle*>(NULL));
89
90 std::fill(runningEnergies,
91 runningEnergies + ParticleTable::maxClusterMass,
92 0.0);
93
94 std::fill(runningPotentials,
95 runningPotentials + ParticleTable::maxClusterMass,
96 0.0);
97
98 std::fill(runningConfiguration,
99 runningConfiguration + ParticleTable::maxClusterMass,
100 -1);
101
102 }
int G4int
Definition: G4Types.hh:66
static const G4int clusterZMin[maxClusterMass+1]
static G4double getRealMass(const G4INCL::ParticleType t)
Get particle mass (in MeV/c^2)
static const G4int clusterZMax[maxClusterMass+1]
static const G4int maxClusterMass

◆ ~ClusteringModelIntercomparison()

virtual G4INCL::ClusteringModelIntercomparison::~ClusteringModelIntercomparison ( )
inlinevirtual

Definition at line 104 of file G4INCLClusteringModelIntercomparison.hh.

104 {
105 delete [] consideredPartners;
106 delete [] isInRunningConfiguration;
107 }

Member Function Documentation

◆ clusterCanEscape()

G4bool G4INCL::ClusteringModelIntercomparison::clusterCanEscape ( Nucleus const * const  ,
Cluster const * const   
)
virtual

Determine whether cluster can escape or not.

Implements G4INCL::IClusteringModel.

Definition at line 346 of file G4INCLClusteringModelIntercomparison.cc.

346 {
347 // Forbid emission of the whole nucleus
348 if(c->getA()>=n->getA())
349 return false;
350
351 // Check the escape angle of the cluster
352 const ThreeVector &pos = c->getPosition();
353 const ThreeVector &mom = c->getMomentum();
354 const G4double cosEscapeAngle = pos.dot(mom) / std::sqrt(pos.mag2()*mom.mag2());
355 if(cosEscapeAngle < limitCosEscapeAngle)
356 return false;
357
358 return true;
359 }
double G4double
Definition: G4Types.hh:64

◆ getCluster()

Cluster * G4INCL::ClusteringModelIntercomparison::getCluster ( Nucleus ,
Particle  
)
virtual

Choose a cluster candidate to be produced. At this point we don't yet decide if it can pass through the Coulomb barrier or not.

Implements G4INCL::IClusteringModel.

Definition at line 52 of file G4INCLClusteringModelIntercomparison.cc.

52 {
53 // Set the maximum clustering mass dynamically, based on the current nucleus
54 const G4int maxClusterAlgorithmMass = nucleus->getStore()->getConfig()->getClusterMaxMass();
55 runningMaxClusterAlgorithmMass = std::min(maxClusterAlgorithmMass, nucleus->getA()/2);
56
57 // Nucleus too small?
58 if(runningMaxClusterAlgorithmMass<=1)
59 return NULL;
60
61 theNucleus = nucleus;
62 Particle *theLeadingParticle = particle;
63
64 // Initialise sqtot to a large number
65 sqtot = 50000.0;
66 selectedA = 0;
67 selectedZ = 0;
68
69 // The distance parameter, known as h in publications.
70 // Default value is 1 fm.
71 const G4double transp = 1.0;
72
73 const G4double rmaxws = theNucleus->getUniverseRadius();
74
75 // Radius of the sphere where the leading particle is positioned.
76 const G4double Rprime = theNucleus->getDensity()->getNuclearRadius() + transp;
77
78 // Bring the leading particle back to the coalescence sphere
79 const G4double pk = theLeadingParticle->getMomentum().mag();
80 const G4double cospr = theLeadingParticle->getPosition().dot(theLeadingParticle->getMomentum())/(theNucleus->getUniverseRadius() * pk);
81 const G4double arg = rmaxws*rmaxws - Rprime*Rprime;
82 G4double translat;
83
84 if(arg > 0.0) {
85 // coalescence sphere smaller than Rmax
86 const G4double cosmin = std::sqrt(arg)/rmaxws;
87 if(cospr <= cosmin) {
88 // there is an intersection with the coalescence sphere
89 translat = rmaxws * cospr;
90 } else {
91 // no intersection with the coalescence sphere
92 translat = rmaxws * (cospr - std::sqrt(cospr*cospr - cosmin*cosmin));
93 }
94 } else {
95 // coalescence sphere larger than Rmax
96 translat = rmaxws * cospr - std::sqrt(Rprime*Rprime - rmaxws*rmaxws*(1.0 - cospr*cospr));
97 }
98
99 const ThreeVector oldLeadingParticlePosition = theLeadingParticle->getPosition();
100 const ThreeVector leadingParticlePosition = oldLeadingParticlePosition - theLeadingParticle->getMomentum() * (translat/pk);
101 const ThreeVector &leadingParticleMomentum = theLeadingParticle->getMomentum();
102 theLeadingParticle->setPosition(leadingParticlePosition);
103
104 // Initialise the array of considered nucleons
105 const G4int theNucleusA = theNucleus->getA();
106 if(nConsideredMax < theNucleusA) {
107 delete [] consideredPartners;
108 delete [] isInRunningConfiguration;
109 nConsideredMax = 2*theNucleusA;
110 consideredPartners = new Particle *[nConsideredMax];
111 isInRunningConfiguration = new G4bool [nConsideredMax];
112 std::fill(isInRunningConfiguration,
113 isInRunningConfiguration + nConsideredMax,
114 false);
115 }
116
117 // Select the subset of nucleons that will be considered in the
118 // cluster production:
119 cascadingEnergyPool = 0.;
120 nConsidered = 0;
121 const ParticleList particles = theNucleus->getStore()->getParticles();
122 for(ParticleIter i = particles.begin(); i != particles.end(); ++i) {
123 if (!(*i)->isNucleon()) continue; // Only nucleons are allowed in clusters
124 if ((*i)->getID() == theLeadingParticle->getID()) continue; // Don't count the leading particle
125
126 G4double space = ((*i)->getPosition() - leadingParticlePosition).mag2();
127 G4double momentum = ((*i)->getMomentum() - leadingParticleMomentum).mag2();
128 G4double size = space*momentum*ParticleTable::clusterPosFact2[runningMaxClusterAlgorithmMass];
129 // Nucleons are accepted only if they are "close enough" in phase space
130 // to the leading nucleon. The selected phase-space parameter corresponds
131 // to the running maximum cluster mass.
132 if(size < ParticleTable::clusterPhaseSpaceCut[runningMaxClusterAlgorithmMass]) {
133 consideredPartners[nConsidered] = *i;
134 // Keep trace of how much energy is carried by cascading nucleons. This
135 // is used to stop the clustering algorithm as soon as possible.
136 if(!(*i)->isTargetSpectator())
137 cascadingEnergyPool += (*i)->getEnergy() - (*i)->getPotentialEnergy() - 931.3;
138 nConsidered++;
139 // Make sure we don't exceed the array size
140// assert(nConsidered<=nConsideredMax);
141 }
142 }
143 // Sort the list of considered partners so that we give priority
144 // to participants. As soon as we encounter the first spectator in
145 // the list we know that all the remaining nucleons will be
146 // spectators too.
147 std::partition(consideredPartners, consideredPartners+nConsidered, cascadingFirstPredicate);
148
149 // Clear the sets of checked configurations
150 // We stop caching two masses short of the max mass -- there seems to be a
151 // performance hit above
152 maxMassConfigurationSkipping = runningMaxClusterAlgorithmMass-2;
153 for(G4int i=0; i<runningMaxClusterAlgorithmMass-2; ++i) // no caching for A=1,2
154 checkedConfigurations[i].clear();
155
156 // Initialise position, momentum and energy of the running cluster
157 // configuration
158 runningPositions[1] = leadingParticlePosition;
159 runningMomenta[1] = leadingParticleMomentum;
160 runningEnergies[1] = theLeadingParticle->getEnergy();
161 runningPotentials[1] = theLeadingParticle->getPotentialEnergy();
162
163 // Make sure that all the elements of isInRunningConfiguration are false.
164// assert(std::count(isInRunningConfiguration, isInRunningConfiguration+nConsidered, true)==0);
165
166 // Start the cluster search!
167 findClusterStartingFrom(1, theLeadingParticle->getZ());
168
169 // Again, make sure that all the elements of isInRunningConfiguration have
170 // been reset to false. This is a sanity check.
171// assert(std::count(isInRunningConfiguration, isInRunningConfiguration+nConsidered, true)==0);
172
173 Cluster *chosenCluster = 0;
174 if(selectedA!=0) { // A cluster was found!
175 candidateConfiguration[selectedA-1] = theLeadingParticle;
176 chosenCluster = new Cluster(candidateConfiguration,
177 candidateConfiguration + selectedA);
178 }
179
180 // Restore the original position of the leading particle
181 theLeadingParticle->setPosition(oldLeadingParticlePosition);
182
183 return chosenCluster;
184 }
bool G4bool
Definition: G4Types.hh:67
Store * getStore() const
NuclearDensity * getDensity() const
Getter for theDensity.
G4double getUniverseRadius() const
Getter for theUniverseRadius.
static const G4double clusterPosFact2[maxClusterMass+1]
static const G4double clusterPhaseSpaceCut[maxClusterMass+1]
G4double getEnergy() const
G4int getA() const
Returns the baryon number.
ParticleList const & getParticles() const
Definition: G4INCLStore.hh:237
std::list< G4INCL::Particle * > ParticleList
std::list< G4INCL::Particle * >::const_iterator ParticleIter

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