68{
69 if (material != lastMaterial) {
71 f1Fluct = ioni->GetF1fluct();
72 f2Fluct = ioni->GetF2fluct();
73 e1Fluct = ioni->GetEnergy1fluct();
74 e2Fluct = ioni->GetEnergy2fluct();
75 e1LogFluct = ioni->GetLogEnergy1fluct();
76 e2LogFluct = ioni->GetLogEnergy2fluct();
78 lastMaterial = material;
79 }
80
85
90 a1 =
C*f1Fluct*(
w2-e1LogFluct)/e1Fluct;
91 a2 =
C*f2Fluct*(
w2-e2LogFluct)/e2Fluct;
92 } else {
94 }
97 a1 /= fwnow;
98 e1 *= fwnow;
99 } else {
102 }
103 }
104 }
105
108 if(a1+a2 <= 0.) { a3 /=
rate; }
109
110
113
114
115 if(a1 > 0.0) {
AddExcitation(rndmEngineF, a1, e1, emean, loss, sig2e); }
116
117
118 if(a2 > 0.0) {
AddExcitation(rndmEngineF, a2, e2, emean, loss, sig2e); }
119
120 if(sig2e > 0.0) {
SampleGauss(rndmEngineF, emean, sig2e, loss); }
121
122
123 if(a3 > 0.) {
124 emean = 0.;
125 sig2e = 0.;
131 const G4double namean = a3*w1*(alfa-1.)/((w1-1.)*alfa);
132 emean += namean*
e0*alfa1;
133 sig2e +=
e0*
e0*namean*(alfa-alfa1*alfa1);
134 p3 -= namean;
135 }
136
138 if(tcut > w3) {
141 if(nnb > 0) {
146 }
149 }
150 }
151 if(sig2e > 0.0) {
SampleGauss(rndmEngineF, emean, sig2e, loss); }
152 }
153
154 return loss;
155}
G4double G4Log(G4double x)
G4long G4Poisson(G4double mean)
G4IonisParamMat * GetIonisation() const
void AddExcitation(CLHEP::HepRandomEngine *rndm, const G4double ax, const G4double ex, G4double &eav, G4double &eloss, G4double &esig2)
void SampleGauss(CLHEP::HepRandomEngine *rndm, const G4double eav, const G4double esig2, G4double &eloss)