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,v 1.6 2006/06/29 20:24:51 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-08-02 $ 27 // 29 // 28 // by V. Lara 30 // by V. Lara 29 // ------------------------------------------- 31 // -------------------------------------------------------------------- 30 // << 31 // Modified: << 32 // 25.07.08 I.Pshenichnov (in collaboration wi << 33 // Mishustin (FIAS, Frankfurt, INR, M << 34 // Moscow, pshenich@fias.uni-frankfur << 35 // a fagment with Z=A; fixed memory l << 36 32 37 #include "G4StatMFMacroCanonical.hh" 33 #include "G4StatMFMacroCanonical.hh" 38 #include "G4PhysicalConstants.hh" << 34 39 #include "G4SystemOfUnits.hh" << 40 #include "G4Pow.hh" << 41 35 42 // constructor 36 // constructor 43 G4StatMFMacroCanonical::G4StatMFMacroCanonical 37 G4StatMFMacroCanonical::G4StatMFMacroCanonical(const G4Fragment & theFragment) 44 { 38 { 45 39 46 // Get memory for clusters 40 // Get memory for clusters 47 _theClusters.push_back(new G4StatMFMacroNucl 41 _theClusters.push_back(new G4StatMFMacroNucleon); // Size 1 48 _theClusters.push_back(new G4StatMFMacroBiNu 42 _theClusters.push_back(new G4StatMFMacroBiNucleon); // Size 2 49 _theClusters.push_back(new G4StatMFMacroTriN 43 _theClusters.push_back(new G4StatMFMacroTriNucleon); // Size 3 50 _theClusters.push_back(new G4StatMFMacroTetr 44 _theClusters.push_back(new G4StatMFMacroTetraNucleon); // Size 4 51 for (G4int i = 4; i < theFragment.GetA_asInt << 45 for (G4int i = 4; i < theFragment.GetA(); i++) 52 _theClusters.push_back(new G4StatMFMacroMu 46 _theClusters.push_back(new G4StatMFMacroMultiNucleon(i+1)); // Size 5 ... A 53 47 54 // Perform class initialization 48 // Perform class initialization 55 Initialize(theFragment); 49 Initialize(theFragment); 56 50 57 } 51 } 58 52 >> 53 59 // destructor 54 // destructor 60 G4StatMFMacroCanonical::~G4StatMFMacroCanonica 55 G4StatMFMacroCanonical::~G4StatMFMacroCanonical() 61 { 56 { 62 // garbage collection 57 // garbage collection 63 if (!_theClusters.empty()) 58 if (!_theClusters.empty()) 64 { 59 { 65 std::for_each(_theClusters.begin(),_theC 60 std::for_each(_theClusters.begin(),_theClusters.end(),DeleteFragment()); 66 } 61 } 67 } 62 } 68 63 >> 64 // operators definitions >> 65 G4StatMFMacroCanonical & >> 66 G4StatMFMacroCanonical::operator=(const G4StatMFMacroCanonical & ) >> 67 { >> 68 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMacroCanonical::operator= meant to not be accessable"); >> 69 return *this; >> 70 } >> 71 >> 72 G4bool G4StatMFMacroCanonical::operator==(const G4StatMFMacroCanonical & ) const >> 73 { >> 74 return false; >> 75 } >> 76 >> 77 >> 78 G4bool G4StatMFMacroCanonical::operator!=(const G4StatMFMacroCanonical & ) const >> 79 { >> 80 return true; >> 81 } >> 82 >> 83 69 // Initialization method 84 // Initialization method >> 85 >> 86 70 void G4StatMFMacroCanonical::Initialize(const 87 void G4StatMFMacroCanonical::Initialize(const G4Fragment & theFragment) 71 { 88 { 72 89 73 G4int A = theFragment.GetA_asInt(); << 90 G4double A = theFragment.GetA(); 74 G4int Z = theFragment.GetZ_asInt(); << 91 G4double Z = theFragment.GetZ(); 75 G4double x = 1.0 - 2.0*Z/G4double(A); << 76 G4Pow* g4calc = G4Pow::GetInstance(); << 77 92 78 // Free Internal energy at T = 0 93 // Free Internal energy at T = 0 79 __FreeInternalE0 = A*( -G4StatMFParameters:: << 94 __FreeInternalE0 = A*( -G4StatMFParameters::GetE0() + // Volume term (for T = 0) 80 G4StatMFParameters::GetGamma0()*x*x) // << 95 G4StatMFParameters::GetGamma0()* // Symmetry term 81 + G4StatMFParameters::GetBeta0()*g4calc->Z << 96 (1.0-2.0*Z/A)*(1.0-2.0*Z/A) ) + 82 0.6*elm_coupling*Z*Z/(G4StatMFParameters:: << 97 G4StatMFParameters::GetBeta0()*std::pow(A,2.0/3.0) + // Surface term (for T = 0) 83 g4calc->Z13(A)); << 98 (3.0/5.0)*elm_coupling*Z*Z/(G4StatMFParameters::Getr0()* // Coulomb term >> 99 std::pow(A,1.0/3.0)); >> 100 >> 101 84 102 85 CalculateTemperature(theFragment); 103 CalculateTemperature(theFragment); >> 104 86 return; 105 return; 87 } 106 } 88 107 >> 108 >> 109 >> 110 >> 111 89 void G4StatMFMacroCanonical::CalculateTemperat 112 void G4StatMFMacroCanonical::CalculateTemperature(const G4Fragment & theFragment) 90 { 113 { 91 // Excitation Energy 114 // Excitation Energy 92 G4double U = theFragment.GetExcitationEnergy 115 G4double U = theFragment.GetExcitationEnergy(); 93 116 94 G4int A = theFragment.GetA_asInt(); << 117 G4double A = theFragment.GetA(); 95 G4int Z = theFragment.GetZ_asInt(); << 118 G4double Z = theFragment.GetZ(); 96 119 97 // Fragment Multiplicity 120 // Fragment Multiplicity 98 G4double FragMult = std::max((1.0+(2.31/MeV) 121 G4double FragMult = std::max((1.0+(2.31/MeV)*(U/A - 3.5*MeV))*A/100.0, 2.0); 99 122 >> 123 100 // Parameter Kappa 124 // Parameter Kappa 101 G4Pow* g4calc = G4Pow::GetInstance(); << 125 _Kappa = (1.0+elm_coupling*(std::pow(FragMult,1./3.)-1)/ 102 _Kappa = (1.0+elm_coupling*(g4calc->A13(Frag << 126 (G4StatMFParameters::Getr0()*std::pow(A,1./3.))); 103 (G4StatMFParameters::Getr0()*g4calc->Z13 << 104 _Kappa = _Kappa*_Kappa*_Kappa - 1.0; 127 _Kappa = _Kappa*_Kappa*_Kappa - 1.0; >> 128 105 129 106 G4StatMFMacroTemperature * theTemp = new 130 G4StatMFMacroTemperature * theTemp = new 107 G4StatMFMacroTemperature(A,Z,U,__FreeInter 131 G4StatMFMacroTemperature(A,Z,U,__FreeInternalE0,_Kappa,&_theClusters); 108 132 109 __MeanTemperature = theTemp->CalcTemperature 133 __MeanTemperature = theTemp->CalcTemperature(); 110 _ChemPotentialNu = theTemp->GetChemicalPoten 134 _ChemPotentialNu = theTemp->GetChemicalPotentialNu(); 111 _ChemPotentialMu = theTemp->GetChemicalPoten 135 _ChemPotentialMu = theTemp->GetChemicalPotentialMu(); 112 __MeanMultiplicity = theTemp->GetMeanMultipl 136 __MeanMultiplicity = theTemp->GetMeanMultiplicity(); 113 __MeanEntropy = theTemp->GetEntropy(); 137 __MeanEntropy = theTemp->GetEntropy(); 114 138 115 delete theTemp; 139 delete theTemp; 116 140 117 return; 141 return; 118 } 142 } 119 143 >> 144 120 // ------------------------------------------- 145 // -------------------------------------------------------------------------- 121 146 122 G4StatMFChannel * G4StatMFMacroCanonical::Choo 147 G4StatMFChannel * G4StatMFMacroCanonical::ChooseAandZ(const G4Fragment &theFragment) 123 // Calculate total fragments multiplicity, fra << 148 // Calculate total fragments multiplicity, fragment atomic numbers and charges 124 { 149 { 125 G4int A = theFragment.GetA_asInt(); << 150 G4double A = theFragment.GetA(); 126 G4int Z = theFragment.GetZ_asInt(); << 151 G4double Z = theFragment.GetZ(); 127 152 128 std::vector<G4int> ANumbers(A); << 153 std::vector<G4double> ANumbers(static_cast<G4int>(A)); 129 154 130 G4double Multiplicity = ChooseA(A,ANumbers); 155 G4double Multiplicity = ChooseA(A,ANumbers); 131 156 132 std::vector<G4int> FragmentsA; << 133 157 134 G4int i = 0; << 158 std::vector<G4double> FragmentsA; 135 for (i = 0; i < A; i++) << 136 { << 137 for (G4int j = 0; j < ANumbers[i]; j++) << 138 } << 139 159 140 // Sort fragments in decreasing order << 160 G4int i = 0; 141 G4int im = 0; << 161 for (i = 0; i < A; i++) 142 for (G4int j = 0; j < Multiplicity; j++) << 162 { 143 { << 163 for (G4int j = 0; j < ANumbers[i]; j++) FragmentsA.push_back(i+1); 144 G4int FragmentsAMax = 0; << 164 } 145 im = j; << 165 146 for (i = j; i < Multiplicity; i++) << 166 147 { << 167 // Sort fragments in decreasing order 148 if (FragmentsA[i] <= FragmentsAMax) { cont << 168 G4int im = 0; 149 else << 169 for (G4int j = 0; j < Multiplicity; j++) 150 { << 170 { 151 im = i; << 171 G4double FragmentsAMax = 0.0; 152 FragmentsAMax = FragmentsA[im]; << 172 im = j; 153 } << 173 for (i = j; i < Multiplicity; i++) 154 } << 174 { 155 if (im != j) << 175 if (FragmentsA[i] <= FragmentsAMax) continue; 156 { << 176 else 157 FragmentsA[im] = FragmentsA[j]; << 177 { 158 FragmentsA[j] = FragmentsAMax; << 178 im = i; 159 } << 179 FragmentsAMax = FragmentsA[im]; 160 } << 180 } 161 return ChooseZ(Z,FragmentsA); << 181 } >> 182 >> 183 if (im != j) >> 184 { >> 185 FragmentsA[im] = FragmentsA[j]; >> 186 FragmentsA[j] = FragmentsAMax; >> 187 } >> 188 } >> 189 >> 190 return ChooseZ(static_cast<G4int>(Z),FragmentsA); 162 } 191 } 163 192 164 G4double G4StatMFMacroCanonical::ChooseA(G4int << 193 >> 194 >> 195 G4double G4StatMFMacroCanonical::ChooseA(const G4double A, std::vector<G4double> & ANumbers) 165 // Determines fragments multiplicities and c 196 // Determines fragments multiplicities and compute total fragment multiplicity 166 { 197 { 167 G4double multiplicity = 0.0; 198 G4double multiplicity = 0.0; 168 G4int i; 199 G4int i; 169 << 200 >> 201 170 std::vector<G4double> AcumMultiplicity; 202 std::vector<G4double> AcumMultiplicity; 171 AcumMultiplicity.reserve(A); << 203 AcumMultiplicity.reserve(static_cast<G4int>(A)); 172 204 173 AcumMultiplicity.push_back((*(_theClusters.b 205 AcumMultiplicity.push_back((*(_theClusters.begin()))->GetMeanMultiplicity()); 174 for (std::vector<G4VStatMFMacroCluster*>::it 206 for (std::vector<G4VStatMFMacroCluster*>::iterator it = _theClusters.begin()+1; 175 it != _theClusters.end(); ++it) 207 it != _theClusters.end(); ++it) 176 { 208 { 177 AcumMultiplicity.push_back((*it)->GetMea 209 AcumMultiplicity.push_back((*it)->GetMeanMultiplicity()+AcumMultiplicity.back()); 178 } 210 } 179 211 180 G4int CheckA; 212 G4int CheckA; 181 do { 213 do { 182 CheckA = -1; 214 CheckA = -1; 183 G4int SumA = 0; 215 G4int SumA = 0; 184 G4int ThisOne = 0; 216 G4int ThisOne = 0; 185 multiplicity = 0.0; 217 multiplicity = 0.0; 186 for (i = 0; i < A; i++) ANumbers[i] = 0; << 218 for (i = 0; i < A; i++) ANumbers[i] = 0.0; 187 do { 219 do { 188 G4double RandNumber = G4UniformRand()*__ 220 G4double RandNumber = G4UniformRand()*__MeanMultiplicity; 189 for (i = 0; i < A; i++) { 221 for (i = 0; i < A; i++) { 190 if (RandNumber < AcumMultiplicity[i]) { 222 if (RandNumber < AcumMultiplicity[i]) { 191 ThisOne = i; 223 ThisOne = i; 192 break; 224 break; 193 } 225 } 194 } 226 } 195 multiplicity++; 227 multiplicity++; 196 ANumbers[ThisOne] = ANumbers[ThisOne]+1; 228 ANumbers[ThisOne] = ANumbers[ThisOne]+1; 197 SumA += ThisOne+1; 229 SumA += ThisOne+1; 198 CheckA = A - SumA; << 230 CheckA = static_cast<G4int>(A) - SumA; 199 231 200 // Loop checking, 05-Aug-2015, Vladimir << 201 } while (CheckA > 0); 232 } while (CheckA > 0); 202 233 203 // Loop checking, 05-Aug-2015, Vladimir Iv << 234 } while (CheckA < 0 || std::abs(__MeanMultiplicity - multiplicity) > std::sqrt(__MeanMultiplicity) + 1./2.); 204 } while (CheckA < 0 || std::abs(__MeanMultip << 205 235 206 return multiplicity; 236 return multiplicity; 207 } 237 } 208 238 209 G4StatMFChannel * G4StatMFMacroCanonical::Choo << 239 210 std::vector<G4int> & FragmentsA) << 240 G4StatMFChannel * G4StatMFMacroCanonical::ChooseZ(const G4int & Z, >> 241 std::vector<G4double> & FragmentsA) 211 // 242 // 212 { 243 { 213 G4Pow* g4calc = G4Pow::GetInstance(); << 244 std::vector<G4double> FragmentsZ; 214 std::vector<G4int> FragmentsZ; << 215 245 216 G4int DeltaZ = 0; << 246 G4double DeltaZ = 0.0; 217 G4double CP = G4StatMFParameters::GetCoulom << 247 G4double CP = (3./5.)*(elm_coupling/G4StatMFParameters::Getr0())* 218 G4int multiplicity = (G4int)FragmentsA.size( << 248 (1.0 - 1.0/std::pow(1.0+G4StatMFParameters::GetKappaCoulomb(),1./3.)); 219 249 220 do { << 250 G4int multiplicity = FragmentsA.size(); 221 FragmentsZ.clear(); << 251 222 G4int SumZ = 0; << 252 do 223 for (G4int i = 0; i < multiplicity; ++i) << 253 { 224 { << 254 FragmentsZ.clear(); 225 G4int A = FragmentsA[i]; << 255 G4int SumZ = 0; 226 if (A <= 1) << 256 for (G4int i = 0; i < multiplicity; i++) 227 { << 257 { 228 G4double RandNumber = G4UniformRand(); << 258 G4double A = FragmentsA[i]; 229 if (RandNumber < (*_theClusters.begin()) << 259 if (A <= 1.0) 230 { << 260 { 231 FragmentsZ.push_back(1); << 261 G4double RandNumber = G4UniformRand(); 232 SumZ += FragmentsZ[i]; << 262 if (RandNumber < (*_theClusters.begin())->GetZARatio()) 233 } << 263 { 234 else FragmentsZ.push_back(0); << 264 FragmentsZ.push_back(1.0); 235 } << 265 SumZ += static_cast<G4int>(FragmentsZ[i]); 236 else << 266 } 237 { << 267 else FragmentsZ.push_back(0.0); 238 G4double RandZ; << 268 } 239 G4double CC = 8.0*G4StatMFParameters::Ge << 269 else 240 + 2*CP*g4calc->Z23(FragmentsA[i]); << 270 { 241 G4double ZMean; << 271 G4double RandZ; 242 if (FragmentsA[i] > 1 && FragmentsA[i] < << 272 G4double CC = 8.0*G4StatMFParameters::GetGamma0()+2.0*CP*std::pow(FragmentsA[i],2./3.); 243 else { << 273 G4double ZMean; 244 ZMean = FragmentsA[i]*(4.0*G4StatMFPar << 274 if (FragmentsA[i] > 1.5 && FragmentsA[i] < 4.5) ZMean = 0.5*FragmentsA[i]; 245 + _ChemPotentialNu)/CC; << 275 else ZMean = FragmentsA[i]*(4.0*G4StatMFParameters::GetGamma0()+_ChemPotentialNu)/CC; >> 276 G4double ZDispersion = std::sqrt(FragmentsA[i]*__MeanTemperature/CC); >> 277 G4int z; >> 278 do >> 279 { >> 280 RandZ = G4RandGauss::shoot(ZMean,ZDispersion); >> 281 z = static_cast<G4int>(RandZ+0.5); >> 282 } while (z < 0 || z > A); >> 283 FragmentsZ.push_back(z); >> 284 SumZ += z; 246 } 285 } 247 G4double ZDispersion = std::sqrt(Fragmen << 286 } 248 G4int z; << 287 DeltaZ = Z - SumZ; 249 do << 288 } 250 { << 289 while (std::abs(DeltaZ) > 1.1); 251 RandZ = G4RandGauss::shoot(ZMean,ZDispersi << 252 z = G4lrint(RandZ+0.5); << 253 // Loop checking, 05-Aug-2015, Vladimir Iv << 254 } while (z < 0 || z > A); << 255 FragmentsZ.push_back(z); << 256 SumZ += z; << 257 } << 258 } << 259 DeltaZ = Z - SumZ; << 260 // Loop checking, 05-Aug-2015, Vladimir Ivan << 261 } while (std::abs(DeltaZ) > 1); << 262 290 263 // DeltaZ can be 0, 1 or -1 291 // DeltaZ can be 0, 1 or -1 264 G4int idx = 0; 292 G4int idx = 0; 265 if (DeltaZ < 0.0) 293 if (DeltaZ < 0.0) 266 { 294 { 267 while (FragmentsZ[idx] < 1) { ++idx; } << 295 while (FragmentsZ[idx] < 0.5) ++idx; 268 } 296 } 269 FragmentsZ[idx] += DeltaZ; 297 FragmentsZ[idx] += DeltaZ; 270 298 271 G4StatMFChannel * theChannel = new G4StatMFC 299 G4StatMFChannel * theChannel = new G4StatMFChannel; 272 for (G4int i = multiplicity-1; i >= 0; --i) << 300 for (G4int i = multiplicity-1; i >= 0; i--) 273 { 301 { 274 theChannel->CreateFragment(FragmentsA[i] 302 theChannel->CreateFragment(FragmentsA[i],FragmentsZ[i]); 275 } 303 } 276 << 304 277 return theChannel; << 305 >> 306 return theChannel; 278 } 307 } 279 308