75{
76
77
78
79
80
81
83
84
87
88
90 fDirectEnergyLossProcess->GetDEDX(fPreStepKinEnergy, fCurrentCouple);
91
92
93
94
95 G4DynamicParticle* dynParticle = new G4DynamicParticle();
99
101 if(Tkin != fPreStepKinEnergy && fIsIon)
102 {
103 G4double chargeSqRatio = fCurrentModel->GetChargeSquareRatio(
104 fDirectPartDef, fCurrentMaterial, Tkin);
105 fDirectEnergyLossProcess->SetDynamicMassCharge(fMassRatio, chargeSqRatio);
106 }
107
108 G4double r = fDirectEnergyLossProcess->GetRange(Tkin, fCurrentCouple);
109 if(dlength <= fLinLossLimit * r)
110 {
111 degain = DEDX_before * dlength;
112 }
113 else
114 {
116 G4double E = fDirectEnergyLossProcess->GetKineticEnergy(x, fCurrentCouple);
117 if(fIsIon)
118 {
119 G4double chargeSqRatio = fCurrentModel->GetChargeSquareRatio(
120 fDirectPartDef, fCurrentMaterial, E);
121 fDirectEnergyLossProcess->SetDynamicMassCharge(fMassRatio, chargeSqRatio);
122 G4double x1 = fDirectEnergyLossProcess->GetRange(E, fCurrentCouple);
123
125 constexpr G4int iimax = 100;
126 while(std::abs(x - x1) > 0.01 * x)
127 {
128 E = fDirectEnergyLossProcess->GetKineticEnergy(x, fCurrentCouple);
129 chargeSqRatio = fCurrentModel->GetChargeSquareRatio(
130 fDirectPartDef, fCurrentMaterial, E);
131 fDirectEnergyLossProcess->SetDynamicMassCharge(fMassRatio,
132 chargeSqRatio);
133 x1 = fDirectEnergyLossProcess->GetRange(E, fCurrentCouple);
134 ++ii;
135 if(ii >= iimax)
136 {
137 break;
138 }
139 }
140 }
141
142 degain = E - Tkin;
143 }
144 G4double tmax = fCurrentModel->MaxSecondaryKinEnergy(dynParticle);
145 fCurrentTcut = std::min(fCurrentTcut, tmax);
146
148
149
150 fCurrentModel->CorrectionsAlongStep(fCurrentMaterial, fDirectPartDef, Tkin,
151 fCurrentTcut, dlength, degain);
152
153
155 if(fLossFluctuationFlag)
156 {
157 deltaE = fCurrentModel->GetModelOfFluctuations()->SampleFluctuations(
158 fCurrentCouple, dynParticle, fCurrentTcut, tmax, dlength, degain)
159 - degain;
160 }
161
163 if(egain <= 0.)
164 egain = degain;
165 Tkin += egain;
167
168 delete dynParticle;
169
170 if(fIsIon)
171 {
172 G4double chargeSqRatio = fCurrentModel->GetChargeSquareRatio(
173 fDirectPartDef, fCurrentMaterial, Tkin);
174 fDirectEnergyLossProcess->SetDynamicMassCharge(fMassRatio, chargeSqRatio);
175 }
176
177 G4double DEDX_after = fDirectEnergyLossProcess->GetDEDX(Tkin, fCurrentCouple);
178 G4double weight_correction = DEDX_after / DEDX_before;
179
181
182
183
184
185
190
192}
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4double GetKineticEnergy() const
void SetKineticEnergy(G4double aEnergy)
G4double GetWeight() const
G4double GetStepLength() const
G4StepPoint * GetPostStepPoint() const
const G4DynamicParticle * GetDynamicParticle() const
G4ParticleChange aParticleChange