51#ifndef G4VEnergyLossProcess_h
52#define G4VEnergyLossProcess_h 1
151 G4bool ascii =
false)
override;
224 std::size_t& idxCouple)
const;
365 inline std::vector<G4TwoPeaksXS*>*
TwoPeaksXS()
const;
382 void FillSecondariesAlongStep(
G4double weight);
411 void ComputeLambdaForScaledEnergy(
G4double scaledKinE,
447 std::vector<const G4Region*>* scoffRegions =
nullptr;
448 std::vector<G4VEmModel*>* emModels =
nullptr;
449 const std::vector<G4int>* theDensityIdx =
nullptr;
450 const std::vector<G4double>* theDensityFactor =
nullptr;
452 const std::vector<G4bool>* theFluctuationFlags =
nullptr;
454 std::vector<G4double>* theEnergyOfCrossSectionMax =
nullptr;
455 std::vector<G4TwoPeaksXS*>* fXSpeaks =
nullptr;
490 G4int numberOfModels = 0;
491 G4int nSCoffRegions = 0;
497 G4int mainSecondaries = 1;
499 std::size_t basedCoupleIndex = 0;
500 std::size_t coupleIdxRange = 0;
501 std::size_t idxDEDX = 0;
502 std::size_t idxDEDXunRestricted = 0;
503 std::size_t idxIonisation = 0;
504 std::size_t idxRange = 0;
505 std::size_t idxCSDA = 0;
506 std::size_t idxSecRange = 0;
507 std::size_t idxInverseRange = 0;
508 std::size_t idxLambda = 0;
513 G4bool lossFluctuationFlag =
true;
514 G4bool useCutAsFinalRange =
false;
515 G4bool tablesAreBuilt =
false;
518 G4bool isIonisation =
false;
519 G4bool useDeexcitation =
false;
521 G4bool weightFlag =
false;
526 G4bool actLinLossLimit =
false;
527 G4bool actBinning =
false;
528 G4bool actMinKinEnergy =
false;
529 G4bool actMaxKinEnergy =
false;
531 std::vector<G4DynamicParticle*> secParticles;
532 std::vector<G4Track*> scTracks;
553 G4double kinEnergy, std::size_t& idx)
const
555 return modelManager->SelectModel(kinEnergy, idx);
567 fFactor = chargeSqRatio*biasFactor;
574 reduceFactor = 1.0/(fFactor*massRatio);
587 G4double x = fFactor*(*theDEDXTable)[basedCoupleIndex]->Value(e, idxDEDX);
588 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
602 G4double x = fFactor*(*theDEDXTable)[basedCoupleIndex]->LogVectorValue(e,loge);
603 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
609inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(
G4double e)
612 fFactor*(*theIonisationTable)[basedCoupleIndex]->Value(e, idxIonisation);
613 if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
619inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(
G4double e)
627 fRange = reduceFactor*((*theRangeTableForLoss)[basedCoupleIndex])->Value(e, idxRange);
628 if (fRange < 0.0) { fRange = 0.0; }
629 else if (e < minKinEnergy) { fRange *= std::sqrt(e/minKinEnergy); }
638G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(
G4double e,
G4double loge)
646 fRange = reduceFactor*((*theRangeTableForLoss)[basedCoupleIndex])->LogVectorValue(e, loge);
647 if (fRange < 0.0) { fRange = 0.0; }
648 else if (e < minKinEnergy) { fRange *= std::sqrt(e/minKinEnergy); }
659G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(
G4double e)
661 G4double x = ((*theCSDARangeTable)[basedCoupleIndex])->Value(e, idxCSDA);
662 if (x < 0.0) { x = 0.0; }
663 else if (e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
670G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(
G4double e,
673 G4double x = ((*theCSDARangeTable)[basedCoupleIndex])->LogVectorValue(e, loge);
674 if (x < 0.0) { x = 0.0; }
675 else if (e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
686 G4PhysicsVector* v = (*theInverseRangeTable)[basedCoupleIndex];
689 if(r >= rmin) { e = v->
Value(r, idxInverseRange); }
692 e = minKinEnergy*x*x;
701 return fFactor*((*theLambdaTable)[basedCoupleIndex])->Value(e, idxLambda);
709 return fFactor*((*theLambdaTable)[basedCoupleIndex])->LogVectorValue(e, loge);
714inline G4double G4VEnergyLossProcess::LogScaledEkin(
const G4Track& track)
725 DefineMaterial(couple);
726 return GetDEDXForScaledEnergy(kinEnergy*massRatio);
736 DefineMaterial(couple);
737 return GetDEDXForScaledEnergy(kinEnergy*massRatio, logKinEnergy+logMassRatio);
746 DefineMaterial(couple);
747 return GetScaledRangeForScaledEnergy(kinEnergy*massRatio);
757 DefineMaterial(couple);
758 return GetScaledRangeForScaledEnergy(kinEnergy*massRatio, logKinEnergy+logMassRatio);
767 DefineMaterial(couple);
768 return (
nullptr == theCSDARangeTable) ?
DBL_MAX :
769 GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
778 DefineMaterial(couple);
779 return ScaledKinEnergyForLoss(range/reduceFactor)/massRatio;
788 DefineMaterial(couple);
789 return (
nullptr != theLambdaTable) ?
790 GetLambdaForScaledEnergy(kinEnergy*massRatio) : 0.0;
800 DefineMaterial(couple);
801 return (
nullptr != theLambdaTable) ?
802 GetLambdaForScaledEnergy(kinEnergy*massRatio, logKinEnergy+logMassRatio)
832 secondaryParticle = p;
862 return secondaryParticle;
897 return nSCoffRegions;
925 return tablesAreBuilt;
939 return theDEDXunRestrictedTable;
946 return theIonisationTable;
953 return theCSDARangeTable;
960 return theRangeTableForLoss;
967 return theInverseRangeTable;
974 return theLambdaTable;
986inline std::vector<G4double>*
989 return theEnergyOfCrossSectionMax;
1003 return numberOfModels;
1010 return (index < emModels->size()) ? (*emModels)[index] :
nullptr;
1018 return modelManager->GetModel((
G4int)idx, ver);
G4double condition(const G4ErrorSymMatrix &m)
G4double GetLogKineticEnergy() const
const G4Material * GetMaterial() const
G4double Energy(const std::size_t index) const
G4double Value(const G4double energy, std::size_t &lastidx) const
G4Region defines a region or a group of regions in the detector geometry setup, sharing properties as...
G4SafetyHelper is a helper class for physics processes which require knowledge of the safety,...
const G4DynamicParticle * GetDynamicParticle() const
G4VContinuousDiscreteProcess(const G4String &, G4ProcessType aType=fNotDefined)
const G4ParticleDefinition * BaseParticle() const
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *fluc=nullptr, const G4Region *region=nullptr)
G4PhysicsTable * RangeTableForLoss() const
G4bool UseBaseMaterial() const
G4double GetContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety) override
void SetMaxKinEnergy(G4double e)
G4ParticleChangeForLoss fParticleChange
void PreparePhysicsTable(const G4ParticleDefinition &) override
std::vector< G4double > * EnergyOfCrossSectionMax() const
G4double GetCSDADEDX(G4double kineticEnergy, const G4MaterialCutsCouple *)
G4PhysicsTable * InverseRangeTable() const
G4double MeanFreePath(const G4Track &track)
void SetFluctModel(G4VEmFluctuationModel *)
G4VEnergyLossProcess(G4VEnergyLossProcess &)=delete
G4double GetKineticEnergy(G4double range, const G4MaterialCutsCouple *)
G4PhysicsTable * CSDARangeTable() const
void SetSpline(G4bool val)
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)
void ProcessDescription(std::ostream &outFile) const override
std::size_t NumberOfModels() const
G4VEmModel * EmModel(std::size_t index=0) const
G4VEmModel * GetModelByIndex(std::size_t idx=0, G4bool ver=false) const
G4PhysicsTable * BuildDEDXTable(G4EmTableType tType=fRestricted)
void SetTwoPeaksXS(std::vector< G4TwoPeaksXS * > *)
const G4MaterialCutsCouple * currentCouple
G4double MaxKinEnergy() const
void SetLossFluctuations(G4bool)
std::size_t CurrentMaterialCutsCoupleIndex() const
G4bool TablesAreBuilt() const
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition *, const G4Material *, G4double cut)
G4double preStepScaledEnergy
void ActivateSecondaryBiasing(const G4String ®ion, G4double factor, G4double energyLimit)
G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
const G4Element * GetCurrentElement() const
void SetDEDXBinning(G4int nbins)
void SetStepFunction(G4double v1, G4double v2)
G4double GetLambda(G4double kineticEnergy, const G4MaterialCutsCouple *)
void SetEmModel(G4VEmModel *, G4int index=0)
void SetCrossSectionBiasingFactor(G4double f, G4bool flag=true)
const G4Material * currentMaterial
G4VEnergyLossProcess & operator=(const G4VEnergyLossProcess &right)=delete
G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
G4double ContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety)
std::vector< G4TwoPeaksXS * > * TwoPeaksXS() const
void SetParticle(const G4ParticleDefinition *p)
void SetCrossSectionType(G4CrossSectionType val)
const G4ParticleDefinition * Particle() const
void SetInverseRangeTable(G4PhysicsTable *p)
G4bool RetrievePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii) override
void ActivateForcedInteraction(G4double length, const G4String ®ion, G4bool flag=true)
G4CrossSectionType CrossSectionType() const
void SetDynamicMassCharge(G4double massratio, G4double charge2ratio)
G4double MinKinEnergy() const
void SetBaseParticle(const G4ParticleDefinition *p)
G4double CrossSectionBiasingFactor() const
G4bool IsIonisationProcess() const
void SetEnergyOfCrossSectionMax(std::vector< G4double > *)
G4double CrossSectionPerVolume(G4double kineticEnergy, const G4MaterialCutsCouple *couple)
void SetDEDXTable(G4PhysicsTable *p, G4EmTableType tType)
G4PhysicsTable * BuildLambdaTable(G4EmTableType tType=fRestricted)
G4bool StorePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii=false) override
~G4VEnergyLossProcess() override
G4double GetCSDARange(G4double kineticEnergy, const G4MaterialCutsCouple *)
void SetIonisation(G4bool val)
G4double GetDEDX(G4double kineticEnergy, const G4MaterialCutsCouple *)
G4double AlongStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection) override
G4VEmFluctuationModel * FluctModel() const
void SetLinearLossLimit(G4double val)
void SetLowestEnergyLimit(G4double)
void SetLambdaTable(G4PhysicsTable *p)
void BuildPhysicsTable(const G4ParticleDefinition &) override
G4VEnergyLossProcess(const G4String &name="EnergyLoss", G4ProcessType type=fElectromagnetic)
G4double preStepKinEnergy
G4VParticleChange * AlongStepDoIt(const G4Track &, const G4Step &) override
G4double GetRange(G4double kineticEnergy, const G4MaterialCutsCouple *)
G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple, const G4DynamicParticle *dp, G4double length)
G4PhysicsTable * IonisationTable() const
void ActivateSubCutoff(const G4Region *region)
G4VEmModel * SelectModelForMaterial(G4double kinEnergy, std::size_t &idxCouple) const
void SetSecondaryParticle(const G4ParticleDefinition *p)
G4PhysicsTable * LambdaTable() const
void SetCSDARangeTable(G4PhysicsTable *pRange)
G4PhysicsTable * DEDXunRestrictedTable() const
std::size_t currentCoupleIndex
virtual void StreamProcessInfo(std::ostream &) const
G4PhysicsTable * DEDXTable() const
G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &) override
void StartTracking(G4Track *) override
void SetMinKinEnergy(G4double e)
const G4ParticleDefinition * SecondaryParticle() const