- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/electromagnetic/standard/src/G4UniversalFluctuation.cc
r1337 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4UniversalFluctuation.cc,v 1.2 2 2009/03/20 18:11:23 urbanExp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$26 // $Id: G4UniversalFluctuation.cc,v 1.28 2010/10/26 10:06:12 vnivanch Exp $ 27 // GEANT4 tag $Name: emstand-V09-03-24 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 34 34 // File name: G4UniversalFluctuation 35 35 // 36 // Author: Vladimir Ivanchenko36 // Author: Laszlo Urban 37 37 // 38 38 // Creation date: 03.01.2002 … … 57 57 // 03-04-07 correction to get better width of eloss distr.(L.Urban) 58 58 // 13-07-07 add protection for very small step or low-density material (VI) 59 // 19-03-09 new width correction (does not depend on previous steps) (L.Urban) 59 // 19-03-09 new width correction (does not depend on previous steps) (L.Urban) 60 60 // 20-03-09 modification in the width correction (L.Urban) 61 // 14-06-10 fixed tail distribution - do not use uniform function (L.Urban) 62 // 08-08-10 width correction algorithm has bee modified --> 63 // better results for thin targets (L.Urban) 61 64 // 62 65 … … 82 85 theBohrBeta2(50.0*keV/proton_mass_c2), 83 86 minLoss(10.*eV), 84 nmaxCont1(4.), 85 nmaxCont2(16.) 87 nmaxCont(16.), 88 rate(0.55), 89 fw(4.) 86 90 { 87 91 lastMaterial = 0; 92 93 particleMass = chargeSquare = ipotFluct = electronDensity = f1Fluct = f2Fluct 94 = e1Fluct = e2Fluct = e1LogFluct = e2LogFluct = ipotLogFluct = e0 = esmall 95 = e1 = e2 = 0; 88 96 } 89 97 … … 118 126 // shortcut for very very small loss (out of validity of the model) 119 127 // 120 if (meanLoss < minLoss) 121 return meanLoss; 122 123 if(!particle) InitialiseMe(dp->GetDefinition()); 128 if (meanLoss < minLoss) { return meanLoss; } 129 130 if(!particle) { InitialiseMe(dp->GetDefinition()); } 124 131 125 132 G4double tau = dp->GetKineticEnergy()/particleMass; … … 174 181 ipotLogFluct = material->GetIonisation()->GetLogMeanExcEnergy(); 175 182 e0 = material->GetIonisation()->GetEnergy0fluct(); 183 esmall = 0.5*sqrt(e0*ipotFluct); 176 184 lastMaterial = material; 177 178 // modification of some model parameters 179 // (this part should go to materials later) 180 G4double p = 1.40; 181 f2Fluct *= p; 182 f1Fluct = 1.-f2Fluct; 183 G4double q = 1.00; 184 e2Fluct *= q; 185 e2LogFluct = log(e2Fluct); 186 e1LogFluct = (ipotLogFluct-f2Fluct*e2LogFluct)/f1Fluct; 187 e1Fluct = exp(e1LogFluct); 185 188 186 } 189 187 … … 193 191 G4double a1 = 0. , a2 = 0., a3 = 0. ; 194 192 195 // cut and material dependent rate196 G4double rate = 1.0;197 193 if(tmax > ipotFluct) { 198 194 G4double w2 = log(2.*electron_mass_c2*beta2*gam2)-beta2; 199 195 200 if(w2 > ipotLogFluct && w2 > e2LogFluct) { 201 202 rate = 0.03+0.23*log(log(tmax/ipotFluct)); 196 if(w2 > ipotLogFluct && w2 > e2LogFluct && tmax> ipotFluct) { 203 197 G4double C = meanLoss*(1.-rate)/(w2-ipotLogFluct); 204 198 a1 = C*f1Fluct*(w2-e1LogFluct)/e1Fluct; 205 199 a2 = C*f2Fluct*(w2-e2LogFluct)/e2Fluct; 206 // correction in order to get better FWHM values 207 // ( scale parameters a1 and e1) 208 G4double width = 1.; 209 if(meanLoss > 10.*e1Fluct) 200 201 202 if(a1 < nmaxCont) 203 { 204 //small energy loss 205 G4double sa1 = sqrt(a1); 206 if(G4UniformRand() < exp(-sa1)) 210 207 { 211 width = 3.1623/sqrt(meanLoss/e1Fluct); 212 if(width < a2/a1) 213 width = a2/a1; 208 e1 = esmall; 209 a1 = meanLoss*(1.-rate)/e1; 210 a2 = 0.; 211 e2 = e2Fluct; 214 212 } 215 a1 *= width; 216 e1 = e1Fluct/width; 213 else 214 { 215 a1 = sa1 ; 216 e1 = sa1*e1Fluct; 217 e2 = e2Fluct; 218 } 219 } 220 else 221 { 222 //not small energy loss 223 //correction to get better fwhm value 224 a1 /= fw; 225 e1 = fw*e1Fluct; 217 226 e2 = e2Fluct; 218 227 } 219 } 228 } 229 } 220 230 221 231 G4double w1 = tmax/e0; … … 223 233 a3 = rate*meanLoss*(tmax-e0)/(e0*tmax*log(w1)); 224 234 225 //'nearly' Gaussian fluctuation if a1>nmaxCont 2&&a2>nmaxCont2&&a3>nmaxCont2235 //'nearly' Gaussian fluctuation if a1>nmaxCont&&a2>nmaxCont&&a3>nmaxCont 226 236 G4double emean = 0.; 227 237 G4double sig2e = 0., sige = 0.; … … 229 239 230 240 // excitation of type 1 231 if(a1 > nmaxCont 2)241 if(a1 > nmaxCont) 232 242 { 233 243 emean += a1*e1; … … 243 253 244 254 // excitation of type 2 245 if(a2 > nmaxCont 2)255 if(a2 > nmaxCont) 246 256 { 247 257 emean += a2*e2; … … 262 272 p3 = a3; 263 273 G4double alfa = 1.; 264 if(a3 > nmaxCont 2)274 if(a3 > nmaxCont) 265 275 { 266 alfa = w1*(nmaxCont 2+a3)/(w1*nmaxCont2+a3);276 alfa = w1*(nmaxCont+a3)/(w1*nmaxCont+a3); 267 277 G4double alfa1 = alfa*log(alfa)/(alfa-1.); 268 278 G4double namean = a3*w1*(alfa-1.)/((w1-1.)*alfa);
Note: See TracChangeset
for help on using the changeset viewer.