79 G4Exception(
"G4RDVeLowEnergyLoss::G4RDVeLowEnergyLoss()",
"InvalidCall",
140 delete theRangeTable; }
145 for (
G4int J=0; J<numOfCouples; J++)
149 highestKineticEnergy,TotBin);
150 BuildRangeVector(theDEDXTable,lowestKineticEnergy,highestKineticEnergy,
152 theRangeTable->
insert(aVector);
154 return theRangeTable ;
159 void G4RDVeLowEnergyLoss::BuildRangeVector(
G4PhysicsTable* theDEDXTable,
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);
284 BuildLabTimeVector(theDEDXTable,
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);
317 BuildProperTimeVector(theDEDXTable,
318 lowestKineticEnergy,highestKineticEnergy,TotBin,J,aVector);
319 theProperTimeTable->
insert(aVector);
323 return theProperTimeTable ;
328 void G4RDVeLowEnergyLoss::BuildLabTimeVector(
G4PhysicsTable* theDEDXTable,
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)) ;
364 ltaulow = std::log(taulim);
366 Value = timelim+LabTimeIntLog(physicsVector,nbin);
371 }
while (tau<=taulim) ;
373 for (
G4int j=i; j<TotBin; j++)
377 ltaulow = std::log(tauold);
379 Value = oldValue+LabTimeIntLog(physicsVector,nbin);
388 void G4RDVeLowEnergyLoss::BuildProperTimeVector(
G4PhysicsTable* theDEDXTable,
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)) ;
424 ltaulow = std::log(taulim);
426 Value = timelim+ProperTimeIntLog(physicsVector,nbin);
431 }
while (tau<=taulim) ;
433 for (
G4int j=i; j<TotBin; j++)
437 ltaulow = std::log(tauold);
439 Value = oldValue+ProperTimeIntLog(physicsVector,nbin);
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 ;
583 void G4RDVeLowEnergyLoss::InvertRangeVector(
G4PhysicsTable* theRangeTable,
592 G4double LowEdgeRange,A,B,C,discr,KineticEnergy ;
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) ;
657 G4double w = R1*(RTable-1.)*(RTable-1.);
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) ;
719 G4double w = R1*(RTable-1.)*(RTable-1.);
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) ;
780 G4double w = R1*(RTable-1.)*(RTable-1.);
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) ;
890 loss = G4RandGauss::shoot(MeanLoss,siga) ;
891 }
while (loss < 0. || loss > 2.0*MeanLoss);
920 p3 = std::max(0,
G4int(G4RandGauss::shoot(a3,siga)+0.5));
932 Tm = Tm-ipotFluct+e0 ;
943 a3 = MeanLoss*(Tm-e0)/(Tm*e0*std::log(Tm/e0));
950 p3 = std::max(0,
G4int(G4RandGauss::shoot(a3,siga)+0.5));
984 p1 = std::max(0,
int(G4RandGauss::shoot(a1,siga)+0.5));
993 p2 = std::max(0,
int(G4RandGauss::shoot(a2,siga)+0.5));
1011 siga=std::sqrt(a3) ;
1012 p3 = std::max(0,
int(G4RandGauss::shoot(a3,siga)+0.5));
1028 na = G4RandGauss::shoot(namean,sa);
1032 alfa1 = alfa*std::log(alfa)/(alfa-1.);
1033 ea = na*ipotFluct*alfa1;
1034 sea = ipotFluct*std::sqrt(na*(alfa-alfa1*alfa1));
1035 lossc += G4RandGauss::shoot(ea,sea);