170 secondaryParticle(nullptr),
172 idxSCoffRegions(nullptr),
174 theDEDXTable(nullptr),
175 theDEDXSubTable(nullptr),
176 theDEDXunRestrictedTable(nullptr),
177 theIonisationTable(nullptr),
178 theIonisationSubTable(nullptr),
179 theRangeTableForLoss(nullptr),
180 theCSDARangeTable(nullptr),
181 theSecondaryRangeTable(nullptr),
182 theInverseRangeTable(nullptr),
183 theLambdaTable(nullptr),
184 theSubLambdaTable(nullptr),
185 theDensityFactor(nullptr),
186 theDensityIdx(nullptr),
187 baseParticle(nullptr),
188 lossFluctuationFlag(true),
190 tablesAreBuilt(false),
195 useDeexcitation(false),
197 currentCouple(nullptr),
205 preStepKinEnergy = 0.0;
206 preStepRangeEnergy = 0.0;
210 minKinEnergy = 0.1*
keV;
211 maxKinEnergy = 100.0*
TeV;
213 maxKinEnergyCSDA = 1.0*
GeV;
215 actMinKinEnergy = actMaxKinEnergy = actBinning = actLinLossLimit
216 = actLossFluc = actIntegral = actStepFunc =
false;
233 theGenericIon =
nullptr;
246 fluctModel =
nullptr;
247 currentModel =
nullptr;
248 atomDeexcitation =
nullptr;
249 subcutProducer =
nullptr;
251 biasManager =
nullptr;
257 idxDEDX = idxDEDXSub = idxDEDXunRestricted = idxIonisation =
258 idxIonisationSub = idxRange = idxCSDA = idxSecRange =
259 idxInverseRange = idxLambda = idxSubLambda = 0;
262 secParticles.reserve(5);
264 theCuts = theSubCuts =
nullptr;
265 currentMaterial =
nullptr;
266 currentCoupleIndex = basedCoupleIndex = 0;
267 massRatio = fFactor = reduceFactor = chargeSqRatio = 1.0;
268 preStepLambda = preStepScaledEnergy = fRange = 0.0;
270 secID = biasID = subsecID = -1;
288 if (isMaster && !baseParticle) {
292 if(theIonisationTable == theDEDXTable) { theIonisationTable = 0; }
296 theDEDXTable =
nullptr;
297 if(theDEDXSubTable) {
298 if(theIonisationSubTable == theDEDXSubTable)
299 { theIonisationSubTable =
nullptr; }
301 delete theDEDXSubTable;
302 theDEDXSubTable =
nullptr;
306 if(theIonisationTable) {
309 delete theIonisationTable;
310 theIonisationTable =
nullptr;
312 if(theIonisationSubTable) {
314 delete theIonisationSubTable;
315 theIonisationSubTable =
nullptr;
317 if(theDEDXunRestrictedTable && isIonisation) {
319 delete theDEDXunRestrictedTable;
320 theDEDXunRestrictedTable =
nullptr;
322 if(theCSDARangeTable && isIonisation) {
324 delete theCSDARangeTable;
325 theCSDARangeTable =
nullptr;
328 if(theRangeTableForLoss && isIonisation) {
330 delete theRangeTableForLoss;
331 theRangeTableForLoss =
nullptr;
334 if(theInverseRangeTable && isIonisation ) {
336 delete theInverseRangeTable;
337 theInverseRangeTable =
nullptr;
342 delete theLambdaTable;
343 theLambdaTable =
nullptr;
345 if(theSubLambdaTable) {
347 delete theSubLambdaTable;
348 theSubLambdaTable =
nullptr;
360 void G4VEnergyLossProcess::Clean()
368 delete [] idxSCoffRegions;
370 tablesAreBuilt =
false;
375 idxDEDX = idxDEDXSub = idxDEDXunRestricted = idxIonisation =
376 idxIonisationSub = idxRange = idxCSDA = idxSecRange =
377 idxInverseRange = idxLambda = idxSubLambda = 0;
395 modelManager->
AddEmModel(order, p, fluc, region);
411 G4int n = emModels.size();
412 if(index >= n) {
for(
G4int i=n; i<=index; ++i) {emModels.push_back(0);} }
421 if(index >= 0 && index <
G4int(emModels.size())) { p = emModels[index]; }
429 return modelManager->
GetModel(idx, ver);
445 G4cout <<
"G4VEnergyLossProcess::PreparePhysicsTable for "
452 if(masterProcess && masterProcess !=
this) { isMaster =
false; }
454 currentCouple =
nullptr;
458 preStepKinEnergy = 0.0;
459 preStepRangeEnergy = 0.0;
467 if( !particle ) { particle = ∂ }
472 if(pname !=
"deuteron" && pname !=
"triton" &&
473 pname !=
"alpha+" && pname !=
"helium" &&
474 pname !=
"hydrogen") {
481 if(theGenericIon && particle != theGenericIon) {
484 size_t n = v->
size();
485 for(
size_t j=0; j<
n; ++j) {
486 if((*v)[j] ==
this) {
487 particle = theGenericIon;
495 if( particle != &part ) {
500 G4cout <<
"### G4VEnergyLossProcess::PreparePhysicsTable()"
501 <<
" interrupted for "
503 <<
" particle " << particle <<
" GenericIon " << theGenericIon
520 theDEDXAtMaxEnergy.resize(n, 0.0);
521 theRangeAtMaxEnergy.resize(n, 0.0);
522 theEnergyOfCrossSectionMax.resize(n, 0.0);
523 theCrossSectionMax.resize(n,
DBL_MAX);
526 if(!actIntegral) { integral = theParameters->
Integral(); }
527 if(!actLossFluc) { lossFluctuationFlag = theParameters->
LossFluctuation(); }
529 if(!actMinKinEnergy) { minKinEnergy = theParameters->
MinKinEnergy(); }
530 if(!actMaxKinEnergy) { maxKinEnergy = theParameters->
MaxKinEnergy(); }
533 *
G4lrint(std::log10(maxKinEnergy/minKinEnergy));
537 *
G4lrint(std::log10(maxKinEnergyCSDA/minKinEnergy));
538 if(!actLinLossLimit) { linLossLimit = theParameters->
LinearLossLimit(); }
551 massRatio = (baseParticle->
GetPDGMass())/initialMass;
554 if(chargeSqRatio > 0.0) { reduceFactor = 1.0/(chargeSqRatio*massRatio); }
556 if(initialMass <
MeV) {
563 if (isMaster && !baseParticle) {
565 if(theDEDXTable && isIonisation) {
566 if(theIonisationTable && theDEDXTable != theIonisationTable) {
569 theDEDXTable = theIonisationTable;
571 if(theDEDXSubTable && theIonisationSubTable &&
572 theDEDXSubTable != theIonisationSubTable) {
574 delete theDEDXSubTable;
575 theDEDXSubTable = theIonisationSubTable;
582 if(theDEDXSubTable) {
588 theDEDXunRestrictedTable =
597 theRangeTableForLoss =
599 theInverseRangeTable =
638 for(
G4int i=0; i<nmod; ++i) {
647 theCuts = modelManager->
Initialise(particle, secondaryParticle,
652 if(nSCoffRegions > 0) {
653 if(theParameters->
MinSubRange() < 1.0) { useSubCutoff =
true; }
657 idxSCoffRegions =
new G4bool[
n];
658 for (
size_t j=0; j<
n; ++j) {
665 for(
G4int i=0; i<nSCoffRegions; ++i) {
666 if( pcuts == scoffRegions[i]->GetProductionCuts()) {
671 idxSCoffRegions[j] =
reg;
676 G4cout <<
"G4VEnergyLossProcess::PrepearPhysicsTable() is done "
678 <<
" isIon= " << isIon;
682 G4cout <<
" chargeSqRatio= " << chargeSqRatio
683 <<
" massRatio= " << massRatio
684 <<
" reduceFactor= " << reduceFactor <<
G4endl;
686 G4cout <<
" SubCutoff Regime is ON for regions: " <<
G4endl;
687 for (
G4int i=0; i<nSCoffRegions; ++i) {
688 const G4Region* r = scoffRegions[i];
701 G4cout <<
"### G4VEnergyLossProcess::BuildPhysicsTable() for "
708 G4cout <<
" TablesAreBuilt= " << tablesAreBuilt
709 <<
" isIon= " << isIon <<
" " <<
this <<
G4endl;
712 if(&part == particle) {
744 tablesAreBuilt =
true;
748 for(
G4int i=0; i<numberOfModels; ++i) {
764 num ==
"e+" || num ==
"mu+" ||
765 num ==
"mu-" || num ==
"proton"||
766 num ==
"pi+" || num ==
"pi-" ||
767 num ==
"kaon+" || num ==
"kaon-" ||
768 num ==
"alpha" || num ==
"anti_proton" ||
769 num ==
"GenericIon")))
779 if(nSCoffRegions > 0) { subcutProducer = lManager->
SubCutProducer(); }
780 if(atomDeexcitation) {
781 if(atomDeexcitation->
IsPIXEActive()) { useDeexcitation =
true; }
796 G4cout <<
"### G4VEnergyLossProcess::BuildPhysicsTable() done for "
799 if(isIonisation) {
G4cout <<
" isIonisation flag = 1"; }
809 G4cout <<
"G4VEnergyLossProcess::BuildDEDXTable() of type " << tType
819 emax = maxKinEnergyCSDA;
821 table = theDEDXunRestrictedTable;
823 table = theDEDXTable;
825 table = theDEDXSubTable;
827 G4cout <<
"G4VEnergyLossProcess::BuildDEDXTable WARNING: wrong type "
837 G4cout << numOfCouples <<
" materials"
838 <<
" minKinEnergy= " << minKinEnergy
839 <<
" maxKinEnergy= " << emax
841 <<
" EmTableType= " << tType
842 <<
" table= " << table <<
" " <<
this
845 if(!table) {
return table; }
852 for(
size_t i=0; i<numOfCouples; ++i) {
855 G4cout <<
"G4VEnergyLossProcess::BuildDEDXVector Idx= " << i
856 <<
" flagTable= " << table->
GetFlag(i)
864 if((*table)[i]) {
delete (*table)[i]; }
882 G4cout <<
"G4VEnergyLossProcess::BuildDEDXTable(): table is built for "
899 table = theLambdaTable;
901 table = theSubLambdaTable;
903 G4cout <<
"G4VEnergyLossProcess::BuildLambdaTable WARNING: wrong type "
908 G4cout <<
"G4VEnergyLossProcess::BuildLambdaTable() of type "
909 << tType <<
" for process "
912 <<
" EmTableType= " << tType
913 <<
" table= " << table
916 if(!table) {
return table;}
931 for(
size_t i=0; i<numOfCouples; ++i) {
943 if(minKinEnergy > emin) {
949 if(emax <= emin) { emax = 2*emin; }
964 G4cout <<
"Lambda table is built for "
978 G4cout << std::setprecision(6);
983 G4cout <<
" dE/dx and range tables from "
985 <<
" to " <<
G4BestUnit(maxKinEnergy,
"Energy")
986 <<
" in " << nBins <<
" bins" <<
G4endl
987 <<
" Lambda tables from threshold to "
990 <<
" bins per decade, spline: "
991 << theParameters->
Spline()
993 if(theRangeTableForLoss && isIonisation) {
994 G4cout <<
" finalRange(mm)= " << finalRange/
mm
995 <<
", dRoverRange= " << dRoverRange
996 <<
", integral: " << integral
997 <<
", fluct: " << lossFluctuationFlag
998 <<
", linLossLimit= " << linLossLimit
1003 if(theCSDARangeTable && isIonisation) {
1004 G4cout <<
" CSDA range table up"
1005 <<
" to " <<
G4BestUnit(maxKinEnergyCSDA,
"Energy")
1006 <<
" in " << nBinsCSDA <<
" bins" <<
G4endl;
1008 if(nSCoffRegions>0 && isIonisation) {
1009 G4cout <<
" Subcutoff sampling in " << nSCoffRegions
1013 G4cout <<
" DEDXTable address= " << theDEDXTable <<
G4endl;
1014 if(theDEDXTable && isIonisation)
G4cout << (*theDEDXTable) <<
G4endl;
1015 G4cout <<
"non restricted DEDXTable address= "
1016 << theDEDXunRestrictedTable <<
G4endl;
1017 if(theDEDXunRestrictedTable && isIonisation) {
1020 if(theDEDXSubTable && isIonisation) {
1023 G4cout <<
" CSDARangeTable address= " << theCSDARangeTable
1025 if(theCSDARangeTable && isIonisation) {
1028 G4cout <<
" RangeTableForLoss address= " << theRangeTableForLoss
1030 if(theRangeTableForLoss && isIonisation) {
1033 G4cout <<
" InverseRangeTable address= " << theInverseRangeTable
1035 if(theInverseRangeTable && isIonisation) {
1038 G4cout <<
" LambdaTable address= " << theLambdaTable <<
G4endl;
1039 if(theLambdaTable && isIonisation) {
1042 G4cout <<
" SubLambdaTable address= " << theSubLambdaTable
1044 if(theSubLambdaTable && isIonisation) {
1058 reg = regionStore->
GetRegion(
"DefaultRegionForTheWorld",
false);
1062 if (nSCoffRegions > 0) {
1063 for (
G4int i=0; i<nSCoffRegions; ++i) {
1064 if (reg == scoffRegions[i]) {
1071 scoffRegions.push_back(reg);
1090 preStepRangeEnergy = 0.0;
1094 chargeSqRatio = 0.5;
1098 massRatio = baseParticle->
GetPDGMass()/newmass;
1099 }
else if(theGenericIon) {
1122 *selection = aGPILSelection;
1123 if(isIonisation && currentModel->
IsActive(preStepScaledEnergy)) {
1124 fRange = GetScaledRangeForScaledEnergy(preStepScaledEnergy)*reduceFactor;
1132 x = fRange*dRoverRange + finR*(1.0 - dRoverRange)*(2.0 - finR/fRange);
1166 preStepScaledEnergy = preStepKinEnergy*massRatio;
1169 if(!currentModel->
IsActive(preStepScaledEnergy)) {
1178 if(q2 != chargeSqRatio && q2 > 0.0) {
1180 fFactor = q2*biasFactor*(*theDensityFactor)[currentCoupleIndex];
1181 reduceFactor = 1.0/(fFactor*massRatio);
1192 return biasManager->
GetStepLimit(currentCoupleIndex, previousStepSize);
1198 if(preStepScaledEnergy < mfpKinEnergy) {
1199 if (integral) { ComputeLambdaForScaledEnergy(preStepScaledEnergy); }
1200 else { preStepLambda = GetLambdaForScaledEnergy(preStepScaledEnergy); }
1203 if(preStepLambda <= 0.0) {
1210 if(preStepLambda > 0.0) {
1234 G4cout <<
"G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength ";
1237 <<
" in Material " << currentMaterial->
GetName()
1238 <<
" Ekin(MeV)= " << preStepKinEnergy/
MeV
1242 <<
"InteractionLength= " << x/
cm <<
"[cm] " <<
G4endl;
1255 if(!isIonisation || !currentModel->
IsActive(preStepScaledEnergy)) {
1287 weight /= biasFactor;
1292 if (length >= fRange || preStepKinEnergy <= lowestKinEnergy) {
1293 eloss = preStepKinEnergy;
1294 if (useDeexcitation) {
1296 eloss, currentCoupleIndex);
1297 if(scTracks.size() > 0) { FillSecondariesAlongStep(eloss, weight); }
1298 if(eloss < 0.0) { eloss = 0.0; }
1308 eloss = GetDEDXForScaledEnergy(preStepScaledEnergy)*length;
1313 if(eloss > preStepKinEnergy*linLossLimit) {
1315 G4double x = (fRange - length)/reduceFactor;
1317 eloss = preStepKinEnergy - ScaledKinEnergyForLoss(x)/massRatio;
1345 G4double cut = (*theCuts)[currentCoupleIndex];
1351 if(useSubCutoff && !subcutProducer) {
1352 if(idxSCoffRegions[currentCoupleIndex]) {
1367 if(preSafety < rcut) {
1372 if(preSafety < rcut) { yes =
true; }
1376 G4double postSafety = preSafety - length;
1377 if(postSafety < rcut) {
1380 if(postSafety < rcut) { yes =
true; }
1388 cut = (*theSubCuts)[currentCoupleIndex];
1389 eloss -= GetSubDEDXForScaledEnergy(preStepScaledEnergy)*length;
1391 currentModel,currentCoupleIndex);
1412 eloss, eadd, length);
1413 if(eloss < 0.0) { eloss = 0.5*eloss_before; }
1417 if (lossFluctuationFlag) {
1419 if(eloss + esec < preStepKinEnergy) {
1438 if (useDeexcitation) {
1439 G4double esecfluo = preStepKinEnergy - esec;
1448 de, currentCoupleIndex);
1454 if(eloss >= esecfluo) {
1472 if(subcutProducer && idxSCoffRegions[currentCoupleIndex]) {
1475 if(scTracks.size() > 0) { FillSecondariesAlongStep(eloss, weight); }
1478 G4double finalT = preStepKinEnergy - eloss - esec;
1479 if (finalT <= lowestKinEnergy) {
1485 currentMaterial,finalT));
1510 G4VEnergyLossProcess::FillSecondariesAlongStep(
G4double&,
G4double& weight)
1512 G4int n0 = scTracks.size();
1523 G4int n = scTracks.size();
1526 for(
G4int i=0; i<
n; ++i) {
1549 G4double subcut = (*theSubCuts)[idx];
1551 if(cut <= subcut) {
return esec; }
1556 G4double cross = (*theDensityFactor)[idx]*chargeSqRatio
1557 *(((*theSubLambdaTable)[(*theDensityIdx)[idx]])->Value(e, idxSubLambda));
1561 if(length*cross <
perMillion) {
return esec; }
1582 fragment += del/length;
1583 if (fragment > 1.0) {
break; }
1586 secParticles.clear();
1592 std::vector<G4DynamicParticle*>::iterator it;
1593 for(it=secParticles.begin(); it!=secParticles.end(); ++it) {
1598 tracks.push_back(t);
1614 }
while (fragment <= 1.0);
1631 G4double postStepScaledEnergy = finalT*massRatio;
1633 if(!currentModel->
IsActive(postStepScaledEnergy)) {
1653 G4double lx = GetLambdaForScaledEnergy(postStepScaledEnergy);
1674 weight /= biasFactor;
1679 G4double tcut = (*theCuts)[currentCoupleIndex];
1682 secParticles.clear();
1688 G4int num0 = secParticles.size();
1696 track, currentModel,
1698 currentCoupleIndex, tcut,
1708 G4int num = secParticles.size();
1714 for (
G4int i=0; i<num; ++i) {
1715 if(secParticles[i]) {
1761 if (!isMaster || baseParticle || part != particle )
return res;
1763 if(!StoreTable(part,theDEDXTable,ascii,directory,
"DEDX"))
1766 if(!StoreTable(part,theDEDXunRestrictedTable,ascii,directory,
"DEDXnr"))
1769 if(!StoreTable(part,theDEDXSubTable,ascii,directory,
"SubDEDX"))
1772 if(!StoreTable(part,theIonisationTable,ascii,directory,
"Ionisation"))
1775 if(!StoreTable(part,theIonisationSubTable,ascii,directory,
"SubIonisation"))
1779 !StoreTable(part,theCSDARangeTable,ascii,directory,
"CSDARange"))
1783 !StoreTable(part,theRangeTableForLoss,ascii,directory,
"Range"))
1787 !StoreTable(part,theInverseRangeTable,ascii,directory,
"InverseRange"))
1790 if(!StoreTable(part,theLambdaTable,ascii,directory,
"Lambda"))
1793 if(!StoreTable(part,theSubLambdaTable,ascii,directory,
"SubLambda"))
1798 G4cout <<
"Physics tables are stored for "
1801 <<
" in the directory <" << directory
1805 G4cout <<
"Fail to store Physics Tables for "
1808 <<
" in the directory <" << directory
1822 if (!isMaster)
return res;
1826 G4cout <<
"G4VEnergyLossProcess::RetrievePhysicsTable() for "
1828 <<
"; tables_are_built= " << tablesAreBuilt
1831 if(particle == part) {
1833 if ( !baseParticle ) {
1836 if(!RetrieveTable(part,theDEDXTable,ascii,directory,
"DEDX",fpi))
1840 if(!RetrieveTable(part,theDEDXTable,ascii,directory,
"Ionisation",
false))
1843 if(!RetrieveTable(part,theRangeTableForLoss,ascii,directory,
"Range",fpi))
1846 if(!RetrieveTable(part,theDEDXunRestrictedTable,ascii,directory,
1850 if(!RetrieveTable(part,theCSDARangeTable,ascii,directory,
1854 if(!RetrieveTable(part,theInverseRangeTable,ascii,directory,
1855 "InverseRange",fpi))
1858 if(!RetrieveTable(part,theLambdaTable,ascii,directory,
"Lambda",
true))
1862 if(nSCoffRegions > 0) {yes =
true;}
1864 if(!RetrieveTable(part,theDEDXSubTable,ascii,directory,
"SubDEDX",yes))
1867 if(!RetrieveTable(part,theSubLambdaTable,ascii,directory,
1871 if(!fpi) yes =
false;
1872 if(!RetrieveTable(part,theIonisationSubTable,ascii,directory,
1873 "SubIonisation",yes))
1910 G4bool isRetrieved =
false;
1916 if(theParameters->
Spline()) {
1917 size_t n = aTable->
length();
1918 for(
size_t i=0; i<
n; ++i) {
1919 if((*aTable)[i]) { (*aTable)[i]->SetSpline(
true); }
1924 <<
" is Retrieved from <" << filename <<
">"
1930 if(mandatory && !isRetrieved) {
1934 << filename <<
"> is not Retrieved"
1949 DefineMaterial(couple);
1953 tmax =
std::min(tmax,(*theCuts)[currentCoupleIndex]);
1956 if(fm) { d = fm->
Dispersion(currentMaterial,dp,tmax,length); }
1966 DefineMaterial(couple);
1968 if(theLambdaTable) {
1969 cross = GetLambdaForScaledEnergy(kineticEnergy*massRatio);
1972 cross = biasFactor*(*theDensityFactor)[currentCoupleIndex]
1974 particle, kineticEnergy,
1975 (*theCuts)[currentCoupleIndex]));
1977 if(cross < 0.0) { cross = 0.0; }
1986 preStepLambda = GetLambdaForScaledEnergy(track.
GetKineticEnergy()*massRatio);
1988 if(0.0 < preStepLambda) { x = 1.0/preStepLambda; }
2042 if(add && nProcesses > 0) {
2043 for(
G4int i=0; i<nProcesses; ++i) {
2044 if(p == scProcesses[i]) {
2051 scProcesses.push_back(p);
2055 <<
" is added to the list of collaborative processes of "
2067 theDEDXunRestrictedTable =
p;
2077 for (
size_t i=0; i<
n; ++i) {
2081 dedx = pv->
Value(emax, idxDEDXunRestricted);
2083 pv = (*p)[(*theDensityIdx)[i]];
2086 pv->
Value(emax, idxDEDXunRestricted)*(*theDensityFactor)[i];
2089 theDEDXAtMaxEnergy[i] = dedx;
2107 theDEDXSubTable =
p;
2117 theIonisationTable =
p;
2119 theIonisationSubTable =
p;
2127 theCSDARangeTable =
p;
2134 for (
size_t i=0; i<
n; ++i) {
2137 if(pv) { rmax = pv->
Value(emax, idxCSDA); }
2139 pv = (*p)[(*theDensityIdx)[i]];
2140 if(pv) { rmax = pv->
Value(emax, idxCSDA)/(*theDensityFactor)[i]; }
2142 theRangeAtMaxEnergy[i] = rmax;
2153 theRangeTableForLoss =
p;
2155 G4cout <<
"### Set Range table " << p
2165 theSecondaryRangeTable =
p;
2167 G4cout <<
"### Set SecondaryRange table " << p
2177 theInverseRangeTable =
p;
2179 G4cout <<
"### Set InverseRange table " << p
2190 G4cout <<
"### Set Lambda table " << p
2196 tablesAreBuilt =
true;
2202 if(theLambdaTable) {
2203 size_t n = theLambdaTable->
length();
2210 for (i=0; i<
n; ++i) {
2211 pv = (*theLambdaTable)[i];
2217 for (
size_t j=0; j<nb; ++j) {
2226 theEnergyOfCrossSectionMax[i] =
emax;
2227 theCrossSectionMax[i] =
smax;
2230 <<
" Max CS at i= " << i <<
" emax(MeV)= " << emax/
MeV
2231 <<
" lambda= " << smax <<
G4endl;
2236 for (i=0; i<
n; ++i) {
2237 pv = (*theLambdaTable)[i];
2239 G4int j = (*theDensityIdx)[i];
2240 theEnergyOfCrossSectionMax[i] = theEnergyOfCrossSectionMax[j];
2241 theCrossSectionMax[i] = (*theDensityFactor)[i]*theCrossSectionMax[j];
2251 theSubLambdaTable =
p;
2253 G4cout <<
"### Set SebLambda table " << p
2277 G4cout <<
"### SetCrossSectionBiasingFactor: for "
2279 <<
" biasFactor= " << f <<
" weightFlag= " << flag
2294 G4cout <<
"### ActivateForcedInteraction: for "
2296 <<
" length(mm)= " << length/
mm
2297 <<
" in G4Region <" << region
2298 <<
"> weightFlag= " << flag
2312 if (0.0 <= factor) {
2321 G4cout <<
"### ActivateSecondaryBiasing: for "
2323 <<
" factor= " << factor
2324 <<
" in G4Region <" << region
2325 <<
"> energyLimit(MeV)= " << energyLimit/
MeV
2344 if(0.0 < val && val < 1.0) {
2346 actLinLossLimit =
true;
2347 }
else { PrintWarning(
"SetLinearLossLimit", val); }
2355 if(actStepFunc) {
return; }
2357 if(0.0 < v1 && 0.0 < v2 && v2 < 1.e+50) {
2360 }
else if(v1 <= 0.0) {
2361 PrintWarning(
"SetStepFunction", v1);
2363 PrintWarning(
"SetStepFunction", v2);
2371 if(1.e-18 < val && val < 1.e+50) { lowestKinEnergy = val; }
2372 else { PrintWarning(
"SetLowestEnergyLimit", val); }
2379 if(2 < n && n < 1000000000) {
2384 PrintWarning(
"SetDEDXBinning", e);
2392 if(1.e-18 < e && e < maxKinEnergy) {
2394 actMinKinEnergy =
true;
2395 }
else { PrintWarning(
"SetMinKinEnergy", e); }
2402 if(minKinEnergy < e && e < 1.e+50) {
2404 actMaxKinEnergy =
true;
2405 if(e < maxKinEnergyCSDA) { maxKinEnergyCSDA = e; }
2406 }
else { PrintWarning(
"SetMaxKinEnergy", e); }
2413 G4String ss =
"G4VEnergyLossProcess::" + tit;
2415 ed <<
"Parameter is out of range: " << val
2416 <<
" it will have no effect!\n" <<
" Process "
2418 <<
" Emin(keV)= " << minKinEnergy/
keV
2419 <<
" Emax(GeV)= " << maxKinEnergy/
GeV;
G4VEnergyLossProcess(const G4String &name="EnergyLoss", G4ProcessType type=fElectromagnetic)
G4double condition(const G4ErrorSymMatrix &m)
G4bool UseCutAsFinalRange() const
G4VSubCutProducer * SubCutProducer()
static constexpr double perMillion
G4double MaxSecondaryKinEnergy(const G4DynamicParticle *dynParticle)
G4int NumberOfBinsPerDecade() const
G4ParticleDefinition * GetDefinition() const
const G4VProcess * GetMasterProcess() const
void SetDEDXTable(G4PhysicsTable *p, G4EmTableType tType)
G4int GetParentID() 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 &)
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)
G4int WorkerVerbose() const
G4double MaxKinEnergy() const
static G4LossTableManager * Instance()
void ActivateForcedInteraction(G4double length=0.0, const G4String &r="")
virtual G4double SampleFluctuations(const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmax, G4double length, G4double meanLoss)=0
static constexpr double mm
virtual void SampleSecondaries(const G4Step &step, std::vector< G4Track * > &tracks, G4double &eloss, G4double cut) const =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)
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin=0.0, G4double tmax=DBL_MAX)=0
std::ostringstream G4ExceptionDescription
G4double GetKineticEnergy() const
void PrintInfoDefinition(const G4ParticleDefinition &part)
void SetIonisation(G4bool val)
virtual void BuildPhysicsTable(const G4ParticleDefinition &) override
G4VEmModel * GetModel(G4int idx, G4bool ver=false)
G4double GetStepLength() const
G4double HighEnergyLimit() const
const G4DynamicParticle * GetDynamicParticle() const
G4bool SecondaryBiasingRegion(G4int coupleIdx)
void SetParticleChange(G4VParticleChange *, G4VEmFluctuationModel *f=nullptr)
G4bool IsPIXEActive() const
G4PhysicsTable * SubLambdaTable() const
G4double LowestElectronEnergy() const
virtual G4double GetContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety) override
G4double GetProductionCut(G4int index) const
void DeRegister(G4VEnergyLossProcess *p)
G4PhysicsTable * RangeTableForLoss() const
G4StepStatus GetStepStatus() const
void UpdateEmModel(const G4String &model_name, G4double emin, G4double emax)
const G4String & GetName() const
G4PhysicsTable * SecondaryRangeTable() const
void AddCollaborativeProcess(G4VEnergyLossProcess *)
const G4ThreeVector & GetPosition() const
virtual void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *masterModel)
void SetLinearLossLimit(G4double val)
G4bool ForcedInteractionRegion(G4int coupleIdx)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
G4PhysicsTable * CSDARangeTable() const
G4ParticleChangeForLoss fParticleChange
virtual G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
G4double theNumberOfInteractionLengthLeft
void SelectModel(G4double kinEnergy)
G4bool GetFlag(size_t idx) const
void SetTouchableHandle(const G4TouchableHandle &apValue)
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *, const G4Region *)
G4VEmModel * GetModelByIndex(G4int idx=0, G4bool ver=false) const
G4int NumberOfModels() const
void ResetForcedInteraction()
G4PhysicsTable * IonisationTableForSubsec() const
G4double GetParentWeight() const
virtual G4VParticleChange * AlongStepDoIt(const G4Track &, const G4Step &) override
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void ActivateSecondaryBiasing(const G4String ®ion, G4double factor, G4double energyLimit)
void DefineRegParamForLoss(G4VEnergyLossProcess *, G4bool isElectron) const
G4VEmFluctuationModel * GetModelOfFluctuations()
const G4DataVector * SubCutoff() const
size_t GetVectorLength() const
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)
void FillSecondDerivatives()
G4PhysicsTable * BuildLambdaTable(G4EmTableType tType=fRestricted)
void SetStepFunction(G4double v1, G4double v2, G4bool lock=true)
const G4String & GetPhysicsTableFileName(const G4ParticleDefinition *, const G4String &directory, const G4String &tableName, G4bool ascii=false)
static G4PhysicsTable * PreparePhysicsTable(G4PhysicsTable *physTable)
G4double MinSubRange() const
const G4String & GetParticleName() const
G4LossTableBuilder * GetTableBuilder()
void SetWeight(G4double aValue)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
void SetCreatorModelIndex(G4int idx)
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
G4bool ExistPhysicsTable(const G4String &fileName) const
static const G4double reg
void Initialise(const G4ParticleDefinition &part, const G4String &procName, G4int verbose)
void SetHighEnergyLimit(G4double)
virtual G4double Dispersion(const G4Material *, const G4DynamicParticle *, G4double tmax, G4double length)=0
static constexpr double TeV
static G4RegionStore * GetInstance()
G4StepPoint * GetPreStepPoint() const
G4bool BuildCSDARange() const
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *fluc=0, const G4Region *region=nullptr)
G4PhysicsTable * LambdaTable() const
void ProposeWeight(G4double finalWeight)
void SetAngularGeneratorFlag(G4bool)
G4double LinearLossLimit() const
void SetSecondaryWeightByProcess(G4bool)
void SetInverseRangeTable(G4PhysicsTable *p)
G4double LambdaFactor() const
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)
G4GLOB_DLL std::ostream G4cout
void FillDEDXVector(G4PhysicsVector *, const G4MaterialCutsCouple *, G4EmTableType t=fRestricted)
G4PhysicsTable * DEDXTable() const
size_t GetTableSize() const
const G4ThreeVector & GetPosition() const
const G4Element * GetCurrentElement() const
G4double LowestMuHadEnergy() const
static constexpr double mm
static constexpr double cm
G4double GetStepLimit(G4int coupleIdx, G4double previousStep)
static constexpr double MeV
G4double currentInteractionLength
void SetProposedKineticEnergy(G4double proposedKinEnergy)
const G4ParticleDefinition * GetParticleDefinition() const
void ActivateForcedInteraction(G4double length, const G4String ®ion, G4bool flag=true)
virtual ~G4VEnergyLossProcess()
const G4String & GetParticleType() const
void SetMaxKinEnergy(G4double e)
void Register(G4VEnergyLossProcess *p)
G4double MinKinEnergy() const
virtual void ProcessDescription(std::ostream &outFile) const
G4double GetGlobalTime() const
G4PhysicsTable * DEDXTableForSubsec() const
G4double Energy(size_t index) const
G4double Value(G4double theEnergy, size_t &lastidx) const
const G4String & GetProcessName() const
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)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
const G4DataVector * Initialise(const G4ParticleDefinition *part, const G4ParticleDefinition *secPart, G4double minSubRange, G4int verb)
G4double ComputeSafety(const G4ThreeVector &pGlobalPoint, G4double maxRadius=DBL_MAX)
static G4TransportationManager * GetTransportationManager()
static const G4double emax
void SetMasterThread(G4bool val)
G4double G4Log(G4double x)
void ActivateSecondaryBiasing(const G4String ®ion, G4double factor, G4double energyLimit)
virtual G4double GetParticleCharge(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
static G4ProductionCutsTable * GetProductionCutsTable()
void SetLambdaTable(G4PhysicsTable *p)
static G4Positron * Positron()
G4int NumberOfModels() const
G4bool LossFluctuation() const
virtual void PrintInfo()=0
G4PhysicsTable * InverseRangeTable() const
void BuildPhysicsTable(const G4ParticleDefinition *aParticle)
G4double GetPDGMass() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
virtual void StartTracking(G4Track *) override
static G4ParticleTable * GetParticleTable()
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4ProcessManager * GetProcessManager() const
void InitialiseBaseMaterials(G4PhysicsTable *table)
void SetNumberOfSecondaries(G4int totSecondaries)
G4bool UseAngularGeneratorForIonisation() const
virtual G4bool RetrievePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii) override
static G4int Register(const G4String &)
G4double GetLocalEnergyDeposit() const
G4double MeanFreePath(const G4Track &track)
G4StepPoint * GetPostStepPoint() const
void UpdateEmModel(const G4String &, G4double, G4double)
static G4EmParameters * Instance()
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection) override
virtual void PreparePhysicsTable(const G4ParticleDefinition &) override
G4VParticleChange * pParticleChange
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)
static constexpr double GeV
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)
static G4Electron * Electron()
G4double GetGlobalTime() const
static constexpr double MeV
void SetSecondaryRangeTable(G4PhysicsTable *p)
G4bool StorePhysicsTable(const G4String &filename, G4bool ascii=false)
G4TrackStatus GetTrackStatus() const
G4VAtomDeexcitation * AtomDeexcitation()
G4PhysicsTable * DEDXunRestrictedTable() const
void ActivateSubCutoff(G4bool val, const G4Region *region=nullptr)
G4double theInitialNumberOfInteractionLength
G4bool GetFlag(size_t i) const
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &) override
void ProposeTrackStatus(G4TrackStatus status)
void SetLowestEnergyLimit(G4double)
void SetSubLambdaTable(G4PhysicsTable *p)
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition *, const G4Material *, G4double cut)
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4Track * GetTrack() const
G4double MaxEnergyForCSDARange() const
G4double GetPDGCharge() const
void SetRangeTableForLoss(G4PhysicsTable *p)
static G4bool RetrievePhysicsTable(G4PhysicsTable *physTable, const G4String &fileName, G4bool ascii)
G4ProductionCuts * GetProductionCuts() const
static constexpr double keV
virtual G4bool StorePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii=false) override
const XML_Char XML_Content * model
G4int GetProcessSubType() const
G4PhysicsTable * BuildDEDXTable(G4EmTableType tType=fRestricted)
G4VEmModel * EmModel(G4int index=1) const
void SetVerboseLevel(G4int value)
void SetDEDXBinning(G4int nbins)
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition *, const G4ParticleDefinition *)=0
const G4Material * GetMaterial() const
G4double CrossSectionPerVolume(G4double kineticEnergy, const G4MaterialCutsCouple *couple)
const std::vector< G4int > * GetCoupleIndexes()
const G4Element * GetCurrentElement() const
G4bool IsIonisationProcess() const
void SetMinKinEnergy(G4double e)