Geant4  10.00.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 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
28 // Davide Mancusi, CEA
29 // Alain Boudard, CEA
30 // Sylvie Leray, CEA
31 // Joseph Cugnon, University of Liege
32 //
33 #define INCLXX_IN_GEANT4_MODE 1
34 
35 #include "globals.hh"
36 
37 #ifndef G4INCLClusteringModelIntercomparison_hh
38 #define G4INCLClusteringModelIntercomparison_hh 1
39 
40 #ifdef INCLXX_IN_GEANT4_MODE
41 #define INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set 1
42 #endif // INCLXX_IN_GEANT4_MODE
43 
45 #include "G4INCLParticle.hh"
46 #include "G4INCLParticleTable.hh"
47 #include "G4INCLCluster.hh"
48 #include "G4INCLNucleus.hh"
49 #include "G4INCLKinematicsUtils.hh"
50 #include "G4INCLHashing.hh"
51 
52 #include <set>
53 #include <algorithm>
54 
55 namespace G4INCL {
56 
71 
73  particle(NULL),
74  isTargetSpectator(false),
75  Z(0),
76  energy(0.),
77  potentialEnergy(0.)
78  {}
79 
81  particle(p),
82  isTargetSpectator(particle->isTargetSpectator()),
83  Z(particle->getZ()),
84  position(particle->getPosition()),
85  momentum(particle->getMomentum()),
86  energy(particle->getEnergy()),
87  potentialEnergy(particle->getPotentialEnergy())
88  {}
89  };
90 
93  public:
94  ClusteringModelIntercomparison(Config const * const theConfig) :
95  theNucleus(NULL),
96  selectedA(0),
97  selectedZ(0),
98  sqtot(0.),
100  protonMass(ParticleTable::getRealMass(Proton)),
101  neutronMass(ParticleTable::getRealMass(Neutron)),
102  runningMaxClusterAlgorithmMass(theConfig->getClusterMaxMass()),
103  nConsideredMax(0),
104  nConsidered(0),
105  consideredPartners(NULL),
108  {
109  // Set up the maximum charge and neutron number for clusters
110  clusterZMaxAll = 0;
111  clusterNMaxAll = 0;
117  }
118  std::fill(candidateConfiguration,
120  static_cast<Particle*>(NULL));
121 
122  std::fill(runningEnergies,
124  0.0);
125 
126  std::fill(runningPotentials,
128  0.0);
129 
130  std::fill(runningConfiguration,
132  -1);
133 
134  }
135 
137  delete [] consideredPartners;
138  delete [] isInRunningConfiguration;
139  }
140 
141  virtual Cluster* getCluster(Nucleus*, Particle*);
142  virtual G4bool clusterCanEscape(Nucleus const * const, Cluster const * const);
143 
144  private:
145  void findClusterStartingFrom(const G4int oldA, const G4int oldZ);
146  G4double getPhaseSpace(const G4int oldA, ConsideredPartner const &p);
147 
149 
154 #if defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_HashMask)
156 #elif defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set)
157  G4int runningConfiguration[ParticleTable::maxClusterMass];
158 #else
159 #error Unrecognized INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON. Allowed values are: Set, HashMask.
160 #endif
161 
164 
166 
168 
173 
176 
179 
182 
184 
187 
189 
192 
207 
214 
221 
222 #if defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_HashMask)
223  typedef std::set<Hashing::HashType> HashContainer;
224  typedef HashContainer::iterator HashIterator;
225 
228 #elif defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set)
229 
237  public:
238  // Use Particle* as nucleon identifiers
240 
243 
246  theSize(rhs.theSize),
247  nucleons(new NucleonItem[theSize])
248  {
250  }
251 
254  delete [] nucleons;
255  }
256 
259  std::swap(theSize, rhs.theSize);
260  std::swap(nucleons, rhs.nucleons);
261  }
262 
265  SortedNucleonConfiguration tempConfig(rhs);
266  swap(tempConfig);
267  return *this;
268  }
269 
276 // assert(theSize==rhs.theSize);
277  return std::lexicographical_compare(nucleons, nucleons+theSize, rhs.nucleons, rhs.nucleons+theSize);
278  }
279 
281  void fill(NucleonItem *config, size_t n) {
282  theSize = n;
283  nucleons = new NucleonItem[theSize];
284  std::copy(config, config+theSize, nucleons);
285  std::sort(nucleons, nucleons+theSize);
286  }
287 
288  private:
290  size_t theSize;
291 
293  NucleonItem *nucleons;
294  };
295 
296  typedef std::set<SortedNucleonConfiguration> SortedNucleonConfigurationContainer;
297  typedef SortedNucleonConfigurationContainer::iterator SortedNucleonConfigurationIterator;
298 
300  SortedNucleonConfigurationContainer checkedConfigurations[ParticleTable::maxClusterMass-2];
301 #else
302 #error Unrecognized INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON. Allowed values are: Set, HashMask.
303 #endif
304 
310  };
311 
312 }
313 
314 #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:67
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)
void copy(std::vector< T > &main, const std::vector< T > &data)
Definition: DicomRun.hh:91
An abstract interface to cluster formation model(s).
G4double getRealMass(const G4INCL::ParticleType t)
Get particle mass (in MeV/c^2)
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
static const G4double A[nN]
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]