108{
109
110 if(meanLoss <= minLoss) return meanLoss;
111
112
113
114
115
116
119 }
120
124
125
126
127
128
129
130
131 if ( meanLoss > minFraction*kineticEnergy ) {
132 G4double gam = (kineticEnergy - meanLoss)/particleMass + 1.0;
134 if(b2 < xmin*beta2) b2 = xmin*beta2;
137 siga *= 0.25*(1.0 + x)*(x3 + (1.0/b2 - 0.5)/(1.0/beta2 - 0.5) );
138 }
139 siga = std::sqrt(siga);
141 G4double twomeanLoss = meanLoss + meanLoss;
142
143
145
146 if (sn >= 2.0) {
147
148 do {
149 loss = G4RandGauss::shoot(rndmEngine,meanLoss,siga);
150
151 } while (0.0 > loss || twomeanLoss < loss);
152
153
154 } else if(sn > 0.1) {
155
157 loss = meanLoss*G4RandGamma::shoot(rndmEngine,neff,1.0)/neff;
158
159
160 } else {
161 loss = twomeanLoss*rndmEngine->
flat();
162 }
163
164
165 return loss;
166}
G4double Dispersion(const G4Material *, const G4DynamicParticle *, const G4double tcut, const G4double tmax, const G4double length) override
const G4Material * GetMaterial() const
G4double SampleFluctuations(const G4MaterialCutsCouple *, const G4DynamicParticle *, const G4double, const G4double, const G4double, const G4double) override