59 const G4int nPerDecade = 10;
63 fPAIySection.SetVerbose(ver);
65 fLowestKineticEnergy =
std::max(tmin, lowestTkin);
66 fHighestKineticEnergy = tmax;
67 if(tmax < 10*fLowestKineticEnergy) {
68 fHighestKineticEnergy = 10*fLowestKineticEnergy;
69 }
else if(tmax > highestTkin) {
70 fHighestKineticEnergy =
std::max(highestTkin, 10*fLowestKineticEnergy);
72 fTotBin = (
G4int)(nPerDecade*
73 std::log10(fHighestKineticEnergy/fLowestKineticEnergy));
76 fHighestKineticEnergy,
79 G4cout <<
"### G4PAIModelData: Nbins= " << fTotBin
80 <<
" Tlowest(keV)= " << lowestTkin/
keV
81 <<
" Tmin(keV)= " << fLowestKineticEnergy/
keV
82 <<
" Tmax(GeV)= " << fHighestKineticEnergy/
GeV
91 size_t n = fPAIxscBank.size();
93 for(
size_t i=0; i<
n; ++i) {
95 fPAIxscBank[i]->clearAndDestroy();
96 delete fPAIxscBank[i];
99 fPAIdEdxBank[i]->clearAndDestroy();
100 delete fPAIdEdxBank[i];
102 delete fdEdxTable[i];
105 delete fParticleEnergyVector;
114 fSandia.Initialize(const_cast<G4Material*>(mat));
120 fHighestKineticEnergy,
123 G4double Tmin = fSandia.GetSandiaMatTablePAI(0,0);
128 for (
G4int i = 0; i <= fTotBin; ++i) {
130 G4double kinEnergy = fParticleEnergyVector->Energy(i);
135 if (Tmax < Tmin + deltaLow ) { Tmax = Tmin + deltaLow; }
137 fPAIySection.Initialize(mat, Tmax, bg2, &fSandia);
142 G4int n = fPAIySection.GetSplineSize();
145 if(fPAIySection.GetIntegralPAIySection(
k+1) <= 0.0) {
160 G4double t = fPAIySection.GetSplineEnergy(
k+1);
161 tr = fPAIySection.GetIntegralPAIySection(
k+1);
167 dEdxVector->
PutValue(
k, t, fPAIySection.GetIntegralPAIdEdx(
k+1));
174 G4double ionloss = fPAIySection.GetMeanEnergyLoss();
176 if(ionloss < 0.0) ionloss = 0.0;
178 dEdxMeanVector->
PutValue(i,ionloss);
180 PAItransferTable->
insertAt(i,transferVector);
181 PAIdEdxTable->
insertAt(i,dEdxVector);
189 fPAIxscBank.push_back(PAItransferTable);
190 fPAIdEdxBank.push_back(PAIdEdxTable);
197 fdEdxTable.push_back(dEdxMeanVector);
207 size_t iPlace = fParticleEnergyVector->FindBin(scaledTkin, 0);
208 size_t nPlace = fParticleEnergyVector->GetVectorLength() - 1;
215 if(scaledTkin >= fParticleEnergyVector->Energy(nPlace)) { iPlace = nPlace; }
216 else if(scaledTkin > fParticleEnergyVector->Energy(0)) {
221 G4double dEdx = fdEdxTable[coupleIndex]->Value(scaledTkin);
222 G4double del = (*(fPAIdEdxBank[coupleIndex]))(iPlace)->Value(cut);
225 G4double del2 = (*(fPAIdEdxBank[coupleIndex]))(iPlace+1)->Value(cut);
226 G4double E1 = fParticleEnergyVector->Energy(iPlace);
227 G4double E2 = fParticleEnergyVector->Energy(iPlace+1);
251 size_t iPlace = fParticleEnergyVector->FindBin(scaledTkin, 0);
252 size_t nPlace = fParticleEnergyVector->GetVectorLength() - 1;
255 if(scaledTkin >= fParticleEnergyVector->Energy(nPlace)) { iPlace = nPlace; }
256 else if(scaledTkin > fParticleEnergyVector->Energy(0)) {
263 cross1 = (*table)(iPlace)->Value(tmax)/tmax;
265 cross2 = (*table)(iPlace)->Value(tcut)/tcut;
267 cross = (cross2-cross1);
270 cross2 = (*table)(iPlace+1)->Value(tcut)/tcut
271 - (*table)(iPlace+1)->Value(tmax)/tmax;
273 G4double E1 = fParticleEnergyVector->Energy(iPlace);
274 G4double E2 = fParticleEnergyVector->Energy(iPlace+1);
297 size_t iPlace = fParticleEnergyVector->FindBin(scaledTkin, 0);
298 size_t nPlace = fParticleEnergyVector->GetVectorLength() - 1;
301 if(scaledTkin >= fParticleEnergyVector->Energy(nPlace)) { iPlace = nPlace; }
302 else if(scaledTkin > fParticleEnergyVector->Energy(0)) {
319 meanN11 = (*v1)[0]/
e1;
321 meanNumber = (meanN11 - meanN12)*stepFactor;
329 v2 = (*(fPAIxscBank[coupleIndex]))(iPlace+1);
334 meanN21 = (*v2)[0]/
e1;
336 G4double E1 = fParticleEnergyVector->Energy(iPlace);
337 G4double E2 = fParticleEnergyVector->Energy(iPlace+1);
339 W1 = (E2 - scaledTkin)*W;
340 W2 = (scaledTkin - E1)*W;
342 meanNumber += (meanN21 - meanN22)*stepFactor*W2;
346 if(meanNumber < 0.0) {
return loss; }
351 if(0 == numOfCollisions) {
return loss; }
354 for(
G4int i=0; i< numOfCollisions; ++i) {
356 position = meanN12 + (meanN11 - meanN12)*rand;
357 omega = GetEnergyTransfer(coupleIndex, iPlace, position);
360 position = meanN22 + (meanN21 - meanN22)*rand;
361 omega2 = GetEnergyTransfer(coupleIndex, iPlace+1, position);
368 if(loss > kinEnergy) {
break; }
372 if(loss > kinEnergy) { loss = kinEnergy; }
373 else if(loss < 0.) { loss = 0.; }
392 size_t nPlace = fParticleEnergyVector->GetVectorLength() - 1;
393 size_t iPlace = fParticleEnergyVector->FindBin(scaledTkin, 0);
396 if(scaledTkin >= fParticleEnergyVector->Energy(nPlace)) { iPlace = nPlace; }
397 else if(scaledTkin > fParticleEnergyVector->Energy(0)) {
405 if(emax < emin) {
return transfer; }
416 transfer = GetEnergyTransfer(coupleIndex, iPlace, position);
433 G4double E1 = fParticleEnergyVector->Energy(iPlace);
434 G4double E2 = fParticleEnergyVector->Energy(iPlace+1);
442 position = dNdx2 + (dNdx1 - dNdx2)*rand;
443 G4double tr2 = GetEnergyTransfer(coupleIndex, iPlace+1, position);
467 if(position*v->
Energy(0) >= (*v)[0]) {
return v->
Energy(0); }
475 for(iTransfer=1; iTransfer<=iTransferMax; ++iTransfer) {
477 y2 = (*v)[iTransfer]/
x2;
478 if(position >=
y2) {
break; }
479 if(iTransfer == iTransferMax) {
return v->
GetMaxEnergy(); }
483 y1 = (*v)[iTransfer-1]/
x1;
495 const G4int nbins = 5;
498 for(
G4int i=1; i<=nbins; ++i) {
516 return energyTransfer;