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: G4StatMFMicroPartition.cc,v 1.8 2008/07/25 11:20:47 vnivanch Exp $ >> 28 // GEANT4 tag $Name: geant4-09-02 $ 27 // 29 // 28 // by V. Lara 30 // by V. Lara 29 // ------------------------------------------- 31 // -------------------------------------------------------------------- 30 32 31 #include "G4StatMFMicroPartition.hh" 33 #include "G4StatMFMicroPartition.hh" 32 #include "G4PhysicalConstants.hh" << 33 #include "G4SystemOfUnits.hh" << 34 #include "G4HadronicException.hh" 34 #include "G4HadronicException.hh" 35 #include "Randomize.hh" << 35 36 #include "G4Log.hh" << 37 #include "G4Exp.hh" << 38 #include "G4Pow.hh" << 39 36 40 // Copy constructor 37 // Copy constructor 41 G4StatMFMicroPartition::G4StatMFMicroPartition 38 G4StatMFMicroPartition::G4StatMFMicroPartition(const G4StatMFMicroPartition & ) 42 { 39 { 43 throw G4HadronicException(__FILE__, __LINE__ << 40 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMicroPartition::copy_constructor meant to not be accessable"); 44 } 41 } 45 42 46 // Operators 43 // Operators 47 44 48 G4StatMFMicroPartition & G4StatMFMicroPartitio 45 G4StatMFMicroPartition & G4StatMFMicroPartition:: 49 operator=(const G4StatMFMicroPartition & ) 46 operator=(const G4StatMFMicroPartition & ) 50 { 47 { 51 throw G4HadronicException(__FILE__, __LINE__ << 48 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMicroPartition::operator= meant to not be accessable"); 52 return *this; 49 return *this; 53 } 50 } 54 51 55 52 56 G4bool G4StatMFMicroPartition::operator==(cons 53 G4bool G4StatMFMicroPartition::operator==(const G4StatMFMicroPartition & ) const 57 { 54 { 58 //throw G4HadronicException(__FILE__, __LINE << 55 //throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMicroPartition::operator== meant to not be accessable"); 59 return false; 56 return false; 60 } 57 } 61 58 62 59 63 G4bool G4StatMFMicroPartition::operator!=(cons 60 G4bool G4StatMFMicroPartition::operator!=(const G4StatMFMicroPartition & ) const 64 { 61 { 65 //throw G4HadronicException(__FILE__, __LINE << 62 //throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMicroPartition::operator!= meant to not be accessable"); 66 return true; 63 return true; 67 } 64 } 68 65 69 void G4StatMFMicroPartition::CoulombFreeEnergy << 66 >> 67 >> 68 void G4StatMFMicroPartition::CoulombFreeEnergy(const G4double anA) 70 { 69 { 71 // This Z independent factor in the Coulomb 70 // This Z independent factor in the Coulomb free energy 72 G4double CoulombConstFactor = G4StatMFParam << 71 G4double CoulombConstFactor = 1.0/std::pow(1.0+G4StatMFParameters::GetKappaCoulomb(),1.0/3.0); >> 72 >> 73 CoulombConstFactor = elm_coupling * (3./5.) * >> 74 (1. - CoulombConstFactor)/G4StatMFParameters::Getr0(); 73 75 74 // We use the aproximation Z_f ~ Z/A * A_f 76 // We use the aproximation Z_f ~ Z/A * A_f 75 << 76 G4double ZA = G4double(theZ)/G4double(theA); << 77 77 78 if (anA == 0 || anA == 1) 78 if (anA == 0 || anA == 1) 79 { 79 { 80 _theCoulombFreeEnergy.push_back(CoulombC << 80 _theCoulombFreeEnergy.push_back(CoulombConstFactor*(theZ/theA)*(theZ/theA)); 81 } 81 } 82 else if (anA == 2 || anA == 3 || anA == 4) 82 else if (anA == 2 || anA == 3 || anA == 4) 83 { 83 { 84 // Z/A ~ 1/2 84 // Z/A ~ 1/2 85 _theCoulombFreeEnergy.push_back(CoulombC << 85 _theCoulombFreeEnergy.push_back(CoulombConstFactor*0.5*std::pow(anA,5./3.)); 86 *anA*G4Pow::GetInstance()->Z23(a << 87 } 86 } 88 else // anA > 4 87 else // anA > 4 89 { 88 { 90 _theCoulombFreeEnergy.push_back(CoulombC << 89 _theCoulombFreeEnergy.push_back(CoulombConstFactor*(theZ/theA)*(theZ/theA)* 91 *anA*G4Pow::GetInstance()->Z23(a << 90 std::pow(anA,5./3.)); >> 91 92 } 92 } 93 } 93 } 94 94 >> 95 95 G4double G4StatMFMicroPartition::GetCoulombEne 96 G4double G4StatMFMicroPartition::GetCoulombEnergy(void) 96 { 97 { 97 G4Pow* g4calc = G4Pow::GetInstance(); << 98 G4double CoulombFactor = 1.0/ 98 G4double CoulombFactor = 1.0/g4calc->A13(1. << 99 std::pow(1.0+G4StatMFParameters::GetKappaCoulomb(),1.0/3.0); 99 100 100 G4double CoulombEnergy = elm_coupling*0.6*th << 101 G4double CoulombEnergy = elm_coupling*(3./5.)*theZ*theZ*CoulombFactor/ 101 (G4StatMFParameters::Getr0()*g4calc->Z13(t << 102 (G4StatMFParameters::Getr0()*std::pow(static_cast<G4double>(theA),1./3.)); 102 103 103 G4double ZA = G4double(theZ)/G4double(theA); << 104 for (unsigned int i = 0; i < _thePartition.s 104 for (unsigned int i = 0; i < _thePartition.size(); i++) 105 CoulombEnergy += _theCoulombFreeEnergy[i] << 105 CoulombEnergy += _theCoulombFreeEnergy[i] - elm_coupling*(3./5.)* 106 ZA*ZA*_thePartition[i]*g4calc->Z23(_theP << 106 (theZ/theA)*(theZ/theA)*std::pow(static_cast<G4double>(_thePartition[i]),5./3.)/ 107 G4StatMFParameters::Getr0(); 107 G4StatMFParameters::Getr0(); 108 108 109 return CoulombEnergy; 109 return CoulombEnergy; 110 } 110 } 111 111 112 G4double G4StatMFMicroPartition::GetPartitionE << 112 G4double G4StatMFMicroPartition::GetPartitionEnergy(const G4double T) 113 { 113 { 114 G4Pow* g4calc = G4Pow::GetInstance(); << 114 G4double CoulombFactor = 1.0/ 115 G4double CoulombFactor = 1.0/g4calc->A13(1. << 115 std::pow(1.0+G4StatMFParameters::GetKappaCoulomb(),1.0/3.0); 116 116 117 G4double PartitionEnergy = 0.0; 117 G4double PartitionEnergy = 0.0; 118 118 >> 119 119 // We use the aprox that Z_f ~ Z/A * A_f 120 // We use the aprox that Z_f ~ Z/A * A_f 120 for (unsigned int i = 0; i < _thePartition.s 121 for (unsigned int i = 0; i < _thePartition.size(); i++) 121 { 122 { 122 if (_thePartition[i] == 0 || _thePartiti 123 if (_thePartition[i] == 0 || _thePartition[i] == 1) 123 { 124 { 124 PartitionEnergy += _theCoulombFreeEn 125 PartitionEnergy += _theCoulombFreeEnergy[i]; 125 } 126 } 126 else if (_thePartition[i] == 2) 127 else if (_thePartition[i] == 2) 127 { 128 { 128 PartitionEnergy += 129 PartitionEnergy += 129 -2.796 // Binding Energy of deuter 130 -2.796 // Binding Energy of deuteron ?????? 130 + _theCoulombFreeEnergy[i]; 131 + _theCoulombFreeEnergy[i]; 131 } 132 } 132 else if (_thePartition[i] == 3) 133 else if (_thePartition[i] == 3) 133 { 134 { 134 PartitionEnergy += 135 PartitionEnergy += 135 -9.224 // Binding Energy of trtion 136 -9.224 // Binding Energy of trtion/He3 ?????? 136 + _theCoulombFreeEnergy[i]; 137 + _theCoulombFreeEnergy[i]; 137 } 138 } 138 else if (_thePartition[i] == 4) 139 else if (_thePartition[i] == 4) 139 { 140 { 140 PartitionEnergy += 141 PartitionEnergy += 141 -30.11 // Binding Energy of ALPHA 142 -30.11 // Binding Energy of ALPHA ?????? 142 + _theCoulombFreeEnergy[i] 143 + _theCoulombFreeEnergy[i] 143 + 4.*T*T/InvLevelDensity(4.); 144 + 4.*T*T/InvLevelDensity(4.); 144 } 145 } 145 else 146 else 146 { << 147 { 147 PartitionEnergy += 148 PartitionEnergy += 148 //Volume term 149 //Volume term 149 (- G4StatMFParameters::GetE0() + 150 (- G4StatMFParameters::GetE0() + 150 T*T/InvLevelDensity(_thePartition 151 T*T/InvLevelDensity(_thePartition[i])) 151 *_thePartition[i] + 152 *_thePartition[i] + 152 153 153 // Symmetry term 154 // Symmetry term 154 G4StatMFParameters::GetGamma0()* 155 G4StatMFParameters::GetGamma0()* 155 (1.0-2.0*theZ/theA)*(1.0-2.0*theZ/ 156 (1.0-2.0*theZ/theA)*(1.0-2.0*theZ/theA)*_thePartition[i] + 156 157 157 // Surface term 158 // Surface term 158 (G4StatMFParameters::Beta(T) - T*G 159 (G4StatMFParameters::Beta(T) - T*G4StatMFParameters::DBetaDT(T))* 159 g4calc->Z23(_thePartition[i]) + << 160 std::pow(static_cast<G4double>(_thePartition[i]),2./3.) + 160 161 161 // Coulomb term 162 // Coulomb term 162 _theCoulombFreeEnergy[i]; 163 _theCoulombFreeEnergy[i]; 163 } 164 } 164 } 165 } 165 166 166 PartitionEnergy += elm_coupling*0.6*theZ*the << 167 PartitionEnergy += elm_coupling*(3./5.)*theZ*theZ*CoulombFactor/ 167 (G4StatMFParameters::Getr0()*g4calc->Z13(t << 168 (G4StatMFParameters::Getr0()*std::pow(static_cast<G4double>(theA),1./3.)) 168 + 1.5*T*(_thePartition.size()-1); << 169 + (3./2.)*T*(_thePartition.size()-1); 169 170 170 return PartitionEnergy; 171 return PartitionEnergy; 171 } 172 } 172 173 173 G4double G4StatMFMicroPartition::CalcPartition << 174 174 G4double FreeInternalE0) << 175 G4double G4StatMFMicroPartition::CalcPartitionTemperature(const G4double U, >> 176 const G4double FreeInternalE0) 175 { 177 { 176 G4double PartitionEnergy = GetPartitionEnerg 178 G4double PartitionEnergy = GetPartitionEnergy(0.0); 177 179 178 // If this happens, T = 0 MeV, which means t 180 // If this happens, T = 0 MeV, which means that probability for this 179 // partition will be 0 181 // partition will be 0 180 if (std::fabs(U + FreeInternalE0 - Partition << 182 if (std::abs(U + FreeInternalE0 - PartitionEnergy) < 0.003) return -1.0; 181 183 182 // Calculate temperature by midpoint method 184 // Calculate temperature by midpoint method 183 185 184 // Bracketing the solution 186 // Bracketing the solution 185 G4double Ta = 0.001; 187 G4double Ta = 0.001; 186 G4double Tb = std::max(std::sqrt(8.0*U/theA) 188 G4double Tb = std::max(std::sqrt(8.0*U/theA),0.0012*MeV); 187 G4double Tmid = 0.0; 189 G4double Tmid = 0.0; 188 190 189 G4double Da = (U + FreeInternalE0 - GetParti 191 G4double Da = (U + FreeInternalE0 - GetPartitionEnergy(Ta))/U; 190 G4double Db = (U + FreeInternalE0 - GetParti 192 G4double Db = (U + FreeInternalE0 - GetPartitionEnergy(Tb))/U; 191 193 192 G4int maxit = 0; 194 G4int maxit = 0; 193 // Loop checking, 05-Aug-2015, Vladimir Ivan << 194 while (Da*Db > 0.0 && maxit < 1000) 195 while (Da*Db > 0.0 && maxit < 1000) 195 { 196 { 196 ++maxit; 197 ++maxit; 197 Tb += 0.5*Tb; 198 Tb += 0.5*Tb; 198 Db = (U + FreeInternalE0 - GetPartitionE 199 Db = (U + FreeInternalE0 - GetPartitionEnergy(Tb))/U; 199 } 200 } 200 201 201 G4double eps = 1.0e-14*std::abs(Ta-Tb); 202 G4double eps = 1.0e-14*std::abs(Ta-Tb); 202 203 203 for (G4int i = 0; i < 1000; i++) 204 for (G4int i = 0; i < 1000; i++) 204 { 205 { 205 Tmid = (Ta+Tb)/2.0; 206 Tmid = (Ta+Tb)/2.0; 206 if (std::fabs(Ta-Tb) <= eps) return Tmid << 207 if (std::abs(Ta-Tb) <= eps) return Tmid; 207 G4double Dmid = (U + FreeInternalE0 - Ge 208 G4double Dmid = (U + FreeInternalE0 - GetPartitionEnergy(Tmid))/U; 208 if (std::fabs(Dmid) < 0.003) return Tmid << 209 if (std::abs(Dmid) < 0.003) return Tmid; 209 if (Da*Dmid < 0.0) 210 if (Da*Dmid < 0.0) 210 { 211 { 211 Tb = Tmid; 212 Tb = Tmid; 212 Db = Dmid; 213 Db = Dmid; 213 } 214 } 214 else 215 else 215 { 216 { 216 Ta = Tmid; 217 Ta = Tmid; 217 Da = Dmid; 218 Da = Dmid; 218 } 219 } 219 } 220 } 220 // if we arrive here the temperature could n 221 // if we arrive here the temperature could not be calculated 221 G4cout << "G4StatMFMicroPartition::CalcParti << 222 G4cerr << "G4StatMFMicroPartition::CalcPartitionTemperature: I can't calculate the temperature" 222 << G4endl; 223 << G4endl; 223 // and set probability to 0 returning T < 0 224 // and set probability to 0 returning T < 0 224 return -1.0; 225 return -1.0; 225 226 226 } 227 } 227 228 228 G4double G4StatMFMicroPartition::CalcPartition << 229 229 G4double FreeInternalE0, << 230 G4double G4StatMFMicroPartition::CalcPartitionProbability(const G4double U, 230 G4double SCompound) << 231 const G4double FreeInternalE0, >> 232 const G4double SCompound) 231 { 233 { 232 G4double T = CalcPartitionTemperature(U,Free 234 G4double T = CalcPartitionTemperature(U,FreeInternalE0); 233 if ( T <= 0.0) return _Probability = 0.0; 235 if ( T <= 0.0) return _Probability = 0.0; 234 _Temperature = T; 236 _Temperature = T; 235 237 236 G4Pow* g4calc = G4Pow::GetInstance(); << 237 238 238 // Factorial of fragment multiplicity 239 // Factorial of fragment multiplicity 239 G4double Fact = 1.0; 240 G4double Fact = 1.0; 240 unsigned int i; 241 unsigned int i; 241 for (i = 0; i < _thePartition.size() - 1; i+ 242 for (i = 0; i < _thePartition.size() - 1; i++) 242 { 243 { 243 G4double f = 1.0; 244 G4double f = 1.0; 244 for (unsigned int ii = i+1; i< _theParti 245 for (unsigned int ii = i+1; i< _thePartition.size(); i++) 245 { 246 { 246 if (_thePartition[i] == _thePartitio 247 if (_thePartition[i] == _thePartition[ii]) f++; 247 } 248 } 248 Fact *= f; 249 Fact *= f; 249 } 250 } 250 251 251 G4double ProbDegeneracy = 1.0; 252 G4double ProbDegeneracy = 1.0; 252 G4double ProbA32 = 1.0; 253 G4double ProbA32 = 1.0; 253 254 254 for (i = 0; i < _thePartition.size(); i++) 255 for (i = 0; i < _thePartition.size(); i++) 255 { 256 { 256 ProbDegeneracy *= GetDegeneracyFactor(_t << 257 ProbDegeneracy *= GetDegeneracyFactor(static_cast<G4int>(_thePartition[i])); 257 ProbA32 *= _thePartition[i]*std::sqrt((G << 258 ProbA32 *= static_cast<G4double>(_thePartition[i])* >> 259 std::sqrt(static_cast<G4double>(_thePartition[i])); 258 } 260 } 259 261 260 // Compute entropy 262 // Compute entropy 261 G4double PartitionEntropy = 0.0; 263 G4double PartitionEntropy = 0.0; 262 for (i = 0; i < _thePartition.size(); i++) 264 for (i = 0; i < _thePartition.size(); i++) 263 { 265 { 264 // interaction entropy for alpha 266 // interaction entropy for alpha 265 if (_thePartition[i] == 4) 267 if (_thePartition[i] == 4) 266 { 268 { 267 PartitionEntropy += 269 PartitionEntropy += 268 2.0*T*_thePartition[i]/InvLevelDen 270 2.0*T*_thePartition[i]/InvLevelDensity(_thePartition[i]); 269 } 271 } 270 // interaction entropy for Af > 4 272 // interaction entropy for Af > 4 271 else if (_thePartition[i] > 4) 273 else if (_thePartition[i] > 4) 272 { 274 { 273 PartitionEntropy += 275 PartitionEntropy += 274 2.0*T*_thePartition[i]/InvLevelDen 276 2.0*T*_thePartition[i]/InvLevelDensity(_thePartition[i]) 275 - G4StatMFParameters::DBetaDT(T) * << 277 - G4StatMFParameters::DBetaDT(T) >> 278 * std::pow(static_cast<G4double>(_thePartition[i]),2.0/3.0); 276 } 279 } 277 } 280 } 278 281 279 // Thermal Wave Lenght = std::sqrt(2 pi hbar 282 // Thermal Wave Lenght = std::sqrt(2 pi hbar^2 / nucleon_mass T) 280 G4double ThermalWaveLenght3 = 16.15*fermi/st 283 G4double ThermalWaveLenght3 = 16.15*fermi/std::sqrt(T); 281 ThermalWaveLenght3 = ThermalWaveLenght3*Ther 284 ThermalWaveLenght3 = ThermalWaveLenght3*ThermalWaveLenght3*ThermalWaveLenght3; 282 285 283 // Translational Entropy 286 // Translational Entropy 284 G4double kappa = 1. + elm_coupling*(g4calc-> << 287 G4double kappa = (1. + elm_coupling*(std::pow(static_cast<G4double>(_thePartition.size()),1./3.)-1.0) 285 /(G4StatMFParameters::Getr << 288 /(G4StatMFParameters::Getr0()*std::pow(static_cast<G4double>(theA),1./3.))); 286 kappa = kappa*kappa*kappa; 289 kappa = kappa*kappa*kappa; 287 kappa -= 1.; 290 kappa -= 1.; 288 G4double V0 = (4./3.)*pi*theA*G4StatMFParame 291 G4double V0 = (4./3.)*pi*theA*G4StatMFParameters::Getr0()*G4StatMFParameters::Getr0()* 289 G4StatMFParameters::Getr0(); 292 G4StatMFParameters::Getr0(); 290 G4double FreeVolume = kappa*V0; 293 G4double FreeVolume = kappa*V0; 291 G4double TranslationalS = std::max(0.0, G4Lo << 294 G4double TranslationalS = std::max(0.0, std::log(ProbA32/Fact) + 292 (_thePartition.size()-1.0)*G4Log(FreeVol << 295 (_thePartition.size()-1.0)*std::log(FreeVolume/ThermalWaveLenght3) + 293 1.5*(_thePartition.size()-1.0) - 1.5*g4c << 296 1.5*(_thePartition.size()-1.0) - (3./2.)*std::log(theA)); 294 297 295 PartitionEntropy += G4Log(ProbDegeneracy) + << 298 PartitionEntropy += std::log(ProbDegeneracy) + TranslationalS; 296 _Entropy = PartitionEntropy; 299 _Entropy = PartitionEntropy; 297 300 298 // And finally compute probability of fragme 301 // And finally compute probability of fragment configuration 299 G4double exponent = PartitionEntropy-SCompou 302 G4double exponent = PartitionEntropy-SCompound; 300 if (exponent > 300.0) exponent = 300.0; << 303 if (exponent > 700.0) exponent = 700.0; 301 return _Probability = G4Exp(exponent); << 304 return _Probability = std::exp(exponent); 302 } 305 } 303 306 304 G4double G4StatMFMicroPartition::GetDegeneracy << 307 >> 308 >> 309 G4double G4StatMFMicroPartition::GetDegeneracyFactor(const G4int A) 305 { 310 { 306 // Degeneracy factors are statistical factor 311 // Degeneracy factors are statistical factors 307 // DegeneracyFactor for nucleon is (2S_n + 1 312 // DegeneracyFactor for nucleon is (2S_n + 1)(2I_n + 1) = 4 308 G4double DegFactor = 0; 313 G4double DegFactor = 0; 309 if (A > 4) DegFactor = 1.0; 314 if (A > 4) DegFactor = 1.0; 310 else if (A == 1) DegFactor = 4.0; // nuc 315 else if (A == 1) DegFactor = 4.0; // nucleon 311 else if (A == 2) DegFactor = 3.0; // Deu 316 else if (A == 2) DegFactor = 3.0; // Deuteron 312 else if (A == 3) DegFactor = 4.0; // Tri << 317 else if (A == 3) DegFactor = 2.0+2.0; // Triton + He3 313 else if (A == 4) DegFactor = 1.0; // alp 318 else if (A == 4) DegFactor = 1.0; // alpha 314 return DegFactor; 319 return DegFactor; 315 } 320 } 316 321 317 G4StatMFChannel * G4StatMFMicroPartition::Choo << 322 >> 323 G4StatMFChannel * G4StatMFMicroPartition::ChooseZ(const G4double A0, const G4double Z0, const G4double MeanT) 318 // Gives fragments charges 324 // Gives fragments charges 319 { 325 { 320 std::vector<G4int> FragmentsZ; 326 std::vector<G4int> FragmentsZ; 321 327 322 G4int ZBalance = 0; 328 G4int ZBalance = 0; 323 do 329 do 324 { 330 { 325 G4double CC = G4StatMFParameters::GetGam 331 G4double CC = G4StatMFParameters::GetGamma0()*8.0; 326 G4int SumZ = 0; 332 G4int SumZ = 0; 327 for (unsigned int i = 0; i < _thePartiti 333 for (unsigned int i = 0; i < _thePartition.size(); i++) 328 { 334 { 329 G4double ZMean; 335 G4double ZMean; 330 G4double Af = _thePartition[i]; 336 G4double Af = _thePartition[i]; 331 if (Af > 1.5 && Af < 4.5) ZMean = 0. 337 if (Af > 1.5 && Af < 4.5) ZMean = 0.5*Af; 332 else ZMean = Af*Z0/A0; 338 else ZMean = Af*Z0/A0; 333 G4double ZDispersion = std::sqrt(Af 339 G4double ZDispersion = std::sqrt(Af * MeanT/CC); 334 G4int Zf; 340 G4int Zf; 335 do 341 do 336 { 342 { 337 Zf = static_cast<G4int>(G4RandGa 343 Zf = static_cast<G4int>(G4RandGauss::shoot(ZMean,ZDispersion)); 338 } 344 } 339 // Loop checking, 05-Aug-2015, Vladi << 340 while (Zf < 0 || Zf > Af); 345 while (Zf < 0 || Zf > Af); 341 FragmentsZ.push_back(Zf); 346 FragmentsZ.push_back(Zf); 342 SumZ += Zf; 347 SumZ += Zf; 343 } 348 } 344 ZBalance = Z0 - SumZ; << 349 ZBalance = static_cast<G4int>(Z0) - SumZ; 345 } 350 } 346 // Loop checking, 05-Aug-2015, Vladimir Ivan << 351 while (std::abs(ZBalance) > 1.1); 347 while (std::abs(ZBalance) > 1); << 348 FragmentsZ[0] += ZBalance; 352 FragmentsZ[0] += ZBalance; 349 353 350 G4StatMFChannel * theChannel = new G4StatMFC 354 G4StatMFChannel * theChannel = new G4StatMFChannel; 351 for (unsigned int i = 0; i < _thePartition.s 355 for (unsigned int i = 0; i < _thePartition.size(); i++) 352 { 356 { 353 theChannel->CreateFragment(_thePartition 357 theChannel->CreateFragment(_thePartition[i],FragmentsZ[i]); 354 } 358 } 355 359 356 return theChannel; 360 return theChannel; 357 } 361 } 358 362