76 f1Fluct(0),f2Fluct(0),e1Fluct(0),e2Fluct(0),rateFluct(0),
77 ipotFluct(0),e1LogFluct(-1),e2LogFluct(-1),ipotLogFluct(-1),
81 G4Exception(
"G4VeLowEnergyLoss::G4VeLowEnergyLoss()",
91 f1Fluct(0),f2Fluct(0),e1Fluct(0),e2Fluct(0),rateFluct(0),
92 ipotFluct(0),e1LogFluct(-1),e2LogFluct(-1),ipotLogFluct(-1),
109 f1Fluct(0),f2Fluct(0),e1Fluct(0),e2Fluct(0),rateFluct(0),
110 ipotFluct(0),e1LogFluct(-1),e2LogFluct(-1),ipotLogFluct(-1),
146 delete theRangeTable; }
151 for (
G4int J=0; J<numOfCouples; J++)
155 highestKineticEnergy,TotBin);
156 BuildRangeVector(theDEDXTable,lowestKineticEnergy,highestKineticEnergy,
158 theRangeTable->
insert(aVector);
160 return theRangeTable ;
165void G4VeLowEnergyLoss::BuildRangeVector(
G4PhysicsTable* theDEDXTable,
176 G4double energy1 = lowestKineticEnergy;
183 for (
G4int j=1; j<=TotBin; j++) {
186 G4double de = (energy2 - energy1) * del ;
189 for (
G4int i=1; i<n; i++) {
192 range += 0.5*de*(1.0/dedx1 + 1.0/dedx2);
207 G4double dtau,Value,taui,ti,lossi,ci;
212 for (
G4int i=0; i<nbin; i++)
216 lossi = physicsVector->
GetValue(ti,isOut);
238 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
244 for (
G4int i=0; i<nbin; i++)
249 lossi = physicsVector->
GetValue(ti,isOut);
259 Value += ci*taui/lossi;
279 delete theLabTimeTable; }
283 for (
G4int J=0; J<numOfCouples; J++)
288 highestKineticEnergy,TotBin);
290 BuildLabTimeVector(theDEDXTable,
291 lowestKineticEnergy,highestKineticEnergy,TotBin,J,aVector);
292 theLabTimeTable->
insert(aVector);
296 return theLabTimeTable ;
310 if(theProperTimeTable)
312 delete theProperTimeTable; }
316 for (
G4int J=0; J<numOfCouples; J++)
321 highestKineticEnergy,TotBin);
323 BuildProperTimeVector(theDEDXTable,
324 lowestKineticEnergy,highestKineticEnergy,TotBin,J,aVector);
325 theProperTimeTable->
insert(aVector);
329 return theProperTimeTable ;
334void G4VeLowEnergyLoss::BuildLabTimeVector(
G4PhysicsTable* theDEDXTable,
343 G4double tlim=5.*keV,parlowen=0.4,ppar=0.5-parlowen ;
344 G4double losslim,clim,taulim,timelim,
345 LowEdgeEnergy,tau,Value ;
351 losslim = physicsVector->
GetValue(tlim,isOut);
353 clim=std::sqrt(
ParticleMass*tlim/2.)/(c_light*losslim*ppar) ;
367 Value = clim*std::exp(ppar*std::log(tau/taulim)) ;
374 Value = timelim+LabTimeIntLog(physicsVector,nbin);
379 }
while (tau<=taulim) ;
381 for (
G4int j=i; j<=TotBin; j++)
387 Value = oldValue+LabTimeIntLog(physicsVector,nbin);
396void G4VeLowEnergyLoss::BuildProperTimeVector(
G4PhysicsTable* theDEDXTable,
404 G4double tlim=5.*keV,parlowen=0.4,ppar=0.5-parlowen ;
405 G4double losslim,clim,taulim,timelim,
406 LowEdgeEnergy,tau,Value ;
413 losslim = physicsVector->
GetValue(tlim,isOut);
415 clim=std::sqrt(
ParticleMass*tlim/2.)/(c_light*losslim*ppar) ;
429 Value = clim*std::exp(ppar*std::log(tau/taulim)) ;
436 Value = timelim+ProperTimeIntLog(physicsVector,nbin);
441 }
while (tau<=taulim) ;
443 for (
G4int j=i; j<=TotBin; j++)
449 Value = oldValue+ProperTimeIntLog(physicsVector,nbin);
462 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
468 for (
G4int i=0; i<nbin; i++)
473 lossi = physicsVector->
GetValue(ti,isOut);
495 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
501 for (
G4int i=0; i<nbin; i++)
506 lossi = physicsVector->
GetValue(ti,isOut);
538 if(theInverseRangeTable)
540 delete theInverseRangeTable; }
544 for (
G4int i=0; i<numOfCouples; i++)
566 for (
size_t j=1; j<nbins; j++) {
570 for (ihigh=ilow+1; ihigh<nbins; ihigh++) {
573 if(range2 >= range || ihigh == nbins-1) {
581 G4double e = std::log(energy1) + std::log(energy2/energy1)*std::log(range/range1)/std::log(range2/range1);
585 theInverseRangeTable->
insert(v);
588 return theInverseRangeTable ;
593void G4VeLowEnergyLoss::InvertRangeVector(
G4PhysicsTable* theRangeTable,
602 G4double LowEdgeRange,A,B,C,discr,KineticEnergy ;
603 G4double RTable = std::exp(std::log(highestKineticEnergy/lowestKineticEnergy)/TotBin) ;
604 G4double Tbin = lowestKineticEnergy/RTable ;
606 G4int binnumber = -1 ;
610 for(
G4int i=0; i<=TotBin; i++)
613 if( rangebin < LowEdgeRange )
619 rangebin = (*theRangeTable)(materialIndex)->GetValue(Tbin,isOut) ;
621 while ((rangebin < LowEdgeRange) && (binnumber < TotBin )) ;
625 KineticEnergy = lowestKineticEnergy ;
626 else if(binnumber == TotBin)
627 KineticEnergy = highestKineticEnergy ;
630 A = (*(*theRangeCoeffATable)(materialIndex))(binnumber-1) ;
631 B = (*(*theRangeCoeffBTable)(materialIndex))(binnumber-1) ;
632 C = (*(*theRangeCoeffCTable)(materialIndex))(binnumber-1) ;
634 KineticEnergy = (LowEdgeRange -C )/B ;
637 discr = B*B - 4.*A*(C-LowEdgeRange);
638 discr = discr>0. ? std::sqrt(discr) : 0.;
639 KineticEnergy = 0.5*(discr-B)/A ;
643 aVector->
PutValue(i,KineticEnergy) ;
659 if(theRangeCoeffATable)
661 delete theRangeCoeffATable; }
664 G4double RTable = std::exp(std::log(highestKineticEnergy/lowestKineticEnergy)/TotBin) ;
667 G4double w = R1*(RTable-1.)*(RTable-1.);
668 G4double w1 = RTable/w , w2 = -RTable*R1/w , w3 = R2/w ;
669 G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
673 for (
G4int J=0; J<numOfCouples; J++)
675 G4int binmax=TotBin ;
678 Ti = lowestKineticEnergy ;
681 for (
G4int i=0; i<=TotBin; i++)
683 Ri = rangeVector->
GetValue(Ti,isOut) ;
689 Rim = rangeVector->
GetValue(Tim,isOut);
696 Rip = rangeVector->
GetValue(Tip,isOut);
698 Value = (w1*Rip + w2*Ri + w3*Rim)/(Ti*Ti) ;
704 theRangeCoeffATable->
insert(aVector);
706 return theRangeCoeffATable ;
721 if(theRangeCoeffBTable)
723 delete theRangeCoeffBTable; }
726 G4double RTable = std::exp(std::log(highestKineticEnergy/lowestKineticEnergy)/TotBin) ;
729 G4double w = R1*(RTable-1.)*(RTable-1.);
730 G4double w1 = -R1/w , w2 = R1*(R2+1.)/w , w3 = -R2*R1/w ;
731 G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
735 for (
G4int J=0; J<numOfCouples; J++)
737 G4int binmax=TotBin ;
740 Ti = lowestKineticEnergy ;
743 for (
G4int i=0; i<=TotBin; i++)
745 Ri = rangeVector->
GetValue(Ti,isOut) ;
751 Rim = rangeVector->
GetValue(Tim,isOut);
758 Rip = rangeVector->
GetValue(Tip,isOut);
760 Value = (w1*Rip + w2*Ri + w3*Rim)/Ti;
765 theRangeCoeffBTable->
insert(aVector);
767 return theRangeCoeffBTable ;
782 if(theRangeCoeffCTable)
784 delete theRangeCoeffCTable; }
787 G4double RTable = std::exp(std::log(highestKineticEnergy/lowestKineticEnergy)/TotBin) ;
790 G4double w = R1*(RTable-1.)*(RTable-1.);
791 G4double w1 = 1./w , w2 = -RTable*R1/w , w3 = RTable*R2/w ;
792 G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
796 for (
G4int J=0; J<numOfCouples; J++)
798 G4int binmax=TotBin ;
801 Ti = lowestKineticEnergy ;
804 for (
G4int i=0; i<=TotBin; i++)
806 Ri = rangeVector->
GetValue(Ti,isOut) ;
812 Rim = rangeVector->
GetValue(Tim,isOut);
819 Rip = rangeVector->
GetValue(Tip,isOut);
821 Value = w1*Rip + w2*Ri + w3*Rim ;
826 theRangeCoeffCTable->
insert(aVector);
828 return theRangeCoeffCTable ;
840 static const G4double minLoss = 1.*eV ;
841 static const G4double probLim = 0.01 ;
842 static const G4double sumaLim = -std::log(probLim) ;
845 static const G4double factor = twopi_mc2_rcl2 ;
865 beta2,suma,e0,loss,lossc,w;
869 G4double Corrfac, na,alfa,rfac,namean,sa,alfa1,ea,sea;
875 if(MeanLoss < minLoss)
return MeanLoss ;
883 ->GetEnergyCutsVector(1)))[
imat];
886 G4double Tm = 2.*electron_mass_c2*tau2/(1.+2.*tau1*rmass+rmass*rmass);
890 if(Tm > threshold) Tm = threshold;
891 beta2 = tau2/(tau1*tau1);
894 if(MeanLoss >= kappa*Tm || MeanLoss <= kappa*
ipotFluct)
897 siga = std::sqrt(Tm*(1.0-0.5*beta2)*step*
898 factor*electronDensity/beta2) ;
900 loss = G4RandGauss::shoot(MeanLoss,siga) ;
901 }
while (loss < 0. || loss > 2.0*MeanLoss);
906 w2 = std::log(2.*electron_mass_c2*tau2);
930 p3 = std::max(0,
G4int(G4RandGauss::shoot(a3,siga)+0.5));
953 a3 = MeanLoss*(Tm-e0)/(Tm*e0*std::log(Tm/e0));
960 p3 = std::max(0,
G4int(G4RandGauss::shoot(a3,siga)+0.5));
994 p1 = std::max(0,
int(G4RandGauss::shoot(a1,siga)+0.5));
1002 siga=std::sqrt(a2) ;
1003 p2 = std::max(0,
int(G4RandGauss::shoot(a2,siga)+0.5));
1021 siga=std::sqrt(a3) ;
1022 p3 = std::max(0,
int(G4RandGauss::shoot(a3,siga)+0.5));
1038 na = G4RandGauss::shoot(namean,sa);
1042 alfa1 = alfa*std::log(alfa)/(alfa-1.);
1044 sea =
ipotFluct*std::sqrt(na*(alfa-alfa1*alfa1));
1045 lossc += G4RandGauss::shoot(ea,sea);
G4long G4Poisson(G4double mean)
G4double GetKineticEnergy() const
G4double GetF2fluct() const
G4double GetLogEnergy1fluct() const
G4double GetLogEnergy2fluct() const
G4double GetMeanExcitationEnergy() const
G4double GetF1fluct() const
G4double GetEnergy2fluct() const
G4double GetEnergy1fluct() const
G4double GetRateionexcfluct() const
G4double GetEnergy0fluct() const
G4double GetLogMeanExcEnergy() const
const G4Material * GetMaterial() const
G4IonisParamMat * GetIonisation() const
G4double GetElectronDensity() const
void insert(G4PhysicsVector *)
size_t GetVectorLength() const
G4double GetValue(G4double theEnergy, G4bool &isOutRange)
virtual G4double GetLowEdgeEnergy(size_t binNumber) const
void PutValue(size_t index, G4double theValue)
size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()
G4VeLowEnergyLoss(const G4String &, G4ProcessType aType=fNotDefined)
static G4double ParticleMass
static G4PhysicsTable * BuildRangeTable(G4PhysicsTable *theDEDXTable, G4PhysicsTable *theRangeTable, G4double Tmin, G4double Tmax, G4int nbin)
static void SetEnlossFluc(G4bool value)
const G4Material * lastMaterial
static G4PhysicsTable * BuildRangeCoeffATable(G4PhysicsTable *theRangeTable, G4PhysicsTable *theCoeffATable, G4double Tmin, G4double Tmax, G4int nbin)
static G4double finalRange
static G4PhysicsTable * BuildRangeCoeffCTable(G4PhysicsTable *theRangeTable, G4PhysicsTable *theCoeffCTable, G4double Tmin, G4double Tmax, G4int nbin)
static void SetRndmStep(G4bool value)
static G4PhysicsTable * BuildLabTimeTable(G4PhysicsTable *theDEDXTable, G4PhysicsTable *theLabTimeTable, G4double Tmin, G4double Tmax, G4int nbin)
static G4bool rndmStepFlag
virtual ~G4VeLowEnergyLoss()
static G4PhysicsTable * BuildInverseRangeTable(G4PhysicsTable *theRangeTable, G4PhysicsTable *theRangeCoeffATable, G4PhysicsTable *theRangeCoeffBTable, G4PhysicsTable *theRangeCoeffCTable, G4PhysicsTable *theInverseRangeTable, G4double Tmin, G4double Tmax, G4int nbin)
static G4double dRoverRange
static G4PhysicsTable * BuildRangeCoeffBTable(G4PhysicsTable *theRangeTable, G4PhysicsTable *theCoeffBTable, G4double Tmin, G4double Tmax, G4int nbin)
static G4PhysicsTable * BuildProperTimeTable(G4PhysicsTable *theDEDXTable, G4PhysicsTable *ProperTimeTable, G4double Tmin, G4double Tmax, G4int nbin)
static void SetStepFunction(G4double c1, G4double c2)
G4double GetLossWithFluct(const G4DynamicParticle *aParticle, const G4MaterialCutsCouple *couple, G4double MeanLoss, G4double step)
static G4bool EnlossFlucFlag
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)