39 , fAdjointComptonModel(nullptr)
40 , fAdjointBremModel(nullptr)
50 delete fParticleChange;
55 std::ostream& out)
const
57 out <<
"Forced interaction for gamma.\n";
93 if(fCopyGammaForForced)
105 G4bool is_scat_proj_to_proj_case =
false;
107 if(!fAdjointComptonModel && !fAdjointBremModel)
108 return fParticleChange;
109 if(!fAdjointComptonModel)
111 theSelectedModel = fAdjointBremModel;
112 is_scat_proj_to_proj_case =
false;
118 else if(!fAdjointBremModel)
120 theSelectedModel = fAdjointComptonModel;
121 is_scat_proj_to_proj_case =
true;
129 theSelectedModel = fAdjointBremModel;
130 is_scat_proj_to_proj_case =
false;
131 factor=bremAdjCS/fLastAdjCS/0.5;
135 theSelectedModel = fAdjointComptonModel;
136 is_scat_proj_to_proj_case =
true;
137 factor=(fLastAdjCS-bremAdjCS)/fLastAdjCS/0.5;
143 (1. - std::exp(fNbAdjIntLength - fTotNbAdjIntLength)) / fLastAdjCS/fCSBias;
149 factor*fLastAdjCS * invEffectiveAdjointCS);
154 fContinueGammaAsNewFreeFlight =
true;
156 return fParticleChange;
170 G4double nb_fwd_interaction_length_over_step =
175 G4double nb_adj_interaction_length_over_step = stepLength * fLastAdjCS;
177 std::exp(-nb_fwd_interaction_length_over_step);
178 G4double mc_induced_survival_probability = 1.;
183 fTotNbAdjIntLength += nb_adj_interaction_length_over_step;
184 fAccTrackLength += stepLength;
188 G4double previous_acc_nb_adj_interaction_length = fNbAdjIntLength;
189 fNbAdjIntLength += fCSBias*nb_adj_interaction_length_over_step;
193 if(std::abs(fTotNbAdjIntLength - previous_acc_nb_adj_interaction_length) <=
196 mc_induced_survival_probability = 1.e50;
200 mc_induced_survival_probability =
201 std::exp(-fNbAdjIntLength) - std::exp(-fTotNbAdjIntLength);
202 mc_induced_survival_probability /=
203 (std::exp(-previous_acc_nb_adj_interaction_length) -
204 std::exp(-fTotNbAdjIntLength));
208 fwd_survival_probability / mc_induced_survival_probability;
221 return fParticleChange;
229 static G4int lastFreeFlightTrackId = 1000;
232 fCopyGammaForForced =
false;
235 (track_id != lastFreeFlightTrackId + 1 || fContinueGammaAsNewFreeFlight);
238 if(step_id == 1 || fContinueGammaAsNewFreeFlight)
243 fCopyGammaForForced =
true;
244 lastFreeFlightTrackId = track_id;
245 fAccTrackLength = 0.;
246 fTotNbAdjIntLength = 0.;
247 fContinueGammaAsNewFreeFlight =
false;
259 fCSBias=0.000001/fTotNbAdjIntLength;
260 fTotNbAdjIntLength*=fCSBias;
261 G4double min_val = std::exp(-fTotNbAdjIntLength);
265 fNbAdjIntLength = 0.;
271 if(thePostPhysVolume)
G4double condition(const G4ErrorSymMatrix &m)
void BuildTotalSigmaTables()
G4double GetTotalForwardCS(G4ParticleDefinition *aPartDef, G4double Ekin, const G4MaterialCutsCouple *aCouple)
static G4AdjointCSManager * GetAdjointCSManager()
G4double GetTotalAdjointCS(G4ParticleDefinition *aPartDef, G4double Ekin, const G4MaterialCutsCouple *aCouple)
void BuildCrossSectionMatrices()
G4AdjointForcedInteractionForGamma(G4String process_name)
G4double GetContinuousStepLimit(const G4Track &aTrack, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety) override
G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
~G4AdjointForcedInteractionForGamma() override
G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &step) override
void ProcessDescription(std::ostream &) const override
G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
void BuildPhysicsTable(const G4ParticleDefinition &) override
G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &) override
static G4AdjointGamma * AdjointGamma()
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
void AddSecondary(G4Track *aSecondary)
void Initialize(const G4Track &) override
G4VPhysicalVolume * GetPhysicalVolume() const
G4double GetWeight() const
G4StepPoint * GetPreStepPoint() const
G4double GetStepLength() const
G4StepPoint * GetPostStepPoint() const
const G4ThreeVector & GetPosition() const
G4int GetCurrentStepNumber() const
G4ThreeVector GetMomentum() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
const G4Step * GetStep() const
virtual void SampleSecondaries(const G4Track &aTrack, G4bool isScatProjToProj, G4ParticleChange *fParticleChange)=0
void SetAdditionalWeightCorrectionFactorForPostStepOutsideModel(G4double factor)
virtual G4double AdjointCrossSection(const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool isScatProjToProj)
void SetCorrectWeightForPostStepInModel(G4bool aBool)
void SetSecondaryWeightByProcess(G4bool)
void SetParentWeightByProcess(G4bool)
void ProposeParentWeight(G4double finalWeight)
G4LogicalVolume * GetLogicalVolume() const
G4double theInitialNumberOfInteractionLength
G4double theNumberOfInteractionLengthLeft