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;
175 const G4int iimax = 100;
176 while (std::abs(x-x1)>0.01*x) {
180 x1= theDirectEnergyLossProcess->
GetRange(E, currentCouple);
182 if(ii >= iimax) {
break; }
193 tmax = std::min(tmax,currentTcut);
208 if (lossFluctuationFlag ) {
210 SampleFluctuations(currentCouple,dynParticle,tmax,dlength,degain)-degain;
214 if (egain <=0) egain=degain;
231 G4double DEDX_after = theDirectEnergyLossProcess->
GetDEDX(Tkin, currentCouple);
234 G4double weight_correction=DEDX_after/DEDX_before;
259 if(val && !lossFluctuationArePossible)
return;
260 lossFluctuationFlag = val;
278 currentModel = theDirectEnergyLossProcess->
SelectModelForMaterial(preStepScaledKinEnergy,currentCoupleIndex);
281 chargeSqRatio = currentModel->
GetChargeSquareRatio(theDirectPartDef,currentMaterial,preStepKinEnergy);
282 preStepChargeSqRatio = chargeSqRatio;
287 G4double maxE =1.1*preStepKinEnergy;
292 if (preStepKinEnergy < currentTcut) maxE = std::min(currentTcut,maxE);
294 maxE=std::min(emax_model*1.001,maxE);
296 preStepRange = theDirectEnergyLossProcess->
GetRange(preStepKinEnergy, currentCouple);
310 x=std::max(r1-preStepRange,0.001*mm);
320void G4ContinuousGainOfEnergy::SetDynamicMassCharge(
const G4Track& ,
G4double energy)
324 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