158
162 G4double nb_fwd_interaction_length_over_step=0.;
163 G4double nb_adj_interaction_length_over_step=0.;
167 nb_fwd_interaction_length_over_step = stepLength*lastFwdCS;
168 nb_adj_interaction_length_over_step = stepLength*lastAdjCS;
169 G4double fwd_survival_probability=std::exp(-nb_fwd_interaction_length_over_step);
170 G4double mc_induced_survival_probability=1.;
171
172 if (is_free_flight_gamma) {
173
174 total_acc_nb_fwd_interaction_length+=nb_fwd_interaction_length_over_step;
175 total_acc_nb_adj_interaction_length+=nb_adj_interaction_length_over_step;
176 acc_track_length+=stepLength;
177 }
178 else {
179 G4double previous_acc_nb_adj_interaction_length =acc_nb_adj_interaction_length;
180 acc_nb_fwd_interaction_length+=nb_fwd_interaction_length_over_step;
181 acc_nb_adj_interaction_length+=nb_adj_interaction_length_over_step;
183
184
185
186
187 if (std::abs(total_acc_nb_adj_interaction_length - previous_acc_nb_adj_interaction_length) <= 1.e-15) {
188 mc_induced_survival_probability = 1.e50;
189
190
191
192
193
194
195
196
197 }
198 else {
199 mc_induced_survival_probability= std::exp(-acc_nb_adj_interaction_length)-std::exp(-total_acc_nb_adj_interaction_length);
200 mc_induced_survival_probability=mc_induced_survival_probability/(std::exp(-previous_acc_nb_adj_interaction_length)-std::exp(-total_acc_nb_adj_interaction_length));
201 }
202 }
203 G4double weight_correction = fwd_survival_probability/mc_induced_survival_probability;
204
205
206
207
208
209
210
212
213
214
215
216
220
221 return fParticleChange;
222}
G4double GetTotalForwardCS(G4ParticleDefinition *aPartDef, G4double Ekin, const G4MaterialCutsCouple *aCouple)
G4double GetTotalAdjointCS(G4ParticleDefinition *aPartDef, G4double Ekin, const G4MaterialCutsCouple *aCouple)
static G4AdjointGamma * AdjointGamma()
virtual void Initialize(const G4Track &)
G4double GetWeight() const
G4double GetStepLength() const
G4StepPoint * GetPostStepPoint() const
const G4ThreeVector & GetPosition() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
const G4Step * GetStep() const
void SetSecondaryWeightByProcess(G4bool)
void SetParentWeightByProcess(G4bool)
void ProposeParentWeight(G4double finalWeight)
G4double theNumberOfInteractionLengthLeft