Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Public Member Functions
G4INCL::ClusteringModelIntercomparison Class Reference

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

#include <G4INCLClusteringModelIntercomparison.hh>

Inheritance diagram for G4INCL::ClusteringModelIntercomparison:
G4INCL::IClusteringModel

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 92 of file G4INCLClusteringModelIntercomparison.hh.

Constructor & Destructor Documentation

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

Definition at line 94 of file G4INCLClusteringModelIntercomparison.hh.

References G4INCL::ParticleTable::maxClusterMass.

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

Definition at line 136 of file G4INCLClusteringModelIntercomparison.hh.

136  {
137  delete [] consideredPartners;
138  delete [] isInRunningConfiguration;
139  }

Member Function Documentation

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

Determine whether cluster can escape or not.

Implements G4INCL::IClusteringModel.

Definition at line 373 of file G4INCLClusteringModelIntercomparison.cc.

References G4INCL::ThreeVector::dot(), G4INCL::Particle::getA(), G4INCL::Particle::getMomentum(), G4INCL::Particle::getPosition(), and G4INCL::ThreeVector::mag2().

373  {
374  // Forbid emission of the whole nucleus
375  if(c->getA()>=n->getA())
376  return false;
377 
378  // Check the escape angle of the cluster
379  const ThreeVector &pos = c->getPosition();
380  const ThreeVector &mom = c->getMomentum();
381  const G4double cosEscapeAngle = pos.dot(mom) / std::sqrt(pos.mag2()*mom.mag2());
382  if(cosEscapeAngle < limitCosEscapeAngle)
383  return false;
384 
385  return true;
386  }
const G4int n
double G4double
Definition: G4Types.hh:76
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 79 of file G4INCLClusteringModelIntercomparison.cc.

References G4INCL::ThreeVector::dot(), energy(), G4INCL::Particle::getA(), G4INCL::Config::getClusterMaxMass(), G4INCL::Store::getConfig(), G4INCL::Nucleus::getDensity(), G4INCL::Particle::getEnergy(), G4INCL::Particle::getID(), G4INCL::Particle::getMomentum(), G4INCL::Store::getParticles(), G4INCL::Particle::getPosition(), G4INCL::Particle::getPotentialEnergy(), G4INCL::NuclearDensity::getProtonNuclearRadius(), G4INCL::Nucleus::getStore(), G4INCL::Nucleus::getUniverseRadius(), G4INCL::Particle::getZ(), G4INCL::ThreeVector::mag(), G4INCL::Math::min(), and G4INCL::Particle::setPosition().

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

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