50 lossFluctuationArePossible =
true;
51 lossFluctuationFlag=
true;
58 preStepChargeSqRatio=1.;
61 currentCoupleIndex=9999999;
63 currentMaterialIndex=9999999;
67 preStepScaledKinEnergy=0.;
102 massRatio = proton_mass_c2/theDirectPartDef->
GetPDGMass();
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);
315void G4ContinuousGainOfEnergy::SetDynamicMassCharge(
const G4Track& ,
G4double energy)
319 if (theDirectEnergyLossProcess) theDirectEnergyLossProcess->
SetDynamicMassCharge(massRatio,ChargeSqRatio);
virtual G4double GetContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety)
void SetLossFluctuations(G4bool val)
void BuildPhysicsTable(const G4ParticleDefinition &)
G4VParticleChange * AlongStepDoIt(const G4Track &, const G4Step &)
void SetDirectParticle(G4ParticleDefinition *p)
virtual ~G4ContinuousGainOfEnergy()
void PreparePhysicsTable(const G4ParticleDefinition &)
G4ContinuousGainOfEnergy(const G4String &name="EnergyGain", G4ProcessType type=fElectromagnetic)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4double GetKineticEnergy() const
void SetKineticEnergy(G4double aEnergy)
G4double EffectiveChargeSquareRatio(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
static G4LossTableManager * Instance()
G4EmCorrections * EmCorrections()
void ProposeEnergy(G4double finalEnergy)
virtual void Initialize(const G4Track &)
const G4String & GetParticleType() const
G4double GetPDGMass() const
G4double GetPDGCharge() const
G4double GetWeight() const
G4double GetStepLength() const
G4StepPoint * GetPostStepPoint() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetKineticEnergy() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
virtual void CorrectionsAlongStep(const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double &eloss, G4double &niel, G4double length)
G4VEmFluctuationModel * GetModelOfFluctuations()
G4double HighEnergyLimit() const
virtual G4double GetChargeSquareRatio(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
G4double MaxSecondaryKinEnergy(const G4DynamicParticle *dynParticle)
G4double GetKineticEnergy(G4double &range, const G4MaterialCutsCouple *)
G4VEmModel * SelectModelForMaterial(G4double kinEnergy, size_t &idx) const
void SetDynamicMassCharge(G4double massratio, G4double charge2ratio)
G4double GetDEDX(G4double &kineticEnergy, const G4MaterialCutsCouple *)
G4double GetRange(G4double &kineticEnergy, const G4MaterialCutsCouple *)
void SetParentWeightByProcess(G4bool)
void ProposeParentWeight(G4double finalWeight)
G4ParticleChange aParticleChange