110{
111
112
113
114
115
116
117
118
119 if (averageLoss < minLoss) { return averageLoss; }
122
123
125
127
128 const G4double gam = tkin * m_Inv_particleMass + 1.0;
132
134
136
137
138
139
140
141 if ((particleMass > electron_mass_c2) &&
142 (meanLoss >= minNumberInteractionsBohr*tmax))
143 {
144 G4double tmaxkine = 2.*electron_mass_c2*beta2*gam2/
145 (1.+m_massrate*(2.*
gam+m_massrate)) ;
146 if (tmaxkine <= 2.*tmax)
147 {
149 siga = sqrt((1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
150 * electronDensity * chargeSquare);
151
153
154
155 if (sn >= 2.0) {
156
157 const G4double twomeanLoss = meanLoss + meanLoss;
158 do {
159 loss = G4RandGauss::shoot(rndmEngineF,meanLoss,siga);
160
161 } while (0.0 > loss || twomeanLoss < loss);
162
163
164 } else {
165
167 loss = meanLoss*G4RandGamma::shoot(rndmEngineF,neff,1.0)/neff;
168 }
169
170 return loss;
171 }
172 }
173
174
175
176 if (material != lastMaterial) {
186 esmall = 0.5*sqrt(e0*ipotFluct);
187 lastMaterial = material;
188 }
189
190
191 if(tmax <= e0) { return meanLoss; }
192
193
194 const G4double scaling = std::min(1.+0.5*CLHEP::keV/tmax,1.50);
195 meanLoss /= scaling;
196
198
199 loss = 0.0;
200
201 e1 = e1Fluct;
202 e2 = e2Fluct;
203
204 if(tmax > ipotFluct) {
206
207 if(w2 > ipotLogFluct) {
208 if(w2 > e2LogFluct) {
209 const G4double C = meanLoss*(1.-rate)/(w2-ipotLogFluct);
210 a1 =
C*f1Fluct*(w2-e1LogFluct)/e1Fluct;
211 a2 =
C*f2Fluct*(w2-e2LogFluct)/e2Fluct;
212 } else {
213 a1 = meanLoss*(1.-rate)/e1;
214 }
215 if(a1 < a0) {
216 const G4double fwnow = 0.5+(fw-0.5)*sqrt(a1/a0);
217 a1 /= fwnow;
218 e1 *= fwnow;
219 } else {
220 a1 /= fw;
221 e1 = fw*e1Fluct;
222 }
223 }
224 }
225
227 if(tmax > e0) {
228 a3 = rate*meanLoss*(tmax-e0)/(e0*tmax*
G4Log(w1));
229 if(a1+a2 <= 0.) {
230 a3 /= rate;
231 }
232 }
233
236
237
238 if(a1 > 0.0) { AddExcitation(rndmEngineF, a1, e1, emean, loss, sig2e); }
239
240
241 if(a2 > 0.0) { AddExcitation(rndmEngineF, a2, e2, emean, loss, sig2e); }
242
243 if(sig2e > 0.0) { SampleGauss(rndmEngineF, emean, sig2e, loss); }
244
245
246 if(a3 > 0.) {
247 emean = 0.;
248 sig2e = 0.;
251 if(a3 > nmaxCont)
252 {
253 alfa = w1*(nmaxCont+a3)/(w1*nmaxCont+a3);
255 const G4double namean = a3*w1*(alfa-1.)/((w1-1.)*alfa);
256 emean += namean*e0*alfa1;
257 sig2e += e0*e0*namean*(alfa-alfa1*alfa1);
258 p3 = a3-namean;
259 }
260
262 if(tmax > w2) {
265 if(nnb > 0) {
266 if(nnb > sizearray) {
267 sizearray = nnb;
268 delete [] rndmarray;
270 }
272 for (
G4int k=0; k<nnb; ++k) { loss += w2/(1.-w*rndmarray[k]); }
273 }
274 }
275 if(sig2e > 0.0) { SampleGauss(rndmEngineF, emean, sig2e, loss); }
276 }
277
278 loss *= scaling;
279
280 return loss;
281
282}
G4double G4Log(G4double x)
G4long G4Poisson(G4double mean)
virtual void flatArray(const int size, double *vect)=0
G4double GetKineticEnergy() const
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
const G4Material * GetMaterial() const
G4IonisParamMat * GetIonisation() const