82 fLowestKineticEnergy(10.0*
keV),
83 fHighestKineticEnergy(100.*
TeV),
87 fHighKinEnergy(100.*
TeV),
88 fLowKinEnergy(2.0*
MeV),
89 fTwoln10(2.0*log(10.0)),
99 fHighestKineticEnergy,
101 fPAItransferTable = 0;
103 fPAIplasmonTable = 0;
106 fSandiaPhotoAbsCof = 0;
111 fdNdxCutPhotonVector = 0;
112 fdNdxCutPlasmonVector = 0;
114 fSandiaIntervalNumber = 0;
121 if(p) { SetParticle(p); }
122 else { SetParticle(fElectron); }
124 isInitialised =
false;
135 if( fPAItransferTable )
137 delete fPAItransferTable;
139 if( fPAIphotonTable )
141 delete fPAIphotonTable;
143 if( fPAIplasmonTable )
145 delete fPAIplasmonTable;
169 if(isInitialised) {
return; }
170 isInitialised =
true;
172 if(!fParticle) SetParticle(p);
180 size_t numRegions = fPAIRegionVector.size();
182 for(
size_t iReg = 0; iReg < numRegions; ++iReg)
184 const G4Region* curReg = fPAIRegionVector[iReg];
187 for(
size_t jMat = 0; jMat < numOfMat; ++jMat)
200 fMaterialCutsCoupleVector.push_back(couple);
219 fPAIxscBank.push_back(fPAItransferTable);
220 fPAIphotonBank.push_back(fPAIphotonTable);
221 fPAIplasmonBank.push_back(fPAIplasmonTable);
222 fPAIdEdxBank.push_back(fPAIdEdxTable);
223 fdEdxTable.push_back(fdEdxVector);
227 fdNdxCutTable.push_back(fdNdxCutVector);
228 fdNdxCutPhotonTable.push_back(fdNdxCutPhotonVector);
229 fdNdxCutPlasmonTable.push_back(fdNdxCutPlasmonVector);
230 fLambdaTable.push_back(fLambdaVector);
242 if(isInitialised) {
return; }
243 isInitialised =
true;
245 if( !fParticle ) SetParticle(p);
260 fMaterialCutsCoupleVector.push_back(couple);
262 for( jMat = 0; jMat < numOfMat; ++jMat )
264 if( material->
GetName() == (*theMaterialTable)[jMat]->GetName() )
break;
285 fPAIxscBank.push_back(fPAItransferTable);
286 fPAIphotonBank.push_back(fPAIphotonTable);
287 fPAIplasmonBank.push_back(fPAIplasmonTable);
288 fPAIdEdxBank.push_back(fPAIdEdxTable);
289 fdEdxTable.push_back(fdEdxVector);
293 fdNdxCutTable.push_back(fdNdxCutVector);
294 fdNdxCutPhotonTable.push_back(fdNdxCutPhotonVector);
295 fdNdxCutPlasmonTable.push_back(fdNdxCutPlasmonVector);
296 fLambdaTable.push_back(fLambdaVector);
304 G4int i, j, numberOfElements;
308 numberOfElements = (*theMaterialTable)[fMatIndex]->
309 GetNumberOfElements();
310 G4int* thisMaterialZ =
new G4int[numberOfElements];
312 for(i=0;i<numberOfElements;i++)
315 (
G4int)(*theMaterialTable)[fMatIndex]->GetElement(i)->GetZ();
318 (thisMaterialZ,numberOfElements);
320 fSandiaIntervalNumber = thisMaterialSandiaTable.
SandiaMixing
322 (*theMaterialTable)[fMatIndex]->GetFractionVector() ,
323 numberOfElements,fSandiaIntervalNumber);
325 fSandiaPhotoAbsCof =
new G4double*[fSandiaIntervalNumber];
327 for(i=0;i<fSandiaIntervalNumber;i++) fSandiaPhotoAbsCof[i] =
new G4double[5];
329 for( i = 0; i < fSandiaIntervalNumber; i++ )
333 for( j = 1; j < 5; j++ )
335 fSandiaPhotoAbsCof[i][j] = thisMaterialSandiaTable.
336 GetPhotoAbsorpCof(i+1,j)*
337 (*theMaterialTable)[fMatIndex]->GetDensity();
340 delete[] thisMaterialZ;
353 G4double tau, Tmax, Tmin, Tkin, deltaLow, bg2;
382 fHighestKineticEnergy,
388 for (
G4int i = 0; i <= fTotBin; i++)
395 bg2 = tau*(tau + 2. );
404 if ( Tkin < Tmin + deltaLow )
406 Tkin = Tmin + deltaLow;
437 photonVector->PutValue( k ,
440 plasmonVector->PutValue( k ,
443 dEdxVector->PutValue( k ,
448 if ( ionloss <= 0.) ionloss =
DBL_MIN;
451 fPAItransferTable->
insertAt(i,transferVector);
452 fPAIphotonTable->
insertAt(i,photonVector);
453 fPAIplasmonTable->
insertAt(i,plasmonVector);
454 fPAIdEdxTable->
insertAt(i,dEdxVector);
473 G4double dNdxCut,dNdxPhotonCut,dNdxPlasmonCut,
lambda, deltaCutInKineticEnergyNow, photonCutInKineticEnergyNow;
490 for (jMatCC = 0; jMatCC < numOfCouples; jMatCC++ )
494 if( jMatCC == numOfCouples && jMatCC > 0 ) jMatCC--;
499 if (fLambdaVector)
delete fLambdaVector;
500 if (fdNdxCutVector)
delete fdNdxCutVector;
501 if (fdNdxCutPhotonVector)
delete fdNdxCutPhotonVector;
502 if (fdNdxCutPlasmonVector)
delete fdNdxCutPlasmonVector;
505 fHighestKineticEnergy,
508 fHighestKineticEnergy,
511 fHighestKineticEnergy,
514 fHighestKineticEnergy,
517 deltaCutInKineticEnergyNow = (*deltaCutInKineticEnergy)[jMatCC];
518 photonCutInKineticEnergyNow = (*photonCutInKineticEnergy)[jMatCC];
528 G4cout<<
"PAIPhotonModel deltaCutInKineticEnergyNow = "
529 <<deltaCutInKineticEnergyNow/
keV<<
" keV"<<
G4endl;
530 G4cout<<
"PAIPhotonModel photonCutInKineticEnergyNow = "
531 <<photonCutInKineticEnergyNow/
keV<<
" keV"<<
G4endl;
533 for ( i = 0; i <= fTotBin; i++ )
538 dNdxCut = dNdxPhotonCut + dNdxPlasmonCut;
541 if (lambda <= 1000*kCarTolerance) lambda = 1000*kCarTolerance;
545 fdNdxCutVector->
PutValue(i, dNdxCut);
546 fdNdxCutPhotonVector->
PutValue(i, dNdxPhotonCut);
547 fdNdxCutPlasmonVector->
PutValue(i, dNdxPlasmonCut);
561 G4double dNdxCut,dNdxPhotonCut,dNdxPlasmonCut,
lambda, deltaCutInKineticEnergyNow, photonCutInKineticEnergyNow;
575 for (jMatCC = 0; jMatCC < numOfCouples; jMatCC++ )
579 if( jMatCC == numOfCouples && jMatCC > 0 ) jMatCC--;
581 if (fLambdaVector)
delete fLambdaVector;
582 if (fdNdxCutVector)
delete fdNdxCutVector;
583 if (fdNdxCutPhotonVector)
delete fdNdxCutPhotonVector;
584 if (fdNdxCutPlasmonVector)
delete fdNdxCutPlasmonVector;
587 fHighestKineticEnergy,
590 fHighestKineticEnergy,
593 fHighestKineticEnergy,
596 fHighestKineticEnergy,
600 photonCutInKineticEnergyNow = photEnergy;
601 deltaCutInKineticEnergyNow = eTkin;
605 G4cout<<
"PAIPhotonModel deltaCutInKineticEnergyNow = "
606 <<deltaCutInKineticEnergyNow/
keV<<
" keV"<<
G4endl;
607 G4cout<<
"PAIPhotonModel photonCutInKineticEnergyNow = "
608 <<photonCutInKineticEnergyNow/
keV<<
" keV"<<
G4endl;
610 for ( i = 0; i <= fTotBin; i++ )
615 dNdxCut = dNdxPhotonCut + dNdxPlasmonCut;
618 if (lambda <= 1000*kCarTolerance) lambda = 1000*kCarTolerance;
622 fdNdxCutVector->
PutValue(i, dNdxCut);
623 fdNdxCutPhotonVector->
PutValue(i, dNdxPhotonCut);
624 fdNdxCutPlasmonVector->
PutValue(i, dNdxPlasmonCut);
641 iTransfer <
G4int((*fPAItransferTable)(iPlace)->GetVectorLength());
644 if(transferCut <= (*fPAItransferTable)(iPlace)->GetLowEdgeEnergy(iTransfer))
649 if ( iTransfer >=
G4int((*fPAItransferTable)(iPlace)->GetVectorLength()) )
651 iTransfer = (*fPAItransferTable)(iPlace)->GetVectorLength() - 1;
653 if (iTransfer == 0)
return (*(*fPAItransferTable)(iPlace))(iTransfer);
654 y1 = (*(*fPAItransferTable)(iPlace))(iTransfer-1);
655 y2 = (*(*fPAItransferTable)(iPlace))(iTransfer);
657 x1 = (*fPAItransferTable)(iPlace)->GetLowEdgeEnergy(iTransfer-1);
658 x2 = (*fPAItransferTable)(iPlace)->GetLowEdgeEnergy(iTransfer);
661 if ( y1 == y2 ) dNdxCut = y2;
666 if ( std::abs(x1-x2) <=
eV ) dNdxCut = y1 + (y2 - y1)*0.5;
667 else dNdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1);
686 iTransfer <
G4int((*fPAIphotonTable)(iPlace)->GetVectorLength());
689 if(transferCut <= (*fPAIphotonTable)(iPlace)->GetLowEdgeEnergy(iTransfer))
694 if ( iTransfer >=
G4int((*fPAIphotonTable)(iPlace)->GetVectorLength()) )
696 iTransfer = (*fPAIphotonTable)(iPlace)->GetVectorLength() - 1;
698 if (iTransfer == 0)
return (*(*fPAIphotonTable)(iPlace))(iTransfer);
699 y1 = (*(*fPAIphotonTable)(iPlace))(iTransfer-1);
700 y2 = (*(*fPAIphotonTable)(iPlace))(iTransfer);
702 x1 = (*fPAIphotonTable)(iPlace)->GetLowEdgeEnergy(iTransfer-1);
703 x2 = (*fPAIphotonTable)(iPlace)->GetLowEdgeEnergy(iTransfer);
706 if ( y1 == y2 ) dNdxCut = y2;
711 if ( std::abs(x1-x2) <=
eV ) dNdxCut = y1 + (y2 - y1)*0.5;
712 else dNdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1);
732 iTransfer <
G4int((*fPAIplasmonTable)(iPlace)->GetVectorLength());
735 if(transferCut <= (*fPAIplasmonTable)(iPlace)->GetLowEdgeEnergy(iTransfer))
740 if ( iTransfer >=
G4int((*fPAIplasmonTable)(iPlace)->GetVectorLength()) )
742 iTransfer = (*fPAIplasmonTable)(iPlace)->GetVectorLength() - 1;
744 if (iTransfer == 0)
return (*(*fPAIplasmonTable)(iPlace))(iTransfer);
745 y1 = (*(*fPAIplasmonTable)(iPlace))(iTransfer-1);
746 y2 = (*(*fPAIplasmonTable)(iPlace))(iTransfer);
748 x1 = (*fPAIplasmonTable)(iPlace)->GetLowEdgeEnergy(iTransfer-1);
749 x2 = (*fPAIplasmonTable)(iPlace)->GetLowEdgeEnergy(iTransfer);
752 if ( y1 == y2 ) dNdxCut = y2;
757 if ( std::abs(x1-x2) <=
eV ) dNdxCut = y1 + (y2 - y1)*0.5;
758 else dNdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1);
777 iTransfer <
G4int((*fPAIdEdxTable)(iPlace)->GetVectorLength());
780 if(transferCut <= (*fPAIdEdxTable)(iPlace)->GetLowEdgeEnergy(iTransfer))
785 if ( iTransfer >=
G4int((*fPAIdEdxTable)(iPlace)->GetVectorLength()) )
787 iTransfer = (*fPAIdEdxTable)(iPlace)->GetVectorLength() - 1;
789 if (iTransfer == 0)
return (*(*fPAIdEdxTable)(iPlace))(iTransfer);
790 y1 = (*(*fPAIdEdxTable)(iPlace))(iTransfer-1);
791 y2 = (*(*fPAIdEdxTable)(iPlace))(iTransfer);
793 x1 = (*fPAIdEdxTable)(iPlace)->GetLowEdgeEnergy(iTransfer-1);
794 x2 = (*fPAIdEdxTable)(iPlace)->GetLowEdgeEnergy(iTransfer);
797 if ( y1 == y2 ) dEdxCut = y2;
802 if ( std::abs(x1-x2) <=
eV ) dEdxCut = y1 + (y2 - y1)*0.5;
803 else dEdxCut = y1 + (transferCut - x1)*(y2 - y1)/(x2 - x1);
829 for( jMat = 0;jMat < fMaterialCutsCoupleVector.size(); ++jMat )
831 if( matCC == fMaterialCutsCoupleVector[jMat] )
break;
833 if(jMat == fMaterialCutsCoupleVector.size() && jMat > 0) jMat--;
843 fPAIdEdxTable = fPAIdEdxBank[jMat];
844 fdEdxVector = fdEdxTable[jMat];
845 for(iTkin = 0; iTkin <= fTotBin; iTkin++)
847 if(scaledTkin < fProtonEnergyVector->GetLowEdgeEnergy(iTkin))
break;
850 if(iPlace < 0) iPlace = 0;
851 else if(iPlace > fTotBin) iPlace = fTotBin;
852 dEdx = charge2*( (*fdEdxVector)(iPlace) -
GetdEdxCut(iPlace,cut) );
854 if( dEdx < 0.) dEdx = 0.;
871 if(cutEnergy >= tmax)
return 0.0;
875 G4double charge2 = charge*charge, cross, cross1, cross2;
876 G4double photon1, photon2, plasmon1, plasmon2;
885 for (jMatCC = 0; jMatCC < numOfCouples; jMatCC++ )
889 if( jMatCC == numOfCouples && jMatCC > 0 ) jMatCC--;
891 const vector<G4double>* photonCutInKineticEnergy = theCoupleTable->
894 G4double photonCut = (*photonCutInKineticEnergy)[jMatCC];
896 for( jMat = 0;jMat < fMaterialCutsCoupleVector.size(); ++jMat )
898 if( matCC == fMaterialCutsCoupleVector[jMat] )
break;
900 if(jMat == fMaterialCutsCoupleVector.size() && jMat > 0) jMat--;
902 fPAItransferTable = fPAIxscBank[jMat];
903 fPAIphotonTable = fPAIphotonBank[jMat];
904 fPAIplasmonTable = fPAIplasmonBank[jMat];
906 for(iTkin = 0; iTkin <= fTotBin; iTkin++)
908 if(scaledTkin < fProtonEnergyVector->GetLowEdgeEnergy(iTkin))
break;
911 if(iPlace < 0) iPlace = 0;
921 cross1 = photon1 + plasmon1;
923 cross2 = photon2 + plasmon2;
925 cross = (cross2 - cross1)*charge2;
928 if( cross < 0. ) cross = 0.;
945 if(cutEnergy >= tmax)
return 0.0;
949 G4double charge2 = charge*charge, cross, cross1, cross2;
950 G4double photon1, photon2, plasmon1, plasmon2;
959 for (jMatCC = 0; jMatCC < numOfCouples; jMatCC++ )
963 if( jMatCC == numOfCouples && jMatCC > 0 ) jMatCC--;
969 for( jMat = 0;jMat < fMaterialCutsCoupleVector.size(); ++jMat )
971 if( matCC == fMaterialCutsCoupleVector[jMat] )
break;
973 if(jMat == fMaterialCutsCoupleVector.size() && jMat > 0) jMat--;
975 fPAItransferTable = fPAIxscBank[jMat];
976 fPAIphotonTable = fPAIphotonBank[jMat];
977 fPAIplasmonTable = fPAIplasmonBank[jMat];
979 for(iTkin = 0; iTkin <= fTotBin; iTkin++)
981 if(scaledTkin < fProtonEnergyVector->GetLowEdgeEnergy(iTkin))
break;
984 if(iPlace < 0) iPlace = 0;
994 cross1 = photon1 + plasmon1;
996 cross2 = photon2 + plasmon2;
998 cross = (cross2 - cross1)*charge2;
1001 if( cross < 0. ) cross = 0.;
1018 for( jMat = 0;jMat < fMaterialCutsCoupleVector.size(); ++jMat )
1020 if( matCC == fMaterialCutsCoupleVector[jMat] )
break;
1022 if( jMat == fMaterialCutsCoupleVector.size() && jMat > 0 ) jMat--;
1024 fPAItransferTable = fPAIxscBank[jMat];
1025 fPAIphotonTable = fPAIphotonBank[jMat];
1026 fPAIplasmonTable = fPAIplasmonBank[jMat];
1028 fdNdxCutVector = fdNdxCutTable[jMat];
1029 fdNdxCutPhotonVector = fdNdxCutPhotonTable[jMat];
1030 fdNdxCutPlasmonVector = fdNdxCutPlasmonTable[jMat];
1033 if( tmin >= tmax && fVerbose > 0)
1035 G4cout<<
"G4PAIPhotonModel::SampleSecondary: tmin >= tmax "<<
G4endl;
1042 G4double totalEnergy = kineticEnergy + particleMass;
1043 G4double pSquare = kineticEnergy*(totalEnergy+particleMass);
1046 for(iTkin=0;iTkin<=fTotBin;iTkin++)
1048 if(scaledTkin < fProtonEnergyVector->GetLowEdgeEnergy(iTkin))
break;
1050 G4int iPlace = iTkin - 1;
1051 if(iPlace < 0) iPlace = 0;
1053 G4double dNdxPhotonCut = (*fdNdxCutPhotonVector)(iPlace);
1054 G4double dNdxPlasmonCut = (*fdNdxCutPlasmonVector)(iPlace);
1055 G4double dNdxCut = dNdxPhotonCut + dNdxPlasmonCut;
1058 if (dNdxCut > 0.) ratio = dNdxPhotonCut/dNdxCut;
1064 iPlace, scaledTkin);
1068 if( deltaTkin <= 0. )
1070 G4cout<<
"G4PAIPhotonModel::SampleSecondary e- deltaTkin = "<<deltaTkin<<
G4endl;
1072 if( deltaTkin <= 0.)
return;
1074 if( deltaTkin >= kineticEnergy )
1076 deltaTkin = kineticEnergy;
1077 kineticEnergy = 0.0;
1080 G4double totalMomentum = sqrt(pSquare);
1082 /(deltaTotalMomentum * totalMomentum);
1084 if( costheta > 0.99999 ) costheta = 0.99999;
1086 G4double sin2 = 1. - costheta*costheta;
1087 if( sin2 > 0.) sintheta = sqrt(sin2);
1092 G4double dirx = sintheta*cos(phi), diry = sintheta*sin(phi), dirz = costheta;
1095 deltaDirection.
rotateUz(direction);
1097 if( kineticEnergy > 0.)
1099 kineticEnergy -= deltaTkin;
1100 G4ThreeVector dir = totalMomentum*direction - deltaTotalMomentum*deltaDirection;
1101 direction = dir.
unit();
1117 vdp->push_back(deltaRay);
1127 if( deltaTkin <= 0. )
1129 G4cout<<
"G4PAIPhotonModel::SampleSecondary gamma deltaTkin = "<<deltaTkin<<
G4endl;
1131 if( deltaTkin <= 0.)
return;
1133 if( deltaTkin >= kineticEnergy )
1135 deltaTkin = kineticEnergy;
1136 kineticEnergy = 0.0;
1139 G4double sintheta = sqrt((1.+costheta)*(1.-costheta));
1143 G4double dirx = sintheta*cos(phi), diry = sintheta*sin(phi), dirz = costheta;
1146 deltaDirection.
rotateUz(direction);
1148 if( kineticEnergy > 0.)
1150 kineticEnergy -= deltaTkin;
1165 vdp->push_back(photonRay);
1178 for( jMat = 0;jMat < fMaterialCutsCoupleVector.size(); ++jMat )
1180 if( matCC->
GetMaterial()->
GetName() == fMaterialCutsCoupleVector[jMat]->GetMaterial()->GetName() )
break;
1182 if( jMat == fMaterialCutsCoupleVector.size() && jMat > 0 ) jMat--;
1184 fPAItransferTable = fPAIxscBank[jMat];
1185 fPAIphotonTable = fPAIphotonBank[jMat];
1186 fPAIplasmonTable = fPAIplasmonBank[jMat];
1188 fdNdxCutVector = fdNdxCutTable[jMat];
1189 fdNdxCutPhotonVector = fdNdxCutPhotonTable[jMat];
1190 fdNdxCutPlasmonVector = fdNdxCutPlasmonTable[jMat];
1193 if( tmin >= tmax && fVerbose > 0)
1195 G4cout<<
"G4PAIPhotonModel::TestSecondaries: tmin >= tmax "<<
G4endl;
1202 G4double totalEnergy = kineticEnergy + particleMass;
1203 G4double pSquare = kineticEnergy*(totalEnergy+particleMass);
1206 for(iTkin=0;iTkin<=fTotBin;iTkin++)
1208 if(scaledTkin < fProtonEnergyVector->GetLowEdgeEnergy(iTkin))
break;
1210 G4int iPlace = iTkin - 1;
1211 if(iPlace < 0) iPlace = 0;
1213 G4double dNdxPhotonCut = (*fdNdxCutPhotonVector)(iPlace);
1214 G4double dNdxPlasmonCut = (*fdNdxCutPlasmonVector)(iPlace);
1215 G4double dNdxCut = dNdxPhotonCut + dNdxPlasmonCut;
1218 if (dNdxCut > 0.) ratio = dNdxPhotonCut/dNdxCut;
1224 iPlace, scaledTkin);
1228 if( deltaTkin <= 0. )
1230 G4cout<<
"G4PAIPhotonModel::SampleSecondary e- deltaTkin = "<<deltaTkin<<
G4endl;
1232 if( deltaTkin <= 0.)
return 0.;
1235 G4double totalMomentum = sqrt(pSquare);
1237 /(deltaTotalMomentum * totalMomentum);
1239 if( costheta > 0.99999 ) costheta = 0.99999;
1241 G4double sin2 = 1. - costheta*costheta;
1242 if( sin2 > 0.) sintheta = sqrt(sin2);
1247 G4double dirx = sintheta*cos(phi), diry = sintheta*sin(phi), dirz = costheta;
1250 deltaDirection.
rotateUz(direction);
1254 kineticEnergy -= deltaTkin;
1255 G4ThreeVector dir = totalMomentum*direction - deltaTotalMomentum*deltaDirection;
1256 direction = dir.
unit();
1274 if( deltaTkin <= 0. )
1276 G4cout<<
"G4PAIPhotonModel::SampleSecondary gamma deltaTkin = "<<deltaTkin<<
G4endl;
1278 if( deltaTkin <= 0.)
return 0.;
1281 G4double sintheta = sqrt((1.+costheta)*(1.-costheta));
1285 G4double dirx = sintheta*cos(phi), diry = sintheta*sin(phi), dirz = costheta;
1288 deltaDirection.
rotateUz(direction);
1291 kineticEnergy -= deltaTkin;
1319 G4int iTkin = iPlace+1, iTransfer;
1322 dNdxCut1 = (*pVector)(iPlace);
1326 if(iTkin == fTotBin)
1331 iTransfer <
G4int((*pTable)(iPlace)->GetVectorLength()); iTransfer++ )
1333 if(
position >= (*(*pTable)(iPlace))(iTransfer))
break;
1339 dNdxCut2 = (*pVector)(iPlace+1);
1345 iTransfer <
G4int((*pTable)(iPlace+1)->GetVectorLength()); iTransfer++ )
1347 if(
position >= (*(*pTable)(iPlace+1))(iTransfer))
break;
1356 W1 = (E2 - scaledTkin)*W;
1357 W2 = (scaledTkin - E1)*W;
1363 G4int iTrMax1, iTrMax2, iTrMax;
1365 iTrMax1 =
G4int((*pTable)(iPlace)->GetVectorLength());
1366 iTrMax2 =
G4int((*pTable)(iPlace+1)->GetVectorLength());
1368 if (iTrMax1 >= iTrMax2) iTrMax = iTrMax2;
1369 else iTrMax = iTrMax1;
1371 for( iTransfer = 0; iTransfer < iTrMax; iTransfer++ )
1374 ( (*(*pTable)(iPlace))(iTransfer)*W1 +
1375 (*(*pTable)(iPlace+1))(iTransfer)*W2) )
break;
1381 if( transfer < 0.0 ) transfer = 0.0;
1395 G4double x1, x2, y1, y2, energyTransfer;
1399 energyTransfer = (*pTable)(iPlace)->GetLowEdgeEnergy(iTransfer);
1403 iTransferMax =
G4int((*pTable)(iPlace)->GetVectorLength());
1405 if ( iTransfer >= iTransferMax) iTransfer = iTransferMax - 1;
1407 y1 = (*(*pTable)(iPlace))(iTransfer-1);
1408 y2 = (*(*pTable)(iPlace))(iTransfer);
1410 x1 = (*pTable)(iPlace)->GetLowEdgeEnergy(iTransfer-1);
1411 x2 = (*pTable)(iPlace)->GetLowEdgeEnergy(iTransfer);
1413 if ( x1 == x2 ) energyTransfer = x2;
1416 if ( y1 == y2 ) energyTransfer = x1 + (x2 - x1)*
G4UniformRand();
1419 energyTransfer = x1 + (position - y1)*(x2 - x1)/(y2 - y1);
1423 return energyTransfer;
1438 for(;jMat < fMaterialCutsCoupleVector.size(); ++jMat )
1440 if( matCC == fMaterialCutsCoupleVector[jMat] )
break;
1442 if(jMat == fMaterialCutsCoupleVector.size()) {
return eloss; }
1444 fPAItransferTable = fPAIxscBank[jMat];
1445 fPAIphotonTable = fPAIphotonBank[jMat];
1446 fPAIplasmonTable = fPAIplasmonBank[jMat];
1448 fdNdxCutVector = fdNdxCutTable[jMat];
1449 fdNdxCutPhotonVector = fdNdxCutPhotonTable[jMat];
1450 fdNdxCutPlasmonVector = fdNdxCutPlasmonTable[jMat];
1452 G4int iTkin, iPlace ;
1456 G4double loss, photonLoss, plasmonLoss, charge2;
1462 charge2 = charge*charge;
1463 G4double scaledTkin = Tkin*MassRatio;
1466 for( iTkin = 0; iTkin <= fTotBin; iTkin++)
1468 if(scaledTkin < fProtonEnergyVector->GetLowEdgeEnergy(iTkin))
break;
1471 if( iPlace < 0 ) iPlace = 0;
1474 iPlace,scaledTkin,step,cof);
1479 iPlace,scaledTkin,step,cof);
1483 loss = photonLoss + plasmonLoss;
1501 G4int iTkin = iPlace + 1, iTransfer;
1502 G4double loss = 0.,
position, E1, E2, W1, W2, W, dNdxCut1, dNdxCut2, meanNumber;
1504 G4long numOfCollisions=0;
1507 dNdxCut1 = (*pVector)(iPlace);
1511 if(iTkin == fTotBin)
1513 meanNumber = ((*(*pTable)(iPlace))(0) - dNdxCut1)*cof;
1514 if(meanNumber < 0.) meanNumber = 0.;
1516 if( meanNumber > 0.) lambda = step/meanNumber;
1521 stepSum += stepDelta;
1522 if(stepSum >= step)
break;
1528 while(numOfCollisions)
1534 iTransfer <
G4int((*pTable)(iPlace)->GetVectorLength()); iTransfer++ )
1536 if(
position >= (*(*pTable)(iPlace))(iTransfer))
break;
1544 dNdxCut2 = (*pVector)(iPlace+1);
1548 meanNumber = ((*(*pTable)(iPlace+1))(0) - dNdxCut2)*cof;
1549 if( meanNumber < 0. ) meanNumber = 0.;
1551 if( meanNumber > 0.) lambda = step/meanNumber;
1556 stepSum += stepDelta;
1557 if(stepSum >= step)
break;
1563 while(numOfCollisions)
1569 iTransfer <
G4int((*pTable)(iPlace+1)->GetVectorLength()); iTransfer++ )
1571 if(
position >= (*(*pTable)(iPlace+1))(iTransfer))
break;
1582 W1 = (E2 - scaledTkin)*W;
1583 W2 = (scaledTkin - E1)*W;
1590 meanNumber=( ((*(*pTable)(iPlace))(0)-dNdxCut1)*W1 +
1591 ((*(*pTable)(iPlace+1))(0)-dNdxCut2)*W2 )*cof;
1592 if(meanNumber<0.0) meanNumber = 0.0;
1594 if( meanNumber > 0.) lambda = step/meanNumber;
1599 stepSum += stepDelta;
1600 if(stepSum >= step)
break;
1606 while(numOfCollisions)
1608 position = dNdxCut1*W1 + dNdxCut2*W2 +
1609 ( ( (*(*pTable)(iPlace ))(0) - dNdxCut1)*W1 +
1611 ( (*(*pTable)(iPlace+1))(0) - dNdxCut2)*W2 )*
G4UniformRand();
1616 iTransfer <
G4int((*pTable)(iPlace)->GetVectorLength()); iTransfer++ )
1619 ( (*(*pTable)(iPlace))(iTransfer)*W1 +
1620 (*(*pTable)(iPlace+1))(iTransfer)*W2) )
1651 G4double etot = kineticEnergy + particleMass;
1652 G4double beta2 = kineticEnergy*(kineticEnergy + 2.0*particleMass)/(etot*etot);
1654 * electronDensity * q * q;
1678 if(p == fElectron) tmax *= 0.5;
1679 else if(p != fPositron)
1683 G4double gamma= kinEnergy/mass + 1.0;
1685 (1. + 2.0*gamma*ratio + ratio*ratio);
1694 fPAIRegionVector.push_back(r);
G4double TestSecondaries(G4MaterialCutsCouple *, G4DynamicParticle *, G4double tmin, G4double maxEnergy)
G4double GetdEdxCut(G4int iPlace, G4double transferCut)
ThreeVector shoot(const G4int Ap, const G4int Af)
const std::vector< G4double > * GetEnergyCutsVector(size_t pcIdx) const
G4ParticleChangeForLoss * GetParticleChangeForLoss()
void PutValue(size_t binNumber, G4double binValue, G4double dataValue)
G4double GetKineticEnergy() const
void ComputeSandiaPhotoAbsCof()
G4double GetXscPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double photonCut, G4double cutEnergy, G4double maxEnergy)
void DefineForRegion(const G4Region *r)
const G4String & GetName() const
G4double GetEnergyTransfer(G4PhysicsTable *, G4int iPlace, G4double position, G4int iTransfer)
G4double GetIntegralPlasmon(G4int i) const
virtual G4double ComputeDEDXPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy)
G4double GetSurfaceTolerance() const
static G4MaterialTable * GetMaterialTable()
std::vector< G4Material * > G4MaterialTable
G4double GetIntegralPAIxSection(G4int i) const
G4double GetdNdxPlasmonCut(G4int iPlace, G4double transferCut)
G4double GetSandiaMatTablePAI(G4int, G4int)
void SetMomentumDirection(const G4ThreeVector &aDirection)
G4ParticleDefinition * GetDefinition() const
G4double GetIntegralPAIdEdx(G4int i) const
G4double GetLowEdgeEnergy(size_t binNumber) const
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
G4int SandiaMixing(G4int Z[], const G4double *fractionW, G4int el, G4int mi)
void BuildLambdaVector(const G4MaterialCutsCouple *matCutsCouple)
const G4MaterialCutsCouple * CurrentCouple() const
G4GLOB_DLL std::ostream G4cout
virtual G4double CrossSectionPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy, G4double maxEnergy)
void BuildPAIonisationTable()
size_t GetTableSize() const
G4double GetElectronDensity() const
virtual void InitTest(const G4ParticleDefinition *, G4MaterialCutsCouple *, G4double, G4double)
G4int GetSplineSize() const
G4double GetdNdxPhotonCut(G4int iPlace, G4double transferCut)
const G4ThreeVector & GetMomentumDirection() const
G4double MaxSecondaryEnergy(const G4ParticleDefinition *, G4double kinEnergy)
Hep3Vector & rotateUz(const Hep3Vector &)
G4double GetCharge() const
G4double GetIntegralCerenkov(G4int i) const
void PutValue(size_t index, G4double theValue)
void SetProposedKineticEnergy(G4double proposedKinEnergy)
G4MaterialCutsCouple * FindCouple(G4Material *mat)
virtual G4double SampleFluctuations(const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double, G4double, G4double)
static size_t GetNumberOfMaterials()
void SetProposedMomentumDirection(const G4ThreeVector &dir)
G4double GetAlongStepTransfer(G4PhysicsTable *, G4PhysicsLogVector *, G4int iPlace, G4double scaledTkin, G4double step, G4double cof)
void SetKineticEnergy(G4double aEnergy)
G4int SandiaIntervals(G4int Z[], G4int el)
virtual G4double Dispersion(const G4Material *, const G4DynamicParticle *, G4double, G4double)
static G4ProductionCutsTable * GetProductionCutsTable()
static G4Positron * Positron()
G4double GetPDGMass() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
virtual ~G4PAIPhotonModel()
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
void Initialize(const G4Material *material, G4double maxEnergyTransfer, G4double betaGammaSq, G4SandiaTable *)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4double GetPhotoAbsorpCof(G4int i, G4int j) const
G4double GetdNdxCut(G4int iPlace, G4double transferCut)
void insertAt(size_t, G4PhysicsVector *)
G4double GetPDGSpin() const
static G4Electron * Electron()
G4PAIPhotonModel(const G4ParticleDefinition *p=0, const G4String &nam="PAIPhoton")
void ProposeTrackStatus(G4TrackStatus status)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4double GetPDGCharge() const
G4double GetPostStepTransfer(G4PhysicsTable *, G4PhysicsLogVector *, G4int iPlace, G4double scaledTkin)
static G4GeometryTolerance * GetInstance()
G4double GetMeanEnergyLoss() const
void Initialize(G4Material *)
G4double GetSplineEnergy(G4int i) const
const G4Material * GetMaterial() const