Geant4  10.02.p01
G4INCLClusteringModelIntercomparison.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // INCL++ intra-nuclear cascade model
27 // Alain Boudard, CEA-Saclay, France
28 // Joseph Cugnon, University of Liege, Belgium
29 // Jean-Christophe David, CEA-Saclay, France
30 // Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
31 // Sylvie Leray, CEA-Saclay, France
32 // Davide Mancusi, CEA-Saclay, France
33 //
34 #define INCLXX_IN_GEANT4_MODE 1
35 
36 #include "globals.hh"
37 
38 #ifndef G4INCLClusteringModelIntercomparison_hh
39 #define G4INCLClusteringModelIntercomparison_hh 1
40 
41 #ifdef INCLXX_IN_GEANT4_MODE
42 #define INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set 1
43 #endif // INCLXX_IN_GEANT4_MODE
44 
46 #include "G4INCLParticle.hh"
47 #include "G4INCLParticleTable.hh"
48 #include "G4INCLCluster.hh"
49 #include "G4INCLNucleus.hh"
50 #include "G4INCLKinematicsUtils.hh"
51 #include "G4INCLHashing.hh"
52 
53 #include <set>
54 #include <algorithm>
55 
56 namespace G4INCL {
57 
72 
74  particle(NULL),
75  isTargetSpectator(false),
76  Z(0),
77  energy(0.),
78  potentialEnergy(0.)
79  {}
80 
82  particle(p),
83  isTargetSpectator(particle->isTargetSpectator()),
84  Z(particle->getZ()),
85  position(particle->getPosition()),
86  momentum(particle->getMomentum()),
87  energy(particle->getEnergy()),
88  potentialEnergy(particle->getPotentialEnergy())
89  {}
90  };
91 
94  public:
95  ClusteringModelIntercomparison(Config const * const theConfig) :
96  theNucleus(NULL),
97  selectedA(0),
98  selectedZ(0),
99  sqtot(0.),
101  protonMass(ParticleTable::getRealMass(Proton)),
102  neutronMass(ParticleTable::getRealMass(Neutron)),
103  runningMaxClusterAlgorithmMass(theConfig->getClusterMaxMass()),
104  nConsideredMax(0),
105  nConsidered(0),
106  consideredPartners(NULL),
109  {
110  // Set up the maximum charge and neutron number for clusters
111  clusterZMaxAll = 0;
112  clusterNMaxAll = 0;
118  }
119  std::fill(candidateConfiguration,
121  static_cast<Particle*>(NULL));
122 
123  std::fill(runningEnergies,
125  0.0);
126 
127  std::fill(runningPotentials,
129  0.0);
130 
131  std::fill(runningConfiguration,
133  -1);
134 
135  }
136 
138  delete [] consideredPartners;
139  delete [] isInRunningConfiguration;
140  }
141 
142  virtual Cluster* getCluster(Nucleus*, Particle*);
143  virtual G4bool clusterCanEscape(Nucleus const * const, Cluster const * const);
144 
145  private:
146  void findClusterStartingFrom(const G4int oldA, const G4int oldZ);
147  G4double getPhaseSpace(const G4int oldA, ConsideredPartner const &p);
148 
150 
155 #if defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_HashMask)
157 #elif defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set) || defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_None)
158  G4int runningConfiguration[ParticleTable::maxClusterMass];
159 #else
160 #error Unrecognized INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON. Allowed values are: Set, HashMask, None.
161 #endif
162 
165 
167 
169 
174 
177 
180 
183 
185 
188 
190 
193 
208 
215 
222 
223 #if defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_HashMask)
224  typedef std::set<Hashing::HashType> HashContainer;
225  typedef HashContainer::iterator HashIterator;
226 
229 #elif defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set)
230 
238  public:
239  // Use Particle* as nucleon identifiers
241 
244 
247  theSize(rhs.theSize),
248  nucleons(new NucleonItem[theSize])
249  {
250  std::copy(rhs.nucleons, rhs.nucleons+theSize, nucleons);
251  }
252 
255  delete [] nucleons;
256  }
257 
260  std::swap(theSize, rhs.theSize);
261  std::swap(nucleons, rhs.nucleons);
262  }
263 
266  SortedNucleonConfiguration tempConfig(rhs);
267  swap(tempConfig);
268  return *this;
269  }
270 
277 // assert(theSize==rhs.theSize);
278  return std::lexicographical_compare(nucleons, nucleons+theSize, rhs.nucleons, rhs.nucleons+theSize);
279  }
280 
282  void fill(NucleonItem *config, size_t n) {
283  theSize = n;
284  nucleons = new NucleonItem[theSize];
285  std::copy(config, config+theSize, nucleons);
286  std::sort(nucleons, nucleons+theSize);
287  }
288 
289  private:
291  size_t theSize;
292 
294  NucleonItem *nucleons;
295  };
296 
297  typedef std::set<SortedNucleonConfiguration> SortedNucleonConfigurationContainer;
298  typedef SortedNucleonConfigurationContainer::iterator SortedNucleonConfigurationIterator;
299 
301  SortedNucleonConfigurationContainer checkedConfigurations[ParticleTable::maxClusterMass-2];
302 #elif !defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_None)
303 #error Unrecognized INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON. Allowed values are: Set, HashMask, None.
304 #endif
305 
311  };
312 
313 }
314 
315 #endif
virtual G4bool clusterCanEscape(Nucleus const *const, Cluster const *const)
Determine whether cluster can escape or not.
static const G4double clusterPosFact[ParticleTable::maxClusterMass+1]
Precomputed factor 1.0/A.
SortedNucleonConfigurationContainer::iterator SortedNucleonConfigurationIterator
The INCL configuration object.
Definition: G4INCLConfig.hh:60
SortedNucleonConfiguration & operator=(const SortedNucleonConfiguration &rhs)
Assignment operator.
G4double runningPotentials[ParticleTable::maxClusterMass+1]
G4int maxMassConfigurationSkipping
Maximum mass for configuration storage.
G4double runningEnergies[ParticleTable::maxClusterMass+1]
static const G4int clusterZMin[ParticleTable::maxClusterMass+1]
Lower limit of Z for cluster of mass A.
SortedNucleonConfigurationContainer checkedConfigurations[ParticleTable::maxClusterMass-2]
Array of containers for configurations that have already been checked.
void swap(SortedNucleonConfiguration &rhs)
Helper method for the assignment operator.
Particle * candidateConfiguration[ParticleTable::maxClusterMass]
Best cluster configuration.
Cluster is a particle (inherits from the Particle class) that is actually a collection of elementary ...
int G4int
Definition: G4Types.hh:78
G4double getPhaseSpace(const G4int oldA, ConsideredPartner const &p)
std::set< SortedNucleonConfiguration > SortedNucleonConfigurationContainer
void findClusterStartingFrom(const G4int oldA, const G4int oldZ)
An abstract interface to cluster formation model(s).
G4double getRealMass(const G4INCL::ParticleType t)
Get particle mass (in MeV/c^2)
double A(double temperature)
G4bool operator<(const SortedNucleonConfiguration &rhs) const
Order operator for SortedNucleonConfiguration.
static const G4double clusterPhaseSpaceCut[ParticleTable::maxClusterMass+1]
Phase-space parameters for cluster formation.
G4bool * isInRunningConfiguration
Array of flags for nucleons in the running configuration.
bool G4bool
Definition: G4Types.hh:79
ThreeVector runningPositions[ParticleTable::maxClusterMass+1]
G4int runningConfiguration[ParticleTable::maxClusterMass]
static const G4int clusterZMax[ParticleTable::maxClusterMass+1]
Upper limit of Z for cluster of mass A.
Class for storing and comparing sorted nucleon configurations.
const G4int n
SortedNucleonConfiguration(const SortedNucleonConfiguration &rhs)
Copy constructor.
Container for the relevant information.
virtual Cluster * getCluster(Nucleus *, Particle *)
Choose a cluster candidate to be produced.
void fill(NucleonItem *config, size_t n)
Fill configuration with array of NucleonItem.
ConsideredPartner * consideredPartners
Array of considered cluster partners.
Functions for hashing a collection of NucleonItems.
Cluster coalescence algorithm used in the IAEA intercomparison.
static const G4double clusterPosFact2[ParticleTable::maxClusterMass+1]
Precomputed factor (1.0/A)^2.
double G4double
Definition: G4Types.hh:76
ThreeVector runningMomenta[ParticleTable::maxClusterMass+1]