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 ;
165 void 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++)
246 ui = ltaulow+dltau*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 ;
334 void 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);
367 Value = clim*std::exp(ppar*std::log(tau/taulim)) ;
372 ltaulow = std::log(taulim);
374 Value = timelim+LabTimeIntLog(physicsVector,nbin);
379 }
while (tau<=taulim) ;
381 for (
G4int j=i; j<=TotBin; j++)
385 ltaulow = std::log(tauold);
387 Value = oldValue+LabTimeIntLog(physicsVector,nbin);
396 void 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);
429 Value = clim*std::exp(ppar*std::log(tau/taulim)) ;
434 ltaulow = std::log(taulim);
436 Value = timelim+ProperTimeIntLog(physicsVector,nbin);
441 }
while (tau<=taulim) ;
443 for (
G4int j=i; j<=TotBin; j++)
447 ltaulow = std::log(tauold);
449 Value = oldValue+ProperTimeIntLog(physicsVector,nbin);
462 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
468 for (
G4int i=0; i<nbin; i++)
470 ui = ltaulow+dltau*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++)
503 ui = ltaulow+dltau*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 ;
593 void 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 ;
841 static const G4double probLim = 0.01 ;
842 static const G4double sumaLim = -std::log(probLim) ;
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];
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);
930 p3 = std::max(0,
G4int(G4RandGauss::shoot(a3,siga)+0.5));
942 Tm = Tm-ipotFluct+e0 ;
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.);
1043 ea = na*ipotFluct*alfa1;
1044 sea = ipotFluct*std::sqrt(na*(alfa-alfa1*alfa1));
1045 lossc += G4RandGauss::shoot(ea,sea);