51 lossFluctuationArePossible =
true;
52 lossFluctuationFlag=
true;
59 preStepChargeSqRatio=1.;
62 currentCoupleIndex=9999999;
64 currentMaterialIndex=9999999;
68 preStepScaledKinEnergy=0.;
137 G4double DEDX_before = theDirectEnergyLossProcess->
GetDEDX(preStepKinEnergy, currentCouple);
151 if (is_integral ) n=10;
154 for (
size_t i=0;i<
n;i++) {
155 if (Tkin != preStepKinEnergy && IsIon) {
162 if( dlength <= linLossLimit * r ) {
163 degain = DEDX_before*dlength;
176 const G4int iimax = 100;
177 while (std::abs(x-x1)>0.01*x) {
181 x1= theDirectEnergyLossProcess->
GetRange(E, currentCouple);
183 if(ii >= iimax) {
break; }
209 if (lossFluctuationFlag ) {
211 SampleFluctuations(currentCouple,dynParticle,tmax,dlength,degain)-degain;
215 if (egain <=0) egain=degain;
232 G4double DEDX_after = theDirectEnergyLossProcess->
GetDEDX(Tkin, currentCouple);
235 G4double weight_correction=DEDX_after/DEDX_before;
260 if(val && !lossFluctuationArePossible)
return;
261 lossFluctuationFlag = val;
279 currentModel = theDirectEnergyLossProcess->
SelectModelForMaterial(preStepScaledKinEnergy,currentCoupleIndex);
282 chargeSqRatio = currentModel->
GetChargeSquareRatio(theDirectPartDef,currentMaterial,preStepKinEnergy);
283 preStepChargeSqRatio = chargeSqRatio;
288 G4double maxE =1.1*preStepKinEnergy;
293 if (preStepKinEnergy < currentTcut) maxE =
std::min(currentTcut,maxE);
295 maxE=
std::min(emax_model*1.001,maxE);
297 preStepRange = theDirectEnergyLossProcess->
GetRange(preStepKinEnergy, currentCouple);
325 if (theDirectEnergyLossProcess) theDirectEnergyLossProcess->
SetDynamicMassCharge(massRatio,ChargeSqRatio);
G4double GetKineticEnergy(G4double &range, const G4MaterialCutsCouple *)
G4double MaxSecondaryKinEnergy(const G4DynamicParticle *dynParticle)
static G4LossTableManager * Instance()
G4double GetWeight() const
G4ContinuousGainOfEnergy(const G4String &name="EnergyGain", G4ProcessType type=fElectromagnetic)
static constexpr double mm
virtual void CorrectionsAlongStep(const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double &eloss, G4double &niel, G4double length)
void SetDynamicMassCharge(G4double massratio, G4double charge2ratio)
static constexpr double proton_mass_c2
G4double GetKineticEnergy() const
G4double GetStepLength() const
G4double HighEnergyLimit() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetDEDX(G4double &kineticEnergy, const G4MaterialCutsCouple *)
G4double EffectiveChargeSquareRatio(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
void ProposeParentWeight(G4double finalWeight)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
void BuildPhysicsTable(const G4ParticleDefinition &)
G4VParticleChange * AlongStepDoIt(const G4Track &, const G4Step &)
G4VEmFluctuationModel * GetModelOfFluctuations()
void SetParentWeightByProcess(G4bool)
G4double GetKineticEnergy() const
G4EmCorrections * EmCorrections()
void SetDirectParticle(G4ParticleDefinition *p)
const G4String & GetParticleType() const
void SetKineticEnergy(G4double aEnergy)
virtual G4double GetChargeSquareRatio(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
virtual G4double GetContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety)
virtual void Initialize(const G4Track &)
void SetLossFluctuations(G4bool val)
G4double GetPDGMass() const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double energy(const ThreeVector &p, const G4double m)
G4StepPoint * GetPostStepPoint() const
void PreparePhysicsTable(const G4ParticleDefinition &)
void ProposeEnergy(G4double finalEnergy)
G4ParticleChange aParticleChange
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4double GetPDGCharge() const
virtual ~G4ContinuousGainOfEnergy()
G4VEmModel * SelectModelForMaterial(G4double kinEnergy, size_t &idx) const
G4double GetRange(G4double &kineticEnergy, const G4MaterialCutsCouple *)