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