50 lossFluctuationArePossible =
true;
51 lossFluctuationFlag=
true;
58 preStepChargeSqRatio=1.;
61 currentCoupleIndex=9999999;
63 currentMaterialIndex=9999999;
67 preStepScaledKinEnergy=0.;
136 G4double DEDX_before = theDirectEnergyLossProcess->
GetDEDX(preStepKinEnergy, currentCouple);
150 if (is_integral ) n=10;
153 for (
size_t i=0;i<
n;i++) {
154 if (Tkin != preStepKinEnergy && IsIon) {
161 if( dlength <= linLossLimit * r ) {
162 degain = DEDX_before*dlength;
172 while (std::abs(x-x1)>0.01*x) {
176 x1= theDirectEnergyLossProcess->
GetRange(E, currentCouple);
188 tmax = std::min(tmax,currentTcut);
203 if (lossFluctuationFlag ) {
205 SampleFluctuations(currentMaterial,dynParticle,tmax,dlength,degain)-degain;
209 if (egain <=0) egain=degain;
226 G4double DEDX_after = theDirectEnergyLossProcess->
GetDEDX(Tkin, currentCouple);
229 G4double weight_correction=DEDX_after/DEDX_before;
254 if(val && !lossFluctuationArePossible)
return;
255 lossFluctuationFlag = val;
273 currentModel = theDirectEnergyLossProcess->
SelectModelForMaterial(preStepScaledKinEnergy,currentCoupleIndex);
276 chargeSqRatio = currentModel->
GetChargeSquareRatio(theDirectPartDef,currentMaterial,preStepKinEnergy);
277 preStepChargeSqRatio = chargeSqRatio;
282 G4double maxE =1.1*preStepKinEnergy;
287 if (preStepKinEnergy < currentTcut) maxE = std::min(currentTcut,maxE);
289 maxE=std::min(emax_model*1.001,maxE);
291 preStepRange = theDirectEnergyLossProcess->
GetRange(preStepKinEnergy, currentCouple);
305 x=std::max(r1-preStepRange,0.001*
mm);
319 if (theDirectEnergyLossProcess) theDirectEnergyLossProcess->
SetDynamicMassCharge(massRatio,ChargeSqRatio);