79 G4Exception(
"G4RDVeLowEnergyLoss::G4RDVeLowEnergyLoss()",
"InvalidCall",
140 delete theRangeTable; }
145 for (
G4int J=0; J<numOfCouples; J++)
149 highestKineticEnergy,TotBin);
152 theRangeTable->
insert(aVector);
154 return theRangeTable ;
170 G4double energy1 = lowestKineticEnergy;
177 for (
G4int j=1; j<TotBin; j++) {
180 G4double de = (energy2 - energy1) * del ;
183 for (
G4int i=1; i<
n; i++) {
186 range += 0.5*de*(1.0/dedx1 + 1.0/dedx2);
201 G4double dtau,Value,taui,ti,lossi,ci;
206 for (
G4int i=0; i<=nbin; i++)
210 lossi = physicsVector->
GetValue(ti,isOut);
232 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
238 for (
G4int i=0; i<=nbin; i++)
240 ui = ltaulow+dltau*i;
243 lossi = physicsVector->
GetValue(ti,isOut);
253 Value += ci*taui/lossi;
273 delete theLabTimeTable; }
277 for (
G4int J=0; J<numOfCouples; J++)
282 highestKineticEnergy,TotBin);
285 lowestKineticEnergy,highestKineticEnergy,TotBin,J,aVector);
286 theLabTimeTable->
insert(aVector);
290 return theLabTimeTable ;
304 if(theProperTimeTable)
306 delete theProperTimeTable; }
310 for (
G4int J=0; J<numOfCouples; J++)
315 highestKineticEnergy,TotBin);
318 lowestKineticEnergy,highestKineticEnergy,TotBin,J,aVector);
319 theProperTimeTable->
insert(aVector);
323 return theProperTimeTable ;
338 G4double tlim=5.*
keV,parlowen=0.4,ppar=0.5-parlowen ;
339 G4double losslim,clim,taulim,timelim,
340 LowEdgeEnergy,tau,Value ;
345 losslim = physicsVector->
GetValue(tlim,isOut);
359 Value = clim*std::exp(ppar*std::log(tau/taulim)) ;
371 }
while (tau<=taulim) ;
373 for (
G4int j=i; j<TotBin; j++)
397 G4double tlim=5.*
keV,parlowen=0.4,ppar=0.5-parlowen ;
398 G4double losslim,clim,taulim,timelim,
399 LowEdgeEnergy,tau,Value ;
405 losslim = physicsVector->
GetValue(tlim,isOut);
419 Value = clim*std::exp(ppar*std::log(tau/taulim)) ;
431 }
while (tau<=taulim) ;
433 for (
G4int j=i; j<TotBin; j++)
452 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
458 for (
G4int i=0; i<=nbin; i++)
460 ui = ltaulow+dltau*i;
463 lossi = physicsVector->
GetValue(ti,isOut);
485 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
491 for (
G4int i=0; i<=nbin; i++)
493 ui = ltaulow+dltau*i;
496 lossi = physicsVector->
GetValue(ti,isOut);
528 if(theInverseRangeTable)
530 delete theInverseRangeTable; }
534 for (
G4int i=0; i<numOfCouples; i++)
544 rhigh *= std::exp(std::log(rhigh/rlow)/((
G4double)(nbins-1)));
556 for (
size_t j=1; j<nbins; j++) {
560 for (ihigh=ilow+1; ihigh<nbins; ihigh++) {
563 if(range2 >= range || ihigh == nbins-1) {
571 G4double e = std::log(energy1) + std::log(energy2/energy1)*std::log(range/range1)/std::log(range2/range1);
575 theInverseRangeTable->
insert(v);
578 return theInverseRangeTable ;
593 G4double RTable = std::exp(std::log(highestKineticEnergy/lowestKineticEnergy)/TotBin) ;
594 G4double Tbin = lowestKineticEnergy/RTable ;
596 G4int binnumber = -1 ;
600 for(
G4int i=0; i<TotBin; i++)
603 if( rangebin < LowEdgeRange )
609 rangebin = (*theRangeTable)(materialIndex)->GetValue(Tbin,isOut) ;
611 while ((rangebin < LowEdgeRange) && (binnumber < TotBin )) ;
615 KineticEnergy = lowestKineticEnergy ;
616 else if(binnumber == TotBin-1)
617 KineticEnergy = highestKineticEnergy ;
620 A = (*(*theRangeCoeffATable)(materialIndex))(binnumber-1) ;
621 B = (*(*theRangeCoeffBTable)(materialIndex))(binnumber-1) ;
622 C = (*(*theRangeCoeffCTable)(materialIndex))(binnumber-1) ;
624 KineticEnergy = (LowEdgeRange -
C )/B ;
627 discr = B*B - 4.*A*(C-LowEdgeRange);
628 discr = discr>0. ? std::sqrt(discr) : 0.;
629 KineticEnergy = 0.5*(discr-
B)/A ;
633 aVector->
PutValue(i,KineticEnergy) ;
649 if(theRangeCoeffATable)
651 delete theRangeCoeffATable; }
654 G4double RTable = std::exp(std::log(highestKineticEnergy/lowestKineticEnergy)/TotBin) ;
658 G4double w1 = RTable/
w , w2 = -RTable*R1/
w , w3 = R2/
w ;
659 G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
663 for (
G4int J=0; J<numOfCouples; J++)
665 G4int binmax=TotBin ;
668 Ti = lowestKineticEnergy ;
671 for (
G4int i=0; i<TotBin; i++)
673 Ri = rangeVector->
GetValue(Ti,isOut) ;
679 Rim = rangeVector->
GetValue(Tim,isOut);
686 Rip = rangeVector->
GetValue(Tip,isOut);
688 Value = (w1*Rip + w2*Ri + w3*Rim)/(Ti*Ti) ;
694 theRangeCoeffATable->
insert(aVector);
696 return theRangeCoeffATable ;
711 if(theRangeCoeffBTable)
713 delete theRangeCoeffBTable; }
716 G4double RTable = std::exp(std::log(highestKineticEnergy/lowestKineticEnergy)/TotBin) ;
720 G4double w1 = -R1/
w , w2 = R1*(R2+1.)/
w , w3 = -R2*R1/
w ;
721 G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
725 for (
G4int J=0; J<numOfCouples; J++)
727 G4int binmax=TotBin ;
730 Ti = lowestKineticEnergy ;
733 for (
G4int i=0; i<TotBin; i++)
735 Ri = rangeVector->
GetValue(Ti,isOut) ;
741 Rim = rangeVector->
GetValue(Tim,isOut);
748 Rip = rangeVector->
GetValue(Tip,isOut);
750 Value = (w1*Rip + w2*Ri + w3*Rim)/Ti;
755 theRangeCoeffBTable->
insert(aVector);
757 return theRangeCoeffBTable ;
772 if(theRangeCoeffCTable)
774 delete theRangeCoeffCTable; }
777 G4double RTable = std::exp(std::log(highestKineticEnergy/lowestKineticEnergy)/TotBin) ;
781 G4double w1 = 1./
w , w2 = -RTable*R1/
w , w3 = RTable*R2/
w ;
782 G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
786 for (
G4int J=0; J<numOfCouples; J++)
788 G4int binmax=TotBin ;
791 Ti = lowestKineticEnergy ;
794 for (
G4int i=0; i<TotBin; i++)
796 Ri = rangeVector->
GetValue(Ti,isOut) ;
802 Rim = rangeVector->
GetValue(Tim,isOut);
809 Rip = rangeVector->
GetValue(Tip,isOut);
811 Value = w1*Rip + w2*Ri + w3*Rim ;
816 theRangeCoeffCTable->
insert(aVector);
818 return theRangeCoeffCTable ;
831 static const G4double probLim = 0.01 ;
832 static const G4double sumaLim = -std::log(probLim) ;
855 beta2,suma,e0,loss,lossc,
w;
859 G4double Corrfac, na,alfa,rfac,namean,sa,alfa1,ea,sea;
865 if(MeanLoss < minLoss)
return MeanLoss ;
873 ->GetEnergyCutsVector(1)))[
imat];
880 if(Tm > threshold) Tm = threshold;
881 beta2 = tau2/(tau1*tau1);
884 if(MeanLoss >= kappa*Tm || MeanLoss <= kappa*
ipotFluct)
887 siga = std::sqrt(Tm*(1.0-0.5*beta2)*step*
888 factor*electronDensity/beta2) ;
891 }
while (loss < 0. || loss > 2.0*MeanLoss);
932 Tm = Tm-ipotFluct+e0 ;
943 a3 = MeanLoss*(Tm-e0)/(Tm*e0*std::log(Tm/e0));
1011 siga=std::sqrt(a3) ;
1032 alfa1 = alfa*std::log(alfa)/(alfa-1.);
1033 ea = na*ipotFluct*alfa1;
1034 sea = ipotFluct*std::sqrt(na*(alfa-alfa1*alfa1));
static constexpr double micrometer
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double GetLogEnergy1fluct() const
static G4bool EnlossFlucFlag
static G4double LabTimeIntLog(G4PhysicsVector *physicsVector, G4int nbin)
static void SetStepFunction(G4double c1, G4double c2)
G4double GetEnergy1fluct() const
G4double GetLowEdgeEnergy(size_t binNumber) const
static G4bool rndmStepFlag
G4double GetF1fluct() const
static constexpr double keV
static constexpr double twopi_mc2_rcl2
G4double GetLogMeanExcEnergy() const
static constexpr double perCent
static G4double ParticleMass
const G4Material * lastMaterial
static G4PhysicsTable * BuildRangeCoeffATable(G4PhysicsTable *theRangeTable, G4PhysicsTable *theCoeffATable, G4double Tmin, G4double Tmax, G4int nbin)
virtual ~G4RDVeLowEnergyLoss()
static void BuildLabTimeVector(G4PhysicsTable *theDEDXTable, G4double Tmin, G4double Tmax, G4int nbin, G4int materialIndex, G4PhysicsLogVector *rangeVector)
static G4double RangeIntLog(G4PhysicsVector *physicsVector, G4int nbin)
static void InvertRangeVector(G4PhysicsTable *theRangeTable, G4PhysicsTable *theRangeCoeffATable, G4PhysicsTable *theRangeCoeffBTable, G4PhysicsTable *theRangeCoeffCTable, G4double Tmin, G4double Tmax, G4int nbin, G4int materialIndex, G4PhysicsLogVector *rangeVector)
G4double GetValue(G4double theEnergy, G4bool &isOutRange) const
G4double GetEnergy0fluct() const
static void SetEnlossFluc(G4bool value)
static G4PhysicsTable * BuildLabTimeTable(G4PhysicsTable *theDEDXTable, G4PhysicsTable *theLabTimeTable, G4double Tmin, G4double Tmax, G4int nbin)
static G4PhysicsTable * BuildProperTimeTable(G4PhysicsTable *theDEDXTable, G4PhysicsTable *ProperTimeTable, G4double Tmin, G4double Tmax, G4int nbin)
const XML_Char int const XML_Char * value
const G4ParticleDefinition const G4Material *G4double range
static G4PhysicsTable * BuildRangeCoeffBTable(G4PhysicsTable *theRangeTable, G4PhysicsTable *theCoeffBTable, G4double Tmin, G4double Tmax, G4int nbin)
static constexpr double electron_mass_c2
G4double GetEnergy2fluct() const
double A(double temperature)
static constexpr double eV
G4double GetMeanExcitationEnergy() const
static G4PhysicsTable * BuildRangeCoeffCTable(G4PhysicsTable *theRangeTable, G4PhysicsTable *theCoeffCTable, G4double Tmin, G4double Tmax, G4int nbin)
size_t GetTableSize() const
ThreeVector shoot(const G4int Ap, const G4int Af)
static G4double ProperTimeIntLog(G4PhysicsVector *physicsVector, G4int nbin)
G4double GetLossWithFluct(const G4DynamicParticle *aParticle, const G4MaterialCutsCouple *couple, G4double MeanLoss, G4double step)
static G4ProductionCutsTable * GetProductionCutsTable()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
static void BuildRangeVector(G4PhysicsTable *theDEDXTable, G4double Tmin, G4double Tmax, G4int nbin, G4int materialIndex, G4PhysicsLogVector *rangeVector)
static constexpr double c_light
static G4double finalRange
void insert(G4PhysicsVector *)
G4IonisParamMat * GetIonisation() const
G4double GetLogEnergy2fluct() const
G4double GetKineticEnergy() const
static G4double RangeIntLin(G4PhysicsVector *physicsVector, G4int nbin)
G4long G4Poisson(G4double mean)
static G4PhysicsTable * BuildInverseRangeTable(G4PhysicsTable *theRangeTable, G4PhysicsTable *theRangeCoeffATable, G4PhysicsTable *theRangeCoeffBTable, G4PhysicsTable *theRangeCoeffCTable, G4PhysicsTable *theInverseRangeTable, G4double Tmin, G4double Tmax, G4int nbin)
static G4PhysicsTable * BuildRangeTable(G4PhysicsTable *theDEDXTable, G4PhysicsTable *theRangeTable, G4double Tmin, G4double Tmax, G4int nbin)
const G4Material * GetMaterial() const
G4double GetF2fluct() const
G4double GetRateionexcfluct() const
static G4double dRoverRange
double B(double temperature)
G4double GetElectronDensity() const
static void BuildProperTimeVector(G4PhysicsTable *theDEDXTable, G4double Tmin, G4double Tmax, G4int nbin, G4int materialIndex, G4PhysicsLogVector *rangeVector)
void PutValue(size_t index, G4double theValue)
static void SetRndmStep(G4bool value)
size_t GetVectorLength() const