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;
173 while (std::abs(x-x1)>0.01*x) {
177 x1= theDirectEnergyLossProcess->
GetRange(E, currentCouple);
204 if (lossFluctuationFlag ) {
206 SampleFluctuations(currentCouple,dynParticle,tmax,dlength,degain)-degain;
210 if (egain <=0) egain=degain;
227 G4double DEDX_after = theDirectEnergyLossProcess->
GetDEDX(Tkin, currentCouple);
230 G4double weight_correction=DEDX_after/DEDX_before;
255 if(val && !lossFluctuationArePossible)
return;
256 lossFluctuationFlag = val;
274 currentModel = theDirectEnergyLossProcess->
SelectModelForMaterial(preStepScaledKinEnergy,currentCoupleIndex);
277 chargeSqRatio = currentModel->
GetChargeSquareRatio(theDirectPartDef,currentMaterial,preStepKinEnergy);
278 preStepChargeSqRatio = chargeSqRatio;
283 G4double maxE =1.1*preStepKinEnergy;
288 if (preStepKinEnergy < currentTcut) maxE =
std::min(currentTcut,maxE);
290 maxE=
std::min(emax_model*1.001,maxE);
292 preStepRange = theDirectEnergyLossProcess->
GetRange(preStepKinEnergy, currentCouple);
320 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)
virtual void CorrectionsAlongStep(const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double &eloss, G4double &niel, G4double length)
void SetDynamicMassCharge(G4double massratio, G4double charge2ratio)
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
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 *)