00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #define INCLXX_IN_GEANT4_MODE 1
00034
00035 #include "globals.hh"
00036
00037 #ifndef G4INCLClusteringModelIntercomparison_hh
00038 #define G4INCLClusteringModelIntercomparison_hh 1
00039
00040 #ifdef INCLXX_IN_GEANT4_MODE
00041 #define INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set 1
00042 #endif // INCLXX_IN_GEANT4_MODE
00043
00044 #include "G4INCLIClusteringModel.hh"
00045 #include "G4INCLParticle.hh"
00046 #include "G4INCLParticleTable.hh"
00047 #include "G4INCLCluster.hh"
00048 #include "G4INCLNucleus.hh"
00049 #include "G4INCLKinematicsUtils.hh"
00050 #include "G4INCLHashing.hh"
00051
00052 #include <set>
00053 #include <algorithm>
00054
00055 namespace G4INCL {
00056
00058 class ClusteringModelIntercomparison : public IClusteringModel {
00059 public:
00060 ClusteringModelIntercomparison(Config const * const theConfig) :
00061 theNucleus(NULL),
00062 selectedA(0),
00063 selectedZ(0),
00064 sqtot(0.),
00065 cascadingEnergyPool(0.),
00066 protonMass(ParticleTable::getRealMass(Proton)),
00067 neutronMass(ParticleTable::getRealMass(Neutron)),
00068 runningMaxClusterAlgorithmMass(theConfig->getClusterMaxMass()),
00069 nConsideredMax(0),
00070 nConsidered(0),
00071 consideredPartners(NULL),
00072 isInRunningConfiguration(NULL),
00073 maxMassConfigurationSkipping(ParticleTable::maxClusterMass)
00074 {
00075
00076 clusterZMaxAll = 0;
00077 clusterNMaxAll = 0;
00078 for(G4int A=0; A<=runningMaxClusterAlgorithmMass; ++A) {
00079 if(ParticleTable::clusterZMax[A]>clusterZMaxAll)
00080 clusterZMaxAll = ParticleTable::clusterZMax[A];
00081 if(A-ParticleTable::clusterZMin[A]>clusterNMaxAll)
00082 clusterNMaxAll = A-ParticleTable::clusterZMin[A];
00083 }
00084 std::fill(candidateConfiguration,
00085 candidateConfiguration + ParticleTable::maxClusterMass,
00086 static_cast<Particle*>(NULL));
00087
00088 std::fill(runningEnergies,
00089 runningEnergies + ParticleTable::maxClusterMass,
00090 0.0);
00091
00092 std::fill(runningPotentials,
00093 runningPotentials + ParticleTable::maxClusterMass,
00094 0.0);
00095
00096 std::fill(runningConfiguration,
00097 runningConfiguration + ParticleTable::maxClusterMass,
00098 -1);
00099
00100 }
00101
00102 virtual ~ClusteringModelIntercomparison() {
00103 delete [] consideredPartners;
00104 delete [] isInRunningConfiguration;
00105 }
00106
00107 virtual Cluster* getCluster(Nucleus*, Particle*);
00108 virtual G4bool clusterCanEscape(Nucleus const * const, Cluster const * const);
00109
00110 private:
00111 void findClusterStartingFrom(const G4int oldA, const G4int oldZ);
00112 G4double getPhaseSpace(const G4int oldA, Particle const * const p);
00113
00114 Nucleus *theNucleus;
00115
00116 G4double runningEnergies[ParticleTable::maxClusterMass+1];
00117 ThreeVector runningMomenta[ParticleTable::maxClusterMass+1];
00118 ThreeVector runningPositions[ParticleTable::maxClusterMass+1];
00119 G4double runningPotentials[ParticleTable::maxClusterMass+1];
00120 #if defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_HashMask)
00121 Hashing::NucleonItem runningConfiguration[ParticleTable::maxClusterMass];
00122 #elif defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set)
00123 G4int runningConfiguration[ParticleTable::maxClusterMass];
00124 #else
00125 #error Unrecognized INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON. Allowed values are: Set, HashMask.
00126 #endif
00127
00128 G4int selectedA, selectedZ;
00129 G4double sqtot;
00130
00131 G4int clusterZMaxAll, clusterNMaxAll;
00132
00133 G4double cascadingEnergyPool;
00134
00135 static const G4double limitCosEscapeAngle;
00136
00137 const G4double protonMass;
00138 const G4double neutronMass;
00139
00140 G4int runningMaxClusterAlgorithmMass;
00141
00142 G4int nConsideredMax;
00143 G4int nConsidered;
00144
00157 Particle **consideredPartners;
00158
00164 G4bool *isInRunningConfiguration;
00165
00171 Particle *candidateConfiguration[ParticleTable::maxClusterMass];
00172
00173 #if defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_HashMask)
00174 typedef std::set<Hashing::HashType> HashContainer;
00175 typedef HashContainer::iterator HashIterator;
00176
00178 HashContainer checkedConfigurations[ParticleTable::maxClusterMass-2];
00179 #elif defined(INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON_Set)
00180
00187 class SortedNucleonConfiguration {
00188 public:
00189
00190 typedef G4int NucleonItem;
00191
00193 SortedNucleonConfiguration() : theSize(0), nucleons(NULL) {}
00194
00196 SortedNucleonConfiguration(const SortedNucleonConfiguration &rhs) :
00197 theSize(rhs.theSize),
00198 nucleons(new NucleonItem[theSize])
00199 {
00200 std::copy(rhs.nucleons, rhs.nucleons+theSize, nucleons);
00201 }
00202
00204 ~SortedNucleonConfiguration() {
00205 delete [] nucleons;
00206 }
00207
00209 void swap(SortedNucleonConfiguration &rhs) {
00210 std::swap(theSize, rhs.theSize);
00211 std::swap(nucleons, rhs.nucleons);
00212 }
00213
00215 SortedNucleonConfiguration &operator=(const SortedNucleonConfiguration &rhs) {
00216 SortedNucleonConfiguration tempConfig(rhs);
00217 swap(tempConfig);
00218 return *this;
00219 }
00220
00226 G4bool operator<(const SortedNucleonConfiguration &rhs) const {
00227
00228 return std::lexicographical_compare(nucleons, nucleons+theSize, rhs.nucleons, rhs.nucleons+theSize);
00229 }
00230
00232 void fill(NucleonItem *config, size_t n) {
00233 theSize = n;
00234 nucleons = new NucleonItem[theSize];
00235 std::copy(config, config+theSize, nucleons);
00236 std::sort(nucleons, nucleons+theSize);
00237 }
00238
00239 private:
00241 size_t theSize;
00242
00244 NucleonItem *nucleons;
00245 };
00246
00247 typedef std::set<SortedNucleonConfiguration> SortedNucleonConfigurationContainer;
00248 typedef SortedNucleonConfigurationContainer::iterator SortedNucleonConfigurationIterator;
00249
00251 SortedNucleonConfigurationContainer checkedConfigurations[ParticleTable::maxClusterMass-2];
00252 #else
00253 #error Unrecognized INCL_CACHING_CLUSTERING_MODEL_INTERCOMPARISON. Allowed values are: Set, HashMask.
00254 #endif
00255
00260 G4int maxMassConfigurationSkipping;
00261 };
00262
00263 }
00264
00265 #endif