133 G4hRDEnergyLoss::taulow,
134 G4hRDEnergyLoss::tauhigh,
135 G4hRDEnergyLoss::ltaulow,
136 G4hRDEnergyLoss::ltauhigh;
163 MaxExcitationNumber (1.e6),
165 nmaxDirectFluct (100),
170 MinKineticEnergy(0.0)
174 if (!RecorderOfProcess) RecorderOfProcess =
new G4PhysicsTable*[100];
192 return NumberOfProcesses;
199 NumberOfProcesses=number;
256 if (!RecorderOfProcess) RecorderOfProcess =
new G4PhysicsTable*[100];
260 std::size_t numOfCouples = theCoupleTable->
GetTableSize();
269 if( ((
Charge>0.) && (theDEDXTable==0)) ||
270 ((
Charge<0.) && (theDEDXTable==0))
281 if(CounterOfProcess == NumberOfProcesses)
295 if(CounterOfProcess == NumberOfProcesses)
305 if(CounterOfProcess == NumberOfProcesses)
312 for (std::size_t J=0; J<numOfCouples; ++J)
326 for (
G4int process=0; process < NumberOfProcesses; process++)
328 pointer= RecorderOfProcess[process];
329 Value += (*pointer)[J]->
330 GetValue(LowEdgeEnergy,isOutRange) ;
336 theDEDXTable->
insert(aVector) ;
346 BuildRangeTable( aParticleType);
349 BuildTimeTables( aParticleType) ;
352 BuildRangeCoeffATable( aParticleType);
353 BuildRangeCoeffBTable( aParticleType);
354 BuildRangeCoeffCTable( aParticleType);
358 BuildInverseRangeTable(aParticleType);
411 for (
G4int J=0; J<numOfCouples; ++J)
417 BuildRangeVector(J, aVector);
418 theRangeTable->
insert(aVector);
460 for (
G4int J=0; J<numOfCouples; ++J)
468 BuildLabTimeVector(J, aVector);
469 theLabTimeTable->
insert(aVector);
474 BuildProperTimeVector(J, bVector);
475 theProperTimeTable->
insert(bVector);
481void G4hRDEnergyLoss::BuildRangeVector(
G4int materialIndex,
498 G4double de = (energy2 - energy1) * del ;
501 for (
G4int i=1; i<
n; i++) {
504 range += 0.5*de*(1.0/dedx1 + 1.0/dedx2);
515void G4hRDEnergyLoss::BuildLabTimeVector(
G4int materialIndex,
522 G4double tlim=5.*keV,parlowen=0.4,ppar=0.5-parlowen ;
524 G4double losslim,clim,taulim,timelim,
525 LowEdgeEnergy,tau,Value ;
530 losslim = physicsVector->
GetValue(tlim,isOut);
532 clim=std::sqrt(
ParticleMass*tlim/2.)/(c_light*losslim*ppar) ;
546 Value = clim*std::exp(ppar*std::log(tau/taulim)) ;
551 ltaulow = std::log(taulim);
552 ltauhigh = std::log(tau);
553 Value = timelim+LabTimeIntLog(physicsVector,nbin);
558 }
while (tau<=taulim) ;
565 ltaulow = std::log(tauold);
566 ltauhigh = std::log(tau);
567 Value = oldValue+LabTimeIntLog(physicsVector,nbin);
576void G4hRDEnergyLoss::BuildProperTimeVector(
G4int materialIndex,
583 G4double tlim=5.*keV,parlowen=0.4,ppar=0.5-parlowen ;
585 G4double losslim,clim,taulim,timelim,
586 LowEdgeEnergy,tau,Value ;
591 losslim = physicsVector->
GetValue(tlim,isOut);
593 clim=std::sqrt(
ParticleMass*tlim/2.)/(c_light*losslim*ppar) ;
607 Value = clim*std::exp(ppar*std::log(tau/taulim)) ;
612 ltaulow = std::log(taulim);
613 ltauhigh = std::log(tau);
614 Value = timelim+ProperTimeIntLog(physicsVector,nbin);
619 }
while (tau<=taulim) ;
626 ltaulow = std::log(tauold);
627 ltauhigh = std::log(tau);
628 Value = oldValue+ProperTimeIntLog(physicsVector,nbin);
642 G4double dtau,Value,taui,ti,lossi,ci;
644 dtau = (tauhigh-taulow)/nbin;
647 for (
G4int i=0; i<=nbin; i++)
649 taui = taulow + dtau*i ;
651 lossi = physicsVector->
GetValue(ti,isOut);
674 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
676 ltt = ltauhigh-ltaulow;
680 for (
G4int i=0; i<=nbin; i++)
682 ui = ltaulow+dltau*i;
685 lossi = physicsVector->
GetValue(ti,isOut);
695 Value += ci*taui/lossi;
708 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
710 ltt = ltauhigh-ltaulow;
714 for (
G4int i=0; i<=nbin; i++)
716 ui = ltaulow+dltau*i;
719 lossi = physicsVector->
GetValue(ti,isOut);
742 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
744 ltt = ltauhigh-ltaulow;
748 for (
G4int i=0; i<=nbin; i++)
750 ui = ltaulow+dltau*i;
753 lossi = physicsVector->
GetValue(ti,isOut);
780 if(thepRangeCoeffATable)
782 delete thepRangeCoeffATable; }
784 theRangeCoeffATable = thepRangeCoeffATable ;
789 if(thepbarRangeCoeffATable)
791 delete thepbarRangeCoeffATable; }
793 theRangeCoeffATable = thepbarRangeCoeffATable ;
801 G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
805 for (
G4int J=0; J<numOfCouples; J++)
816 Ri = rangeVector->
GetValue(Ti,isOut) ;
833 Rim = rangeVector->
GetValue(Tim,isOut);
840 Rip = rangeVector->
GetValue(Tip,isOut);
842 Value = (w1*Rip + w2*Ri + w3*Rim)/(Ti*Ti) ;
848 theRangeCoeffATable->
insert(aVector);
864 if(thepRangeCoeffBTable)
866 delete thepRangeCoeffBTable; }
868 theRangeCoeffBTable = thepRangeCoeffBTable ;
873 if(thepbarRangeCoeffBTable)
875 delete thepbarRangeCoeffBTable; }
877 theRangeCoeffBTable = thepbarRangeCoeffBTable ;
885 G4double w1 = -R1/w , w2 = R1*(R2+1.)/w , w3 = -R2*R1/w ;
886 G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
890 for (
G4int J=0; J<numOfCouples; J++)
901 Ri = rangeVector->
GetValue(Ti,isOut) ;
909 Rim = rangeVector->
GetValue(Tim,isOut);
916 Rip = rangeVector->
GetValue(Tip,isOut);
919 Value = (w1*Rip + w2*Ri + w3*Rim)/Ti;
924 theRangeCoeffBTable->
insert(aVector);
940 if(thepRangeCoeffCTable)
942 delete thepRangeCoeffCTable; }
944 theRangeCoeffCTable = thepRangeCoeffCTable ;
949 if(thepbarRangeCoeffCTable)
951 delete thepbarRangeCoeffCTable; }
953 theRangeCoeffCTable = thepbarRangeCoeffCTable ;
961 G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
965 for (
G4int J=0; J<numOfCouples; J++)
975 Ri = rangeVector->
GetValue(Ti,isOut) ;
981 Rim = rangeVector->
GetValue(Tim,isOut);
988 Rip = rangeVector->
GetValue(Tip,isOut);
990 Value = w1*Rip + w2*Ri + w3*Rim ;
995 theRangeCoeffCTable->
insert(aVector);
1001void G4hRDEnergyLoss::
1010 std::size_t numOfCouples = theCoupleTable->
GetTableSize();
1021 theRangeCoeffATable = thepRangeCoeffATable ;
1022 theRangeCoeffBTable = thepRangeCoeffBTable ;
1023 theRangeCoeffCTable = thepRangeCoeffCTable ;
1035 theRangeCoeffATable = thepbarRangeCoeffATable ;
1036 theRangeCoeffBTable = thepbarRangeCoeffBTable ;
1037 theRangeCoeffCTable = thepbarRangeCoeffCTable ;
1041 for (std::size_t i=0; i<numOfCouples; ++i)
1051 if (rlow <
DBL_MIN) rlow = 1.e-8;
1052 if (rhigh > 1.e16) rhigh = 1.e16;
1053 if (rhigh < 1.e-8) rhigh =1.e-8;
1060 if (tmpTrick <= 0. || tmpTrick <
DBL_MIN) tmpTrick = 1.e-8;
1061 if (tmpTrick > 1.e16) tmpTrick = 1.e16;
1063 rhigh *= std::exp(std::log(tmpTrick)/((
G4double)(nbins-1)));
1072 std::size_t ilow = 0;
1075 for (std::size_t j=1; j<nbins; ++j) {
1079 for (ihigh=ilow+1; ihigh<nbins; ihigh++) {
1082 if(range2 >= range || ihigh == nbins-1) {
1090 G4double e = std::log(energy1) + std::log(energy2/energy1)*std::log(range/range1)/std::log(range2/range1);
1094 theInverseRangeTable->
insert(v);
1101void G4hRDEnergyLoss::InvertRangeVector(
G4int materialIndex,
1109 G4int binnumber = -1 ;
1118 if( rangebin < LowEdgeRange )
1124 rangebin = (*theRangeTable)(materialIndex)->GetValue(Tbin,isOut) ;
1126 while ((rangebin < LowEdgeRange) && (binnumber <
TotBin )) ;
1131 else if(binnumber ==
TotBin-1)
1135 A = (*(*theRangeCoeffATable)(materialIndex))(binnumber-1) ;
1136 B = (*(*theRangeCoeffBTable)(materialIndex))(binnumber-1) ;
1137 C = (*(*theRangeCoeffCTable)(materialIndex))(binnumber-1) ;
1142 discr =
B*
B - 4.*
A*(
C-LowEdgeRange);
1143 discr = discr>0. ? std::sqrt(discr) : 0.;
1148 aVector->
PutValue(i,KineticEnergy) ;
1156 G4bool wasModified =
false;
1161 for (
G4int j=0; j<numOfCouples; ++j){
G4double C(G4double temp)
G4double B(G4double temperature)
static G4AntiProton * AntiProton()
static void Register(const G4ParticleDefinition *p, const G4PhysicsTable *tDEDX, const G4PhysicsTable *tRange, const G4PhysicsTable *tInverseRange, const G4PhysicsTable *tLabTime, const G4PhysicsTable *tProperTime, G4double lowestKineticEnergy, G4double highestKineticEnergy, G4double massRatio, G4int NumberOfBins)
G4bool IsRecalcNeeded() const
G4double GetPDGMass() const
G4double GetPDGCharge() const
void insert(G4PhysicsVector *)
G4double GetLowEdgeEnergy(const std::size_t index) const
void PutValue(const std::size_t index, const G4double value)
G4double GetValue(const G4double energy, G4bool &isOutRange) const
std::size_t GetVectorLength() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()
static G4Proton * Proton()
static G4ThreadLocal G4PhysicsTable * theDEDXpTable
static G4ThreadLocal G4PhysicsTable * theInverseRangepTable
static void SetStepFunction(G4double c1, G4double c2)
static G4ThreadLocal G4double Charge
static G4ThreadLocal G4double finalRange
static G4ThreadLocal G4double c3lim
static G4ThreadLocal G4PhysicsTable * theDEDXpbarTable
static G4ThreadLocal G4PhysicsTable ** RecorderOfpProcess
static G4ThreadLocal G4double dRoverRange
static G4ThreadLocal G4int TotBin
static G4ThreadLocal G4PhysicsTable * theProperTimepTable
static G4ThreadLocal G4double c1lim
G4PhysicsTable * theLossTable
static G4ThreadLocal G4PhysicsTable * theLabTimepTable
G4hRDEnergyLoss(const G4String &)
static G4ThreadLocal G4double c2lim
static G4ThreadLocal G4PhysicsTable * theRangepTable
static G4ThreadLocal G4PhysicsTable * theLabTimepbarTable
static void SetdRoverRange(G4double value)
static G4ThreadLocal G4PhysicsTable * theInverseRangepbarTable
static void PlusNumberOfProcesses()
static G4ThreadLocal G4int CounterOfpProcess
static G4ThreadLocal G4double ParticleMass
static G4ThreadLocal G4double HighestKineticEnergy
static void SetRndmStep(G4bool value)
static G4ThreadLocal G4double LOGRTable
static G4ThreadLocal G4int CounterOfpbarProcess
static G4ThreadLocal G4PhysicsTable * theProperTimepbarTable
static G4ThreadLocal G4double pbartableElectronCutInRange
static G4ThreadLocal G4PhysicsTable ** RecorderOfpbarProcess
static G4ThreadLocal G4double LowestKineticEnergy
static G4ThreadLocal G4double ptableElectronCutInRange
static G4ThreadLocal G4PhysicsTable * theRangepbarTable
static G4ThreadLocal G4bool rndmStepFlag
static void MinusNumberOfProcesses()
static G4ThreadLocal G4bool EnlossFlucFlag
G4bool CutsWhereModified()
static void SetNumberOfProcesses(G4int number)
static void SetEnlossFluc(G4bool value)
static G4int GetNumberOfProcesses()
static G4ThreadLocal G4double RTable
static void BuildDEDXTable(const G4ParticleDefinition &aParticleType)
G4double energy(const ThreeVector &p, const G4double m)