87G4int G4hRDEnergyLoss::NumberOfProcesses = 1 ;
89G4int 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);
375void G4hRDEnergyLoss::BuildRangeTable(
404 for (
size_t J=0; J<numOfCouples; J++)
410 BuildRangeVector(J, aVector);
411 theRangeTable->
insert(aVector);
417void 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);
476void 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);
509void 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);
526 clim=std::sqrt(
ParticleMass*tlim/2.)/(c_light*losslim*ppar) ;
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);
570void 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);
586 clim=std::sqrt(
ParticleMass*tlim/2.)/(c_light*losslim*ppar) ;
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);
760void 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);
844void G4hRDEnergyLoss::BuildRangeCoeffBTable(
854 if(thepRangeCoeffBTable)
856 delete thepRangeCoeffBTable; }
858 theRangeCoeffBTable = thepRangeCoeffBTable ;
863 if(thepbarRangeCoeffBTable)
865 delete thepbarRangeCoeffBTable; }
867 theRangeCoeffBTable = thepbarRangeCoeffBTable ;
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);
920void G4hRDEnergyLoss::BuildRangeCoeffCTable(
930 if(thepRangeCoeffCTable)
932 delete thepRangeCoeffCTable; }
934 theRangeCoeffCTable = thepRangeCoeffCTable ;
939 if(thepbarRangeCoeffCTable)
941 delete thepbarRangeCoeffCTable; }
943 theRangeCoeffCTable = thepbarRangeCoeffCTable ;
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);
991void 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);
1089void 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++){
static G4AntiProton * AntiProton()
static void Register(const G4ParticleDefinition *p, const G4PhysicsTable *tDEDX, const G4PhysicsTable *tRange, const G4PhysicsTable *tInverseRange, const G4PhysicsTable *tLabTime, const G4PhysicsTable *tProperTime, G4double lowestKineticEnergy, G4double highestKineticEnergy, G4double massRatio, G4int NumberOfBins)
G4bool IsRecalcNeeded() const
G4double GetPDGMass() const
G4double GetPDGCharge() 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)
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()
static G4Proton * Proton()
static G4PhysicsTable * theDEDXpTable
static void SetStepFunction(G4double c1, G4double c2)
static G4PhysicsTable * theInverseRangepbarTable
static G4PhysicsTable * theInverseRangepTable
static G4double pbartableElectronCutInRange
static G4PhysicsTable ** RecorderOfpbarProcess
static G4double finalRange
static G4int CounterOfpbarProcess
static G4PhysicsTable * theRangepTable
static G4PhysicsTable * theDEDXpbarTable
G4PhysicsTable * theLossTable
static G4double dRoverRange
G4hRDEnergyLoss(const G4String &)
static G4double LowestKineticEnergy
static void SetdRoverRange(G4double value)
static void PlusNumberOfProcesses()
static void SetRndmStep(G4bool value)
static G4PhysicsTable * theLabTimepTable
static G4PhysicsTable * theProperTimepbarTable
static G4PhysicsTable * theProperTimepTable
static G4PhysicsTable ** RecorderOfpProcess
static G4PhysicsTable * theLabTimepbarTable
static void MinusNumberOfProcesses()
static G4bool EnlossFlucFlag
G4bool CutsWhereModified()
static G4bool rndmStepFlag
static void SetNumberOfProcesses(G4int number)
static G4double HighestKineticEnergy
static void SetEnlossFluc(G4bool value)
static G4int GetNumberOfProcesses()
static G4double ptableElectronCutInRange
static G4int CounterOfpProcess
static G4double ParticleMass
static G4PhysicsTable * theRangepbarTable
static G4double LOGRTable
static void BuildDEDXTable(const G4ParticleDefinition &aParticleType)