87 G4int G4hRDEnergyLoss::NumberOfProcesses = 1 ;
89 G4int G4hRDEnergyLoss::CounterOfProcess = 0 ;
137 G4hRDEnergyLoss::taulow,
138 G4hRDEnergyLoss::tauhigh,
139 G4hRDEnergyLoss::ltaulow,
140 G4hRDEnergyLoss::ltauhigh;
165 MaxExcitationNumber (1.e6),
167 nmaxDirectFluct (100),
172 MinKineticEnergy(0.0)
189 return NumberOfProcesses;
196 NumberOfProcesses=number;
263 if( ((
Charge>0.) && (theDEDXTable==0)) ||
264 ((
Charge<0.) && (theDEDXTable==0))
275 if(CounterOfProcess == NumberOfProcesses)
289 if(CounterOfProcess == NumberOfProcesses)
299 if(CounterOfProcess == NumberOfProcesses)
306 for (
size_t J=0; J<numOfCouples; J++)
319 for (
G4int process=0; process < NumberOfProcesses; process++)
321 pointer= RecorderOfProcess[process];
322 Value += (*pointer)[J]->
323 GetValue(LowEdgeEnergy,isOutRange) ;
329 theDEDXTable->
insert(aVector) ;
339 BuildRangeTable( aParticleType);
342 BuildTimeTables( aParticleType) ;
345 BuildRangeCoeffATable( aParticleType);
346 BuildRangeCoeffBTable( aParticleType);
347 BuildRangeCoeffCTable( aParticleType);
351 BuildInverseRangeTable(aParticleType);
375 void G4hRDEnergyLoss::BuildRangeTable(
404 for (
size_t J=0; J<numOfCouples; J++)
410 BuildRangeVector(J, aVector);
411 theRangeTable->
insert(aVector);
417 void G4hRDEnergyLoss::BuildTimeTables(
455 for (
size_t J=0; J<numOfCouples; J++)
463 BuildLabTimeVector(J, aVector);
464 theLabTimeTable->
insert(aVector);
469 BuildProperTimeVector(J, bVector);
470 theProperTimeTable->
insert(bVector);
476 void G4hRDEnergyLoss::BuildRangeVector(
G4int materialIndex,
492 G4double de = (energy2 - energy1) * del ;
495 for (
G4int i=1; i<
n; i++) {
498 range += 0.5*de*(1.0/dedx1 + 1.0/dedx2);
509 void G4hRDEnergyLoss::BuildLabTimeVector(
G4int materialIndex,
516 G4double tlim=5.*
keV,parlowen=0.4,ppar=0.5-parlowen ;
518 G4double losslim,clim,taulim,timelim,
519 LowEdgeEnergy,tau,Value ;
524 losslim = physicsVector->
GetValue(tlim,isOut);
540 Value = clim*std::exp(ppar*std::log(tau/taulim)) ;
545 ltaulow = std::log(taulim);
546 ltauhigh = std::log(tau);
547 Value = timelim+LabTimeIntLog(physicsVector,nbin);
552 }
while (tau<=taulim) ;
559 ltaulow = std::log(tauold);
560 ltauhigh = std::log(tau);
561 Value = oldValue+LabTimeIntLog(physicsVector,nbin);
570 void G4hRDEnergyLoss::BuildProperTimeVector(
G4int materialIndex,
576 G4double tlim=5.*
keV,parlowen=0.4,ppar=0.5-parlowen ;
578 G4double losslim,clim,taulim,timelim,
579 LowEdgeEnergy,tau,Value ;
584 losslim = physicsVector->
GetValue(tlim,isOut);
600 Value = clim*std::exp(ppar*std::log(tau/taulim)) ;
605 ltaulow = std::log(taulim);
606 ltauhigh = std::log(tau);
607 Value = timelim+ProperTimeIntLog(physicsVector,nbin);
612 }
while (tau<=taulim) ;
619 ltaulow = std::log(tauold);
620 ltauhigh = std::log(tau);
621 Value = oldValue+ProperTimeIntLog(physicsVector,nbin);
634 G4double dtau,Value,taui,ti,lossi,ci;
636 dtau = (tauhigh-taulow)/nbin;
639 for (
G4int i=0; i<=nbin; i++)
641 taui = taulow + dtau*i ;
643 lossi = physicsVector->
GetValue(ti,isOut);
665 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
667 ltt = ltauhigh-ltaulow;
671 for (
G4int i=0; i<=nbin; i++)
673 ui = ltaulow+dltau*i;
676 lossi = physicsVector->
GetValue(ti,isOut);
686 Value += ci*taui/lossi;
698 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
700 ltt = ltauhigh-ltaulow;
704 for (
G4int i=0; i<=nbin; i++)
706 ui = ltaulow+dltau*i;
709 lossi = physicsVector->
GetValue(ti,isOut);
731 G4double ltt,dltau,Value,ui,taui,ti,lossi,ci;
733 ltt = ltauhigh-ltaulow;
737 for (
G4int i=0; i<=nbin; i++)
739 ui = ltaulow+dltau*i;
742 lossi = physicsVector->
GetValue(ti,isOut);
760 void G4hRDEnergyLoss::BuildRangeCoeffATable(
770 if(thepRangeCoeffATable)
772 delete thepRangeCoeffATable; }
774 theRangeCoeffATable = thepRangeCoeffATable ;
779 if(thepbarRangeCoeffATable)
781 delete thepbarRangeCoeffATable; }
783 theRangeCoeffATable = thepbarRangeCoeffATable ;
791 G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
795 for (
G4int J=0; J<numOfCouples; J++)
806 Ri = rangeVector->
GetValue(Ti,isOut) ;
823 Rim = rangeVector->
GetValue(Tim,isOut);
830 Rip = rangeVector->
GetValue(Tip,isOut);
832 Value = (w1*Rip + w2*Ri + w3*Rim)/(Ti*Ti) ;
838 theRangeCoeffATable->
insert(aVector);
844 void G4hRDEnergyLoss::BuildRangeCoeffBTable(
854 if(thepRangeCoeffBTable)
856 delete thepRangeCoeffBTable; }
858 theRangeCoeffBTable = thepRangeCoeffBTable ;
863 if(thepbarRangeCoeffBTable)
865 delete thepbarRangeCoeffBTable; }
867 theRangeCoeffBTable = thepbarRangeCoeffBTable ;
873 G4double w = R1*(RTable-1.)*(RTable-1.);
875 G4double w1 = -R1/w , w2 = R1*(R2+1.)/w , w3 = -R2*R1/w ;
876 G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
880 for (
G4int J=0; J<numOfCouples; J++)
891 Ri = rangeVector->
GetValue(Ti,isOut) ;
899 Rim = rangeVector->
GetValue(Tim,isOut);
906 Rip = rangeVector->
GetValue(Tip,isOut);
909 Value = (w1*Rip + w2*Ri + w3*Rim)/Ti;
914 theRangeCoeffBTable->
insert(aVector);
920 void G4hRDEnergyLoss::BuildRangeCoeffCTable(
930 if(thepRangeCoeffCTable)
932 delete thepRangeCoeffCTable; }
934 theRangeCoeffCTable = thepRangeCoeffCTable ;
939 if(thepbarRangeCoeffCTable)
941 delete thepbarRangeCoeffCTable; }
943 theRangeCoeffCTable = thepbarRangeCoeffCTable ;
949 G4double w = R1*(RTable-1.)*(RTable-1.);
950 G4double w1 = 1./w , w2 = -RTable*R1/w , w3 = RTable*R2/w ;
951 G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
955 for (
G4int J=0; J<numOfCouples; J++)
965 Ri = rangeVector->
GetValue(Ti,isOut) ;
971 Rim = rangeVector->
GetValue(Tim,isOut);
978 Rip = rangeVector->
GetValue(Tip,isOut);
980 Value = w1*Rip + w2*Ri + w3*Rim ;
985 theRangeCoeffCTable->
insert(aVector);
991 void G4hRDEnergyLoss::BuildInverseRangeTable(
1010 theRangeCoeffATable = thepRangeCoeffATable ;
1011 theRangeCoeffBTable = thepRangeCoeffBTable ;
1012 theRangeCoeffCTable = thepRangeCoeffCTable ;
1024 theRangeCoeffATable = thepbarRangeCoeffATable ;
1025 theRangeCoeffBTable = thepbarRangeCoeffBTable ;
1026 theRangeCoeffCTable = thepbarRangeCoeffCTable ;
1030 for (
size_t i=0; i<numOfCouples; i++)
1040 if (rlow <
DBL_MIN) rlow = 1.e-8;
1041 if (rhigh > 1.e16) rhigh = 1.e16;
1042 if (rhigh < 1.
e-8) rhigh =1.e-8;
1048 if (tmpTrick <= 0. || tmpTrick <
DBL_MIN) tmpTrick = 1.e-8;
1049 if (tmpTrick > 1.e16) tmpTrick = 1.e16;
1051 rhigh *= std::exp(std::log(tmpTrick)/((
G4double)(nbins-1)));
1063 for (
size_t j=1; j<nbins; j++) {
1067 for (ihigh=ilow+1; ihigh<nbins; ihigh++) {
1070 if(range2 >= range || ihigh == nbins-1) {
1078 G4double e = std::log(energy1) + std::log(energy2/energy1)*std::log(range/range1)/std::log(range2/range1);
1082 theInverseRangeTable->
insert(v);
1089 void G4hRDEnergyLoss::InvertRangeVector(
G4int materialIndex,
1093 G4double LowEdgeRange,A,B,C,discr,KineticEnergy ;
1096 G4int binnumber = -1 ;
1105 if( rangebin < LowEdgeRange )
1111 rangebin = (*theRangeTable)(materialIndex)->GetValue(Tbin,isOut) ;
1113 while ((rangebin < LowEdgeRange) && (binnumber < TotBin )) ;
1118 else if(binnumber == TotBin-1)
1122 A = (*(*theRangeCoeffATable)(materialIndex))(binnumber-1) ;
1123 B = (*(*theRangeCoeffBTable)(materialIndex))(binnumber-1) ;
1124 C = (*(*theRangeCoeffCTable)(materialIndex))(binnumber-1) ;
1126 KineticEnergy = (LowEdgeRange -C )/B ;
1129 discr = B*B - 4.*A*(C-LowEdgeRange);
1130 discr = discr>0. ? std::sqrt(discr) : 0.;
1131 KineticEnergy = 0.5*(discr-B)/A ;
1135 aVector->
PutValue(i,KineticEnergy) ;
1143 G4bool wasModified =
false;
1148 for (
size_t j=0; j<numOfCouples; j++){