Geant4-11
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"
48#include "G4INCLCluster.hh"
49#include "G4INCLNucleus.hh"
51#include "G4INCLHashing.hh"
52
53#include <set>
54#include <algorithm>
55
56namespace G4INCL {
57
73
75 particle(NULL),
76 isTargetSpectator(false),
77 Z(0),
78 S(0),
79 energy(0.),
81 {}
82
84 particle(p),
86 Z(particle->getZ()),
87 S(particle->getS()),
88 position(particle->getPosition()),
89 momentum(particle->getMomentum()),
90 energy(particle->getEnergy()),
91 potentialEnergy(particle->getPotentialEnergy())
92 {}
93 };
94
97 public:
98 ClusteringModelIntercomparison(Config const * const theConfig) :
99 theNucleus(NULL),
100 selectedA(0),
101 selectedZ(0),
102 selectedS(0),
103 sqtot(0.),
105 protonMass(ParticleTable::getRealMass(Proton)),
106 neutronMass(ParticleTable::getRealMass(Neutron)),
107 lambdaMass(ParticleTable::getRealMass(Lambda)),
108 runningMaxClusterAlgorithmMass(theConfig->getClusterMaxMass()),
110 nConsidered(0),
111 consideredPartners(NULL),
114 {
115 // Set up the maximum charge and neutron number for clusters
116 clusterZMaxAll = 0;
117 clusterNMaxAll = 0;
123 }
124 std::fill(candidateConfiguration,
126 static_cast<Particle*>(NULL));
127
128 std::fill(runningEnergies,
130 0.0);
131
132 std::fill(runningPotentials,
134 0.0);
135
136 std::fill(runningConfiguration,
138 -1);
139
140 }
141
143 delete [] consideredPartners;
144 delete [] isInRunningConfiguration;
145 }
146
147 virtual Cluster* getCluster(Nucleus*, Particle*);
148 virtual G4bool clusterCanEscape(Nucleus const * const, Cluster const * const);
149
150 private:
151 void findClusterStartingFrom(const G4int oldA, const G4int oldZ, const G4int oldS);
152 G4double getPhaseSpace(const G4int oldA, ConsideredPartner const &p);
153
155
160#if defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_HashMask)
162#elif defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set) || defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_None)
164#else
165#error Unrecognized INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON. Allowed values are: Set, HashMask, None.
166#endif
167
170
172
174
179
182
185
188
190
194
196
199
214
221
228
229#if defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_HashMask)
230 typedef std::set<Hashing::HashType> HashContainer;
231 typedef HashContainer::iterator HashIterator;
232
235#elif defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set)
244 public:
245 // Use Particle* as nucleon identifiers
247
250
253 theSize(rhs.theSize),
255 {
257 }
258
261 delete [] nucleons;
262 }
263
266 std::swap(theSize, rhs.theSize);
267 std::swap(nucleons, rhs.nucleons);
268 }
269
272 SortedNucleonConfiguration tempConfig(rhs);
273 swap(tempConfig);
274 return *this;
275 }
276
283// assert(theSize==rhs.theSize);
284 return std::lexicographical_compare(nucleons, nucleons+theSize, rhs.nucleons, rhs.nucleons+theSize);
285 }
286
288 void fill(NucleonItem *config, size_t n) {
289 theSize = n;
292 std::sort(nucleons, nucleons+theSize);
293 }
294
295 private:
297 size_t theSize;
298
301 };
302
303 typedef std::set<SortedNucleonConfiguration> SortedNucleonConfigurationContainer;
304 typedef SortedNucleonConfigurationContainer::iterator SortedNucleonConfigurationIterator;
305
308#elif !defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_None)
309#error Unrecognized INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON. Allowed values are: Set, HashMask, None.
310#endif
311
317 };
318
319}
320
321#endif
Functions for hashing a collection of NucleonItems.
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
const G4double A[17]
Class for storing and comparing sorted nucleon configurations.
SortedNucleonConfiguration & operator=(const SortedNucleonConfiguration &rhs)
Assignment operator.
void swap(SortedNucleonConfiguration &rhs)
Helper method for the assignment operator.
void fill(NucleonItem *config, size_t n)
Fill configuration with array of NucleonItem.
G4bool operator<(const SortedNucleonConfiguration &rhs) const
Order operator for SortedNucleonConfiguration.
SortedNucleonConfiguration(const SortedNucleonConfiguration &rhs)
Copy constructor.
Cluster coalescence algorithm used in the IAEA intercomparison.
G4double getPhaseSpace(const G4int oldA, ConsideredPartner const &p)
static const G4double clusterPhaseSpaceCut[ParticleTable::maxClusterMass+1]
Phase-space parameters for cluster formation.
static const G4double clusterPosFact[ParticleTable::maxClusterMass+1]
Precomputed factor 1.0/A.
SortedNucleonConfigurationContainer checkedConfigurations[ParticleTable::maxClusterMass-2]
Array of containers for configurations that have already been checked.
G4double runningPotentials[ParticleTable::maxClusterMass+1]
ThreeVector runningMomenta[ParticleTable::maxClusterMass+1]
G4double runningEnergies[ParticleTable::maxClusterMass+1]
SortedNucleonConfigurationContainer::iterator SortedNucleonConfigurationIterator
static const G4int clusterZMin[ParticleTable::maxClusterMass+1]
Lower limit of Z for cluster of mass A.
void findClusterStartingFrom(const G4int oldA, const G4int oldZ, const G4int oldS)
G4int runningConfiguration[ParticleTable::maxClusterMass]
G4bool * isInRunningConfiguration
Array of flags for nucleons in the running configuration.
static const G4double clusterPosFact2[ParticleTable::maxClusterMass+1]
Precomputed factor (1.0/A)^2.
static const G4int clusterZMax[ParticleTable::maxClusterMass+1]
Upper limit of Z for cluster of mass A.
ThreeVector runningPositions[ParticleTable::maxClusterMass+1]
virtual G4bool clusterCanEscape(Nucleus const *const, Cluster const *const)
G4int maxMassConfigurationSkipping
Maximum mass for configuration storage.
ConsideredPartner * consideredPartners
Array of considered cluster partners.
std::set< SortedNucleonConfiguration > SortedNucleonConfigurationContainer
virtual Cluster * getCluster(Nucleus *, Particle *)
Particle * candidateConfiguration[ParticleTable::maxClusterMass]
Best cluster configuration.
G4double getRealMass(const G4INCL::ParticleType t)
Get particle mass (in MeV/c^2)
void copy(G4double dst[], const G4double src[], size_t size=G4FieldTrack::ncompSVEC)
Definition: G4FieldUtils.cc:98
Container for the relevant information.