51#ifndef G4VEnergyLossProcess_h
52#define G4VEnergyLossProcess_h 1
173 G4bool ascii =
false)
override;
438 inline G4double GetLimitScaledRangeForScaledEnergy(
G4double scaledKinEnergy);
439 inline G4double GetLimitScaledRangeForScaledEnergy(
G4double scaledKinEnergy,
445 void ComputeLambdaForScaledEnergy(
G4double scaledKinEnergy,
468 std::vector<G4VEmModel*> emModels;
472 std::vector<const G4Region*> scoffRegions;
476 std::vector<G4VEnergyLossProcess*> scProcesses;
493 size_t idxDEDXSub = 0;
494 size_t idxDEDXunRestricted = 0;
495 size_t idxIonisation = 0;
496 size_t idxIonisationSub = 0;
499 size_t idxSecRange = 0;
500 size_t idxInverseRange = 0;
501 size_t idxLambda = 0;
502 size_t idxSubLambda = 0;
504 std::vector<G4double> theDEDXAtMaxEnergy;
505 std::vector<G4double> theRangeAtMaxEnergy;
506 std::vector<G4double> theEnergyOfCrossSectionMax;
507 std::vector<G4double> theCrossSectionMax;
509 const std::vector<G4double>* theDensityFactor;
510 const std::vector<G4int>* theDensityIdx;
532 G4bool lossFluctuationFlag;
571 std::vector<G4DynamicParticle*> secParticles;
572 std::vector<G4Track*> scTracks;
577 size_t basedCoupleIndex;
611 G4double kinEnergy,
size_t& idx)
const
627 reduceFactor = 1.0/(fFactor*massRatio);
629 idxLambda = idxSubLambda = 0;
638 massRatio = massratio;
639 logMassRatio =
G4Log(massRatio);
641 chargeSqRatio = charge2ratio;
642 reduceFactor = 1.0/(fFactor*massRatio);
654 G4double x = fFactor*(*theDEDXTable)[basedCoupleIndex]->Value(e, idxDEDX);
655 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
667 G4double x = fFactor*(*theDEDXTable)[basedCoupleIndex]->LogVectorValue(e,loge);
668 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
677 fFactor*(*theDEDXSubTable)[basedCoupleIndex]->Value(e, idxDEDXSub);
678 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
684inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(
G4double e)
687 fFactor*(*theIonisationTable)[basedCoupleIndex]->Value(e, idxIonisation);
688 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
698 (*theIonisationSubTable)[basedCoupleIndex]->Value(e, idxIonisationSub);
699 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
705inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(
G4double e)
711 lastIdx = basedCoupleIndex;
714 ((*theRangeTableForLoss)[basedCoupleIndex])->Value(e, idxRange);
715 if(e < minKinEnergy) {
computedRange *= std::sqrt(e/minKinEnergy); }
725G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(
G4double e,
G4double loge)
731 lastIdx = basedCoupleIndex;
734 ((*theRangeTableForLoss)[basedCoupleIndex])->LogVectorValue(e, loge);
735 if(e < minKinEnergy) {
computedRange *= std::sqrt(e/minKinEnergy); }
747G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(
G4double e)
750 if (e < maxKinEnergyCSDA) {
751 x = ((*theCSDARangeTable)[basedCoupleIndex])->Value(e, idxCSDA);
752 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
754 x = theRangeAtMaxEnergy[basedCoupleIndex] +
755 (e - maxKinEnergyCSDA)/theDEDXAtMaxEnergy[basedCoupleIndex];
761G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(
G4double e,
765 if (e < maxKinEnergyCSDA) {
766 x = ((*theCSDARangeTable)[basedCoupleIndex])->LogVectorValue(e, loge);
767 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
769 x = theRangeAtMaxEnergy[basedCoupleIndex] +
770 (e - maxKinEnergyCSDA)/theDEDXAtMaxEnergy[basedCoupleIndex];
785 if(r >= rmin) { e = v->
Value(r, idxInverseRange); }
788 e = minKinEnergy*x*x;
797 return fFactor*((*theLambdaTable)[basedCoupleIndex])->Value(e, idxLambda);
803 return fFactor*((*theLambdaTable)[basedCoupleIndex])->LogVectorValue(e,loge);
812 DefineMaterial(couple);
813 return GetDEDXForScaledEnergy(kinEnergy*massRatio);
821 DefineMaterial(couple);
822 return GetDEDXForScaledEnergy(kinEnergy*massRatio, logKinEnergy+logMassRatio);
831 DefineMaterial(couple);
832 return GetSubDEDXForScaledEnergy(kineticEnergy*massRatio);
842 DefineMaterial(couple);
843 if(theCSDARangeTable) {
844 x = reduceFactor * GetLimitScaledRangeForScaledEnergy(kinEnergy*massRatio);
845 }
else if(theRangeTableForLoss) {
846 x = reduceFactor * GetScaledRangeForScaledEnergy(kinEnergy*massRatio);
857 DefineMaterial(couple);
858 if(theCSDARangeTable) {
859 x = reduceFactor * GetLimitScaledRangeForScaledEnergy(kinEnergy*massRatio,
860 logKinEnergy+logMassRatio);
861 }
else if(theRangeTableForLoss) {
862 x = reduceFactor * GetScaledRangeForScaledEnergy(kinEnergy*massRatio,
863 logKinEnergy+logMassRatio);
874 DefineMaterial(couple);
875 return (theCSDARangeTable) ?
876 GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor
887 DefineMaterial(couple);
888 return reduceFactor * GetScaledRangeForScaledEnergy(kinEnergy*massRatio);
898 DefineMaterial(couple);
899 return reduceFactor * GetScaledRangeForScaledEnergy(kinEnergy*massRatio,
900 logKinEnergy+logMassRatio);
909 DefineMaterial(couple);
910 return ScaledKinEnergyForLoss(range/reduceFactor)/massRatio;
919 DefineMaterial(couple);
920 return theLambdaTable ? GetLambdaForScaledEnergy(kinEnergy*massRatio) : 0.0;
928 DefineMaterial(couple);
929 return theLambdaTable
930 ? GetLambdaForScaledEnergy(kinEnergy*massRatio, logKinEnergy+logMassRatio)
960 secondaryParticle = p;
990 return secondaryParticle;
997 lossFluctuationFlag = val;
1020 return isIonisation;
1027 return nSCoffRegions;
1034 return minKinEnergy;
1041 return maxKinEnergy;
1055 return tablesAreBuilt;
1062 return theDEDXTable;
1069 return theDEDXSubTable;
1076 return theDEDXunRestrictedTable;
1083 return theIonisationTable;
1090 return theIonisationSubTable;
1097 return theCSDARangeTable;
1104 return theSecondaryRangeTable;
1111 return theRangeTableForLoss;
1118 return theInverseRangeTable;
1125 return theLambdaTable;
1132 return theSubLambdaTable;
G4double condition(const G4ErrorSymMatrix &m)
G4double G4Log(G4double x)
G4VEmModel * SelectModel(G4double &energy, size_t &index)
const G4Material * GetMaterial() const
G4double Energy(std::size_t index) const
G4double Value(G4double theEnergy, std::size_t &lastidx) const
void SetCurrentCouple(const G4MaterialCutsCouple *)
const G4ParticleDefinition * BaseParticle() const
G4PhysicsTable * RangeTableForLoss() const
G4double GetRangeForLoss(G4double kineticEnergy, const G4MaterialCutsCouple *)
virtual G4double GetContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety) override
void SetMaxKinEnergy(G4double e)
G4ParticleChangeForLoss fParticleChange
virtual void PreparePhysicsTable(const G4ParticleDefinition &) override
G4PhysicsTable * InverseRangeTable() const
void ActivateSubCutoff(G4bool val, const G4Region *region=nullptr)
G4double MeanFreePath(const G4Track &track)
void SetFluctModel(G4VEmFluctuationModel *)
G4double preStepLogScaledEnergy
G4double GetKineticEnergy(G4double range, const G4MaterialCutsCouple *)
G4PhysicsTable * CSDARangeTable() const
G4VEmModel * GetModelByIndex(G4int idx=0, G4bool ver=false) const
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition *, const G4ParticleDefinition *)=0
void SelectModel(G4double kinEnergy)
void SetRangeTableForLoss(G4PhysicsTable *p)
G4int NumberOfSubCutoffRegions() const
G4PhysicsVector * LambdaPhysicsVector(const G4MaterialCutsCouple *, G4double cut)
virtual void ProcessDescription(std::ostream &outFile) const override
void UpdateEmModel(const G4String &, G4double, G4double)
G4PhysicsTable * BuildDEDXTable(G4EmTableType tType=fRestricted)
const G4MaterialCutsCouple * currentCouple
G4double MaxKinEnergy() const
void AddCollaborativeProcess(G4VEnergyLossProcess *)
G4VEmModel * SelectModelForMaterial(G4double kinEnergy, size_t &idx) const
G4bool TablesAreBuilt() const
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition *, const G4Material *, G4double cut)
G4double preStepScaledEnergy
void ActivateSecondaryBiasing(const G4String ®ion, G4double factor, G4double energyLimit)
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
const G4Element * GetCurrentElement() const
void SetDEDXBinning(G4int nbins)
void SetStepFunction(G4double v1, G4double v2)
G4PhysicsTable * DEDXTableForSubsec() const
G4double GetLambda(G4double kineticEnergy, const G4MaterialCutsCouple *)
G4int NumberOfModels() const
void SetEmModel(G4VEmModel *, G4int index=0)
void SetCrossSectionBiasingFactor(G4double f, G4bool flag=true)
G4PhysicsTable * IonisationTableForSubsec() const
const G4Material * currentMaterial
virtual G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
G4double ContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety)
void SetParticle(const G4ParticleDefinition *p)
G4VEmModel * EmModel(size_t index=0) const
G4PhysicsTable * SecondaryRangeTable() const
void SetLossFluctuations(G4bool val)
const G4ParticleDefinition * Particle() const
void SetInverseRangeTable(G4PhysicsTable *p)
virtual G4bool RetrievePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii) override
G4double SampleSubCutSecondaries(std::vector< G4Track * > &, const G4Step &, G4VEmModel *model, G4int matIdx)
void ActivateForcedInteraction(G4double length, const G4String ®ion, G4bool flag=true)
void SetDynamicMassCharge(G4double massratio, G4double charge2ratio)
virtual ~G4VEnergyLossProcess()
G4double MinKinEnergy() const
G4PhysicsTable * SubLambdaTable() const
void SetBaseParticle(const G4ParticleDefinition *p)
size_t currentCoupleIndex
G4double GetDEDXForSubsec(G4double kineticEnergy, const G4MaterialCutsCouple *)
G4double CrossSectionBiasingFactor() const
G4bool IsIonisationProcess() const
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *fluc=0, const G4Region *region=nullptr)
G4double CrossSectionPerVolume(G4double kineticEnergy, const G4MaterialCutsCouple *couple)
void SetDEDXTable(G4PhysicsTable *p, G4EmTableType tType)
virtual G4bool IsApplicable(const G4ParticleDefinition &p) override=0
void SetSecondaryRangeTable(G4PhysicsTable *p)
G4PhysicsTable * BuildLambdaTable(G4EmTableType tType=fRestricted)
virtual G4bool StorePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii=false) override
G4double GetCSDARange(G4double kineticEnergy, const G4MaterialCutsCouple *)
void SetIonisation(G4bool val)
void SetSubLambdaTable(G4PhysicsTable *p)
G4double GetDEDX(G4double kineticEnergy, const G4MaterialCutsCouple *)
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection) override
void SetLinearLossLimit(G4double val)
void SetLowestEnergyLimit(G4double)
void SetLambdaTable(G4PhysicsTable *p)
G4bool IsIntegral() const
virtual void BuildPhysicsTable(const G4ParticleDefinition &) override
G4double preStepKinEnergy
virtual G4VParticleChange * AlongStepDoIt(const G4Track &, const G4Step &) override
G4double GetRange(G4double kineticEnergy, const G4MaterialCutsCouple *)
G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple, const G4DynamicParticle *dp, G4double length)
size_t CurrentMaterialCutsCoupleIndex() const
G4PhysicsTable * IonisationTable() const
void SetSecondaryParticle(const G4ParticleDefinition *p)
G4PhysicsTable * LambdaTable() const
void SetCSDARangeTable(G4PhysicsTable *pRange)
G4double preStepLogKinEnergy
G4PhysicsTable * DEDXunRestrictedTable() const
G4double preStepRangeEnergy
void SetIntegral(G4bool val)
virtual void StreamProcessInfo(std::ostream &) const
G4PhysicsTable * DEDXTable() const
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &) override
G4VEmFluctuationModel * FluctModel()
virtual void StartTracking(G4Track *) override
void SetMinKinEnergy(G4double e)
const G4ParticleDefinition * SecondaryParticle() const