Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4INCL::ClusteringModelIntercomparison Class Reference

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

#include <G4INCLClusteringModelIntercomparison.hh>

Inheritance diagram for G4INCL::ClusteringModelIntercomparison:
Collaboration 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 93 of file G4INCLClusteringModelIntercomparison.hh.

Constructor & Destructor Documentation

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

Definition at line 95 of file G4INCLClusteringModelIntercomparison.hh.

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

Here is the call graph for this function:

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

Definition at line 137 of file G4INCLClusteringModelIntercomparison.hh.

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

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

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

Here is the call graph for this function:

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)->isNucleon()) continue; // Only nucleons 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());
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  }
G4int getA() const
Returns the baryon number.
ParticleList const & getParticles() const
Definition: G4INCLStore.hh:253
Store * getStore() const
int G4int
Definition: G4Types.hh:78
G4double getProtonNuclearRadius() const
bool G4bool
Definition: G4Types.hh:79
NuclearDensity const * getDensity() const
Getter for theDensity.
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 getUniverseRadius() const
Getter for theUniverseRadius.
double G4double
Definition: G4Types.hh:76
ParticleList::const_iterator ParticleIter

Here is the call graph for this function:


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