123{
124
125
126
127
128
129
130
131
134
135 if (meanLoss < minLoss) { return meanLoss; }
136
138
142 G4double beta2 = tau*(tau + 2.0)/gam2;
143
145
146
147
148
149
150 if ((particleMass > electron_mass_c2) &&
151 (meanLoss >= minNumberInteractionsBohr*tmax))
152 {
153 G4double massrate = electron_mass_c2/particleMass ;
154 G4double tmaxkine = 2.*electron_mass_c2*beta2*gam2/
155 (1.+massrate*(2.*
gam+massrate)) ;
156 if (tmaxkine <= 2.*tmax)
157 {
159 siga = sqrt((1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
160 * electronDensity * chargeSquare);
161
162
164
165
166 if (sn >= 2.0) {
167
168 G4double twomeanLoss = meanLoss + meanLoss;
169 do {
170 loss = G4RandGauss::shoot(meanLoss,siga);
171 } while (0.0 > loss || twomeanLoss < loss);
172
173
174 } else {
175
178 }
179
180 return loss;
181 }
182 }
183
184
185
186 if (material != lastMaterial) {
196 esmall = 0.5*sqrt(e0*ipotFluct);
197 lastMaterial = material;
198 }
199
200
201 if(tmax <= e0) { return meanLoss; }
202
205 if(meanLoss < 25.*ipotFluct)
206 {
208 { nstep = 1; }
209 else
210 {
211 nstep = 2;
212 meanLoss *= 0.5;
213 }
214 }
215
216 for (
G4int istep=0; istep < nstep; ++istep) {
217
218 loss = 0.;
219
220 G4double a1 = 0. , a2 = 0., a3 = 0. ;
221
222 if(tmax > ipotFluct) {
223 G4double w2 = log(2.*electron_mass_c2*beta2*gam2)-beta2;
224
225 if(w2 > ipotLogFluct) {
226 G4double C = meanLoss*(1.-rate)/(w2-ipotLogFluct);
227 a1 = C*f1Fluct*(w2-e1LogFluct)/e1Fluct;
228 if(w2 > e2LogFluct) {
229 a2 = C*f2Fluct*(w2-e2LogFluct)/e2Fluct;
230 }
231 if(a1 < nmaxCont) {
232
235 {
236 e1 = esmall;
237 a1 = meanLoss*(1.-rate)/e1;
238 a2 = 0.;
239 e2 = e2Fluct;
240 }
241 else
242 {
243 a1 = sa1 ;
244 e1 = sa1*e1Fluct;
245 e2 = e2Fluct;
246 }
247
248 } else {
249
250
251 a1 /= fw;
252 e1 = fw*e1Fluct;
253 e2 = e2Fluct;
254 }
255 }
256 }
257
259 if(tmax > e0) {
260 a3 = rate*meanLoss*(tmax-e0)/(e0*tmax*log(w1));
261 }
262
266
267
268 if(a1 > nmaxCont)
269 {
270 emean += a1*e1;
271 sig2e += a1*e1*e1;
272 }
273 else if(a1 > 0.)
274 {
276 loss += p1*e1;
277 if(p1 > 0.) {
279 }
280 }
281
282
283
284 if(a2 > nmaxCont)
285 {
286 emean += a2*e2;
287 sig2e += a2*e2*e2;
288 }
289 else if(a2 > 0.)
290 {
292 loss += p2*e2;
293 if(p2 > 0.)
295 }
296
297 if(emean > 0.)
298 {
299 sige = sqrt(sig2e);
300 loss += max(0.,G4RandGauss::shoot(emean,sige));
301 }
302
303
305 if(a3 > 0.) {
306 emean = 0.;
307 sig2e = 0.;
308 sige = 0.;
309 p3 = a3;
311 if(a3 > nmaxCont)
312 {
313 alfa = w1*(nmaxCont+a3)/(w1*nmaxCont+a3);
314 G4double alfa1 = alfa*log(alfa)/(alfa-1.);
315 G4double namean = a3*w1*(alfa-1.)/((w1-1.)*alfa);
316 emean += namean*e0*alfa1;
317 sig2e += e0*e0*namean*(alfa-alfa1*alfa1);
318 p3 = a3-namean;
319 }
320
324 if(nb > 0) {
326 }
327 }
328
329 if(emean > 0.)
330 {
331 sige = sqrt(sig2e);
332 lossc += max(0.,G4RandGauss::shoot(emean,sige));
333 }
334
335 loss += lossc;
336
337 losstot += loss;
338 }
339
340
341 return losstot;
342
343}
G4long G4Poisson(G4double mean)
G4double GetF2fluct() const
G4double GetLogEnergy1fluct() const
G4double GetLogEnergy2fluct() const
G4double GetMeanExcitationEnergy() const
G4double GetF1fluct() const
G4double GetEnergy2fluct() const
G4double GetEnergy1fluct() const
G4double GetEnergy0fluct() const
G4double GetLogMeanExcEnergy() const
G4IonisParamMat * GetIonisation() const