Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // >> 27 // $Id: G4StatMFMacroCanonical.cc 100379 2016-10-19 15:05:35Z gcosmo $ 27 // 28 // 28 // by V. Lara 29 // by V. Lara 29 // ------------------------------------------- 30 // -------------------------------------------------------------------- 30 // 31 // 31 // Modified: 32 // Modified: 32 // 25.07.08 I.Pshenichnov (in collaboration wi 33 // 25.07.08 I.Pshenichnov (in collaboration with Alexander Botvina and Igor 33 // Mishustin (FIAS, Frankfurt, INR, M 34 // Mishustin (FIAS, Frankfurt, INR, Moscow and Kurchatov Institute, 34 // Moscow, pshenich@fias.uni-frankfur 35 // Moscow, pshenich@fias.uni-frankfurt.de) fixed infinite loop for 35 // a fagment with Z=A; fixed memory l 36 // a fagment with Z=A; fixed memory leak 36 37 37 #include "G4StatMFMacroCanonical.hh" 38 #include "G4StatMFMacroCanonical.hh" 38 #include "G4PhysicalConstants.hh" 39 #include "G4PhysicalConstants.hh" 39 #include "G4SystemOfUnits.hh" 40 #include "G4SystemOfUnits.hh" 40 #include "G4Pow.hh" 41 #include "G4Pow.hh" 41 42 42 // constructor 43 // constructor 43 G4StatMFMacroCanonical::G4StatMFMacroCanonical 44 G4StatMFMacroCanonical::G4StatMFMacroCanonical(const G4Fragment & theFragment) 44 { 45 { 45 46 46 // Get memory for clusters 47 // Get memory for clusters 47 _theClusters.push_back(new G4StatMFMacroNucl 48 _theClusters.push_back(new G4StatMFMacroNucleon); // Size 1 48 _theClusters.push_back(new G4StatMFMacroBiNu 49 _theClusters.push_back(new G4StatMFMacroBiNucleon); // Size 2 49 _theClusters.push_back(new G4StatMFMacroTriN 50 _theClusters.push_back(new G4StatMFMacroTriNucleon); // Size 3 50 _theClusters.push_back(new G4StatMFMacroTetr 51 _theClusters.push_back(new G4StatMFMacroTetraNucleon); // Size 4 51 for (G4int i = 4; i < theFragment.GetA_asInt 52 for (G4int i = 4; i < theFragment.GetA_asInt(); i++) 52 _theClusters.push_back(new G4StatMFMacroMu 53 _theClusters.push_back(new G4StatMFMacroMultiNucleon(i+1)); // Size 5 ... A 53 54 54 // Perform class initialization 55 // Perform class initialization 55 Initialize(theFragment); 56 Initialize(theFragment); 56 57 57 } 58 } 58 59 59 // destructor 60 // destructor 60 G4StatMFMacroCanonical::~G4StatMFMacroCanonica 61 G4StatMFMacroCanonical::~G4StatMFMacroCanonical() 61 { 62 { 62 // garbage collection 63 // garbage collection 63 if (!_theClusters.empty()) 64 if (!_theClusters.empty()) 64 { 65 { 65 std::for_each(_theClusters.begin(),_theC 66 std::for_each(_theClusters.begin(),_theClusters.end(),DeleteFragment()); 66 } 67 } 67 } 68 } 68 69 69 // Initialization method 70 // Initialization method 70 void G4StatMFMacroCanonical::Initialize(const 71 void G4StatMFMacroCanonical::Initialize(const G4Fragment & theFragment) 71 { 72 { 72 73 73 G4int A = theFragment.GetA_asInt(); 74 G4int A = theFragment.GetA_asInt(); 74 G4int Z = theFragment.GetZ_asInt(); 75 G4int Z = theFragment.GetZ_asInt(); 75 G4double x = 1.0 - 2.0*Z/G4double(A); 76 G4double x = 1.0 - 2.0*Z/G4double(A); 76 G4Pow* g4calc = G4Pow::GetInstance(); 77 G4Pow* g4calc = G4Pow::GetInstance(); 77 78 78 // Free Internal energy at T = 0 79 // Free Internal energy at T = 0 79 __FreeInternalE0 = A*( -G4StatMFParameters:: 80 __FreeInternalE0 = A*( -G4StatMFParameters::GetE0() + // Volume term (for T = 0) 80 G4StatMFParameters::GetGamma0()*x*x) // 81 G4StatMFParameters::GetGamma0()*x*x) // Symmetry term 81 + G4StatMFParameters::GetBeta0()*g4calc->Z 82 + G4StatMFParameters::GetBeta0()*g4calc->Z23(A) + // Surface term (for T = 0) 82 0.6*elm_coupling*Z*Z/(G4StatMFParameters:: 83 0.6*elm_coupling*Z*Z/(G4StatMFParameters::Getr0()* // Coulomb term 83 g4calc->Z13(A)); 84 g4calc->Z13(A)); 84 85 85 CalculateTemperature(theFragment); 86 CalculateTemperature(theFragment); 86 return; 87 return; 87 } 88 } 88 89 89 void G4StatMFMacroCanonical::CalculateTemperat 90 void G4StatMFMacroCanonical::CalculateTemperature(const G4Fragment & theFragment) 90 { 91 { 91 // Excitation Energy 92 // Excitation Energy 92 G4double U = theFragment.GetExcitationEnergy 93 G4double U = theFragment.GetExcitationEnergy(); 93 94 94 G4int A = theFragment.GetA_asInt(); 95 G4int A = theFragment.GetA_asInt(); 95 G4int Z = theFragment.GetZ_asInt(); 96 G4int Z = theFragment.GetZ_asInt(); 96 97 97 // Fragment Multiplicity 98 // Fragment Multiplicity 98 G4double FragMult = std::max((1.0+(2.31/MeV) 99 G4double FragMult = std::max((1.0+(2.31/MeV)*(U/A - 3.5*MeV))*A/100.0, 2.0); 99 100 100 // Parameter Kappa 101 // Parameter Kappa 101 G4Pow* g4calc = G4Pow::GetInstance(); 102 G4Pow* g4calc = G4Pow::GetInstance(); 102 _Kappa = (1.0+elm_coupling*(g4calc->A13(Frag 103 _Kappa = (1.0+elm_coupling*(g4calc->A13(FragMult)-1)/ 103 (G4StatMFParameters::Getr0()*g4calc->Z13 104 (G4StatMFParameters::Getr0()*g4calc->Z13(A))); 104 _Kappa = _Kappa*_Kappa*_Kappa - 1.0; 105 _Kappa = _Kappa*_Kappa*_Kappa - 1.0; 105 106 106 G4StatMFMacroTemperature * theTemp = new 107 G4StatMFMacroTemperature * theTemp = new 107 G4StatMFMacroTemperature(A,Z,U,__FreeInter 108 G4StatMFMacroTemperature(A,Z,U,__FreeInternalE0,_Kappa,&_theClusters); 108 109 109 __MeanTemperature = theTemp->CalcTemperature 110 __MeanTemperature = theTemp->CalcTemperature(); 110 _ChemPotentialNu = theTemp->GetChemicalPoten 111 _ChemPotentialNu = theTemp->GetChemicalPotentialNu(); 111 _ChemPotentialMu = theTemp->GetChemicalPoten 112 _ChemPotentialMu = theTemp->GetChemicalPotentialMu(); 112 __MeanMultiplicity = theTemp->GetMeanMultipl 113 __MeanMultiplicity = theTemp->GetMeanMultiplicity(); 113 __MeanEntropy = theTemp->GetEntropy(); 114 __MeanEntropy = theTemp->GetEntropy(); 114 115 115 delete theTemp; 116 delete theTemp; 116 117 117 return; 118 return; 118 } 119 } 119 120 120 // ------------------------------------------- 121 // -------------------------------------------------------------------------- 121 122 122 G4StatMFChannel * G4StatMFMacroCanonical::Choo 123 G4StatMFChannel * G4StatMFMacroCanonical::ChooseAandZ(const G4Fragment &theFragment) 123 // Calculate total fragments multiplicity, fra 124 // Calculate total fragments multiplicity, fragment atomic numbers and charges 124 { 125 { 125 G4int A = theFragment.GetA_asInt(); 126 G4int A = theFragment.GetA_asInt(); 126 G4int Z = theFragment.GetZ_asInt(); 127 G4int Z = theFragment.GetZ_asInt(); 127 128 128 std::vector<G4int> ANumbers(A); 129 std::vector<G4int> ANumbers(A); 129 130 130 G4double Multiplicity = ChooseA(A,ANumbers); 131 G4double Multiplicity = ChooseA(A,ANumbers); 131 132 132 std::vector<G4int> FragmentsA; 133 std::vector<G4int> FragmentsA; 133 134 134 G4int i = 0; 135 G4int i = 0; 135 for (i = 0; i < A; i++) 136 for (i = 0; i < A; i++) 136 { 137 { 137 for (G4int j = 0; j < ANumbers[i]; j++) 138 for (G4int j = 0; j < ANumbers[i]; j++) FragmentsA.push_back(i+1); 138 } 139 } 139 140 140 // Sort fragments in decreasing order 141 // Sort fragments in decreasing order 141 G4int im = 0; 142 G4int im = 0; 142 for (G4int j = 0; j < Multiplicity; j++) 143 for (G4int j = 0; j < Multiplicity; j++) 143 { 144 { 144 G4int FragmentsAMax = 0; 145 G4int FragmentsAMax = 0; 145 im = j; 146 im = j; 146 for (i = j; i < Multiplicity; i++) 147 for (i = j; i < Multiplicity; i++) 147 { 148 { 148 if (FragmentsA[i] <= FragmentsAMax) { cont 149 if (FragmentsA[i] <= FragmentsAMax) { continue; } 149 else 150 else 150 { 151 { 151 im = i; 152 im = i; 152 FragmentsAMax = FragmentsA[im]; 153 FragmentsAMax = FragmentsA[im]; 153 } 154 } 154 } 155 } 155 if (im != j) 156 if (im != j) 156 { 157 { 157 FragmentsA[im] = FragmentsA[j]; 158 FragmentsA[im] = FragmentsA[j]; 158 FragmentsA[j] = FragmentsAMax; 159 FragmentsA[j] = FragmentsAMax; 159 } 160 } 160 } 161 } 161 return ChooseZ(Z,FragmentsA); 162 return ChooseZ(Z,FragmentsA); 162 } 163 } 163 164 164 G4double G4StatMFMacroCanonical::ChooseA(G4int 165 G4double G4StatMFMacroCanonical::ChooseA(G4int A, std::vector<G4int> & ANumbers) 165 // Determines fragments multiplicities and c 166 // Determines fragments multiplicities and compute total fragment multiplicity 166 { 167 { 167 G4double multiplicity = 0.0; 168 G4double multiplicity = 0.0; 168 G4int i; 169 G4int i; 169 170 170 std::vector<G4double> AcumMultiplicity; 171 std::vector<G4double> AcumMultiplicity; 171 AcumMultiplicity.reserve(A); 172 AcumMultiplicity.reserve(A); 172 173 173 AcumMultiplicity.push_back((*(_theClusters.b 174 AcumMultiplicity.push_back((*(_theClusters.begin()))->GetMeanMultiplicity()); 174 for (std::vector<G4VStatMFMacroCluster*>::it 175 for (std::vector<G4VStatMFMacroCluster*>::iterator it = _theClusters.begin()+1; 175 it != _theClusters.end(); ++it) 176 it != _theClusters.end(); ++it) 176 { 177 { 177 AcumMultiplicity.push_back((*it)->GetMea 178 AcumMultiplicity.push_back((*it)->GetMeanMultiplicity()+AcumMultiplicity.back()); 178 } 179 } 179 180 180 G4int CheckA; 181 G4int CheckA; 181 do { 182 do { 182 CheckA = -1; 183 CheckA = -1; 183 G4int SumA = 0; 184 G4int SumA = 0; 184 G4int ThisOne = 0; 185 G4int ThisOne = 0; 185 multiplicity = 0.0; 186 multiplicity = 0.0; 186 for (i = 0; i < A; i++) ANumbers[i] = 0; 187 for (i = 0; i < A; i++) ANumbers[i] = 0; 187 do { 188 do { 188 G4double RandNumber = G4UniformRand()*__ 189 G4double RandNumber = G4UniformRand()*__MeanMultiplicity; 189 for (i = 0; i < A; i++) { 190 for (i = 0; i < A; i++) { 190 if (RandNumber < AcumMultiplicity[i]) { 191 if (RandNumber < AcumMultiplicity[i]) { 191 ThisOne = i; 192 ThisOne = i; 192 break; 193 break; 193 } 194 } 194 } 195 } 195 multiplicity++; 196 multiplicity++; 196 ANumbers[ThisOne] = ANumbers[ThisOne]+1; 197 ANumbers[ThisOne] = ANumbers[ThisOne]+1; 197 SumA += ThisOne+1; 198 SumA += ThisOne+1; 198 CheckA = A - SumA; 199 CheckA = A - SumA; 199 200 200 // Loop checking, 05-Aug-2015, Vladimir 201 // Loop checking, 05-Aug-2015, Vladimir Ivanchenko 201 } while (CheckA > 0); 202 } while (CheckA > 0); 202 203 203 // Loop checking, 05-Aug-2015, Vladimir Iv 204 // Loop checking, 05-Aug-2015, Vladimir Ivanchenko 204 } while (CheckA < 0 || std::abs(__MeanMultip 205 } while (CheckA < 0 || std::abs(__MeanMultiplicity - multiplicity) > std::sqrt(__MeanMultiplicity) + 0.5); 205 206 206 return multiplicity; 207 return multiplicity; 207 } 208 } 208 209 209 G4StatMFChannel * G4StatMFMacroCanonical::Choo 210 G4StatMFChannel * G4StatMFMacroCanonical::ChooseZ(G4int & Z, 210 std::vector<G4int> & FragmentsA) 211 std::vector<G4int> & FragmentsA) 211 // 212 // 212 { 213 { 213 G4Pow* g4calc = G4Pow::GetInstance(); 214 G4Pow* g4calc = G4Pow::GetInstance(); 214 std::vector<G4int> FragmentsZ; 215 std::vector<G4int> FragmentsZ; 215 216 216 G4int DeltaZ = 0; 217 G4int DeltaZ = 0; 217 G4double CP = G4StatMFParameters::GetCoulom 218 G4double CP = G4StatMFParameters::GetCoulomb(); 218 G4int multiplicity = (G4int)FragmentsA.size( << 219 G4int multiplicity = FragmentsA.size(); 219 220 220 do { 221 do { 221 FragmentsZ.clear(); 222 FragmentsZ.clear(); 222 G4int SumZ = 0; 223 G4int SumZ = 0; 223 for (G4int i = 0; i < multiplicity; ++i) << 224 for (G4int i = 0; i < multiplicity; i++) 224 { 225 { 225 G4int A = FragmentsA[i]; 226 G4int A = FragmentsA[i]; 226 if (A <= 1) 227 if (A <= 1) 227 { 228 { 228 G4double RandNumber = G4UniformRand(); 229 G4double RandNumber = G4UniformRand(); 229 if (RandNumber < (*_theClusters.begin()) 230 if (RandNumber < (*_theClusters.begin())->GetZARatio()) 230 { 231 { 231 FragmentsZ.push_back(1); 232 FragmentsZ.push_back(1); 232 SumZ += FragmentsZ[i]; 233 SumZ += FragmentsZ[i]; 233 } 234 } 234 else FragmentsZ.push_back(0); 235 else FragmentsZ.push_back(0); 235 } 236 } 236 else 237 else 237 { 238 { 238 G4double RandZ; 239 G4double RandZ; 239 G4double CC = 8.0*G4StatMFParameters::Ge 240 G4double CC = 8.0*G4StatMFParameters::GetGamma0() 240 + 2*CP*g4calc->Z23(FragmentsA[i]); 241 + 2*CP*g4calc->Z23(FragmentsA[i]); 241 G4double ZMean; 242 G4double ZMean; 242 if (FragmentsA[i] > 1 && FragmentsA[i] < 243 if (FragmentsA[i] > 1 && FragmentsA[i] < 5) { ZMean = 0.5*FragmentsA[i]; } 243 else { 244 else { 244 ZMean = FragmentsA[i]*(4.0*G4StatMFPar 245 ZMean = FragmentsA[i]*(4.0*G4StatMFParameters::GetGamma0() 245 + _ChemPotentialNu)/CC; 246 + _ChemPotentialNu)/CC; 246 } 247 } 247 G4double ZDispersion = std::sqrt(Fragmen 248 G4double ZDispersion = std::sqrt(FragmentsA[i]*__MeanTemperature/CC); 248 G4int z; 249 G4int z; 249 do 250 do 250 { 251 { 251 RandZ = G4RandGauss::shoot(ZMean,ZDispersi 252 RandZ = G4RandGauss::shoot(ZMean,ZDispersion); 252 z = G4lrint(RandZ+0.5); 253 z = G4lrint(RandZ+0.5); 253 // Loop checking, 05-Aug-2015, Vladimir Iv 254 // Loop checking, 05-Aug-2015, Vladimir Ivanchenko 254 } while (z < 0 || z > A); 255 } while (z < 0 || z > A); 255 FragmentsZ.push_back(z); 256 FragmentsZ.push_back(z); 256 SumZ += z; 257 SumZ += z; 257 } 258 } 258 } 259 } 259 DeltaZ = Z - SumZ; 260 DeltaZ = Z - SumZ; 260 // Loop checking, 05-Aug-2015, Vladimir Ivan 261 // Loop checking, 05-Aug-2015, Vladimir Ivanchenko 261 } while (std::abs(DeltaZ) > 1); 262 } while (std::abs(DeltaZ) > 1); 262 263 263 // DeltaZ can be 0, 1 or -1 264 // DeltaZ can be 0, 1 or -1 264 G4int idx = 0; 265 G4int idx = 0; 265 if (DeltaZ < 0.0) 266 if (DeltaZ < 0.0) 266 { 267 { 267 while (FragmentsZ[idx] < 1) { ++idx; } 268 while (FragmentsZ[idx] < 1) { ++idx; } 268 } 269 } 269 FragmentsZ[idx] += DeltaZ; 270 FragmentsZ[idx] += DeltaZ; 270 271 271 G4StatMFChannel * theChannel = new G4StatMFC 272 G4StatMFChannel * theChannel = new G4StatMFChannel; 272 for (G4int i = multiplicity-1; i >= 0; --i) << 273 for (G4int i = multiplicity-1; i >= 0; i--) 273 { 274 { 274 theChannel->CreateFragment(FragmentsA[i] 275 theChannel->CreateFragment(FragmentsA[i],FragmentsZ[i]); 275 } 276 } 276 277 277 return theChannel; 278 return theChannel; 278 } 279 } 279 280