945{
947
954
959
960 G4double maximumEnergyTransfer1 = 0;
961 G4double maximumEnergyTransfer2 = 0;
962 G4double maximumEnergyTransferP = 4.* (electron_mass_c2 / proton_mass_c2) * k;
964
966 {
967
968 std::vector<double>::iterator k2 = std::upper_bound(eTdummyVec.begin(),
969 eTdummyVec.end(),
970 k);
971 std::vector<double>::iterator k1 = k2 - 1;
972
973
974
975
976
977
978
979
980
981
982
983
984
985 if (random <= eProbaShellMap[ionizationLevelIndex][(*k1)].back()
986 && random <= eProbaShellMap[ionizationLevelIndex][(*k2)].back())
987 {
988 std::vector<double>::iterator prob12 =
989 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
990 eProbaShellMap[ionizationLevelIndex][(*k1)].end(),
991 random);
992
993 std::vector<double>::iterator prob11 = prob12 - 1;
994
995 std::vector<double>::iterator prob22 =
996 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
997 eProbaShellMap[ionizationLevelIndex][(*k2)].end(),
998 random);
999
1000 std::vector<double>::iterator prob21 = prob22 - 1;
1001
1002 valueK1 = *k1;
1003 valueK2 = *k2;
1004 valuePROB21 = *prob21;
1005 valuePROB22 = *prob22;
1006 valuePROB12 = *prob12;
1007 valuePROB11 = *prob11;
1008
1009
1010
1011
1012
1013
1014
1016 else nrjTransf11 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
1017 if(valuePROB12 == 1)
1018 {
1019 if ((valueK1+bindingEnergy)/2. > valueK1) maximumEnergyTransfer1=valueK1;
1021
1022 nrjTransf12 = maximumEnergyTransfer1;
1023 }
1024 else nrjTransf12 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
1025
1027 else nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1028 if(valuePROB22 == 1)
1029 {
1030 if ((valueK2+bindingEnergy)/2. > valueK2) maximumEnergyTransfer2=valueK2;
1032
1033 nrjTransf22 = maximumEnergyTransfer2;
1034 }
1035 else nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051 }
1052
1053 if (random > eProbaShellMap[ionizationLevelIndex][(*k1)].back())
1054 {
1055 std::vector<double>::iterator prob22 =
1056 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1057 eProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1058 random);
1059
1060 std::vector<double>::iterator prob21 = prob22 - 1;
1061
1062 valueK1 = *k1;
1063 valueK2 = *k2;
1064 valuePROB21 = *prob21;
1065 valuePROB22 = *prob22;
1066
1067
1068
1069 nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1070 nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1071
1072 G4double interpolatedvalue2 = Interpolate(valuePROB21,
1073 valuePROB22,
1074 random,
1075 nrjTransf21,
1076 nrjTransf22);
1077
1078
1079
1080 G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092 return value;
1093 }
1094 }
1095
1097 {
1098
1099
1100 std::vector<double>::iterator k2 = std::upper_bound(pTdummyVec.begin(),
1101 pTdummyVec.end(),
1102 k);
1103
1104 std::vector<double>::iterator k1 = k2 - 1;
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119 if (random <= pProbaShellMap[ionizationLevelIndex][(*k1)].back()
1120 && random <= pProbaShellMap[ionizationLevelIndex][(*k2)].back())
1121 {
1122 std::vector<double>::iterator prob12 =
1123 std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
1124 pProbaShellMap[ionizationLevelIndex][(*k1)].end(),
1125 random);
1126
1127 std::vector<double>::iterator prob11 = prob12 - 1;
1128
1129 std::vector<double>::iterator prob22 =
1130 std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1131 pProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1132 random);
1133
1134 std::vector<double>::iterator prob21 = prob22 - 1;
1135
1136 valueK1 = *k1;
1137 valueK2 = *k2;
1138 valuePROB21 = *prob21;
1139 valuePROB22 = *prob22;
1140 valuePROB12 = *prob12;
1141 valuePROB11 = *prob11;
1142
1143
1144
1145
1146
1147
1148
1150 else nrjTransf11 = pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
1151 if(valuePROB12 == 1) nrjTransf12 = maximumEnergyTransferP;
1152 else nrjTransf12 = pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
1154 else nrjTransf21 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1155 if(valuePROB22 == 1) nrjTransf22 = maximumEnergyTransferP;
1156 else nrjTransf22 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171 }
1172
1173
1174
1175 if (random > pProbaShellMap[ionizationLevelIndex][(*k1)].back())
1176 {
1177 std::vector<double>::iterator prob22 =
1178 std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1179 pProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1180 random);
1181
1182 std::vector<double>::iterator prob21 = prob22 - 1;
1183
1184 valueK1 = *k1;
1185 valueK2 = *k2;
1186 valuePROB21 = *prob21;
1187 valuePROB22 = *prob22;
1188
1189
1190
1191 nrjTransf21 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1192 nrjTransf22 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1193
1194 G4double interpolatedvalue2 = Interpolate(valuePROB21,
1195 valuePROB22,
1196 random,
1197 nrjTransf21,
1198 nrjTransf22);
1199
1200
1201
1202 G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214 return value;
1215 }
1216 }
1217
1218
1219 G4double nrjTransfProduct = nrjTransf11 * nrjTransf12 * nrjTransf21
1220 * nrjTransf22;
1221
1222
1223 if (nrjTransfProduct != 0.)
1224 {
1225 nrj = QuadInterpolator(valuePROB11,
1226 valuePROB12,
1227 valuePROB21,
1228 valuePROB22,
1229 nrjTransf11,
1230 nrjTransf12,
1231 nrjTransf21,
1232 nrjTransf22,
1233 valueK1,
1234 valueK2,
1235 k,
1236 random);
1237 }
1238
1239
1240 return nrj;
1241}