134 G4hRDEnergyLoss::taulow,
135 G4hRDEnergyLoss::tauhigh,
136 G4hRDEnergyLoss::ltaulow,
137 G4hRDEnergyLoss::ltauhigh;
164 MaxExcitationNumber (1.e6),
166 nmaxDirectFluct (100),
171 MinKineticEnergy(0.0)
175 if (!RecorderOfProcess) RecorderOfProcess =
new G4PhysicsTable*[100];
193 return NumberOfProcesses;
200 NumberOfProcesses=number;
257 if (!RecorderOfProcess) RecorderOfProcess =
new G4PhysicsTable*[100];
270 if( ((
Charge>0.) && (theDEDXTable==0)) ||
271 ((
Charge<0.) && (theDEDXTable==0))
282 if(CounterOfProcess == NumberOfProcesses)
296 if(CounterOfProcess == NumberOfProcesses)
306 if(CounterOfProcess == NumberOfProcesses)
313 for (
size_t J=0; J<numOfCouples; J++)
327 for (
G4int process=0; process < NumberOfProcesses; process++)
329 pointer= RecorderOfProcess[process];
330 Value += (*pointer)[J]->
331 GetValue(LowEdgeEnergy,isOutRange) ;
337 theDEDXTable->
insert(aVector) ;
347 BuildRangeTable( aParticleType);
350 BuildTimeTables( aParticleType) ;
353 BuildRangeCoeffATable( aParticleType);
354 BuildRangeCoeffBTable( aParticleType);
355 BuildRangeCoeffCTable( aParticleType);
359 BuildInverseRangeTable(aParticleType);
412 for (
size_t J=0; J<numOfCouples; J++)
418 BuildRangeVector(J, aVector);
419 theRangeTable->
insert(aVector);
461 for (
size_t J=0; J<numOfCouples; J++)
469 BuildLabTimeVector(J, aVector);
470 theLabTimeTable->
insert(aVector);
475 BuildProperTimeVector(J, bVector);
476 theProperTimeTable->
insert(bVector);
482 void G4hRDEnergyLoss::BuildRangeVector(
G4int materialIndex,
499 G4double de = (energy2 - energy1) * del ;
502 for (
G4int i=1; i<
n; i++) {
505 range += 0.5*de*(1.0/dedx1 + 1.0/dedx2);
516 void G4hRDEnergyLoss::BuildLabTimeVector(
G4int materialIndex,
523 G4double tlim=5.*
keV,parlowen=0.4,ppar=0.5-parlowen ;
525 G4double losslim,clim,taulim,timelim,
526 LowEdgeEnergy,tau,Value ;
531 losslim = physicsVector->
GetValue(tlim,isOut);
547 Value = clim*std::exp(ppar*std::log(tau/taulim)) ;
552 ltaulow = std::log(taulim);
553 ltauhigh = std::log(tau);
554 Value = timelim+LabTimeIntLog(physicsVector,nbin);
559 }
while (tau<=taulim) ;
566 ltaulow = std::log(tauold);
567 ltauhigh = std::log(tau);
568 Value = oldValue+LabTimeIntLog(physicsVector,nbin);
577 void G4hRDEnergyLoss::BuildProperTimeVector(
G4int materialIndex,
584 G4double tlim=5.*
keV,parlowen=0.4,ppar=0.5-parlowen ;
586 G4double losslim,clim,taulim,timelim,
587 LowEdgeEnergy,tau,Value ;
592 losslim = physicsVector->
GetValue(tlim,isOut);
608 Value = clim*std::exp(ppar*std::log(tau/taulim)) ;
613 ltaulow = std::log(taulim);
614 ltauhigh = std::log(tau);
615 Value = timelim+ProperTimeIntLog(physicsVector,nbin);
620 }
while (tau<=taulim) ;
627 ltaulow = std::log(tauold);
628 ltauhigh = std::log(tau);
629 Value = oldValue+ProperTimeIntLog(physicsVector,nbin);
643 G4double dtau,Value,taui,ti,lossi,ci;
645 dtau = (tauhigh-taulow)/nbin;
648 for (
G4int i=0; i<=nbin; i++)
650 taui = taulow + dtau*i ;
652 lossi = physicsVector->
GetValue(ti,isOut);
675 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
677 ltt = ltauhigh-ltaulow;
681 for (
G4int i=0; i<=nbin; i++)
683 ui = ltaulow+dltau*i;
686 lossi = physicsVector->
GetValue(ti,isOut);
696 Value += ci*taui/lossi;
709 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
711 ltt = ltauhigh-ltaulow;
715 for (
G4int i=0; i<=nbin; i++)
717 ui = ltaulow+dltau*i;
720 lossi = physicsVector->
GetValue(ti,isOut);
743 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
745 ltt = ltauhigh-ltaulow;
749 for (
G4int i=0; i<=nbin; i++)
751 ui = ltaulow+dltau*i;
754 lossi = physicsVector->
GetValue(ti,isOut);
781 if(thepRangeCoeffATable)
783 delete thepRangeCoeffATable; }
785 theRangeCoeffATable = thepRangeCoeffATable ;
790 if(thepbarRangeCoeffATable)
792 delete thepbarRangeCoeffATable; }
794 theRangeCoeffATable = thepbarRangeCoeffATable ;
802 G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
806 for (
G4int J=0; J<numOfCouples; J++)
817 Ri = rangeVector->
GetValue(Ti,isOut) ;
834 Rim = rangeVector->
GetValue(Tim,isOut);
841 Rip = rangeVector->
GetValue(Tip,isOut);
843 Value = (w1*Rip + w2*Ri + w3*Rim)/(Ti*Ti) ;
849 theRangeCoeffATable->
insert(aVector);
865 if(thepRangeCoeffBTable)
867 delete thepRangeCoeffBTable; }
869 theRangeCoeffBTable = thepRangeCoeffBTable ;
874 if(thepbarRangeCoeffBTable)
876 delete thepbarRangeCoeffBTable; }
878 theRangeCoeffBTable = thepbarRangeCoeffBTable ;
884 G4double w = R1*(RTable-1.)*(RTable-1.);
886 G4double w1 = -R1/w , w2 = R1*(R2+1.)/w , w3 = -R2*R1/w ;
887 G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
891 for (
G4int J=0; J<numOfCouples; J++)
902 Ri = rangeVector->
GetValue(Ti,isOut) ;
910 Rim = rangeVector->
GetValue(Tim,isOut);
917 Rip = rangeVector->
GetValue(Tip,isOut);
920 Value = (w1*Rip + w2*Ri + w3*Rim)/Ti;
925 theRangeCoeffBTable->
insert(aVector);
941 if(thepRangeCoeffCTable)
943 delete thepRangeCoeffCTable; }
945 theRangeCoeffCTable = thepRangeCoeffCTable ;
950 if(thepbarRangeCoeffCTable)
952 delete thepbarRangeCoeffCTable; }
954 theRangeCoeffCTable = thepbarRangeCoeffCTable ;
960 G4double w = R1*(RTable-1.)*(RTable-1.);
961 G4double w1 = 1./w , w2 = -RTable*R1/w , w3 = RTable*R2/w ;
962 G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
966 for (
G4int J=0; J<numOfCouples; J++)
976 Ri = rangeVector->
GetValue(Ti,isOut) ;
982 Rim = rangeVector->
GetValue(Tim,isOut);
989 Rip = rangeVector->
GetValue(Tip,isOut);
991 Value = w1*Rip + w2*Ri + w3*Rim ;
996 theRangeCoeffCTable->
insert(aVector);
1002 void G4hRDEnergyLoss::
1022 theRangeCoeffATable = thepRangeCoeffATable ;
1023 theRangeCoeffBTable = thepRangeCoeffBTable ;
1024 theRangeCoeffCTable = thepRangeCoeffCTable ;
1036 theRangeCoeffATable = thepbarRangeCoeffATable ;
1037 theRangeCoeffBTable = thepbarRangeCoeffBTable ;
1038 theRangeCoeffCTable = thepbarRangeCoeffCTable ;
1042 for (
size_t i=0; i<numOfCouples; i++)
1052 if (rlow <
DBL_MIN) rlow = 1.e-8;
1053 if (rhigh > 1.e16) rhigh = 1.e16;
1054 if (rhigh < 1.e-8) rhigh =1.e-8;
1061 if (tmpTrick <= 0. || tmpTrick <
DBL_MIN) tmpTrick = 1.e-8;
1062 if (tmpTrick > 1.e16) tmpTrick = 1.e16;
1064 rhigh *= std::exp(std::log(tmpTrick)/((
G4double)(nbins-1)));
1076 for (
size_t j=1; j<nbins; j++) {
1080 for (ihigh=ilow+1; ihigh<nbins; ihigh++) {
1083 if(range2 >= range || ihigh == nbins-1) {
1091 G4double e = std::log(energy1) + std::log(energy2/energy1)*std::log(range/range1)/std::log(range2/range1);
1095 theInverseRangeTable->
insert(v);
1102 void G4hRDEnergyLoss::InvertRangeVector(
G4int materialIndex,
1110 G4int binnumber = -1 ;
1119 if( rangebin < LowEdgeRange )
1125 rangebin = (*theRangeTable)(materialIndex)->GetValue(Tbin,isOut) ;
1127 while ((rangebin < LowEdgeRange) && (binnumber < TotBin )) ;
1132 else if(binnumber == TotBin-1)
1136 A = (*(*theRangeCoeffATable)(materialIndex))(binnumber-1) ;
1137 B = (*(*theRangeCoeffBTable)(materialIndex))(binnumber-1) ;
1138 C = (*(*theRangeCoeffCTable)(materialIndex))(binnumber-1) ;
1140 KineticEnergy = (LowEdgeRange -
C )/B ;
1143 discr = B*B - 4.*A*(C-LowEdgeRange);
1144 discr = discr>0. ? std::sqrt(discr) : 0.;
1145 KineticEnergy = 0.5*(discr-
B)/A ;
1149 aVector->
PutValue(i,KineticEnergy) ;
1157 G4bool wasModified =
false;
1162 for (
size_t j=0; j<numOfCouples; j++){
static G4ThreadLocal G4double RTable
static G4ThreadLocal G4PhysicsTable * theProperTimepTable
static G4ThreadLocal G4double LowestKineticEnergy
static G4ThreadLocal G4PhysicsTable * theRangepbarTable
static G4ThreadLocal G4PhysicsTable * theLabTimepTable
static G4ThreadLocal G4PhysicsTable * theDEDXpbarTable
G4double GetValue(G4double theEnergy, G4bool &isOutRange) const
static void MinusNumberOfProcesses()
static G4int GetNumberOfProcesses()
void insert(G4PhysicsVector *)
static constexpr double proton_mass_c2
static G4ThreadLocal G4bool rndmStepFlag
static G4ThreadLocal G4double c3lim
static G4ThreadLocal G4double LOGRTable
static G4ThreadLocal G4double ParticleMass
static G4ThreadLocal G4double Charge
G4bool IsRecalcNeeded() const
static G4ThreadLocal G4double c1lim
static G4ThreadLocal G4PhysicsTable ** RecorderOfpbarProcess
static G4ThreadLocal G4PhysicsTable * theProperTimepbarTable
double B(double temperature)
size_t GetVectorLength() const
static G4ThreadLocal G4double finalRange
G4double GetLowEdgeEnergy(size_t binNumber) const
static G4ThreadLocal G4PhysicsTable * theInverseRangepbarTable
static G4ThreadLocal G4int TotBin
static G4ThreadLocal G4PhysicsTable ** RecorderOfpProcess
double A(double temperature)
const XML_Char int const XML_Char * value
size_t GetTableSize() const
static G4ThreadLocal G4PhysicsTable * theRangepTable
static G4AntiProton * AntiProton()
static constexpr double eplus
void PutValue(size_t index, G4double theValue)
static G4Proton * Proton()
static G4ThreadLocal G4double dRoverRange
static G4ThreadLocal G4int CounterOfpProcess
static void BuildDEDXTable(const G4ParticleDefinition &aParticleType)
static G4ThreadLocal G4double HighestKineticEnergy
static G4ProductionCutsTable * GetProductionCutsTable()
static G4ThreadLocal G4int CounterOfpbarProcess
G4double GetPDGMass() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
static void SetNumberOfProcesses(G4int number)
static void PlusNumberOfProcesses()
static G4ThreadLocal G4double pbartableElectronCutInRange
G4double energy(const ThreeVector &p, const G4double m)
G4bool CutsWhereModified()
static G4ThreadLocal G4bool EnlossFlucFlag
G4hRDEnergyLoss(const G4String &)
static G4ThreadLocal G4double c2lim
static constexpr double c_light
static void SetRndmStep(G4bool value)
static void SetdRoverRange(G4double value)
G4PhysicsTable * theLossTable
static G4ThreadLocal G4PhysicsTable * theLabTimepbarTable
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)
G4double GetPDGCharge() const
static G4ThreadLocal G4PhysicsTable * theInverseRangepTable
static constexpr double keV
static void SetEnlossFluc(G4bool value)
static void SetStepFunction(G4double c1, G4double c2)
static G4ThreadLocal G4double ptableElectronCutInRange
static G4ThreadLocal G4PhysicsTable * theDEDXpTable