Geant4 11.2.2
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 ()
 

Detailed Description

Cluster coalescence algorithm used in the IAEA intercomparison.

Definition at line 96 of file G4INCLClusteringModelIntercomparison.hh.

Constructor & Destructor Documentation

◆ ClusteringModelIntercomparison()

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

Definition at line 98 of file G4INCLClusteringModelIntercomparison.hh.

98 :
99 theNucleus(NULL),
100 selectedA(0),
101 selectedZ(0),
102 selectedS(0),
103 sqtot(0.),
104 cascadingEnergyPool(0.),
108 runningMaxClusterAlgorithmMass(theConfig->getClusterMaxMass()),
109 nConsideredMax(0),
110 nConsidered(0),
111 consideredPartners(NULL),
112 isInRunningConfiguration(NULL),
113 maxMassConfigurationSkipping(ParticleTable::maxClusterMass)
114 {
115 // Set up the maximum charge and neutron number for clusters
116 clusterZMaxAll = 0;
117 clusterNMaxAll = 0;
118 for(G4int A=0; A<=runningMaxClusterAlgorithmMass; ++A) {
119 if(clusterZMax[A]>clusterZMaxAll)
120 clusterZMaxAll = clusterZMax[A];
121 if(A-clusterZMin[A]>clusterNMaxAll)
122 clusterNMaxAll = A-clusterZMin[A];
123 }
124 std::fill(candidateConfiguration,
125 candidateConfiguration + ParticleTable::maxClusterMass,
126 static_cast<Particle*>(NULL));
127
128 std::fill(runningEnergies,
129 runningEnergies + ParticleTable::maxClusterMass,
130 0.0);
131
132 std::fill(runningPotentials,
133 runningPotentials + ParticleTable::maxClusterMass,
134 0.0);
135
136 std::fill(runningConfiguration,
137 runningConfiguration + ParticleTable::maxClusterMass,
138 -1);
139
140 }
int G4int
Definition G4Types.hh:85
const G4double A[17]
G4double getRealMass(const G4INCL::ParticleType t)
Get particle mass (in MeV/c^2)

◆ ~ClusteringModelIntercomparison()

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

Definition at line 142 of file G4INCLClusteringModelIntercomparison.hh.

142 {
143 delete [] consideredPartners;
144 delete [] isInRunningConfiguration;
145 }

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 380 of file G4INCLClusteringModelIntercomparison.cc.

380 {
381 // Forbid emission of the whole nucleus
382 if(c->getA()>=n->getA() || c->getS()>0)
383 return false;
384
385 // Check the escape angle of the cluster
386 const ThreeVector &pos = c->getPosition();
387 const ThreeVector &mom = c->getMomentum();
388 const G4double cosEscapeAngle = pos.dot(mom) / std::sqrt(pos.mag2()*mom.mag2());
389 if(cosEscapeAngle < limitCosEscapeAngle)
390 return false;
391
392 return true;
393 }
double G4double
Definition G4Types.hh:83

◆ 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 80 of file G4INCLClusteringModelIntercomparison.cc.

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

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