94#ifndef G4VEnergyLossProcess_h
95#define G4VEnergyLossProcess_h 1
459 inline G4double GetLimitScaledRangeForScaledEnergy(
G4double scaledKinEnergy);
462 inline void ComputeLambdaForScaledEnergy(
G4double scaledKinEnergy);
484 std::vector<G4VEmModel*> emModels;
487 std::vector<const G4Region*> scoffRegions;
491 std::vector<G4VEnergyLossProcess*> scProcesses;
507 std::vector<G4double> theDEDXAtMaxEnergy;
508 std::vector<G4double> theRangeAtMaxEnergy;
509 std::vector<G4double> theEnergyOfCrossSectionMax;
510 std::vector<G4double> theCrossSectionMax;
512 const std::vector<G4double>* theDensityFactor;
513 const std::vector<G4int>* theDensityIdx;
535 G4bool lossFluctuationFlag;
554 std::vector<G4DynamicParticle*> secParticles;
555 std::vector<G4Track*> scTracks;
562 size_t currentCoupleIndex;
563 size_t basedCoupleIndex;
586 return currentCoupleIndex;
600 currentModel = modelManager->
SelectModel(kinEnergy, currentCoupleIndex);
607 G4double kinEnergy,
size_t& idx)
const
617 if(couple != currentCouple) {
618 currentCouple = couple;
620 currentCoupleIndex = couple->
GetIndex();
621 basedCoupleIndex = (*theDensityIdx)[currentCoupleIndex];
622 fFactor = chargeSqRatio*biasFactor*(*theDensityFactor)[currentCoupleIndex];
623 reduceFactor = 1.0/(fFactor*massRatio);
633 massRatio = massratio;
634 fFactor *= charge2ratio/chargeSqRatio;
635 chargeSqRatio = charge2ratio;
636 reduceFactor = 1.0/(fFactor*massRatio);
645 G4double x = fFactor*(*theDEDXTable)[basedCoupleIndex]->Value(e);
646 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
654 G4double x = fFactor*(*theDEDXSubTable)[basedCoupleIndex]->Value(e);
655 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
661inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(
G4double e)
663 G4double x = fFactor*(*theIonisationTable)[basedCoupleIndex]->Value(e);
664 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
673 G4double x = fFactor*(*theIonisationSubTable)[basedCoupleIndex]->Value(e);
674 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
680inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(
G4double e)
684 G4double x = ((*theRangeTableForLoss)[basedCoupleIndex])->Value(e);
685 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
692G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(
G4double e)
695 if (e < maxKinEnergyCSDA) {
696 x = ((*theCSDARangeTable)[basedCoupleIndex])->Value(e);
697 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
699 x = theRangeAtMaxEnergy[basedCoupleIndex] +
700 (e - maxKinEnergyCSDA)/theDEDXAtMaxEnergy[basedCoupleIndex];
714 if(r >= rmin) { e = v->
Value(r); }
717 e = minKinEnergy*x*x;
726 return fFactor*((*theLambdaTable)[basedCoupleIndex])->Value(e);
735 DefineMaterial(couple);
736 return GetDEDXForScaledEnergy(kineticEnergy*massRatio);
745 DefineMaterial(couple);
746 return GetSubDEDXForScaledEnergy(kineticEnergy*massRatio);
756 if(couple != currentCouple || kineticEnergy != preStepKinEnergy) {
757 DefineMaterial(couple);
758 if(theCSDARangeTable) {
759 x = GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio)
761 }
else if(theRangeTableForLoss) {
762 x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
774 DefineMaterial(couple);
776 if(theCSDARangeTable) {
777 x = GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
789 if(couple != currentCouple || kineticEnergy != preStepKinEnergy) {
790 DefineMaterial(couple);
791 x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
804 DefineMaterial(couple);
805 return ScaledKinEnergyForLoss(range/reduceFactor)/massRatio;
814 DefineMaterial(couple);
816 if(theLambdaTable) { x = GetLambdaForScaledEnergy(kineticEnergy*massRatio); }
822inline void G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(
G4double e)
824 mfpKinEnergy = theEnergyOfCrossSectionMax[currentCoupleIndex];
825 if (e <= mfpKinEnergy) {
826 preStepLambda = GetLambdaForScaledEnergy(e);
830 if(e1 > mfpKinEnergy) {
831 preStepLambda = GetLambdaForScaledEnergy(e);
832 G4double preStepLambda1 = GetLambdaForScaledEnergy(e1);
833 if(preStepLambda1 > preStepLambda) {
835 preStepLambda = preStepLambda1;
838 preStepLambda = fFactor*theCrossSectionMax[currentCoupleIndex];
868 secondaryParticle = p;
896 return secondaryParticle;
903 lossFluctuationFlag = val;
961 if(val > 0.0 && val <= 1.0) { lambdaFactor = val; }
970 if (dRoverRange > 0.999) { dRoverRange = 1.0; }
979 lowestKinEnergy = val;
986 return nSCoffRegions;
1021 return minKinEnergy;
1029 if(e < maxKinEnergyCSDA) { maxKinEnergyCSDA = e; }
1036 return maxKinEnergy;
1043 maxKinEnergyCSDA = e;
1057 return tablesAreBuilt;
1064 return theDEDXTable;
1071 return theDEDXSubTable;
1078 return theDEDXunRestrictedTable;
1086 if(theIonisationTable) { t = theIonisationTable; }
1095 if(theIonisationSubTable) { t = theIonisationSubTable; }
1103 return theCSDARangeTable;
1110 return theRangeTableForLoss;
1117 return theInverseRangeTable;
1124 return theLambdaTable;
1131 return theSubLambdaTable;
G4double condition(const G4ErrorSymMatrix &m)
@ NotCandidateForSelection
G4VEmModel * SelectModel(G4double &energy, size_t &index)
const G4Material * GetMaterial() const
G4double Value(G4double theEnergy)
G4double Energy(size_t index) const
void SetCurrentCouple(const G4MaterialCutsCouple *)
const G4ParticleDefinition * BaseParticle() const
G4VEmModel * GetModelByIndex(G4int idx=0, G4bool ver=false)
G4PhysicsTable * RangeTableForLoss() const
void SetRandomStep(G4bool val)
void SetMaxKinEnergy(G4double e)
G4ParticleChangeForLoss fParticleChange
G4PhysicsTable * LambdaTable()
G4PhysicsTable * InverseRangeTable() const
G4double MeanFreePath(const G4Track &track)
void SetLambdaBinning(G4int nbins)
void SetFluctModel(G4VEmFluctuationModel *)
G4PhysicsTable * CSDARangeTable() const
void SetEmModel(G4VEmModel *, G4int index=1)
void PreparePhysicsTable(const G4ParticleDefinition &)
G4double GetCSDARange(G4double &kineticEnergy, const G4MaterialCutsCouple *)
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition *, const G4ParticleDefinition *)=0
void SelectModel(G4double kinEnergy)
void SetRangeTableForLoss(G4PhysicsTable *p)
G4int NumberOfSubCutoffRegions() const
G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
G4double GetRangeForLoss(G4double &kineticEnergy, const G4MaterialCutsCouple *)
G4VEmModel * EmModel(G4int index=1)
G4PhysicsVector * LambdaPhysicsVector(const G4MaterialCutsCouple *, G4double cut)
G4double GetKineticEnergy(G4double &range, const G4MaterialCutsCouple *)
G4bool StorePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii=false)
void UpdateEmModel(const G4String &, G4double, G4double)
G4PhysicsTable * BuildDEDXTable(G4EmTableType tType=fRestricted)
G4double MaxKinEnergy() const
void AddCollaborativeProcess(G4VEnergyLossProcess *)
void StartTracking(G4Track *)
void ActivateSubCutoff(G4bool val, const G4Region *region=0)
virtual void PrintInfo()=0
G4VEmModel * SelectModelForMaterial(G4double kinEnergy, size_t &idx) const
G4bool TablesAreBuilt() const
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition *, const G4Material *, G4double cut)
G4PhysicsTable * SubLambdaTable()
void ActivateSecondaryBiasing(const G4String ®ion, G4double factor, G4double energyLimit)
const G4Element * GetCurrentElement() const
void SetDEDXBinning(G4int nbins)
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *fluc=0, const G4Region *region=0)
G4double GetDEDXForSubsec(G4double &kineticEnergy, const G4MaterialCutsCouple *)
void SetStepFunction(G4double v1, G4double v2)
G4PhysicsTable * DEDXTableForSubsec() const
void BuildPhysicsTable(const G4ParticleDefinition &)
void SetCrossSectionBiasingFactor(G4double f, G4bool flag=true)
G4PhysicsTable * IonisationTableForSubsec() const
G4double GetLambda(G4double &kineticEnergy, const G4MaterialCutsCouple *)
G4double ContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety)
void SetParticle(const G4ParticleDefinition *p)
void SetLambdaFactor(G4double val)
virtual G4bool IsApplicable(const G4ParticleDefinition &p)=0
void SetLossFluctuations(G4bool val)
G4double GetCurrentRange() const
const G4ParticleDefinition * Particle() const
void SetInverseRangeTable(G4PhysicsTable *p)
void ActivateForcedInteraction(G4double length=0.0, const G4String ®ion="", G4bool flag=true)
G4double SampleSubCutSecondaries(std::vector< G4Track * > &, const G4Step &, G4VEmModel *model, G4int matIdx)
void SetDynamicMassCharge(G4double massratio, G4double charge2ratio)
virtual ~G4VEnergyLossProcess()
G4double MinKinEnergy() const
void SetBaseParticle(const G4ParticleDefinition *p)
G4double CrossSectionBiasingFactor() const
void PrintInfoDefinition()
G4bool IsIonisationProcess() const
G4bool RetrievePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii)
G4double CrossSectionPerVolume(G4double kineticEnergy, const G4MaterialCutsCouple *couple)
void SetDEDXTable(G4PhysicsTable *p, G4EmTableType tType)
void SetSecondaryRangeTable(G4PhysicsTable *p)
G4PhysicsTable * BuildLambdaTable(G4EmTableType tType=fRestricted)
G4double GetDEDX(G4double &kineticEnergy, const G4MaterialCutsCouple *)
void SetIonisation(G4bool val)
void SetSubLambdaTable(G4PhysicsTable *p)
void SetLinearLossLimit(G4double val)
void SetDEDXBinningForCSDARange(G4int nbins)
void SetLowestEnergyLimit(G4double)
G4double GetRange(G4double &kineticEnergy, const G4MaterialCutsCouple *)
G4VParticleChange * AlongStepDoIt(const G4Track &, const G4Step &)
void SetLambdaTable(G4PhysicsTable *p)
G4bool IsIntegral() const
void SetMaxKinEnergyForCSDARange(G4double e)
G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple, const G4DynamicParticle *dp, G4double length)
G4double AlongStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection)
size_t CurrentMaterialCutsCoupleIndex() const
G4PhysicsTable * IonisationTable() const
void SetMinSubRange(G4double val)
G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
void SetSecondaryParticle(const G4ParticleDefinition *p)
void SetCSDARangeTable(G4PhysicsTable *pRange)
G4PhysicsTable * DEDXunRestrictedTable() const
G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
void SetIntegral(G4bool val)
G4double GetContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety)
G4PhysicsTable * DEDXTable() const
G4VEmFluctuationModel * FluctModel()
void SetMinKinEnergy(G4double e)
const G4ParticleDefinition * SecondaryParticle() const