168 secondaryParticle(0),
174 theDEDXunRestrictedTable(0),
175 theIonisationTable(0),
176 theIonisationSubTable(0),
177 theRangeTableForLoss(0),
178 theCSDARangeTable(0),
179 theSecondaryRangeTable(0),
180 theInverseRangeTable(0),
182 theSubLambdaTable(0),
187 lossFluctuationFlag(true),
189 tablesAreBuilt(false),
194 useDeexcitation(false),
392 if(index >= n) {
for(
G4int i=n; i<=index; ++i) {
emModels.push_back(0);} }
425 G4cout <<
"G4VEnergyLossProcess::PreparePhysicsTable for "
432 if(masterProcess && masterProcess !=
this) {
isMaster =
false; }
452 if(pname !=
"deuteron" && pname !=
"triton" &&
453 pname !=
"alpha+" && pname !=
"helium" &&
454 pname !=
"hydrogen") {
464 size_t n = v->
size();
465 for(
size_t j=0; j<
n; ++j) {
466 if((*v)[j] ==
this) {
480 G4cout <<
"### G4VEnergyLossProcess::PreparePhysicsTable()"
481 <<
" interrupted for "
580 for(
G4int i=0; i<nmod; ++i) {
596 for (
size_t j=0; j<
n; ++j) {
605 if( pcuts ==
scoffRegions[i]->GetProductionCuts()) { reg =
true; }
613 G4cout <<
"G4VEnergyLossProcess::PrepearPhysicsTable() is done "
615 <<
" isIon= " <<
isIon;
621 G4cout <<
" SubCutoff Regime is ON for regions: " <<
G4endl;
638 G4cout <<
"### G4VEnergyLossProcess::BuildPhysicsTable() for "
685 for(
G4int i=0; i<numberOfModels; ++i) {
701 num ==
"e+" || num ==
"mu+" ||
702 num ==
"mu-" || num ==
"proton"||
703 num ==
"pi+" || num ==
"pi-" ||
704 num ==
"kaon+" || num ==
"kaon-" ||
705 num ==
"alpha" || num ==
"anti_proton" ||
706 num ==
"GenericIon")))
723 G4cout <<
"### G4VEnergyLossProcess::BuildPhysicsTable() done for "
737 G4cout <<
"G4VEnergyLossProcess::BuildDEDXTable() of type " << tType
755 G4cout <<
"G4VEnergyLossProcess::BuildDEDXTable WARNING: wrong type "
765 G4cout << numOfCouples <<
" materials"
767 <<
" maxKinEnergy= " << emax
769 <<
" EmTableType= " << tType
770 <<
" table= " << table <<
" " <<
this
773 if(!table) {
return table; }
780 for(
size_t i=0; i<numOfCouples; ++i) {
783 G4cout <<
"G4VEnergyLossProcess::BuildDEDXVector Idx= " << i
784 <<
" flagTable= " << table->
GetFlag(i)
810 G4cout <<
"G4VEnergyLossProcess::BuildDEDXTable(): table is built for "
831 G4cout <<
"G4VEnergyLossProcess::BuildLambdaTable WARNING: wrong type "
836 G4cout <<
"G4VEnergyLossProcess::BuildLambdaTable() of type "
837 << tType <<
" for process "
840 <<
" EmTableType= " << tType
841 <<
" table= " << table
844 if(!table) {
return table;}
859 for(
size_t i=0; i<numOfCouples; ++i) {
877 if(emax <= emin) { emax = 2*emin; }
879 if(bin < 3) { bin = 3; }
892 G4cout <<
"Lambda table is built for "
906 G4cout << std::setprecision(6);
911 G4cout <<
" dE/dx and range tables from "
915 <<
" Lambda tables from threshold to "
917 <<
" in " <<
nBins <<
" bins, spline: "
931 G4cout <<
" CSDA range table up"
942 G4cout <<
"non restricted DEDXTable address= "
985 reg = regionStore->
GetRegion(
"DefaultRegionForTheWorld",
false);
1169 G4cout <<
"G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength ";
1173 <<
" Ekin(MeV)= " << preStepKinEnergy/
MeV
1177 <<
"InteractionLength= " << x/
cm <<
"[cm] " <<
G4endl;
1233 if(eloss < 0.0) { eloss = 0.0; }
1300 if(preSafety < rcut) {
1304 if(preSafety < rcut) { yes =
true; }
1308 G4double postSafety = preSafety - length;
1309 if(postSafety < rcut) {
1312 if(postSafety < rcut) { yes =
true; }
1344 eloss, eadd, length);
1345 if(eloss < 0.0) { eloss = 0.5*eloss_before; }
1387 if(eloss >= esecfluo) {
1418 if(eloss < 0.0) { eloss = 0.0; }
1455 for(
G4int i=0; i<
n; ++i) {
1479 G4double subcut = (*theSubCuts)[idx];
1481 if(cut <= subcut) {
return esec; }
1487 *(((*theSubLambdaTable)[(*theDensityIdx)[idx]])->Value(e,
idxSubLambda));
1491 if(length*cross <
perMillion) {
return esec; }
1513 fragment += del/length;
1514 if (fragment > 1.0)
break;
1523 std::vector<G4DynamicParticle*>::iterator it;
1529 tracks.push_back(t);
1532 esec += 2.0*electron_mass_c2;
1544 }
while (fragment <= 1.0);
1644 for (
G4int i=0; i<num; ++i) {
1726 G4cout <<
"Physics tables are stored for "
1729 <<
" in the directory <" << directory
1733 G4cout <<
"Fail to store Physics Tables for "
1736 <<
" in the directory <" << directory
1753 G4cout <<
"G4VEnergyLossProcess::RetrievePhysicsTable() for "
1782 "InverseRange",fpi))
1798 if(!fpi) yes =
false;
1800 "SubIonisation",yes))
1833 G4bool isRetrieved =
false;
1841 for(
size_t i=0; i<
n; ++i) {
1842 if((*aTable)[i]) { (*aTable)[i]->SetSpline(
true); }
1847 <<
" is Retrieved from <" << filename <<
">"
1853 if(mandatory && !isRetrieved) {
1857 << filename <<
"> is not Retrieved"
1900 if(cross < 0.0) { cross = 0.0; }
1978 <<
" is added to the list of collaborative processes of "
1997 for (
size_t i=0; i<
n; ++i) {
2003 pv = (*p)[(*theDensityIdx)[i]];
2017 G4cout<<
"G4VEnergyLossProcess::SetDEDXTable "
2030 G4cout<<
"G4VEnergyLossProcess::SetIonisationTable "
2054 for (
size_t i=0; i<
n; ++i) {
2059 pv = (*p)[(*theDensityIdx)[i]];
2060 if(pv) { rmax = pv->
Value(emax,
idxCSDA)/(*theDensityFactor)[i]; }
2075 G4cout <<
"### Set Range table " << p
2087 G4cout <<
"### Set SecondaryRange table " << p
2099 G4cout <<
"### Set InverseRange table " << p
2110 G4cout <<
"### Set Lambda table " << p
2129 for (i=0; i<
n; ++i) {
2130 pv = (*theLambdaTable)[i];
2136 for (
size_t j=0; j<nb; ++j) {
2149 <<
" Max CS at i= " << i <<
" emax(MeV)= " << emax/
MeV
2150 <<
" lambda= " << smax <<
G4endl;
2155 for (i=0; i<
n; ++i) {
2156 pv = (*theLambdaTable)[i];
2158 G4int j = (*theDensityIdx)[i];
2172 G4cout <<
"### Set SebLambda table " << p
2196 G4cout <<
"### SetCrossSectionBiasingFactor: for "
2198 <<
" biasFactor= " << f <<
" weightFlag= " << flag
2213 G4cout <<
"### ActivateForcedInteraction: for "
2215 <<
" length(mm)= " << length/
mm
2216 <<
" in G4Region <" << region
2217 <<
"> weightFlag= " << flag
2231 if (0.0 <= factor) {
2240 G4cout <<
"### ActivateSecondaryBiasing: for "
2242 <<
" factor= " << factor
2243 <<
" in G4Region <" << region
2244 <<
"> energyLimit(MeV)= " << energyLimit/
MeV
G4VEnergyLossProcess(const G4String &name="EnergyLoss", G4ProcessType type=fElectromagnetic)
G4double condition(const G4ErrorSymMatrix &m)
G4double MaxSecondaryKinEnergy(const G4DynamicParticle *dynParticle)
G4ParticleDefinition * GetDefinition() const
const G4VProcess * GetMasterProcess() const
G4LossTableManager * lManager
std::vector< G4double > theEnergyOfCrossSectionMax
void SetDEDXTable(G4PhysicsTable *p, G4EmTableType tType)
G4int GetParentID() const
G4bool SplineFlag() const
virtual G4double CrossSectionPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
void InitializeForPostStep(const G4Track &)
G4double preStepKinEnergy
const G4String & GetName() const
G4SafetyHelper * GetSafetyHelper() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
const std::vector< G4double > * GetDensityFactors()
static void SetPhysicsVector(G4PhysicsTable *physTable, size_t idx, G4PhysicsVector *vec)
static G4LossTableManager * Instance()
void ActivateForcedInteraction(G4double length=0.0, const G4String &r="")
G4GPILSelection aGPILSelection
virtual G4double SampleFluctuations(const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmax, G4double length, G4double meanLoss)=0
void AlongStepDeexcitation(std::vector< G4Track * > &tracks, const G4Step &step, G4double &eLoss, G4int coupleIndex)
G4double ApplySecondaryBiasing(std::vector< G4DynamicParticle * > &, const G4Track &track, G4VEmModel *currentModel, G4ParticleChangeForGamma *pParticleChange, G4double &eloss, G4int coupleIdx, G4double tcut, G4double safety=0.0)
virtual void CorrectionsAlongStep(const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double &eloss, G4double &niel, G4double length)
void UpdateEmModel(const G4String &, G4double, G4double)
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin=0.0, G4double tmax=DBL_MAX)=0
G4double GetKineticEnergy() const
void PrintInfoDefinition(const G4ParticleDefinition &part)
CLHEP::Hep3Vector G4ThreeVector
G4double GetStepLength() const
G4double HighEnergyLimit() const
void BuildPhysicsTable(const G4ParticleDefinition &)
const G4DynamicParticle * GetDynamicParticle() const
G4bool SecondaryBiasingRegion(G4int coupleIdx)
G4bool IsPIXEActive() const
G4PhysicsTable * SubLambdaTable() const
void SetLowEnergyLimit(G4double elimit)
G4VEmModel * currentModel
G4VEmModel * GetModel(G4int, G4bool ver=false)
G4double GetProductionCut(G4int index) const
void DeRegister(G4VEnergyLossProcess *p)
G4PhysicsTable * RangeTableForLoss() const
G4double GetContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety)
const std::vector< G4double > * theDensityFactor
G4StepStatus GetStepStatus() const
G4bool BuildCSDARange() const
const G4String & GetName() const
G4PhysicsTable * SecondaryRangeTable() const
G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
void AddCollaborativeProcess(G4VEnergyLossProcess *)
const G4ThreeVector & GetPosition() const
const std::vector< G4int > * theDensityIdx
virtual void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *masterModel)
void ActivateForcedInteraction(G4double length=0.0, const G4String ®ion="", G4bool flag=true)
const G4ParticleDefinition * secondaryParticle
G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
void SetStepFunction(G4double v1, G4double v2)
G4bool ForcedInteractionRegion(G4int coupleIdx)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
G4PhysicsTable * CSDARangeTable() const
G4PhysicsTable * theSecondaryRangeTable
G4bool StorePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii=false)
G4VEmFluctuationModel * fluctModel
G4ParticleChangeForLoss fParticleChange
G4double theNumberOfInteractionLengthLeft
void SelectModel(G4double kinEnergy)
G4bool GetFlag(size_t idx) const
G4PhysicsTable * theIonisationTable
void SetTouchableHandle(const G4TouchableHandle &apValue)
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *, const G4Region *)
G4VEmModel * GetModelByIndex(G4int idx=0, G4bool ver=false) const
G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
size_t currentCoupleIndex
G4int NumberOfModels() const
void ResetForcedInteraction()
G4PhysicsTable * IonisationTableForSubsec() const
G4double GetParentWeight() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void ActivateSecondaryBiasing(const G4String ®ion, G4double factor, G4double energyLimit)
G4VEmFluctuationModel * GetModelOfFluctuations()
const G4DataVector * SubCutoff() const
size_t GetVectorLength() const
G4double preStepRangeEnergy
G4PhysicsVector * LambdaPhysicsVector(const G4MaterialCutsCouple *, G4double cut)
void InitializeForAlongStep(const G4Track &)
G4double GetProposedKineticEnergy() const
G4PhysicsTable * IonisationTable() const
void FillLambdaVector(G4PhysicsVector *, const G4MaterialCutsCouple *, G4bool startFromNull=true, G4EmTableType t=fRestricted)
G4ProcessManager * GetProcessManager() const
G4VAtomDeexcitation * atomDeexcitation
void FillSecondDerivatives()
G4PhysicsTable * BuildLambdaTable(G4EmTableType tType=fRestricted)
const G4String & GetPhysicsTableFileName(const G4ParticleDefinition *, const G4String &directory, const G4String &tableName, G4bool ascii=false)
static G4PhysicsTable * PreparePhysicsTable(G4PhysicsTable *physTable)
const G4String & GetParticleName() const
G4bool lossFluctuationFlag
G4LossTableBuilder * GetTableBuilder()
void SetWeight(G4double aValue)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
void SetCreatorModelIndex(G4int idx)
G4bool ExistPhysicsTable(const G4String &fileName) const
const G4ParticleDefinition * theGamma
static const G4double reg
const G4MaterialCutsCouple * currentCouple
void Initialise(const G4ParticleDefinition &part, const G4String &procName, G4int verbose)
const G4DataVector * theCuts
void SetHighEnergyLimit(G4double)
virtual G4double Dispersion(const G4Material *, const G4DynamicParticle *, G4double tmax, G4double length)=0
static G4RegionStore * GetInstance()
G4PhysicsTable * theSubLambdaTable
G4StepPoint * GetPreStepPoint() const
G4PhysicsTable * LambdaTable() const
void ProposeWeight(G4double finalWeight)
void SetSecondaryWeightByProcess(G4bool)
void SetInverseRangeTable(G4PhysicsTable *p)
void SetCrossSectionBiasingFactor(G4double f, G4bool flag=true)
G4ProcessVector * GetAtRestProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4double GetKineticEnergy() const
G4double SampleSubCutSecondaries(std::vector< G4Track * > &, const G4Step &, G4VEmModel *model, G4int matIdx)
const G4ParticleDefinition * baseParticle
G4GLOB_DLL std::ostream G4cout
void FillDEDXVector(G4PhysicsVector *, const G4MaterialCutsCouple *, G4EmTableType t=fRestricted)
void FillSecondariesAlongStep(G4double &eloss, G4double &weight)
const G4DataVector * theSubCuts
G4PhysicsTable * DEDXTable() const
G4double ScaledKinEnergyForLoss(G4double range)
size_t GetTableSize() const
G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy)
void SetParticleChange(G4VParticleChange *, G4VEmFluctuationModel *f=0)
const G4ThreeVector & GetPosition() const
const G4Element * GetCurrentElement() const
const G4ParticleDefinition * theGenericIon
const G4ParticleDefinition * thePositron
void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy)
std::vector< G4Track * > scTracks
G4double preStepScaledEnergy
G4double GetStepLimit(G4int coupleIdx, G4double previousStep)
G4double currentInteractionLength
void SetProposedKineticEnergy(G4double proposedKinEnergy)
G4double GetSubDEDXForScaledEnergy(G4double scaledKinEnergy)
const G4ParticleDefinition * GetParticleDefinition() const
G4PhysicsTable * theCSDARangeTable
virtual ~G4VEnergyLossProcess()
const G4String & GetParticleType() const
void Register(G4VEnergyLossProcess *p)
std::vector< G4double > theDEDXAtMaxEnergy
G4VParticleChange * AlongStepDoIt(const G4Track &, const G4Step &)
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *fluc=0, const G4Region *region=0)
const G4ParticleDefinition * particle
G4double GetGlobalTime() const
G4PhysicsTable * DEDXTableForSubsec() const
G4double Energy(size_t index) const
G4double Value(G4double theEnergy, size_t &lastidx) const
const G4String & GetProcessName() const
G4double AlongStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection)
void AddSecondary(G4Track *aSecondary)
virtual G4double ChargeSquareRatio(const G4Track &)
const G4TouchableHandle & GetTouchableHandle() const
G4Material * GetMaterial() const
void RegisterExtraParticle(const G4ParticleDefinition *aParticle, G4VEnergyLossProcess *p)
G4bool IsActive(G4double kinEnergy)
void DumpModelList(G4int verb)
std::vector< const G4Region * > scoffRegions
const G4DataVector * Initialise(const G4ParticleDefinition *part, const G4ParticleDefinition *secPart, G4double minSubRange, G4int verb)
G4double ComputeSafety(const G4ThreeVector &pGlobalPoint, G4double maxRadius=DBL_MAX)
G4PhysicsTable * theLambdaTable
static G4TransportationManager * GetTransportationManager()
G4bool RetrievePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii)
void SetMasterThread(G4bool val)
void PreparePhysicsTable(const G4ParticleDefinition &)
G4double G4Log(G4double x)
const G4ParticleDefinition * theElectron
void ActivateSecondaryBiasing(const G4String ®ion, G4double factor, G4double energyLimit)
static const double perMillion
virtual G4double GetParticleCharge(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
static G4ProductionCutsTable * GetProductionCutsTable()
const G4Material * currentMaterial
void SetLambdaTable(G4PhysicsTable *p)
G4PhysicsTable * theInverseRangeTable
static G4Positron * Positron()
G4int NumberOfModels() const
G4SafetyHelper * safetyHelper
std::vector< G4double > theCrossSectionMax
virtual void PrintInfo()=0
G4PhysicsTable * InverseRangeTable() const
void BuildPhysicsTable(const G4ParticleDefinition *aParticle)
G4double GetPDGMass() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
static G4ParticleTable * GetParticleTable()
void StartTracking(G4Track *)
G4double maxKinEnergyCSDA
void InitialiseBaseMaterials(G4PhysicsTable *table)
void SetNumberOfSecondaries(G4int totSecondaries)
G4double GetLocalEnergyDeposit() const
G4double MeanFreePath(const G4Track &track)
G4PhysicsTable * theDEDXunRestrictedTable
G4StepPoint * GetPostStepPoint() const
void UpdateEmModel(const G4String &, G4double, G4double)
G4bool StoreTable(const G4ParticleDefinition *p, G4PhysicsTable *, G4bool ascii, const G4String &directory, const G4String &tname)
G4VParticleChange * pParticleChange
G4PhysicsTable * theRangeTableForLoss
void SetEmModel(G4VEmModel *, G4int index=1)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4double ContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety)
std::vector< G4VEmModel * > emModels
G4double GetSafety() const
void SetProposedCharge(G4double theCharge)
void PreparePhysicsTable(const G4ParticleDefinition *aParticle, G4VEnergyLossProcess *p, G4bool theMaster)
void SetCSDARangeTable(G4PhysicsTable *pRange)
G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple, const G4DynamicParticle *dp, G4double length)
void LocalPhysicsTables(const G4ParticleDefinition *aParticle, G4VEnergyLossProcess *p)
G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy)
static G4Electron * Electron()
G4double GetGlobalTime() const
void SetSecondaryRangeTable(G4PhysicsTable *p)
G4bool StorePhysicsTable(const G4String &filename, G4bool ascii=false)
G4TrackStatus GetTrackStatus() const
G4VAtomDeexcitation * AtomDeexcitation()
G4PhysicsTable * DEDXunRestrictedTable() const
std::vector< G4double > theRangeAtMaxEnergy
G4bool RetrieveTable(const G4ParticleDefinition *p, G4PhysicsTable *, G4bool ascii, const G4String &directory, const G4String &tname, G4bool mandatory)
G4PhysicsTable * theDEDXTable
G4double theInitialNumberOfInteractionLength
G4bool GetFlag(size_t i) const
static G4int Register(G4String &)
void ProposeTrackStatus(G4TrackStatus status)
void SetSubLambdaTable(G4PhysicsTable *p)
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition *, const G4Material *, G4double cut)
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4Track * GetTrack() const
G4double GetPDGCharge() const
G4EmBiasingManager * biasManager
void ActivateSubCutoff(G4bool val, const G4Region *region=0)
void SetRangeTableForLoss(G4PhysicsTable *p)
static G4bool RetrievePhysicsTable(G4PhysicsTable *physTable, const G4String &fileName, G4bool ascii)
G4ProductionCuts * GetProductionCuts() const
G4PhysicsTable * theDEDXSubTable
G4int GetProcessSubType() const
G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy)
std::vector< G4VEnergyLossProcess * > scProcesses
G4PhysicsTable * BuildDEDXTable(G4EmTableType tType=fRestricted)
G4VEmModel * EmModel(G4int index=1) const
void DefineMaterial(const G4MaterialCutsCouple *couple)
void SetVerboseLevel(G4int value)
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition *, const G4ParticleDefinition *)=0
const G4Material * GetMaterial() const
G4PhysicsTable * theIonisationSubTable
G4double CrossSectionPerVolume(G4double kineticEnergy, const G4MaterialCutsCouple *couple)
std::vector< G4DynamicParticle * > secParticles
size_t idxDEDXunRestricted
const std::vector< G4int > * GetCoupleIndexes()
const G4Element * GetCurrentElement() const
G4bool IsIonisationProcess() const
G4EmModelManager * modelManager